cfhttp issues using “.local” on Max OSX

Ran into an interesting problem today doing something quite simple. Basically all I was doing was posting xml data to a URL, but I kept getting a 408 request timeout and I didn’t know why.

We happen to use the “.local” domain name structure for local development. I was posting data from one local site to another e.g.

http://mysite1.local -> http://mysite2.local

When I dumped cfhttp on the posting page I got the following error:

cfhttp

Now I hadn’t come across this error before with cfhttp and nothing I did fixed the issue, I even got that message using a “GET” method. It wasn’t till I tried “GET” from a public domain (http://www.google.com, which worked) that I thought to try a local domain which didn’t use “.local”.

Success!

Mark mentioned that it could be a problem with Bonjour (as I’m on a Mac) which uses .local.

This is kinda timely as we’re moving away from the “.local” convention in favour of “.cf7″, “.cf9″, “.railo” etc as we’re using multiple cfmx engines for different projects and that provides a way to easily test codebases against different engines easily.

No Comments

BrowserLab live on adobe.com

I’m probably a bit behind the times with this one, but Adobe have added “BrowserLab” functionality to “preview and test your web pages on leading browsers and operating systems – on demand“.

Seems to work like other paid services, but is free :)

https://browserlab.adobe.com/

Available browser options (across mac and windows) include:

  • IE 6/7/8
  • Firefox 2/3
  • Safari 3/4

michaelsharman.com

2 Comments

Extracting URL variables using JavaScript

Server side languages are cool in that they give you a nice associative array to access URL variables. ColdFusion has the URL scope, PHP has $_GET[] etc, but how do you get these values easily with JavaScript?

I came across a post over at Jake Munson’s blog which had just what I needed. Actually although Jakes solution was perfectly valid, I preferred a slight modification from one of the commenters which wrapped the entire URL string into an associative array so you can access the entire URL scope, as well as extracting a specific value via a key. Thanks Chad (and Jake).

So if you had a URL like http://www.mysite.com/?s=the first param&email=someone@me.com you could get the following:

jsdump

Here is the javascript function (note that we wrap all functions into objects to avoid any naming collisions, hence the “Learnosity.” convention):

Learnosity.getURL = function()
{
	document.getVars = [];
	var urlHalves = String(document.location).split('?');
	if(urlHalves[1])
	{
		var urlVars = urlHalves[1].split('&');
		for(var i=0; i<=(urlVars.length); i++)
		{
			if(urlVars[i])
			{
				var urlVarPair = urlVars[i].split('=');
				document.getVars[urlVarPair[0]] = urlVarPair[1];
			}
		}
	}
	return document.getVars;
}

To access the “email” key in the URL, simply call

Learnosity.getURL().email;

Another modification which I added was to unescape any strings, so removing things like %20 (a space character) that might be in the URL value. The following will automatically unescape all values, if this isn’t what you want you can pass “false” to the function (i.e. Learnosity.getURL(false);)

Learnosity.getURL = function(unesc)
{
	clean = (unesc === undefined)?true:unesc;
	document.getVars = [];
	var urlHalves = String(document.location).split('?');
	if(urlHalves[1])
	{
		var urlVars = urlHalves[1].split('&');
		for(var i=0; i<=(urlVars.length); i++)
		{
			if(urlVars[i])
			{
				var urlVarPair = urlVars[i].split('=');
				document.getVars[urlVarPair[0]] = (clean)?unescape(urlVarPair[1]):urlVarPair[1];
			}
		}
	}
	return document.getVars;
}
1 Comment

Firefox changing default download location?

Hmm it seems firefox (Windows) 3.5.2 has decided to change the default location for downloading files. Used to be the desktop, but if you suddenly discover that you can’t find things you’ve download you might want to head to Tools->Options in firefox.

If you see “Downloads” as the chosen folder (as below), you can change it back to the desktop.

ffdownload

Safari (at least on the Mac) also annoyingly places files there.

2 Comments

New location for FarCry subversion repositories

The folks at Daemon have completed some migrations with their subversion repositories which directly effects FarCry. Notes from the farcry-dev groups:

All URL’s should be replaced with this repo location:
https://modius.svn.cvsdude.com/farcry

All project folders are relative to this root. For example, the p520
branch for FarCry 5.2.x is available here:
https://modius.svn.cvsdude.com/farcry/core/branches/p520/

You can re-checkout or use the “relocate” command if your SVN client
supports.

No Comments