小编jor*_*bor的帖子

如何运行Python CGI脚本

我之前从未设置过服务器(更不用说python服务器)了,我有点迷失了.我如何使用以下代码?我试图放入cgi bin目录但是没有用.它返回了内部服务器错误.看看这里

#!/usr/bin/env python
#
# Funf: Open Sensing Framework
# Copyright (C) 2010-2011 Nadav Aharony, Wei Pan, Alex Pentland.
# Acknowledgments: Alan Gardner


from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from SocketServer import ThreadingMixIn
import sys
import cgi
import urlparse
import os.path
import shutil
import time

server_dir = os.path.dirname(__file__)

config_path = '/config'
config_file_path = os.path.join(server_dir, 'config.json')

upload_path = '/data'
upload_dir = os.path.join(server_dir, 'uploads')

def read_config():
    config = None
    try:
        with open(config_file_path) as config_file:
            config = config_file.read()
    except IOError:
        pass
    return …
Run Code Online (Sandbox Code Playgroud)

python cgi

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

导入错误ghmm库

我收到此错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/dist-packages/ghmm.py", line 112, in <module>
    import ghmmwrapper
  File "/usr/local/lib/python2.6/dist-packages/ghmmwrapper.py", line 25, in <module>
    _ghmmwrapper = swig_import_helper()
  File "/usr/local/lib/python2.6/dist-packages/ghmmwrapper.py", line 21, in swig_import_helper
    _mod = imp.load_module('_ghmmwrapper', fp, pathname, description)
ImportError: libghmm.so.1: cannot open shared object file: No such file or directory
Run Code Online (Sandbox Code Playgroud)

root@ubuntu:~# sudo locate libghmm
/usr/local/lib/libghmm.a
/usr/local/lib/libghmm.la
/usr/local/lib/libghmm.so
/usr/local/lib/libghmm.so.1
/usr/local/lib/libghmm.so.1.0.0
Run Code Online (Sandbox Code Playgroud)

为什么我会收到此错误?我尝试添加

/usr/local/lib/
Run Code Online (Sandbox Code Playgroud)

我的PYTHONPATH

但它不起作用.

python linux import importerror hidden-markov-models

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

言语中的情绪检测

我想建立一个应用程序,分析麦克风的语音情感内容.

虽然有时用作额外的特征,但它不涉及语音识别.情绪分析基于声音的韵律特征(音高变化,速度等,音调).

我知道这可以在台式计算机上完成,但我不希望用户必须将他们的录音(电话交谈)上传到服务器以获得情绪反馈.

我需要的是一个API,它提供整个分析或API,我可以用来提取这些功能(即对话的平均速度).

那里有这样的东西吗?

提前致谢!

android speech-recognition speech

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

如何只打印包含子字符串的行

我有一个字符串文件:

