问题列表 - 第36922页

编程cuda内核时的整数大小

我似乎无法在Cuda编程指南中找到这个简单问题的答案:用nvcc编译内核时,short,int,long和long long声明了什么大小的整数?它是否依赖于我的主机架构,所以我应该使用int16_t,int32_t和int64_t,还是总是固定大小?

cuda

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

boost :: filesystem相对路径和当前目录?

如何boost::filesystem::path在Windows上指定相对路径?此尝试失败:

boost:filesystem::path full_path("../asset/toolbox"); // invalid path or directory.
Run Code Online (Sandbox Code Playgroud)

也许是为了帮我调试,如何使用boost :: filesystem获取当前的工作目录?

c++ filesystems boost

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

不推荐使用I18n消息中的{{key}}插值语法.请改用%{key}

我正在使用Rails 2.3.8运行ruby 1.8.7(2010-01-10 patchlevel 249)[i686-darwin10.3.2],我必须使用该版本.当我进行'rake test'时,我得到了

The {{key}} interpolation syntax in I18n messages is deprecated. Please use %{key} instead.
Run Code Online (Sandbox Code Playgroud)

有一个错误,但现在应该解决:https://rails.lighthouseapp.com/projects/8994/tickets/4525-favor-in-all-code-instead-of-deprecated-as-interpolation-syntax-for-国际化

我试过版本为0.4.1,0.4.0和0.4.0-beta1的i18n gem没有运气

任何的想法?

ruby-on-rails internationalization

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

如何在sql server中提交和回滚事务?

我有一个巨大的脚本用于创建表和从一个服务器移植数据.所以这个剧本基本上有 -

  1. 为表创建语句.
  2. 插入以将数据移植到这些新创建的表.
  3. 为存储过程创建语句.

所以我有这个代码,但它基本上不起作用@@ ERROR总是零我认为..

BEGIN TRANSACTION
--CREATES
--INSERTS
--STORED PROCEDURES CREATES
    -- ON ERROR ROLLBACK ELSE COMMIT THE TRANSACTION
    IF @@ERROR != 0
        BEGIN

            PRINT @@ERROR
                      PRINT 'ERROR IN SCRIPT'
            ROLLBACK TRANSACTION
            RETURN
        END
    ELSE
    BEGIN
        COMMIT TRANSACTION
        PRINT 'COMMITTED SUCCESSFULLY'
    END
    GO
Run Code Online (Sandbox Code Playgroud)

任何人都可以帮我写一个事务,基本上会回滚错误并提交,如果一切都很好.. 我可以在这里使用RaiseError ..

transactions sql-server-2008

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

FileInfo.Length大于0但文件是否为空?

我有一个应用程序来处理一堆文本文件.目前,我有这样的代码(剪下摘录):

FileInfo info = new FileInfo(...)
if (info.Length > 0) {
    string content = getFileContents(...);
        // uses a StreamReader
        // returns reader.ReadToEnd();
    Debug.Assert(!string.IsNullOrEmpty(contents)); // FAIL
}

private string getFileContents(string filename)
    {
        TextReader reader = null;
        string text = "";

        try
        {
            reader = new StreamReader(filename);
            text = reader.ReadToEnd();
        }
        catch (IOException e)
        {
            // File is concurrently accessed. Come back later.
            text = "";
        }
        finally
        {
            if (reader != null)
            {
                reader.Close();
            }
        }

        return text;
    }
Run Code Online (Sandbox Code Playgroud)

为什么我收到失败的断言?FileInfo.Length属性已用于验证文件是否为空.

编辑: …

c# file-io

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

如何在Cassandra中创建自动增量ID

我们知道在SQL数据库中创建自动增量ID很容易,在Cassandra中有一个很好的解决方案吗?ID应该是键名或列名.

cassandra

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

专用类模板的类构造函数定义

我正在尝试为类定义之外的显式专用类模板定义构造函数,如下所示:

template <typename T>
struct x;

template <>
struct x<int> {
    inline x();

    /* This would have compiled:
    x() {
    }
    */
};

template <>    // Error
x<int>::x() {
}
Run Code Online (Sandbox Code Playgroud)

但这似乎是一个错误.Comeau说:error: "x<int>::x()" is not an entity that can be explicitly specialized尽管完整的课程是专业的.

这是什么问题?

c++ templates template-specialization

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

带有参数的函数的Javascript eval()

我该怎么做呢?

function myUIEvent() {
    var iCheckFcn = "isInFavorites";
    var itemSrc = ui.item.find("img").attr("src");

    if (eval(iCheckFcn(itemSrc))) { alert("it's a favorite"); }

function isInFavorites(url) { return true; } // returns boolean
Run Code Online (Sandbox Code Playgroud)

javascript arguments eval

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

如何拒绝访问文件但允许服务器

我有一个Web应用程序,其中包含一个配置文件夹,其中包含多个XML文件,这些文件是多个"门户"的配置设置.我需要IIS才能访问它们,以便"门户"加载(sql连接字符串,主页面路径),但我想拒绝任何外部访问(URL浏览).这是一个例子如下:

HTTP://www.mywebsite/virtualdirectory/configurationdirectory/configfile.xml

我需要限制对此文件的访问,如果您正在浏览它但仍然允许系统访问它,以便它可以解析它正在加载的"门户".

有任何想法吗?

asp.net authentication iis-7 authorization geolocation

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

如何定制Maven独特版本字符串?

我想知道在<uniqueVersion>true</uniqueVersion>设置时自定义Maven工件部署中使用的时间戳字符串有哪些选项 .理想情况下,我们希望从源代码控制中包含更改列表编号而不是时间戳,因为它是确定给定版本中哪些功能和错误修复的更可靠的方法.

continuous-integration maven-2

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