小编Nav*_*hna的帖子

Android pre-lollipop设备发出错误"SSL握手中止:ssl = 0x618d9c18:系统调用期间的I/O错误,同级连接重置"

我有这个奇怪的问题,其中改造不断抛弃我

"SSL握手中止:ssl = 0x618d9c18:系统调用期间的I/O错误,同级连接重置"

在kitkat,而相同的代码在棒棒糖设备中工作正常.我使用如下的OkHttpClient客户端

public OkHttpClient getUnsafeOkHttpClient() {
    try {
        final TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
            @Override
            public void checkClientTrusted(
                    java.security.cert.X509Certificate[] chain,
                    String authType) {
            }
            @Override
            public void checkServerTrusted(
                    java.security.cert.X509Certificate[] chain,
                    String authType) {
            }
            @Override
            public java.security.cert.X509Certificate[] getAcceptedIssuers() {
                return new java.security.cert.X509Certificate[0];
            }
        } };

        int cacheSize = 10 * 1024 * 1024; // 10 MB
        Cache cache = new Cache(getCacheDir(), cacheSize);
        final SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
        sslContext.init(null, trustAllCerts,
                new java.security.SecureRandom());
        final SSLSocketFactory …
Run Code Online (Sandbox Code Playgroud)

android sslhandshakeexception android-4.4-kitkat tls1.2 retrofit2

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

Android主题更改复选框项目文本颜色

如何在Android Studio的styles.xml中更改复选框视图的文本颜色?

我想创建一个主题,其中所有复选框项都是与默认黑色不同的颜色,如:

在此输入图像描述

除了我希望盒子本身与文本颜色相同.

我应该在我的主题中使用以下内容吗?

<item name="android:checkboxStyle">@style/App_CheckboxStyle</item>
Run Code Online (Sandbox Code Playgroud)

android android-theme

9
推荐指数
4
解决办法
8029
查看次数

使用未定义的常量REQUEST_URI - 在第73行的functions.php中假设为'REQUEST_URI'

我最近将我的网站移动到一个新的服务器,我的数据库配置完美,但我不断收到此错误,无法访问我的wp-admin:

使用未定义的常量REQUEST_URI - 在第73行的/www/docs/wordpress/wp-content/themes/twentyfifteen/functions.php中假定为"REQUEST_URI"

每个主题都会出现此错误,即使我的所有插件都已禁用.

php wordpress

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

如何在iPhoneX上设置statusBar颜色?

我使用navigationController,我隐藏了navigationBar,如何在iPhoneX上设置statusBar颜色?我不想设置self.view.backgroundColor

iPhoneX缺口颜色

在此输入图像描述

iphone-x

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

'ls'不被识别为内部或外部命令,可操作程序或批处理文件

'ls'不被识别为内部或外部命令,可操作程序或批处理文件.当我尝试浏览文件夹的文件时出现此错误.

  • cmd定期打开(不是管理员).
  • 我最近为python下载了anaconda.在安装过程中,有一段时间我允许添加一个不推荐的PATH.'ls'以前工作得很好

    这是路径

    在此输入图像描述

command cmd ls batch-file

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

如何在达到一定距离后停止在Recycler视图中滑动项目

我在android中有一个Recycler View.我已经附上了ItemTouchHelper它.我只启用了从左到右的滑动.

因此,当我滑动Recycler视图的任何项目时,项目开始向右移动,在左侧我绘制文本.这可以 .我的要求是,我希望允许用户仅滑动到一定距离,当达到该距离并且用户松开触摸时,正在滑动的项目应该返回到其向左的位置.

问题是,当我从左向右滑动时,视图会完全滑出屏幕.如何限制它只能滑到一定距离?我该怎么做 ?

这是我的项目触摸回调的代码:

