May 2005 Archive
Nice date pattern today!
Al just pointed out to me that today is 05/05/05!
That is a nice pattern!
Posted by Niklas Richardson on 05 May 2005
Don't forget to vote!
Today in Great Britain, it is voting day for the General Election!
This is the day that we get to decide who is going to run our country!
So, don’t forget to vote!
Posted by Niklas Richardson on 05 May 2005
Don't forget to vote!
Today in Great Britain, it is voting day for the General Election!
This is the day that we get to decide who is going to run our country!
So, don’t forget to vote!
Posted by Niklas Richardson on 05 May 2005
We now offer Macromedia Certified Flex Training
I am pleased to announce that Macromedia has just certified me as a Flex Trainer! We are quite pleased to offer this service to all of those developers who are transitioning into Flex.
For more information about the materials, the course outlines, please give us a call.
Over the next month we will be putting materials on our website which goes into greater details about what Flex Mentoring Services we offer.
Posted by Neil Middleton on 05 May 2005
Blog fixed!
So the blog broke when we moved server!
But now it’s back, so be prepared for Prismix posts again!
Posted by Niklas Richardson on 05 May 2005
Flash Form Error Messages - New Lines
As well as working on a large Flex project, we have also been working on a couple of large ColdFusion MX 7 Intranet projects since Christmas and both of them use Flash Forms heavily.
While creating custom error messages for some form fields I wanted to split the error message over multiple lines to make it’s content clearer.

