ColdFusion String is a Java String

ColdFusion strings are Java Strings internally, which means they are an Object of class “java.lang.String” . In this post, I will try and use some of these Java String functions that can be applied directly to a ColdFusion string variable. I understand that most of these have been discussed in bits and pieces all over the blogosphere but I am just building up a cumulative list of these functions. More »

Transfer : First Thoughts

Having read the blogosphere about Transfer a lot recently, I wanted to give it a try as well. My only problem is that, at my work, I dont get to use Transfer because of the way things are setup there. So, I had to find the time to do it in my spare time outside of work which is a hard thing to do. However, I managed to do it recently.

For those who are not aware, Transfer is a ORM (Object Relational Mapper) for ColdFusion, that according to their website, through a central configuration file Transfer knows how to generate objects, and how to manage them and their relationships back to the database. Which means you don’t have to write any (almost!) SQL queries while writing your app. You need to map / define your database objects in a XML file and tell Transfer to read the file and voila! you are done. The best thing is , behind the scenes, it supports 4 databases (MS Sql Server 2000+, MySQL 4.1+, PostGres 8.1+, Oracle 9i+) which means your database could be any of the these 4 and as long as your config file is mapping the database correctly, you wont have to change any code if ever you decide to change your backend database server. That is a big flexibility!

So, after my initial reading of the docs and simple download and after creating a mapping in the CF admin to tell it where Transfer sits on my machine, I was all set. I created a simple config file for one of my databases. which looks like this.

That basically tells Transfer that it should go and read a table called customers in my database and map its 4 fields to whatever properties I defined here.

And then in my CF code, after initiating Transfer factory, I can simply do this to get a list of all customers. (just as an example)

And that gives me a query with all my customers. Sweet! I am very impressed. We can also create one to many and many to many mappings within the config file and Transfer will know how to relate the 2 tables. Very sweet!

I know this is just the beginning I think I am going to use it all over now. The only question popping my head is how would it perform in high traffic websites and if I can configure it to look for database objects with different logins e.g. a database could have tables with different ownerships (dbo, dev, mylogin etc), and some queries could have joins across these tables, so is this supported? Will find out soon after some more reading!

Great work here by Mark Mandel! (the guy behind the project, for those who dont know)

cfpop and gmail

Tagged Under :

I know this has come up with a few times before but its something I want to blog more for myself so I could easily refer to it when required.

By default, cfpop does not support ssl and if you are trying to access your gmail account via cfpop, you wouldnt be able to do so straight away because gmail requires you to access its mail server using ssl. There are a couple solutions around (which can be searched via Google) but the best I found was that you can force socketFactory’s class to use ssl (which is not the default behaviour).

Just add the following few lines of code before your cfpop tag call and that should do it! And dont forget to enable POP access in your gmail account first.

More updates to coldfusiondocs.com

Tagged Under :

Last night, I made some more updates to ColdFusiondocs.com, although minor updates again. I have changed the right panel to have a tabbed layout rather than a top and bottom layout, I think this gives more room for the actual content and both the documentation section and the useful url’s section should be easier for the eye.

Another minor change I did was to focus the search field on load and place the text caret in there. I cant seem to get it to work in Firefox though, would be nice to know if anyone has a fix.

On a side note, I am still struggling to get the deep linking to work mainly because of the fact that the way this app is written. I wil try some more when I get some time as I know its an important feature for this app.

Oh, by the way, as a reminder, you are more than welcome to go and add you CF related links to the app.

Here is the link. www.coldfusiondocs.com/app/

Add your CF links to coldfusiondocs.com

Tagged Under : ,

Yes, thats right. I have just released some updates to Coldfusiondocs.com. It’s now got a 4th panel to it which lists the related links for the tag or function in question. The idea here is that, lets say you are browsing cfquery tag on the left panel, you should be able to look at the cfquery related links (ideally blog posts or other useful links specific to cfquery), right there on the right panel.

I think this adds more value to it in a way that you can look at the documentation and the “interesting” blog posts at the same time in the same interface. It would be really helpful to have these links “rated” and the most rated ones show on top but I would leave it like this for few weeks and based on the interest it generates, I would then later on add the rating feature. Remember, this is not a paid project, so I have to keep this development only to my limited free time.

