<?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>Lifeline Blog&#187; Tutorials</title>
	<atom:link href="http://www.lifelinedesign.ca/blog/category/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lifelinedesign.ca/blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Fri, 19 Aug 2011 21:22:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Instructing web spiders with a robots.txt file</title>
		<link>http://www.lifelinedesign.ca/blog/2011/04/instructing-web-spiders-with-a-robots-txt-file/</link>
		<comments>http://www.lifelinedesign.ca/blog/2011/04/instructing-web-spiders-with-a-robots-txt-file/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 13:00:35 +0000</pubDate>
		<dc:creator>Sebastian</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.lifelinedesign.ca/blog/?p=879</guid>
		<description><![CDATA[Most sites have several pages you want to keep out of the reach of search engines. For example, there is no need to clutter Google’s results pages with your login pages or other  private pages. You can easily “tell” spiders the pages they are to stay away from with a robots.txt file. A basic robots.txt [...]]]></description>
			<content:encoded><![CDATA[<p>Most sites have several pages you want to keep out of the reach of search engines. For example, there is no need to clutter Google’s results pages with your login pages or other  private pages. You can easily “tell” spiders the pages they are to stay away from with a robots.txt file.</p>
<h2>A basic robots.txt</h2>
<p>When a crawler visits your site, it first looks for a robots.txt file placed in the root of your domain that instructs it on which pages it should ignore. Such a file is made of one or more records, and each must contain a line to address a certain user agent followed by one or more Disallow lines. The syntax is therefore trivial – you don’t need to learn more than these two directives. For example, a robots.txt file made of</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:535px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">User-agent: googlebot<br />
Disallow: /login.php<br />
Disallow: /admin</div></div>
<p>would tell Google Bot not to crawl neither <span style="text-decoration: underline;">http://yourdomain.com/login.php</span> nor <span style="text-decoration: underline;">http://yourdomain.com/admin</span>.</p>
<h2>Wildcards – not so wild</h2>
<p>User agents may be matched by a wildcard. Instead of having a User-agent: spidername section for each crawler, you can instruct them all to follow the subsequent Disallow lines by using User-agent: *. The star symbol matches any number of characters – so “spider*” can stand for “spider A”, “spiderFromSomeSite” or “spiderFromThatOtherSite”. A question mark would match one character, so “spider?” will work for “spiderA”, “spiderB”, but not “spider X”.</p>
<h2>Follow the syntax strictly</h2>
<p>Robots.txt can be picky with syntaxes, so make sure you follow the structure:</p>
<ul>
<li>Don’t mix and match. User-agent comes before Disallow, it won’t work if you put them the other way around.</li>
<li>Don’t use more than one URL in the Disallow line. “Disallow: /path1 /path2 /path3” won’t work; you are to put each path under its own Disallow rule.</li>
<li>Keep case sensitivity in mind. “/path1” and “/Path1” are two different URLs.</li>
<li>Inline comments don’t work. You might be used to placing comments after a “#” sign at the end of the row from Perl, PHP or shell scripting. With robots.txt, each comment has to be on its own line. For example, “Disallow: /admin # don’t index /admin” might confuse some spiders who will be looking for a “/admin#don’t” folder.</li>
<li>There is no “Allow” directive. As outlined in the beginning, the syntax of a robots.txt file is as easy as it can get. To allow spiders to index every file, simply place an empty Disallow line.</li>
</ul>
<h2>Beware of sensitive information</h2>
<p>As a final note, remember that you shouldn&#8217;t use robots.txt to keep spiders from accessing overly sensitive information. Just because a standards-compliant web spider won’t access it, it doesn’t mean a malicious one (or even a human user) can’t or won’t. Such a setting is a no-no:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:535px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">User-agent: *<br />
Disallow: /admin/passwords.txt</div></div>
<p>Sensitive information such as users and passwords should be placed outside your htdocs path. Just because Google won’t crawl your passwords.txt file it doesn’t mean a malicious user won’t open up /admin/passwords.txt in a browser and read your “hidden” content.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lifelinedesign.ca/blog/2011/04/instructing-web-spiders-with-a-robots-txt-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building a simple RSS feed reader with PHP</title>
		<link>http://www.lifelinedesign.ca/blog/2011/01/building-a-simple-rss-feed-reader-with-php/</link>
		<comments>http://www.lifelinedesign.ca/blog/2011/01/building-a-simple-rss-feed-reader-with-php/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 13:00:38 +0000</pubDate>
		<dc:creator>Sebastian</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.lifelinedesign.ca/blog/?p=769</guid>
		<description><![CDATA[If you aren&#8217;t already familiar with what RSS stands for then I would highly advise you to have a look at this great article on ProBlogger, then get back to read the rest of the entry. In this article I will also assume you are more or less familiar with Object Oriented Programming and you know some [...]]]></description>
			<content:encoded><![CDATA[<p>If you aren&#8217;t already familiar with what RSS stands for then I would highly advise you to have a look at <a href="http://www.problogger.net/what-is-rss/" target="_blank">this great article</a> on ProBlogger, then get back to read the rest of the entry. In this article I will also assume you are more or less familiar with Object Oriented Programming and you know some PHP.</p>
<p>Back in the days of PHP 4.x reading an RSS stream would have involved opening a TCP connection to the URI, reading the content and parsing it with an endless stream of regular expressions. PHP 5 allows you to do it seamlessly in a few lines of code with the help of <a href="http://php.net/simplexml_load_file" target="_blank">simplexml_load_file()</a>.</p>
<h2>Prerequisites</h2>
<p>You will need the <em>libxml</em> extension installed. To check for it, point your browser to the <em>phpinfo </em>page and look for something similar to the image below:</p>
<p><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="image" src="http://www.lifelinedesign.ca/blog/wp-content/uploads/2010/12/image.png" border="0" alt="image" width="520" height="133" /></p>
<p>If the extension is not enabled, you will need to recompile PHP with the <em>&#8211;enable-libxml</em> argument (or ask your web hosting provider to set it up for you if you are on a shared host). Also, since you will be opening remote XML feeds, you will need <em>allow_url_fopen = on </em>in your <em>php.ini </em>file.</p>
<h2>Reading the remote feed with simplexml_load_file()</h2>
<p>Getting the RSS feed is as simple as</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:535px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$rss</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/simplexml_load_file"><span style="color: #990000;">simplexml_load_file</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
<p>For this example, we will be using the <a href="http://www.lifelinedesign.ca/blog/feed/" target="_blank">Lifeline Design feed</a>. Provided there are no errors, <em>$rss </em>is now a <em>SimpleXMLElement </em>object, with one property we are interested in: <em>$rss-&gt;channel </em>contains all information in the RSS feed. <em>$rss-&gt;channel </em>is a <em>SimpleXMLElement </em>object as well, with the following properties:</p>
<ul>
<li><em>title:</em> The title of the blog—the one that you see at the very top of your browser window when you open the front page. In our case, it will be “<em>Lifeline Blog.”</em></li>
<li><em>link:</em> The URL of the blog—”<em>http://www.lifelinedesign.ca/blog”</em></li>
<li><em>description:</em> Description of the site. It might not be relevant for the blog, since a lot of WordPress themes don’t take it into account. With LLD, the description is the standard “<em>Just another WordPress weblog.”</em></li>
<li><em>lastBuildDate:</em> The time and date of the last update, namely the latest post published.</li>
<li><em>generator:</em> Usually the name and version of the script the site is running on. With WordPress blogs, this string is usually in the form of “<em>http://wordpress.org/?v=x.x.x”</em></li>
<li><em>language:</em> The language the site runs on, in <a href="http://en.wikipedia.org/wiki/Locale" target="_blank">locale</a> format.</li>
<li><em>item:</em> An array containing the posts offered in the RSS feed.</li>
</ul>
<p>To get the actual posts, you will need to loop through the <em>$rss-&gt;channel-&gt;item</em> object, which is also an instance of <em>SimpleXMLElement</em>, and read the following properties:</p>
<ul>
<li><em>title:</em> the title of the article;</li>
<li><em>link:</em> the Permalink to the post;</li>
<li><em>comments:</em> the URL for comments on the article (with most WordPress installations this would be <em>http://example.com/permalink-to-article/#comments</em>)</li>
<li><em>pubDate:</em> self-explanatory, the date and time when the article was published;</li>
<li><em>category:</em> a <em>SimpleXMLElement</em> object with the category under which the article lies;</li>
<li><em>guid:</em> the URL of the article in standard canonical format <em>(http://example.com/?p=article_id);</em></li>
<li><em>description:</em> depending on the settings on that site, this will contain either a preview or the full article.</li>
</ul>
<h2>The code</h2>
<p>As outlined in the beginning, as little as a few lines of code can do the job:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:535px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$rss</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/simplexml_load_file"><span style="color: #990000;">simplexml_load_file</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://www.lifelinedesign.ca/blog/feed/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$rss</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;h1&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$rss</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">channel</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/h1&gt;'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//channel title, aka the name of the blog</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Last updated on: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$rss</span><span style="color: #339933;">&gt;</span>channel<span style="color: #339933;">-&gt;</span><span style="color: #004000;">lastBuildDate</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//date of the last post</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;ul&gt;'</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$rss</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">channel</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$item</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//loop through the articles</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt;&lt;a href=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$item</span><span style="color: #339933;">-&gt;</span><a href="http://www.php.net/link"><span style="color: #990000;">link</span></a> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//title and link</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">' ('</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pubDate</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">')'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//publishing date</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;br /&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">description</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/li&gt;'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//contents</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/ul&gt;'</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
<p>Of course, there is still room for improvement (for example, if there is no feed at that URL, libxml will throw a set of nasty warnings), yet the code can be used to jumpstart your own RSS reader.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lifelinedesign.ca/blog/2011/01/building-a-simple-rss-feed-reader-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make Your Own Branded G1 Wallpaper</title>
		<link>http://www.lifelinedesign.ca/blog/2010/02/make-your-own-branded-g1-wallpaper/</link>
		<comments>http://www.lifelinedesign.ca/blog/2010/02/make-your-own-branded-g1-wallpaper/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 15:57:50 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.lifelinedesign.ca/blog/?p=298</guid>
		<description><![CDATA[The HTC Dream, also known as the T-Mobile G1 in the States, was the first commercially available Android mobile phone. It only recently came here to Canada, and was our (Lifeline&#8217;s) handset of choice when we recently upgraded from Blackberries.  The HTC Dream has streamlined a lot of mobile processes for us and saved us [...]]]></description>
			<content:encoded><![CDATA[<p>The HTC Dream, also known as the T-Mobile G1 in the States, was the first commercially available Android mobile phone. It only recently came here to Canada, and was our (Lifeline&#8217;s) handset of choice when we recently upgraded from Blackberries.  The HTC Dream has streamlined a lot of mobile processes for us and saved us significant costs on our monthly bills, mainly because we already use Google Apps for email and calendar scheduling.  We highly recommend Google Apps as an email / collaboration tool, but that&#8217;s a topic for  an entirely different blog post.  Getting a new phone isn&#8217;t all work and no play though,  if you&#8217;re a geek like me&#8230; half the fun is setting up your new phone and finding out what new features can help your productivity.</p>
<p>Yesterday evening, I decided to &#8220;brand&#8221; my phone to Lifeline a bit more, and made a custom wallpaper for the phone:</p>
<div align="center"><img title="mybg" src="http://www.lifelinedesign.ca/blog/wp-content/uploads/2010/02/mybg.jpg" alt="mybg" width="322" height="480" align="center" /></div>
<p>When two rows of icons are setup, the logo fits nicely between them. I&#8217;m pretty happy with my handiwork, but it got me thinking that maybe other people out there would like to create a background for their G1 with their company logo on it, so I&#8217;ve created a Photoshop source file along with some explanation below to show you how to create your own!</p>
<p>First of all, take a look at the image below, it&#8217;s a picture of the source file (not to scale):</p>
<div align="center"><img title="explanation" src="http://www.lifelinedesign.ca/blog/wp-content/uploads/2010/02/explanation.jpg" alt="explanation" width="480" height="360" align="center" /></div>
<p>In the actual source file, the coloured lines are just set up as guides, but for the example image I&#8217;ve coloured them to help make the explanation easier.</p>
<p>The red line is the middle of the entire wallpaper, so you&#8217;d want your logo to be centered horizontally on this line. The while lines represent the edge of the main screen. If you have an HTC-Dream, you&#8217;ll know that you can switch to alternate pages of icons on the left and right. For example, if I switched to the alternate icon page on the left side, then the phone would display from the left edge of the image all the way to the red line in the center.</p>
<p>The green lines represent the vertical space you&#8217;ll want to fit your logo in to allow a row of icons above and below your logo without obstructing or crowding it. So, you&#8217;ll want to fit your logo in the area shaded blue.  The Photoshop file has a black background currently, but feel free to change it to anything you&#8217;d like! You can download it by <a href="http://www.lifelinedesign.ca/blog/wp-content/downloads/lifelineg1.zip">clicking here</a>.</p>
<p>Have fun making your own HTC-Dream wallpapers!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lifelinedesign.ca/blog/2010/02/make-your-own-branded-g1-wallpaper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

