Mark Drew (Redux)- cf_etc...

a compendium of railo, cfml, cfeclipse and technology topics

Mark Drew (Redux)- cf_etc...

Entries Tagged as webdev

Aptana moves to the server side

January 23, 2008 ·

Those clever folks at Aptana famous for their IDE and Eclipse plugins for JavaScript/Ajax, HTML and CSS have released Jaxer, The Ajax Server:
...Jaxer changes all that. Jaxer is the world's first true Ajax server. HTML, JavaScript, and CSS are native to Jaxer, as are XMLHttpRequests, JSON, DOM scripting, etc. And as a server it offers access to databases, files, and networking, as well as logging, process management, scalability, security, integration APIs, and extensibility
You can get it as part of the IDE or download the standalone server, for Windows, Mac and Linux. I dont find this surprising really, since Paul Colton, the CEO and founder is the man behind JRun! Awesome stuff, and I hope to get some examples up to show you soon!

Tags: ajax · apple · eclipse · webdev

Using keyword substitution in Subversion

January 11, 2008 ·

When I previously used CVS, I was able to put in my code some keywords that I wanted to substitue, such as the checkin date, who had checked it in, which version it was etc. I have had a hell of a time finding out how to do this in Subversion (SVN). Thanks to a link sent to me by Tom Chiverton, I managed to figure out how to do it via Eclipse. First of, read the manual, especially the svn:keywords section. So, lets say I want to put the following in my headers: Author: $Author$
Date: $Date$
Revision: $Revision$
So in CFEclipse/Eclipse enter that in a file and check it in to your repository, nothing happens right? No changes to the file happen, we must first set the properties for that file (or group of files): 1. Right click on your file and do Team -> Set Property 2. Select the "svn:keywords" property from the drop down 3. In the text area add (without the quotes) "Date Author Revision" 4. Check in the file and reload when it asks if you want to reload the file (since SVN has changed it) TADDA!!! Your file should look like this now: Author: $Author: mark.drew $
Date: $Date: 2008-01-11 15:03:22 +0000 (Fri, 11 Jan 2008) $
Revision: $Revision: 2076 $
I hope that helps!

Tags: eclipse · webdev

Sending complex objects through webservices using ColdFusion

November 18, 2007 ·

Title: Sending complex objects through webservices using ColdFusion Using web servies with ColdFusion is pretty simple most of the time, you create a webservice object and then call the methods on that object, for example: <cfset ws = CreateObject("webservice", "http://localhost/someservice/?wsdl")>
   <cfset aResults = ws.doSearch("find something")>
This is all fine and dandy if you have to pass a simple string or many other things, but what happens if, as I am having to do at the moment, you need to call a method that takes an object as a parameter? Sometimes, looking at the WSDL of the webserive isn't enough to tell you how to create an object to send to the webservice. First of, a simple way of creating an object is with a struct, so if you had to send an parameter (lets say, SearchQueryTO) you can create it as follows: searchQuery = StructNew();
   searchQuery.params = "find Something";
   searchQuery.resultCount = "10";
   //Do a search with the object...
   results = ws.doSearch(searchQuery);
The searchQuery struct above now gets automagically translated into the SearchQuery object that the webservice requires, all fine so far, but recently I got stuck with trying to pass some data back to a webservice. The WSDL said that it was an array of SearchCriteriaTO's but no matter what I did (create Arrays etc) it wouldn't accept it. In the ColdFusion server, all webservice calls generate java classes or "stubs" using a little Apache Axis library called wsdl2Java (imaginative eh), these stubbs are what you are actually calling from your code to connect to the webservice, since I didn't know EXACTLY what I had to call, you can do the following:
  • Zip up the stubbs for your service, they are held in /stubs/ and there will be a "WSxxxxxxx" folder where the x's are a number. Delete them all and make a call to your miscreant webservice to see the folder generated for the stubbs
  • In Eclipse, create a new Java Project, you wont be doing any actual java but it just will help so that you can import the zipped stub folder
  • Right click on the project, and select Java Build Path
  • Click on the Libraries tab and select "Add External Jars..." and select the zip that you created of your stubs and click ok
  • In your project you should now expand the "Referenced Libraries" node and you will see all the java classes that make up your webservice
The problem I had was that I didn't know, even from the WSDL, how I was meant to send the array of objects, well, in my webservice, it had generated a ArrayofSearchCriteriaTO class, which had a "searchCriteriaTO" property that was an array, therefore I had to first create the ArrayofSearchCriteriaTO and then put all the search criterias into the property: //create the array that we will pass
   ArrayOfSearchCriteriaTO = StructNew();
   ArrayOfSearchCriteriaTO['searchCriteriaTO'] = ArrayNew(1);
   
   //create the objects that we will put into the array
   sc = StructNew();
   sc['attributeName'] = "name";
   sc['stringValue'] = "some value";
