小编Koh*_*URA的帖子

在打包APK期间复制文件

我使用的是Android Studio,我在那里使用了几个库.

我有:

android-query-full.0.25.10.jar
gson-2.2.4-sources.jar
slide-menu.jar
Run Code Online (Sandbox Code Playgroud)

我在build.gradle文件中定义了编译整个libs目录,如下所示:

dependencies {
    compile 'com.android.support:support-v4:13.0.+'
    compile fileTree(dir: 'libs', include: '*.jar')
}
Run Code Online (Sandbox Code Playgroud)

所有这些都很有效.

现在我想添加另一个库"PullToRefresh"我已经将ResSrc文件夹打包到一个jar文件中,其中包含来自eclipse的源代码(就像我使用SlideMenu.jar一样)并将新创建的jar作为库添加到我的项目旁边所有其他人.

当我尝试构建我的项目时,我从gradle中得到以下错误:

Gradle: : duplicate files during packaging of APK C:\Code\TestProject\Test\build\apk\Endilo-debug-unaligned.apk
Gradle: Execution failed for task ':Endilo:packageDebug'.
> Duplicate files copied in APK res/values/attrs.xml
    File 1: C:\Code\TestProject\Test\libs\PullToRefresh.jar
    File 2: C:\Code\TestProject\Test\libs\PullToRefresh.jar
Run Code Online (Sandbox Code Playgroud)

这是非常奇怪的,因为我从同一个jar文件中获取重复项.这里发生了什么!?

android jar gradle android-studio

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

F5在调试器中运行Visual Studio Test

我正在使用Visual Studio Test for C++,我正在调试一个特定的测试.Microsoft提供了各种方法来在调试器中运行测试,但没有我真正喜欢的方法.我厌倦了必须找到测试代码,然后按Ctrl+ R,Ctrl+ T(或我讨厌的鼠标).我想要来自任何源代码上下文的Ctrl+ R,Ctrl+ T行为.

有没有办法挂钩F5在调试器中运行选定的测试?

我已经尝试将我的测试项目设置为启动,但这使得F5"无法启动",因为测试是一个DLL.

visual-studio-2012 visual-studio-test-runner

14
推荐指数
2
解决办法
802
查看次数

如何使用Android Room和RxJava 2没有结果?

我有数据库与表联系,我想检查是否有联系某些电话号码.

@Query("SELECT * FROM contact WHERE phone_number = :number")
Flowable<Contact> findByPhoneNumber(int number);
Run Code Online (Sandbox Code Playgroud)

我有RxJava 2 Composite一次性声明,以检查是否有电话号码联系.

