小编TMo*_*aes的帖子

Android:错误上传图像在不同的Android版本

我在不同的Android版本上传图像有问题.我需要为php服务器发送图像,所以我使用的是webservice.我测试了版本Froyo e Jelly Beans,它们可以工作,但KitKat不起作用.我正在阅读MediaStore,我看到了不同的方式,如果我的对与错,我不会.

我重新编写了我的项目,我可以看到,在KitKat中,路径为NULL,Logcat在KitKat中告诉我"Java Null Pointer".我怎样才能使应用程序适用于所有版本.

UploadImage.java

package br.gov.rj.barraemexposicao;

import android.app.ProgressDialog;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.provider.MediaStore;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;


public class EnviaFoto extends ActionBarActivity {

    final int PICK_FILE_RESULT_CODE = 1;
    final int CAMERA_IMAGE =2;

    TextView messageText;
    Button uploadButton;
    Button btnTiraFoto;
    Button selectImage;
    ImageView imgFoto;

    int …
Run Code Online (Sandbox Code Playgroud)

java android web-services

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

CakePHP 3 - 比较密码

我有两个字段"密码"(此字段在数据库中)和confirm_password(此字段不在数据库中)

好吧,我需要比较密码== confirm_password ..但我不知道为"confirm_password"创建自定义验证...需要在数据库中有这个字段吗?

我该怎么办?

php cakephp cakephp-3.0

7
推荐指数
2
解决办法
7283
查看次数

Python virtualenv:系统找不到指定的路径

在本教程virtualenv之后,我收到以下消息:

C:\Users\Dev\Desktop>mkvirtualenv AndroidKivy
C:\Users\Dev\Envs is not a directory, creating
Running virtualenv with interpreter C:/Python27/python.exe
Overwriting C:\Users\Dev\Envs\AndroidKivy\lib\orig-prefix.txt with new content
New python executable in C:\Users\Dev\Envs\AndroidKivy\Scripts\python.exe
Installing setuptools, pip, wheel...done.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
Run Code Online (Sandbox Code Playgroud)

我读到此mkvirtualenv 结果错误:系统找不到指定的路径并使用命令where python.exe。我的 PATH 中只有一个 python.exe 运行时,所以一开始我的问题不适合它。

C:\Python27\python.exe
Run Code Online (Sandbox Code Playgroud)

再次,发现了Stackoverflow这个话题。即使这样执行mkvirtualenv -p C:/Python27/python.exe AndroidKivy我也会收到同样的错误。

画中画列表

pip (9.0.1)
setuptools (28.8.0)
virtualenv (15.2.0)
virtualenvwrapper-win …
Run Code Online (Sandbox Code Playgroud)

windows virtualenv python-2.7

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

CakePHP 3-创建hiddenField

根据文档

http://book.cakephp.org/3.0/en/views/helpers/form.html#options-for-select-checkbox-and-radio-inputs

我使用“ HiddenField”创建值为0的隐藏输入。

 echo $this->Form->Label("Stats ");            
                echo $this->Form->checkbox('stats', [
                                'value' => '1',
                                'hiddenField' => '0',
                            ]);
Run Code Online (Sandbox Code Playgroud)

我的HTML(没有隐藏字段)应为:

<input type="checkbox" name="stats" value="1" required="required">
Run Code Online (Sandbox Code Playgroud)

我昨天做了,但是今天不起作用,我还没有更新蛋糕的版本。。没什么,疯狂的:\

php cakephp cakephp-3.0

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

Python:setup.py Egg_info 失败,错误代码为 1

我已经将 Python 2.7.x 更新到 3.6,但当我尝试安装任何软件包时仍然收到此消息。示例:Flask、Kivy..

命令“python setup.py Egg_info”失败,错误代码为 1,位于 C:\Users\Dev\AppData\Local\Temp\pip-install-1_cikdf6\itsdangerous\

System Information:

Windows 10
Python 3.6.5
pip        10.0.1
setuptools 39.0.1
wheel      0.31.0
Run Code Online (Sandbox Code Playgroud)

安装命令:python -m pip install 'package-name' 以管理员权限运行

更新

运行后,pip install ez_setup我等了 30 多分钟,它开始闪烁白色空间,就像它在等待完成某件事一样。

在此输入图像描述

python

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

CakePHP 3 - 更改密码

我现在开始学习cakephp 3,他是测试版,所以你的手册还没有完成..

我需要更改用户的密码,但它触发了 Flash 错误。调试变量 $user 只显示“需要的字段”,但所有表的字段的值为 NULL。

我的代码:

