This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Attempts to get the ViewHolder for the given position, either from the Recycler scrap, | |
* cache, the RecycledViewPool, or creating it directly. | |
* <p> | |
* If a deadlineNs other than {@link #FOREVER_NS} is passed, this method early return | |
* rather than constructing or binding a ViewHolder if it doesn't think it has time. | |
* If a ViewHolder must be constructed and not enough time remains, null is returned. If a | |
* ViewHolder is aquired and must be bound but not enough time remains, an unbound holder is | |
* returned. Use {@link ViewHolder#isBound()} on the returned object to check for this. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.java.test.thread; | |
import java.util.concurrent.atomic.AtomicInteger; | |
/** | |
* Created by John on 18/3/19. | |
* 使用三个线程使得ABC 循环输出十次 | |
*/ | |
public class PrintABC { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public String commonUpload(Context cxt, String url, Map<String, String> params, | |
List<UploadFile> uploadFiles, Map<String, String> properties, String encoding) throws IOException { | |
// 定义POST体中分割线 | |
String BOUNDARY = "124324471239807512395795"; | |
String PREFIX = "--"; | |
String ENDLINE = "\r\n"; | |
String CONTENT_TYPE = "multipart/form-data"; | |
// long contentLen = 0; | |
// 1. 拼接HTTP 请求头 | |
HttpURLConnection httpConn = NetworkUtils.openHttpURLConnection(cxt, url); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, render_template, jsonify, request | |
from threading import Timer, Thread | |
from time import sleep | |
app = Flask(__name__) | |
@app.route("/api/<method>") | |
def api(method): | |
data = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String cameraFileName; | |
@Override | |
public void choiceAvatarFromCamera() { | |
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | |
cameraFileName = Constants.DOWNLOAD_IMAGE_PATH + System.currentTimeMillis(); | |
File file = new File(Constants.DOWNLOAD_IMAGE_PATH); | |
if(!file.exists()){ | |
file.mkdirs(); | |
} | |
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(cameraFileName))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dianxinos.wifimgr.widget; | |
import android.graphics.Camera; | |
import android.graphics.Matrix; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.view.animation.Animation; | |
import android.view.animation.DecelerateInterpolator; | |
import android.view.animation.Interpolator; | |
import android.view.animation.Transformation; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 16进制MD5值 | |
* @param message | |
* @return | |
* @throws Exception | |
*/ | |
private String hexdigest(String message) throws Exception { | |
String hd; | |
MessageDigest md5 = MessageDigest.getInstance("MD5"); | |
md5.update(message.getBytes()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String decrypt(String encryptedData) throws Exception { | |
Key key = new SecretKeySpec(KEY.getBytes(), "AES"); | |
Cipher c = Cipher.getInstance("AES/CBC/NoPadding"); | |
IvParameterSpec iv = new IvParameterSpec(IV.getBytes()); | |
c.init(Cipher.DECRYPT_MODE, key,iv); | |
byte[] decValue = c.doFinal(encryptedData.getBytes()); | |
String decryptedValue = new String(decValue); | |
return decryptedValue; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (WifiManager.NETWORK_STATE_CHANGED_ACTION.equals(intent.getAction())) { | |
Parcelable parcelableExtra = intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO); | |
if (null != parcelableExtra) { | |
NetworkInfo networkInfo = (NetworkInfo) parcelableExtra; | |
if (networkInfo.getState() == State.CONNECTED) { | |
netManager.start(true); | |
} else if (networkInfo.getState() == State.DISCONNECTED) { | |
Const.IS_CONNECTED = false; | |
netManager.close(); | |
Intent netDis = new Intent(Const.NET_STATE_DISCONNECT); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import selenium | |
from scrapy.spider import BaseSpider | |
from scrapy.http import Request | |
import time | |
import lxml.html | |
class SeleniumSprider(BaseSpider): | |
name = "selenium" | |
allowed_domains = ['selenium.com'] | |
start_urls = ["http://localhost"] |
NewerOlder