刚刚安装并开始使用Android Studio,并在配置开始处理项目所需的所有内容后创建了新项目.在新创建的项目中,我没有更改任何内容,然后尝试运行该项目.但它不起作用,我猜测会抛出一些依赖性错误.就这个
Gradle:
FAILURE: Build failed with an exception.
Run Code Online (Sandbox Code Playgroud)
出了什么问题:在任务':StudioTest2:packageDebug' 的配置中发现了一个问题.
为属性'dexFile'指定的文件'C:\ Users\StudioTest2\StudioTest2\build\libs\StudioTest2-debug.dex'不存在.
尝试:使用--stacktrace选项运行以获取堆栈跟踪.使用--info或--debug选项运行以获取更多日志输出.
无法使用Gradle分发' http://services.gradle.org/distributions/gradle-1.6-bin.zip ' 执行构建.
在achartengine库中,类XYMultipleSeriesRenderer有两个函数:
public void setXLabelsColor(int color)
public void setYLabelsColor(int scale, int color)
Run Code Online (Sandbox Code Playgroud)
setXLabelsColor()直觉上有意义,因为只需要传递颜色,但是最长的时间我无法弄清楚"尺度"参数是setYLabelsColor做什么的.文档说,它是"渲染器规模",但显然不是什么价值尺度可能是显而易见的.在搞乱输入之后,我终于得到了使用'scale'值为0的函数.这对我来说并不直观.我认为比例值为1意味着图表保持其规模.为什么值为0有效,而默认值为1则不然?
我有Web服务,它返回XML数据.但在数据中,我在它的开头接收到Null字段.实际数据也可用,但后面跟着Null字段.我正在使用ksoap2访问Android中的web服务.SoapObject变量具有完整数据,但也具有那些空字段,这对于使用此服务有点创建问题.在这里你可以看到,在开始它没有什么,但后来它有数据以标签"标题"开头
04-12 10:55:09.405: D/ENVELOPE(1394): GetGuestEventsListingForServiceResponse{GetGuestEventsListingForServiceResult=anyType{schema=anyType{element=anyType{complexType=anyType{choice=anyType{element=anyType{complexType=anyType{sequence=anyType{element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; }; }; }; }; }; }; }; diffgram=anyType{NewDataSet=anyType{Table=anyType{Title=THE CLUSTER DAY-1, JUNKOVATION; Description=anyType{}; EventDate=Apr 12, 2013; EventTime=5:00 PM; Venue=BLOCK 13-306; CreatedBy=16689; CreatedOn=2013-04-11T09:52:07.163+05:30; EventFor=All; Type=Internal; IsActive=true; };
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用动态密钥和相应的值创建哈希.比如这样
hash = {1 => 23.67, 1 => 78.44, 3 => 66.33, 12 => 44.2}
Run Code Online (Sandbox Code Playgroud)
像这样的1,2,12是数组索引.我希望这是可以理解的.我正在尝试使用ROR教程中的语法.
像这样
test = Hash.new
for i in 0..23
if (s.duration.start.hour == array[i].hour)
s.sgs.each do |s1|
case s1.type.to_s
when 'M'
test ={i => s1.power} # here I am trying to create hash like give example in which i is for loop value
when 'L'
puts "to be done done"
else
puts "Not Found"
end
end
end
end
end
Run Code Online (Sandbox Code Playgroud)
更新的代码
test = Hash.new
for i in …Run Code Online (Sandbox Code Playgroud) 我试图通过JSON String保存数据,其中我有嵌套的关联属性.我不想使用attr_accessible.我几乎得到了强参数的逻辑,但仍然有问题使它们工作.我正在获取JSON字符串并使用它来使用它来保存数据
data = request.body.read
@inputData = Person.new(JSON.parse(data))
@inputData.save!
if@inputData.valid?
render :status => 200, :json => "Data inserted successfully"
else
render :status => 404, :json => "Not Inserted "
end
Run Code Online (Sandbox Code Playgroud)
我已经定义了permit strong参数方法允许这样的嵌套属性
def referral_params
params.require(:person).permit(:id, user_attributes: [:id, :first_name, :last_name, :email], device_attributes: [:id, :os_type, :os_version], location_attributes: [:id, :latitude, :longitude], duration_attributes[:id, :start_time, :end_time]) end
Run Code Online (Sandbox Code Playgroud)
但我不知道如何使用此regerral_params方法以及JSON输入字符串....
json ruby-on-rails nested-attributes strong-parameters ruby-on-rails-4
嗨,我添加了两个TabHosts Activity并且工作正常.我添加了另一个XML文件,ListView并Activity在我使用的地方调用Tabhost.它正如预期的那样给出错误,但我尝试了很多但无法解决它.谁能给我关于如何管理任何想法ListView,并TabHost在一两个Activity?我没有放入代码,因为它主要来自教程.任何帮助,将不胜感激.谢谢.主要错误是"您的内容必须具有TabHost其id属性为'android.R.id.tabhost'"
android android-widget android-layout android-listview android-tabhost
我试图在一个范围内找到所有可用的蓝牙设备.但我只得到一个设备,我在运行方法的线程中使用它.我已经检查了很多关于此问题的链接,但无法解决此问题.这是我的代码
public void run() {
if(service != null) {
IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
service.registerReceiver(this.bReceiver, filter);
bluetooth.startDiscovery();
}
}
class BluetoothReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
Set<BluetoothDevice> pairedDevices = bluetooth.getBondedDevices();
String action = intent.getAction();
if (pairedDevices.size() > 0) {
for (BluetoothDevice device : pairedDevices) {
int rssi = intent.getShortExtra(BluetoothDevice.EXTRA_RSSI,Short.MIN_VALUE);
Log.d(TAG, device.getName());
}
}
if(BluetoothDevice.ACTION_FOUND.equals(action)) {
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
String uuid = intent.getStringExtra(BluetoothDevice.EXTRA_UUID);
int rssi = intent.getShortExtra(BluetoothDevice.EXTRA_RSSI,Short.MIN_VALUE);
Log.d(TAG, device.getName());
}
}
}
Run Code Online (Sandbox Code Playgroud)
另外我想要每个找到的设备的rssi值,但请忽略语法
我正在尝试连续显示蓝牙设备并在屏幕上显示它们但它从来没有向我显示所有设备,而是一次只显示1个.我找不到我做错了什么.这是我的代码,也许你可以在其中找到任何问题.谢谢
class monitorBluetooth extends monitor {
private ListView mLvDevices;
private ArrayList<String> mDeviceList = new ArrayList<String>();
public monitorBluetooth(service service) {
super(service);
bluetooth = BluetoothAdapter.getDefaultAdapter();
this.bReceiver = new BluetoothReceiver();
}
public void finalize() throws Throwable {
super.finalize();
}
public void run() {
IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
service.registerReceiver(this.bReceiver, filter);
if(service != null) {
bluetooth = BluetoothAdapter.getDefaultAdapter();
bluetooth.startDiscovery();
}
}
class BluetoothReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
Set<BluetoothDevice> pairedDevices = bluetooth.getBondedDevices();
String action = intent.getAction();
if(BluetoothDevice.ACTION_FOUND.equals(action)) {
BluetoothDevice …Run Code Online (Sandbox Code Playgroud) 有没有办法停止,在docker swarm模式下启动单个任务,以及如何做到这一点?
我正在使用jbuilder编写部分来返回json数据.我有一个模块,我在其中返回show方法中每条记录的数据和索引中的所有记录.但是所有记录的东西都没有在这里工作,我在控制器中做了我的show方法
def index
@signals = Signal.all.paginate(:page => params[:page], :per_page => 10)
end
def show
@signal = Signal.find(params[:id])
end
Run Code Online (Sandbox Code Playgroud)
这是我的部分_signal.json_jbuilder
json.(@signal, :id, :power)
json.user do
json.first_name @signal.user.first_name
json.last_name @signal.user.last_name
json.email @signal.user.email
end
json.location @signal.signal_location, :latitude, :longitude
json.device do
json.model @signal.device.phonemodel
json.os_version @signal.device.os_version
json.os_type @signal.device.os_type
json.sim_card_provider @signal.device.sim_card_provider
end
Run Code Online (Sandbox Code Playgroud)
现在我在我的show.json.jbuilder和index.json.jbuilder中使用这个部分,这是我的show.json.jbuilder
json.partial! 'signals/signal', signal: :@signal
Run Code Online (Sandbox Code Playgroud)
它工作正常,但当我在index.json.jbuilder中使用这个部分时,这是我的index.json.jbuilder
json.partial! partial: 'signals/signal', collection: @signals, as: :signal
Run Code Online (Sandbox Code Playgroud)
它说undefined @ signal.user.first_name.它到达内部部分但不能达到联想.我检查了日志..但没有什么非常有帮助...坚持了很长时间...帮助赞赏
我正在尝试在C++方面的Java方法调用上显示吐司我已设法调用该方法甚至获取字符串但Toast无法正常工作我已经尝试了几乎所有上下文和所有内容
C++ Side
JavaVMAttachArgs args = { JNI_VERSION_1_6, NULL, NULL };
vm->AttachCurrentThread( &env, &args );
activityConstructor = env->GetMethodID(activity, "<init>", "()V");
jobject object = env->NewObject(activity, activityConstructor);
toastID = env->GetMethodID(activity, "toast", "(Ljava/lang/String;)V");
qDebug() << "Moving";
jstring message1 = env->NewStringUTF("This comes from jni.");
qDebug()<< "Test" << message1;
env->CallVoidMethod(object, toastID, message1);
Run Code Online (Sandbox Code Playgroud)
Java方面
public void toast(String message){
messageData = message;
Log.d(TAG, message);
new Thread()
{
public void run()
{
esActivity.this.runOnUiThread(new Runnable(){
public void run(){
Log.d("Message in UIThread", messageData);
Toast.makeText(context, messageData, Toast.LENGTH_SHORT).show();
}
});
}
}.start(); …Run Code Online (Sandbox Code Playgroud) android ×7
bluetooth ×2
json ×2
achartengine ×1
arrays ×1
asp.net ×1
c++ ×1
charts ×1
docker ×1
docker-swarm ×1
hash ×1
jbuilder ×1
qt ×1
ruby ×1
web-services ×1