<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>Dr. Andrew J. Page - Coding</title>
    <link>http://andrewjpage.com/</link>
    <description>Distributed Computing Blog</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.4.1 - http://www.s9y.org/</generator>
    <ttl>1440</ttl>
<pubDate>Tue, 16 Jun 2009 15:34:04 GMT</pubDate>

    <image>
        <url>http://www.minds.may.ie/~page/images/pagehead.png</url>
        <title>RSS: Dr. Andrew J. Page - Coding - Distributed Computing Blog</title>
        <link>http://andrewjpage.com/</link>
        <width>45</width>
        <height>61</height>
    </image>

<item>
    <title>Variations of JSON results from Search Engine APIs</title>
    <link>http://andrewjpage.com/index.php?/archives/121-Variations-of-JSON-results-from-Search-Engine-APIs.html</link>
            <category>Coding</category>
    
    <comments>http://andrewjpage.com/index.php?/archives/121-Variations-of-JSON-results-from-Search-Engine-APIs.html#comments</comments>
    <wfw:comment>http://andrewjpage.com/wfwcomment.php?cid=121</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://andrewjpage.com/rss.php?version=2.0&amp;type=comments&amp;cid=121</wfw:commentRss>
    

    <author>nospam@example.com (Andrew Page)</author>
    <content:encoded>
    I&#039;m retrieving the search engine count estimates for queries from Bing, Google and Yahoo, using the APIs for each and getting back JSON formatted results. You&#039;d think its easy, but think again.  The problem is that each search engine has a different format with different interpretations of the JSON spec.  For example, the total number of hits (search engine count estimate) for a query is called &quot;Total&quot; by Bing, &quot;estimatedResultCount&quot; by Google and &quot;deephits&quot; by Yahoo.  It gets worse, Bing returns a integer value (correct) while Yahoo and Google return a string containing an integer (not so correct).  Hopefully in the future there will be a single standard format for interacting with a search engine, however its a very very long way off.  
    </content:encoded>

    <pubDate>Mon, 06 Jul 2009 06:53:27 +0000</pubDate>
    <guid isPermaLink="false">http://andrewjpage.com/index.php?/archives/121-guid.html</guid>
    
</item>
<item>
    <title>Automating searching with Google, Bing and Yahoo</title>
    <link>http://andrewjpage.com/index.php?/archives/120-Automating-searching-with-Google,-Bing-and-Yahoo.html</link>
            <category>Coding</category>
    
    <comments>http://andrewjpage.com/index.php?/archives/120-Automating-searching-with-Google,-Bing-and-Yahoo.html#comments</comments>
    <wfw:comment>http://andrewjpage.com/wfwcomment.php?cid=120</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://andrewjpage.com/rss.php?version=2.0&amp;type=comments&amp;cid=120</wfw:commentRss>
    

    <author>nospam@example.com (Andrew Page)</author>
    <content:encoded>
    &lt;p&gt;Some observations on using the search APIs for the 3 major search engines, Google, Bing and Yahoo.  By far the best I&#039;ve found is Bing, followed by Yahoo, and lastly Google.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;To perform a search for Ireland:&lt;/p&gt;&lt;ul&gt;&lt;br /&gt;
&lt;li&gt;&lt;a href=&quot;http://api.search.live.net/json.aspx?AppId=YourAPIKey&amp;Query=Ireland&amp;Sources=Web&amp;Web.Count=64&amp;Web.Offset=0&quot;&gt;http://api.search.live.net/json.aspx?AppId=YourAPIKey&amp;Query=Ireland&amp;Sources=Web&amp;Web.Count=64&amp;Web.Offset=0&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://boss.yahooapis.com/ysearch/web/v1/Ireland?appid=YourAPIKey&amp;format=json&amp;count=64&amp;start=0&quot;&gt;http://boss.yahooapis.com/ysearch/web/v1/Ireland?appid=YourAPIKey&amp;format=json&amp;count=64&amp;start=0&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://ajax.googleapis.com/ajax/services/search/web?v=1.0&amp;q=Ireland&amp;rsz=large&amp;start=0&quot;&gt;http://ajax.googleapis.com/ajax/services/search/web?v=1.0&amp;q=Ireland&amp;rsz=large&amp;start=0&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;p&gt;For Bing and Yahoo you need to sign up for an API key.  It only takes 2 minutes. Google doesnt need an API key. All can return JSON formatted search results (also XML), however each has a proprietary format.  All search engines have removed limits on the number of queries you can submit.  Bing and Yahoo dont place limits on the number of results that can be returned from a single query, however Google limits you to 64 results for a general search (other searches are more limited).  The &#039;rsz&#039; parameter for Google can be small (4 results) or large (8 results).  To retrieve more results for all you can apply an offset, which is the last parameter for each.  Overall the search APIs have improved massively over the past year. All thats really missing is a unified search syntax and result set. &lt;/p&gt; 
    </content:encoded>

    <pubDate>Mon, 29 Jun 2009 21:36:18 +0000</pubDate>
    <guid isPermaLink="false">http://andrewjpage.com/index.php?/archives/120-guid.html</guid>
    
