Web Development


I have been playing with Flex a bit, to write an Flash application for my masters degree (I find the flex environment much better for programming than flash), and like most people working with flash I have come up against the cross domain issue (where the player won’t pull data from a domain which doesn’t have a cross domain policy allowing them to do so). This is a problem for the application I am working with, because I want to pull RSS feeds.

The obvious answer, a php proxy. In a way that makes it sound grander than it is because all it really is is a script to pull data from a remote source to get around the cross domain issue.

here is the script (simplified):

<?php
	header("Content-Type: application/xml; charset=UTF-8");
	$url = $_GET['url'];
	readfile($url);
?>

Now the code pulls back the feed as expected, but prepends this:

67c0

immediately before the content. Where does that come from, any ideas? Wherever it comes from it obviously means the feed won’t parse!

In the end, I used curl like this (simplified):

<?php
	header("Content-Type: application/xml; charset=UTF-8");

	// note that this will not follow redirects

	$url = $_GET['url'];

	// create a new curl resource
	$ch = curl_init();

	// set URL and other appropriate options
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_HEADER, 0);

	// grab URL and pass it to the browser
	curl_exec($ch);

	// close curl resource, and free up system resources
	curl_close($ch);
?>

Technorati Tags:
, , , ,

As a web developer, I love the fact that my work machine can run apache, mysql and php. It makes my working life so much easier than all that ftp’ing then testing. It becomes even more important when you are working with Subversion; I think it good practice to work on a particular bit of a project until it is basically working, before those changes are committed. So my set up is that my SVN working copies become my apache docroots.

So, I usually have Apache 2 set up (along with MySQL, and PHP), via MacPorts, and using ‘dynamically configured mass virtual hosting‘.

This basically means that any calls to my local apache server will look in my sites folder for a directory with the same name as the requested domain name. In order to get the domains working under Mac OS X Tiger, I would just edit /etc/hosts pointing each domain to 127.0.0.1, then restart lookupd, and the whole system would work.

Great … except when Apple developed Leopard, they removed lookupd and thus, my means of pointing my local domains to my local server. Read on for the answer …

Technorati Tags:
, , , , , , ,

(more…)

I finally tried out the Firebug extension for Firefox; man it’s good. Almost enough to make me switch to FF full time. As a web developer, it’s simply indispensable once you’ve started using it …

Firebug integrates with Firefox to put a wealth of development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page.

Combined with the GrApple (Eos Pro) theme, Firebug is making a good case for me to switch … if it wasn’t for the very un-mac behaviours like not using the keychain.

So, for now I’ll keep playing the dual browser game; Safari still rocks (apart from being a bit of a resource hog).

SteamSHIFT out.

Technorati Tags:
, , , , ,

I have built a quicky site for my application(s). Loads more to be done on it, but wanted to get it up there. Check it out at: http://apps.steamshift.com.

Laters. SteamSHIFT out.

If you use MySQL on a remote server for web sites, you may want a nice way of backing them up or moving them to another server (perhaps keeping 2 servers in sync). To get you started try this:

Use an SSH client, like putty (if your database is on a remote server), to connect to your server and export the databse you want simply with:

mysqldump --user=username --password=1234 --databases your_database --opt --quote-names --allow-keywords --complete-insert | bzip2 -c > your_database.sql.bz2

download the .bz2 file created, unzip it using 7-zip (if you dont have any other uncompress utility), and backup your database in mysql using:

mysql --user=username --password your_database < your_database.sql

Via Sephiroth.it

Also note, that if you have mysql installed locally, by including a host / port in the mysqldump arguements, you don’t need to run the command remotely (although you would probably want to get mysql to do the compression rather than piping it through the bzip command).

I’ll upload a full mysql mirror script in a few days. SteamSHIFT out.

Technorati Tags:
, ,

Since I’ve been contracting again, I’ve been working for a few different companies; one of the things that I have found interesting is the different approach to version control. The latest experience was working at a company who use Microsoft Visual Studio 2005. It’s a pretty ugly application but it did show the use of decent version control - something that some of the other places I have been could have done with.

So, working on my own stuff, I thought it was about time I put in place a more structured approach to version control than the ‘make a backup copy when I think about it’ approach.

Enter Subversion. I had heard the name bandied about, but never really looked much into it until I saw the Clickable Bliss video introducing Subversion, posted on Del.icio.us. I followed the instructions in the video and then added SvnX into the mix (an OS X GUI svn client).

Brilliant. Sweet version control goodness.

One little thing that makes life easier for web developers:- make your working directory part of your local web server document root (I use a copy of apache/mysql/php5 on my local machine for web development before deploy), that way you can check it in a ‘live’ environment.

Also see this tutorial.

SteamSHIFT out.

Technorati Tags:
, , ,

I’m totally loving Parallels! It’s giving me the opportunity to try out Linux without any fear … for instance, today I decided to install Ubuntu Linux (more on why later), but for no obvious reason, a bit of the way into the install it just froze. I just stopped the virtual machine, recreated the disk image and tried again (this time ending in success).

I like Ubuntu 6.06 better than Suse 10.1 thus far, although I haven’t spent enough time with either to make an informed decision; maybe it’s because the former feels a little more Mac like!

Technorati Tags:
, , , , , , , , ,


(more…)

As the proud owner of a MacBook Pro, I have finally had the opportunity to give Parallels Desktop a try. I have thus far installed Free BSD 6.1, Suse Linux 10.1, Windows 2000 and Windows XP. All have worked flawlessly and have run at totally acceptable speeds (I have used VirtualPC in the past and found it generally to be so slow as to be unusable).

Technorati Tags:
, , , , , , ,


(more…)

Quick heads up for those mac based web developers out there who are using CocoaMySQL-SBG because the standard version wasn’t working on the version of MySQL you are using, you might want to try the latest beta of CocoaMySQL (version 0.7b4) which fixes a load of the bugs. One thing that I love is that unlike SBG, the standard version remembers your passwords if you ask it to!!

SteamSHIFt out.

Technorati Tags:
, , , ,

test post from within textmate

Next Page »