rss
twitter
Find out what I'm doing, Follow Me :)
1

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) />

 

0

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;
}
}

 

1


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.

13

At my work place we were setting up local development environment for all the developer. Our setup was pretty standard. Local development environment for all developer, Subversion (SVN) for version control and development/test server for QA. To make this setup painless for developers, one of the main requirement was to export the code to our development server when it was committed to SVN. To do something like that, SVN has what they call "hooks". These are essentially scripts that are run on certain repository events. The events are:

  • start-commit - This is run before commit transaction begins, can be used to do special permission checking.
  • pre-commit - This is run when the transaction is complete, but before commit. Often used to validate things such as a non zero length log message.
  • post-commit - This is run after the transaction has been committed and a revision number created. Can be used for sending emails, or backing up repository or in our case exporting the changed files.
  • pre-revprop-change - Runs before a revision property change. Can be used to check permissions.
  • post-revprop-change - Runs after a revision property change. Can be used to email or backup these changes.

More information on hooks here http://svnbook.red-bean.com/en/1.1/ch05s02.html

So, with this knowledge I thought it should be easy enough to just do an SVN export command in the post-commit hook, right? Well, I should know better. Nothing ever is quite that simple. But, hopefully after you read this post, it will be for you. I will go step by step on how to get it working and the issues I faced.

If you are someone like me who doesn't like to read long posts, go ahead and download the script and play with it. If it works for you, great! Otherwise keep reading :)

Read More
0

So, here I'm. Finally ready to blog. In the past years I have taken so much from the community that I think now it's time to give back a little. 

First off all, many thanks to all those who take the time and effort to blog about their experiences and knowledge for others to learn from. You have saved me many hours of frustrations over the years. And you are the ones who inspired me to start bloging, so others can learn from my experiences. Also, thanks to Brian Rinaldi for pushing me to get my blog out.

I don't claim to be an expert on anything I will be writing about. I will be merely sharing my experiences. I will however try to provide quality content so that my readers as well as I, benefit from the discussion and the feedback provided by others.

I will mostly be writing on topics related to (but not limited to) ColdFusion, Flex, SQL, JavaScript, AJAX, Automation etc.

And so it begins...

 

More Results: