Category: model-glue

Oct 24 2008

The oddest CF error/strangeness I have spotted

I recently have been working on adding a couple of different cache providers for Model-Glue 3 .

So I was getting my head round Andrew Powell's CF_EHCache so that I can write an interface for it that Model-Glue can use, which should be simple enough since it already uses a SimpleTimedCache, when I come across a very odd thing, with the code out of the box I got the following error:

The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code.
   Null Pointers are another name for undefined values.

So I started dumping my way through it, so to speak, but it would work... eh?!

	<cfscript>
		var mBeanServer     = createObject('java','java.lang.management.ManagementFactory').getPlatformMBeanServer();

			variables.manager	= createObject('java','net.sf.ehcache.CacheManager');
			variables.manager.create(javacast("string",expandPath('#arguments.scope#.xml')));
			variables.cacheName = arguments.cacheName;
	</cfscript>
	<cfdump var="#variables.manager#">
	<cfset createObject('java','net.sf.ehcache.management.ManagementService').registerMBeans(variables.manager,mBeanServer,
		javacast("boolean",false),
		javacast("boolean",false),
		javacast("boolean",false),
		javacast("boolean",true))>
<cfset variables.manager.addCache(javacast("string",arguments.cacheName))>

 

The above is the constructor code, I have split it out a bit so that you can see what is happening, but if call the above code without the cfdump, I get an error, but if remove it, it crashes. I have never seen something like this before.

UPDATE!

This morning, writing this post, I realised that in the third line I had forgotten to add the .init() to the CacheManager. Go figure! Seems that cfdump does the init for you eh?

0 comments - Posted by Mark Drew at 3:08 AM - Categories: model-glue | model-glue | coldfusion

Nov 6 2007

Like Model-Glue? Then get trained!

As you may know from my previous posts, I am a bit into Model-Glue. Besides giving tips on using it I have talked at a couple of ColdFusion User Groups about the framework and try and pass on any knowledge I can, since I think its a nice brief framework that in conjunction with ColdSpring and Reactor (or Transfer) can really help your application development. The problem with just giving tips, is that if you have a whole development team to get up to speed, you need more formal training to really get up to speed. If you are in the USA, I found out recently that Alagad,Inc that über development company (run by Reactor supremo Doug Hughes, with none other than Jared Rypka-Hauer and Scott Stroz amongst others!) has started offering training courses in Model-Glue! The four day course based in Arlington VA seems to cover anything you need to get your team up to date, and, for a hands-on four day course doesn't seem expensive at all (ok, that might be because the pound is strong against the dollar, but then again, its still pretty cheap). Check out the details on Alagad's site (Tell them I sent you and I am sure they will make you a cup of tea!)

0 comments - Posted by Mark Drew at 12:47 PM - Categories: model-glue | coldfusion | reactor | coldspring | transfer

Nov 1 2007

Urgently Seeking ColdFusion Contractors

As some people might have noticed, its got so busy round here that I haven't been blogging as much as I used to and basically been keeping my head down and eyes on coding for the last few months. To aliviate this situation, Design UK, the company I work for is desperately seeking a couple of ColdFusion contractors to work in our London offices for a minimum of 2 weeks (could be up till XMas). No, you can't do the work remotely, sorry, don't ask. No, really... just don't. Also, if you are an agency, don't call me or email me. Just don't, really, you WILL get abuse, and I am sure you don't want that. The pay is dependent on experience (hey, I want to pay nothing, you want a lot, we compromise). The kind of experience that we are seeking is:
  • 2 years minimum ColdFusion (obviously)
  • Experience of Frameworks especially Model-Glue and ColdSpring are a massive plus
  • SQL Server knowledge
  • HTML, JavaScript and CSS (yep, there is front end work to do too!)
  • XML (generating and parsing)
  • Subversion and Trac knowledge is also a plus
Start date is as soon as possible, so if you are available and want some work, let me know by emailing me your CV to .

5 comments - Posted by Mark Drew at 1:01 PM - Categories: model-glue | coldfusion | coldspring | jobs

Aug 17 2007

Model Glue Tips Part 7: Set myself in your views

This is a quick tip for today. In all views you will probably be linking to other events, now of course you could write something like: <a href="#CGI.SCRIPT_NAME#?event=my.event">My Event </a> But what happens if you change the event key to something else (you can do that in the ModelGlue configuration section in the ColdSpring.xml file, see the property for "eventValue") such as "go" or "action"? You would have to change every view. A simple way round this is to put at the top of each view the following: <cfset myself = ViewState.getValue('myself')> And then change your links to: <a href="#myself#my.event">My Event </a> What do you think?

