Category: Coldfusion

Jul 16 2008

Removing spaces from a string with coldfusion

Ran into this problem today and it seemed to take quite a long time for me to find a solution so I'm posting how it works here for the benefit of others. This method uses a regular expression to do it's bidding.

<!--- set up a test variable --->
<cfset mySpaceFilledString = "a brand new combine harvester" />

<!--- remove ALL spaces from the string --->
<cfset mySpaceFreeVariable = ReReplace(mySpaceFilledString, "[[:space:]]","","ALL")>

<!--- check it works --->
<cfdump var = #mySpaceFreeVariable#>

this returns "abrandnewcombineharvester" - all spaces removed from the whole string



To simply remove the spaces at the beginning and end of a string (a form field for example) it's much easier...

<!--- set up a test variable --->
<cfset form.myTestString = " mark mcaulay " />

<!--- remove spaces from start and end of the string --->
<cfset mySpaceFreeVariable = Trim(form.myTestString)>

<!--- check it works --->

<cfdump var = #mySpaceFreeVariable#>


this returns "mark mcaulay" - only the spaces at the start and end of the string have been removed

Hope this helps someone!

**UPDATE - Just for good measure, and of course, to keep James happy ;) here is the equivelent in php

<?php

// set up a test variable

$mySpaceFilledString = " a brand new combine harvester ";

// remove all spaces from the string

$mySpaceFreeVariable = str_replace(" ", "", $mySpaceFilledString);

// check it works

echo $mySpaceFreeVariable;

?>

this returns "abrandnewcombineharvester" - all spaces removed from the whole string

To simply remove the spaces at the beginning and end of a string (a form field for example) it's again, much easier...

<?php

// set up a test variable

$myFormVariable = " mark mcaulay ";

// remove spaces from start and end of the string

$myTrimmedVariable = trim($mySpaceFilledString);

//check it works

echo $myTrimmedVariable;

?>

this returns "mark mcaulay" - only the spaces at the start and end of the string have been removed

5 comments - Posted by mark at 7:50 PM - Categories: Coldfusion

Jun 5 2008

Scotch On The Rocks Day 2

So, following on from my post on day 1 of Scotch on the Rocks, here is my post on day 2.

