These days Google is pretty much everywhere. Personally I have multiple domains hosted with googles apps for email, my main email address is @gmail, my blog is hosted by google ( blogger ), I just purchased 20 gig of storage for $5 per year not to mention the simple fact that when I search I use google. Now they are introducing their own DNS servers.

http://googleblog.blogspot.com/2009/12/introducing-google-public-dns.html


As a quick reference in case your not sure what DNS is put simple it's the phone book for domain names. When you type in your browser www.learncf.com for example, your actaully sending a request to a DNS server to translate the words into numbers ( IP adddress ) then then you get the website data.

How do we feel about google doing this translation for us? How much trust do we put into google. The reality is that if so inclined by using googles DNS servers they ( google ) could constantly redirect bing.com to one of googles own servers. That's not to mention that now every single site you visit regardless of you being signed in to google or using a search engine can be logged.

There is also the other side. We trust so much with google why not let them provide this service. It's likely to always be up and fast being that they have so many datacenters.

At this point in time I'll stick with my ISP's DNS but I guess more options are good thing.

Ever wanted to save an image to a database with ColdFusion? I see this question asked quite often. I don't have a need to do this but I mocked up a quick demo or reading and writing binary data to and from a mySQL database.

The code is very simple. I read the binary data from a image. Write it to a database, read it back out and write it to the browser. I also rotate the image to show the result from the database acts just like any other image data.

You might note I made use of 2 great new features of ColdFusion 9.

1. Data source specific to the application. I no longer need to specify a datasource in my cfquery tags as I have this setup in Application.cfc.

2. On insert ColdFusion can return the autoincrement id value of the record just inserted. Eg in SQL server select @@identity does the same thing. This was available in CF8 but it was lacking and was different depending on the database type.

In ColdFusion 9 the old values still work ( so code wont break ) but we also can now use queryResult.generatedKey.

I always try include a working demo: http://railo.kukiel.net/imageinsert/

Here is the CF Code:

Here is a sample to create the mySQL table:


Also note as this gets alot of people that by default CFadmin only allows 64k to be passed from CF to the database. You will probably need to increase this value. For this example I just added 2 extra 0's ( 6.4meg ). If you don't half the image will be inserted and you will be confused as to what the image ( or other binary files ) are corrupted.

With multiple projects running locally I prefer to use virtual hosts so I can browse to http://project1.local and http://project2.local rather than http://127.0.0.1/project1 and http://127.0.0.1/project2

This is really easy in IIS ( point and click ).

Apache you have to touch some configuration files but there is alot of information out there on this.

With Resin it's also quite simple but there is far less information about this available.

I put together this walk through on the process.

And if your wondering about the performance of resin ( free edition ) Peter Bell's response should give you some confidence.

I run about 70 websites on Railo and Resin on a Win2k3 64bit server
with 8Gb of RAM and have excellent performance. Not to say it wouldn't
be better if I used the professional version.


http://groups.google.com/group/railo/msg/047ea89dea7c9385

Sample Virtual host block:



High Quality Version click here.





Related:
Setting up Resin Express.



Download and install java sdk ( I used 1.6.17 ) ( note you need the JDK not JRE )
Download glassFish
Download ColdFusion 8 or 9
Download Apache

I used Windows Server 2008 64bit but the process is the same for 32bit or Win 2k3.  It's also ( obviously ) different on linux or unix but not majorly.

When installing glassFish did not detect java home correctly so I provided the location via the cmd line.


The install is very straight forward I did not select anything unusual and just clicked through:

Once glassFish was installed I started the server:



Then browse to:  http://127.0.0.1:4848 to get to the admin console.


I choose to leave the admin with no authentication so it will just load to the console.

Before you look at the console we will need to create a ColdFusion war.  Run the ColdFusion installer and select "JEE Configuration"

This will produce the war file ready for deployment.  For me the output was c:\coldFusion9\cfusion.war

Now go back to the control panel.  Select "Applications" from the menu.  Then select "Deploy".  Choose a file from the local file system and leave the name as cfusion.


Once the application is deployed we can launch it by clicking launch button and you will see:

404 error's.  This is because there are no .cfm files if you went to /CFID/administrator you would would be at the CFADMIN.

I'll skip the CFADMIN and make a index.cfm:

Contaning:





Reload the Original page that was launched by clicking "Launch"

And ColdFusion 9 is running on GlassFish.

This is on port 8080 but I want it to run behind apache on port 80 without the /cfusion

Make sure IIS is not running. Install Apache.  Apache for windows come with all the modules you're likely to need but most are commented out.  Test to make sure Apache is runnign and http://127.0.0.1 should the standard message "It works".

Now we will setup the proxy.

Around line 110 of httpd.conf uncomment 2 modules mod_proxy.so and mod_proxy_connect.so



Also un-comment


Open {apacheInstallDir}\conf\extrahttpd-vhosts.conf

create a new vhostBlock


I created a dummy entry in the Windows host file so http://cf9gf resolves locally. I'll be using this as the test domain.

Restart apache and look for errors.


If there are no errors you should now be ready to proxy from apache to glassFish on port 80.


Done.

Now GlashFish is no longer listed here: http://www.adobe.com/products/coldfusion/systemreqs/ but it still works fine.

Also note the /flex2gateway works fine aswell.
Ever needed to compare a ColdFusion hash() directly in MS SQL? I did today and I knew I had accomplished this before but forgot how to do it. Searching the net and twitter I came to some dead end or longish solutions. I knew Steve Good and I worked this out once before but I also remember there being an easier way.

Well there is and here is where I took the solution from: http://orangepips.instantspot.com/blog/Database

The funny thing is I found this nearly a year ago and actually commented on the post just forgot all about it.





The result: