coldfusion

Coldfusion: passing a struct as String through url

余生长醉 提交于 2019-12-19 07:35:13
问题 Is there a simple way to serialize a single-level structure as a string for use in a url? for example: ?key1=val1&key2=val2 回答1: <cfscript> // create simple struct x = { a=1, b=2, c=3 }; WriteDump(x); // serialize in JSON format and encode for URL transport y = URLEncodedFormat( SerializeJSON(x)); WriteOutput( 'url: <a href="#SCRIPT_NAME#?z=#y#">#SCRIPT_NAME#?#y#</a>'); // now receive the URL variable and dump it if ( StructKeyExists( url, 'z' )) { writeOutput( '<h3>URL Data:</h3>' );

Coldfusion: passing a struct as String through url

三世轮回 提交于 2019-12-19 07:34:32
问题 Is there a simple way to serialize a single-level structure as a string for use in a url? for example: ?key1=val1&key2=val2 回答1: <cfscript> // create simple struct x = { a=1, b=2, c=3 }; WriteDump(x); // serialize in JSON format and encode for URL transport y = URLEncodedFormat( SerializeJSON(x)); WriteOutput( 'url: <a href="#SCRIPT_NAME#?z=#y#">#SCRIPT_NAME#?#y#</a>'); // now receive the URL variable and dump it if ( StructKeyExists( url, 'z' )) { writeOutput( '<h3>URL Data:</h3>' );

Coldfusion: passing a struct as String through url

╄→гoц情女王★ 提交于 2019-12-19 07:34:12
问题 Is there a simple way to serialize a single-level structure as a string for use in a url? for example: ?key1=val1&key2=val2 回答1: <cfscript> // create simple struct x = { a=1, b=2, c=3 }; WriteDump(x); // serialize in JSON format and encode for URL transport y = URLEncodedFormat( SerializeJSON(x)); WriteOutput( 'url: <a href="#SCRIPT_NAME#?z=#y#">#SCRIPT_NAME#?#y#</a>'); // now receive the URL variable and dump it if ( StructKeyExists( url, 'z' )) { writeOutput( '<h3>URL Data:</h3>' );

Calculate HMAC-SHA256 digest in ColdFusion using Java

耗尽温柔 提交于 2019-12-19 07:32:14
问题 We are trying to calculate a HMAC-SHA256 digest in ColdFusion and we are using the HMAC CFC, but in one case it is producing a different result for the digest compared to ones generated in different languages - have tried the same data using Ruby & PHP and get the expected result. I have also tried the CF_HMAC custom tag it is based on and get the same results. I understand that from CF8 encrypt() supports HMAC-SHA256, but it's only available in Enterprise (which we don't have) and isn't even

Scoping: Local vs Var

烂漫一生 提交于 2019-12-19 07:23:06
问题 I'm new to CF so this may be a basic question. But I've heard I should use local for objects inside functions due to how scoping works in CF. But what about 'var'? Is var the same as using local? e.g. function MyFunction() { local.obj = {}; } Is this the same as: function MyFunction() { var obj = {}; } If they aren't the same, what is the difference between them? And when should I be using either of them? 回答1: They are very similar, but not exactly the same. Both only exist inside of a

Disadvantages of J2EE session management in ColdFusion

馋奶兔 提交于 2019-12-19 06:46:58
问题 Manual page tells about bunch of advantages of the J2EE session management (SM) over the ColdFusion SM, but what about other side? Which problems can appear when using J2EE SM? Also, if J2EE SM is so cool, why ColdFusion SM is still default? I can see one obvious reason: backwards compatibility. And this is typical for Adobe. Same time I doubt that Adobe cares about compatibility with other CFML engines. Any other reasons? 回答1: None that I've found, really. As soon as J2EE session management

cfquery crashes when there are tsql comments

北城以北 提交于 2019-12-19 06:18:53
问题 This does not crash in ColdFusion 11, but does crash in ColdFusion 2016 SELECT * FROM dbo.Roles WITH (NOLOCK) WHERE Code IS NOT NULL AND Active = 1 AND RoleID IN (SELECT RoleID FROM dbo.Emp WITH (NOLOCK)) -- It's ok to look at termed employees This works OK in both SELECT * FROM dbo.Roles WITH (NOLOCK) WHERE Code IS NOT NULL AND Active = 1 AND RoleID IN (SELECT RoleID FROM dbo.Emp WITH (NOLOCK)) Is there a setting to restore the orginal behavior? UPDATE I thought I had a minimal example of

ColdFusion too big to be an integer

天涯浪子 提交于 2019-12-19 05:53:13
问题 I am trying to convert a large number going in to Megabytes. I don't want decimals numeric function formatMB(required numeric num) output="false" { return arguments.num \ 1024 \ 1024; } It then throws an error How do I get around this? 回答1: You can't change the size of a Long, which is what CF uses for integers. So you'll need to BigInteger instead: numeric function formatMB(required numeric num) { var numberAsBigInteger = createObject("java", "java.math.BigInteger").init(javacast("string",

PHP encryption code converted to ColdFusion

蓝咒 提交于 2019-12-19 05:08:09
问题 I have this bit of PHP that I'd like to do the equivalent of in ColdFusion. function & _encryptMessage( $message ) { $td = mcrypt_module_open( MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, ''); mcrypt_generic_init( $td, $this->key, $this->iv ); $encrypted_data = mcrypt_generic( $td, $message ); mcrypt_generic_deinit($td); mcrypt_module_close($td); return base64_encode( $encrypted_data ); } I think it is just encrypt(message,"","AES","Base64") But I have no real way of knowing for sure and it

Passing a Table Valued parameter to a stored procedure

怎甘沉沦 提交于 2019-12-19 03:56:06
问题 Here's an example of how to use table-valued parameters in a SQL Server 2008 stored procedure using .NET. And here's the list of parameter types in CF9. Q: Is it possible for ColdFusion to pass a table-valued parameter to a Microsoft SQL Server 2008 stored procedure? 回答1: Not sure. If you need to pass a table of information, probably your best bet is to use the XML data type. Code sample here. 回答2: Short Answer: No support, it should, vote for it! Long Answer: Coldfusion can use JDBC, which