首先,我不需要任何功能而不是上传文件.没有进度条,没有文件类型或大小检查,没有多个文件.
我想要的是最简单的HTML网页来处理上传并使用我指定的名称保存文件.
我试着用这个:
<form action="../cgi-bin/upload.py" method="post" enctype="multipart/form-data">
<input type="file" name="upload" />
<input type="submit" /></form>
Run Code Online (Sandbox Code Playgroud)
在upload.py:
#!/usr/bin/python
import os
import commands
import cgi, cgitb
cgitb.enable()
print "Content-Type: text/html"
print
print 'start!'
form = cgi.FieldStorage()
filedata = form['upload']
Run Code Online (Sandbox Code Playgroud)
但我不知道如何将其保存在文件中,如"Beautiful.mp3".
任何身体都能帮忙吗?
虽然,实际上,我不想使用任何脚本.我只想要最基本的html页面.只有在必须有一些CGI处理程序时才会存在Python脚本.Flash不是首选.
因为bool,它是8位而只有真和假,为什么它们不能使它成为单位.
而且我知道有bitset,但不是那么方便,我只是想知道为什么?
我知道存在std::set::lower_bound并且时间复杂度为O(log),并且我发现这比在 上运行时std::lower_bound慢得多。std::set::lower_boundstd::set
我用谷歌搜索并发现了这个:
http://en.cppreference.com/w/cpp/algorithm/lower_bound http://en.cppreference.com/w/cpp/iterator/advance
所以很明显,由于std::advance是线性的set::iterator,所以整体std::lower_bound需要O(n)。
然而,它的运行速度比我使用它时快得多O(n)(一些朋友也是这么说的),任何人都可以解释为什么或告诉我它不是那样的。
我创建了一个QTextBrowser显示大量数据(实际显示运行时日志),这是在另一个进程中动态生成的.
我发现我可以使用fopen("log.html","a")将数据附加到实际日志文件中,并且reload()每次更新时都会这样,但我认为这样做效率不高,甚至可能不明智.
我想知道是否有一种巧妙的方法来实现这一点.
原始代码是:
if (expression1) statement1;
else statement2;
Run Code Online (Sandbox Code Playgroud)
有可能把它变成这个吗?
expression1 ? statement1 : statement2
Run Code Online (Sandbox Code Playgroud)
还是取决于编译器?似乎这在c ++标准中有所不同?
有时情况是这样的if (expression1) statement1;,我怎么能改变它?
顺便说一句,它可以在c中完成.
使源代码不可读正是我想要做的事情
这只是其中一个步骤
error: second operand to the conditional operator is of type 'void', but the third operand is neither a throw-expression nor of type 'void'
这是我在编译时用g ++(TDM-2 mingw32)4.4.1得到的
#include <stdio.h>
void _(int __, int ___, int ____, int _____)
{
((___ / __) <= _____) ? _(__,___+_____,____,_____) : !(___ % __) ? _(__,___+_____,___ % __, _____) :
((___ % …Run Code Online (Sandbox Code Playgroud) 我的意思是,如果我有一些类:
class A{
int* pi;
};
*A pa;
Run Code Online (Sandbox Code Playgroud)
当我打电话时delete pa,会pi被删除吗?
当我要为我的应用程序编写一个子模块时,我想将所有的东西放在子文件夹中/foo,并且我给脚本命名foo.py并且在其中有一个
app = webapp2.WSGIApplication([('/foo/', Index)])
然后它来了
Fatal error when loading application configuration:
threadsafe cannot be enabled with CGI handler: foo/foo.app
in "/home/***/workspace/***/app.yaml", line 23, column 20
Run Code Online (Sandbox Code Playgroud)
然后我将其设置为false,它变为错误500
ImportError: Could not find module foo.foo.app
Run Code Online (Sandbox Code Playgroud)
我app.yaml就像
application: ***
version: alpha
runtime: python27
api_version: 1
threadsafe: false
handlers:
- url: /static
static_dir: static
- url: /admin.*
script: admin.app
login: admin
- url: /foo
script: foo/foo.app
- url: /.*
script: index.app
Run Code Online (Sandbox Code Playgroud) 就像hold on在Matlab中一样.
当我想在一张照片中画几行时,我遇到了这个问题.
线数各不相同.