嗨,我想创建一个数组,其中每个位置由枚举的值表示.
例如:
public enum type{
green,blue,black,gray;
}
Run Code Online (Sandbox Code Playgroud)
现在我想创建一个阵列,其中每个位置都是绿色,蓝色,......
我会更清楚.我想创建一个数组,其中位置由enum class.instead int []数组表示.[=] int []创建int [] array = new int [type.value]
我会检查服务器中放置的服务器套接字是否打开.在我创建套接字的客户端中,我Socket sock = new Socket(host,port)检查它是否打开:
if(sock == null)
System.out.println("The server is not connected!");
else
//Doing some task
Run Code Online (Sandbox Code Playgroud)
但我没有收到任何结果.有方法检查另一侧的服务器套接字是否打开?我甚至尝试过这种方法,isConnected()但没有
我已将gson添加到我的pom.xml。就这个。但是当我打电话Gson gson = new Gson()并尝试在 Maven 存储库中搜索时,它没有找到任何元素。为什么?我哪里错了?
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>VolaConNoi_webapp</artifactId>
<groupId>it.volaconnoi</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>it.volaconnoi</groupId>
<artifactId>VolaConNoi_webapp-ear</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>ear</packaging>
<name>VolaConNoi_webapp-ear</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.8</version>
<configuration>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>it.volaconnoi</groupId>
<artifactId>VolaConNoi_webapp-ejb</artifactId>
<version>1.0-SNAPSHOT</version>
<type>ejb</type>
</dependency>
<dependency>
<groupId>it.volaconnoi</groupId>
<artifactId>VolaConNoi_webapp-web</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<!-- Gson: Java to Json conversion -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId> …Run Code Online (Sandbox Code Playgroud) 我创建了这个简单的应用程序来获取位置.我正在使用genymotion虚拟机.我启用了GPS并正确安装了谷歌播放服务.不幸的是我无法找回位置.当然,我已经添加了正确的权限.还有什么我应该做的?
package com.salvo.weather.android;
import android.app.Activity;
import android.location.Location;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationServices;
public class TodayActivity extends Activity
implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
protected static final String TAG = "location-weather";
protected Location mLastLocation;
/**
* Provides the entry point to Google Play services.
*/
protected GoogleApiClient mGoogleApiClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_today);
// TODO: here get coordinates data and pass to Valley JsonObjectRetrieve
buildGoogleApiClient();
}
/** …Run Code Online (Sandbox Code Playgroud) 我会在JPanel上写一个比其他元素更大的字符串.这可能是简单地描绘字符串的方法吗?有一种方法可以做到这一点吗?
我已经导入了一个项目Android Studio但是我得到了错误:
找不到com.android.support:support-v4:19.1.0.
我在哪里可以找到这个文件?我使用了导入项目Gradle.
我有Android Studio version 0.5.7最后一个android sdk和java 1.7u55.
我正在使用requestnpm获取http页面.我有类似的东西
function callbackFunction1() {
var p = 'foo';
request(url, callbackFunction2);
}
function callbackFunction2(err, response, body){
}
Run Code Online (Sandbox Code Playgroud)
我如何将变量p作为callbackFunction2的参数传递?
我正在尝试从ActiveMQ的公开OpenPGP密钥获取指纹。它们发布在http://www.apache.org/dist/activemq/KEYS上。
不幸的是,并非所有键旁边都列出了指纹。您知道如何进行吗?
我的想法是通过将一个字符串附加到每个元素上来修改列表的元素。如何做到这一点?我没有找到任何允许我执行此操作的功能。