小编Ham*_*eni的帖子

`$(window).load(function(){})`和`$(function(){})之间有什么区别?

我正在使用$(window).load(function(){});我的项目,直到某个地方我看到有人说我们可以使用$(function(){});它们并且它们的表现相同.
但是现在我有更多经验,我注意到它们并不相同.我注意到第一段代码在第二段代码之后就开始了.
我只是想知道有什么区别?

jquery dom window-load

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

什么是Diameter协议?

我有3个简单的问题.

  1. 简单说明中的Diameter协议是什么?
  2. 为什么用它?
  3. 怎么用呢?

我在网上搜索了一个实际的解释,却找不到一个.总而言之,是一些技术性的诽谤.

authentication network-protocols diameter-protocol

6
推荐指数
2
解决办法
6857
查看次数

蜂窝数据上的WebRTC连接失败

我正在尝试使用WebRTC使用这些项目创建一个Android应用程序:

AndroidRTC

哪个使用此存储库:io.prinstine.libjingle

当两个客户端通过wifi连接到网络时,此项目运行良好,但当其中一个客户端通过蜂窝数据连接时,它不起作用.

我试图找到源代码,看看发现了什么,我找到了这个静态类:

public static class Options {
    // Keep in sync with webrtc/base/network.h!
    static final int ADAPTER_TYPE_UNKNOWN = 0;
    static final int ADAPTER_TYPE_ETHERNET = 1 << 0;
    static final int ADAPTER_TYPE_WIFI = 1 << 1;
    static final int ADAPTER_TYPE_CELLULAR = 1 << 2;
    static final int ADAPTER_TYPE_VPN = 1 << 3;
    static final int ADAPTER_TYPE_LOOPBACK = 1 << 4;

    public int networkIgnoreMask;
  }
Run Code Online (Sandbox Code Playgroud)

我发现这行代码引用了使用此类的本机方法:

public void setOptions(Options options) {
    nativeSetOptions(nativeFactory, options);
  }

public native void nativeSetOptions(long …
Run Code Online (Sandbox Code Playgroud)

java android node.js webrtc

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

具有多个位置块的nginx配置

我正在尝试配置nginx从2个不同的位置提供2个不同的PHP脚本.配置如下.

  1. 我有一个Laravel安装,/home/hamed/laravelpublic应该在其中提供目录.
  2. 我有一个Wordpress安装/home/hamed/www/blog.

这是我的nginx配置:

server {
        listen  443 ssl;
        server_name example.com www.example.com;

        #root /home/hamed/laravel/public;

        index index.html index.htm index.php;

        ssl_certificate /root/hamed/ssl.crt;
        ssl_certificate_key /root/hamed/ssl.key;

        location /blog {
                root /home/hamed/www/blog;
                try_files $uri $uri/ /blog/index.php?do=$request_uri;
        }

        location / {
                root /home/hamed/laravel/public;
                try_files $uri $uri/ /index.php?$request_uri;
        }
        error_page 404 /404.html;
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/html;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                #fastcgi_pass 127.0.0.1:9000;
                fastcgi_pass unix:/var/run/php5-fpm.hamed.sock;
                fastcgi_index …
Run Code Online (Sandbox Code Playgroud)

php nginx nginx-location

6
推荐指数
2
解决办法
8376
查看次数

Superpowered:无法让TimeStretching正常工作,输出声音失真

我正在尝试使用Superpowered SDK在正在播放和同时录制的mp3文件上应用实时Time Stretching和Pitch Shifting.问题在于,无论我做什么,输出音质都很糟糕(到了它被扭曲的程度).
我怀疑这是由于每帧数的样本冲突造成的.这是我的cpp文件的完整源代码:

static SuperpoweredAndroidAudioIO *audioIO;
static SuperpoweredTimeStretching *stretching;
static SuperpoweredAudiopointerList *outputBuffers;
static SuperpoweredDecoder *decoder;
static SuperpoweredRecorder *recorder;
const char *outFilePath;
const char *tempFilePath;

static short int *intBuffer;
static float *playerBuffer;

bool audioInitialized = false;
bool playing = false;

static bool audioProcessing(
        void *__unused clientData, // custom pointer
        short int *audio,           // buffer of interleaved samples
        int numberOfFrames,         // number of frames to process
        int __unused sampleRate     // sampling rate
) {

    if (playing) {
        unsigned …
Run Code Online (Sandbox Code Playgroud)

c++ android signal-processing android-ndk superpowered

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

"非静态变量,这不能从静态上下文引用"?

我是一个Java新手,我正试图通过递归函数部署斐波那契线,然后计算运行时间.这是我设法编写的代码:

class nanoTime{
    int fib(int n){
        if(n==0) return 0;
        if(n==1) return 1;
        return this.fib(n-1)+this.fib(n-2);
    }
    public static void main(String[] args){
        double beginTime,endTime,runTime;
        int n=10;
        beginTime = System.nanoTime();
        n = this.fib(n);
        endTime = System.nanoTime();
        runTime = endTime-beginTime;
        System.out.println("Run Time:" + runTime);
    }
}
Run Code Online (Sandbox Code Playgroud)

问题是,当我试图将其变为字节码时,我收到以下错误:

nanoTime.java:11: non-static variable this cannot be referenced from a static context
Run Code Online (Sandbox Code Playgroud)

我想知道这是什么问题?!

java recursion static syntax-error

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

如何在活动中获取服务对象?

这是我的服务代码:

public class DownloadService extends Service {
    LocalBroadcastManager mLocalBroadcastManager;
    ArrayList<DownloadAsyncTask> dat = new ArrayList<DownloadAsyncTask>();
    @Override
    public IBinder onBind(Intent arg0) {
        return null;
    }

    @Override
    public void onStart( Intent intent, int startId ) {
          super.onStart( intent, startId );
          Log.d("service","DownloadService started");
    }
    public void startDownload(String url, String fname, ProgressBar pBar){
        int dID = dat.size();
        Log.d("status","dat length:"+dID);
        dat.add( new DownloadAsyncTask(url,fname,pBar));
        dat.get(dID).execute();
    }

    public void cancelDownload(String fname){
        for(DownloadAsyncTask da: dat){
            if(da.getName().equals(fname)){
                da.cancel(true);
            }
        }
    }

    public DownloadAsyncTask getDownloadByName(String fname){
        for(DownloadAsyncTask da: dat){
            if(da.getName().equals(fname)){
                return …
Run Code Online (Sandbox Code Playgroud)

android android-service android-asynctask

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

如何让 gettext 和 poedit 识别自定义文件类型?

我正在尝试让 Smarty 和 gettext 在我的一个项目中协同工作。目前 smarty 使用.tpl文件作为其模板系统。
我使用 PoEdit 创建目录文件,并且在 PHP 下的文件扩展名中添加了“*.tpl”,但是当我尝试扫描 gettext 字符串时,出现以下错误并且无法找到我的字符串:

xgettext:警告:文件../libs/smarty/debug.tpl' extensiontpl' 未知;将尝试 C
xgettext:警告:文件../template/login.tpl' extensiontpl' 未知;将尝试 C
xgettext:警告:文件../template/index.tpl' extensiontpl' 未知;将尝试 C

那么我怎样才能让它工作?

php smarty gettext poedit

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

OkHttp上传进度与实际上传不同步

我正在尝试使用OkHttp跟踪上传的进度.我创建了一个RequestBody带有以下主体的自定义(由此答案提供),它写入接收器并发布进度.

public class CountingFileRequestBody extends RequestBody {
    private static final String TAG = "CountingFileRequestBody";

    private final ProgressListener listener;
    private final String key;
    private final MultipartBody multipartBody;
    protected CountingSink mCountingSink;

    public CountingFileRequestBody(MultipartBody multipartBody,
                                   String key,
                                   ProgressListener listener) {
        this.multipartBody = multipartBody;
        this.listener = listener;
        this.key = key;
    }

    @Override
    public long contentLength() throws IOException {
        return multipartBody.contentLength();
    }

    @Override
    public MediaType contentType() {
        return multipartBody.contentType();
    }

    @Override
    public void writeTo(BufferedSink sink) throws IOException {
        mCountingSink = new …
Run Code Online (Sandbox Code Playgroud)

android file-upload okhttp3

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

无法为 Android 构建 ffmpeg

我正在尝试使用两种不同的方法为 Android 构建 ffmpeg 源:

  1. https://yesimroy.gitbooks.io/android-note/content/compile_ffmpeg_for_android.html
  2. https://github.com/Khang-NT/ffmpeg-binary-android

这里的问题是,我在这两种方法中都面临着一些类似的问题,所以我想问题不在于这些脚本,而是我的环境中出现了一些问题。以下是两个构建脚本的输出:

对于方法#1:

/home/hamed/dev/android-tools/android-sdk-linux/ndk-bundle/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-gcc is unable to create an executable file.
C compiler test failed.

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "conflog.txt" produced by configure as this will help
solve the problem.
Makefile:2: ffbuild/config.mak: No such file or directory
Makefile:40: /tools/Makefile: …
Run Code Online (Sandbox Code Playgroud)

android ffmpeg android-ndk

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