At the moment, anyone can add links by entering a name and email address, and apart from some very basic validations, its straight forward to add a link. You just need to select a tag or function on the left panel (I have added a few in cfgrid to start with), and then on the right lower panel, fill the form in to add links. Thats about it.

There is no moderation at the moment but I will periodically do an exercise to remove any “non-genuine” links (not that I expect them but you never now), until I put some checks in place to validate a link (as in if it really is a CF related link).

So, go ahead and add links. www.coldfusiondocs.com/app/

changing cfgrid pageSize dynamically

Tagged Under :

Here is an example of how to change the pageSize of an AJAX CFFGRID dynamically.

Purpose :-
Let the end user select how many rows of data he/she wants to see in the Grid. (ie technically speaking, change the pageSize on the fly).

Approach :-
1) Add a ComboBoxwith the number of Rows to be selected, for the user to be able to select. use the Ext JS functions to achieve that.
2) Take the value selected from ComboBox and reload the grid data.
3) Reload the paging Toolbar as well because, apparently, the grid data and paging toolbar work independently, reloading the grid does not reload the paging toolbar. So you have to do that manually.
4) Reconfigure the Grid. More »

Minor Updates to coldfusiondocs.com

Tagged Under :

I have added a new category to the coldfusion documentation at www.coldfusiondocs.com. The category is called ‘CF8 Javascript Functions’ and it lists all the available JS functions in CF8. There are 33 functions in total, however, I wouldnt mind adding any ‘undocumented’ JS functions to the list, so if you know of any, feel free to send them over.

Go check it out.  - Select ‘CF8 Javascript Functions’ in the dropdown.

CRUD with cfgrid html format

Tagged Under :

After looking at Dan Vega’s series of posts on CFGRID usage, I decided to put together an example of CFGRID with a full CRUD functionality. ColdFusion 8 has introduced the new HTML format CFGRID which uses AJAX behind the scenes. I quite like the features it offers and I think with EXT framework behind the scenes, there are some nice things that can be done with it. Dan has already covered a lot of these areas and is doing a great job I think in writing these posts up. More »

Coldfusion 8, .NET and Excel Example

Tagged Under :

In an attempt to do something with Coldfusion’s .NET functionality, I tried to consume any existing .NET component to do something useful with it. Ideally, in order for this exercise to be really termed as useful, I should have been writing my own .NET component and then consume it in CF, but I would leave that exercise for later on, given the fact that my .NET skills are not so good and I haven’t really done a lot of .NET except a few tidbits here and there.

So, having said that, I decided to do something with Excel and started looking for a publicly available .NET component for Excel. Although there are a lot of ways to do that already, via CF, as described by Charlie Arehart (which happens to be a really informative list), I still wanted to do it via a .NET component just for the sake of doing it.

More »

Anyone came across this cfdump issue?

Tagged Under :

The issue is really weird. What’s happening is that whenever <cfdump> tag is used anywhere in the code, it throws an error like this.

Permission denied for creating Java object: coldfusion.util.DumpHelper. Access to Java objects in the ColdFusion package has been disabled by the administrator

The server is CF8 with access to internal Java Objects disabled. I have checked all the application.cfm files that can possibly be called and there are no Java objects being used anywhere. It might be worth mentioning that there is a CFC which is being used on the server which uses some Java objects but those Java objects are not the CF’s internal objects, so that should be fine and that CFC works just fine when called.

I have spent a few hours trying to figure this out and I am at a loss as to what’s going on with <cfdump> here. I have tried to reproduce the error to get to the bottom of it but there is no consistency in its behaviour. Here is what I did :-

  1. Keep the access to Java Objects disabled and restart CF.
  2. Create a Java Object that uses internal CF object and get a ‘Permissions denied’ error as expected.
  3. Now comment that line of code which uses the internal CF object, and use a simple <cfdump> tag that dumps any var.
  4. Unexpectedly, It would throw the error I stated above (not always though - it did this just once, the first time)
  5. Enable access to internal Java objects and the error is gone, as expected.
  6. Disable the access again and you might see the error again.
  7. Repeat the whole exercise and you might see the error thrown by cfdump at Step 4.

Anyone came across this issue ever? Any info would be appreciated. This is a very useful tag and is used all the time while coding and its a big issue when it doesn’t work.