小编oha*_*nho的帖子

在不符合textview大小的文本后3点

我有这段代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="100sp"          
            android:orientation="vertical"
            android:id="@+id/linearLayout1">
<TextView 
       android:id="@+id/click"
       android:layout_width="fill_parent"
       android:layout_height="30sp"               
       android:text="Enter the text right over here"
       android:textSize="25sp"  
       android:textColor="#000000"
       android:textStyle="bold"     
       android:onClick="onClick"                     
       android:clickable="true"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我需要将"在此处输入文本"文本写为"正确输入文本..."(因为文本超出了定义的宽度.

我该如何创建该功能?

android android-ui android-layout

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

在RelativeLayout中心

我需要将ImageView和TextView置于RelativeLayout中.我无法弄清楚我做错了什么.

这是我的代码:

<RelativeLayout    
        android:id="@+id/teamNameLayout"
    android:layout_width="130dip"
    android:layout_height="fill_parent"
    android:orientation="horizontal"          
    android:background="@drawable/border"
    android:layout_toLeftOf="@+id/teamPosition"          
    >
    <ImageView
            android:id="@+id/teamIcon"
            android:src="@drawable/logo1"
            android:layout_width="20dip"            
            android:layout_height="fill_parent"                    
            android:scaleType="fitXY"
            android:textStyle="bold"
       android:textSize="16sp" 
             />
    <TextView  android:id="@+id/teamName"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent"
        android:gravity="center"                        
       android:textColor="#000000"  
       android:textStyle="bold"
       android:textSize="16sp"      
       android:text="blabla" />
    </RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

我试过"center_horizo​​ntal"没有成功.我需要ImageView将在TextView的右侧.

android android-layout

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

用map-reduce编写一个简单的组(Couchbase)

我是整个map-reduce概念的新手,我正在尝试执行一个简单的map-reduce功能.

我目前正在使用Couchbase服务器作为我的NoSQL数据库.

我想获得所有类型的列表:

key: 1, value: null
key: 2, value: null
key: 3, value: null
Run Code Online (Sandbox Code Playgroud)

这是我的文件:

{
   "type": "1",
   "value": "1"
}

{
   "type": "2",
   "value": "2"
}

{
   "type": "3",
   "value": "3"
}

{
   "type": "1",
   "value": "4"
}
Run Code Online (Sandbox Code Playgroud)

我一直想做的是:写一个地图功能:

function (doc, meta) {
  emit(doc.type, 0);
}
Run Code Online (Sandbox Code Playgroud)

使用内置的reduce功能:

_count
Run Code Online (Sandbox Code Playgroud)

但我没有得到预期的结果.

我怎样才能获得所有类型?

UPDATE

请注意,类型是不同的文档,我知道reduce对文档起作用,不在文档之外执行.

mapreduce nosql couchbase

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

Elasticsearch - 将字段从not_analyzed更改为已分析

是否可以将现有字段的属性修改not_analyzedanalyzed

如果没有,我可以做些什么来保存我的所有文件?

我无法删除映射(因为那时所有文档都将消失),我需要分析旧字段.

elasticsearch

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

Github - 如何在我的个人资料中显示协作项目?

有人将我添加为他的 GitHub 用户中的存储库的合作者。

是否可以在我的 github 个人资料中显示此项目?

git github

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

Linq 对累积 bool 值进行聚合

我有一个包含字符串的列表:

List<string> strList = new List<string>();

strList.Add("first");
strList.Add("second");
strList.Add("third");
strList.Add("fourth");
Run Code Online (Sandbox Code Playgroud)

我需要在每次迭代时向某个返回的方法发送两个字符串,bool并最终告诉结果是什么。

例如:

  • 第一次迭代:“第一”、“第二”(返回 true)
  • 第二次迭代:“第二”、“第三”(返回 true)
  • 第三次迭代:“第三”、“第四”(返回 false)

因此,所有调用的返回值是false(在这些返回值之间执行"&&")。

我必须使用 LINQ 所以我尝试做类似的事情:

strList.Aggregate<bool>((prev, current) => Method(prev,current));
Run Code Online (Sandbox Code Playgroud)

但不幸的是我做错了什么。

进一步解释:

我想为 strList 中的所有连续字符串对调用 bool Method(string, string) 并获取所有结果的布尔 &&

c# linq

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

我们如何部署Pharo海边网络应用程序?

我知道在Entreprise Pharo一书中有一个很好的解释,可以通过Linux服务器进行部署生产.我按照教程,并能够部署相同的项目.但是,该项目只包含一个简单的类'MyFirstWebApp',并且不包含Seaside框架.运行脚本如下:

ZnServer defaultOn: 8080. ZnServer default logToStandardOutput. ZnServer default delegate map: 'image' to: MyFirstWebApp new; map: 'redirect-to-image' to: [ :request | ZnResponse redirect: 'image' ]; map: '/' to: 'redirect-to-image'. ZnServer default start.

如果你有一个使用Seaside框架的许多类的项目怎么样?我为自己的Seaside项目重复了相同的过程,但是WARequestContextNotFound当我使用以下命令启动run.st脚本时出现消息错误./pharo myapp.image run.st.任何的想法?

cloud smalltalk seaside pharo pharo-5

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

Automapper - 更新现有实例

我有这些课程:

public class SourceA 
{
  public double SourceAProp { get; set; }
}

public class SourceB
{
  public double SourceBProp { get; set; }
}

public class Dest
{
  public double SourceAProp { get; set; }
  public double SourceBProp { get; set; }
} 
Run Code Online (Sandbox Code Playgroud)

我尝试过:

var config = new MapperConfiguration(cfg => cfg.CreateMap<SourceA, Dest>());
var mapper = config.CreateMapper();            
var dest = mapper.Map<SourceA, Dest>(sourceA.Value);

config = new MapperConfiguration(cfg => cfg.CreateMap<SourceB, Dest>());
mapper = config.CreateMapper();            
dest = mapper.Map<SourceB, Dest>(sourceB.Value);
Run Code Online (Sandbox Code Playgroud)

但我认为Map在每次执行时都会创建实例。

如何使用 …

c# automapper

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

图返回“代码:ResourceNotFound 消息:无效版本:我内部错误”

我正在尝试执行读取用户配置文件的简单操作。在我授予此操作的相关权限后,我可以通过编写以下代码来获取令牌:

static void Main(string[] args)
{
    var getToken = new GetTokenEntity()
    {
        Authority = "https://login.microsoftonline.com/common",
        Resource = "https://graph.microsoft.com",
        UserName = "myusername",
        ClientId = "appclientidguid",
        Password = "somepass"
    };

    var graphClient = new GraphServiceClient("https://graph.microsoft.com", new DelegateAuthenticationProvider(async(requestMessage) =>
    {
        var authResult = await GetToken(getToken);
        requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", authResult.AccessToken);
    }));

    var inbox = GetMessages(graphClient).GetAwaiter().GetResult();
}

public async static Task<AuthenticationResult> GetToken(GetTokenEntity getToken)
{
    var authenticationContext = new AuthenticationContext(getToken.Authority);
    var authenticationResult = await authenticationContext
        .AcquireTokenAsync(getToken.Resource, getToken.ClientId,
            new UserPasswordCredential(getToken.UserName, getToken.Password));
    return authenticationResult;
}

public async …
Run Code Online (Sandbox Code Playgroud)

c# microsoft-graph-sdks microsoft-graph-api

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

Moving cursor in react slate-editor

I'm trying to move the cursor in react slate-editor.

I tried to do it in 2 ways.

First:

// This code saving key in offset in variables
const nativeSelection = this.getSelectedText();
const nativeRange = nativeSelection.getRangeAt(0);
    const range = findRange(nativeRange, this.editor);
const offset = nativeRange.endOffset;
const key = range.anchor.key;

// OnChange is triggered by running the next line and cursor moves back
this.editor.blur();

// Trying to move to the cursor
this.editor.moveTo(key, offset);
Run Code Online (Sandbox Code Playgroud)

Second:

const nativeSelection = this.getSelectedText();
const nativeRange = nativeSelection.getRangeAt(0); …
Run Code Online (Sandbox Code Playgroud)

reactjs react-slate

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