You notice that I used the ['property'] to create the keys in the array, I did this to be sure that the keys would retain their case, of course this is not essential, but I was just trying to make sure that I was hitting the right properties (since java is case sensitive).

Tags: coldfusion · eclipse · webdev

Stopping Firefox's annoying form autofill

August 10, 2007 ·

When I am developing websites, especially forms, Firefox has this habit of confusing me and wasting a number of minutes of my time by trying to be useful. How you might ask? Well, if you are working on pre-populating a form, say setting options in a select dropdown to selected = "true", Firefox will come along and say something like: "Hey Mark, I saw you posted that form before! I am going to be really annoying and not select any! Even though you told me to!" Well, there is a simple way to fix this behaviour, all you have to do is go to about:config and search for the Preference name "browser.formfill.enable" and set its value to false (by double clicking on it if you are on a Mac) This should stop Firefox from pre-filling your forms whilst you are in development

Tags: webdev

Want Pownce? I got some invites...

July 13, 2007 ·

As the title says, I have a few invites for Pownce to give away. All you have to do is leave a comment with the email you want me to send it to (dont worry your email isnt public here) and the first 4 that message me will get one! (after that, if your name is on the comments, I shall send you one) Also, say what you have done to help CFEclipse or the CFEclipse community, best answer will get it first :)

Tags: cfeclipse · coldfusion · webdev

Top 10 Must-buy OS X Applications

June 22, 2007 ·

I wanted to put down (for the help of new Switchers and myself) a list of applications I consider a top 10 of commercial (have to pay) applications for OS X. There are so many applications that are free on the Mac, that cover nearly everything you want to do, but for this post I wanted to cover some of the paid for applications. I know there are Open Source alternatives for most of this software, but sometimes there is just software that *IS* worth the few pounds/dollars/euros that it takes to buy them. Please bear in mind, that I am a web developer (or application developer depending on the time of day) so these are focused on what I do. So without further ado here is my list (in no particular order): 1) TextMate http://macromates.com/ &euro 39 This is the "Missing Text Editor" for the Mac. I use this all the time, and there is a CFML plugin for it, for when you need to edit those random CFML files. Obviously for projects I use CFEclipse, but a text editor is always a handy tool 2) QuickTime Pro http://www.apple.com/quicktime/pro/ £ 20 QuickTime already comes with OS X but what you really want is the very cheap Pro edition, if only to watch stuff in full screen, and not to mention its export capabilities! 3) Parallels http://www.parallels.com/en/products/desktop/ $79.99 /VMWare Fusion http://www.vmware.com/beta/fusion/ $ 39.99 (for pre-orders) With the advent of the IntelMacs, we can now run Windows natively or in Virtualisation, so these are the best (maybe only) tools for the job! I classify both of these as one since they do the same job (I have been checking out VMWare Fusion for a few weeks using my BootCamp drive, and I am really enjoying it, it seems faster than Parallels) Don't boot up your Mac without at least one of these! 4) iWork http://www.apple.com/iwork/ $79 I do a lot of presentations and the best software for that is Keynote, it just runs rings round PowerPoint (now if only Adobe Connect would support either PDF or Keynote files!!) I dont use Pages as much, but its still a lot nicer than the interface-cluttering Microsoft Word. 5) Coda http://www.panic.com/coda/ $69 We all have some small sites to manage, and Coda, a new kid on the block brings in some real nice features for this. I think its worth it alone for the CSS and the Site panel (which it automatically creates thumbnails of your sites!) I haven't bought this yet, but I am really liking it. EDIT: the latest version of Coda supports CFML too. 6) Adobe Fireworks CS3 http://www.adobe.com/products/fireworks/ $299 I am not a designer but I love Fireworks. I have been using it for years and its the best web graphic design software I have used. I know Adobe Photoshop is the daddy but the ability to do everything web design related in one package (down to creating the HTML for you) is just too good. I love this app! 7) Aqua Data Studio http://www.aquafold.com/ $399 There are apps for every database out there, but if you are connecting to a variety of databases this rules. Unfortunately because of the price I have to install Windows and use Microsoft MSSQL Enterprise Manager, but if I could afford this, Windows would end up just being a shell for Internet Explorer. This is a must if you do a lot of database work. (Aqua Data Studio v4.7 is actually free, but it doesn't have all the features I would like it to have) 8) OmniGraffle http://www.omnigroup.com/applications/omnigraffle/ from $79 If you are doing a lot of diagrams, be they UML to system architecture, OmniGraffle makes it really nice with very impressive results. 9) OmniPlan http://www.omnigroup.com/applications/omniplan/ $149.95 I always hated Microsoft Project, there is something evil about it (maybe just because I am a developer) but when I had a go on Omni Plan, I thought "hey, I *CAN* get into project management!". As with OmniGraffle its results are impressive as well as pretty, and hey, if you are going to be staring at something all day, you might as well be staring at something good right? 10) Delicious Library http://www.delicious-monster.com/ $40 This is a great little tool if you have lots of DVD's (and books) as well as appreciative friends who like borrowing them. The main thing about this is that you can very easily create a whole library of your DVD's simply by scanning the bar-code using your iSight camera. You can then have a list of who you have lent out your DVD's too as well as loads more info and suggestions (driven by Amazon I think?) So, there it is, my 10 must-buy applications for OS X. Edit: If you think this post was usefult, why dont you Digg it?

