问题列表 - 第37600页

用于音频重采样的库

在嵌入式(Windows CE)C++项目中,我必须将任意采样率重新采样(或向上)到44100 Hz.

是否有用于音频重采样的免费便携式C/C++库?

c c++ embedded audio resampling

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

最奇怪的分段错误

好吧,基本上我正在编写一个程序,它接收两个目录并根据提供的选项处理它们.当我没有看到问题时,它会给我分段错误.导致问题的代码如下:

编辑:更新代码以包含我的整个源文件

#include <unistd.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>

#define OPTLIST "am:npruv"
#define DEFAULT_MOD_TIMES 1

typedef struct
{
    /* Boolean toggle to indicate whether hidden files should be
       processed or not */
    bool processHiddens;
    /* Integer number of seconds such that files with modification
       times that differ by less than this value are considered the
       same */
    int timeResolution;
    /* Boolean toggle to indicate whether the actual synchronisation
       (file creation and overwriting) should be performed or not */
    bool …
Run Code Online (Sandbox Code Playgroud)

c bash segmentation-fault

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

混合"替代"与"选项"时的Boost.Spirit错误?

我只使用Boost.Spirit(来自Boost 1.44)三天,试图通过RFC2822中的确切语法解析原始电子邮件.我以为我开始理解它并到达某个地方,但后来我遇到了一个问题:

#include <iostream>
#include <boost/spirit/include/qi.hpp>

namespace qi = boost::spirit::qi;
using qi::omit;
using qi::repeat;
using std::cout;
using std::endl;

typedef qi::rule<std::string::const_iterator, std::string()> strrule_t;

void test(const std::string input, strrule_t rule) {
    std::string target;
    std::string::const_iterator i = input.begin(), ie = input.end();

    if (qi::parse(i, ie, rule, target)) {
        cout << "Success: '" << target << "'" << endl;
    } else {
        cout << "Failed to match." << endl;
    }
}

int main() {
    strrule_t obsolete_year = omit[-qi::char_(" \t")] >> repeat(2)[qi::digit] >>
        omit[-qi::char_(" \t")];
    strrule_t …
Run Code Online (Sandbox Code Playgroud)

c++ boost boost-spirit boost-spirit-qi

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

如何计算字符串中的字符串出现?

如何计算特定字符串在另一个字符串中出现的次数.例如,这是我在Javascript中尝试做的事情:

var temp = "This is a string.";
alert(temp.count("is")); //should output '2'
Run Code Online (Sandbox Code Playgroud)

javascript regex string

554
推荐指数
12
解决办法
44万
查看次数

检测长按 UIWebview 并在按下链接时弹出菜单

遇到 UIWebview 的问题,它似乎对手势识别器没有反应。每当我用不同的动作长按链接(或图像)时,我都希望出现一个弹出窗口。

任何帮助将不胜感激=)。谢谢。

iphone objective-c uiwebview ios

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

用C#代码更改WPF窗口背景图像

我有几个图像配置为应用程序资源.

当我的应用程序启动时,主窗口的背景是通过XAML设置的:

<Window.Background>
    <ImageBrush ImageSource="/myapp;component/Images/icon.png" />
</Window.Background>
Run Code Online (Sandbox Code Playgroud)

如果发生给定事件,我想将此背景更改为另一个资源("/myapp;component/Images/icon_gray.png").

我尝试过使用两个常量:

private static readonly ImageBrush ENABLED_BACKGROUND =
    new ImageBrush(new BitmapImage(new Uri("/myapp;component/Images/icon.png")));
private static readonly ImageBrush DISABLED_BACKGROUND =
    new ImageBrush(new BitmapImage(new Uri("/myapp;component/Images/icon_gray.png")));
Run Code Online (Sandbox Code Playgroud)

...但很自然地,我得到一个带有无效URI的例外.

有没有一种简单的方法来this.Background = ...使用包Uri或资源(即:) 更改WPF窗口的背景图像(via Myapp.Properties.Resources.icon)?

c# wpf background-image

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

python - 未定义的变量?

python是否有一些未定义的变量/调试模式,它将输出通知/警告?

PHP允许您修改error_reporting以打开通知警告,这意味着要做

<?php
echo $foo;
Run Code Online (Sandbox Code Playgroud)

将在第2行抛出一个"Undefined variable foo .......

python有类似的东西吗?

我有一个我正在做的错误

db.connect
Run Code Online (Sandbox Code Playgroud)

代替

db.connect()
Run Code Online (Sandbox Code Playgroud)

我希望python会抛出一个未定义的变量连接...

你能提高python中的错误报告级别或类似程度吗?

python variables debugging error-reporting

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

C程序终止于-1(0xFFFFFFFF),看似没有理由?

#include <stdio.h>
typedef struct pduct {char name[20];
                        int price;
                        int stock;} PRODUCT;

void init(PRODUCT * product)
{
    printf("What is the name of the product: ");
    fgets(product->name, 20, stdin);
    printf("DEBUG: Did it get written...: %s", product->name);
    printf("What is the current stock of the item: ");
    scanf("%d", product->stock);
    printf("What is the price of the new item: ");
    scanf("%d", product->price);
}

int main()
{
    PRODUCT products[5];
    init(products);
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

现在,我真的有点亏.在运行它时,它会询问产品的名称,将其打印出来,以便我知道它存储了它,然后询问库存量,它将崩溃并返回-1.

我不知道出了什么问题.我试着换出fgetsscanf,只是可以肯定的,但同样的事情发生.我猜我struct的设置错了,但我不知道怎么回事.它char可能是阵列吗?此外,无论我如何安排它,它始终是第二个输入.那么为什么第一个这么好呢?

谢谢你的帮助!

c struct pointers scanf segmentation-fault

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

在这个正则表达式中加入"减号",怎么样?

我有这个正则表达式:

  var alphaExp = /^[a-zA-ZåäöÅÄÖ\s]+$/;
Run Code Online (Sandbox Code Playgroud)

这是表单验证中的名称字段.

我需要输入像"Anna-nicole"这样的名字(注意减号).目前,减号会导致错误.

我需要重新制作这个正则表达式,以便在名称中包含减号; 最好是我应该这样做,以便名称也不能以减号开头,或以一个减号结束.只允许在"单词或名称"之间使用减号.

有人知道怎么做这个吗?

顺便说一句,它是JavaScript.

html javascript regex security validation

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

_1是C++ 0x的一部分吗?

我已经看到两个最近的答案使用_1纯C++ 0x解决方案(没有明确提到boost lambdas).

是否有这样的动物,std::_1我认为拥有原生的lambdas将使这样的构造多余.

Google代码搜索std::_1会带来同一项目的两个结果,因此不确定.

c++ lambda boost c++11

12
推荐指数
3
解决办法
2295
查看次数