小编Lei*_*igh的帖子

从CFC中包含CFM时的并发和范围问题

我在我的应用程序范围中放置一个组件,以便在所有请求中共享它,它包含一个cfm模板:

<cfcomponent output="false">

    <cffunction name="run" output="false" returntype="void">

        <cfset var tmp = false/>

        <cftry>
            <cfinclude template="inc.cfm"/>
            <cfcatch>
                <cffile action="append"
                        file="#ExpandPath("error.log")#"
                        output="ERROR: #cfcatch.message#"/>
            </cfcatch>
        </cftry>

    </cffunction>

</cfcomponent>
Run Code Online (Sandbox Code Playgroud)

正在包含的模板只是创建一个数组并检查数组长度应该是什么,如果不是它写入error.log文件:

<cfset tmp = [
    "one",
    "two",
    "three"
]/>
<cfif ArrayLen(tmp) neq 3>
    <cffile action="append"
            file="#ExpandPath("error.log")#"
            output="Length = #ArrayLen(tmp)#"/>
</cfif>
Run Code Online (Sandbox Code Playgroud)

如果我然后在它上面运行一个加载(100个并发线程),我会在我的error.log文件中出现以下项目...

ERROR: element at position 3 of array variable &quot;___IMPLICITARRYSTRUCTVAR0&quot; cannot be found.
Length = 0
Length = 2
Run Code Online (Sandbox Code Playgroud)

注意我在Java 1.7.0_09上使用ColdFusion 9.0.1.274733.我在相同的JRE上测试过Railo并且工作正常.


附加以下还会导致问题,将tmp变量更改为结构并在variables范围中添加随机项,而不是在任何地方引用...

<cfcomponent output="false"> …
Run Code Online (Sandbox Code Playgroud)

coldfusion cfc coldfusion-9

6
推荐指数
1
解决办法
246
查看次数

没有由SQLite JDBC驱动程序实现

我已成功使用sqlitejdbc-v056.jar.创建了一个到SQLite数据库的ColdFusion数据源.然后我将此查询添加到我的.cfm页面

<cfquery name="qry" datasource="Spiceworks">
SELECT
id AS Ticket_Number,
summary AS Summary,
status AS Status,
created_at AS Created_At,
assigned_to AS Assigned_to

FROM tickets
WHERE status = 'open' AND assigned_to IS NULL
ORDER BY Created_At DESC   
</cfquery>
Run Code Online (Sandbox Code Playgroud)

当我浏览IE和Firefox中的.cfm页面时,出现错误:

没有由SQLite JDBC驱动程序实现

错误发生在C:/Inetpub/wwwroot/intra/SmartTV/UnassignedTickets/Tickets.cfm:第204行

202:
203:
204:
205:SELECT
206:id,

SQL SELECT id,summary,status,created_at,assigned_to FROM tickets WHERE status ='open'AND assigned_to IS NULL ORDER BY created_at DESC DATASOURCE Spiceworks Resources:

Check the ColdFusion documentation to verify that you are using the correct syntax.
Search the Knowledge …
Run Code Online (Sandbox Code Playgroud)

sqlite coldfusion jdbc

6
推荐指数
1
解决办法
3944
查看次数

WCF和ColdFusion

我有一个WCF WebService我想使用ColdFusion消费.常规过程是使用CFHTTP在WSDL中使用SOAP请求.通常,这是有效的,一切正常.

<cfsavecontent variable="xmlBody" >
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/">
   <soap:Header/>
   <soap:Body>
      <tem:GetVersion/>
   </soap:Body>
</soap:Envelope>
</cfsavecontent>
Run Code Online (Sandbox Code Playgroud)
<cfhttp url="https://www.example.com/OtherService.svc?wsdl" method="post" timeout="1200" username="myUsername" password="myPassword" >
    <cfhttpparam type="header" name="Content-Type" value="application/soap+xml;charset=UTF-8">
    <cfhttpparam type="header" name="Content-Length" value="#len(trim(xmlbody))#">
    <cfhttpparam type="header" name="soapAction" value="http://tempuri.org/GetVersion">
    <cfhttpparam type="body" name="body" value="#trim(xmlBody)#">
</cfhttp>
<cfdump var="#cfhttp#">
Run Code Online (Sandbox Code Playgroud)

运行页面后,我得到了The security context token is expired or is not valid. The message was not processed.回复.在阅读服务提供商提供的文档时,似乎我不能只将XML发布到URL并将其称为一天: While WCF uses XML to post communications to the endpoint, it is required that users use Visual Studio's "Add Service Reference" or svcutil.exe …

.net coldfusion wcf web-services coldfusion-11

6
推荐指数
0
解决办法
388
查看次数

Microsoft Azure身份验证失败和ColdFusion

我正在努力将ColdFusion 2016应用程序连接到Microsoft Azure blob存储,并且似乎无法正确地进行身份验证.

这是我收到的错误:

<Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:9aed89ad-0001-00b8-6fd8-ecc48c000000 Time:2016-08-02T16:07:42.9046123Z</Message><AuthenticationErrorDetail>The Date header in the request is incorrect.</AuthenticationErrorDetail></Error>

HTTP/1.1 403服务器无法验证请求.确保正确形成Authorization标头的值,包括签名.内容长度:419内容类型:application/xml服务器:Microsoft-HTTPAPI/2.0 x-ms-request-id:9aed89ad-0001-00b8-6fd8-ecc48c000000日期:星期二,02八月2016 16:07:42 GMT Connection : 关

这是我在容器中列出blob的代码:

<!--- The key is copied directly from the Azure portal interface. --->
<cfset theKey = "fxIciOymaQ2OAcc1g2M...BwQRxNPtEzmwHAyx6J6pw==" />