private void initSwipe(){
    ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) {
            @Override
            public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
                return false;
            }

            @Override
            public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
                int position = viewHolder.getAdapterPosition();
            }

        @Override
        public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
            ViewHolder viewHolder1 = (ViewHolder)viewHolder;
            int position = viewHolder1.getAdapterPosition();
            MyItem item = dataList.get(position);
            if (item==null )return;
            if(actionState == …
Run Code Online (Sandbox Code Playgroud)

android android-recyclerview itemtouchhelper

7
推荐指数
1
解决办法
1525
查看次数

Sonarqube v.4 TFS任务"发布分析结果"抛出错误"无法获取指标"

在TFS上,我无法运行"发布分析结果"以在TFS网页上发布质量门.其他任务"在SonarQube上准备分析"和"运行代码分析"成功运行.

错误消息是:

[错误] [SQ]无法获取指标

[错误] [SQ]无法获取ID'FWK9NiOFibiMfA2L0BHo'的任务

尽管有错误消息,当我访问url http:// localhost:9000/api/ce/task?id = FWK9NiOFibiMfA2L0BHo时,我得到一个带有任务信息的json响应.

c# tfs sonarqube sonarqube-scan

7
推荐指数
1
解决办法
1214
查看次数

有什么办法可以只在工具提示(Recharts)中显示悬停线?

我曾尝试使用自定义工具提示,但我的问题是我不知道如何获取悬停的有效负载的索引。我想要的是在工具提示中只显示悬停线的值。例如,我将鼠标悬停在值 1 行上,因此我只想在工具提示中仅显示值 1。

所以这是图像

在此处输入图片说明

这是我的代码,虽然我删除了自定义工具提示:

    export default class LineChartPresentational extends React.Component {
      constructor(props) {
      super();
      this.state = {
          clickedLineid: '' }}


      changeStrokeclick(data) {
         console.log(data, 'see what is coming');
         this.setState({clickedLineID: data} ) }

      render() {
         return ( 
            <div>
            <div id="lclastdataref" style={{ textAlign: 'right' }}>
            <span>Last Data Refresh: {linechartdf.date} </span>
            </div>
            <div className='line-charts'>
            <div className="line-chart-wrapper " style={{ width: window.innerWidth / 2, height: window.innerHeight / 2, }}>

        <ResponsiveContainer>
          <LineChart
            width={width} height={height} margin={{ top: 20, right: 20, bottom: 20, left: 20 }} data={linechartdata} …
Run Code Online (Sandbox Code Playgroud)

javascript css reactjs recharts

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

Android系统.在RecyclerView中搜索和过滤

翻译使用"谷歌翻译"!

简要说明问题.我决定尝试使用RecyclerView.像搜索listView这样的现成解决方案,没有必要全部实现.所以我找到了一个解决方案,如果在源代码的底部需要一个解决方案,但是存在问题.有一个列表,它显示标题,当您点击第二个回合Activiti中已有标题和完整描述的任何项目时.实现我喜欢:在MainActivity中我从数据库(使用Sugar ORM)头文件和id加载

ArrayList<String> arrTitle = new ArrayList<>();
for(Contact contact:allContacts){
arrTitle.add(contact.title);
}

ArrayList<String> arrId = new ArrayList<>();
for(Contact contact:allContacts){
long  i = contact.getId();
String str = Long.toString(i);
arrId.add(str);
}
Run Code Online (Sandbox Code Playgroud)

然后将它们传送到适配器

mAdapter = new RecyclerAdapter(arrTitle,  arrId);
Run Code Online (Sandbox Code Playgroud)

适配器Recycler Adapter我得到值推导标题到列表,第二个传递id活动

        @Override
public void onBindViewHolder(ViewHolder holder, int position) {

// Convert the id to the array
idTab = new String[mId.size()];
for (int i = 0; i != mId.size(); i++) {
    idTab[i] = mId.get(i);
}

// Element position
final int idvadaptere = position;
// Display …
Run Code Online (Sandbox Code Playgroud)

java android filter android-recyclerview

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

@GetMapping不会生成响应内容类型application / json

我正在用Spring 4和注释大手笔开发API Rest。到目前为止,我一直在使用
'@RequestMapping(value = "/myapi/{id}", method = RequestMethod.GET, produces = "application/json; charset=UTF-8")',但是我想将简化版本与GET:一起使用 @GetMapping("/myapi/{id}")。问题是,摇摇欲坠没有正确显示响应内容类型:我得到了以下内容:

响应内容类型/

我尝试将HttpHeaders对象添加到响应实体,但不起作用。

你能帮助我吗?

spring swagger

3
推荐指数
1
解决办法
9714
查看次数

包含的工具栏有奇怪的边距(Android 约束布局)

我尝试使用约束布局重建我的工具栏,但有些事情我自己无法解决。

我在另一个布局中使用了包含的工具栏,一切看起来都不错,但是包含的工具栏有奇怪的左边距。我检查了所有边距和填充,但仍然......

图片:

包含工具栏的奇怪边距

在此处输入图片说明

如您所见,父工具栏和包含的 new_toolbar 之间有一个空格

活动.xml:

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="56dp"
    android:background="?attr/colorPrimary"
    android:minHeight="?attr/actionBarSize"
    android:padding="0dp"
    app:titleTextColor="@android:color/white">

    <include
        android:id="@+id/actionBar"
        layout="@layout/new_toolbar" />

</android.support.v7.widget.Toolbar>

<ListView
    android:id="@+id/listAccount"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="56dp"/>

<android.support.design.widget.BottomNavigationView
    android:id="@+id/bottom_navigation"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"

    android:layout_alignParentBottom="true"
    app:layout_anchor="@id/listAccount"
    app:layout_anchorGravity="bottom"

    app:itemBackground="@color/white"
    app:itemIconTint="@drawable/selector_bottom_navigation"
    app:itemTextColor="@drawable/selector_bottom_navigation"
    app:menu="@menu/bottom_navigation"/>
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

new_toolbar.xml

<ImageButton
    android:id="@+id/mainIcon"

    app:layout_constraintTop_toTopOf="parent"
    android:layout_marginTop="16dp"
    app:layout_constraintLeft_toLeftOf="parent"
    android:layout_marginLeft="16dp"

    android:layout_height="24dp"
    android:layout_width="24dp"

    android:background="@null"
    android:tint="@color/white"
    app:srcCompat="@drawable/ic_menu_black_24dp" />

<TextView
    android:id="@+id/title"

    app:layout_constraintTop_toTopOf="parent"
    android:layout_marginTop="14dp"
    app:layout_constraintLeft_toRightOf="@+id/mainIcon"
    android:layout_marginLeft="32dp"

    android:layout_height="24dp"
    android:layout_width="wrap_content"

    android:fontFamily=" Roboto Semibold"
    android:text="Title"
    android:textColor="@color/white"
    android:textSize="20sp" />

<ImageButton
    android:id="@+id/rightIcon1"

    app:layout_constraintTop_toTopOf="parent"
    android:layout_marginTop="16dp"
    app:layout_constraintRight_toRightOf="parent"
    android:layout_marginRight="16dp"

    android:layout_height="24dp"
    android:layout_width="24dp"

    android:background="@null"
    android:tint="@color/white"
    app:srcCompat="@drawable/ic_add_black_24dp" />

<ImageButton
    android:id="@+id/rightIcon2" …
Run Code Online (Sandbox Code Playgroud)

android android-layout android-constraintlayout

3
推荐指数
1
解决办法
990
查看次数

Django 管理器不可用;“auth.User”已替换为“users.MyUser”

我在 Django 1.11 中创建了自定义 UserModel,我需要一个允许用户登录的函数\n我认为我的自定义用户模型与我的函数不兼容\n我该如何修复?

\n\n

请参阅下图中的错误消息:

\n\n

在此输入图像描述

\n\n

用户.models.py

\n\n
from django.db import models\nfrom django.contrib.auth.models import AbstractBaseUser, BaseUserManager\nfrom apps.teams.models import Team\nimport uuid\n\nclass MyUserManager(BaseUserManager):\n    def _create_user(self, username, password, **extra_kwargs):\n        user = self.model(username=username, **extra_kwargs)\n        user.set_password(password)\n        user.save(using=self._db)\n        return user\n\n    def create_superuser(self, username, password, **extra_kwargs):\n        extra_kwargs.setdefault(\'is_active\', True)\n        extra_kwargs.setdefault(\'is_superuser\', True)\n        extra_kwargs.setdefault(\'is_staff\', True)\n\n        if extra_kwargs.get(\'is_superuser\', None) is not True:\n            raise ValueError(\'\xea\xb4\x80\xeb\xa6\xac\xec\x9e\x90 \xea\xb6\x8c\xed\x95\x9c\xec\x9d\xb4 \xed\x95\x84\xec\x9a\x94\xed\x95\xa9\xeb\x8b\x88\xeb\x8b\xa4.\')\n\n        return self._create_user(username, password, **extra_kwargs)\n\nclass MyUser(AbstractBaseUser):\n    """\n    \xec\x9c\xa0\xec\xa0\x80 \xeb\xaa\xa8\xeb\x8d\xb8\n    """\n    POSITION_TYPES = (\n        (\'a\', \'\xeb\x8c\x80\xed\x91\x9c\'),\n        (\'b\', \'\xed\x8c\x80\xec\x9e\xa5\'),\n        (\'c\', \'\xea\xb3\xbc\xec\x9e\xa5\'),\n        (\'d\', \'\xeb\x8c\x80\xeb\xa6\xac\'),\n        (\'e\', \'\xec\xa3\xbc\xec\x9e\x84\'),\n …
Run Code Online (Sandbox Code Playgroud)

python django django-models django-users

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

Java android moshi 将 Json 解析为对象

我使用 moshi 将 JSon 解析为 Object 。这是我的 JSon:

[{
   "id": 4,
   "phone":    {
      "id": 3,
      "imei": "356938035643801",
      "description": "Marek Kowalski"
   },
   "user":    {
      "id": 3,
      "username": "marek.kowalski",
      "first_name": "Marek",
      "last_name": "Kowalski"
   },
   "user_id": 3,
   "message": "Podejrzane zachowanie, sprawd??.",
   "date_time_data": "2017-09-05T22:26:44.916927Z",
   "longitude": 19.934113,
   "latitude": 50.075086,
   "confirm": 0,
   "changetime": "2017-09-05T22:26:44.930357Z",
   "has_coordinates": 1
}]
Run Code Online (Sandbox Code Playgroud)

这是我的对象:

public class Message {

    String message;
    double longitude;
    double latitude;
    int confirm;

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    } …
Run Code Online (Sandbox Code Playgroud)

java android json

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