5 comments - Posted by Mark Drew at 6:54 AM - Categories: model-glue

Aug 14 2007

Model Glue Tips Part 6: Create a services directory to keep your model tidy

By default, when you create a Model-Glue project you get the following directories in you root project:
	/config
	/controller
	/css
	/images
	/model
	/views
This fits (apart from the css and images folders) with the idea of an MVC model. The problem that I find is that Reactor (by default) creates objects in the model/data directory. Why is this a problem you might ask? Well, I find that it doesn't fit in with what I think of the model. I see the model as the business model, and I tend to add another directory; "services" which interact with the model. The services are stored there and they glue the model together the model being stuff created by your ORM. I know people might disagree (no names) but I tend to add a services directory in which I have number of cfc's usually named %3CSomething%3EService.cfc . In my model folder I then have the objects and gateways. This means that the controller talks to the service and the service talks to the gateways and objects. This keeps it nice and tidy in my view. Of course, it doesn't matter at the end of the day, since you can change where all the objects are stored and just change your ColdSpring.xml file (you ARE using your ColdSpring.xml file your services aren't you?!)

5 comments - Posted by Mark Drew at 2:44 AM - Categories: model-glue

Aug 13 2007

Model Glue Tips Part 5: Maximize your re-usability with message arguments

As shown in the previous post, there is the ability to pass messages back to a message-listener with added information in the form of arguments. This can come in quite handy and allows you to make your controllers a bit more dynamic and re-usable so that they are useful under different situations. I shall give an example, which you should have spotted if you read the GenericList documentation, but I shall go into more depth here.

Read more...

5 comments - Posted by Mark Drew at 2:00 PM - Categories: model-glue

Aug 13 2007

Model Glue Tips Part 4: Use Generic Database Messages to speed up your development

A lot of the time that you are developing an application, depending on how you have set up your database etc, you will want to do a "select * from sometable", for example to get the types of pages you have, or a full list of user roles or simply to get the current user. This is all fine if you are sticking to the semi rigid pattern of having services for your whole architecture, but in the heat of battle, you might be tempted to do a cfquery in your view. DONT! Model-Glue gives you a built-in way of doing Generic Database actions (or messages as they are called in the documentation) The messages that you can call from the broadcast section of your event handler are:
  • modelglue.GenericList: Which does a select * from [table]
  • modelglue.GenericRead: Which does a select * from [table] where [id] = xyz
  • modelglue.GenericCommit: Which will save the record (or update it depending if it already exists with that ID)
  • modelglue.GenericDelete: Which will delete the record with the ID that you have passed in
An example of using modelglue.GenericList would be to list the People in our fictional system. In ModelGlue_people.xml I create an event-handler to display people: <event-handler name="people.list.users">
      <broadcasts>
         <message name="modelglue.GenericList">
            <argument name="object" value="People" />
            <argument name="queryName" value="qPeopleList" />
         </message>
      </broadcasts>
   
      <view>
   </event-handler>
Then in my display template I can get access to the query: <cfdump var="#viewstate.getValue("qPeopleList")#"/> There is more functionality available such as filtering and sorting, you can check out the details in the Documentation for modelglue.GenericList Calling the other other Generic Database functions is as simple as that, have a look at the full documentation over at http://docs.model-glue.com/ under "How To's" / "How To Use Generic Database Messages"

3 comments - Posted by Mark Drew at 9:06 AM - Categories: model-glue

Search Archives

Categories

coldfusion cfeclipse personal apple cfconferences webdev model-glue blogging ukcfug cfunited coldspring adobe scotch on the rocks presentations cfobjective lost reactor jobs flex eclipse ajax model-glue frameworks max reference google podcasting fusebox ask md spam railo eventvalidation donations tattoo snipex music microsoft fusiondebug flying blue dragon air wishlist tips rant open bluedragon java graphic novels funny eventguard derby blog aptana apple xml webservices transfer tashr subversion spry regex quack pownce podcast ooops mvc metrics jquery itunes hosting groovy gadgets flash firefox doh! directing development coldfusioncamp codeshare cfug cfonwheels cfdevcon apollo

Monthly Archives