小编gur*_*e94的帖子

React native - 连接没有连接处理程序错误含义?

我创建了一个新的反应项目,当我在iOS上从xcode运行它时,控制台给了我:

2017-05-19 23:25:34.119 [info][tid:main][RCTBatchedBridge.m:77] Initializing <RCTBatchedBridge: 0x6100001a6c80> (parent: <RCTBridge: 0x6100000c46e0>, executor: RCTJSCExecutor)
2017-05-19 23:25:51.287 [info][tid:main][RCTRootView.m:295] Running application test ({
    initialProps =     {
    };
    rootTag = 1;
})
2017-05-19 23:25:51.289 [info][tid:com.facebook.react.JavaScript] Running application "test" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
2017-05-19 23:25:51.299771-0400 test[21948:1121429] [] nw_connection_get_connected_socket_block_invoke 3 Connection has no connected handler
2017-05-19 23:25:53.335282-0400 test[21948:1121426] [] nw_connection_get_connected_socket_block_invoke 4 Connection has no connected handler
2017-05-19 23:25:55.349190-0400 test[21948:1120112] [] nw_connection_get_connected_socket_block_invoke 5 Connection has no connected handler …
Run Code Online (Sandbox Code Playgroud)

connection ios react-native

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

如何使用像scanf这样的函数使用int16_t或int32_t

我理解int16_tint32_t在C中的方式是它们在您的计算机上分别被命名为16位和32位数字.我相信当你需要保证数字为16或32位时你会使用这些,因为不同的系统并不总是代表int32位或short16位(这个假设是正确的吗?当我在网上看时,我找到了混合的答案.) .

我的问题是当我要求它们实际上是16位或32位或其他什么时,我将如何使用一个函数scanf来获取来自具有int16_t或者int32_t或任何其他类型定义数字类型的用户的输入?有某种特殊的字符串修饰符吗?通常情况下,如果我想int从一个用户那里得到一个没有关心它实际表示多大的用户,我会写这样的东西

scanf("%d", &int);
Run Code Online (Sandbox Code Playgroud)

这是有效的,如果我传入一个,int32_t但我认为它只是因为int我的系统是32位,它没有特别给我一个32位数,而只是给了我一个int.我如何获得保证为32位的数字?我查看了这个字符串修饰符和其他一些地方的页面,但没有提到这些类型定义的数字类型.

编辑:自从收到我的问题的答案后,我做了一些谷歌搜索并找到了这个.我将它包括在下面以供参考.

uppercase hexadecimal printf format for uintptr_t

#define SCNd16   "d"
decimal scanf format for int16_t

#define SCNd32   "ld"
decimal scanf format for int32_t

#define SCNd8   "hhd"
decimal scanf format for int8_t

#define SCNdFAST16   "d"
decimal scanf format for int_fast16_t

#define SCNdFAST32   "ld"
decimal scanf format …
Run Code Online (Sandbox Code Playgroud)

c user-input scanf

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

Django让我安装pytz,现在我的模型不会验证Django

在测试我刚刚设置的项目时,我遇到了这个错误

Exception Type: ImproperlyConfigured
Exception Value:    
This query requires pytz, but it isn't installed.
Run Code Online (Sandbox Code Playgroud)

经过一番谷歌搜索后,我发现我得到了这个,因为在我指定的设置中

USE_TZ = True
Run Code Online (Sandbox Code Playgroud)

我相信它应该让我的项目时区意识到.

所以我跑了一个sudo pip install pytz安装pytz所以我不会得到这个错误.问题是,现在,安装了pytz后,我的模型将无法在我尝试时验证,./manage.py runserver并且我收到此错误

Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/user/.virtualenvs/app/lib/python3.4/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/Users/user/.virtualenvs/app/lib/python3.4/site-packages/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "/Users/user/.virtualenvs/app/lib/python3.4/site-packages/django/__init__.py", line 18, in setup
    from django.utils.log import configure_logging
  File "/Users/user/.virtualenvs/app/lib/python3.4/site-packages/django/utils/log.py", line 10, in <module>
    from django.views.debug import ExceptionReporter, get_exception_reporter_filter
  File "/Users/user/.virtualenvs/app/lib/python3.4/site-packages/django/views/debug.py", line 10, in …
Run Code Online (Sandbox Code Playgroud)

python django model pytz

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

View.isActivated() 的作用是什么?

我最近遇到了这个View.isActivated()方法,但不确定它的作用。文档

公共布尔 isActivated ()

指示该视图的激活状态。

如果视图被激活则返回 true,否则返回 false

视图的状态是什么意思?视图什么时候被激活,什么时候不激活?

android view

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

节点找不到模块,但是它存在于node_modules中?

在过去的一天中,我一直在与node一起玩,遇到了一个问题,我非常感谢您的帮助。

我创建了一个新项目,并尝试使用通过npm安装的模块,该模块按预期方式存在于node_modules目录中,并且该命令运行时没有错误,但是node找不到它并抛出错误(我尝试了多个软件包结果相同)。以下说明了我所做的事情:

我使用创建了一个新项目,npm init并完成了指导性的package.json创建。然后,我创建了一个包含此行代码的javascript文件。

const k = require('korbit-node');

并使用安装了模块,npm install korbit-node然后尝试使用node index.js(我称为js文件)在本地运行该模块,并收到此错误。

$ node index.js

