问题列表 - 第38168页

有没有办法在Perl中获取一个匿名数组末尾的切片?

所以这让我在过去的半小时里疯狂了.有没有办法让我在一个匿名数组的末尾抓取一个数组切片?我已经尝试过了:

(split(' ',$test_line))[1..$#_]

我已经尝试过了, (split(' ',$test_line))[1..-1]

但是加剧了这些工作.我真的不希望有一个额外的临时变量实例化到中间数组(我不需要).我真的不想使用丑陋且难以理解的一个班轮(在网上找到一些).真的没有直接的方法来做到这一点吗?

perl

13
推荐指数
2
解决办法
4523
查看次数

纯HTML + JavaScript客户端模板

我想使用仅客户端技术(没有服务器端包括)实现类似于Java Tiles框架的东西.

我想有一个页面,例如layout.html,它将包含布局定义.该页面中的内容占位符为空#content div标签.

我想根据网址在该页面上注入不同的内容.像layout.html?content = mainlayout.html?content = edit这样的内容会显示内容已替换为main.html或edit.html.

目标是避免重复代码,即使是布局,也可以在没有服务器端模板的情况下编写页面.

你会建议什么方法?

编辑:我不需要一个完整的模板库,只需要一种组合页面的方法,类似于瓷砖.

html javascript templates tiles client-side

8
推荐指数
1
解决办法
4333
查看次数

curl errno 35(与[安全站点]相关的未知SSL协议错误:443)

我正在尝试使用curl发布到外部URL,外部页面使用https,这是我正在使用的服务器的desc

服务器Apache/2.2.11(Win32)mod_ssl/2.2.11 OpenSSL/0.9.8k PHP/5.3.0

外部网址重定向到我在帖子中发送的另一个网址,但每次我尝试我都会收到此错误

curl_errno = 35(与[安全站点]相关的未知SSL协议错误:443)

所以我检查了萤火虫的反应,它说

无法加载源: http://localhost/3Party/PHP_VPC_3Party_Auth_Capture_Order_DO.php

这是我正在使用的代码

ob_start();

// initialise Client URL object
$ch = curl_init();
// set the URL of the VPC

curl_setopt ($ch, CURLOPT_URL, $vpcURL);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $this->postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);  
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_exec ($ch);
if (curl_error($ch)) {
    $this->errorMessage = 
        "curl_errno=". curl_errno($ch) . " (" . curl_error($ch) . ")";
}
curl_close ($ch);
Run Code Online (Sandbox Code Playgroud)

php ssl https curl

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

jquery在<td>中找到文本

我正在玩一些选择器,而且我在一个单元格中选择Text时撞墙.

这是我正在做的一个简单的尝试.

<table>
 <tr>
     <td>First Name</td>
     <td>*required</td>
  </tr>
</table> 
Run Code Online (Sandbox Code Playgroud)

我想将该单元格的类更改为"红色" - 如果找到字符串"*required".

这是我对jquery的尝试:

$("td:contains('*required')").addClass("red");
Run Code Online (Sandbox Code Playgroud)

它似乎导致所有细胞应用该类.有没有更好的方法来寻找特定的文字?

jquery jquery-selectors

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

strtod和下溢

我想在使用strtod函数在C++(Visual C++ 2010)中将字符串转换为double时检测下溢.下面的代码不能像我期望的那样工作,尽管我是根据strtod文档做的:

 char numStr[] = "123456.122111111123123123123132123123123123123124434345345";
 char* pEnd;
 double d = strtod(numStr, &pEnd);
 int errorNum = errno;
 if (errorNum == ERANGE) // this should be true
 {
  // underflow occurred
 }
Run Code Online (Sandbox Code Playgroud)

使用调试器,我发现errorNum总是被设置为0ERANGE34.

我错过了什么?

c c++ type-conversion visual-c++

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

Spring连接池问题

我没有Java和Spring的经验.我尝试编写一个使用JdbcTemplate进行数据访问的程序.我使用DBCP池,这里是:

<bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
    <property name="url" value="jdbc:oracle:thin:@192.168.2.7:1521:xe" />
    <property name="username" value="manifesto" />
    <property name="password" value="manifesto" />
    <property name="initialSize" value="2" />
    <property name="maxActive" value="4" />
