<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ed&#039;s Blog &#187; ColdFusion</title>
	<atom:link href="http://edmundlong.com/edsBlog/category/coldfusion/feed/" rel="self" type="application/rss+xml" />
	<link>http://edmundlong.com/edsBlog</link>
	<description>Stuff I&#039;m working on at the moment</description>
	<lastBuildDate>Fri, 13 Aug 2010 10:58:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Wget, Bootcamp and ColdFusion setup</title>
		<link>http://edmundlong.com/edsBlog/wget-bootcamp-and-coldfusion-setup/</link>
		<comments>http://edmundlong.com/edsBlog/wget-bootcamp-and-coldfusion-setup/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 23:08:01 +0000</pubDate>
		<dc:creator>edlong</dc:creator>
				<category><![CDATA[Archive Post]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://edmundlong.com/edsBlog/?p=98</guid>
		<description><![CDATA[Hi all. Pretty late now, spent a fair bit of time setting up the new blog and am in the proces of getting the site sorted out a little better. I’ve been using ftp to get all my websites files, to recursively get files using ftp use mget. mget -r ftp://username:password@host -p Apart from that [...]]]></description>
			<content:encoded><![CDATA[<p>Hi all.</p>
<p>Pretty late now, spent a fair bit of time setting up the new blog and am in the proces of getting the site sorted out a little better.</p>
<p>I’ve been using ftp to get all my websites files, to recursively get files using ftp use mget.</p>
<pre class="brush:plain">
mget -r ftp://username:password@host -p <directory to write to>
</pre>
<p>Apart from that I’ve a couple of other little tid-bits. Installing Bootcamp on an Intel-based CPU mac is a pain. I’ve tried now 3 times, the biggest problem being that my Media Center 2005 installation has 2 cds and I don’t know how to eject the cd during the install phase when prompted to! The eject button doesn’t work so maybe there’s a shortcut I don’t know or something.Perhaps I’ll have to get a single CD install.</p>
<p>Had the craziest install of ColdFusion/Apache during the week. I had apache working(i.e was able to get to my localhost fine) and so decided to go off and get ColdFusion talknig with apache. I went to /Applications/JRun4/lib/ and executed unzip wsconfig.jar to a local directory. Then I went into the apache/connectors/macos-intel directory and copied out the wsconfig file to /Application/JRun4/lib/wsconfig/1(I created the last 2 directories myself). That was fine I added the ColdFusion code to the end of the httpd.conf file for the CF module and restarted apache. I started getting the NameVirtualHost *.80 has no virtual hosts even though I had about 10 in my users/xxx.conf file. This file was definitely being loaded so I couldn’t figure out why this was happening. After some help from work -colleagues we eventually figured out the problem. We went through the whole copying out of the connector again and got the CORRECT code to enter at the end of the httpd.conf file for the ColdFusion module inclusion and it worked perfectly straight away. Spent about 2 hours figuring this out!</p>
<div class="fullcircle-social-links" style="display: block;"></div><div style="clear: both;"></div>]]></content:encoded>
			<wfw:commentRss>http://edmundlong.com/edsBlog/wget-bootcamp-and-coldfusion-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ColdFusion doesn’t like doublequotes in Query of Queries</title>
		<link>http://edmundlong.com/edsBlog/coldfusion-doesn%e2%80%99t-like-doublequotes-in-query-of-queries/</link>
		<comments>http://edmundlong.com/edsBlog/coldfusion-doesn%e2%80%99t-like-doublequotes-in-query-of-queries/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 23:06:57 +0000</pubDate>
		<dc:creator>edlong</dc:creator>
				<category><![CDATA[Archive Post]]></category>
		<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://edmundlong.com/edsBlog/?p=95</guid>
		<description><![CDATA[Hello to anyone reading this! I’ve decided to take my blog in a new direction, as I am now in web-development I’m going to begin to post problems I encounter and solutions I find(hopefully I find them) and try and breathe a little more life into the site, its been pretty stagnant of late! Today [...]]]></description>
			<content:encoded><![CDATA[<p>Hello to anyone reading this!</p>
<p>I’ve decided to take my blog in a new direction, as I am now in web-development I’m going to begin to post problems I encounter and solutions I find(hopefully I find them) and try and breathe a little more life into the site, its been pretty stagnant of late!</p>
<p>Today I’ve discovered that ColdFusion really doesn’t like have quotation marks in query of queries. I got this rather unhelpful error:</p>
<pre class="brush:plain">
Incorrect conditional expression,  Incorrect conditional expression,  Lexical error at line 0, column 0.  Encountered: "\"" (34), after : ""
</pre>
<p>Replacing the double quotes with single quotes fixed that problem, hope that helps someone!</p>
<p>Query of queries are great but are lacking in functionality, can’t do updates or deletes in them(I can see why but it is annoying!). I’ve found that I need to append the table name onto the start of each item in the query for it to work e.g.</p>
<pre class="brush:sql">
SELECT test.username, test.id
FROM test
WHERE 1=1
GROUP BY test.id,test.username
</pre>
<div class="fullcircle-social-links" style="display: block;"></div><div style="clear: both;"></div>]]></content:encoded>
			<wfw:commentRss>http://edmundlong.com/edsBlog/coldfusion-doesn%e2%80%99t-like-doublequotes-in-query-of-queries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title></title>
		<link>http://edmundlong.com/edsBlog/76/</link>
		<comments>http://edmundlong.com/edsBlog/76/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 22:50:46 +0000</pubDate>
		<dc:creator>edlong</dc:creator>
				<category><![CDATA[Archive Post]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://edmundlong.com/edsBlog/?p=76</guid>
		<description><![CDATA[Hi again, Yesterday I had some fun trying to use Flex to call an upload.cfm page but as the CF page was behind a secured system(i.e. need to be logged in to call a page) the system was looking for the Flex app to login again. I only found this out by running Charles Web [...]]]></description>
			<content:encoded><![CDATA[<p>Hi again,</p>
<p>Yesterday I had some fun trying to use Flex to call an upload.cfm page but as the CF page was behind a secured system(i.e. need to be logged in to call a page) the system was looking for the Flex app to login again. I only found this out by running Charles Web Debugging app which showed the request and response http data. I saw that response was source for a login page, strangely though the flex app told me the upload was called successfully and the file was uploaded successfully.<br />
Also looking at the HTTP data I saw that the jsessionid wasn’t being passed in alongside the Flex request so I needed to pass the session variable into the Flex app from ColdFusion. The CF was determining that the session was over so it was looking for a login. After looking around a bit I saw that it wasn’t possible to just get the Session variable from the swf directly you have to request it from ColdFusion as it is stored server side(I think).<br />
So I made a function in a CFC to get the session variable:</p>
<p>[code lang="xml"]<br />
<cffunction name="getSessionID" access="remote" returntype="string"></p>
<p>      <!--- Get SESSION var if it exists ---><br />
      <cfif StructKeyExists(SESSION, 'sessionid')><br />
		<cfreturn "#session.sessionid#"><br />
      </cfif></p>
<p>      <!--- Return it ---><br />
      <cfreturn 'NotLoggedIn'></p>
<p></cffunction><br />
[/code]</p>
<p>I call this from the Flex app using a Flex WebService and then when I’m doing a URL request I pass the jsessionid alongside the request like so:</p>
<p>[code lang="actionscript"]<br />
var uploadDestination:String = myModel.CFLocation + model.AssetModel.getInstance().UPLOAD_CFM_NAME + ';jsessionid=' + myModel.sessionID;<br />
[/code]</p>
<p>The session id is stored alongside the model as a variable. This essentially calls ‘upload.cfm;jsessionid=xyz’</p>
<p>This fixed my problem and the app works fine now.</p>
<div class="fullcircle-social-links" style="display: block;"></div><div style="clear: both;"></div>]]></content:encoded>
			<wfw:commentRss>http://edmundlong.com/edsBlog/76/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title></title>
		<link>http://edmundlong.com/edsBlog/73/</link>
		<comments>http://edmundlong.com/edsBlog/73/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 22:49:31 +0000</pubDate>
		<dc:creator>edlong</dc:creator>
				<category><![CDATA[Archive Post]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://edmundlong.com/edsBlog/?p=73</guid>
		<description><![CDATA[Hi, Today I needed to format a number to contain 2 decimal places, it’s a bit weird way to do it but here is how I did it, if anyone else knows a better way please tell! number format &#8216;,.99&#8242;: #numberformat(num,&#8217;,.99&#8242;)# I ran into a few problems while trying to compile the app_conference addon for [...]]]></description>
			<content:encoded><![CDATA[<p>Hi,<br />
Today I needed to format a number to contain 2 decimal places, it’s a bit weird way to do it but here is how I did it, if anyone else knows a better way please tell!</p>
<blockquote><p>
number format &#8216;,.99&#8242;: #numberformat(num,&#8217;,.99&#8242;)#</p></blockquote>
<p>I ran into a few problems while trying to compile the app_conference addon for Asterisk both this week and last week.</p>
<blockquote><p>
conflicting types for ‘strtoq’ from stdlib.h and concat.h</p>
<p>error: ‘AST_MODULE’ undeclared here (not in a function)</p></blockquote>
<p>The error was confusing and I found it difficult to find any solution to my problem. Everywhere just indicated that you didn’t need to do anything to get the source to compile. I got the Asterisk source apt-get install apt-get install asterisk-dev and modified the Makefile in the app_conference directory to point at the asterisk includes (/usr/src/asterisk/include for me). When I attempted to make the application but got the errors above.</p>
<p>The solution I sort of stumbled onto inadvertently actually. I tried to place the code in the asterisk-src/apps directory in the hope it would pickup the includes properly, not sure why I was doing it actually. Anyway when I tried to re-compile the asterisk source(which automatically compiles the app directory) I saw that I was getting an error in the build. After a quick google I found that this was because libncurses5-dev wasn’t installed. I also installed pkg-config and libtool but I’ve a feeling that it was libncurses that fixed my problem. Anyway after this I compile it ok with now errors, copied the app_conference.so into the /usr/lib/asterisk/modules.so directory restarted asterisk and bingo it worked. Only pity is that it is literally a conference application it does nothing else really, no voice prompts or admin sort of features like allowing a user to kick other users but I hope to either add those or come up with a work-around for this.</p>
<p>Xlite is available for Mac OS Leopard now <a href="http://www.counterpath.com/">http://www.counterpath.com/</a>, it wasn’t previously. I was using Zoiper but it is nowhere near as good as XLite in my opinion so I’m happy with that.</p>
<div class="fullcircle-social-links" style="display: block;"></div><div style="clear: both;"></div>]]></content:encoded>
			<wfw:commentRss>http://edmundlong.com/edsBlog/73/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Firefox and ColdFusion comparisons and some links</title>
		<link>http://edmundlong.com/edsBlog/firefox-and-coldfusion-comparisons-and-some-links/</link>
		<comments>http://edmundlong.com/edsBlog/firefox-and-coldfusion-comparisons-and-some-links/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 22:48:17 +0000</pubDate>
		<dc:creator>edlong</dc:creator>
				<category><![CDATA[Archive Post]]></category>
		<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://edmundlong.com/edsBlog/?p=69</guid>
		<description><![CDATA[Hi all, Recently saw this article writen by a FF developer about whats been done by Mozilla to improve Firefox 3 and runs through some comparison tests with other browsers, accompanied by some pretty graphs. http://blog.pavlov.net/2008/03/11/firefox-3-memory-usage/ Check out Mark’s blog(well Learnosity’s) for a comparison of SOAP and REST for ColdFusion MX, again accompanied b pretty [...]]]></description>
			<content:encoded><![CDATA[<p>Hi all,</p>
<p>Recently saw this article writen by a FF developer about whats been done by Mozilla to improve Firefox 3 and runs through some comparison tests with other browsers, accompanied by some pretty graphs.<br />
<a href=" http://blog.pavlov.net/2008/03/11/firefox-3-memory-usage/"></p>
<p>http://blog.pavlov.net/2008/03/11/firefox-3-memory-usage/</a></p>
<p>Check out Mark’s blog(well Learnosity’s) for a comparison of SOAP and REST for ColdFusion MX, again accompanied b pretty charts!</p>
<p><a href="http://www.learnosity.com/techblog/index.cfm/2008/3/13/CFMX–SOAP-vs-REST-benchmarks">http://www.learnosity.com/techblog/index.cfm/2008/3/13/CFMX–SOAP-vs-REST-benchmarks</a></p>
<p>Came across a nice plugin to visualise images in Firefox &#8211; check out <a href="http://piclens.com/site/firefox/win/">http://piclens.com/site/firefox/win/</a> I really like it.</p>
<p>I’ve signed up for the beta of SearchMe, it sounds good in theory but will be interested to try it. Have a look at the video demo here<br />
<a href="www.searchme.com">www.searchme.com</a></p>
<p>And finally what made my week. The work of Jeff Orkin’s on the topic of Goal Oriented Action Planning inspired my Masters and he has referenced my Master’s thesis from his MIT Media site, check out his publications(and games, they rock) <a href="http://web.media.mit.edu/~jorkin/goap.html">http://web.media.mit.edu/~jorkin/goap.html</a></p>
<div class="fullcircle-social-links" style="display: block;"></div><div style="clear: both;"></div>]]></content:encoded>
			<wfw:commentRss>http://edmundlong.com/edsBlog/firefox-and-coldfusion-comparisons-and-some-links/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP dump, Beejive and MySQL tidbits</title>
		<link>http://edmundlong.com/edsBlog/php-dump-beejive-and-mysql-tidbits/</link>
		<comments>http://edmundlong.com/edsBlog/php-dump-beejive-and-mysql-tidbits/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 22:46:44 +0000</pubDate>
		<dc:creator>edlong</dc:creator>
				<category><![CDATA[Archive Post]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://edmundlong.com/edsBlog/?p=66</guid>
		<description><![CDATA[Hi, Haven’t had time to post recently and this is a relatively short one. I’ve been coding with PHP again recently and was looking for something similar to ColdFusions cfdump and didn’t know until last week that the var_dump function existed, its very handy although it doesn’t output the dumped variable in a very user-friendly [...]]]></description>
			<content:encoded><![CDATA[<p>Hi,<br />
Haven’t had time to post recently and this is a relatively short one.</p>
<p>I’ve been coding with PHP again recently and was looking for something similar to ColdFusions cfdump and didn’t know until last week that the var_dump function existed, its very handy although it doesn’t output the dumped variable in a very user-friendly fashion.</p>
<p>As I posted previously I jailbroke my iTouch and was looking for a good app for IM. I installed Apollo IM hearing that it was meant to be very good but it only has .Mac, MSN, AIM and one other I can’t remember, the main problem with the app is that there doesn’t seem to be Google Talk support. After looking around for a bit I found Beejive which is excellent, very nice to use but unfortunately only works from within Safari and isn’t a standalone app but will do for the moment. Check it out at <a href="http://www.beejive.com/">Beejive</a>.</p>
<p>I had this error during the week when doing some CF troubleshooting. I couldn’t figure it out for a while and the error message wasn’t especially helpful.</p>
<blockquote><p> Element 25316 is undefined in a Java object of type class coldfusion.runtime.TemplateProxy. </p></blockquote>
<p>The error occurred (I don’t know why I was doing this) when I was trying to index into a CF object as you would a struct! So if I had an object oObject and try to do something like oObject["someValue"] you will get an error like above.</p>
<p>Finally just a couple of quick really useful MYSQL snippets I picked up during the week. I needed to rename a MYSQL table, the SQL below does this nicely.</p>
<pre class="brush:sql">
rename table myOriginalTable TO newTableName;
</pre>
<p>Another really great piece of SQL performs an insert if a record doesn’t exist and if it does exist it performs an update on the record.</p>
<pre class="brush:sql">
INSERT INTO table (a,b,c) VALUES (1,2,3)
  ON DUPLICATE KEY UPDATE c=c+1;
</pre>
<p>Coalesce is a nice MYSQL function, it returns the first non-null in a list. If there is nothing besides NULL in the list, 1 is returned as in the case below.</p>
<pre class="brush:sql">
SELECT COALESCE(NULL,1) FROM tbl_test
</pre>
<div class="fullcircle-social-links" style="display: block;"></div><div style="clear: both;"></div>]]></content:encoded>
			<wfw:commentRss>http://edmundlong.com/edsBlog/php-dump-beejive-and-mysql-tidbits/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CF Exceptions, disable CF security &amp; CF oddities</title>
		<link>http://edmundlong.com/edsBlog/cf-exceptions-disable-cf-security-cf-oddities/</link>
		<comments>http://edmundlong.com/edsBlog/cf-exceptions-disable-cf-security-cf-oddities/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 22:44:27 +0000</pubDate>
		<dc:creator>edlong</dc:creator>
				<category><![CDATA[Archive Post]]></category>
		<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://edmundlong.com/edsBlog/?p=62</guid>
		<description><![CDATA[Hi again, Been a while since my last post so quite a bit to post, will probably split into two. I was having a very strange problem in CF last week where CF was unable to find any Application.cfc of any of my sites. I did many updateapps, restarted ColdFusion a couple of times, ensured [...]]]></description>
			<content:encoded><![CDATA[<p>Hi again,</p>
<p>Been a while since my last post so quite a bit to post, will probably split into two.</p>
<p>I was having a very strange problem in CF last week where CF was unable to find any Application.cfc of any of my sites. I did many updateapps, restarted ColdFusion a couple of times, ensured the relative paths were correct and there were no errors in the cfc. After reaching my wits end with it, I asked a co-worker(cheers Sharmo!) for his assistance. We checked the logs and a whole bunch of other things with no avail to figure out what was going wrong. Michael then explained how cfcs are converted into Java bytecode classes in the backend so we figured that there could be something funky going on with the caching in the backend or on of the classes had become corrupt. So we deleted all the classes from /Applications/JRun4/servers/cfusion/cfusion-ear/cfusion-war/WEB-INF/cfclasses and did a restart of ColdFusion and voila…all working again.</p>
<p>I’ve been performing a lot of exception checking for ColdFusion of late. There are several different types of ColdFusion error listed below. Some exceptions CAN contain exception specific data thrown along with the error. Every exception contains a message and a type(i.e. database, application etc. ). Each exception can also include two members of the cfcatch struct called rootCause and cause which include data that can explain the reason behind the exception.</p>
<p>Database &#8211; Mysql errors<br />
Special variables</p>
<p>    * cfcatch.rootcause.datasource : the SQL datasource<br />
    * cfcatch.rootcause.sql : the problematic sql code</p>
<p>Application &#8211; Errors in the application scope</p>
<p>      Special variables</p>
<p>    * cfcatch.extendedInfo : exactly what it says on the tin</p>
<p>Template &#8211; Occurs when a template which is included can’t be found</p>
<p>      Special variables</p>
<p>    * cfcatch.missingfileName : The name of the missing template</p>
<p>Security &#8211; Occurs with ColdFusion sandbox and other security exceptions</p>
<p>      Special variables</p>
<p>    * Couldn’t find any in specific but I’m sure there are, had some sandbox setup issues <img src='http://edmundlong.com/edsBlog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>MissingInclude &#8211; Thrown when a CF resource isn’t found when using cfinclude, cfmodule</p>
<p>      Special variables</p>
<p>    * cfcatch.misingFilename : The missing include filename</p>
<p>Lock &#8211; Exceptions which occur when failed locking operations occur.</p>
<p>      Special variables</p>
<p>    * cfcatch.lockName : the name of the lock that failed<br />
    * cfcatch.lockOperation : the type of lock operation that failed(timeout, mutex or unknown)</p>
<p>Object &#8211; Object exceptions, occur when an operation is performed on an object or something invalid is done with an object</p>
<p>      Special variables</p>
<p>    * Nothing special</p>
<p>Expression &#8211; Exceptions thrown by invalid CF expressions</p>
<p>      Special variables</p>
<p>    * cfcatch.errNumber : The expression error number</p>
<p>Any &#8211; Other errors including custom errors, search engine errors and other Java exceptions not caught by CF.</p>
<p>I’m sure there more but this is what I found from testing. You can find Adobe’s (rather poor) explanation of the CF8 exceptions here</p>
<p>I recently had the need to disable ColdFusion passwords for both the Administrator and the Sandbox security sections of the CF backend. The best way to do this is to directly modify the security xml file that ColdFusion reads in. On the Mac I’m working on this security file was located in /Applications/JRun4/servers/cfusion/cfusion-ear/cfusion-war/WEB-INF/cfusion/lib/neo-security.xml</p>
<p>Alter the end of this file and there are a few booleans there that be set to disable sandbox security, disable admin security, disable rds security and set the admin user name(I believe thats what the final entry is, I haven’t looked into it)</p>
<pre class="brush:xml">
<var name='sbs.security.enabled'><boolean value='false'/></var>
<var name='admin.security.enabled'><boolean value='false'/></var>
<var name='rds.security.enabled'><boolean value='true'/></var
<var name='admin.userid.root'><string>admin</string></var>
</pre>
<div class="fullcircle-social-links" style="display: block;"></div><div style="clear: both;"></div>]]></content:encoded>
			<wfw:commentRss>http://edmundlong.com/edsBlog/cf-exceptions-disable-cf-security-cf-oddities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get a CFC name, simultaneous instances of FF(again), XMLSearch case-sensitivity and Asterisk stats</title>
		<link>http://edmundlong.com/edsBlog/get-a-cfc-name-simultaneous-instances-of-ffagain-xmlsearch-case-sensitivity-and-asterisk-stats/</link>
		<comments>http://edmundlong.com/edsBlog/get-a-cfc-name-simultaneous-instances-of-ffagain-xmlsearch-case-sensitivity-and-asterisk-stats/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 22:42:57 +0000</pubDate>
		<dc:creator>edlong</dc:creator>
				<category><![CDATA[Archive Post]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://edmundlong.com/edsBlog/?p=59</guid>
		<description><![CDATA[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. [...]]]></description>
			<content:encoded><![CDATA[<p>Hi all,</p>
<p>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)<br />
<a href=" http://support.mozilla.com/kb/Running+different+versions+of+Firefox+at+the+same+time"></p>
<p>http://support.mozilla.com/kb/Running+different+versions+of+Firefox+at+the+same+time</a></p>
<p><a href="http://www.jeroencoumans.nl/journal/multiple-firefox-versions">http://www.jeroencoumans.nl/journal/multiple-firefox-versions</a></p>
<p>Here’s a small ColdFusion snippet to get the name of a cfc using the metadata. cfcname contains the name of the cfc.</p>
<pre class="brush:xml">
<cfset cfcname = getMetaData().fullname>
<cfloop condition="find('.',#cfcname#)">
	<cfset cfcname = right(name,len(cfcname) - find('.',cfcname))>
</cfloop>
</pre>
<p>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 &#038; 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.</p>
<pre class="brush:php">
<?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 &#038; $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 &#038; $count>=5)
               {
                        $array[$count][$j]=$token;
                        $j++; $token = strtok(':(');
               }
       $count++;
       $wrets .= '';
       }
		echo "
<form action='currentStats.php' method='post'>";
       /*echo 'Command :
<select name="managersAction">';
       for($i=5;$i<$count-4;$i++){ echo '
<option value="'.$array[$i][0].'">'.$array[$i][1].'</option>

'; }
       echo '</select>

';*/
       echo "

Command :
<input type='text' name='managersAction' size='50'/>

";
       echo "

Parameter :
<input type='text' name='variable' size='40' />

";

       echo "
<input type='submit' value='Perform action' name='submit'>";

       echo "</form>

";
       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);
}

?>
</pre>
<p>This code is very very insecure and I’m using it only for testing, anyone could type ‘restart now’ to reboot your asterisk system!</p>
<p>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</p>
<pre class="brush:xml">
<config>
<edsTest><[CDATA[abc]]&gt;</edsTest>
</config>
</pre>
<p>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. </p>
<div class="fullcircle-social-links" style="display: block;"></div><div style="clear: both;"></div>]]></content:encoded>
			<wfw:commentRss>http://edmundlong.com/edsBlog/get-a-cfc-name-simultaneous-instances-of-ffagain-xmlsearch-case-sensitivity-and-asterisk-stats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a custom Farcry type</title>
		<link>http://edmundlong.com/edsBlog/creating-a-custom-farcry-type/</link>
		<comments>http://edmundlong.com/edsBlog/creating-a-custom-farcry-type/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 22:40:53 +0000</pubDate>
		<dc:creator>edlong</dc:creator>
				<category><![CDATA[Archive Post]]></category>
		<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://edmundlong.com/edsBlog/?p=56</guid>
		<description><![CDATA[Hi again, I’ve been delving into the wonderful world of Farcry CMS. I needed to create a custom type and having never created one before didn’t really know where to start. Luckily for me I’m working with one of the ex-developers of Farcry Michael and he stepped me through how to create it. This process [...]]]></description>
			<content:encoded><![CDATA[<p>Hi again,</p>
<p>I’ve been delving into the wonderful world of Farcry CMS. I needed to create a custom type and having never created one before didn’t really know where to start. Luckily for me I’m working with one of the ex-developers of Farcry Michael and he stepped me through how to create it. This process is for the latest beta version of Farcry 5 so may be different for other versions of the CMS.</p>
<p>First and foremost you need to need to create a new type cfc in you /webroot/farcry/projects/#projectName#/packages/types directory. I created a CFC called Products(although I think you may be better of leaving it all lower case, more on that later) which contains several properties. The properties contained in this CFC define what is to be contained in the request stObj whenever someone hits/calls the new types page. The products cfc extends the farcry core types cfc and so inherits all the generic stuff like status verison, object id etc properties that are common across all farcry objects. Next I began to include my own custom ’stuff’ that I want specific to that object. I created a title, display method and product type. The title is just a string and the display method goes off and creates a drop down list of all objects in the products directory in the webskin that begin with ‘displayPage’, again more on that later. The product type is a list of allowed types of products. I specified this as a string but it can easily be replaced by a query or you can pull in other Farcry objects. Finally we need an edit function that tells farcry where to look when editing the object in the back-end. I specified that farcry should look in the _Products directory and for edit.cfm. So whenever we are editing an object in the back end Farcry will load up edit.cfm and this page essentially becomes a regular form style page with a little difference as you need to save the changes back to the Farcry object &#038; DB when completed.</p>
<pre class="brush:xml">
<cfcomponent displayname="Products" extends="farcry.core.packages.types.types" output="false" buseintree="true">
<cfproperty ftSeq="1" ftFieldset="General Details" name="title" type="string"hint="Product title." required="yes" default="" blabel="true" ftlabel="Product Title" />
<cfproperty ftSeq="2" ftFieldset="General Details" name="displayMethod" type="string" hint="Display method to render this HTML object with." required="yes" ftLabel="Display Method" ftType="webskin" ftPrefix="displayPage">
<cfproperty ftSeq="3" ftFieldSet="General Details"  name="productType" type="string" hint="The product type" required="true" default="Type1" ftLabel="Product Type" ftType="list" ftList="Type1:Type1,Type2:Type2,Type3:Type3,Type4:Type4">
<!--- Object Methods --->
<cffunction name="edit" access="public">
	<cfargument name="objectid" required="yes" type="UUID">

	<!--- getData for object edit --->
	<cfset stObj = this.getData(arguments.objectid)>
	<cfinclude template="_Products/edit.cfm">
</cffunction>

</cfcomponent>
</pre>
<p>The edit.cfm is quite long but I’ve edited it a bit and included it anyway.</p>
<pre class="brush:xml">
<cfsetting enablecfoutputonly="yes" />

<!--- import tag libraries --->
<cfimport taglib="/farcry/core/tags/navajo/" prefix="nj" />
<cfimport taglib="/farcry/core/tags/widgets" prefix="widgets">

<!--- determine where the edit handler has been called from to provide the right return url --->
<cfparam name="url.ref" default="sitetree" type="string">
<cfif url.ref eq "typeadmin">
	<!--- typeadmin redirect --->
	<cfset cancelCompleteURL = "#application.url.farcry#/content/dmProducts.cfm">
<cfelse>
	<!--- site tree redirect --->
	<cfset cancelCompleteURL = "#application.url.farcry#/edittabOverview.cfm?objectid=#stObj.ObjectID#">
</cfif>

<!--- default form elements --->
<cfparam name="form.title" default="">
<cfparam name="form.productType" default="">

<!--- local variables --->
<cfparam name="errormessage" default="">
<cfset lProductTypes = "Type1, Type2, Type3, Type4">

<!------------------------------------------------
	Form Action
	 - self posting form
------------------------------------------------->
<!--- action: cancel --->
<cfif isDefined("form.cancel")>
	<!--- cancel content item lock --->
	<cfset setlock(locked="false")>
	<cflocation url="#cancelCompleteURL#" addtoken="no">
</cfif>

<cfif isDefined("form.update")>
	<!--- action: update --->
	<cfset stProperties = structNew()>
	<cfset stProperties.objectid = stObj.ObjectID>
	<cfset stProperties.label = form.title>
 	<cfset stProperties.title = form.title>
	<cfset stProperties.datetimelastupdated = Now()>
	<cfset stProperties.lastupdatedby = session.dmSec.authentication.userlogin>
	<cfset stProperties.displayMethod = form.displayMethod>	 

	<!--- update the OBJECT if no error occured and reloacte--->
	<cfif NOT len(errormessage)>
		<!--- remove content item lock --->
		<cfset setlock(locked="false")>
		<!--- update content item --->
		<cfset setData(stProperties=stProperties)>

		<!--- if not typeadmin edit then refresh JS tree data --->
		<cfif url.ref neq "typeadmin">
			<!--- get parent to update site js tree --->
			<nj:treeGetRelations typename="#stObj.typename#" objectId="#stObj.ObjectID#" get="parents" r_lObjectIds="ParentID" bInclusive="1">
			<!--- update site js tree --->
			<nj:updateTree objectId="#parentID#">
			<!--- relocate iframes for tree and edit areas using JS --->
			<cfoutput>
			<script type="text/javascript">
			if(parent['sidebar'].frames['sideTree'])
				parent['sidebar'].frames['sideTree'].location= parent['sidebar'].frames['sideTree'].location;
				parent['content'].location.href = "#cancelCompleteURL#"
			</script>
			</cfoutput>
			<cfabort>

		<cfelse>
			<cflocation url="#cancelCompleteURL#" addtoken="no">
		</cfif>

	<cfelse>
		<!--- show error --->
		<cfoutput>
<p id="fading1" class="fade"><span class="error">#errormessage#</span>

</cfoutput>
	</cfif>

<!--- set default values for form--->
<cfelse>
	<!--- Lock content item for editing--->
	<cfset setlock(locked="true")>

	<cfset title = stObj.title>
	<cfset productType = stObj.productType>

</cfif>

<!------------------------------------------------
	Form Display
------------------------------------------------->
<!--- output form UI --->
<cfoutput>
<form action="#cgi.script_name#?#cgi.query_string#" class="f-wrap-1 wider f-bg-medium" enctype="multipart/form-data" name="fileForm" method="post">
<fieldset>
<h3>#application.rb.getResource("generalInfo")#: <span class="highlight">#stObj.title#</span></h3>

		<label for="title"><b>#application.rb.getResource("titleLabel")#</b>
<input type="text" name="title" id="title" value="#title#" maxlength="255" size="45" />
		</label>

		<!--- <widgets:fileUpload fileFieldPrefix="css" fieldLabel="Upload CSS:" uploadType="file" fieldValue="#stObj.filename#" previewURL="/css/" bShowPreview="0"> --->
		<widgets:displayMethodSelector typeName="Products" prefix="displayPage">

		<label for="productType"><b>Product Type:</b>
<select name="productType" id="productType" multiple="true"><cfloop index="iProduct" list="#lProductTypes#">
<option value="#iProduct#"<cfif ListFindNoCase(productType,iProduct)> selected="selected"</cfif>>#iProduct#</option>

</cfloop>
			</select>


		</label>
	</fieldset>
<div class="f-submit-wrap">
<input type="submit" name="update" value="OK" class="f-submit" />
<input type="submit" name="cancel" value="Cancel" class="f-submit" />
	</div>
</form>

</cfoutput>
<cfsetting enablecfoutputonly="no" />
</pre>
<p>Now you’ve created your products.cfc log into the farcry backend and go to the Admin tab. Select COAPI management from the dropdown and then select types on the left hand nav. You should now see your newly created products object here ready to be deployed. You can select deploy and your products should be available in the backend. However you need to do one more thing before you can begin to create products in the backend and view them on the front end, you need to define how products are to be displayed on the front end. To do this create a products directory in the /webroot/farcry/products/#appName#/webskin/ and within this create a page called displayPageStandard. Whenever this page is called the stObj struct is passed into the page and you can now access all the properties of this specific product and display it as you wish. So within this page I just dumped the stObj and then created a simple table of the object title and type. Obviously you can do much more complex stuff than this but this is really just a tutorial on how to do it.</p>
<p>Now you should be able to create product objects select a display method and edit them according to your own custom edit.cfm. One problem I never encountered on my Mac but did in staging was that I had created the products cfc with a large “P” and had use the same casing everywhere around the project. No problem there but in staging an error occurred saying that the table ‘products’ couldn’t be found. Looks like Farcry LCASEs the products name when creating the table, Mac’s NFS filesystem was forgiving but on Linux the problem reared it’s head. Had to rename the table manually and it all worked fine again. Perhaps this is just a bug in the beta that will be fixed come the release date.</p>
<p>I wrote this based entirely off my memory do hope I haven’t left anything out!!!</p>
<div class="fullcircle-social-links" style="display: block;"></div><div style="clear: both;"></div>]]></content:encoded>
			<wfw:commentRss>http://edmundlong.com/edsBlog/creating-a-custom-farcry-type/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CF form validation, Unix search + replace and JMeter load-testing</title>
		<link>http://edmundlong.com/edsBlog/cf-form-validation-unix-search-replace-and-jmeter-load-testing/</link>
		<comments>http://edmundlong.com/edsBlog/cf-form-validation-unix-search-replace-and-jmeter-load-testing/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 22:36:51 +0000</pubDate>
		<dc:creator>edlong</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://edmundlong.com/edsBlog/?p=54</guid>
		<description><![CDATA[I’ve recently been doing some form validation using CF and needed to valid some form fields. One of the form fields was a uuid so was wondering how to check if it was in the correct format. CF’s isValid(’uuid’,form.uuid) did the trick nicely and can be used for a whole bunch of other data-types &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve recently been doing some form validation using CF and needed to valid some form fields. One of the form fields was a uuid so was wondering how to check if it was in the correct format. CF’s isValid(’uuid’,form.uuid) did the trick nicely and can be used for a whole bunch of other data-types &#8211; array, binary, boolean, credit card, date, email, float, guid, integer, query, string, struct, telephone, url or uuid. So as you can see its a very handy function for validating form variables.</p>
<p>I was looking at ways to replace a bunch of strings in a SQL file and came across a unix command sed which can be used to do the job. Using the -e command allows you to replace multiple strings within a file and I then piped the result into a different SQL file.</p>
<pre class="brush:plain">    sed -e “s/string1ToFind\string2Replacement/g” -e “s/stiring2ToFind/string2Replacement/g” -e “string3ToFind/string3Replacement/g” sqlFile1.sql > newSqlFile1.sql </pre>
<p>I’ve also been using JMeter from Apache recently to perform some load tests on a website.<br />
I got the binary here: http://jakarta.apache.org/site/downloads/downloads_jmeter.cgi Just unzip it and run /bin/jmeter and it will load up.</p>
<p>In test plan create a thread group (edit->add->thread group) and there you can set the number of users/threads, loop count and a couple of other things. Select thread group and add a http request(edit->add->sampler->http request). There you can set the webserver name and the rel path from the web-server, add paramters to post(i,.e. mimic a form post) and retreive all embedded resources(if you want to test getting the webpage resources too along with the request). Again you can change stuff like following redirects and other bits and pieces.</p>
<p>You can add a whole bunch of Listeners or reporting graphs/charts. Just select the thread group again and edit->add->listener and add summary report and view reports in tree. The summary report gives you #samples,average,min,max, deviation, errors, throughput, kb/sec and avg bytes while the view reports in tree lets you see what is reqeusted and returned as part of the http request. I’ve not checked out other reports, I’m sure they contain lots of handy stuff.</p>
<div class="fullcircle-social-links" style="display: block;"></div><div style="clear: both;"></div>]]></content:encoded>
			<wfw:commentRss>http://edmundlong.com/edsBlog/cf-form-validation-unix-search-replace-and-jmeter-load-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