</item>
<item>
    <title>Analysing Reddit</title>
    <link>http://andrewjpage.com/index.php?/archives/119-Analysing-Reddit.html</link>
            <category>Coding</category>
    
    <comments>http://andrewjpage.com/index.php?/archives/119-Analysing-Reddit.html#comments</comments>
    <wfw:comment>http://andrewjpage.com/wfwcomment.php?cid=119</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://andrewjpage.com/rss.php?version=2.0&amp;type=comments&amp;cid=119</wfw:commentRss>
    

    <author>nospam@example.com (Andrew Page)</author>
    <content:encoded>
    Using data I collected from &lt;a href=&quot;http://reddit.com&quot;&gt;Reddit&lt;/a&gt; for &lt;a href=&quot;http://reddittrends.com&quot;&gt;RedditTrends&lt;/a&gt; I found some interesting spikes in the number of votes submitted articles receive.  &lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://reddittrends.com&quot;&gt;&lt;img src=&quot;images/upvotes.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
This graph shows the sum total of UP votes received per day by submitted links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://reddittrends.com&quot;&gt;&lt;img src=&quot;images/downvotes.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
This graph shows the sum total of DOWN votes received per day by submitted links.&lt;br /&gt;
&lt;br /&gt;
As you can see, the graphs are normally quite static, but have huge spikes every now and again, which are massively out of kilter with the normal every day average.   &lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://reddittrends.com&quot;&gt;&lt;img src=&quot;images/score.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
This graph shows the total score achieved which should be = UP votes - DOWN votes. On one positive note, users of Reddit are twice as likely to UP vote a link than to DOWN vote a link.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://reddittrends.com&quot;&gt;&lt;img src=&quot;images/comments.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
When this is compared to the total number of comments its clear to see that the spike around January is a natural one. It seems to correspond with Obamas election and inauguration. &lt;br /&gt;
&lt;br /&gt;
The huge spike on 24th of April was effectively a &lt;a href=&quot;http://www.reddit.com/r/reddit.com/comments/8fa3q/it_is_fucking_high_time_that_we_have_an_option_on/&quot;&gt;revolt on Reddit over the number of duplicate stories&lt;/a&gt;. Dozens of links got vast numbers of UP and DOWN votes, mostly with the same title.  &lt;br /&gt;
 
    </content:encoded>

    <pubDate>Tue, 16 Jun 2009 15:34:04 +0000</pubDate>
    <guid isPermaLink="false">http://andrewjpage.com/index.php?/archives/119-guid.html</guid>
    
</item>
<item>
    <title>RedditTrends.com - tracking Reddit submissions</title>
    <link>http://andrewjpage.com/index.php?/archives/118-RedditTrends.com-tracking-Reddit-submissions.html</link>
            <category>Coding</category>
    
    <comments>http://andrewjpage.com/index.php?/archives/118-RedditTrends.com-tracking-Reddit-submissions.html#comments</comments>
    <wfw:comment>http://andrewjpage.com/wfwcomment.php?cid=118</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://andrewjpage.com/rss.php?version=2.0&amp;type=comments&amp;cid=118</wfw:commentRss>
    

    <author>nospam@example.com (Andrew Page)</author>
    <content:encoded>
    As an extension to &lt;a href=&quot;http://predictreddit.com&quot;&gt;PredictReddit&lt;/a&gt; I&#039;ve created &lt;a href=&quot;http://reddittrends.com&quot;&gt;RedditTrends.com&lt;/a&gt;. Its kind of like Google trends except for Reddit submissions.  Its just an early work in progress but looks interesting and produces pretty graphs.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Pandemic&lt;/h2&gt;&lt;br /&gt;
