小编Jua*_*uan的帖子

清单合并失败:uses-sdk:minSdkVersion 1不能小于版本7

我正在使用Parse学习这个构建简单聊天客户端,我正在使用gradle 2.4来构建我的项目.我的build.gradle和AndroidManifest.xml代码是:

的build.gradle

 buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.3'
    }
 }

 apply plugin: 'com.android.application'

 android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"
 }


 repositories {
    jcenter()
 }


 dependencies {
    compile fileTree(dir: 'libs', include: 'Parse-*.jar')
    compile 'com.parse.bolts:bolts-android:1.+'
 }

 dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile 'com.android.support:support-v4:21.0.0'
    compile 'com.android.support:appcompat-v7:21.0.0+'    
    compile 'com.squareup.picasso:picasso:2.5.0'
 }
Run Code Online (Sandbox Code Playgroud)

AndroidManifest.xml中

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application android:label="@string/app_name" 
android:name="main.java.org.hello.ChatApplication">
    <activity
        android:name=".ChatActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" /> …
Run Code Online (Sandbox Code Playgroud)

android gradle build.gradle android-gradle-plugin

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

检查上三角矩阵或下三角矩阵

有没有办法,使用numpy或scipy来检查矩阵是低三角矩阵还是上三角矩阵?我知道如何制作一个功能来检查这个; 但我想知道这些模块本身是否有自己的功能.我在文档中搜索,但我没有找到任何东西.

python numpy scipy

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

传递的对象的弹性搜索数必须是偶数

我正在学习弹性搜索,我正在学习下一个教程,但是我得到了下一个错误

Exception in thread "main" java.lang.IllegalArgumentException: The number of object passed must be even but was [1]
at  org.elasticsearch.action.index.IndexRequest.source(IndexRequest.java:451)
at elastic.elasti.App.lambda$0(App.java:55)
at java.util.ArrayList.forEach(ArrayList.java:1249)
at elastic.elasti.App.indexExampleData(App.java:53)
at elastic.elasti.App.main(App.java:45)
Run Code Online (Sandbox Code Playgroud)

你能帮我解决一下吗?

