使用Python的模块bottle,我在发布正文大小> bottle内部MEMFILE_MAX常量的请求时收到HTTP 413错误.最小的工作示例如下所示.
服务器部分(server.py):
from bottle import *
@post('/test')
def test():
return str(len(request.forms['foo']));
def main():
run(port=8008);
if __name__ == '__main__':
main();
Run Code Online (Sandbox Code Playgroud)
客户部分(client.py):
import requests
def main():
url = 'http://127.0.0.1:8008/test';
r = requests.post(url, data={ 'foo' : 100000 * 'a' });
print(r.text);
r = requests.post(url, data={ 'foo' : 200000 * 'a' });
print(r.text);
if __name__ == '__main__':
main();
Run Code Online (Sandbox Code Playgroud)
第一个请求打印:
100000
Run Code Online (Sandbox Code Playgroud)
第二个请求打印:
...
<body>
<h1>Error: 413 Request Entity Too Large</h1>
<p>Sorry, the requested URL …Run Code Online (Sandbox Code Playgroud) 我安装了android studio并试图运行简单的项目.
但我发现了奇怪的错误信息:
Waiting for device.
/usr/local/idea/android-studio/sdk/tools/emulator -avd Nexus-4-18-xhdpi -netspeed full -netdelay none
emulator: emulator window was out of view and was recentered
Device connected: emulator-5554
Device is online: emulator-5554
Target device: Nexus-4-18-xhdpi [emulator-5554]
Uploading file
local path: /home/nazar/Documents/coursera-android/Examples/HelloAndroid/out/production/HelloAndroid/HelloAndroid.apk
remote path: /data/local/tmp/course.examples.HelloWorld.HelloWorld
Installing course.examples.HelloWorld.HelloWorld
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/course.examples.HelloWorld.HelloWorld"
Error: Could not access the Package Manager. Is the system running?
Run Code Online (Sandbox Code Playgroud)
我无法弄清楚为什么会这样?
我安装了sdk版本并配置了模拟器.有什么建议?
这是模拟器配置:

