Archive for category ColdFusion

Getting UK GeoCode Data with YQL and ColdFusion

I stumbled across YQL today and although I had heard about it in the past, today was the first time, I actually sat down and read the documentation and went through some of the example apps. I am amazed at how powerful it is and am just imagining the wonderful applications that can be built using YQL. It opens up the doors to pretty much anything using a SQL like syntax. Read the rest of this entry »

Tags: ,

Sorting XML with XSLT and ColdFusion

I came across a requirement today, where I had to sort a XML file by one of the attributes in one of its child nodes. I did some searching and came across these excellent posts by Ben Nadel.  Obviously, that gave me some headstart and it was clear that XSLT was the way to go.  I have not used a lot of XSLT in the past so my knowledge is a bit limited in this area.

After reading a couple of articles on the subject and understanding some basic stuff – here is what I came up with. Read the rest of this entry »

Tags: , ,

CF/Flex Connectivity in Flex Builder : Invalid root. The WEB-INF/flex folder must contain either flex-config.xml or services-config.xml.

I was setting up a new Project in Flex Builder with Application Server Type as ‘ColdFusion’. I had the default values in the Flex Builder wizard. But the Wizard wont let me go past the second screen. I kept getting this error :-

Invalid root. The WEB-INF/flex folder must contain either flex-config.xml or services-config.xml.

And I was sure that the WEB-INF folder actually had the correct files under it. Read the rest of this entry »

Tags: , , ,

Enabling AutoFilters on an Excel Template Dynamically

I had a requirement to generate an Excel report based on some filter criteria. Since I am using ColdFusion for the project, I will be using ColdFusion code to demonstrate what I did but this can pretty much apply to any language that can run loops and write files.

My requirement was to have Excel’s Auto-Filters enabled when the user downloads the file via the browser.  After searching a little bit, I realized its not that straight forward. I will probably blog about the harder way of doing it later, but here is what I ended up doing which turns out to be very simple and easy to do as well. Read the rest of this entry »

Tags:

What is the best way to deal with Spiders/Bots/Crawlers?

Although Search engine Spiders are a good thing (e.g. GoogleBot, YahooSlurp etc) as if they dont spider your website, you will probably not appear on search results, but at the same time, they also cause a lot of un-necessary management to be done on the developer side of things. Here are a few of the things I have noticed :-

1) They cause a lot of un-necessary active sessions created on the server if you have session management turned on (which most sites do).
2) There is a growing number of bots and its really hard to tell which ones to block and which ones not.
3) You do want the major search engines to spider you but you don’t necessarily want every search engine to spider you and it becomes hard to maintain this list (for a developer).

Apart form the above, another major problem is when someone intentionally tries to download/crawl your website using a custom written script or using a site downloader and in this case, the Browser/Referrer is mostly spoofed as someting they are not. These crawlers most probably do not even respect the existence of a robots.txt file.

My question is, apart from checking the name of the bot and restricting their session to like a few seconds , what other checks do people put in place to solve these hurdles ?

Installing ColdFusion 9 on MacOSX with Apache : Broken Apache Config

I had to re-install ColdFusion 9 on my MacOS today and having installed CF approx. a million times before, I thought it would only take few minutes.

Here is what I did :-

1) Went to /Applications/ -> Moved existing “ColdFusion 9″ folder to Trash.
2) Ran the CF Installer and everything went well. But finally, the installer got stuck at “Installing WebServer Connectors” – I waited a few minutes but then gave up.
3) Repeat Steps 1 and 2.
4) I then decided to try the installation with the in-built webserver. That worked, but I could not load any pages at all in browser. Basically, Apache was not working.
5) I opened Terminal. Ran the command “sudo apachectl start” – It says “Already running”. At this point, I was wondering whats wrong.
6) Ran the command “sudo apachectl restart” and it appeared as if it got restarted. No changes.
7) Did some Search and ran this command. “sudo apachectl configtest” to make sure the Apache config was fine. Turns out it was throwing this error. Read the rest of this entry »

Tags: ,

Creating Multiple IIS Websites in one go

I was assigned a task, recently, whereby I was given a list of about 100 domain names and I had to create all those websites on a fresh installation of IIS 6.0.  Naturally, I started looking for some kind of tool that would do this for me. After spending some time on search and asking a few people, I realized , there is no such tool (correct me if I am wrong here).

So, I thought of writing a little ColdFusion script that would do this for me. Turns out it wasnt that bad at all and it worked like a charm. Read the rest of this entry »

Easiest way to get Twitter Statuses with ColdFusion

This post of mine is coming after a long time, I know. The reason for this has been lack of time, being very busy with other things etc. I will try to be more frequent here hereafer.

Anyways, in a recent project, I had the requirement to show Twitter statuses on the homepage of the website I was working on. The first thing I did was, went straight to RiaForge and searched for any Twitter related CFC’s. I did find a couple of them and they all looked pretty good. However, since I only wanted to get the stautses and not the other fancy stuff like direct messages etc, I thought there must be an easier way of doing it.

That’s when I thought if the statuses are available as RSS feeds, I am done. CFFEED can do everything for me.


<cfset feedurl = "http://twitter.com/statuses/user_timeline/15172848.rss" />
 <cffeed source="#feedurl#" properties="statusmeta" query="statuses" />

Thats it. The code above gives me a feed of my status updates in a ColdFusion query, which I can now use to display as I want. There are too many columns in the query with lots of useful information. I ended up using just the “rsslink” and “title” columns as those were the only 2 I wanted for my requirement.

Its nice to know that Twitter publishes these rss feeds and even nicer that I can use this in one line of code.

Tags:

Removing NameSpaces from XML using XSLT and ColdFusion

If you are using ColdFusion XPath functions to search/parse XML strings, you will probably have come across this one at some point.  Not all, but most of the XML files have namespaces in them e.g. xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”. If you use Xpath on a string that contains namespaces, chances are that you will get back the namespaces as well and sometimes you dont want these at all. You just want to deal with the real data. Read the rest of this entry »

Tags: , ,

ColdFusionDocs now using Cairngorm

This weekend, I thought of revisiting the Coldfusiondocs.com application which I didn’t get the time to even touch for last so many months. I thought using Cairngorm to re-write the app would be ideal as it’s the most widely used Flex framework around.

So, I went ahead and re-wrote the whole thing using Cairngorm (took me one full day) and in the process optimized/fixed the existing minor problems as well. And I also thought that, since this is a project for the community, why not release the code to the community as well. So, for those who are interested, here is the Project with the source code. And yes, project contributors are most welcome. There is loads we can do with it.

A note for those code critics : I am not a Flex guru and definitely not a Cairngorm guru. So, please keep the code critics to be postive ones please. This doesn’t mean my code is bad, it just means it “might” not be the best code around. Also remember, this is not a paid project anyways.

Tags: , ,

WP SlimStat