小编Axi*_*rse的帖子

将几何转换为BufferGeometry

据我了解,Geometry存储顶点和面的javascript对象结构,BufferGeometry只通过Float32Arrays等存储原始gl数据.

有没有办法将标准几何转换为BufferGeometry,这是一个更小的内存紧凑与更少的对象?例如,如果我创建一个新的SphereGeometry,有没有办法轻松地将其转换为BufferGeometry?

javascript three.js buffer-geometry

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

Tensorflow与CUBLAS_STATUS_ALLOC_FAILED崩溃

我正在使用一个简单的MINST神经网络程序在Windows 10上运行tensorflow-gpu.当它试图运行时,它遇到CUBLAS_STATUS_ALLOC_FAILED错误.谷歌搜索没有发现任何东西.

I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:885] Found device 0 with properties:
name: GeForce GTX 970
major: 5 minor: 2 memoryClockRate (GHz) 1.253
pciBusID 0000:0f:00.0
Total memory: 4.00GiB
Free memory: 3.31GiB
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:906] DMA: 0
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:916] 0:   Y
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 970, pci bus id: 0000:0f:00.0)
E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_blas.cc:372] failed to create cublas handle: CUBLAS_STATUS_ALLOC_FAILED
W c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\stream.cc:1390] attempting to perform BLAS operation using StreamExecutor without BLAS support
Traceback (most recent call last): …
Run Code Online (Sandbox Code Playgroud)

cublas tensorflow

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

如何使用给定模式尾随最新的日志文件

我使用一些日志系统,每小时创建一个日志文件,如下所示:

SoftwareLog.2010-08-01-08
SoftwareLog.2010-08-01-09
SoftwareLog.2010-08-01-10
Run Code Online (Sandbox Code Playgroud)

我试图跟踪最新的日志文件给出一个模式(例如SoftwareLog*),我意识到:

tail -F (tail --follow=name --retry)
Run Code Online (Sandbox Code Playgroud)

但这只遵循一个特定的名称 - 这些名称按日期和小时分列.我尝试过类似的东西:

tail --follow=name --retry SoftwareLog*(.om[1])  
Run Code Online (Sandbox Code Playgroud)

但是,通配符语句在传递给尾部之前会被重新发送,并且不会在每次尾部重试时重新执行.

有什么建议?

linux logging zsh tail

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

lambda的模板参数推导

我正在尝试创建一个辅助函数,如果给定的weak_ptr有效,则在调用时执行lambda/std :: function.目前以下代码有效,但不幸的是,它需要我定义模板参数.我正在寻找一种方法来实现自动模板参数推导.

template <typename DependentType, typename... ArgumentTypes>
auto make_dependent(std::weak_ptr<DependentType>& dependent, std::function < void(ArgumentTypes...)> functor) -> decltype(functor)
{
    return [&dependent, functor] (ArgumentTypes... args)
    {
        if (!dependent.expired()) {
            functor(args...);
        }
    };
};
Run Code Online (Sandbox Code Playgroud)

理想情况下,我想std::function <void(ArgumentTypes...)>用通用模板参数替换FunctorType,但后来我不确定如何从中提取参数FunctorType.上面的代码有效,下面的代码是理论上的:

template <typename DependentType, typename FunctorType>
auto make_dependent_ideal(std::weak_ptr<DependentType>& dependent, FunctorType functor) -> decltype(std::function<return_value(functor)(argument_list(functor))>)
{
    return[&dependent, functor](argument_list(functor) args)
    {
        if (!dependent.expired()) {
            functor(args...);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

有没有办法做这样的事情?

c++ lambda templates c++11 c++14

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

在Windows/OSX/Linux上为Python中的图标添加徽章

我正在试图弄清楚如何在文件系统上添加和修改徽章图标到单个文件,就像Dropbox如何将同步图标添加到文件一样.我希望跨平台做到这一点,我希望看到哪种语言最好.现在我认为python是候选者,但我对其他语言开放,这个问题可能已经解决了.

python filesystems icons finder badge

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

迭代unique_ptrs向量的unique_ptr

如果向量不是unique_ptrs,或者我没有向量的unique_ptr(并且没有取消引用)它可以工作,但是两者都会导致编译错误.我不确定发生了什么.

auto v = std::make_unique<std::vector<std::unique_ptr<int>>>();
for (auto item : *v)
{

}
Run Code Online (Sandbox Code Playgroud)

c++ for-loop unique-ptr c++11

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

如何将消息传递给兄弟iFrame

我正在寻找一种方法将postMessage发送到兄弟iFrame,而不需要父页面中的任何javascript.我遇到的困难是尝试从第一个iFrame中获取另一个iFrame的窗口对象

该页面的布局如下:

html body (http://host.com/)
  iFrame#a (http://me.com/a)
  iFrame#b (http://me.com/b)
Run Code Online (Sandbox Code Playgroud)

iFrame#a我想做的:

(iFrame#b window).postMessage(...)
Run Code Online (Sandbox Code Playgroud)

问题是我不知道如何iFrame#b从内部获取窗口对象iFrame#a.parent.getElementById()和其他功能受XSS限制.我只想postMessage在父页面上向http://me.com/上面示例中的所有其他iFrame 发出一个来自我的域的所有其他iFrame .

javascript xss iframe postmessage

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