<?xml version="1.0"?>
<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/"
	>
   <channel>
      <pubDate>Thu, 4 Dec 2008 04:56:07 GMT</pubDate>
      <lastBuildDate>Thu, 4 Dec 2008 04:56:07 GMT</lastBuildDate>
      <language>en</language>
      <docs>http://www.rssboard.org/rss-specification</docs>
      <title>CrunchBang ~ scripts</title>
      <link>http://crunchbang.org/tags/scripts/</link>
      <description>Code, Design &amp; GNU/Linux</description>

<item>
    <title>TwitterZoid PHP Script</title>
    <link>http://crunchbang.org/archives/2008/02/20/twitterzoid-php-script/</link>
    <pubDate>Wed, 20 Feb 2008 02:16:55 GMT</pubDate>
    <dc:creator>Philip Newborough</dc:creator>
    <guid>http://crunchbang.org/archives/2008/02/20/twitterzoid-php-script/</guid>
    <description><![CDATA[
    <p>It&#39;s a rather silly name, I know; however, TwitterZoid is the chosen name of my PHP script for parsing Twitter RSS feeds. I&#39;ve been using <a href="http://twitter.com/ " title="Twitter - What are you doing?">Twitter</a> quite steadily for a couple of weeks now and I thought it might be nice to include <a href="http://crunchbang.org/what-am-i-doing/ " title="What am I doing?">my latest tweets on my blog</a>, so I wrote TwitterZoid to do just that.</p>

<p>TwitterZoid differs to other PHP based Twitter RSS parsers, <em>at least the ones I tried before I wrote it</em>, in that it will automatically link both <a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=63 " title="Back @ you baby! Or: What does @username do?">lexicons</a> and URLs found within individual tweets. It also tries to mimic Twitter&#39;s timestamping, although this could be improved.</p>

<h3>TwitterZoid usage</h3>

<p>I wanted to make TwitterZoid as simple to use as possible. Therefore I decided to write the script to be used as a simple include file which can be used on any PHP page. Basically, to use TwitterZoid all you need to do is set a couple of variables, include <code>twitterzoid.php</code> and then <code>echo</code> the main <code>$TwitterZoid</code> variable where you would like your list of tweets to appear.</p>

<h4>Example set-up:</h4>

<pre><code>$twitter_username = "corenominal";
$twitter_feed = "http://twitter.com/statuses/user_timeline/99713.rss";
require_once('twitterzoid.php');
</code></pre>

<h4>Call on the main TwitterZoid variable to produce the list of tweets:</h4>

<pre><code>echo $TwitterZoid;
</code></pre>

<p>Don&#39;t worry if this reads like gibberish, I&#39;ve included an example page within the download.</p>

<h3>TwitterZoid examples</h3>

<p>There are currently two demonstrations of TwitterZoid in action, see:</p>

<p>My official &#34;What am I doing?&#34; Twitter page:<br />
<a href="http://crunchbang.org/what-am-i-doing/ " title="What am I doing?">http://crunchbang.org/what-am-i-doing/</a></p>

<p>A more stylised version of &#34;What am I doing?&#34;, included within the download:<br />
<a href="http://crunchbang.org/projects/twitterzoid/demo/ " title="What am I doing? - demo version included with download.">http://crunchbang.org/projects/twitterzoid/demo/</a></p>

<h3>Download TwitterZoid</h3>

<p><strong>Location:</strong> <a href="http://crunchbang.org/projects/twitterzoid/twitterzoid-0.1.tar.gz " title="Download TwitterZoid">http://crunchbang.org/projects/twitterzoid/twitterzoid-0.1.tar.gz</a><br />
<strong>MD5:</strong> 99dace9f9872cf1ebf93588bb2d36458</p>

<h3>TwitterZoid license</h3>

<p>This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.</p>

<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.</p>

<p><a href="http://www.gnu.org/licenses/ " title="GNU General Public License">http://www.gnu.org/licenses/</a></p>

    <p style="font-size:smaller;">Tags: <a href="http://crunchbang.org/tags/code/" title="Browse all posts tagged with &#8220;code&#8221;">code</a>, <a href="http://crunchbang.org/tags/php/" title="Browse all posts tagged with &#8220;php&#8221;">php</a>, <a href="http://crunchbang.org/tags/projects/" title="Browse all posts tagged with &#8220;projects&#8221;">projects</a>, <a href="http://crunchbang.org/tags/scripts/" title="Browse all posts tagged with &#8220;scripts&#8221;">scripts</a>, <a href="http://crunchbang.org/tags/twitter/" title="Browse all posts tagged with &#8220;twitter&#8221;">twitter</a>, <a href="http://crunchbang.org/tags/webdesign/" title="Browse all posts tagged with &#8220;webdesign&#8221;">webdesign</a></p>
    ]]></description>
</item>