disposable.add(Db.with(context).getContactsDao().findByPhoneNumber(phoneNumber)
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribeWith(new DisposableSubscriber<Contact>() {
                @Override
                public void onNext(final Contact contact) {
                    Log.d("TAG", "phone number fined");
                    Conversation conversation;
                    if(contact != null){
                        conversation = Db.with(context).getConversationsDao().findBySender(contact.getContactId());
                        if(conversation != null){
                            conversation.setUpdatedAt(Utils.getDateAndTimeNow());
                            saveConversation(contact, conversation, context, text, phoneNumber, false);
                        } else {
                            conversation = getConversation(contact, contact.getPhoneNumber());
                            saveConversation(contact, conversation, context, text, phoneNumber, true);
                        }
                    } else {
                        conversation = Db.with(context).getConversationsDao().findByPhone(phoneNumber);
                        if(conversation != null){
                            conversation.setUpdatedAt(Utils.getDateAndTimeNow());
                            saveConversation(contact, conversation, context, text, phoneNumber, false); …
Run Code Online (Sandbox Code Playgroud)

android rx-java2 android-room

14
推荐指数
3
解决办法
9344
查看次数

如何在自定义通知中引用视图

在下面发布的代码中,我创建了一个自定义布局的通知.通知的布局包含三个操作按钮.

我现在的问题是,我无法引用代码中的任何按钮,以便我可以根据单击的操作按钮导航到另一个活动.我想要做的Action button 1 是点击何时Activity 1显示,何时Action button 2单击然后Activity 2出现等等.

请告诉我如何在通知的自定义布局中引用视图?

代码:

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Using RemoteViews to bind custom layouts into Notification
        RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.layout_notification);
        String notification_title = "Notification_Title";
        String notification_text = "Notification_Text";

        // Open NotificationView Class on Notification Click
        Intent intent = new Intent(this, NotificationReply.class);
        // Send data to NotificationView Class
        intent.putExtra("title", notification_title);
        intent.putExtra("text", notification_text);
        // …
Run Code Online (Sandbox Code Playgroud)

java android android-notifications remoteview android-pendingintent

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

如何调试lombok对象

Person.toString()使用Eclipse或IntelliJ IDEA时,有谁知道如何在下面设置断点?

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.ToString;

@ToString
@AllArgsConstructor
@Data
public class Person {
    private String lastName;
    private String firstName;
}
Run Code Online (Sandbox Code Playgroud)

编辑:

如果可能的话,我想只在toString()被叫时停止.

java eclipse intellij-idea lombok

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

如何将 InMemoryUploadedFile 的内容转换为字符串

有谁知道如何将InMemoryUploadedFileDjango2中上传文件 ( ) 的内容转换为字符串?

我想知道如何写以下内容convert2string()

uploaded_file = request.FILES['file']
my_xml = convert2string(uploaded_file)  # TODO write method(convert to xml string)
obj = MyObject()
parser = MyContentHandler(obj)
xml.sax.parseString(my_xml, parser)  # or xml.sax.parse(convertType(uploaded_file), parser)
Run Code Online (Sandbox Code Playgroud)

django python-3.x

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

如何使用StreamReader和StreamWriter创建文件副本

我需要使用StreamReader读取控制台应用程序上的.txt文件,然后创建一个具有不同名称但内容相同的新文件或备份.问题是我无法弄清楚如何使用第一个文件中的内容放入新文件中.(这是针对学校的事情而且是C#的新手)

using System;
using System.IO;
namespace UserListCopier
{
    class Program
    {
        static void Main()
        {
            string fineName = "zombieList.txt";

            StreamReader reader = new StreamReader(fineName);

            int lineNumber = 0;

            string line = reader.ReadLine();

            while (line != null) {
                lineNumber++;
                Console.WriteLine("Line {0}: {1}", lineNumber, line);
                line = reader.ReadLine();
            }

            StreamWriter writetext = new StreamWriter("zombieListBackup.txt");

            writetext.Close();
            System.Console.Read();
            reader.Close();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

c# copy streamwriter streamreader

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

javax.net.ssl.SSLException:&lt;&gt;的证书与任何主题备用名称都不匹配:[]

当我尝试使用Postman命中URL时,通过使用我的个人证书可以正常工作。但是当我使用Rest Assured测试用例尝试访问URL时,将抛出上述异常。

配置类别

public class Configuration {

    protected SSLConfig config = null;
    private static final Logger LOG = LoggerFactory.getLogger(Configuration.class);

    @SuppressWarnings("deprecation")
    @BeforeClass
    public void setKeystore()

    {
        KeyStore keyStore = null;

        KeyStore trustStore = null;
        try {
            String certPassword = System.getProperty("certPassword");
            String certPath = System.getProperty("certPath");

            String trustStorePassword = System.getProperty("trustStorePassword");
            String trustStorePath = System.getProperty("trustStorePath");
            Validate.notNull(certPath, "Path to Certificate on the file system cannot be null");
            Validate.notEmpty(certPassword, "Password cannot be empty");
            Validate.notNull(trustStorePath, "Path to trustStore on the file system cannot be null");
            Validate.notEmpty(trustStorePassword, "TrustStore …
Run Code Online (Sandbox Code Playgroud)

java ssl https rest-assured

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

在Windows上,Ctrl + C无法停止Maven启动Java进程的原因

我创建了一个可由Maven(mvn clean install exec:exec)运行的可执行Tomcat jar应用程序.Linux上的Ctrl+ 可以停止此应用程序C.但是,它无法在Windows上运行.有谁知道原因和解决方案?

环境:

$ mvn -version
Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T22:51:42+09:00)
Maven home: c:\apache-maven-3.2.2
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: c:\Program Files\Java\jdk1.8.0_121\jre
Default locale: ja_JP, platform encoding: MS932
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
Run Code Online (Sandbox Code Playgroud)

pom.xml的摘录:

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.1</version>
    <executions>
        <execution>
            <id>tomcat-run</id>
            <goals>
                <goal>exec-war-only</goal>
            </goals>
            <phase>package</phase>
            <configuration>
                <path>/</path>
                <enableNaming>true</enableNaming>
                <finalName>embtest.jar</finalName>
                <charset>utf-8</charset>
            </configuration>
        </execution>
    </executions>
</plugin>
<plugin>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.6</version>
    <configuration>
        <failOnMissingWebXml>false</failOnMissingWebXml>
        <warName>ROOT</warName>
    </configuration>
</plugin> …
Run Code Online (Sandbox Code Playgroud)

java tomcat maven

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

客户端未连接到任何Elasticsearch节点!在flink中以独立群集模式运行时

我能够在我的eclipse中运行以下代码,但是当我在flink集群中运行它时,我得到以下错误.谁能指导我这个?

我的代码:

public static void main(String[] args) throws Exception {

    /**
     * Getting the execution Environment
     */
    final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

    Properties properties = new Properties();
    properties.setProperty("bootstrap.servers", "11.71.10.13:9092");
    properties.setProperty("group.id", "Bitfinex");
    Map<String, String> config = new HashMap<>();
    config.put("cluster.name", "TRADE-ES");
    config.put("bulk.flush.max.actions", "1");
    config.put("node.name", "node-1");

    List<InetSocketAddress> transportAddresses = new ArrayList<>();
    transportAddresses.add(new InetSocketAddress(InetAddress.getByName("19.18.1.55"), 9300));
    transportAddresses.add(new InetSocketAddress(InetAddress.getByName("19.18.1.78"), 9300));

    /**
     * Adding the BitFinex-ETHBTC-Order source to the execution environment
     */
    DataStream<String> ethbtc_OrderStream = env.addSource(
            new FlinkKafkaConsumer010<String>("BitFinex-ETHBTC-Order", new SimpleStringSchema(), properties),
            "Kafka_BitFinex-ETHBTC-Order_Source").setParallelism(1);

    ethbtc_OrderStream.addSink(new BitfinexEthbtcOrderADLSink<String>()).name("BitfinexEthbtcOrderADLSink")
            .setParallelism(10);

    ethbtc_OrderStream
            .addSink(new …
Run Code Online (Sandbox Code Playgroud)

elasticsearch apache-flink flink-streaming

5
推荐指数
0
解决办法
374
查看次数