&lt;a href=&quot;http://reddittrends.com/index/tag?word=mexico&amp;time=lastyear&quot;&gt;&lt;img src=&quot;pandemic.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Obama&lt;/h2&gt;&lt;br /&gt;
&lt;a href=&quot;http://reddittrends.com/index/tag?word=obama&amp;time=lastyear&quot;&gt;&lt;img src=&quot;obama.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Mexico&lt;/h2&gt;&lt;br /&gt;
&lt;a href=&quot;http://reddittrends.com/index/tag?word=mexico&amp;time=lastyear&quot;&gt;&lt;img src=&quot;mexico.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Graphs are produced using &lt;a href=&quot;http://code.google.com/p/flot/&quot;&gt;flot&lt;/a&gt; (jQuery). The backend runs the &lt;a href=&quot;http://framework.zend.com/&quot;&gt;Zend framework&lt;/a&gt; (PHP) and MySQL. 
    </content:encoded>

    <pubDate>Sun, 03 May 2009 16:44:11 +0000</pubDate>
    <guid isPermaLink="false">http://andrewjpage.com/index.php?/archives/118-guid.html</guid>
    
</item>
<item>
    <title>Predicting votes on Reddit: PredictReddit.com</title>
    <link>http://andrewjpage.com/index.php?/archives/117-Predicting-votes-on-Reddit-PredictReddit.com.html</link>
            <category>Coding</category>
    
    <comments>http://andrewjpage.com/index.php?/archives/117-Predicting-votes-on-Reddit-PredictReddit.com.html#comments</comments>
    <wfw:comment>http://andrewjpage.com/wfwcomment.php?cid=117</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://andrewjpage.com/rss.php?version=2.0&amp;type=comments&amp;cid=117</wfw:commentRss>
    

    <author>nospam@example.com (Andrew Page)</author>
    <content:encoded>
    On &lt;a href=&quot;http://www.reddit.com&quot;&gt;Reddit&lt;/a&gt; there are a huge number of links submitted, however few ever get enough votes to make it to the front page of the site where most Reddit users will see it.  A submission depends greatly on the title, however you only have one shot to get it right.  &lt;br /&gt;
&lt;br /&gt;
This is where &lt;a href=&quot;http://www.predictreddit.com&quot;&gt;PredictReddit&lt;/a&gt; comes in. It allows you to test out your proposed title, giving you an estimate of the number of votes it is likely to get.  So you can fine tune it before you submit it to Reddit.  It uses past submissions to predict future votes. This of course assumes that the Reddit community is interested in similar recurring topics (and it seems to be).&lt;br /&gt;
&lt;br /&gt;
There can be some confusion over the results it gives back. For example, if you type in a title that you know got a high number of votes and you get a low number of votes back. You might assume that &lt;a href=&quot;http://www.predictreddit.com&quot;&gt;PredictReddit&lt;/a&gt; is broken, however in reality, if a story is very successful, often you find numerous other submissions trying to piggyback on its success (but they fail to get many votes). This gives a low predicted number of votes.  Best to play around with it yourself and try it out. And remember its just for fun.&lt;br /&gt;
&lt;br /&gt;
It works by using a k-Nearest Neighbours algorithm. It was written in PHP using the &lt;a href=&quot;http://framework.zend.com/&quot;&gt;Zend Framework&lt;/a&gt;.  It uses MySQL for data storage.  Data is pulled from Reddit using their json interface. 
    </content:encoded>

    <pubDate>Sat, 02 May 2009 19:12:39 +0000</pubDate>
    <guid isPermaLink="false">http://andrewjpage.com/index.php?/archives/117-guid.html</guid>
    
</item>
<item>
    <title>Matlab NOT Equals logical operator</title>
    <link>http://andrewjpage.com/index.php?/archives/112-Matlab-NOT-Equals-logical-operator.html</link>
            <category>Coding</category>
    
    <comments>http://andrewjpage.com/index.php?/archives/112-Matlab-NOT-Equals-logical-operator.html#comments</comments>
    <wfw:comment>http://andrewjpage.com/wfwcomment.php?cid=112</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://andrewjpage.com/rss.php?version=2.0&amp;type=comments&amp;cid=112</wfw:commentRss>
    

    <author>nospam@example.com (Andrew Page)</author>
    <content:encoded>
    The logical operator for NOT Equals in Matlab is ~=  rather than !=&lt;br /&gt;