<cfset requestMethod = "GET" />

<cfset utcDate = dateConvert("local2UTC",now()) />
<cfset xmsDate = dateFormat(utcDate,"ddd, d mmm yyyy") & " …
Run Code Online (Sandbox Code Playgroud)

coldfusion azure azure-storage-blobs

6
推荐指数
1
解决办法
315
查看次数

ColdFusion - 如何设置Content-Length标头

有没有人成功地将Content-Length标题添加到常规ColdFusion(我正在使用CF9)页面?我正在使用压缩在思科负载均衡器后面设置一个新服务器 - 该框拒绝压缩没有此标头的任何内容,但CF默认情况下不通过它.

<cfheader name="Content-Length" value="something"> 将设置标题,但找到正确的值是一个问题.

任何指针都将非常感激.

coldfusion content-length http-headers

5
推荐指数
1
解决办法
2538
查看次数

prism/mvvm:将列绑定到DataGrid

我正在使用这样的标准.NET DataGrid:

<DataGrid ItemsSource="{Binding Datensaetze}" AutoGenerateColumns="False">
 <DataGrid.Columns>
   <DataGridTextColumn Header="my col 1" Binding="{Binding MyCol1}"/>
   <DataGridTextColumn Header="my col 2" Binding="{Binding MyCol2}"/>
   <DataGridTextColumn Header="my col 3" Binding="{Binding MyCol3}"/>
 </DataGrid.Columns>
</DataGrid>
Run Code Online (Sandbox Code Playgroud)

这很好用.现在我想在ViewModel中定义列,而不是在xaml中设置固定列,我想在运行中生成它们.但是,如果我尝试将列绑定到任何东西,我会收到错误,说

DataGrid.Columns是一个只读属性,无法绑定.

有没有办法动态地将DataGrid列绑定到后面的代码中?

wpf binding datagrid prism mvvm

5
推荐指数
1
解决办法
3821
查看次数

JSTL舍入/减少号码

这可能是一个愚蠢的问题,但是假设seconds我的JSP页面中有一个变量,其值为779.现在我想通过执行以下操作将其转换为分钟和秒:

    <c:set var="${seconds / 60}" value="min"/>
    <c:set var="${seconds mod 60}" value="sec">
Run Code Online (Sandbox Code Playgroud)

这样我得到min = 12.983333和sec = 59.0.

现在我想合并两个并将结果显示为12:59.我面临的问题是min不断向上调整到13.我尝试了很多东西,例如:

    <fmt:parseNumber var="minutes" integerOnly="true" type="number" value="${min}" />

    <fmt:formatNumber type="number" pattern="###" value="${min}" var="minutes" />

    fn:substringBefore(min, '.')

    maxFractionDigits="0"

    // and so on...
Run Code Online (Sandbox Code Playgroud)

但他们所有人都只是一致地回归13.在这一点上我有点无能为力.但我可能错过了一些东西.我希望这里的某个人有一个关于可能出错的想法或暗示.

-编辑

下面的代码最终使它工作.我不知道出了什么问题,因为它现在也在使用"/".也许其他地方有些小错误.不过非常感谢你的时间:) Kudos!

    <c:set var="min" value="${fn:substringBefore((seconds div 60), '.')}"/>  
    <fmt:formatNumber var="sec" pattern="##" value="${seconds mod 60)}"/>   
Run Code Online (Sandbox Code Playgroud)

java tags jsp jstl rounding

5
推荐指数
1
解决办法
1万
查看次数

Backbone和要求如何添加Qunit

我正在使用Backbone和Require.js.一切都很好,但我想在我的应用程序中添加一些单元测试.我决定使用Qunit.js.

在我的main.js文件中,我创建了新对象EventsView:

require.config({
  paths: {
    jquery:                 'libs/jquery',
    underscore:             'libs/underscore',
    backbone:               'libs/backbone',
    qunit:                  'test/libs/qunit-1.10.0
    }
 });
 require(['view/eventsView', 
          'test/eventsView_test', 
          'test/eventView_test' ], function(EventsView){
           var events = new EventsView; //here I create first object my View
 });
Run Code Online (Sandbox Code Playgroud)

eventsView.js中, initialize我渲染主视图

  define(['jquery',
          'backbone',
          'underscore',
          'collection/eventC',
          'model/eventM',
          'view/eventView'], function($, Backbone,_,EventC,EventM, EventView,){

 var EventsView = Backbone.View.extend({
    el: $(".contener"),     
    initialize: function(){
        this.render();
     },
     ....//other functions
    });
     return EventsView;
 });
Run Code Online (Sandbox Code Playgroud)

所以现在我需要在其他文件eventsView_test.js中调用此视图中的函数.我不能这样做,因为View将再次呈现:

  define(['jquery','qunit','view/eventsView'], function($,qunit,EventsView){
    //var eventsView = new EventsView(); // I can't create …
Run Code Online (Sandbox Code Playgroud)

require qunit backbone.js

5
推荐指数
1
解决办法
1714
查看次数

如何在prestashop中获取当前控制器名称?

如何在prestashop 1.5中获取当前控制器名称?

prestashop

5
推荐指数
3
解决办法
2万
查看次数

从java程序运行jar文件

我试图从另一个Java程序执行jar文件.我使用以下代码:

      try {
          Runtime runtime = Runtime.getRuntime();
          runtime.exec("path upto jar");
      } catch (Exception ex) {
          JOptionPane.showMessageDialog(null, "Exception occured" + ex);
      }
Run Code Online (Sandbox Code Playgroud)

但它不起作用.我试过谷歌,它给了我使用ProcessBuilder的例子,但这也没有用.

java runtime jar executable-jar

5
推荐指数
2
解决办法
2万
查看次数