Nov 25, 2009

Railo and Flash remoting ( Flex )

Flashremoting works with Railo. It works in the same way it does with ColdFusion and it's actually quite easy to setup once you know how. This short screen cast demonstrates.



Click here for a high quality video.

Here is a sample web.xml



Take a look at this post for a working demo:

( right click to view source )

http://vc.kukiel.net/demos/railoremoting/

Nov 22, 2009

Railo Resin and Virtual hosts

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.



Nov 21, 2009

Railo Express with Resin and 64bit jre

When I work on a Railo cfml project I use Railo express locally. The jetty express package doesn't support SES URL's which is one reason to consider using the Resin express bundle.

More importantly to me is that the server I develop on is the same as the server I use in production ( on my VPS ). In this case that's resin. I run IIS and CF for my main job locally and really don't want to also run apache ( my VPS runs apache ) but Resin alone is close enough until I need to make sure my URL re-write work on Apache. As alot of my work involved Flex this isn't to often so using Railo Resin express locally is almost ideal.

The setup is extremely easy to get an out of the box setup going but there are a few tricks that I want to go over. The first thing I like to do is run the most recent jvm and also run in 64bit mode. Then update Railo to a recent version.


Here is the High Quality version:
http://vc.kukiel.net/RailoResin/

I recommend this version as the embedded version is a little small to see whats going on.






Next post I will show how to add virtual hosts to Resin.

Nov 19, 2009

.NET or ColdFusion ?

Umm why not both?

I think having an understanding of multiple languages is a good thing. Before working with ColdFusion my preferred web language was PHP. At that time I was also writing some thick clients in VB.NET I still like to work with other languages and recently I have been brushing up on C#.

So what's the point of learning languages if your not going to use them? Well occasionally you do and it can really come in handy. Recently I worked on a project that had some pre-built code in c# and they needed a Web interface to part of there system. As alot of the processing was already built in .NET I took what I needed compiled it to a dll and just invoked that from ColdFusion ( yeah fancy that a shop that had both .NET and CF ).

This is a handy feature of ColdFusion 8 and 9 and we rarely see any examples or mentions of this.

I made this quick demo to show how you can pass some simple data to and from .NET from CF.

Yes it's alot of code for a 4 line cfquery but it's just a demo.

.NET Code


CF Code:



Result:

Nov 18, 2009

Flexbuilder / FlashBuilder 4 for linux

This came up on FlexCoders today. Seams someone has ported FlexBuilder / FlashBuilder 4 to linux. By the looks of the screen shots it does not include design view.  Many of the devs are wanting FlashBuilder 4 for linux as the only alternative is to run a VM with Windows or use IntelliJ


Here is the link for more information:

http://tech.groups.yahoo.com/group/flexcoders/message/149843



I haven't tried it yet and if you have feed back it would be good to hear how well it works.

Here is the official requst for FlexBuilder for linux

http://bugs.adobe.com/jira/browse/FB-19053

Nov 17, 2009

Is your ColdFusion server/site secure?

I'm guessing there are quite a few of us out there that are both developers and also administer our servers. Being good at one thing doesn't always make you good at another. I'll often consult with someone when I set up a new server especially if it's a total new install or an unfamiliar operating system.

The ColdFusion community has many such skilled people one of them is Pete Freitag.

Pete put together http://www.hackmycf.com/ a site where you can run a quick report against your ColdFusion server and get back a report with detailed information on what could be a security issue and how to address it.

I run it against my personal server and I'm happy to report it found no issues. That doesn't mean its hack proof but at least I haven't left anything obvious open.

Anyway its free and helpful and probably worth a look. Thanks Pete.


Nov 14, 2009

Railo GlassFish and Flex ( flash ) remoting

So dropping a Railo war on GlassFish and being up an running is easy but flashremoting dosn't work right away. As a flex developer this is a show stopper for me but lucky that's also easily solved.

Basically all that's needed is to add the MessageBrokerServlet and /flex2gateway mappings to the web.xml

You'll find the web.xml in the directory you deployed the application to in my case:

C:\glassfishv3\glassfish\domains\domain1\applications\railo\WEB-INF

Pasting the xml into my blog looked a little nasty so I used pastebin. You can see the WEB.xml after I added the additions here. You should have no issues copying all of this and pasting it into your web.xml over writing everything.

There is no need to re-deply Railo simple restart the application to pickup the changes.

To confirm the changes try ( in my case ) http://railolocal/flex2gateway if its a plain white page its good if it 404's then you might have made a typo.

Happy Flex (flash) remoting.



Railo Apache and Glassfish
ColdFusion 9 Apache and Glassfish

Railo Apache and GlassFish


Setting up Railo of GlassFish is a breeze. From start to finish I could accomplish this in 5 minutes and that includes downloading Railo.

Working with 2 CFML engines on the same machine is pretty easy and my main dev machine ( my laptop ) I have CF8 and CF9 installed but I also have a slew of Virtual machines for different configurations for different clients.

I haven't yet seen anyone actually run CF9 and Railo side by side on GlassFish but I wanted to demonstrate how easy this would be to setup in a dev environment.

Click here for high Quality version.



The index.cfm contains only:

< cfdump var="#server#" />

Here is the original link on Getting started with ColdFusion and GlassFish.