So not is ~ in matlab, compared to ! in Java/C/Perl etc.... 
    </content:encoded>

    <pubDate>Wed, 14 Nov 2007 11:45:40 +0000</pubDate>
    <guid isPermaLink="false">http://andrewjpage.com/index.php?/archives/112-guid.html</guid>
    
</item>
<item>
    <title>Visualising threads on a timeline</title>
    <link>http://andrewjpage.com/index.php?/archives/104-Visualising-threads-on-a-timeline.html</link>
            <category>Coding</category>
    
    <comments>http://andrewjpage.com/index.php?/archives/104-Visualising-threads-on-a-timeline.html#comments</comments>
    <wfw:comment>http://andrewjpage.com/wfwcomment.php?cid=104</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://andrewjpage.com/rss.php?version=2.0&amp;type=comments&amp;cid=104</wfw:commentRss>
    

    <author>nospam@example.com (Andrew Page)</author>
    <content:encoded>
    I implimented an automatic tagging system a while ago for phpbb, which calculates the most commonly occuring words in a thread and saves them as tags. A user can then click on a tag to find other threads tagged with the same word. &lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.politics.ie/tags.php?tag=kildare&quot;&gt;&lt;img src=&quot;images/kildaretags.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
They can then see all of the threads with this tag on a nice interactive timeline, can click on a thread on the timeline to see the 1st post, or drag it to see a different point in time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;&lt;a href=&quot;http://andrewjpage.com/index.php?/archives/104-Visualising-threads-on-a-timeline.html#extended&quot;&gt;Continue reading &quot;Visualising threads on a timeline&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Sat, 21 Jul 2007 12:58:48 +0000</pubDate>
    <guid isPermaLink="false">http://andrewjpage.com/index.php?/archives/104-guid.html</guid>
    
</item>
<item>
    <title>Optimizing a phpbb forum under highload</title>
    <link>http://andrewjpage.com/index.php?/archives/102-Optimizing-a-phpbb-forum-under-highload.html</link>
            <category>Coding</category>
    
    <comments>http://andrewjpage.com/index.php?/archives/102-Optimizing-a-phpbb-forum-under-highload.html#comments</comments>
    <wfw:comment>http://andrewjpage.com/wfwcomment.php?cid=102</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://andrewjpage.com/rss.php?version=2.0&amp;type=comments&amp;cid=102</wfw:commentRss>
    

    <author>nospam@example.com (Andrew Page)</author>
    <content:encoded>
    With the upcoming elections &lt;a href=&quot;http://politics.ie&quot; &gt;Politics.ie&lt;/a&gt; has seen its traffic explode, trippling in 2 weeks from 30k pageviews per day to 100k pageviews per day. Six months ago it was only 15k pageviews per day and when it got to the 30k mark we got ourselves a new dual Xeon to keep up.&lt;br /&gt;
&lt;br /&gt;
So heres some things I&#039;ve done over the past while to reduce the load on the server to cope with the huge increase in traffic.&lt;br /&gt;
&lt;br /&gt;
Installed &lt;a href=&quot;http://www.phpbb.com/community/viewtopic.php?t=125251&quot; &gt;eXtreme styles&lt;/a&gt; template caching mod - this precomplies the templates phpBB uses.&lt;br /&gt;
&lt;br /&gt;
Removed the CSS from being included inline in each page to a standalone style file saving 12kb per page.&lt;br /&gt;
&lt;br /&gt;
Caching of pages - the most viewed pages are the latest discussions page, the landing page and the index.php page. So by taking a snapshot of each every few minutes, and serving those out, that cut down on the number of pages to be dynamic ally generated. Very simply I just put a check at the top of the php scripts to see if the url matched e.g. &#039;/latest.php&#039; and served out a copy if it did. Only a few pages are suitable to caching.  Nobody has complained so far, so it must be working fine.&lt;br /&gt;
&lt;br /&gt;
Turned on mod_expires in apache and set images &amp;amp; javascript to expire in 1 month, thus they will be cached along the way.  The mod_mem_cache isnt suitable because of the dynamic nature of most of the pages on the site.&lt;br /&gt;
&lt;br /&gt;
Logged into Googles webmaster tools and asked Google to slow down their crawling (they were asking for 80k pages per day).&lt;br /&gt;
&lt;br /&gt;
I&#039;ve also optimized the mysql queries, but thats for another day. All in all the above things reduced the load a fair bit, but the load is continuously rising so the reduced load is used up. 
    </content:encoded>

    <pubDate>Fri, 04 May 2007 16:19:44 +0000</pubDate>
    <guid isPermaLink="false">http://andrewjpage.com/index.php?/archives/102-guid.html</guid>
    