<item>
    <title>User Agent Sniffer</title>
    <link>http://crunchbang.org/archives/2007/10/18/user-agent-sniffer/</link>
    <pubDate>Thu, 18 Oct 2007 08:52:21 GMT</pubDate>
    <dc:creator>Philip Newborough</dc:creator>
    <guid>http://crunchbang.org/archives/2007/10/18/user-agent-sniffer/</guid>
    <description><![CDATA[
    <p>I&#39;ve currently got several web projects at various stages of development. One thing that all of these projects have in common is that they all capture and manipulate user-agent stings.</p>

<h3>What are user-agent strings?</h3>

<p>User-agents strings are used by client applications such as web browsers, feed readers, bots and other software to identify themselves to the servers they are connecting to. The strings contain important information such as application type, version, language and operating system. A typical user-agent string might look like this:</p>

<pre><code>Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.7 (like Gecko) (Kubuntu)
</code></pre>

<p>The above example is used to identify that the client is a Mozilla compatible Konqueror web browser running on Kubuntu Linux.</p>

<h3>Collecting user-agent strings</h3>

<p>To run tests on my projects I need some sample data to play around with [<em>a list or database table of user-agent strings.</em>] I figured that the best way to get this sample data would be to collect some user-agent strings from the wild. So, I wrote a quick PHP script to do just that.</p>

<p>I ran the script on this site [<em>crunchbang.org</em>] for ten days, starting on October 7th 2007. During that ten day period the script captured a total of 2272 unique user-agent strings. The captured list included both standard and non-standard strings.</p>

<h3>A few facts about user-agent strings</h3>

<p>After capturing the list I then edited the PHP script so that it would report a few facts. Here is a breakdown of what was returned:</p>

<p><strong>1.</strong> At just 6 characters in length the shortest user-agent string captured was:</p>

<pre><code>NG/2.0
</code></pre>

<p><strong>2.</strong> The longest measured in at 205 characters, it was:</p>

<pre><code>Mozilla/5.0 (compatible; MSIE 7.0; Windows; HTMLAB; .NET CLR 1.1.4322; 
MEGAUPLOAD 1.0; Seekmo; ZangoToolbar4.8.2; Alexa Toolbar; Hotbar 4.2.8.0) (compatible; 
Googlebot/2.1; +http://www.google.com/bot.html)
</code></pre>

<p><strong>3.</strong> The average computed length of the user-agent strings was 91.2750880282 characters.</p>

<p><strong>4.</strong> Most strings contained some non-alphanumeric characters, these were:</p>

<pre><code>/ . ( ; - : ) + _ ! = , @ &amp;  ' [ ] * ~ ? { }
</code></pre>

<p><strong>5.</strong> The strangest user-agent string was:</p>

<pre><code>Mmm.... Brains....
</code></pre>

<h3>View the whole report</h3>

<p>You can view the whole report here: <a href="http://crunchbang.org/misc/user-agent-report-2007-10-17.txt " title="View the User Agent Sniffer report.">http://crunchbang.org/misc/user-agent-report-2007-10-17.txt</a></p>

<h3>Get the sample data</h3>

<p>I thought it would be good to share the sample data. There&#39;s no private or confidential information in the data and I figure it may come in handy for other developers working on similar projects.</p>

<p>You can get the data as an ASCII file [<em>one user-agent string per line</em>] here: <a href="http://crunchbang.org/misc/sample-user-agents-ascii.txt " title="Get the sample data as a flat ascii file.">http://crunchbang.org/misc/sample-user-agents-ascii.txt</a></p>

<p>Or, as an SQL statement here: <a href="http://crunchbang.org/misc/sample-user-agents-mysql.txt " title="Insert the sample data into a MySQL database using this SQL statement.">http://crunchbang.org/misc/sample-user-agents-mysql.txt</a></p>

<h3>Get the PHP script</h3>

<p>If you fancy having a go at collecting your own samples you can grab my PHP script here: <a href="http://crunchbang.org/misc/ua-sniffer.txt " title="Get the User Agent Sniffer PHP script.">http://crunchbang.org/misc/ua-sniffer.txt</a></p>

<p>The script requires the use of MySQL. Other than that it&#39;s a fairly straightforward affair. Just edit the four settings to define your database name, address, username and password.</p>

<p>I ran the script by calling it with a <code>require_once</code> statement. Note that the script also sets and reads a cookie so you&#39;ll need to call on it before outputting any data to the client.</p>

<pre><code>require_once("ua-sniffer.php");
</code></pre>

<p>Once the script has collected some user-agent strings it is possible to query it and have it produce a basic report. You can do this by accessing the script through your browser like so:</p>

<pre><code>http://www.example.com/ua-sniffer.php?report=true
</code></pre>

<h3>Links to external references</h3>

<ul>
<li><a href="http://en.wikipedia.org/wiki/User_agent " title="User Agent article on Wikipedia">User Agent article on Wikipedia</a></li>
<li><a href="http://www.user-agents.org/ " title="List of User-Agents at user-agents.org">List of User-Agents at user-agents.org</a></li>
<li><a href="http://www.zytrax.com/tech/web/browser_ids.htm " title="Browser ID strings at zytrax.com">Another list of browser ID strings</a></li>
<li><a href="http://www.useragentstring.com/ " title="User agent string analysis">User agent string analysis</a></li>
</ul>

    <p style="font-size:smaller;">Tags: <a href="http://crunchbang.org/tags/code/" title="Browse all posts tagged with &#8220;code&#8221;">code</a>, <a href="http://crunchbang.org/tags/php/" title="Browse all posts tagged with &#8220;php&#8221;">php</a>, <a href="http://crunchbang.org/tags/programming/" title="Browse all posts tagged with &#8220;programming&#8221;">programming</a>, <a href="http://crunchbang.org/tags/projects/" title="Browse all posts tagged with &#8220;projects&#8221;">projects</a>, <a href="http://crunchbang.org/tags/scripts/" title="Browse all posts tagged with &#8220;scripts&#8221;">scripts</a></p>
    ]]></description>
</item>

 </channel>
</rss>