module.js:472
    throw err;
    ^

Error: Cannot find module 'korbit-node'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/gabe/Desktop/js_sandbox/index.js:1:73)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
Run Code Online (Sandbox Code Playgroud)

对我来说,这似乎是一条相当简单的错误消息,告诉我未安装该软件包。但是我的项目结构如下所示:

??? index.js
??? node_modules
?   ??? debug
?   ?   ??? CHANGELOG.md
?   ?   ??? LICENSE
?   ? …
Run Code Online (Sandbox Code Playgroud)

javascript module node.js

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

使用 Tkinter 时出现单选按钮错误

我正在尝试使用 tkinter 获得一个带有一些单选按钮的基本 GUI,但是我在创建单选按钮时遇到了一些问题。

import Tkinter as tk   # python
...
def createView(self):
        label = tk.Label(self, text="Choose mode analysis", font=TITLE_FONT)
        label.pack(side="top", fill="x", pady=10)

        form_analysis = tk.BooleanVar()

        # form_analysis_radioButton = tk.RadioButton(self, text="Form Analysis")
                                    # variable=form_analysis, value=True)
        # match_analysis_radioButton = tk.RadioButton(self, text="Match Analysis",
        #                                             variable=form_analysis,
        #                                             value=False)
        # form_analysis_radioButton.pack()
        # match_analysis_radioButton.pack()
Run Code Online (Sandbox Code Playgroud)

抛出此错误文件“gui_test.py”,第 72 行,在 createView 中

    form_analysis_radioButton = tk.RadioButton(self, text="Form Analysis")
AttributeError: 'module' object has no attribute 'RadioButton'
Run Code Online (Sandbox Code Playgroud)

这似乎告诉我 tk 模块中没有 RadioButton 函数(虽然不知道为什么它说“module”而不是“tkinter”),所以我检查了命令行并得到了这个

In [2]: import Tkinter as tk

In [3]: tk.RadioButton() …
Run Code Online (Sandbox Code Playgroud)

python user-interface tkinter radio-button

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

我的switch语句出了什么问题?

我有这段代码给我带来了一些麻烦:

switch(errorNum){
case 404:

    //Send back a 404 error
    char outputBuf[MAXREQUESTLENGTH];
    int outputLength = sprintf(outputBuf, "%s/r/n/r/n%s/r/n", "HTTP/1.0 404 Not Found","<html><body><h1>404 Page Not Found</h1></body></html>");
    char output[outputLength + 1];
    if(strcpy(output, outputBuf) == NULL){
    die("strcpy error");
    }
    if(send(socketFD, output, outputLength, 0) != outputLength){
    die("send error");
    }       
    break;
Run Code Online (Sandbox Code Playgroud)

当我使用这段代码编译我的程序时,我收到这些错误,

http-server.c: In function 'returnError':
http-server.c:28:6: error: a label can only be part of a statement and a declaration is not a statement
http-server.c:29:6: error: expected expression before 'int'
http-server.c:30:18: error: 'outputLength' undeclared (first use in …
Run Code Online (Sandbox Code Playgroud)

c compiler-errors switch-statement

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

Java中的继承和私有变量

我正在尝试在android中的Chronometer类中添加一个方法.它将开始时间存储在此变量中:

private long mBase;
Run Code Online (Sandbox Code Playgroud)

所以我以为我能做到这一点

public class MyChronometer extends Chronometer{

    public void reset(){
        long now = SystemClock.elapsedRealtime();
        this.mBase = now;
    }
}
Run Code Online (Sandbox Code Playgroud)

但Android Studio告诉我mBase无法找到.为什么是这样?我做错了什么?根据我对Java中继承的理解,如果我扩展一个类,那么我将扩展我扩展的类的所有方法和变量,然后我可以添加它.这是不正确的?mBase即使它是私有的,这也不包括变量吗?

编辑:基本上我正在尝试为其创建一个setter函数 mBase

java inheritance android private chronometer

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

nullPointException ...但是我初始化了变量(或者至少我认为)

当我第一次运行这段代码时它工作得很好,但在用几个不同的测试值测试后,我开始得到nullPointerException,现在无论我给出什么值,它都不起作用.我在网上浏览了一下,如果我正确理解了JavaDoc,当你尝试在一个尚未初始化的变量上调用方法时,你会得到一个NullPointerException.这意味着BestCustomer对象没有被初始化但我无法弄清楚为什么这是因为它在我调用getWho方法之前在for循环中初始化并且如果arrayList中没有对象(意味着什么都没有被初始化 - 或者至少我认为它确实如此)我不称之为方法.为什么我得到nullPoiterException?

package hwk4;

import java.util.ArrayList;

public class Store {
    ArrayList<Customer> database = new ArrayList<Customer>();
    Customer person, bestCustomer;
    int totalSales;

    public void addSale(String customerName, double amount) {

        Customer sale = new Customer(customerName, amount);
        database.add(sale);
    }

    public String nameOfBestCustomer() {

        if (database.isEmpty()) {
            return "You have made 0 sales today.";
        } else {
            double largest = database.get(0).getAmt();
            for (int count = 1; count < database.size(); count++) {
                if (database.get(count).getAmt() > largest) {
                    largest = database.get(count).getAmt();
                    bestCustomer = database.get(count);

                }
                // …
Run Code Online (Sandbox Code Playgroud)

java arraylist nullpointerexception

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