</item>
<item>
    <title>Add a custom search engine from your site to IE and Firefox</title>
    <link>http://andrewjpage.com/index.php?/archives/94-Add-a-custom-search-engine-from-your-site-to-IE-and-Firefox.html</link>
            <category>Coding</category>
    
    <comments>http://andrewjpage.com/index.php?/archives/94-Add-a-custom-search-engine-from-your-site-to-IE-and-Firefox.html#comments</comments>
    <wfw:comment>http://andrewjpage.com/wfwcomment.php?cid=94</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://andrewjpage.com/rss.php?version=2.0&amp;type=comments&amp;cid=94</wfw:commentRss>
    

    <author>nospam@example.com (Andrew Page)</author>
    <content:encoded>
    Firefox and IE 7 have a search box in the top bar, and you can choose from a list of search engines to perform a search from. Wouldn&#039;t it be nice if a person could visit your site and your sites search facility was available in this drop down list, and your site could be permanently added as a search engine in a persons browser?&lt;br /&gt;
&lt;br /&gt;
Well its very simple.  Create an &lt;a href=&quot;http://www.bigulo.com/bigulosearch.xml&quot;&gt;xml file&lt;/a&gt; such as this:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&lt;br /&gt;
&amp;lt;?xml version=&quot;1.0&quot;?&amp;gt;&lt;br /&gt;
&amp;lt;OpenSearchDescription xmlns=&quot;http://a9.com/-/spec/opensearch/1.1/&quot;&amp;gt;&lt;br /&gt;
&amp;lt;ShortName&amp;gt;Bigulo&amp;lt;/ShortName&amp;gt;&lt;br /&gt;
&amp;lt;Description&amp;gt;Search for people&amp;lt;/Description&amp;gt;&lt;br /&gt;
&amp;lt;Image height=&quot;16&quot; width=&quot;16&quot;&lt;br /&gt;
type=&quot;image/x-icon&quot;&amp;gt;http://bigulo.com/favicon.ico&amp;lt;/Image&amp;gt;&lt;br /&gt;
&amp;lt;Url type=&quot;text/html&quot; method=&quot;get&quot;&lt;br /&gt;
template=&quot;http://www.bigulo.com/index.php?namesearch={searchTerms}&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/OpenSearchDescription&amp;gt;&lt;br /&gt;
&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
Obviously you replace the various lines with your own urls.  Then in your HTML header add in this:&lt;br /&gt;
&lt;blockquote&gt;&lt;br /&gt;
&amp;lt;link rel=&quot;search&quot; type=&quot;application/opensearchdescription+xml&quot; href=&quot;http://andrewjpage.com/bigulosearch.xml&quot; title=&quot;Bigulo&quot; /&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;
where the xml file is the one from above. Thats all. Now in IE and Firefox a person will have the facility to use your sites search feature from their built in search box. &lt;br /&gt;
&lt;br /&gt;
Thanks to &lt;a href=&quot;http://www.minds.nuim.ie/~xebedee&quot;&gt;Niall&lt;/a&gt;. 
    </content:encoded>

    <pubDate>Mon, 12 Feb 2007 17:10:48 +0000</pubDate>
    <guid isPermaLink="false">http://andrewjpage.com/index.php?/archives/94-guid.html</guid>
    
</item>
<item>
    <title>The value of indexes in SQL tables</title>
    <link>http://andrewjpage.com/index.php?/archives/89-The-value-of-indexes-in-SQL-tables.html</link>
            <category>Coding</category>
    
    <comments>http://andrewjpage.com/index.php?/archives/89-The-value-of-indexes-in-SQL-tables.html#comments</comments>
    <wfw:comment>http://andrewjpage.com/wfwcomment.php?cid=89</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://andrewjpage.com/rss.php?version=2.0&amp;type=comments&amp;cid=89</wfw:commentRss>
    

    <author>nospam@example.com (Andrew Page)</author>
    <content:encoded>
    Someone decided to put &lt;a href=&quot;http://www.destraynor.com/serendipity/index.php?/archives/120-Changing-the-World,-on-9-a-day.html&quot;  title=&quot;des blog post&quot;&gt;Dez&#039;s latest blog post&lt;/a&gt; on &lt;a href=&quot;http://programming.reddit.com/info/xh7n/comments&quot; &gt;reddit&lt;/a&gt;.  Unfortunatly the mysql server was having trouble keeping up, resulting in a slow enough response for visitors. This has happened twice before (its a popular blog).  Anyway the problem is from a bit of sloppy coding in &lt;a href=&quot;http://www.s9y.org/&quot; &gt;serendipity&lt;/a&gt;, and one quick change later the site is back running at full speed.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;&lt;a href=&quot;http://andrewjpage.com/index.php?/archives/89-The-value-of-indexes-in-SQL-tables.html#extended&quot;&gt;Continue reading &quot;The value of indexes in SQL tables&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Mon, 08 Jan 2007 19:54:20 +0000</pubDate>
    <guid isPermaLink="false">http://andrewjpage.com/index.php?/archives/89-guid.html</guid>
    
