Mark Drew (Redux)- cf_etc...

a compendium of railo, cfml, cfeclipse and technology topics

Mark Drew (Redux)- cf_etc...

Entries Tagged as coldspring

ColdFusion Webservice gotcha on OS X

September 25, 2008 · 2 Comments

As I was getting my presentation on ColdSpring ready for A Wee Dram of Scotch, I come across the following problem, that none of my webservices would work! I started getting the following error:

coldfusion.jsp.JavaCompiler$UnknownCompiler: Unable to run the internal Java compiler: java.lang.NoClassDefFoundError: javax/tools/StandardJavaFileManager.

Following a bunch of blogs and thanks to Peter Freitag, the answer was simple, move the tools.jar from your <ColdFusion Install>/lib (or <JRUN Install>servers/cfusion/cfusion-ear/cfusion-war/WEB-INF/cfusion/lib ) and restart the server. Bam... back to webservices working fine again. I am just putting this either to help other people, or to help me next time I forget about this

2 CommentsTags: coldfusion · coldspring

Live from A Wee Dram of Scotch

September 25, 2008 · 1 Comment

I just finished presenting my "Better living through configuration" presentation at A Wee Dram of Scotch in London. Its a great presentation so far with Adam Lehman and Claude from Adobe kicking off the proceedings and showing the (possible) Hibernate features in Centaur (or the "Eagerly Awaited next version of ColdFusion"). 

The rest of the day should be really interesting, and currently Peter Bell is telling us about RAD OO.

This is the smallest conference I have been to, and I think its great, there are only about 70 people in the same room and its only one day... a great way to really meet other developers (rather than the immense scale of other conferences)

If the wireless picks up, I shall try and post some more today, if not I shall give you a breakdown (after the hangover ) tomorrow!

In the meantime, here is my presentation and code for you to play with!

1 CommentTags: CFConferences · coldfusion · coldspring · presentations · scotch on the rocks

Getting ready to sip a Wee Dram of Scotch in London

September 23, 2008 · 1 Comment

Coming up this Thursday 25th of September, the "a Wee Dram of Scotch" one day conference is taking place in London.

This is a great replacement to the cancelled CFDevCon that was meant to be happening over in Brighton, but alas didn't for various reasons. Which brings to mind whether we should have more conferences like this, one day, very cheap (at £10 for entry its surely the cheapest conference there is!) but with still some awesome speakers such as Sean Corfield, Peter Bell and Mike Brunt, not to mention Adam Lehman from Adobe doing the keynote!

So what do you think? Should there be more one day conferences? Would you like your CFUG to cover this instead? More cheap (or free) training in your locality?

Also, how would we expand the use of CF? Is this a good medium for this?

Would love to hear people's opinions on this.

1 CommentTags: CFConferences · coldfusion · coldspring · frameworks · scotch on the rocks

My CFUnited presentations available on Adobe Connect

June 24, 2008 · No Comments

During the CFUnited 2008 Conference in DC, most speakers were able to record their presentations onto Adobe Connect. This is a great feature for most presentation styles (of course not all, since you might want to have a discussion, rather than a presentation), rather than just filming the speaker. Here are the Adobe Connect presentations that have been posted so far: You can see the other presentations posted here and here Let me know what you think!

No CommentsTags: adobe · CFConferences · cfeclipse · cfunited · coldfusion · coldspring · presentations

CFUnited! What a busy conference!

June 11, 2008 · 2 Comments

Next week, CFUnited DC gets on the way, and what a busy conference it will be! Having checked my schedule it looks like it will be a real marathon for me. Here is my schedule: Wed 1:30 - 2:30 : ColdSpring: Better living through configuration Wed 8:30pm - 9:30pm : Improving quality through code reviews and mentoring Thurs 9:30 - 10:30: Fresh Air: Getting to grips with Aptana and AIR applications Fri 9:45-10:45: CFEclipse Reloaded Fri 11:00 - 12:00: Jing Demo (5 mins) Fri 11:00 - 12:00: Railo Demo (10 mins) Sat 9:45-10:45: CFEclipse Reloaded Sat 2:45-3:45: ColdSpring: Better living through configuration You might ask what the Jing and Railo Demo's are about, well, you are just going to have to turn up and find out! :) Hope to see you all there!

2 CommentsTags: AIR · CFConferences · cfeclipse · cfunited · coldfusion · coldspring · frameworks · railo

