月度归档:2017年06月

413 Request Entity Too Large

http://blog.csdn.net/fdipzone/article/details/45544497

Syntax: client_max_body_size size;
Default:
client_max_body_size 1m;
Context: httpserverlocation

Sets the maximum allowed size of the client request body, specified in the “Content-Length” request header field. If the size in a request exceeds the configured value, the 413 (Request Entity Too Large) error is returned to the client. Please be aware that browsers cannot correctly display this error. Setting size to 0 disables checking of client request body size.

最简单的Weex图片加载器(IWXImgLoaderAdapter 简单实现)

package pro.yanglong.weex;


import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.ImageView;

import com.taobao.weex.adapter.IWXImgLoaderAdapter;
import com.taobao.weex.common.WXImageStrategy;
import com.taobao.weex.dom.WXImageQuality;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;

/**
 * Created by YangLong on 2017/11/13.
 */

public class ImageAdapter implements IWXImgLoaderAdapter {
    @SuppressLint("StaticFieldLeak")
    @Override
    public void setImage(String url, ImageView view, WXImageQuality quality, WXImageStrategy strategy) {
        if (url == null) {
            return;
        }
        Log.d("hello", url);

        final Bitmap[] bmp = new Bitmap[1];
        final String _url = url;
        final ImageView _view = view;

        new AsyncTask() {
            @Override
            protected Void doInBackground(Void... params) {
                InputStream in = null;
                try {
                    in = new URL(_url).openStream();
                    bmp[0] = BitmapFactory.decodeStream(in);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                return null;
            }

            @Override
            protected void onPostExecute(Void result) {
                if (bmp[0] != null)
                    _view.setImageBitmap(bmp[0]);
            }

        }.execute();
    }
}

相关知识:

在Java语言中,线程是一种特殊的对象,它必须由Thread类或其子(孙)类来创建。通常有两种方法来创建线程:其一,使用型构为Thread(Runnable)的构造子将一个实现了Runnable接口的对象包装成一个线程,其二,从Thread类派生出子类并重写run方法,使用该子类创建的对象即为线程。值得注意的是Thread类已经实现了Runnable接口,因此,任何一个线程均有它的run方法,而run方法中包含了线程所要运行的代码。线程的活动由一组方法来控制。Java语言支持多个线程的同时执行,并提供多线程之间的同步机制(关键字为synchronized)。

Failed to prepare TableSyncChunk plugin: Cannot chunk table `xxx`.`xxx` using the character column skey, most likely because all values start with the same character.

Failed to prepare TableSyncChunk plugin: Cannot chunk table `doufu`.`user_login` using the character column skey, most likely because all values start with the same character. This table must be synced separately by specifying a list of –algorithms without the Chunk algorithm at /usr/bin/pt-table-sync line 4088. while doing doufu.user_login on web3


pt-table-sync --print --execute --databases xxx h=master,u=repl,p=xxx,D=xxx,t=xxx h=slave --no-check-slave --lock=1 --charset=utf8mb4 --algorithms=Nibble,GroupBy,Stream

加参数 –algorithms=Nibble,GroupBy,Stream