Tags: adobe · apple · ASK MD · personal · webdev

Performance testing the onMissingHandler method

June 18, 2007 ·

I was having a conversation with another developer at work about using the new CF8 onMissingHandler method for components. The issue we were debating was that in Java, using the try/catch or basically error trapping should be slighly more expensive than without it and if in-fact the onMissingMethod was trapping missing method errors, then there should be a big overhead, so it would mean that depending on it would't be a good thing. From what I understand, when ColdFusion compiles CFML code down to Java, each of the functions doesn't get rendered to a java method, but rather to an inner class, so the onMissingMethod is actually another inner class so there should be no overhead. I did a bunch of tests (Here is the code on the measurement and reporting) and it looks like that onMissingMethod is totally safe to use (performance wise)! Another great reason to use CF8!

Tags: coldfusion · webdev

Getting to know you! How analytics lets me know who you are.

June 12, 2007 ·

I am sure lots of people use google analytics on their site to track usage. Its very good for conversion funnels and what have you but it doesn't really have the immediate effect of reporting that I like for blog posts. I have to admit, I am a nosey bugger. I want to know when people are coming to my blog and what they are looking at. I want to know WHO is on my site, I know you dont mind, of course, its only me knowing this stuff right.... right? So, I have been using a service called reInvorate for a long while. It was beta, closed down, become beta again. It has a great feature of showing you who is on your site at the present moment, which is fine if you like knowing that everyone is called "X88893-333-5555"... but if you are using Ray "The Jedi" Camden's BlogCFC, people can ask for the website to remember their details. Now on a tangent, ReInvigorate have released a little tool for Windows and Mac called Snoop which simply displays people coming onto your site. The problem is that they are still pretty anonymous, but I checked something out over at the ReInvigorate site about adding names to these sessions And it turns out that its pretty easy to do it in BlogCFC, you just have to add the following code before the call to ReInvigorate: <cfif isDefined("cookie.blog_name")>
var re_name_tag = "#blog_name#";
</cfif>
<cfif isDefined("cookie.blog_email")>
var re_context_tag="mailto:#cookie.blog_email#";
</cfif>
re_("your_reInvigorate_id");
And then you can finally see who is coming to your site. Nice to see you again too! :)

Tags: blogging · coldspring · webdev

More on Coldfusion 8's Derby database

June 08, 2007 ·

A couple of links (just for my own reference really) on some useful tips on using Derby: Steve Bryant at Coldfusion Journal and good ole Ben Forta (apologies if this is repeating other people's stuff, its mainly for my brain)

Tags: coldfusion · webdev

Coldfusion 8: Creating a Derby database

June 07, 2007 ·

I am not sure how many people noticed but ColdFusion 8 now comes with an in-built database called Apache Derby. This is great for people needing to deploy applications that need a little database that might be highly performant but without the need for complex queries etc. (read SnipEx here). To get you started, it comes with the sample applications already installed, but what if you want to create your own database, and point a datasource to it? Well, help is at hand, this is what I did to create a test database and point a DSN to it: Firstly, go to (in a terminal window) the directory where you will create the database files, in my case I was going to create it under /Applications/ColdFusion8/db/ . Then run the following command: > java -jar /Applcations/ColdFusion8/lib/derbyrun.jar ij (obviously substituting your path to the jar). Once you have done that, you can now create a database by entering: ij> connect 'jdbc:derby:cfeclipse_test;create=true'; Where cfeclipse_test is the name of your database, to exit just type "exit ;" Now that you have created the database you can create a DSN entry for it, all you have to do is create a DSN of type "Apache Derby Embedded" and point it to the folder where you created the databse, in this case it would be "/Applications/ColdFusion8/db/cfeclipse_test" It should all now work, and you have a DSN to create your tables and run your queries against. For more info on Derby, check out: http://db.apache.org/derby/docs/dev/getstart/

Tags: coldfusion · webdev