Mar 4
I'm still trying to wrap my head around the relationships in ORM. Yesterday I wanted to delete all the child entities with the parent is delete. No problem, there is an attribute for that. cascade="all-delete-orphan". Well, it wasn't working for me.
It turned out, in my Mach-II app I was using event-bean (by mistake) to prepare the bean and then calling EntityDelete() on it. The entity was getting deleted but the child entities were not getting deleted. No error either. Once I realized my mistake (event-bean), and changed to call-method to load the entity and then call entityDelete() on it everything worked fine.
So, what is the bug? Here is the code equivalent (artist-art example) of my mumbo-jumbo above:
Read more...
Jan 18
I had an interesting observation about datatype conversion in CF9 when dealing with an error in ORM. I was getting an error that said can't use double for an integer field type (something like that). Now, I know that ColdFusion is datatype "independent". So, all simple variables are of datatype "String". Given that, when we do:
Read more...
Nov 10
ColdFusion's built in function getTimeZoneInfo() doesn't allow you to pass a date. It give you the server timezone info and offset as of "now" (as in, when the code is run).
If you need to find the timezone offset for a specific date, you can use the TimeZone class from java. Here is the code.
<cfset myDate = "11/01/09" />
<cfset timeZone = createObject("java","java.util.TimeZone") />
<cfset myTimeZone = timeZone.getTimeZone("America/New_York") />
<cfset myTimeZoneOffset = myTimeZone.getOffset(1,year(myDate),month(myDate),day(myDate),dayOfWeek(myDate),0) />
Nov 10
I'm slowly migrating to writing script style components. I really started loving it. It's lot faster to write code in script style.
Anyway, today in one of my component I wanted to define the type of a property as a custom class. Since you can't write any code above property definition, on a whim, I tried the import outside of the component declaration and I was pleasantly surprised that it worked as expected!
import someClassPath.*;
component {
property MyClassName myClass;
public void function init() {
return this;
}
}
Oct 13
Recently came across a really bizarre issue with CFHTTP. Look at the code below:
<cfset variables.protocols = "https://,http://">
<cfset variables.link = "www.adobe.com/products/coldfusion/">
<cfloop list="#variables.protocols#" index="protocol">
<cfhttp url="#protocol##variables.link#" method="get" timeout="10"/>
<cfoutput>Status: #cfhttp.StatusCode#<br></cfoutput><cfflush>
</cfloop>
See anything wrong with it? No? Well, here is the output I get:
Status: 200 OK
Status: Connection Failure. Status code unavailable.
And no, both the URL's are valid and you can access them through browser or with CFHTTP outside of CFLOOP. Turns out it's a bug in CFHTTP. When CFHTTP is used inside CFLOOP you can't follow an "https" request with "http" request. Huh? Ya, that's what I thought...
I was ready to file a bug report, but before doing that tested it in CF 9 to see what happens and voila, it works!
So, whatever the bug was, it's fixed in CF 9.
Recent Comments