Setting Up an Adobe Air Development Enviroment (Video Tutorial)

August 21, 2008 3 comments

Adobe Air has been out for around a year, i’ve only just started playing with it. I recorded a video tutorial showing you how to setup a development (using Aptana) and make a very simple application. This method will work for all Operating Systems.

Writing better jQuery Code

August 13, 2008 21 comments

We all know that jQuery is great, that you can do things in 2-3 lines in jQuery that you can in 20 lines of Javascript, but is your jQuery code starting to get a bit bulky?  Could you do things better?. I’m going to show you how to reduce a 20-25 line jQuery script into 3 lines by making the script dynamic, and give a few tips on improvement of your code.

What we want: When the user clicks a list item, it will show the corresponding div

  • PHP
  • ASP
  • Ruby
  • Python
  • AIR
http://www.php.net
http://www.asp.net
http://www.ruby-lang.org
http://www.python.org
http://www.adobe.com/products/air/

If i were a beginner and i was asked to write the script, i’d most likely code sections for each id/div such as below.. Once the specified link is clicked it’ll hide all the divs shown(the other content panels) and then it’ll fade in the relevant content panel.

$("ul#langs li#php").click(function(){

	$("div#container div").hide();
	$("div#container div#d_php").fadeIn("slow");

	});

	$("ul#langs li#asp").click(function(){

	$("div#container div").hide();
	$("div#container div#d_asp").fadeIn("slow");

	});

This is alright.. it does the job but for each id/div you need around 3 lines of code, your also listening for alot of events (all of those clicks) which may use more memory and slow the script down in general.

Instead of listening for unique clicks(php, asp, ruby etc..), why don’t we just listen for…

XAMPP(Webserver) On Linux

August 8, 2008 8 comments

I recently erased Fedora 9 from my hard drive, and installed Linux Mint. Im enjoying it so far but it didn’t come with a webserver. Heres a little tutorial on how to install XAMPP and get it up and running.

First of all, download XAMPP from sourceforge. As of writing this, the latest version is 1.6.7 so ill be referencing to that in the tutorial. Save it to your /home/$USER/ directory.

Extract the archive to your /opt/ directory.

sudo tar xvfz xampp-linux-1.6.7.tar.gz -C /opt

Now its installed :)
To start it:

sudo /opt/lampp/lampp start

To stop it:

sudo /opt/lampp/lampp start

To launch the panel/manager:

sudo /opt/lampp/lampp panel

You can test if its on by going to http://localhost

To add files to the server, you would need to put them in /opt/lampp/htdocs/ but since that directory is owned by root, your user doesn’t have neccesary privilages. The easiest way to “get around” this is to set up a symlink folder in your home directory. You may be familiar with public_html or www directories on your webhosting, we are basically setting the same thing up here.

First we want to set up the directory we are going to link to in htdocs. So..

sudo mkdir /opt/lampp/htdocs/homefiles/

Then make the equivilant directory in our home directory.

mkdir ~/public_html/

And finally link them together.

sudo…

Format your Twitter Stream with jQuery

August 1, 2008 1 comment

Woo! Another screencast. In this one i show you how to include your twitter stream into your blog or website, and then format it using jQuery so your tweets have an alternating background colour.