我刚刚将我的android工作室从1.5升级到2.0.现在,当我尝试启动模拟器时,我面临一些奇怪的错误.我使用的是Ubuntu 15.10操作系统
Android监视器返回此消息
sh: 1: glxinfo: not found
sh: 1: glxinfo: not found
libGL error: unable to load driver: r600_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: r600
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 155 (GLX)
Minor opcode of failed request: 24 (X_GLXCreateNewContext)
Value in failed request: 0x0
Serial number …Run Code Online (Sandbox Code Playgroud) 我正在学习如何使用ajax和Flask,所以我做的是发送一个ajax请求,我post在python文件中接收数据作为请求
My html file contains this code
var data = {"name":"John Doe","age":"21"};
$.ajax({
url:'/post/data',
datatype : "json",
contentType: "application/json; charset=utf-8",
data : JSON.stringify(data),
success : function(result) {
jQuery("#clash").html(result);
},error : function(result){
console.log(result);
}
});
Run Code Online (Sandbox Code Playgroud)
我的python文件包含:
@app.route('/post/data',methods=['GET','POST'])
def postdata():
#do some
data = str(request.args)
json_dumps = json.dumps(data)
return json_dumps
Run Code Online (Sandbox Code Playgroud)
这为我提供了页面上的以下数据
"ImmutableMultiDict([('{\"name\":\"John Doe\",\"age\":\"21\"}', u'')])"
Run Code Online (Sandbox Code Playgroud)
这就是我的request.query_string样子{%22name%22:%22John%20Doe%22,%22age%22:%2221%22}
那我怎么得到name和age.如果我在任何地方都错了,请纠正我.谢谢.
我使用pytesseractlib从图像中提取文本.当我在localhost上运行代码时,这工作正常.但是当我在openshift上部署时,会给我上面的错误.
下面是我到目前为止所编写的代码.
try:
import Image
except ImportError:
from PIL import Image
import pytesseract
filePath = PATH_WHERE_FILE_IS_LOCATED # '/var/lib/openshift/555.../app-root/data/data/y.jpg'
text = pytesseract.image_to_string(Image.open(filePath)) # this line produces error
Run Code Online (Sandbox Code Playgroud)
以上错误的追溯是
>>> pytesseract.image_to_string(Image.open(filePath))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/var/lib/openshift/56faaee42d527151d5000089/app- root/runtime/repo/pytesseract/pytesseract.py", line 132, in image_to_string
boxes=boxes)
File "/var/lib/openshift/56faaee42d527151d5000089/app-root/runtime/repo/pytesseract/pytesseract.py", line 73, in run_tesseract
stderr=subprocess.PIPE)
File "/opt/rh/python27/root/usr/lib64/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/opt/rh/python27/root/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or …Run Code Online (Sandbox Code Playgroud) 我想从服务器端向客户端发送图像文件.我正在使用flask框架.
但问题是每当我调用路径时send_file(),响应返回是一个文件.当我单击此文件gedit时,在该文件中没有任何内容打开它.这意味着它必须是文本文件.
我提到了烧瓶文档send_file().
以下是我在代码中所做的事情:
@app.route('/try')
def trial():
todown = 'https://igcdn-photos-e-a.akamaihd.net//hphotos-ak-xaf1//t51.2885-15//e35//12093691_1082288621781484_1524190206_n.jpg'
resp = requests.get(todown)
return send_file(resp,mimetype="image/jpeg",attachment_filename="img.jpg",as_attachment=True)
Run Code Online (Sandbox Code Playgroud)
每当我加载localhost:5000/try文件时下载但不下载我要下载的图像文件.
我在终端上的错误是AttributeError: 'Response' object has no attribute 'read' error.
一定是什么问题.以上片段中是否缺少任何内容?
我输出的单词和char的数量一直给我零.如果有人能帮助我在我的代码中找到错误的错误.星星包围的代码是我们老师给出的代码,我们需要将它放在我们的程序中.
谢谢!
**我们的老师告诉我们不要使用缓冲方法.此外,如果我更改lineNum方法,它仍会覆盖其他方法吗?部分任务是在我们的程序中使用至少两种方法****
**我根据每个人的建议编辑了我的代码**现在正在打印正确的数字!我怎样才能在其中实现我的两种方法?一个建议是我为wordCount方法使用for循环. 我还需要帮助计算段落数量 一个很好的起点?
import java.util.*;
import java.io.*;
public class WordStats1 {
public static void main(String[] args) {
try {
Scanner input = new Scanner(new FileReader("data.txt"));
//int totalLines = lineNum(input);
//int wordCount = wordCount(input);
//int countChar = countChar(input);
PrintWriter output = new PrintWriter(new FileOutputStream(
"newfile.txt"));
int lineNum = 0;
int wordCount = 1;
int charCount = 0;
while (input.hasNextLine()) {
String line;
line = input.nextLine();
//output.println(lineNum + ": " + line);
lineNum++;
String str [] = line.split((" ")); …Run Code Online (Sandbox Code Playgroud) 我有一个问题,Jinja2没有'fa fa-tachometer'正确地将字符串渲染到类名.
Jinja2呈现如下字符串:
<i class={{ icon }}></i>
成
<i class="fa" fa-tachometer></i>,
如下图所示.我已经完成了空间文字,但它并没有解决我的问题.
{% set navigation_bar = [
('/dashboard', 'dashboard', 'fa fa-tachometer', 'Dashboard')
] -%}
{% set active_page = active_page|default('dashboard') -%}
{# For each of the sidebar nav items, render an <li> #}
{% for href, id, icon, title in navigation_bar %}
{{ icon }}
<li {% if id == active_page %} class="active" {% endif %}>
<a href="{{ href|e }}">
<i class={{ icon }}></i>
<span class="nav-label">{{ title|e }}</span> …Run Code Online (Sandbox Code Playgroud) 从采摘过了一段时间TimePicker,我展示,使用setText(),但是,到目前为止一切正常,但问题是,如果让我选择05:09,我只得到显示5:9 PM在TextView.我想念前面的零.但我需要这个
这是我使用的代码:
public void onTimeSet(TimePicker timePicker,int selectedHour, int selectedMinute)
{
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, selectedHour);
calendar.set(Calendar.MINUTE, selectedMinute);
int c_hour,c_min;
String format;
c_hour=selectedHour;
c_min=selectedMinute;
if (c_hour == 0) {
c_hour += 12;
format = "AM";
}
else if (c_hour == 12) {
format = "PM";
}
else if (c_hour > 12) {
c_hour -= 12;
format = "PM";
}
else {
format = "AM";
}
TextView dimple = (TextView)findViewById(R.id.timeText); …Run Code Online (Sandbox Code Playgroud)