PHP

PHP related stuff

Merry Christmas to all

Well it;s that time of year again (what happend to the rest of the year).

Merry Christmas to all of you out there, some of you are close and some of you are far.

So special greetings go to my Dad (even though you are far away we are thinking about you and miss you lots)

Well guess I should stop being “rude” and leave the pc alone for a little bit, hope you all have an awesome day surrounded by people you love and great food.

And so I write some code today ;)

<?php
   $holiday = new Holiday('Christmas');
   $holiday->celebrate();
   $holiday->eatLotsOfFood();
   $holiday->beMerry();

lolz ;)

MySQL group_concat not returning all data.

So working on a project for work, and it was not behaving as expected. I was selecting all the ID’s from a table that was linked to a couple of other tables, it turns out that it wasn’t returning all the id’s as expected as there is a limit on the amount of data that GROUP_CONCAT will return. MySQL Manual – GROUP_CONCAT

Well instead of using GROUP_CONCAT I’m now selecting the id’s individually, and this is now working.

Also there seems to be a limit on the number of items you can have in a IN clause: SELECT * FROM table WHERE field IN (xxx,xxx,xxx) so I’ve had to split these into 1000 peice chunks.

All seems to be working now after that, we’ll see how it goes… :)

Git colors

I’ve been using Git for a while now and am enjoying it over SVN. Especially the fact that it’s distributed.

Well recently I was having an issue with the color output:

<config ~/.gitconfig>
[color]
ui = auto
</config>

After enabling colors I was getting the following:

#       ESC[31mmodified:   cms/config.phpESC[m

And then I found an entry on the GitFaq which fixed the issue :)

<config ~/.gitconfig>
[core]
pager = less -FXRS
</config>

Hope this helps someone else having the same issue.

Installing Jabber on Debian Etch

Well I just finished getting Jabber installed and working on my local network.

Thanks go here and here.

Basically I just followed the first link to get the server up, and the second to get a web client running.

I did have a couple of issues with the web client, but I will try to document them at another date… (well I need to reinstall the server soon)

Now just to get jabber to talk to the outside world :)

WordPress

Ok, yet again I’ve changed the software behind this site.

Well I’m not finding the time to update the code for this site, and also why reinvent the wheel.

Well lets see how this goes, hopefully we stick with it for a while ;)

PS. This also means that comments are once again enabled, and soon to come Flickr :)

STFU @ comment spambots

Well I’ve disabled comments for now… well until I can add an anti spam feature

If people used all the energy that they use to fill the internet with spam, for good the world would be a better place!!!

Symfony and git

Well decided to tryout a php based framework, and decided on symfony, it seem pretty good, nice and easy to use. It took me _alot_ less time to recreate this site using symfony.

Going to recreate reddevil.co.za using symfony aswell, hopefully this will be quick, and will make maintainance a lot easier

I also decided to try GIT. It also looks good so far, finally managed to setup a central git repository, I know this is kinda against the point of git. But I like the idea of having a local repository that I can commit changes to and then once happy with all the commits I can send them to the central repo

Site Updates – Gravatar

Well added support for gravatars this morning, man these things are pretty kewl.

If you have are registered on http://site.gravatar.com/ and you use your email address when leaving a comment, then your gravitar is shown next to your name… ;)

This was suprisingly simple to setup… :)

I used MySQL to supply me the MD5 but the solution on there site is:

PHP

Implementing gravatars with PHP is quite simple. PHP provides both md5() and urlencode() functions, allowing us to create the gravatar URL with ease. Assume the following data:

    $email = "someone@somewhere.com";
    $default = "http://www.somewhere.com/homestar.jpg";
    $size = 40;

You can construct your gravatar url with the following php code:

    $grav_url = "http://www.gravatar.com/avatar.php?".
                "gravatar_id=".md5($email).
                "&default=".urlencode($default).
                "&size=".$size;

Once the gravatar URL is created, you can output it whenever you please:

    print("<img src=\"{$grav_url}\" alt=\"\" />");

New website design (front and back)

So finally here it is, I have finally finished the redesign of my site.

I have decided on a MVC type framework, which means everything is vary modular, and it’s alot quicker to create new modules

Well best I finish the last couple of tweaks