</item>
<item>
    <title>Bebo picture mosaic of The Blizzards</title>
    <link>http://andrewjpage.com/index.php?/archives/86-Bebo-picture-mosaic-of-The-Blizzards.html</link>
            <category>Coding</category>
    
    <comments>http://andrewjpage.com/index.php?/archives/86-Bebo-picture-mosaic-of-The-Blizzards.html#comments</comments>
    <wfw:comment>http://andrewjpage.com/wfwcomment.php?cid=86</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://andrewjpage.com/rss.php?version=2.0&amp;type=comments&amp;cid=86</wfw:commentRss>
    

    <author>nospam@example.com (Andrew Page)</author>
    <content:encoded>
    Myself and &lt;a href=&quot;http://minds.nuim.ie/~itzme&quot; &gt;Conor (mostly Conor)&lt;/a&gt; used 500 bebo profile pictures to generate a mosaic of The Blizzards latest album cover.  It turned out really well. It was generated using Matlab.  The original Blizzards image is only 60x60 pixels, but as you can see it turned out really well.&lt;br /&gt;
&lt;img src=&quot;http://andrewjpage.com/uploads/target.jpg&quot; alt=&quot;&quot; /&gt; &lt;br /&gt;&lt;a href=&quot;http://andrewjpage.com/index.php?/archives/86-Bebo-picture-mosaic-of-The-Blizzards.html#extended&quot;&gt;Continue reading &quot;Bebo picture mosaic of The Blizzards&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Mon, 04 Dec 2006 19:46:30 +0000</pubDate>
    <guid isPermaLink="false">http://andrewjpage.com/index.php?/archives/86-guid.html</guid>
    
</item>
<item>
    <title>Auto tagging and suggesting related threads in phpBB</title>
    <link>http://andrewjpage.com/index.php?/archives/83-Auto-tagging-and-suggesting-related-threads-in-phpBB.html</link>
            <category>Coding</category>
    
    <comments>http://andrewjpage.com/index.php?/archives/83-Auto-tagging-and-suggesting-related-threads-in-phpBB.html#comments</comments>
    <wfw:comment>http://andrewjpage.com/wfwcomment.php?cid=83</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://andrewjpage.com/rss.php?version=2.0&amp;type=comments&amp;cid=83</wfw:commentRss>
    

    <author>nospam@example.com (Andrew Page)</author>
    <content:encoded>
    Previously I gave an &lt;a href=&quot;http://andrewjpage.com/index.php?/archives/71-Auto-thread-tagging-and-related-discussions-in-phpBB.html&quot; &gt;overview&lt;/a&gt; of an auto tagging and suggested thread system I created for phpBB.  Here is some of the code to impliment it. &lt;br /&gt;&lt;a href=&quot;http://andrewjpage.com/index.php?/archives/83-Auto-tagging-and-suggesting-related-threads-in-phpBB.html#extended&quot;&gt;Continue reading &quot;Auto tagging and suggesting related threads in phpBB&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Sun, 03 Dec 2006 23:17:59 +0000</pubDate>
    <guid isPermaLink="false">http://andrewjpage.com/index.php?/archives/83-guid.html</guid>
    
</item>
<item>
    <title>Google adsense bot is broken</title>
    <link>http://andrewjpage.com/index.php?/archives/81-Google-adsense-bot-is-broken.html</link>
            <category>Coding</category>
    
    <comments>http://andrewjpage.com/index.php?/archives/81-Google-adsense-bot-is-broken.html#comments</comments>
    <wfw:comment>http://andrewjpage.com/wfwcomment.php?cid=81</wfw:comment>

    <slash:comments>3</slash:comments>
    <wfw:commentRss>http://andrewjpage.com/rss.php?version=2.0&amp;type=comments&amp;cid=81</wfw:commentRss>
    

    <author>nospam@example.com (Andrew Page)</author>
    <content:encoded>
    From last night any page that google adsense bot (Mediapartner) requested from my site resulted in a 404. This not only affected this site, but another site I admin which is in a different country, running different software and operating system.&lt;br /&gt;
&lt;br /&gt;
For example the adsense bot requests:&lt;br /&gt;
&lt;a href=&quot;http://bigulo.com/index.php%3Fnamesearch=george+bush&quot; &gt;http://bigulo.com/index.php%3Fnamesearch=george+bush&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.politics.ie/viewforum.php%3Ff%3D2&quot;&gt;http://www.politics.ie/viewforum.php%3Ff%3D2&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
When it should be:&lt;br /&gt;
&lt;a href=&quot;http://bigulo.com/index.php?namesearch=george+bush&quot;&gt;http://bigulo.com/index.php?namesearch=george+bush&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.politics.ie/viewforum.php?f=2&quot;&gt;http://www.politics.ie/viewforum.php?f=2&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The reason for this is it converts all question marks in  a url to %3F. This only affects the google adsense bot, all other user agents work perfectly and the google search engine bot works fine. &lt;br /&gt;
At first the incorrect urls were appearing intermittently first appearing at [30/Nov/2006:20:42:23 -0600] with correct urls appearing inbetween. Then at [01/Dec/2006:05:58:03 -0600] all further urls from the adsense bot were incorrect, and have been ever since. &lt;br /&gt;
&lt;br /&gt;
Since the adsense bot cannot view any pages, it cannot serve out context related ads, so public service ads are appearing, resulting in lost revenue.  Judging by the times, I would say they tested a new version of the adsense bot, then deployed it across all of their adsense bot machines at 12pm GMT.  If you run adsense on your site, I&#039;d suggest checking your logs and contacting google.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
UPDATE: They fixed it at  [01/Dec/2006:19:41:03 -0600].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Fri, 01 Dec 2006 20:55:01 +0000</pubDate>
    <guid isPermaLink="false">http://andrewjpage.com/index.php?/archives/81-guid.html</guid>
    
</item>
<item>
    <title>Alternative PHP way to explode a string</title>
    <link>http://andrewjpage.com/index.php?/archives/79-Alternative-PHP-way-to-explode-a-string.html</link>
            <category>Coding</category>
    
    <comments>http://andrewjpage.com/index.php?/archives/79-Alternative-PHP-way-to-explode-a-string.html#comments</comments>
    <wfw:comment>http://andrewjpage.com/wfwcomment.php?cid=79</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://andrewjpage.com/rss.php?version=2.0&amp;type=comments&amp;cid=79</wfw:commentRss>
    

    <author>nospam@example.com (Andrew Page)</author>
    <content:encoded>
    &lt;strong&gt;The problem:&lt;/strong&gt; I want to access individual characters in a string in PHP but I dont have the PHP modules installed to use &lt;em&gt;explode&lt;/em&gt;.  Heres an alternative (and inefficient) way of doing it using split:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;function string_split&lt;font color=&quot;#4444ff&quot;&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;$str&lt;/font&gt;, &lt;font color=&quot;#2040a0&quot;&gt;$nr&lt;/font&gt;&lt;font color=&quot;#4444ff&quot;&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;&lt;font color=&quot;#4444ff&quot;&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;
   &lt;strong&gt;return&lt;/strong&gt; &lt;font color=&quot;#a52a2a&quot;&gt;&lt;strong&gt;split&lt;/strong&gt;&lt;/font&gt;&lt;font color=&quot;#4444ff&quot;&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color=&quot;#008000&quot;&gt;&quot;-l-&quot;&lt;/font&gt;, chunk_split&lt;font color=&quot;#4444ff&quot;&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;$str&lt;/font&gt;, &lt;font color=&quot;#2040a0&quot;&gt;$nr&lt;/font&gt;, &lt;font color=&quot;#008000&quot;&gt;&#039;-l-&#039;&lt;/font&gt;&lt;font color=&quot;#4444ff&quot;&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;&lt;font color=&quot;#4444ff&quot;&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;