</bean>
Run Code Online (Sandbox Code Playgroud)

我的应用程序执行多个更新操作,然后抛出异常:

    7053 [SenderThread-0] DEBUG org.springframework.jdbc.datasource.DataSourceUtils  - Fetching JDBC Connection from DataSource
Exception in thread "SenderThread-0" org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Listener refused the connection with the following error:
ORA-12519, TNS:no appropriate service handler found
The Connection descriptor used by the client was:
192.168.2.7:1521:xe …
Run Code Online (Sandbox Code Playgroud)

java oracle spring pooling ora-12519

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

使用滚动条在Qt中并排显示图像

我是Qt新手.我想用Qt并排显示2张图像.使用Qt的图像查看器示例,我想添加另一个可滚动的图像显示,以便两个图像并排显示.

示例代码为ctor提供了以下代码段:

ImageViewer::ImageViewer()
{
   imageLabel = new QLabel;
   imageLabel->setBackgroundRole(QPalette::Base);
   imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
   imageLabel->setScaledContents(true);

   scrollArea = new QScrollArea;
   scrollArea->setBackgroundRole(QPalette::Dark);
   scrollArea->setWidget(imageLabel);
   setCentralWidget(scrollArea);
   ...
Run Code Online (Sandbox Code Playgroud)

如果我理解正确,我希望imageLabel只有一半宽度的屏幕,而另一半显示另一个QLabel.

我怎样才能做到这一点?
谢谢.

qt

3
推荐指数
1
解决办法
1748
查看次数

为参数指定多个接口

我有一个实现两个接口的对象...接口是:

public interface IObject
{
    string Name { get; }
    string Class { get; }
    IEnumerable<IObjectProperty> Properties { get; }
}
public interface ITreeNode<T>
{
    T Parent { get; }
    IEnumerable<T> Children { get; }
}
Run Code Online (Sandbox Code Playgroud)

这样的

public class ObjectNode : IObject, ITreeNode<IObject>
{
    public string Class { get; private set; }
    public string Name { get; private set; }
    public IEnumerable<IObjectProperty> Properties { get; set; }
    public IEnumerable<IObject> Children { get; private set; }
    public IObject Parent { get; …
Run Code Online (Sandbox Code Playgroud)

c# interface composition

21
推荐指数
2
解决办法
7920
查看次数

在OpenGL中识别可见顶点

识别特定视点可见顶点的最有效方法是什么?

我有一个由几个3D模型组成的场景.我想将标识符附加到每个顶点(ModelID,VertexID),然后从各个视点生成2D图像,并为每个图像生成可见顶点标识符的列表(实际上这是用于图像处理应用程序).

最初我想在顶点法线和摄像机视图矢量之间执行点积,以确定顶点是否面向摄像机,但是如果模型被另一个对象遮挡,则此测试将不起作用.

提前致谢

opengl visibility occlusion vertices vertex

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

使用UpdatePanel的UpdateProgress

UpdateProgress当用户点击"下一步"按钮转到下一页时,我想在页面A上显示.下一页是页面B,其中包含大量数据.

单击该按钮时,它不会显示UpdateProgress.

此代码中缺少什么,以及如何显示?

<asp:UpdateProgress ID="UpdateProgress1" runat="Server" AssociatedUpdatePanelID="UpdatePanel1">
    <ProgressTemplate >
       Please wait ...
    </ProgressTemplate>
</asp:UpdateProgress>

<asp:UpdatePanel ID="UpdatePanel1" runat="server"> 
   <Triggers>
      <asp:AsyncPostBackTrigger ControlID="btnNext" EventName="Click" />
   </Triggers>                                    

   <ContentTemplate>                                          
      <asp:Button ID="btnCancel" runat="server" TabIndex="1" Text="Cancel"onclick="btnCancel_Click" />                                    
      <asp:Button ID="btnNext" runat="server" TabIndex="2" Text="Next" onclick="btnNext_Click" />
   </ContentTemplate>                                 
</asp:UpdatePanel>
Run Code Online (Sandbox Code Playgroud)

asp.net asp.net-ajax updateprogress

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