Home About Hire Blog
Aug 24

Switch classes in jQuery

jQuery comes with a nice little function called toggleClass() which is good in certain cases, for example when you want to turn a class on or off. However there have been many circumstances where i wanted to swop a class with another. To get around this i wrote this function:
jQuery.fn.switchClass = function(a, b) {
	elm = $(this);
	if ( elm.hasClass(a) ) {
		elm.removeClass(a).addClass(b);
	} else {
		elm.removeClass(b).addClass(a);
	}
};
All you need to do to use it is call the function and pass in the names of the two classes. E.g:
$('a').click( function() {
	$('div').switchClass('up', 'down');
});
This will remove the class up and add the class down, when clicked again it will do the opposite therefore not needing to call it again.

Note: theres a function which can achieve this in jQuery UI however if you don't want to load a entire new library for a simple function then use this, since they're called the same you should use one OR the other.


Sep 12

Still kicking...

I think we've established the past blogs that I'm not very good at keeping up with this whole blogging thing. I thought I'd drop in and say hi and also give everyone some updates on my progress and the way things are going. At the moment I'm working on about 1000 things at once so my time is short and I'm pretty sure that old age is really beginning to take its toll, considering I'm only meant to be 23yrs old its pretty mortifying news. If you continue on below you can see all the projects I'm currently working on and how its going.

CodeTheInter.net Updates

I'm really guilty here as I started a new framework for the site a long time ago and it was really a chance to get my fingers into PHP5 properly by making use of new design patterns and functions. The framework is half way there and uses some nifty things like singleton patterns for my configuration settings, a registry pattern to handle the class, it also has a router for controlling my URLs which are SEO optimised, a db class which makes use of PHP5's PDO class which by way is ubber cool. This all comes together to create a MVC pattern which allows me to control any application however I want. Its currently in its baby phase but I hope to expand it into a fully fledged framework.

A small update I did make to the site was to add SEO which was pretty easy considering there was only one type of URL to contend with which was CodeTheInter.net?index.php&p=home. This is now displayed as CodeTheInter.net/home so search engines can index the site easier. Just noticed the blog here doesn't have SEO so will be adding that next!

Ibitzy

As many of you may already know I have began work on the Ibitzy project again which for those people in the know is a indexer for torrent sites. This project was originally created a few years ago but had to go through constant updates just because it indexed the HTML on the website which constantly changed. Originally it grabbed the HTML and use a series of preg_match functions to find the data required. Not only was that not a very quick way of doing it, we came to realise that well a lot of people don't know regex! The plug-ins system that we created to allow people to extend the application was therefore useless as it was too complicated for anyone to figure out (or they just couldn't be bothered).

In the latest version I'm hoping to get rid of this issue by making use of the latest web technologies at my disposal. These include making the application 100% PHP5 seeing as PHP4 is dead and buried and PHP5 is so much better there's no use to continue with it. Also Ibitzy will now index the RSS feeds of websites and gather the data that it requires. This is fast as it uses cURL to grab whats needed and then uses a XML Parser class to gather the data required.

The XML Parser class is a bit special too in the way that it uses XPath which is a new ability in PHP5 and uses DOM can make it very easy to sift through your XML. I'm hoping to use XPath to sift through the HTML making it very easy to create new plug-ins as its simply a case of finding the path (a singe if your using firefox's firebug).

The rest of the application is all built object orientated to make the processing of data a much more centralised and controlled procedure. This allows of easier extendability and makes modifications and bug fixing a whole log easier too. This should be completed as fast as I can but no ETA yet.

IPBTracker

IPBTracker will go final very soon pending a documentation update to coincide with the latest versions of IPB. I will then bring IPBTracker 2.0 to the end of its life cycle. I know sad news but I'm afraid I don't see any option or room for improvement for it at this stage. Don't let this get you down because with the release of IPB 3 not too far off development on IPBTracker 3.0 will begin! This will be a whole different ball game and with the new IPB 3 hooks system i should be able to reduce the amount of edits required by a ton. I do really hope to eliminate them entirely but we'll have to see. I haven't even began to plan this out but if you have ideas then please be sure to post them on the IPBTracker.eu forum as all suggestions are welcome.

Other

Other things I'm currently working on which I consider a huge privileged is to be involved in the IPB 3 project and helping them develop some parts of it. Of course the biggest advantage of this is getting to glimpse IPB 3 before everyone else. If you've been reading the IPS corporate blog that you know there are tons of goodies to come in the new IPB 3 and there's still a bit of a way to go but its very exciting. There's also so very cool features that haven't been announced yet which you may find out about if you keep an eye on the IPS corporate blog and news sections.

Right I think that wraps up this blog entry, watch out for some tech blogs to come soon explaining some cool things I've come across in PHP5 and how to implement them into your own applications.

Cya!

Apr 07

IPBTracker Updates

Right seems this whole blogging thing is getting on top of me and so I haven't been making regular posts. I hope to change that but for the time being here's some updates about the IPBTracker site.

The site has been officially relaunched however the member database has not been restored as this would cause further delays. Sorry for this but it doesn't take long to re-register. Also I'm pleased to announce that IPBTracker 2.0 has been released and just to show how long I take to blog beta 2 has already been released.

Check out www.ipbtracker.eu news forum for downloads and hope the long wait has been worth it. Think that's about it on the IPBTracker side of things so till next time happy editing.

Mar 11

CodeTheInter.net

This is my new site which is a basically a portfolio site which enables me to keep everything about me in one place and allow people like you find me easily. Be sure to check out the site and people requiring custom modifications check out the hire me form.

Mar 11

Site Coming Back Soon...

Will be relaunching the site complete with IPBTracker 2.0 very soon. Check out IPBTracker.eu for further information and support regarding IPBTracker past and present releases.