ColdSpring: Better living through configuration presentation

June 08, 2008 · No Comments

As promised, I wanted to share my "ColdSpring: Better Living through Configuration" presentation materials. I am not including the source code, since its very simple and its covered in the presentation itself (and if you work through it, you will get a better understanding!) Attachment: ColdSpringScotch2008.pdf

No CommentsTags: coldfusion · coldspring · presentations · scotch on the rocks

Getting all Scotch'd up this week!

June 02, 2008 · No Comments

Tomorrow I shall be heading to Edinburgh for the fantastic Scotch on the Rocks conference. I know Andy Allan has been working really hard to get this conference going and last year's event was a real blast! This year I shall be presenting a couple of topics, ColdSpring: Better Living through Configuration and a new topic which is FreshAIR: Developing Adobe AIR applications using Aptana Studio. This makes a change to my usual CFEclipse presentations and I have been working hard on making them both informative and entertaining (no, no juggling... sorry!) I am really looking forward to meeting some old friends as well as new ones! So come and say hello!

No CommentsTags: AIR · CFConferences · coldfusion · coldspring · scotch on the rocks

Presenting ColdSpring at cfObjective today!

May 03, 2008 · 2 Comments

Sean mentioned last night, due to Hal Helms being unable to come to cfObjective because of health reasons a few sessions have been flipped about but like one of those slidey puzzles where you are trying to get those squares in order to make a picture of a butterfly, there is still a slot missing. I shall try to fill in that slot with a introductory presentation into ColdSpring called "ColdSpring: Better living through configuration". Since its a last minute change, I am hoping *some* people will turn up! I actually enjoy doing this presentation so it should be a laugh if anything!

2 CommentsTags: CFConferences · cfObjective · coldfusion · coldspring · presentations

EventValidation: Getting Ajax (AJAJ) client side validation working

November 27, 2007 · 2 Comments

One of the downfalls of the current cfform implementation of validation is that it only does it on the client side (as far as I have used it, it might have changed). So, you design your form, add some client side validation, then realise that people without javascript enabled are sending junk and you have to re-implement the validation server side. So far so good. But then you are asked to change the validation ("hey, check it really is a creditcard number before we send it to the payment gateway", your boss says) and you implement that on the server side, and then copy the functionality to the client side. The list of changes go on, you go make a cup of coffee and forget to implement one side of the validation somewhere. With EventValidation, you define your validations in one place and you just define whether you are using client side validation. Lets check it out. Here is our modified form from before, and you notice, there is only one change, adding client="true" to the ev:setup tag (and make sure you import the form tags from "/EventValidator/taglib/form" as well as the showerror="true"): <h1>Register</h1>
<cfimport prefix="ev" taglib="/EventValidation/taglib">
<cfoutput>
<form action="#ViewState.getValue("myself")#register.action" method="post" >
<ev:setup id="ev_Register" successEvent="register.action" client="true" showerror="true">
<div>
<label for="email">email:</label>
<input type="text" name="email" id="email" value="#ViewState.getValue("email")#">

<label for="password">password:</label>
<input type="password" name="password" id="password" value="#ViewState.getValue("password")#">
</div>
<div>
<input type="submit">
</div>
</form>
What happens when you call this page, the form fields are replaced with a normal formfield and a hidden div. Also, javascript links are added to the header (in this case JQuery, the form plugin and the EventValidator setup script), which setup your form and the AJAJ based calls are added to the forms on the page (of course, it only adds it to forms that need it!) And that is it, your headaches gone. Apart from one, you would need to make a Virtual Directory on your web server to the "EventValidator/scripts" so you can have access to these scripts, but what if you can't do that (or cant be bothered?). The easiest way to change that is to copy the scripts from EventValidator/scripts somewhere else and change the scriptsrc attribute in the ev:setup tag: <ev:setup id="ev_Register" successEvent="register.action" client="true" showerror="true" scriptsrc="/scripts/"> Now you are all sorted and can see it working.

2 CommentsTags: coldfusion · coldspring · EventValidation

EventValidation: What are we validating against anyway? And how can we add our own validations?

November 26, 2007 · 2 Comments