 //Create a new Entity
 $user = $this->Users->newEntity();
                    // Set new password and user's id... I'm not doing with session yet, ok?
                    $user = $this->Users->patchEntity($user, ['password' => $this->request->data['new-password'], 'id' => 2]);
                    debug($user->errors());
                    if ($this->Users->save($user)) {
                        $this->Flash->success('Its Right');
                    } else {
                        $this->Flash->error('FAIL');
                    }
Run Code Online (Sandbox Code Playgroud)

Debuggin $user是user表的字段。

[
    'gym_id' => [
        (int) 0 => 'This field is required'
    ],
    'role_id' => [
        (int) 0 => 'This field is required'
    ],
    'name' => [
        (int) …
Run Code Online (Sandbox Code Playgroud)

php validation cakephp cakephp-3.0

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

詹金斯:获取远程存储库“来源”时出错

我是新的 Jenkins 用户,收到以下错误ERROR: Error fetching remote repo 'origin',我在 Stack 上阅读了一些关于此错误的帖子,其中一些说有关“容量磁盘” /tmp,其他人说有关工作区默认值,但没有一个能帮助我解决那。

ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://github.com/not-show-my-url.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:996)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1237)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1297)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:125)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress -- https://github.com/thiagolmoraes/Mobile-Contrato.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/not-show-my-url.git'
Run Code Online (Sandbox Code Playgroud)

有趣的是,如果我使用 Freestyle 项目,使用与上面在 …

git jenkins jenkins-pipeline

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

使用 Vue.JS 中的命名最佳实践,我应该使用“template”还是“view”?

I\xe2\x80\x99m 整理我的 VueJS 项目文件夹。哪个是更好的选择,templates或者view?那是,

\n
/src\n- /templates\n  - Home.vue\n  - Login.vue\n  - /users\n    - User.vue\n
Run Code Online (Sandbox Code Playgroud)\n

或者

\n
/src\n- /view\n  - Home.vue\n  - Login.vue\n  - /users\n    - User.vue\n
Run Code Online (Sandbox Code Playgroud)\n

directory-structure naming-conventions vue.js

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

Cakephp:加载背景图像CSS

我没有在我的页面上加载背景图像。它位于“app/webroot/img/background.png”内

style.css - 它正在工作..我只是无法加载我的图像

.layout{
    width: 100%;
    height: 230px;  
    position: relative;
    margin: auto;
    background-image:('../img/background.png');
}

.layout-image{
    width: 940px;
    height: 230px;
    position: relative;
    margin: auto;
}
Run Code Online (Sandbox Code Playgroud)

索引.php

<div class="layout">
      <div class="layout-image">
          <img src="img/layout.png" alt="">
      </div>
    </div>
Run Code Online (Sandbox Code Playgroud)

webroot/.htacces

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)

html css php mod-rewrite cakephp

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

CakePHP 3 - 如何在验证NotEmpty之前使用Trim()?

我的表单验证空字段,但如果用户使用"空格",验证处理一个字符如何...如何在模型表中使用Trim()它不会发生?

php validation cakephp cakephp-3.0

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

Python:将 SELECT 查询列表转换为字典

尝试将此 SELECT 查询转换为 dict,因为我有重复的名称。

def getcity():
 conn = databaseConnection()
 cur = conn.cursor()
 conn.set_client_encoding('LATIN1')
 cur.execute("SELECT codcity, name FROM cities")
 rows = cur.fetchall()
 cities= [dict(row) for row in rows]  
 return cities 
Run Code Online (Sandbox Code Playgroud)

结果:TypeError: cannot convert dictionary update sequence element #0 to a sequence

重复的例子:

Id - 132 | Name: New York
Id - 24 | Name: NEW York
Run Code Online (Sandbox Code Playgroud)

我不确定,但使用 dict 是处理重复情况的最佳方法。我想要的最终结果:

'New York': { 
'id-1': 132,
'id-2': 24 }
Run Code Online (Sandbox Code Playgroud)

打印(行[0])

(338, u'')
None
Run Code Online (Sandbox Code Playgroud)

更新:输出(稍微改变行):

<type 'list'>
[(u'Jam', [314]),
 (u'Arthur Cat', [527]),
 (u'Bel', …
Run Code Online (Sandbox Code Playgroud)

python sql postgresql dictionary

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