小编Ral*_*rix的帖子

如何向Appengine的webapp框架添加中间件?

我正在使用appengine webapp框架(链接).是否可以添加Django中间件?我找不到任何例子.我正在尝试让FirePython中间件工作(链接).

python django google-app-engine middleware django-middleware

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

在C中创建线程

我试图使用gcc -Wall -std = c99 hilo.c - ./a.out hilo.c运行此C程序,我收到此错误消息:

hilo.c: In function ‘func’:
hilo.c:6:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘pthread_t’ [-Wformat]
hilo.c: In function ‘main’:
hilo.c:14:3: warning: passing argument 3 of ‘pthread_create’ from incompatible pointer type [enabled by default]
/usr/include/pthread.h:225:12: note: expected ‘void * (*)(void *)’ but argument is of type ‘void (*)(void)’
hilo.c:15:3: warning: passing argument 3 of ‘pthread_create’ from incompatible pointer type [enabled by default]
/usr/include/pthread.h:225:12: note: expected ‘void * …
Run Code Online (Sandbox Code Playgroud)

c pthreads undefined-reference

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

Java 空 Optional 的类型是什么?

所以问题是我正在检查OptionalJava 类,我在public static<T> Optional<T> empty()文档中注意到了这一点:

@param <T> The type of the non-existent value*.
Run Code Online (Sandbox Code Playgroud)

而且,在查看了整个班级并搜索了这里和其他几页之后,我遇到了这个我无法回答的问题:

  1. Optional可以有特定的类型吗?1.1 如果是,如何设置?1.2 有没有办法检查它的类型?

java optional

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

在循环的输出中创建一个列表

我们的任务是以这种方式打印出Pascal三角形中的值

(pascal 2)
(1 2 1)
(pascal 0)
(1)
Run Code Online (Sandbox Code Playgroud)

我将定义为二项式的代码复制到了互联网上的某处,定义如下:

(defun choose(n k)
        (labels ((prod-enum (s e)
            (do ((i s (1+ i)) (r 1 (* i r))) ((> i e) r)))
          (fact (n) (prod-enum 1 n)))
         (/ (prod-enum (- (1+ n) k) n) (fact k))))
Run Code Online (Sandbox Code Playgroud)

现在,我试图根据我的pascal函数中的值创建一个列表:

(defun pascal (start end) 
  (do ((i start (+ i 1)))
       ((> i end) )
       (print (choose end i) ))
)
Run Code Online (Sandbox Code Playgroud)

如果使用(pascal 0 2)进行测试,该函数将产生1 2 1 NIL。如何消除NIL并创建列表?

common-lisp gnu-common-lisp

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

尝试从广播接收器启动活动

我正在尝试创建一个锁屏。当我尝试com.fira.locker.LockScreenActivity从广播接收器启动时 ,我收到一个错误。错误说:

 java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Intent android.content.Intent.setFlags(int)' on a null object reference
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

package com.fira.locker;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Environment;
import android.util.Log;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.TextView;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

/**
 * Created by Johannett321 on 10/04/16.
 */
public class LockScreenReceiver extends BroadcastReceiver {

    public String screenlockedNumber;

    @Override
    public void onReceive(Context context, Intent intent) {
        //start activity
        Intent i = new Intent();
        i.setClassName("com.fira.locker",     "com.fira.locker.LockScreenActivity");
        i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(i); …
Run Code Online (Sandbox Code Playgroud)

java android broadcastreceiver android-intent

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

Nativescript 2.2例外

使用2.2获得以下异常.

正在使用以前的版本.

"tns info"和所有内容都更新为2.2

JS: Error: Uncaught (in promise): EXCEPTION: Error in pages/listview/listview.html:12:2
JS: ORIGINAL EXCEPTION: TypeError: _this.cssClasses(...).set is not a function
JS: ORIGINAL STACKTRACE:
JS: TypeError: _this.cssClasses(...).set is not a function
JS:     at /data/data/org.nativescript.test1/files/app/tns_modules/nativescript-angular/view-util.js:254:78
JS:     at Array.forEach (native)
JS:     at ViewUtil.setClasses (/data/data/org.nativescript.test1/files/app/tns_modules/nativescript-angular/view-util.js:254:17)
JS:     at ViewUtil.setPropertyInternal (/data/data/org.nativescript.test1/files/app/tns_modules/nativescript-angular/view-util.js:189:18)
JS:     at ViewUtil.setProperty (/data/data/org.nativescript.test1/files/app/tns_modules/nativescript-angular/view-util.js:181:18)
JS:     at NativeScriptRenderer.setElementProperty (/data/data/org.nativescript.test1/files/app/tns_modules/nativescript-angular/renderer.js:141:23)
JS:     at NativeScriptRenderer.setElementAttribute (/data/data/org.nativescript.test1/files/app/tns_modules/nativescript-angular/renderer.js:145:21)
JS:     at DebugAppView._View_ListviewPage0.createInternal (ListviewPage.template.js:58:17)
JS:     at DebugAppView.AppView.create (/data/data/org.nativescript.test1/files/app/tns_modules/@angular/core/src/linker/view.js:87:21)
JS:     at DebugAppView.create (/data/data/org.nativescript.test1/files/app/tns_modules/@angular/core/src/linker/view.js:299:44)
JS: ERROR CONTEXT:
JS: [object Object]
Run Code Online (Sandbox Code Playgroud)

nativescript

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

如何在<td>标签中给出烧瓶删除方法的超链接

如何为烧瓶删除方法提供超链接.这是代码HTML代码.我用HTML编写了超链接.那么,如何在烧瓶路线中传递url.我正在使用Flask框架,我试图从数据库中删除一个条目.下面的代码给出了这个错误:"请求的URL不允许使用该方法."

{% extends "base.html" %}
{% block head %}
{{super()}}
{% endblock %}
{% block navbar %}
{{super()}}
{% endblock %}
{% block content %}
<div class="row">
<ol class="breadcrumb">
<li><a href="#">
<em class="fa fa-home"></em> </a></li>
<li class="active">Users>View/Edit</li>
</ol>
</div><!--/.row-->
<div class="row">
<div class="col-md-12">
<table class="table table-striped table-hover">

<thead>
<tr>
    <th>
        Name
    </th>
    <th>
       Email
   </th>
   <th>
       Address
   </th>
   <th>
       Aadharimage
   </th>

   <th>
       Password
   </th>
   <th>
      Locations
   </th>
   <th>
      Dateofsub
   </th>
   <th>
     Lastlogin
   </th>
   <th>
     Control
</th>
<th>
Delete
</th>
</tr> …
Run Code Online (Sandbox Code Playgroud)

html python flask flask-sqlalchemy flask-restless

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