cfml

ColdFusion - When to use the “request” scope?

我与影子孤独终老i 提交于 2019-11-29 01:32:38
Been going over my predecessor's code and see usage of the "request" scope frequently. What is the appropriate usage of this scope? Adam Tuttle There are several scopes that are available to any portion of your code: Session, Client, Cookie, Application, and Request. Some are inadvisable to use in certain ways (i.e. using Request or Application scope inside your Custom Tags or CFC's; this is coupling , violates encapsulation principles, and is considered a bad practice), and some have special purposes: Cookie is persisted on the client machine as physical cookies, and Session scoped variables

How to handle timezones in CFML?

我怕爱的太早我们不能终老 提交于 2019-11-28 23:31:00
How to handle timezones in CFML? So far all apps I've wrote just use the default timezone of the CF server and/or SQL server. What do you guys usually do? Do you store all dates in GMT with GetTimezineInfo() and then DateAdd(), and translate all time to the correct timezone based on logged in user's preference? Or do you guys use any java methods? Vincent Buck I was looking into the issue some time ago and found Paul Hasting's blog and Coldfusion/Java examples very helpful: Don't forget to check out his TZCFC test bed How to store dates will probably depend on your business logic. In a project

Can I get a query row by index in ColdFusion?

会有一股神秘感。 提交于 2019-11-28 22:10:43
问题 I want to get a specific row in a ColdFusion Query object without looping over it. I'd like to do something like this: <cfquery name="QueryName" datasource="ds"> SELECT * FROM tablename </cfquery> <cfset x = QueryName[5]> But it's giving me an error saying that the query isn't indexable by "5". I know for a fact that there are more than 5 records in this query. 回答1: You can't get a row in CF <= 10. You have to get a specific column. <cfset x = QueryName.columnName[5]> It's been 8 years since

Why does 0.06 + 0.01 = 0.07 in ColdFusion?

守給你的承諾、 提交于 2019-11-28 06:56:40
问题 Why don't math operations in ColdFusion seem to be affected by floating point math issues? Take the code: result = 0.06 + 0.01; writedump(result); writedump(result.getClass().getName()); Which outputs 0.07 java.lang.Double However the equivlant Java code produces what I"d expect when adding two doubles: public static void main(String[] args) { double a = 0.01d; double b = 0.06d; System.out.println(a + b); //0.06999999999999999 } This is what I'd expect to see from ColdFusion because of the

When and when not to use hash # symbol in ColdFusion?

那年仲夏 提交于 2019-11-28 05:12:19
问题 I use the # symbol around every dynamic value in my application and after posting some of my code on here for help, I've been told there's no need to use the # in many places e.g. <cfif> statements. So I have started removing the # symbols, until I realised I broke my application because I removed the # symbols from the value="" attribute of a <cfprocparam> tag. I am confused as to: Why use the # symbol is some places and not others (and what is the benefit of not using it?) Why if they are

ColdFusion Query - Injection Protection

余生颓废 提交于 2019-11-28 02:12:50
I ask this question with a bit of sheepishness because I should know the answer. Could someone be kind and explain if and how injection could occur in the following code? <cfquery> select * from tableName where fieldName = '#value#' </cfquery> I'm specifically curious about injection attempts and other malicious input, not about best practices or input validation for handling "normal" user input. I see folks strongly advocating use of CFQueryParam, but don't think I see the point. If user input has been validated for consistency to the database schema (e.g. so that input must be numeric for

How to handle timezones in CFML?

删除回忆录丶 提交于 2019-11-27 21:17:37
问题 How to handle timezones in CFML? So far all apps I've wrote just use the default timezone of the CF server and/or SQL server. What do you guys usually do? Do you store all dates in GMT with GetTimezineInfo() and then DateAdd(), and translate all time to the correct timezone based on logged in user's preference? Or do you guys use any java methods? 回答1: I was looking into the issue some time ago and found Paul Hasting's blog and Coldfusion/Java examples very helpful: Don't forget to check out

ColdFusion - When to use the “request” scope?

馋奶兔 提交于 2019-11-27 16:04:20
问题 Been going over my predecessor's code and see usage of the "request" scope frequently. What is the appropriate usage of this scope? 回答1: There are several scopes that are available to any portion of your code: Session, Client, Cookie, Application, and Request. Some are inadvisable to use in certain ways (i.e. using Request or Application scope inside your Custom Tags or CFC's; this is coupling, violates encapsulation principles, and is considered a bad practice), and some have special

Wrapping lists into columns

断了今生、忘了曾经 提交于 2019-11-27 12:33:13
I'm using ColdFusion to populate a template that includes HTML unordered lists ( <ul> s). Most of these aren't that long, but a few have ridiculously long lengths and could really stand to be in 2-3 columns. Is there an HTML, ColdFusion or perhaps JavaScript (I'm accepting jQuery solutions) way to do this easily? It's not worth some over-complicated heavyweight solution to save some scrolling. So I dug up this article from A List Apart CSS Swag: Multi-Column Lists . I ended up using the first solution, it's not the best but the others require either using complex HTML that can't be generated

Picking a ColdFusion MVC Framework [closed]

喜你入骨 提交于 2019-11-27 03:58:33
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I am taking over a lot of the ColdFusion stuff that is lingering at our shop and they are insistent it stay on ColdFusion and that new projects in this area MUST be done in CF - basically this part is non-negotiable. I am not very experienced in CF (haven't touched it since 2003) so most of my development has