The Site


I finally got around to it

posted:13/12/2006
posted to:The Site

Well, what have I done? I've fixed the tag cloud. If any thing its actualy simpler code now, but it works correctly.

Before it used to spread the tags equaly, now that might be fine for some people, but as it seems 90% of my tags only have one entry, it really didn't work right. You'd end up with one tag being tiny, and another one large, just because it was later in the alphabet.

I also had the class sizes upside down, now that was just stupid of me but untill I had lots of data, and it generated correctly I couldn't tell.

So now the size is bigger for the more common tags, and all the tags with 1 post as the same size. It actualy looks better now.

I guess the real differance is rather then spreading the tags equaly through the groups, it now spreads the occurances. Right at the moment I am not sure how to explain it, but I'll post the code here, just because I am feeling in that kind of mood. I could explain it, but I've had a head ache all day and I don't much feel like thinking to hard, and translating code to english isn't really my thing.

  function GenerateTagCloud($account_id="", $tagLimit=300) {
    $Result = False ;

    $NumberOfTags = $this->UniqueTagCount() ;
    $TagsInSet = Ceil($NumberOfTags / 7) ;

    // returns an array of id/value pairs "id" and "tag"
    $Result = false;

    if ($account_id != "") {
      $ExtraTable = ", entries e, users u " ;
      $ExtraWhere = " et.entry_id = e.entry_id and e.user_id = 
u.userid and u.account_id = $account_id and " ;
    }

    $GetTagsSQL = "SELECT t.tag_id, t.tag, COUNT(et.entry_id) AS Occurance FROM ".
     _TAGS_TABLE_NAME." t, entry_tags et $ExtraTable WHERE $ExtraWhere et.tag_id = t.tag_id 
GROUP BY t.tag_id ORDER BY Occurance " ;

    if ($tagLimit > 0) {
      $GetTagsSQL .= " LIMIT $tagLimit " ;
    }

    $GetTagsQuery = PerformQuery($GetTagsSQL) ;

    If ($GetTagsQuery) {
      $ResultArray = Array() ;

      while ($row = FetchRow($GetTagsQuery)) {
        $occurance = $row['Occurance'] ;

        $Tag = $row['tag'] ;
        $TempArray['tag'] = $Tag ;
        $TempArray['count'] = $occurance ;

        $ResultArray[$occurance][count($ResultArray[$occurance])] = $TempArray ;
      }
    }

    if (count($ResultArray) > 0) {
      $occurancesPerset = Ceil(count($ResultArray) / 7) ;
      $tagGroupCount = 0 ;

      $tagSetId = 1 ;
      $resultTagsArray = Array() ;

      foreach ($ResultArray AS $tagSet) {
        foreach ($tagSet as $tag) {
          $tagName = $tag['tag'] ;
          $resultTagsArray[$tagName] = $tag ;
          $resultTagsArray[$tagName]['classsize'] = $tagSetId ;
        }

        $tagGroupCount = $tagGroupCount + 1 ;

        if ($tagGroupCount == $occurancesPerset) {
          $tagGroupCount = 0 ;
          $tagSetId = $tagSetId + 1 ;
        }
      }
    }

    sort($resultTagsArray) ;
    return $resultTagsArray ;
  }
Thats the proc that generates the cloud. Obviously if your going to "borrow" it, you'd need the data, and every thing else. But thats a lot more code. The class to do all the tag work is 900 lines on its own. I might open source that, but on the other hand... I might not. See how I feel later. I'd have to take the dependancies to other code out. Still, the idea is there and its not that complicated so I guess people can work out whats missing.

Changed servers, its back, and its better.

posted:07/02/2006
posted to:The Site

Now the new server up, and running and I've had a spare couple of mins to set this site back up its all good. Dedicated servers are all well and good but after a year of problems with host centric we finally had enougth, bit the bullet and moved.

It seems better, images don't just fail to load, its faster and generaly better. I'm happy. Now I just have to reinstall all the other sites. The most suprising thing was when I dumped the database it turned out I had 1,337, 821 lines of SQL... thats one hell of a file.

Any way, its now working, we'll see how it goes with this server I guess...

Onwards and upwards

posted:29/08/2005
posted to:The Site

Well, I've had a good weekend, got some thing done for a change. The site now accepts comments, so if you have some thing to say about what I have said, feel free to do so...

Though try to keep it fairly clean :-)

It's getting there

posted:27/08/2005
posted to:The Site
Well, its not much.... but the sites starting to work. This I guess is not very interesting to most people, so I'll not write much. Basically this site isn't just what I write on it. I've written a fairly funky template engine for it. Its controls the lay out, the content and just about every aspect of the site. There is absolutely no HTML in my PHP any more.Other then that, the tags work, the cloud is generated. But there don't link up yet. I've only just started to connect up the parts.

Exciting ha?