Hi all,
Today I finally sorted out getting multiple instances of Firefox running on my Mac simultaneously after having profile problems for the last few weeks with the new FF version. I followed the steps in the links below to get it working on Leopard, so I’m running Firefox 2.0.11 and Firefox 3 Beta 3. I like the beta a lot, much more stable than the older version, I would like to turn off the hinting in the URL as it occasionally promotes certain visited sites over others when I don’t want it to based on name(ie. I might want to go to webmail.edmundlong.com and when I type in ‘webmail’ into the URL it may suggest another site e.g. www.abertay.ac.uk/webmail over it when I don’t want it to because I’ve visited it more often)
http://support.mozilla.com/kb/Running+different+versions+of+Firefox+at+the+same+time
http://www.jeroencoumans.nl/journal/multiple-firefox-versions
Here’s a small ColdFusion snippet to get the name of a cfc using the metadata. cfcname contains the name of the cfc.
[code lang="xml"]
[/code]
I’ve been working on coming up with a way of accessing the Asterisk CLI from a php page so that stats could be delivered to a webpage. After looking around a bit I see that there is an Asterisk Manager facility that can execute some Asterisk commands along with CLI actions. Below is the code I’m currently using where I have a text-box that I can enter some CLI command e.g. sip show peers and the result is displayed on screen. I’m planning on maybe doing something like this to display some backend stats from the Asterisk system, I could get conference information, number of connected IAX & SIP peers and a whole bunch of other stats. Asterisk doesn’t return the data in a very friendly format though but more on that when I get into it a bit more.
[code lang="php"]
function executeAction($server,$username,$secret,$port,$action,$variable='')
{
$socket = fsockopen($server,$port, $errno, $errstr, 1);
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: $username\r\n");
fputs($socket, "Secret: $secret\r\n\r\n");
fputs($socket, "Action: Command\r\nCommand: $action\r\n\r\n");
/*fputs($socket, "Action: $action\r\n\r\n");
if($variable != '')
{ fputs($socket, "Peer: $variable\r\n\r\n");
}*/
fputs($socket, "Action: Logoff\r\n\r\n");
$count=0;$array;
while (!feof($socket)) {
$wrets = fgets($socket, 8192);
$token = strtok($wrets,':(');
$j=0;
while($token!=false & $count>=5)
{
$array[$count][$j]=$token;
$j++; $token = strtok(':(');
}
$count++;
$wrets .= '
';
}
for($i=5;$i<$count-4;$i++){ echo '
'.$array[$i][0].'
'.'
'.$array[$i][1].'
'; }
fclose($socket);
}
function createActionList($server,$username,$secret,$port,$action="ListCommands")
{
$socket = fsockopen($server,$port, $errno, $errstr, 1);
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: $username\r\n");
fputs($socket, "Secret: $secret\r\n\r\n");
fputs($socket, "Action: ListCommands\r\n\r\n");
fputs($socket, "Action: Logoff\r\n\r\n");
$count=0;$array;
while (!feof($socket)) {
$wrets = fgets($socket, 8192);
$token = strtok($wrets,':(');
$j=0;
while($token!=false & $count>=5)
{
$array[$count][$j]=$token;
$j++; $token = strtok(':(');
}
$count++;
$wrets .= '
';
}
echo "
";
fclose($socket);
}
if ($_POST['submit'])
{ executeAction('127.0.0.1','asterisk','asterisk',5038,$_POST['managersAction'],$_POST['variable']);
}
else
{ createActionList('127.0.0.1','asterisk','asterisk',5038);
}
?>
[/code]
This code is very very insecure and I’m using it only for testing, anyone could type ‘restart now’ to reboot your asterisk system!
I had a couple of problems when using XML search because XMLSearch in ColdFusion is case-sensitive. I had an XML document like the one below
[code lang="xml"]
<[CDATA[abc]]>
[/code]
I used the xpath expression /config/edstest to search for the ‘edsTest’ node but of course this failed due the case-sensitivity involved. The solution was to take the XML and change it all to upper case using UCASE(xml). The good thing is that ColdFusion ignored the content between the CDATA tags and so didn’t resize ‘abc’ which is exactly what I wanted. I then just changed my xpath to /CONFIG/EDSTEST and the search performed as expected.
edlong Archive Post, ColdFusion, PHP, XML