ColdFusion Muse

Primitive Variables Vs. Educated and Urbane Variables

Mark Kruger March 17, 2009 3:39 PM ColdFusion Comments (6)

One of the things that sometimes trips me up is the whole idea of references. I'm not talking about stuffy books in the library. I'm talking about the idea that setting one variable to another can sometimes create a pointer to that item rather than a copy. Now before we chat about it any further we should get square on the difference between a "primitive" or "simple" data type and a "complex" or "emotionally involved" data type.

Primitive Data Types

I like to think of "primitive" data types as "one level" members of any scope. I also like to think of them as little cave men in loin cloths running around and clubbing defenseless mammoths - but that is perhaps too much information. There's actually a pretty short list of primitive data types. In fact, "short" actually is one of the data types I believe. In the CF world a primitive Datatype would be a string, number or possibly a date. Of course the actual list is more like "short, long, float, double, int, string, byte" - but it is probably more useful (for the purpose of this post) to consider String, Number and Date. Check out this example.

Read More
  • Share:

Ask-a-Muse: Getting a Specific Occurence of a Day

Mark Kruger February 26, 2009 7:02 PM ColdFusion Comments (2)

Muse reader James asks:
If a person picks a date on a calendar, say the first Tuesday in a month, how do you calculate date of the first Tuesday in the next month and each succeeding month there after?

This is an immensely complicated issue that will take you days and weeks to sort out. What you need is to know the day number you are looking for (1=Sunday, 2=Monday, etc), The month number (where 1 = January, 2 = February etc.), and the year (where 2009 = 2009, 20010 = 20010 etc.). Then you need to download this handy function from cflib.org called FirstXDayOfMonth, written by a Mr. Troy Pullis. Pass in your values and it will give you back the first occurrence of that day in the month. Add 7 to it get the second occurrence, 14 to get the third etc. Here is an example:

Read More
  • Share:

Coldfusion, SSL 3.0 and Authorize.net

Mark Kruger February 24, 2009 4:38 PM ColdFusion, Hosting and Networking Comments (9)

I've been batting this around for a few days now. Recently, Mary Jo Sminkey of CF Webstore fame posted a note to an email list about the recent requirement by Authorize.net that incoming requests to their API use SSL 3.0. I confess to being unaware of the differences between SSL 2.0 and 3.0. So I set out to discover for myself. To start with SSL 2.0 uses weaker handshaking. A requesting client can, it seems, edit the list of preferences leaving the server no choice but to hand shake with the "lowest common denominator" cipher. There are some other issues as well dealing with how the packets are constructed etc. So the consensus is that SSL 2.0 is the weak sister and should be deprecated. For its part SSL 3.0 has been around for a decade or so and is widely supported.

The question is, will my CFHTTP calls from ColdFusion 6 or Coldfusion 7 still work when Authorize.net disables SSL 2.0? To answer this question I got some great help from Scott Krebs over at Edge Web. He dug out three or four URLs that were really helpful. I've included them at the bottom of this post. I also got some guidance from the Stephen Hawking of cryptography, Mr. Dean H. Saxe (the H is for Holy Cow he knows a lot). The answer is a qualified yes. Anyway, here's what I did to test while I wait for Authorize.net to get their act together and set up a test bed.

Read More
  • Share:

Java in ColdFusion - a Festivus for the Restofus

Mark Kruger February 23, 2009 1:52 PM ColdFusion Comments (6)

Using ColdFusion means leveraging the power of Java. ColdFusion encapsulates a large percentage of the Java web universe and makes it available to you through native tags, but a vast array of additional functionality is also available through the use of Java Libraries. The truth is, however, that working with Java in ColdFusion can be frustrating for the non Java programmer. Sure there are some easy things you can utilize like getClass() and toString(), but what if you have some Java sample code and you just want to pull it into your Coldfusion page? How do you do that? Here's a short example I created in response to a recent CF Talk post. The setup is that Authorize.net sent a memo to everyone telling them that SSL 2.0 would no longer be supported as of late March. There was general agreement that CF 8 could handle SSL 3.0 but what about 6 and 7?

It turned out that both 6 and 7 are compatible as well (as of 1.4.02), but along the way I got the idea to grab the Java code from Authorize.net and give it a whirl in Coldfusion as a sort of test run at bypassing cfhttp. I've done this many times with other products as well (custom libraries, IBM's MQ series etc). So I wrote this post to show the process I went through to unpack Java Code into ColdFusion.

Read More
  • Share:

Ask-a-Muse: Follow up on FQDN in CFMAIL

Mark Kruger February 13, 2009 6:10 PM ColdFusion Comments (5)

Muse reader Eric Cobb, whose CFgears blog is an great read, made an excellent point regarding my statement that the designated server for a CFMAIL tag should be a full qualified domain name instead of just an IP address.

Eric wrote:
To me, this seems like it would be a problem with your mail server, not CF. The mail server is responsible for telling the world the FQDN the email is coming from, not CF. All the mail server settings in the CF Administrator do is tell CF who to pass the mail to so it can be sent, right? The mail server does the actual sending of the mail, and should have everything set up to report its FQDN. So if you specify the mail server's IP address in the CF Administrator, that should be fine since the mail server itself is the one actually sending the email. All CF needs to know is which machine to pass the mail to so it can be sent.

I may have a misunderstanding of how things work, but CF isn't a mail server, it just connects to one and lets it do its job, right?

I got to thinking about this and I wanted to be sure - so I ran a test. Here's what I found.

Read More
  • Share:

The "OK" Button Strikes Again (Cfhttp from CF 6.1 to CF 8.01)

Mark Kruger February 10, 2009 3:16 PM ColdFusion Comments (0)

Recently I migrated a server from ColdFusion 6.1 to ColdFusion 8.01. Typically such migrations are a walk in the park. There are very few things that go wrong. I'll save my check list for another time, but here is one that is new to me. I had some code that utilized the UPS rate checker API. It was fairly straight forward stuff. But for some reason it began throwing a strange error soon after migrating. Here's the scoop.

Read More
  • Share:

Why Curly is Not Just For Yucks

Mark Kruger February 10, 2009 1:41 PM ColdFusion Comments (13)

Most Muse readers know I'm a fan of Cfscript. I often use it in the sample code as well as in the code I write and demonstrate. I use it frequently for a couple of reasons. One reason is that I have an easier time of commenting with cfscript because I can just add a couple of slashes, type a comment and hit enter. I also like cfscript for working with CFCs. For me the code ends up being more readible. As you probably know you can save a few lines with Cfscript as well. Consider the following example:

Read More
  • Share:

CFHTTP and DNS Revisited

Mark Kruger January 28, 2009 7:10 PM ColdFusion Comments (3)

The muse has a few posts that are more popular than others. The post on Update Using a Join is legendary (in my own mind) and has achieved popularity even on SQL forums and blogs. My posts on interfacing with a HP e3000 or using Webspere's MQ Series.... eh... not so much. Among those posts on the popular side of the spectrum is the post on Troubleshooting CFHTTP. This little gem is hit more often than a quarterback for the Detroit Lions. Why? Because CFHTTP relies on a number of things that are outside of ColdFusion's control - like DNS, Networking and sometimes SSL. Today I was on the phone helping a site owner come to grips with just such a problem.

Read More
  • Share: