小编Ciu*_*rin的帖子

如何在<string> XML(eclipse/android)中创建一个新行或制表符?

所以,在我的strings.xml中,我有一个非常长的文本,我想以某种方式格式化.如何在文本的第一句之前加上一个标签?另外,新线的代码是什么?谢谢

xml eclipse tabs android line

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

如何为ASP.NET WebAPI 2中使用路由属性的特定控制器添加MessageHandler?

是否可以仅为使用路由属性的特定控制器添加MessageHandler?

如果它不包含某些标头,我想在管道中提前删除请求.我想提一下:

  • 我无法在WebApiConfig中添加其他路由,我们必须使用控制器中的路由属性.

  • 我不想全局添加MessageHandler.

  • 它必须是MessageHandler(在管道的早期).我们有替代方案,但我们正在努力提高效率.

例如,我用以下RoutePrefix修饰了控制器:api/myapicontroller和一个带有Route("")的动作.(我知道这很奇怪,我们正在根据查询字符串选择不同的动作)

然后,我补充说

config.Routes.MapHttpRoute(
        name: "CustomRoute",
        routeTemplate: "api/myapicontroller/{id}",
        defaults: new { id = RouteParameter.Optional },
        constraints: null,
        handler: new myMessageHandler()  
    );    
Run Code Online (Sandbox Code Playgroud)

如果我在config.MapHttpAttributeRoutes();执行myMessageHandler 之前放置此代码,但是我收到此消息:

控制器'myapicontroller'上没有找到与请求匹配的操作

如果我config.MapHttpAttributeRoutes();先放,myMessageHandler永远不会被执行,但调用myapicontroller中的my动作.

asp.net asp.net-web-api routeattribute asp.net-web-api2 message-handlers

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

导入android.support.v13.app.FragmentActivity无法解析

我正在测试一个Android项目(http://developer.android.com/training/animation/screen-slide.html),我在一个类中有错误.

/*
 * Copyright 2012 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF …
Run Code Online (Sandbox Code Playgroud)

eclipse android class project libs

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

在Azure管理API中找不到订阅

我正在尝试使用Azure管理API创建Kubernetes集群。

  var credentials = SdkContext.AzureCredentialsFactory
    .FromFile(Environment.GetEnvironmentVariable("AZURE_AUTH_LOCATION"));


  var azure = Azure
    .Configure()
    .WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic)
    .Authenticate(credentials)
    .WithDefaultSubscription();

var kubernetesCluster = azure.KubernetesClusters.Define("aks").WithRegion(Region.EuropeWest)
        .WithNewResourceGroup("aksResourceGroup").WithLatestVersion().WithRootUsername("aksUsername")
        .WithSshKey(sshPublicKey).WithServicePrincipalClientId("clientId")
        .WithServicePrincipalSecret("secret").DefineAgentPool("ap").WithVirtualMachineCount(1)
        .WithVirtualMachineSize(ContainerServiceVirtualMachineSizeTypes.StandardA0).Attach()
        .WithDnsPrefix("dns-aks").Create();
Run Code Online (Sandbox Code Playgroud)

在最后一行中,将引发CloudException消息:找不到订阅[]。

即使引发异常,也会创建资源组,但资源组为空。

我已使用带有该服务主体的Azure CLI登录并且已经运行

az account list
Run Code Online (Sandbox Code Playgroud)

响应如下:

[
  {
    "cloudName": "AzureCloud",
    "id": "SUBSCRIPTION ID FROM EXCEPTION ABOVE",
    "isDefault": true,
    "name": "Pay-As-You-Go",
    "state": "Enabled",
    "tenantId": "xxx",
    "user": {
      "name": "xxxx",
      "type": "servicePrincipal"
    }
  }
]
Run Code Online (Sandbox Code Playgroud)

应用程序注册位于Azure Active Directory>应用程序注册>所有应用程序中。我什至授予了所有可能的API的权限。

为了接收该异常消息,我做错了什么吗?

azure azure-management kubernetes azure-container-service

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

Android教程错误:edit_message无法解析或不是字段

我试图按照Android教程但在我尝试运行代码后出现此错误.这是我的MainActivity.

    package com.example.menuexample;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;


public class MainActivity extends Activity {
    public final static String EXTRA_MESSAGE="com.example.menuexample.MESSAGE";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
    public void sendMessage(View view){ 
        Intent intent = new Intent(this, DisplayMessageActivity.class); 
        EditText editText= (EditText) findViewById(R.id.edit_message);  --HERE
        String message = editText.getText().toString();
        intent.putExtra(EXTRA_MESSAGE, message);
        startActivity(intent); 
    }


}
Run Code Online (Sandbox Code Playgroud)

我进入了activity_main:

<EditText
    android:id="@+id/editText1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:hint="@string/edit_message" >

</EditText>
Run Code Online (Sandbox Code Playgroud)

此外,strings.xml还具有:

<string name="edit_message">Test</string>
Run Code Online (Sandbox Code Playgroud)

java eclipse string android android-activity

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