REALSTEP 12342 {2012-7-20   15:10:39};[{416 369 338};{423 432 349};{383 380 357};{399 401 242};{0 454 285};{457 433 115};{419 455 314};{495 534 498};][{428 377 336};{433 456 345};{386 380 363};{384 411 
REALSTEP 7191 {2012-7-20    15:10:41};[{416 370 361};{406 417 376};{377 368 359};{431 387 251};{0 461 366};{438 409 134};{429 411 349};{424 505 364};][{423 372 353};{420 433 374};{379 365 356};{431 387 2
REALSTEP 12123 {2012-7-20   15:10:42};[{375 382 329};{386 402 347};{374 378 357};{382 384 259};{0 397 357};{442 424 188};{398 384 356};{392 420 355};][{404 405 359};{420 432 372};{405 …
Run Code Online (Sandbox Code Playgroud)

python list

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

为什么此 GeoTool 片段不生成可见的 shapefile?

我正在创建一个简单的程序,它从 csv 文件中读取值并根据这些值创建一个 shp 文件。这是对这个例子的轻微修改

形状文件似乎已创建,但是当我使用另一个片段查看形状文件时我什么也没看到。我可以使用此程序查看其他示例 shapefile。

我的代码中缺少什么?

我的数据:

LAT1, LON1, LAT2, LON2, LAT3, LON3, LAT3, LON3, CITY, NUMBER
10, 10, 20, 20, 30, 30, 10, 10, Trento, 140
Run Code Online (Sandbox Code Playgroud)

我的代码:

public class ShapeReaderWriter {

    public static void main(String[] args) throws Exception {

        //read the xml file
        File file = FileUtils.getFile("D:\\workspaces\\Routeguard\\Xml2Shape\\src\\com\\meteogroup\\conversion\\locations.csv");

        List<String> lines = FileUtils.readLines(file, "utf-8");

        final SimpleFeatureType TYPE = createFeatureType();

        List<SimpleFeature> features = new ArrayList<SimpleFeature>();        

        GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null);
        SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(TYPE); …
Run Code Online (Sandbox Code Playgroud)

java geotools

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

Crystal报告:在公式中使用公式/求和时间字段中的汇总字段

在水晶报告中,我想显示时间对象的总和值,即一名员工在一个月内工作三天,每天工作时间可变.

反正有没有总结一个时间字段?

或者作为一种解决方法,我可以将时间字段用作整数,对此求和并显示.但后来我想通过使用公式来改变显示格式.我找不到在公式中包含摘要字段的方法......

提前致谢

PS我正在使用CR 2011(只是程序不通过VB或任何东西).

sum crystal-reports crystal-reports-xi

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

C++中未定义的库错误引用

这段代码:

#include "SoftwareSerial.h">
#include <avr/io.h>
#include <HardwareSerial.h>
#include <avr/interrupt.h>

void read_response();

int main () {
    sei();
    Serial.begin(2400);
    uint8_t receivePin = 2;
    uint8_t transmitPin = 3;
    SoftwareSerial softSerial(receivePin, transmitPin);
    softSerial.begin(2400);

    while(1){
        softSerial.println("to soft serial");
        Serial.print(softSerial.read());
    }   
}
Run Code Online (Sandbox Code Playgroud)

在编译时给我这个错误:

undefined reference to `SoftwareSerial::SoftwareSerial(unsigned char, unsigned char, bool)'
Run Code Online (Sandbox Code Playgroud)

我尝试过使用#include"SoftSerial.h",但没有区别.SoftSerial.h和SoftSerial.cpp文件位于我的库文件夹中,其中HardwareSerial.h文件也驻留在该文件夹中.

我错过了什么?

c++ include atmel

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

如何在python中将[0x01,0xFF,.....]作为字符串''01 FF ....'返回

我对此感到困惑.如何打印十六进制字节:

 [0x05, 0x06, 0x40, 0xFD, 0x05]
Run Code Online (Sandbox Code Playgroud)

在控制台中这样:

 05 06 40 FD 05    
Run Code Online (Sandbox Code Playgroud)

我将如何在to_string函数中使用它:

def to_string(bytes):
    cmd = '%02X'.join(chr(b) for b in self.bytes) #does not work obviously
    return cmd

print to_string([0x05, 0x06, 0x40, 0xFD, 0x05])
Run Code Online (Sandbox Code Playgroud)

我想我可以从你的答案中概括出来.

python hex

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

在水晶报表中对两个字段进行排序控制

我想在Crystal Report中使用多个交互式排序控件.这可能不用分组吗?

我的报告看起来像这样

person
   orderID  date amount
   ...      ...  ...
Run Code Online (Sandbox Code Playgroud)

虽然报告是按人分组的(按照alpabetically排序很好),但我希望最终用户可以在每个字段上对数据(在人员组内)进行排序.

Excel可以做到这一点,所以我对水晶寄予厚望!

谢谢

sorting crystal-reports crystal-reports-2008

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

为什么我们不能从Object []转换为String [],而我们可以从数组中的值转换?

为什么这样运行:

    static TreeMap<String, int[]> configs = new TreeMap<String, int[]>();

    int[] upperarms_body = {2,3,4,6};
    int[] left_arm = {1,2};
    int[] right_arm = {6,7};
    int[] right_side = {5,6,7};
    int[] head_sternum = {3,4};


    configs.put("upperarms_body", upperarms_body);
    configs.put("left_arm", left_arm);
    configs.put("right_arm", right_arm);
    configs.put("right_side", right_side);
    configs.put("head_sternum", head_sternum);



    // create a config counter
    String[] combi = new String[configs.keySet().size()];

    Set<String> s = configs.keySet();
    int g = 0;
    for(Object str : s){
        combi[g] = (String) str; 
    }
Run Code Online (Sandbox Code Playgroud)

而这不是:

  static TreeMap<String, int[]> configs = new TreeMap<String, int[]>();

    int[] upperarms_body = {2,3,4,6};
    int[] …
Run Code Online (Sandbox Code Playgroud)

java arrays casting

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

当我的矩阵"不确定"时出了什么问题?

我正在使用Jahmm java lib进行分类.我想做一些测试,所以我生成一些随机数据集.

我以这种格式创建数据集:

[val_1.1 val_1.2 val_1.3];[val_2.1 val_2.2 val_2.3]; [val_3.1 val_3.2 val_3.3] etc...
Run Code Online (Sandbox Code Playgroud)

我使用随机函数

 val_1.1 == val_1.2 == val_1.3
Run Code Online (Sandbox Code Playgroud)

val_2.1 == val_2.2 == val_2.3 
Run Code Online (Sandbox Code Playgroud)

等等.

当我使用此数据集调用以下函数时,它会抛出IllegalArgumentException

static double[][] decomposeCholesky(double[][] m)
{
    if (!isSquare(m))
        throw new IllegalArgumentException("Matrix is not square");

    double[][] l = matrix(nbRows(m), nbColumns(m));

    for (int j = 0; j < nbRows(m); j++)
    {
        double[] lj = l[j];
        double d = 0.;

        for (int k = 0; k < j; k++) {
            double[] lk = l[k];
            double s = …
Run Code Online (Sandbox Code Playgroud)

java math matrix

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

为什么这个while循环给我一个语法错误?

这段代码:

@Service
public class IvsImport {

    private Logger logger = Logger.getLogger(IvsImport.class);

    @Autowired
    FileReader fileReader;

    @Autowired
    ValueProcessorProvider provider; 

    CSVEntryParser<IvsBerichtPojo> entryParser = new AnnotationEntryParser<IvsBerichtPojo>(IvsBerichtPojo.class, provider);
    CSVReader<IvsBerichtPojo> ivsBerichtReader = new CSVReaderBuilder<IvsBerichtPojo>(fileReader).entryParser(entryParser).build();

    public IvsImport(){}

    public FileReader getFileReader() {
        return fileReader;
    }

    public void setFileReader(FileReader fileReader) {
        this.fileReader = fileReader;
    }

    Iterator<IvsBerichtPojo> it = ivsBerichtReader.iterator(); //this } is not OK????
    while(it.hasNext()) {
            IvsBerichtPojo bericht = it.next();
            logger.info(bericht.getScheepsNummer()); 
    }
} //and here?????
Run Code Online (Sandbox Code Playgroud)

在迭代器声明之后和最后一个卷曲的brakcet上给我一个语法错误:

Syntax error, insert "}" to complete ClassBody
Run Code Online (Sandbox Code Playgroud)

但是当我这样做时,没有任何改变....

请帮忙!

java syntax

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