One thing that I think I forgot to mention is WHAT you can validate against with the EventValidation Action Pack. I thought I would write up a little guide about what you can validate against and even better, how you can extend the validation object to validate against something that is custom. The current event data check rules that you can apply are as follows: Specific EventValidator rules:
  • required: That the field must be in the event and that it must have some length
  • equals: This is a handy function, you can check whether one field equals another, or that a field equals a value, for example to check that the password field matches the password_confirm field we would add this entry in the validation bean: <map>
             <entry name="field"><value>password</value></entry>
             <entry name="field2"><value>password_confirm</value></entry>
             <entry name="rule"><value>equals</value></entry>
          </map>
    If of course we wanted to make sure the password was something like "watangy", we could change the field2 to a value, as follows: <map>
             <entry name="field"><value>password</value></entry>
             <entry name="value"><value>watangy</value></entry>
             <entry name="rule"><value>equals</value></entry>
          </map>
    Of course, this is not the best thing to do since the error would display:
    "The field #rule.getField()# must equal #rule.getValue()#."
    So, we can override the default error message as follows: <map>
                <entry name="field"><value>password</value></entry>
                <entry name="value"><value>watangy</value></entry>
                <entry name="rule"><value>equals</value></entry>
                <entry name="errortext"><value>The password is incorrect</value></entry>
             </map>
  • lessthan/morethan: That the field value is less/more than the value set (such as "you must be over 18 and under 400 to enter this site")
  • maxlength/minlength: The length of the field value is more/less than the value set (such as "your password must be between 40 and 60 characters long")
ColdFusion supplied validation rules: EventValidator uses the isValid function and a lot of the in-built ColdFusion validations, these are (I wont list documentation individually, check the Livedocs for details): boolean,creditcard,date,time,email,eurodate,float,numeric,guid,integer,ssn,social_security_number,string,telephone,url,uuid,usdate,xml,zipcode Creating your own validations But what about a validation that needs to contact a database or do some other kind of processing that is specific for your system? Well, these are easy to implement. Lets take an example where a user cannot register with a username that has already been taken, which means that I shall need to go into the database to check this. First step is to create my own validation component, that extends "EventValidation.model.EventValidator" and overriding the "validateEvent" method, then add a loop through the validation rules and creating my own type of validation, here is a quick example: <cfcomponent extends="EventValidation.model.EventValidator" output="false">

   <cffunction name="validateEvent" returntype="void" access="public" output="false">
         <cfargument name="event" type="any" required="true">
         <cfargument name="context" type="string" required="true">

         <!--- Call the normal validations --->
         <cfset super(arguments.event, arguments.context)>

         <!--- Loop through the validations --->
         <cfloop from="1" to="#ArrayLen(variables.ValidationMap)#" index="r">
               <!--- Setup defaults for each validation --->
               <cfset rule = CreateObject("component", "Rule").init(variables.ValidationMapr])>
            

            <cfswitch expression="#UCase(rule.getRule())#">
               <!--- our own validation --->
               <cfcase value="usernotexists">

                     <!---
                        Go get the user from the db
                        Of course, this might be a service or interacting with your own ORM
                     --->

                     <cfquery name="getUser">
                        SELECT userid FROM Users WHERE username = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(event.getValue(rule.getField()))#">

                     </cfquery>

                  <cfif getUser.recordcount>
                     <cfset event.getValue("ErrorCollection").addError(rule, "The Username #event.valueExists(rule.getField())# has already been taken")>
                  </cfif>
               </cfcase>
            </cfswitch>


         </cfloop>
   </cffunction>
   </cfcomponent>
Hopefully the comments in the code above explain what is going on, but essentially you are calling super() to let all the previous validations work, and then we loop through the validationMap which contains our entries and create a rule object for each entry, we then use a switch (you dont have to, but I might be extending this to have a whole bunch of user based validations) with an entry for "usernotexists", my new validation rule. I then do a query and check it against the username and if it is found, I add an error to the ErrorCollection. The next step is to setup my bean, as you would do normally but instead of using "EventValidation.model.EventValidator" I use my extended class: <bean id="userValidation" class="myProject.model.UserValidator">
          <constructor-arg name="rules">
             <list>
                <map>
                   <entry key="field"><value>username</value></entry>
                   <entry key="rule"><value>usernotexists</value></entry>
                </map>
            </list>
         </constructor-arg>
   </bean>
And there you have it, you have now checked your username against your specific database. Now you can add all sorts of validations that are specific to your own systems!

2 CommentsTags: coldfusion · coldspring · EventValidation