问题列表 - 第222108页

Cython:使用API​​嵌入Cython到C的分段错误

我试图在O'reilly Cython第8章之后将Cython代码嵌入到C中.我在Cython的文档中找到了这一段,但仍然不知道该怎么做:

如果想要使用这些函数的C代码是多个共享库或可执行文件的一部分,则需要在使用这些函数的每个共享库中调用import_modulename()函数.如果在调用其中一个api调用时遇到分段错误(linux上的SIGSEGV)崩溃,这可能表明包含生成分段错误的api调用的共享库之前没有调用import_modulename()函数崩溃的api电话.

我在OS X上运行Python 3.4,Cython 0.23和GCC 5.源代码是transcendentals.pyxmain.c:

main.c

#include "transcendentals_api.h"
#include <math.h>
#include <stdio.h>

int main(int argc, char **argv)
{
  Py_SetPythonHome(L"/Users/spacegoing/anaconda");
  Py_Initialize();
  import_transcendentals();
  printf("pi**e: %f\n", pow(get_pi(), get_e()));

  Py_Finalize();
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

transcendentals.pyx

cdef api double get_pi():
    return 3.1415926

cdef api double get_e():
    print("calling get_e()")
    return 2.718281828
Run Code Online (Sandbox Code Playgroud)

我正在使用setup.py和编译这些文件Makefile:

setup.py:

from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize

setup(
    ext_modules=cythonize([
        Extension("transcendentals", ["transcendentals.pyx"])
    ])
) …
Run Code Online (Sandbox Code Playgroud)

python cython

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

包括Aurelia的bootstrap css

我是Aurelia的新手并且陷入了第一道障碍.我使用aurelia cli创建了一个新项目,并选择使用less.

这工作正常,直到我尝试使用bootstrap.我已经安装了npm的bootstrap,它出现在node_modules/bootstrap /中

这有目录结构

dist fonts grunt Gruntfile.js js less LICENSE package.json README.md

dist目录中有css文件.

在我的模板中我做

我得到的错误是未处理拒绝错误:加载所需的CSS文件失败:bootstrap/css/bootstrap.css

如何告诉Aurelia bootstrap css文件在哪里以及如何使用它们?

谢谢

aurelia

10
推荐指数
3
解决办法
7492
查看次数

如何在PrimeNG数据表中添加"No Record Found"当数据不存在时?

我在primeNG官方网站上搜索过,我发现emptyMessage= "No Record Found"在PrimeNG ref中没有像数据表这样的属性.http://www.primefaces.org/primeng/#/datatable

所以当我的数据表中没有数据时,它没有向我显示任何消息.

<p-dataTable  #datatable [value]="jobData" [rows]="20" [paginator]="true"
            [responsive]="true" selectionMode="single"><--emptyMessage="" not working here as attribute :(
    <p-column expander="true" styleClass="icon"></p-column>
            <p-column field="finOrVin" styleClass="vinfin" header="header" sortable="custom" (sortFunction)="sort($event)">
            <p-column field="state"  styleClass="status" header="Status"  sortable="custom" (sortFunction)="sort($event)">
            </p-column>
    </p-dataTable>
Run Code Online (Sandbox Code Playgroud)

primeng angular

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

JSF Ajax Invoke Application没有执行?

我有这个简单的facelets页面:

<!DOCTYPE html>
<html xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
<h:head>
    <title>Index</title>
</h:head>
<h:body>
    <h:form>
        <h:inputText id="firstname" value="#{fooBar.firstname}">
            <f:ajax event="keyup" render="echo" execute="myCommandButton"/>
        </h:inputText>
        <h:commandButton value="Submit" action="#{fooBar.fooBarAction()}" id="myCommandButton"/>
    </h:form>
    <br/>
    <h:outputText id="echo" value="#{fooBar.firstname}"/>
</h:body>
</html>
Run Code Online (Sandbox Code Playgroud)

和Foobar豆如下:

@ManagedBean
@ApplicationScoped
public class FooBar {

    private String firstname;

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }

    public String getFirstname() {
        return firstname;
    }

    public void fooBarAction() {
        System.out.println("Foo bar action being executed!!!");
    }
}
Run Code Online (Sandbox Code Playgroud)

所以我期望看到每当我在inputText字段中输入内容时都会执行文本Foo bar操作,但实际情况并非如此.我错过了什么?

编辑:为什么我期待这种行为? 我正在研究Core …

ajax jsf jsf-2

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

@Autowired在可运行内部无法正常工作

我有一个可运行的任务,正在尝试自动接线,但是当我这样做时,该任务无法运行。当我为可运行范围外的田地自动接线时,它工作正常。为什么会这样呢?除了在内部自动装配外,是否还有其他更清洁的方法可以在可运行内部获取自动装配字段的新实例?

这是我的可运行方法

Runnable task = new Runnable() {

                @Autowired
                ICruxPanelClientService CruxPanelClientService;

                public void run (){
            CruxPanelClientService.setCruxWebServiceBaseURL("http://10.41.181.23:8080");
            CronCruxModel m = new CronCruxModel();
            m = model1.get(model_var);
            System.out.println("EXECUTING");
            System.out.println(m.getService_status() + " ---------EXEexecution");
            System.out.println(m.getCat_name() + "Executing Name ");
        //  time = m.getService_time();
            UpdateCategoryRequest updateCategoryRequest = new UpdateCategoryRequest();
            CategoryModel categoryModel = new CategoryModel();
            categoryModel.setColor(m.getCat_color());
            categoryModel.setIcon(m.getCat_icon());
            categoryModel.setIconWhite(m.getCat_icon_white());
            categoryModel.setName(m.getCat_name());
            categoryModel.setId(m.getCat_id());
            categoryModel.setKey(m.getCat_catkey());
            categoryModel.setIndexOrder(m.getCat_indexOrder());
            updateCategoryRequest.setCategory(categoryModel);
            CruxPanelClientService.updateCategory(updateCategoryRequest);
            GetServiceDataIdByCategoryIdRequest request1 = new GetServiceDataIdByCategoryIdRequest();    
            request1.setId(m.getCat_id());
            GetServiceDataIdByCategoryIdResponse response1 = CruxPanelClientService.getServiceDataIdByCategoryId(request1);
            ArrayList<ServiceModel> service = new ArrayList<ServiceModel>();
            service = response1.getServiceModels();

            JSONArray json = new JSONArray(); …
Run Code Online (Sandbox Code Playgroud)

java multithreading spring-mvc autowired

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

如何使用Firebase Auth访问Facebook范围数据

我正在尝试访问Facebook要求的数据.这是我的代码:

  var auth_provider_facebook = new firebase.auth.FacebookAuthProvider();

/// BEGIN: configure the facebook authorization provider.
  auth_provider_facebook.addScope('user_birthday');
  auth_provider_facebook.addScope('user_about_me');
  auth_provider_facebook.addScope('user_work_history');
  auth_provider_facebook.addScope('user_education_history');

 // auth_provider_facebook.addScope('user_birthday,user_about_me,user_work_history,user_education_history');

/// END: configure the facebook authorization provider.
Run Code Online (Sandbox Code Playgroud)

我已经尝试过单层衬里和多层衬里,但我仍然无法获取数据.此处的文档绝对没有关于从范围中检索数据的信息.这里提供的文档提到facebook变量作为结果的一部分,但它总是如此undefined.还有更多的文档在这里,带来了一个thirdPartyUserData属性,它也始终undefined.

我如何获取这些数据?

facebook-authentication firebase firebase-authentication

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

在git中使用多个遥控器

我正在开发一个新项目,并希望从我在GitHub上找到的种子项目开始.
我已经在本地克隆了种子项目,它在执行命令时显示了1个远程分支:

git remote -v
Run Code Online (Sandbox Code Playgroud)

但是我想在这个仓库中添加一个新的遥控器并进行所有更改,或者在这个新的仓库中扩展源代码,这是一个私人仓库.

现在添加新遥控器后,我可以在回购中看到2个遥控器.

如何在2个遥控器之间切换?
我不认为git checkout在使用2个不同遥控器的2个分支时,命令会起作用.

git github

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

webpackJsonp未定义:webpack-dev-server和CommonsChunkPlugin

这是我的webpack.config.js文件:

const webpack = require('webpack');
const path = require('path');

module.exports = {
  cache: true,
  devtool: 'source-map',
  entry: {
    app : [
      './src/index.js'
    ],
    vendor: ['lodash']
  },
  output: {
    filename: 'bundle.js',
    path: path.join(__dirname, 'dist'),
    publicPath: '/dist/',
    pathinfo: true
  },
  module: {
    loaders: [
      { test: /\.js$/, exclude: /node_modules/, loaders: ['babel'] },
      { test: /\.scss/, exclude: /node_modules/, loaders: ['style', 'css', 'sass'] }
    ]
  },
  plugins: [
    new webpack.NoErrorsPlugin(),
    new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.bundle.js', Infinity)
  ]
};
Run Code Online (Sandbox Code Playgroud)

这是我运行webpack-dev-server的脚本:

const webpack =require('webpack');
const WebpackDevServer = require('webpack-dev-server'); …
Run Code Online (Sandbox Code Playgroud)

javascript webpack commonschunkplugin

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

如何在Racket中返回命令行结果?

我可以使用Racket发出bash命令(system "some command"),但该函数返回#t而不是命令行的结果输出,它只打印.如何通过该函数获取返回命令的结果?

scheme command-line racket

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

如何在c ++中读取异步文件?

我需要异步读取文件

string read(string path) {
            DWORD readenByte;
            int t;
            char* buffer = new char[512];
            HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, "read");
            OVERLAPPED overlap;
            overlap.hEvent = hEvent;
            HANDLE hFile = CreateFile(path.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
            if(!hFile) {
                Debug::error(GetLastError(), "fileAsync.cpp::read - ");
            }
            t = ReadFile(hFile, buffer, MAX_READ - 1, &readenByte, &overlap);
            if(!t) {
                Debug::error(GetLastError(), "fileAsync.cpp::read - ");
            }
            t = WaitForSingleObject(hEvent, 5000);
            if(t == WAIT_TIMEOUT) {
                Debug::error("fail to read - timeout, fileAsync.cpp::read");
            }
            buffer[readenByte] = '\0';
            string str = …
Run Code Online (Sandbox Code Playgroud)

c++ winapi asynchronous

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