public class App 
{
    public static void main( String[] args ) throws TwitterException, UnknownHostException
    {
    System.out.println( "Hello World!" );
    List tweetJsonList = searchForTweets();

    Client client = TransportClient.builder().build()
            .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));
    String index = "tweets_juan";
    client.admin().indices()
                    .create(new CreateIndexRequest(index))
                    .actionGet();
    indexExampleData(client, tweetJsonList, index);
    searchExample(client);
}
public static void indexExampleData(Client client, List tweetJsonList, …
Run Code Online (Sandbox Code Playgroud)

elasticsearch

11
推荐指数
2
解决办法
8110
查看次数

使用Zip php常规输入/输出错误创建ODT文件

我的系统生成一个包含下一个文件和子文件夹的文件夹

在此输入图像描述

我正在使用此代码创建一个odt文件.当我使用此代码运行我的系统,通过Apache + PHP和Ubuntu 12.04将子文件夹和文件压缩到test.odt文件时,odt文件就可以了.但是当我尝试通过IIS + PHP和Windows将一个压缩到test.odt文件时,odt文件无效.我知道不行,因为当我用LibreOffice打开odt文件时,我得到错误输入/输出一般错误. 这里是odt文件.

当我提取通过Windows生成的odt文件时,文件夹和文件具有相同的图片形式.我正在寻找谷歌,也许问题是mimetype编码.

我将如何修改代码1,以便解决我的问题?

编辑

我用下面的代码使用这个文件夹,但我的odt文件中只有"PKÜNTEBasic/PKÜNTEúミ,lÓR/ Basic/script-lc.xmleマAoÂ0".这里的例子.

<?php

$wordtemplatedownloadpath = "siscons\\test\\wordtemplatedownload\\";
Zip($wordtemplatedownloadpath . "pasta3", $wordtemplatedownloadpath . "test.odt");
force_download("test.odt", $wordtemplatedownloadpath . "test.odt");
//echo "<a href=test/wordtemplatedownload/test.odt>" . "Download Force". "</a>";
function Zip($source, $destination)
{
    if (!extension_loaded('zip') || !file_exists($source)) {
        return false;
    }

    $zip = new ZipArchive();
    if (!$zip->open($destination, ZIPARCHIVE::CREATE)) {
        return false;
    }

    $source = str_replace('\\', '/', realpath($source));
    //echo $source;
    if (is_dir($source) === true) {
        $files …
Run Code Online (Sandbox Code Playgroud)

php

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

类型a必须实现继承的纯虚方法b

我希望使用抽象类在C++中模拟接口sterotype.但是在Eclipse IDE中,我得到"此行的多个标记 - 类型'Handler'必须实现继承的纯虚方法'Handler :: setNext'"

我的问题是为什么这个?

handler.h中

class Handler {
 public:

    virtual void setNext(Handler &next)  = 0;
    Handler();
    virtual ~Handler();
    virtual void process()  = 0;
 public:

    Handler *nextInChain;

};
Run Code Online (Sandbox Code Playgroud)

Handler.cpp

#include "Handler.h"
Handler::Handler(){
}
Handler::~Handler(){
}
Run Code Online (Sandbox Code Playgroud)

Oracle.h

#include "Handler.h"
class Oracle : virtual public Handler {
 public:
    Oracle();
    virtual ~Oracle();
    virtual void process();
    virtual void setNext(Handler &next);
 private:

};
Run Code Online (Sandbox Code Playgroud)

Oracle.cpp

#include "Oracle.h"

Oracle::Oracle(){
Handler AQUI;//AQUI I get Multiple markers at this line
             //- The type 'Handler' must implement the …
Run Code Online (Sandbox Code Playgroud)

c++

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

乘法和模块图灵机

我需要帮助设计一台计算以下内容的图灵机f(x,y) = x*y mod 4.如何处理二进制基地这个问题,在$x$$y$有两位?

turing-machines

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

编写struct + write(buf)指向未初始化的字节

我在变量n0中为struct节点分配空间.我使用fwrite将此结构保存到文件,但是当我运行valgrind时,我收到此错误.我的代码如下,你能帮我吗?

==1412== Syscall param write(buf) points to uninitialised byte(s)
==1412==    at 0x4F22870: __write_nocancel (syscall-template.S:81)
==1412==    by 0x4EB0002: _IO_file_write@@GLIBC_2.2.5 (fileops.c:1261)
==1412==    by 0x4EB14DB: _IO_do_write@@GLIBC_2.2.5 (fileops.c:538)
==1412==    by 0x4EB0D5F: _IO_file_close_it@@GLIBC_2.2.5 (fileops.c:165)
==1412==    by 0x4EA4B0F: fclose@@GLIBC_2.2.5 (iofclose.c:59)
==1412==    by 0x400793: main (in /home/grados-sanchez/git/merkle-codigos-C/test_file)
==1412==  Address 0x402500c is not stack'd, malloc'd or (recently) free'd
==1412==  Uninitialised value was created by a stack allocation
==1412==    at 0x40073F: main (in /home/grados-sanchez/git/merkle-codigos-C/test_file)

typedef struct {
    unsigned char * ustr;
    int height;
}node;

void node_init(node * n, int …
Run Code Online (Sandbox Code Playgroud)

c

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

Valgrind错误m64 m32

我正在尝试使用valgrind验证下面的代码文件test.c,当我制作gcc test.c -o test我得到了跟随错误

Syscall param write(buf) points to uninitialised byte(s)
==22765==    at 0x4F22870: __write_nocancel (syscall-template.S:81)
==22765==    by 0x4EB0002: _IO_file_write@@GLIBC_2.2.5 (fileops.c:1261)
==22765==    by 0x4EB14DB: _IO_do_write@@GLIBC_2.2.5 (fileops.c:538)
==22765==    by 0x4EB0D5F: _IO_file_close_it@@GLIBC_2.2.5 (fileops.c:165)
==22765==    by 0x4EA4B0F: fclose@@GLIBC_2.2.5 (iofclose.c:59)
==22765==    by 0x400986: main (in /home/grados-sanchez/git/merkle-codigos-C/test)
==22765==  Address 0x4025770 is not stack'd, malloc'd or (recently) free'd
==22765==  Uninitialised value was created by a stack allocation
==22765==    at 0x4007E2: node_write (in /home/grados-sanchez/git/merkle-codigos-C/test)
Run Code Online (Sandbox Code Playgroud)

但是当我运行gcc test.c -o test然后valgrind时我没有得到任何错误.我的问题是在这种情况下valgrind会发生什么?有没有办法运行valgrind 32或64位?

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define id_lenght …
Run Code Online (Sandbox Code Playgroud)

c valgrind

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

在C中生成随机字符串无符号字符

我想用下面的代码生成一个长度为100的随机字符串文本,然后验证我是否打印了可变文本的长度,但有时小于100。我该如何解决?

#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

int main() {
    int i, LEN = 100;
    srandom(time(NULL));
    unsigned char text[LEN];
    memset(text, 1, LEN);
    for (i = 0; i < LEN; i++) {
        text[i] = (unsigned char) rand() & 0xfff;
    }
    printf("plain-text:");
    printf("strlen(text)=%zd\n", strlen(text));

}
Run Code Online (Sandbox Code Playgroud)

c

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

在R中绘制+更改字体大小

我想减少"hola"这条指令中的标签表达式:

axis(1, at = c(32.65), labels = expression("hola")) 
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

r

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

隐藏在C中经过的时间

我需要隐藏指令以在C中获得经过的时间.例如,在下一个代码中,有几行指令来获取函数foo的经过时间.

struct timeval start_keygen, end_keygen;
long int diff_keygen_sec = 0;
gettimeofday(&start_keygen, NULL);
foo(r, w, h);
gettimeofday(&end_keygen, NULL);
timediff(start_keygen, end_keygen, &diff_keygen_sec); 
Run Code Online (Sandbox Code Playgroud)

我的问题是如何在一个函数中隐藏多行,例如在"getTime"中,即:

getTime(foo(r,w,h))
Run Code Online (Sandbox Code Playgroud)

c

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

使用按位运算符反转无符号短向量

我想反转二进制文件

unsigned short gf_t  = 44 // = 00101100
Run Code Online (Sandbox Code Playgroud)

在C语言的00110100.我将如何使用按位运算符?

pdta:我的电脑有32位模式.

c bit-manipulation

0
推荐指数
2
解决办法
2830
查看次数

类型的操作数无效

我们来吧

gf.h

typedef unsigned short gf_t;
class GaloisField{
public:
 gf_t * gf_exp;
 gf_t * gf_log;
 int gf_extension_degree, gf_cardinality, gf_multiplicative_order;
 static gf_t gf_ord();
 static int gf_inv(int x);
Run Code Online (Sandbox Code Playgroud)

gf.cpp

 gf_t GaloisField::gf_ord(){
   return gf_multiplicative_order;
 }

 int GaloisField::gf_inv(int x){
   return gf_exp[GaloisField::gf_ord() - gf_log[x]]; //line 181
 }
Run Code Online (Sandbox Code Playgroud)

我收到消息:gf.cpp:181:错误:类型'gf_t'和'gf_t()(gf_t)'的无效操作数到二进制'operator-'.为什么这个?

c++

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