&lt;font color=&quot;#4444ff&quot;&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;
string_split&lt;font color=&quot;#4444ff&quot;&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color=&quot;#008000&quot;&gt;&#039;1234&#039;&lt;/font&gt;, 1&lt;font color=&quot;#4444ff&quot;&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;
&lt;/pre&gt;&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Tue, 28 Nov 2006 15:20:24 +0000</pubDate>
    <guid isPermaLink="false">http://andrewjpage.com/index.php?/archives/79-guid.html</guid>
    
</item>
<item>
    <title>Tips for Optimizing MySQL statements</title>
    <link>http://andrewjpage.com/index.php?/archives/73-Tips-for-Optimizing-MySQL-statements.html</link>
            <category>Coding</category>
    
    <comments>http://andrewjpage.com/index.php?/archives/73-Tips-for-Optimizing-MySQL-statements.html#comments</comments>
    <wfw:comment>http://andrewjpage.com/wfwcomment.php?cid=73</wfw:comment>

    <slash:comments>4</slash:comments>
    <wfw:commentRss>http://andrewjpage.com/rss.php?version=2.0&amp;type=comments&amp;cid=73</wfw:commentRss>
    

    <author>nospam@example.com (Andrew Page)</author>
    <content:encoded>
    &lt;h2&gt;Introduction&lt;/h2&gt;&lt;br /&gt;
I run a few websites on a 1Ghz PIII with 512MB RAM. Its an old server, but its all I&#039;ve got, so have to make best use of it.  Since the last restart of MySQL 58 days ago there have been 210 million queries processed, which works out at 40 per second. The databases contain 12 million rows, and 600MB of data. The server gets most hits during working hours on weekdays, so at peak times there&#039;s over 100 queries per second which need to be serviced.  With so many queries its vital that they are optimized to maximize throughput. So here&#039;s some simple things you can do to optimize your MySQL queries. Most of these tips are generalizable to any database but MySQL has some proprietary syntax, thus I cant guarantee if they will work on any other database software.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Indexing&lt;/h2&gt;&lt;br /&gt;
The simplest way to improve the performance of a your queries is to index some fields in the table your looking up. So if you use &lt;strong&gt;ORDER BY age DESC&lt;/strong&gt; to sort results by age, an index on the age field will dramatically speed up the query. Essentially when rows are inserted, the index on the age field presorts the age field for you. An index does take up additional space in your database though, so don&#039;t go overboard. It also increases the insert time.  If your using phpMyAdmin you just click the lightening icon beside the field you want to index.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Multiple inserts&lt;/h2&gt;&lt;br /&gt;
Rather than using multiple different queries to insert multiple rows into the same table, group them together. For example:&lt;br /&gt;
&lt;strong&gt;insert into users(name,age) values (andrew,24),(john,25),(jack,34)&lt;/strong&gt;.  &lt;br /&gt;
By grouping the inserts together you reduce the overhead for setting up the connection to the database.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Delayed inserts&lt;/h2&gt;&lt;br /&gt;
If your data doesn&#039;t need to be instantaneously inserted into the database (so can be inconsistent), then use &lt;strong&gt;DELAYED&lt;/strong&gt; when inserting. This allows for MySQL to store inserts (and updates) in memory, and group them together for more efficient processing.  For example: &lt;br /&gt;
&lt;strong&gt;insert DELAYED into users(name,age) values (andrew,24),(john,25),(jack,34)&lt;/strong&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Counting&lt;/h2&gt;&lt;br /&gt;
So you want to find out how many rows there are in a table. The most common mistake I see is where people select every row. This means MySQL has to read in the data from every row in the database (probably off disk) which is extremely inefficient.  &lt;br /&gt;
&lt;em&gt;Wrong Way:&lt;/em&gt; &lt;strong&gt;select * from users&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The right way to do it is to use &lt;em&gt;count&lt;/em&gt;.  MySQL stores the number of rows in a table already, so the below query only reads a single value, which is far more efficient.&lt;br /&gt;
&lt;em&gt;Right Way:&lt;/em&gt; &lt;strong&gt;select count(*) from users&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
If you have a &lt;em&gt;where&lt;/em&gt; clause, using &lt;em&gt;count&lt;/em&gt; is still more efficient, because it only reads what it needs into memory. 
    </content:encoded>

    <pubDate>Sun, 03 Sep 2006 22:54:40 +0000</pubDate>
    <guid isPermaLink="false">http://andrewjpage.com/index.php?/archives/73-guid.html</guid>
    
</item>

</channel>
</rss>