问题列表 - 第14820页

关于char-array向量的C++ GCC 4.3.2错误

问题类似于这个bug

关于在C++中将数组存储在std :: vector中的问题

但出于不同的原因(见下文).

对于C++中的以下示例程序:

#include <vector>

int main(int c_, char ** v_)
{
        const int LENGTH = 100;

        std::vector<char[LENGTH]> ca_vector;

        return 0;

}
Run Code Online (Sandbox Code Playgroud)

GCC 4.2.3编译干净.GCC 4.3.2发出以下错误:

/usr/lib/gcc/i686-pc-linux-gnu/4.3.2/include/g++-v4/bits/stl_construct.h: In function ‘void std::_Destroy(_Tp*) [with _Tp = char [100]]’:
/usr/lib/gcc/i686-pc-linux-gnu/4.3.2/include/g++-v4/bits/stl_construct.h:103:   instantiated from ‘void std::_Destroy(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = char (*)[100]]’
/usr/lib/gcc/i686-pc-linux-gnu/4.3.2/include/g++-v4/bits/stl_construct.h:128:   instantiated from ‘void std::_Destroy(_ForwardIterator, _ForwardIterator, std::allocator&) [with _ForwardIterator = char (*)[100], _Tp = char [100]]’
/usr/lib/gcc/i686-pc-linux-gnu/4.3.2/include/g++-v4/bits/stl_vector.h:300:   instantiated from ‘std::vector::~vector() [with _Tp = char [100], _Alloc = std::allocator]’
test.cpp:7:   instantiated from …

c++ arrays destructor vector

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

如何在SQLite中的两个表之间复制数据?

我有两个不同列的表,如下所示:

table1
(
    _id,
    title,
    name,
    number,
    address
)

table2
(
    _id,
    phone,
    name,
    address
)
Run Code Online (Sandbox Code Playgroud)

如何将数据'name','address'从table1复制到table2.

我的问题有两种情况:

  • 第一:table1,table2在同一个数据库文件中
  • 第二:data1.db文件中的table1,data2.db文件中的table2

database sqlite

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

如何找到呼叫程序的汇编版本?

我在这个应用程序中使用C#.

我有一个DLL包含在我的应用程序中.从这个DLL,我需要找到包含此DLL的主程序的汇编版本.

System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()不回报我想要的东西.这将返回DLL的Assembly版本,而不是主程序.

如何从主程序中获取版本信息?

c# dll assemblies version

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

从Lambda Property Expression获取自定义属性

我正在使用ASP.NET MVC 2 Preview 2并编写了一个自定义的HtmlHelper扩展方法来使用表达式创建标签.TModel来自具有属性的简单类,属性可以具有定义验证要求的属性.我试图找出表达式在我的label方法中表示的属性上是否存在某个属性.

类和标签的代码是:

public class MyViewModel
{
    [Required]
    public string MyProperty { get; set; }
}

public static MvcHtmlString Label<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, string label)
{
    return MvcHtmlString.Create(string.Concat("<label for=\"", expression.GetInputName(), "\">", label, "</label>"));
}

public static string GetInputName<TModel, TProperty>(this Expression<Func<TModel, TProperty>> expression)
{
    return expression.Body.ToString().Substring(expression.Parameters[0].Name.Length + 1);
}
Run Code Online (Sandbox Code Playgroud)

然后我会像这样称呼标签:

Html.Label(x => x.MyProperty, "My Label")
Run Code Online (Sandbox Code Playgroud)

有没有办法找出传递给Label方法的表达式值中的属性是否具有Required属性?

我发现如果它存在,执行以下操作确实可以获得属性,但我希望有更简洁的方法来实现这一点.

public static MvcHtmlString Label<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, string label)
{
    System.Attribute.GetCustomAttribute(Expression.Property(Expression.Parameter(expression.Parameters[0].Type, expression.GetInputName()), expression.GetInputName()).Member, typeof(RequiredAttribute))

    return …
Run Code Online (Sandbox Code Playgroud)

c# lambda attributes

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

如何汇款到任何paypal账户

是否可以使用paypal API向任何paypal帐户(不仅仅是API凭证所有者)汇款.我知道使用IPN可以做到这一点,但我需要使用SOAP.

paypal paypal-soap paypal-adaptive-payments

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

一个顶点缓冲区中有多个网格?

我是否需要为每个网格使用一个顶点缓冲区,还是可以在一个顶点缓冲区中存储多个网格?如果是的话,我应该这样做,我该怎么做?

c++ 3d direct3d vertex-buffer

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

jQuery .not()函数,无法正常工作

$(".navigation a").not(".navigation ul ul a").hover(function(){

    // Not working.

});
Run Code Online (Sandbox Code Playgroud)

由于某种原因,<a>里面的所有元素.navigation仍然获得分配给它的悬停功能.

我只想要不在里面的元素ul ul.

Html的结构如下:

<div class="navigation">
    <ul>
        <li><a>item 1</a></li>
        <li><a>item 2</a></li>
        <li>
            <a>item 3</a>
            <ul>
            <li><a>item 3.1</a><li>
            <li><a>item 3.2</a><li>
            <li><a>item 3.3</a><li>
            </ul>
        </li>
        <li><a>item 4</a></li>
        <li><a>item 5</a></li>
    </ul>
</div>
Run Code Online (Sandbox Code Playgroud)

javascript jquery

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

在java中制作决策树的最佳学习算法?

我有一个数据集,其中包含年龄,城市,儿童年龄等信息,以及结果(确认,接受).

为了帮助"工作流程"的模型化,我想基于以前的数据集自动创建决策树.

我已经看了http://en.wikipedia.org/wiki/Decision_tree_learning,我知道这个问题显然不明显.

我只是想对一些算法或一些关于这个主题的库提出建议,这可以帮助我构建基于样本的决策树.

java algorithm classification machine-learning decision-tree

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

如何从WebRequest中删除代理并保持DefaultWebProxy不变

我使用FtpWebRequest做一些FTP的东西,我需要直接连接(没有代理).但是WebRequest.DefaultWebProxy包含IE代理设置(我估计).

WebRequest request = WebRequest.Create("ftp://someftpserver/");
// request.Proxy is null here so setting it to null does not have any effect
WebResponse response = request.GetResponse();
// connects using WebRequest.DefaultWebProxy
Run Code Online (Sandbox Code Playgroud)

我的代码是一个巨大的应用程序中的一块,我不想改变,WebRequest.DefaultWebProxy因为它是全局静态属性,它可能会对应用程序的其他部分产生负面影响.

知道怎么做吗?

.net c#

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

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