Rolled into the George Hotel after 9 hours sleep (a huge improvement on yesterday's awake/asleep mismatch), coffee in hand and ready for the Doug Hughes "CFC Crash Course" parts 1 and 2 session. From the basics of what a CFC is and how we might use it, stepping it up a few levels through nearly 2 hours, this was a very worthwhile session(s) for someone at my level. I got a lot out of this session and feel I could have gone another hour easilly on this, very helpfull stuff.

Read more...

1 comments - Posted by mark at 10:01 PM - Categories: Coldfusion

Jun 4 2008

Scotch On The Rocks Day 1

I got up nice and early this morning (4.30am), got my stuff together and headed for the station to get myself to Edinburgh for this years Scotch on the Rocks Coldfusion conference.

Arriving nice and early in Edinburgh, Julie, James, Colin(all RGU) and I had a quick coffee and then it was straight to the George Hotel for Registration and the Keynote from Adobe, namely Ben Forta and Adam Lehman who went through some bits and pieces about coldfusions role with RIA, namely Flex and Air (no surprises there then), some interesting stuff but largely nothing much to report that is not already public knowledge. Nice surprising moment when Ben Forta asked the 100+(don't know exact number but definately more that 100) delegates which tool they used for writing coldfusion and the result was a massive show of hands for CFEclipse compared to a handfull of Dreamweaver and Homesite users. Mark Drew who was sitting close to the front must have felt rather proud of himself!

Read more...

3 comments - Posted by mark at 7:21 PM - Categories: Coldfusion

May 1 2008

ubuntu 8.04 up and running

That's me just completed the installation of eclipse, cfeclipse and flex builder which brings my laptop back up to "code ready". I had been running Ubuntu 7.10 but being the new software slut that I am, I had been falling over myself to perform the upgrade to 8.04. Common sense has always told me to run linux distros a versions old to ensure they're stable but for some reason with Ubuntu I seem to be keen to throw caution to the wind!

So eager was I to do this, yesterday I rushed into work to take advantage of the super rapid connection before anyone else turned up...only thing being, i'd forgotten my power lead....arse....so the upgrade was rescheduled for today.

Rolled into work before 8am and got the upgrade underway, if you were following my twitter feed, you'll know what I thought of that process....a clean install it was then. Backed up my data while downloading the iso and then 40 mintes after running the disk I had a fresh install of Ubuntu...no driver problems, no issues at all...went to connect to the wireless network and yep...typed in the network key and away i went...piece of piss, try doing that on windows.

today's valuable lesson?....sack the upgrade unless you have a lot of time to burn, just back up your data, remember what you need to reinstall and perform a clean install of Ubuntu.

2 comments - Posted by mark at 11:15 PM - Categories: Linux | Eclipse | Coldfusion | Flex

Feb 15 2008

CF_SCOTCH TOUR: Aberdeen Meet-up

Thought I'd do my bit to promote the second Aberdeen meetup. The first one was a great success and plenty of geek talk was had by all...oh and there was beer too... So the second meet-up will be happening at the RGU Union training room on the 29th Feb 2008 kicking off at 16:30. here are the details: What's Happening? Following the success of last years local Scottish ColdFusion User Group (SCFUG) meet up, we're pleased to announce that we're back for another round! Standards aren't slipping either. We'll have food laid on for everyone courtesy of our kind sponsor Fuzzy Orange who are also going to be buying everyone a 'wee hello' drink. Also, thanks to your feedback from last time, we're arranging an exclusive presentation for everyone that attends - more information on this will follow shortly. Why should I be interested in this? Our event isn't just for experienced ColdFusion Developers. Anybody interested in learning about the technology or use other Adobe related technologies (Flex, Flash or Dreamweaver etc.) can benefit. Skills, experience and backgrounds of people who have attended in the past have varied greatly. Therefore, there is plenty of opportunity for everyone to learn something new, discuss ideas & opportunities and find out if there is way of making your daily work lives easier. You'll also get an opportunity to find out about and ask questions to the organisers of this year's Scotch on the Rocks 2008 event being held in Edinburgh between June the 4th and 6th. Sounds great. How much is this going to cost me? Absolutely nothing but a few hours of your time. What more can you ask for? You'll have: - An exclusive opportunity to network with fellow ColdFusioners and other local talent - A professional presentation by a leading experts - Some lovely local food and drink put on by the staff at the RGU Union - And we may even have some giveaways Ok so what do I need to do? Before a date was even announced for this we've had some great response to its return. Will you be at this one? If you want to come along, email me * before the 22nd Feb with any dietary requirements and i'll pass your details along to the organiser (you can register after this point but you wont get any food) * (the organiser is James Buckingham but i didn't think he'd be too happy with me splashing his email address across the internet!)

0 comments - Posted by mark at 11:23 AM - Categories: Coldfusion | Flex

Nov 23 2007

handy things found in cfeclipse

I thought I'd start a post relating to useful shortcuts etc I've discovered using cfeclipse for my development work. I don't know how much of this will actually be cfeclipse specific or a feature of other plugins I have installed...or even a feature of eclipse itself...I'm not interested in writing a manual here, I just wanted to post some handy stuff that maybe other people will find useful too. The first handy thing I found was the "Link with editor" button in the Navigator tab...this was something that dreamweaver did automatically and that I'd missed when opting for an eclipse environment....the bonus is I can now choose to switch it on or off...choice is king! Link with editor in cfeclipse next up is a couple of shortcuts i've discovered...the first is to add a HTML comment, select the html you want to comment and press ctrl+shift+c....job done!...and for a coldfusion comment press ctrl+shift+m ...can't be easier than that can it? will add more as I discover them, feel free to join in though.

0 comments - Posted by mark at 11:26 AM - Categories: Eclipse | Coldfusion | Tools

Oct 20 2007

blogcfc survey

Just noticed that raymond camden has posted a survey for users of blog cfc...if you're using it, you know you want to help so go do it! direct link to the survey

0 comments - Posted by mark at 7:16 PM - Categories: Coldfusion