更新:
我尝试安装Genymotion设备并使用少量虚拟设备,但抓住了:
Waiting for device.
Target device: genymotion-nexus_4___4_4_2___api_19___768x1280-192.168.56.101:5555
Uploading file
local path: /home/nazar/Documents/coursera-android/Examples/HelloAndroid/out/production/HelloAndroid/HelloAndroid.apk
remote path: …Run Code Online (Sandbox Code Playgroud) 我尝试使用Qt(4.6.3)+ MinGW编译以下代码:
#include <QtCore/QCoreApplication>
#include <exception>
int main(int argc, char *argv[])
{
throw std::runtime_error("");
QCoreApplication a(argc, argv);
return a.exec();
}
Run Code Online (Sandbox Code Playgroud)
......并得到了这个错误:
..\untitled11\main.cpp:6: error: 'runtime_error' is not a member of 'std'
Run Code Online (Sandbox Code Playgroud)
项目从头创建(控制台应用程序),专业文件:
QT += core
QT -= gui
TARGET = untitled11
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
Run Code Online (Sandbox Code Playgroud)
试图用Qt + MSVC2008编译器编译这个 - 工作正常.
这是标准的例外,不知道为什么会丢失.
我用三部手机测试我的应用程序(运行andorid版本:4.1.2 - 4.0.4 - 2.3.6).他们通过蓝牙交换数据没有问题,直到logcat中出现此错误并且手机完全关闭并重新启动.在此错误出现之前一切正常.
这是崩溃的手机上的logcat输出(运行版本4.1.2):
05-29 12:11:36.887: E/InputTransport(2947): channel '418655a8 Toast' ~ Could not create socket pair. errno=24
05-29 12:11:36.897: E/JavaBinder(2947): *** Uncaught remote exception! (Exceptions are not yet supported across processes.)
05-29 12:11:36.897: E/JavaBinder(2947): java.lang.RuntimeException: Could not open input channel pair. status=-24
05-29 12:11:36.897: E/JavaBinder(2947): at android.view.InputChannel.nativeOpenInputChannelPair(Native Method)
05-29 12:11:36.897: E/JavaBinder(2947): at android.view.InputChannel.openInputChannelPair(InputChannel.java:91)
05-29 12:11:36.897: E/JavaBinder(2947): at com.android.server.wm.WindowManagerService.addWindow(WindowManagerService.java:2295)
05-29 12:11:36.897: E/JavaBinder(2947): at com.android.server.wm.Session.add(Session.java:139)
05-29 12:11:36.897: E/JavaBinder(2947): at android.view.IWindowSession$Stub.onTransact(IWindowSession.java:70)
05-29 12:11:36.897: E/JavaBinder(2947): at com.android.server.wm.Session.onTransact(Session.java:111)
05-29 12:11:36.897: E/JavaBinder(2947): at android.os.Binder.execTransact(Binder.java:367) …Run Code Online (Sandbox Code Playgroud) 点子列表抛出一个断言错误,我不知道如何解决.这是在从源代码构建2个软件包(PyUblas-2013.1和boost_1_54_0)之后发生的.我正在使用virtualenv.
错误如下;
(virtenv)[user@xyz ~]$ pip list
beautifulsoup4 (4.2.1)
biopython (1.61)
distribute (0.6.35)
methylpy (0.1.0)
MySQL-python (1.2.4)
numpy (1.7.1)
pip (1.4)
py (1.4.15)
pytest (2.3.5)
PyUblas (2013.1)
Exception:
Traceback (most recent call last):
File "/home/user/virtenv/lib/python2.7/site-packages/pip/basecommand.py", line 134, in main
status = self.run(options, args)
File "/home/user/virtenv/lib/python2.7/site-packages/pip/commands/list.py", line 80, in run
self.run_listing(options)
File "/home/user/virtenv/lib/python2.7/site-packages/pip/commands/list.py", line 127, in run_listing
self.output_package_listing(installed_packages)
File "/home/user/virtenv/lib/python2.7/site-packages/pip/commands/list.py", line 136, in output_package_listing
if dist_is_editable(dist):
File "/home/user/virtenv/lib/python2.7/site-packages/pip/util.py", line 347, in dist_is_editable
req = FrozenRequirement.from_dist(dist, [])
File "/home/user/virtenv/lib/python2.7/site-packages/pip/__init__.py", line 194, in from_dist …Run Code Online (Sandbox Code Playgroud) 当我初始化下面的数组时,所有输出看起来都没问题,除了values[3].出于某种原因,values[3]初始化为values[0]+values[5]输出非常大的数字.我的猜测是,我在尝试分配values[0]+values[5]之前将它们妥善存储在内存中,但是如果有人能够解释那将是很好的.
int main (void)
{
int values[10] = {
[0]=197,[2]=-100,[5]=350,
[3]=values[0] + values[5],
[9]= values[5]/10
};
int index;
for (index=0; index<10; index++)
printf("values[%i] = %i\n", index, values[index]);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
输出如下:
values[0] = 197
values[1] = 0
values[2] = -100
values[3] = -1217411959
values[4] = 0
values[5] = 350
values[6] = 0
values[7] = 0
values[8] = 0
values[9] = 35
Run Code Online (Sandbox Code Playgroud) c arrays runtime-error designated-initializer unspecified-behavior
在Android Studio中开发Android应用时,while循环中使用的变量的值不正确.我在测试用例中将它减少到一个非常简单的情况:
方法onStart:
@Override
public void onStart() {
super.onStart();
int count = 2;
int index = 1;
int value = 23;
Log.i("test", "value before = " + value);
while (index < count) {
Log.i("test", "value in while loop = " + value);
index++;
value = 0;
}
}
Run Code Online (Sandbox Code Playgroud)
执行测试应用程序时的输出是:
value before = 23
value in while loop = 0
Run Code Online (Sandbox Code Playgroud)
而结果应该是
value in while loop = 23
Run Code Online (Sandbox Code Playgroud)
在调试时,结果如预期的那样('while while = 23'中的值),但在常规的调试版本中,它是错误的.主活动类的反汇编代码看起来没问题,变量'value'的值在while循环体的末尾设置为0.当while循环体中的某些代码或函数使用变量'value'时,它将具有值0而不是23.在测试用例中,我使用Log语句来简化.
当我改变线路时,它不会出错
value = 0;
Run Code Online (Sandbox Code Playgroud)
至
if (value …Run Code Online (Sandbox Code Playgroud) 我已经使用下面的代码打开一个SQLite数据库文件,该文件几乎每天都在网络计算机上运行一年多.突然今天早上,我无法以编程方式打开文件.
private Boolean Connect(String strPathFile)
{
// Initialize the connection object.
this.DbConnection = null;
try
{
// DATABASE: Create the connection string and set the settings.
String strConnection = @"Data Source=" + strPathFile + @";Version=3;";
// DATABASE: Connect to the database.
this.DbConnection = new SQLiteConnection(strConnection);
this.DbConnection.Open();
return true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
该文件是"\ Server\ShareName\FileName.db"形式的网络资源(少于双引号).
这是有趣的事情.SQLite管理员无需重复打开网络数据库文件,没有问题.我也可以在本地打开文件.我将文件复制到本地驱动器,只是更改了Visual Studio 2012(VS2012)中的路径.
服务器似乎很好.自从我最后一次检查它以来,它已经在某个时刻重新启动了.我推测Microsoft Update.文件资源管理器浏览文件夹没有问题,正如我所说,SQLite管理员可以打开网络文件.
我再次检查了权限,每个人都有完全控制权,服务器的用户也可以完全控制安全权限和共享权限.我检查了文件夹和文件,权限是一样的.我同样期待,因为SQLite管理员可以打开该文件.服务器没有设置防火墙,Windows防火墙或其他.我今天早上也重新检查了一下.同样,SQLite管理员会抱怨这一点.
我通过使用文件资源管理器在网络驱动器上制作文件的副本来验证写入.这没有问题.
服务器是Windows Server 2003.我使用的是Windows 7 Professional 64位.
我也试图以只读模式打开数据库,但也失败了.我期待那种行为.SQLite Administrator仍然可以很好地工作.
我尝试了各种其他连接字符串,包括SQLiteConnectionStringBuilder()只是为了看看会发生什么,所有的道路都通向罗马,即:
System.Data.SQLite.SQLiteException occurred
HResult=-2147467259
Message=unable …Run Code Online (Sandbox Code Playgroud) 我最近在scala并尝试传递一些简单的scala工作表.
IDE是Intellij IDEA社区版和OS Ubuntu 12.04,sbt安装正确.
但它会引发错误 - error: not found: value
OI无法理解为什么会这样:
码:
object session {
1 + 2
def abs(x: Double) = if (x < 0) -x else x <== update this line
def sqrtIter(guess: Double, x: Double): Double =
if (isGoodEnough(guess, x)) guess
else sqrtIter(improve(guess, x), x)
def isGoodEnough(guess: Double, x: Double) =
abs(guess * guess - x) < 0.001
def improve(guess: Double, x: Double) =
(guess + x / guess) / 2
def sqrt(x: Double) …Run Code Online (Sandbox Code Playgroud) 我正在使用bootstrap3-datetimepicker-rails gem让用户在我的应用程序中存储scheduled_datea WorkOrder('DateTime'属性),但是argument out of range当用户提交表单来创建时,我收到错误WorkOrder,日期是与用户弹出打开编辑屏幕时选择的内容非常不同.有趣的是它曾经工作,但我不知道什么代码可以改变来打破它.
我添加了所需的依赖项并在我的CSS/JS文件中包含了正确的指令:
gem 'momentjs-rails', '~> 2.5.0'
gem 'bootstrap3-datetimepicker-rails', '~> 3.0.0'
Run Code Online (Sandbox Code Playgroud)
据我所知,我的代码看起来与文档中的示例相同.这是我的表格的片段:
<div class="row">
<div class="col-md-4">
<div class="form-group">
<%= f.label :scheduled_date %>
<div class='input-group date'>
<span class="input-group-addon"><span class="fa fa-calendar"></span></span>
<%= f.text_field :scheduled_date, class: 'form-control input-lg', id: "service_date_picker" %>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(function () {
$('#service_date_picker').datetimepicker({
icons: {
time: "fa fa-clock-o",
date: "fa fa-calendar",
up: "fa fa-arrow-up",
down: "fa fa-arrow-down"
}
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
编辑(忘了添加控制器代码 - …
ruby datetime runtime-error ruby-on-rails twitter-bootstrap-3