http://blog.kukiel.net/2009/11/coldfusion-9-on-glassfish.html

Nov 12, 2009

Little known but helpfull ColdFusion function daysInMonth

Need to find out how many days left in the month?

Here the solution.



Here it is in action.

Start and Stop ColdFusion 9 with a batch file

I swap between ColdFusion 8 and 9. I'd rather not have them both running locally at the same time. I have start stop batch files for CF8 so my laptop boots quicker and I start CF when I need it so I also made some for CF9. The main difference is the addition of solr service.

startcf9.bat:


stopcf9.bat:

Nov 11, 2009

OpenBD Google App Engine and jars

CFML on OpenBD under Goolge App Engine is great but what is you also want to leverage some existing java or write and use new java code?

Well it's really easy. In some earlier posts I made some simple java classes and compiled to a jar. I thought I would use the exact same jar and code to demonstrate the same concept on OpenBD on GAE.

Take the compiled jar ( Test.jar ) and drop it into: {openBDGAEProject}/war/WEB-INF/lib

Add the code into a .cfm

Deploy to google

That's it.



You can see the code in action here: http://pcfflex.appspot.com



index.cfm:



Original Java files can be found here.

Nov 10, 2009

Want to win ColdFusion or Adobe software? - Connecticut CFUG

Well if your in Connecticut and you attend the Norwalk ColdFusion usergroup you could!


On November 17th ( next Tuesday ) we've got Ryan Stuart presenting on RIA Technologies and the best of from MAX.  I'm sure the focus will be ColdFusion 9 and the up coming Flex 4

We will also be catching up on the news post Max and post RIA Unleashed ( at least 2 of us are going ).

As always there will be dinner is served so be sure to let either myself of David know your planning to attend.




Nov 9, 2009

ColdFusion Builder and FlexBuilder 3 They do work together!

I like ColdFusion Builder and I have been using it for pure ColdFusion and CFML applications for a while but in my large application ( Flex 3 and ColdFusion 8 ) I was still using FlexBuilder 3 standalone with CFEclipse.

Previously I tried a few times to either get Flex 3 installed into ColdFusion Builder or vice versa or both as plugins to Eclipse. Turns out all I was doign wrong was not using Eclipse 3.4.2 which can be found here:

Eclipse 3.4.2

I then downloaded Flex Builder 3 and installed as a plugin and then ColdFusion Builder Beta 2 and installed as a plug in. No Error ont he install I was feeling good about this.

I launched Eclipse and imported my project and was very happy to now have access to Flex 3 and ColdFusion builder in the one IDE with no errors!



Thanks to:
@coldfumonkeh
@benjamin_wss
@webrat
@mswallace

For there input.

Nov 8, 2009

ColdFusion 9 on GlassFish


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.

Nov 6, 2009

ColdFusion md5 hash directy in MSSQL

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:

Do I need a 64 bit Operating system? Part 2

Getting onto a year ago I made a post regarding weather or not I need a 64 bit operating system. Since then I have re-formatted a number of times as each new Beta release of Windows 7 came out each time opting for the 64 bit version.

I have had no compatibility issues going to 64bit and performance has really increased. It's been one of the best decisions I have made and makes using my laptop a much more developer friendly device.

I can now run VMware, ColdFusion Builder, Flex/FlashBuilder Outlook and a few browser windows all at the same time without slow down. I switch between CF8 and CF9 but I can run them both at the same time if I need to.

These images are the new ones compared to 32bit Vista. I did drop .1 in the Windows rating though but addressing the full 4g of memory and I guess other 64bit and Windows 7 improvements have made a huge difference.

That being said I'd love the price of 2 x 4g Ram chip to drop to a reasonable price so I can upgrade to 8g ram.


Nov 5, 2009

Query of a Query in ColdFusion script with the local scope

I don't do alot of Query of Queries and when I do I often forget that you can escape special reserved words. One of those words is local.

With ColdFusion 9's local scope this is likely to come up if you name the first query local.someQuery and try to QoQ that it wont work unless you escape local as so:

[local].someQuery

We had to do this anyway as we always used to do:

< cfset var local = {} /> prior to CF9.

While making an example I wanted to write this in tags and in pure script. QoQ in script proved a challenge I thought it would just work but it actually needs an additional line:

local.qoq.setAttributes(resultSet = local.qryRes.getResult());

where local.qoq is the new query object and local.qryRes is the original query.

I tried for a while and knew I had seen this in action once but I could not work it out. I had a quick chat with Dave Ferguson who pointed me in the right direction.

Here is an example:

Click here to run the code.



Tag based cfc:



Script based cfc:

Nov 3, 2009

Adobe offering Free Flex training for ColdFusion developers

Just letting people know that Adobe is offering a free 1 day training event aimed at ColdFusion developers.

Sounds like it would be worth going to the price is right and they will likely show some new tricks/tips from both ColdFusion 9 and Flex 4

http://www.ce1.com/adobe/2009/flextrainingforcfdevelopers/

Register now for these training dates & locations:

November 13 - Plano, TX
November 14 - Durham, NC
November 16 - Denver, CO
November 17 - Newport Beach, CA
November 18 - Atlanta, GA
November 19 - Chicago, IL
November 20 - San Francisco, CA
November 20 - Washington, D.C.