It is very easy. All you need to use is the new line escape code “\n”.
e.g.
[code lang=“cf”]
[/code]
Posted by Niklas Richardson on 12 May 2005
Where do I send product feedback and report bugs?
Some times it is a bit difficult to know where to go when you have some suggestions or problems with a Macromedia product or product documentation.
When I’ve noticed issues or had suggestions the Macromedia team pointed me in the direction of the ‘Feature Request/Bug Report Form’.
http://www.macromedia.com/support/email/wishform/
For documentation requests and comments, there is a seperate docs email form.
http://www.macromedia.com/support/email/techsupport/
Both of these are outline in the below TechNote ’ Sendig feedback to the product and documentation teams’.
http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_12032
Posted by Neil Middleton on 16 May 2005
Bug in XMLSearch() on CFMX 6.1 with Updater?
We appear to have found a bug in XMLSearch() where it throws an ArrayOutOfBounds error if the xPathString attribute value is too long.
We’re creating an xPathString value automatically, and well, it can get quite long. In fact, over 4270 characters long.
When I ran my test XMLSearch() through the above error when the xPathString attribute value was 4270 characters long. However, it didn’t throw an error when it was 4210 characters long.
Therefore, there is some value between 4210 and 4270 which is the wall where ther error happens. Unfortunately I haven’t been able to narrow it down any further.
Has anyone else ran into this issue?
Fortunately we have created a workaround but splitting our xPathString into small chunks and then appending the resultant arrays together.
Ugly!
Posted by Niklas Richardson on 16 May 2005
List Looping vs Array Looping!
I’ve been having an interesting discussion with Barney over at BarneyBlog about looping over lists in CFSCRIPT.
When ColdFusion moved from Version 5 to MX, one of the many things that changed was that lists became less performing than arrays (when it came to looping through the items). This is due to the way Java works under the hood with specific data types!
However, I learnt a very valuable lesson today!
I attempted to disprove my originally assumption by creating an array with 10,000 items of variable length (between 5 chars and 15 chars). I then performed two tests:
- Test 1 – Loop over the list and set a variable to the item value using ListGetAt().
- Test 2 – Convert list to an array, loop over the array and set a variable to the item using array notation.
The results were staggering:
- Test 1 took around 31 seconds.
- Test 2 took around 0 ms (max 15 ms).
The moral of the story: if you are using CFSCRIPT and want to loop over a list, always, ALWAYS, convert it to an array.
Here’s the testing code:
[code lang=“cf”]
// Generate Array of 10000 items – randomly generated chars, random length between 5 and 10 chars
total = 10000;
lTest = "";
for (i = 1; i lte total; i = i + 1)
{
lTest = listappend(lTest, generateRandomLengthData(5, 15, i));
}
// Test 1 – Looping over a list and using listGetAt()
startTickCount = getTickCount();
for (i = 1; i lte listlen(lTest); i = i + 1)
{
item = listGetAt(lTest, i);
}
endTickCount = getTickCount();
listTickCount = endTickCount-startTickCount;
// Test 2 – Converting list to an array before looping over the array
startTickCount = getTickCount();
aTest = listToArray(lTest);
for (i = 1; i lte arraylen(aTest); i = i + 1)
{
item = aTest[i];
}
endTickCount = getTickCount();
arrayTickCount = endTickCount-startTickCount;
List Time: #listTickCount# ms
Array Time: #arrayTickCount# ms
[/code]
And my utility functions for generating random data:
[code lang=“cf”]
function generateRandomData(numChars)
{
var character = "";
var firstNumber = 0;
var secondNumber = 0;
var numberToSelect = 0;
// Iterate
if (arguments.numChars gte 1)
character = generateRandomData(arguments.numChars-1);
// Seed
randomize(arguments.numChars, “SHA1PRNG”);
// Select Number
firstNumber = randRange(65, 90, “SHA1PRNG”);
secondNumber = randRange(97, 122, “SHA1PRNG”);
numberToSelect = randRange(1, 2, “SHA1PRNG”);
if (numberToSelect eq 1)
character = character & chr(firstNumber);
else
character = character & chr(secondNumber);
return character;
}
function generateRandomLengthData(minNumChars, maxNumChars)
{
var seed = 1;
var dataLength = 1;
// Optional Arguments
if (arraylen(arguments) gte 2)
seed = arguments3;
randomize(seed, “SHA1PRNG”);
dataLength = randRange(arguments.minNumChars, arguments.maxNumChars, “SHA1PRNG”);
return generateRandomData(dataLength);
}
[/code]
Posted by Niklas Richardson on 18 May 2005
How do I get 'this' URL in Flex.
Someone asked this on the Flex Coders list today “What is the best way to get a fully qualified URL of ‘this’ application in Flex” (i.e. ‘http://www.prismix.com/index.mxml’) – below is an example that we came up with.
At first, I tried using root.url, but this is bad form in Flex, you want to avoid the whole ’root’ from your Flex development. Instead Flex maps these ’root’ level environment variables into the mx.core.* packages.
[code lang=“xml”]
<?xml version=“1.0” encoding=“utf-8”?>
private function getPageURL() : String
{
return(mx.core.Application.application._url);
}
private function getPageDomain() : String
{
var myArray:Array = getPageURL().split(“/”);
var domain = myArray2.toString();
return(domain);
}
]]>
[/code]
Posted by Neil Middleton on 19 May 2005
How do I run a JRUN Server as a Windows Service?
This has come up in Flexcoders and I think it is work posting again. If you are using JRUN you can run any server as a windows service by using the JRUN Command Line Tool ‘jrunsvc’.
From the JRUN Live docs (http://livedocs.macromedia.com/jrun/4/JRun_SDK_Guide/apis4.htm):
Using the jrunsvc tool
Use the jrunsvc tool to execute command on a JRun server that is a Windows service. With this tool, you can install, remove, start, and stop the JRun server’s Windows service.
To install a JRun server as a Windows service, use the following syntax from the jrun_root/bin directory:
%> jrunsvc -install jrun_server [service_name [service_display_name [service_description]]]
To remove, start or stop a JRun server that is currently a Windows service, use the following syntax from the jrun_root/bin directory:
%> jrunsvc -[remove|start|stop service_name]
Posted by Neil Middleton on 20 May 2005
Setting up Flex 1.5 on JRun with Apache
After walking a client through the install of Flex 1.5 on a clean install of JRun and then using Apache as a web server, I thought it would be a great idea to put down the instructions for everyone else, and also see if anyone else had any comments.
I may have skipped a few steps or assumed things. If so please comment and I will improve these steps. There are some steps that are probably not required, or are totally for my own taste, but I welcome comments for those too.
In fact, I welcome any feedback.
The steps below assume the following:
- you have already installed JRun (to D:\JRun4).
- you have already installed Flex 1.5 (to D:\Program Files\Macromedia\Flex).
- you have already installed Apache and it is configured for running virtual hosts.
- you have already set up a/the new domain name in DNS.
So, here follows the steps:
SETTING UP A JRUN SERVER
(1) Log in to your JRun admin.
(2) In the JRun admin click “Create New Server”. Specified the JRun Server Name as “flex15” (no quotes). Leave JRun Server Directory as the default. Click “Create Server”. On the subsequent screen click “Finish” unless you want to change the port numbers.
SETTING UP FLEX IN JRUN AS AN ENTERPRISE APPLICATION
(3) Go to the D:\JRun4\servers\flex15 directory. Create a directory called “flex-ear” (no quotes – I’ll stop saying this now!).
(4) Expand the D:\Program Files\Macromedia\Flex\flex.war into a temporary directory. You should now have a directory called “flex”. Rename the “flex” directory to “flex-war”.
(5) Move “flex-war” directory into “flex-ear” directory created above. You should now have a path like this: “D:\JRun4\servers\flex15\flex-ear\flex-war”.
(6) Copy the directory “META-INF” from inside “D:\JRun4\servers\flex15\default-ear” to “D:\JRun4\servers\flex15\flex-ear”.
(7) Edit the file “D:\JRun4\servers\flex15\flex-ear\META-INF\application.xml” to read:
[code lang=“xml”]
<?xml version=“1.0” encoding=“UTF-8”?>
<!DOCTYPE application PUBLIC “-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN” “http://java.sun.com/j2ee/dtds/application_1_2.dtd”>
[/code]
(8) Now delete the “default-ear” directory in “D:\JRun4\servers\flex15” as it is no longer required.
(9) Go back to the JRun admin and start the new “flex15” server that we created.
(10) Once it has started expand the tree under the server label in the left nagivation and click on “Services”.
(11) Ensure that the ProxyService is started and the WebService is stopped. Start / Stop them as required.
Final Steps – Option 1 of 2 – No Pre existing JRun and Apache configuration
(12) We now need to set up JRun to allow Apache to send Flex requests to it. For simplicities sake let’s use the Web Server Configuration Tool. I won’t go into the details of using it as there are plenty of other docs. Ensure that you select the correct JRun Server, and to select Apache under Web Server properties and specify the correct details.
SETTING UP APACHE TO PASS REQUESTS TO THE FLEX SERVER
(13) Create a new directory in your file system which will be the root of your new Flex 1.5 web site (e.g. E:\Websites\FlexApp\wwwroot).
(14) Create a new virtual host config with the following (as an example).
[code lang=“xml”]
<virtualHost *:80>
ServerName flex15.domain.com
ServerAdmin admin@prismix.com
DirectoryIndex index.mxml
DocumentRoot E:\Websites\FlexApp\wwwroot
ErrorLog logs/flex15-error.log
CustomLog logs/flex15-access.log common
[/code]
(15) Start the JRun “flex15” server in the JRun admin.
(16) Restart the Apache service.
(17) Everything is now configured and you should be able to run MXML files place in your web root.
Alternative Final Steps – Option 2 of 2 – Pre existing JRun and Apache configuration
If you have already run the Web Server Configuration Tool to connect another JRun server to Apache then you will need to perform the next manual steps.
(12) Go to “D:\JRun4\lib\wsconfig” directory. Copy and paste directory “1” (or another other directory) and rename copy to “flex15”. You should then have the following path “D:\JRun4\lib\wsconfig\flex15\”.
(13) In “D:\JRun4\lib\wsconfig\flex15\” edit the “jrunserver.store” file and change the following line to read:
[code lang=“xml”]
proxyservers=127.0.0.1:58801
[/code]
You will need to look in the JRun admin to get the correct proxy port for the Flex 1.5 server that we created.
SETTING UP APACHE TO PASS REQUESTS TO THE FLEX SERVER
(14) Create a new directory in your file system which will be the root of your new Flex 1.5 web site (e.g. E:\Websites\FlexApp\wwwroot).
(15) Create a new virtual host config with the following (as an example). Ensure that the settings are configured for your setup. Specifically be aware of the “JRunConfig” lines which specify how Apache connects to JRun. You will need to set the “JRunConfig Serverstore” and “JRunConfig Bootstrap” values to the path and proxy configure in steps 12 and 13.
[code lang=“xml”]
<virtualHost *:80>
ServerName flex15.domain.com
ServerAdmin admin@prismix.com
DirectoryIndex index.mxml
DocumentRoot E:\Websites\FlexApp\wwwroot
ErrorLog logs/flex15-error.log
CustomLog logs/flex15-access.log common
JRunConfig Serverstore “D:/JRun4/lib/wsconfig/flex15/jrunserver.store”
JRunConfig Bootstrap 127.0.0.1:58801
JRunConfig Apialloc false
AddHandler jrun-handler .jsp .jws .mxml
[/code]
(16) Start the JRun “flex15” server in the JRun admin.
(17) Restart the Apache service.
(18) Everything is now configured and you should be able to run MXML files placed in your web root.
Posted by Niklas Richardson on 23 May 2005
ColdFusion's 10th Birthday on July 13th!
Okay, so this has probably been blogged to hell, but what the heck, I didn’t see anything on the UKCFUG Blogregator!
If you didn’t already know, it is ColdFusion’s 10th birthday on July 13th. From the Macromedia website:
“On July 13, Macromedia is celebrating the 10th birthday of ColdFusion. The founders of ColdFusion, JJ and Jeremy Allaire, will be joining us for a fun retrospective on the history of ColdFusion. Our current ColdFusion team members will also be giving attendees a sneak peek into the future of ColdFusion.”
http://www.macromedia.com/software/coldfusion/special/birthday/
Posted by Niklas Richardson on 24 May 2005
| www.flickr.com |
Archives
Posted by Neil Middleton on 01 Jan 1910
From our portfolio
| www.flickr.com |