本文是 Android RxJava2+Retrofit2+OkHttp3 的使用(一) --基础篇 Retrofit2 的使用

本文的目标是用 Retrofit写一个网络请求:

本文以从获取天气预报接口 (具体接口查看上文 免费天气预报接口)为例,讲解 Retrofit2 的使用

废话不多说,开撸

一、添加依赖

在build.gradle文件中添加如下配置

//retrofit2
compile 'com.squareup.retrofit2:retrofit:2.3.0'//导入retrofit
compile 'com.squareup.retrofit2:converter-gson:2.3.0'//转换器,请求结果转换成Model

二、创建Bean

根据接口返回的JSon数据,使用GsonFormat插件自动创建 WeatherBean 文件 (GsonFormat插件 的安装方法和其余插件安装方法并无二致)

1)打开链接http://t.weather.sojson.com/api/weather/city/101030100,然后复制返回的json数据

2)新建WeatherBean.java ,然后 Alt + Delete ,选择GsonFormat,将复制到的JSON数据赋值进去,点击 “确定” 生成 即可

这是我自动生成的文件:

package com.jack.basemvp.bean;

import java.util.List;

/**
* 由GsonFormat 生成
*/
public class WeatherBean { /**
* time : 2019-04-20 19:11:47
* cityInfo : {"city":"天津市","cityId":"101030100","parent":"天津","updateTime":"18:32"}
* date : 20190420
* message : Success !
* status : 200
* data : {"shidu":"46%","pm25":49,"pm10":87,"quality":"良","wendu":"14","ganmao":"极少数敏感人群应减少户外活动","yesterday":{"date":"19","sunrise":"05:32","high":"高温 18.0℃","low":"低温 11.0℃","sunset":"18:51","aqi":58,"ymd":"2019-04-19","week":"星期五","fx":"东南风","fl":"3-4级","type":"阴","notice":"不要被阴云遮挡住好心情"},"forecast":[{"date":"20","sunrise":"05:30","high":"高温 16.0℃","low":"低温 10.0℃","sunset":"18:52","aqi":64,"ymd":"2019-04-20","week":"星期六","fx":"东北风","fl":"<3级","type":"小雨","notice":"雨虽小,注意保暖别感冒"},{"date":"21","sunrise":"05:29","high":"高温 20.0℃","low":"低温 12.0℃","sunset":"18:53","aqi":72,"ymd":"2019-04-21","week":"星期日","fx":"东南风","fl":"3-4级","type":"晴","notice":"愿你拥有比阳光明媚的心情"},{"date":"22","sunrise":"05:27","high":"高温 26.0℃","low":"低温 16.0℃","sunset":"18:54","aqi":89,"ymd":"2019-04-22","week":"星期一","fx":"南风","fl":"<3级","type":"多云","notice":"阴晴之间,谨防紫外线侵扰"},{"date":"23","sunrise":"05:26","high":"高温 26.0℃","low":"低温 16.0℃","sunset":"18:55","aqi":91,"ymd":"2019-04-23","week":"星期二","fx":"南风","fl":"<3级","type":"多云","notice":"阴晴之间,谨防紫外线侵扰"},{"date":"24","sunrise":"05:25","high":"高温 22.0℃","low":"低温 12.0℃","sunset":"18:56","aqi":66,"ymd":"2019-04-24","week":"星期三","fx":"东风","fl":"4-5级","type":"阴","notice":"不要被阴云遮挡住好心情"},{"date":"25","sunrise":"05:23","high":"高温 19.0℃","low":"低温 12.0℃","sunset":"18:57","aqi":41,"ymd":"2019-04-25","week":"星期四","fx":"东南风","fl":"<3级","type":"晴","notice":"愿你拥有比阳光明媚的心情"},{"date":"26","sunrise":"05:22","high":"高温 21.0℃","low":"低温 12.0℃","sunset":"18:58","ymd":"2019-04-26","week":"星期五","fx":"东南风","fl":"3-4级","type":"多云","notice":"阴晴之间,谨防紫外线侵扰"},{"date":"27","sunrise":"05:21","high":"高温 21.0℃","low":"低温 10.0℃","sunset":"18:59","ymd":"2019-04-27","week":"星期六","fx":"南风","fl":"<3级","type":"阴","notice":"不要被阴云遮挡住好心情"},{"date":"28","sunrise":"05:19","high":"高温 23.0℃","low":"低温 12.0℃","sunset":"19:00","ymd":"2019-04-28","week":"星期日","fx":"北风","fl":"<3级","type":"阴","notice":"不要被阴云遮挡住好心情"},{"date":"29","sunrise":"05:18","high":"高温 22.0℃","low":"低温 12.0℃","sunset":"19:01","ymd":"2019-04-29","week":"星期一","fx":"北风","fl":"3-4级","type":"多云","notice":"阴晴之间,谨防紫外线侵扰"},{"date":"30","sunrise":"05:17","high":"高温 23.0℃","low":"低温 14.0℃","sunset":"19:02","ymd":"2019-04-30","week":"星期二","fx":"东南风","fl":"3-4级","type":"晴","notice":"愿你拥有比阳光明媚的心情"},{"date":"01","sunrise":"05:15","high":"高温 24.0℃","low":"低温 16.0℃","sunset":"19:03","ymd":"2019-05-01","week":"星期三","fx":"东南风","fl":"<3级","type":"多云","notice":"阴晴之间,谨防紫外线侵扰"},{"date":"02","sunrise":"05:14","high":"高温 25.0℃","low":"低温 15.0℃","sunset":"19:04","ymd":"2019-05-02","week":"星期四","fx":"东南风","fl":"3-4级","type":"阴","notice":"不要被阴云遮挡住好心情"},{"date":"03","sunrise":"05:13","high":"高温 24.0℃","low":"低温 14.0℃","sunset":"19:05","ymd":"2019-05-03","week":"星期五","fx":"西南风","fl":"4-5级","type":"阴","notice":"不要被阴云遮挡住好心情"},{"date":"04","sunrise":"05:12","high":"高温 24.0℃","low":"低温 14.0℃","sunset":"19:06","ymd":"2019-05-04","week":"星期六","fx":"东南风","fl":"<3级","type":"阴","notice":"不要被阴云遮挡住好心情"}]}
*/ private String time;
private CityInfoBean cityInfo;
private String date;
private String message;
private int status;
private DataBean data; public String getTime() {
return time;
} public void setTime(String time) {
this.time = time;
} public CityInfoBean getCityInfo() {
return cityInfo;
} public void setCityInfo(CityInfoBean cityInfo) {
this.cityInfo = cityInfo;
} public String getDate() {
return date;
} public void setDate(String date) {
this.date = date;
} public String getMessage() {
return message;
} public void setMessage(String message) {
this.message = message;
} public int getStatus() {
return status;
} public void setStatus(int status) {
this.status = status;
} public DataBean getData() {
return data;
} public void setData(DataBean data) {
this.data = data;
} public static class CityInfoBean {
/**
* city : 天津市
* cityId : 101030100
* parent : 天津
* updateTime : 18:32
*/ private String city;
private String cityId;
private String parent;
private String updateTime; public String getCity() {
return city;
} public void setCity(String city) {
this.city = city;
} public String getCityId() {
return cityId;
} public void setCityId(String cityId) {
this.cityId = cityId;
} public String getParent() {
return parent;
} public void setParent(String parent) {
this.parent = parent;
} public String getUpdateTime() {
return updateTime;
} public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
} public static class DataBean {
/**
* shidu : 46%
* pm25 : 49.0
* pm10 : 87.0
* quality : 良
* wendu : 14
* ganmao : 极少数敏感人群应减少户外活动
* yesterday : {"date":"19","sunrise":"05:32","high":"高温 18.0℃","low":"低温 11.0℃","sunset":"18:51","aqi":58,"ymd":"2019-04-19","week":"星期五","fx":"东南风","fl":"3-4级","type":"阴","notice":"不要被阴云遮挡住好心情"}
* forecast : [{"date":"20","sunrise":"05:30","high":"高温 16.0℃","low":"低温 10.0℃","sunset":"18:52","aqi":64,"ymd":"2019-04-20","week":"星期六","fx":"东北风","fl":"<3级","type":"小雨","notice":"雨虽小,注意保暖别感冒"},{"date":"21","sunrise":"05:29","high":"高温 20.0℃","low":"低温 12.0℃","sunset":"18:53","aqi":72,"ymd":"2019-04-21","week":"星期日","fx":"东南风","fl":"3-4级","type":"晴","notice":"愿你拥有比阳光明媚的心情"},{"date":"22","sunrise":"05:27","high":"高温 26.0℃","low":"低温 16.0℃","sunset":"18:54","aqi":89,"ymd":"2019-04-22","week":"星期一","fx":"南风","fl":"<3级","type":"多云","notice":"阴晴之间,谨防紫外线侵扰"},{"date":"23","sunrise":"05:26","high":"高温 26.0℃","low":"低温 16.0℃","sunset":"18:55","aqi":91,"ymd":"2019-04-23","week":"星期二","fx":"南风","fl":"<3级","type":"多云","notice":"阴晴之间,谨防紫外线侵扰"},{"date":"24","sunrise":"05:25","high":"高温 22.0℃","low":"低温 12.0℃","sunset":"18:56","aqi":66,"ymd":"2019-04-24","week":"星期三","fx":"东风","fl":"4-5级","type":"阴","notice":"不要被阴云遮挡住好心情"},{"date":"25","sunrise":"05:23","high":"高温 19.0℃","low":"低温 12.0℃","sunset":"18:57","aqi":41,"ymd":"2019-04-25","week":"星期四","fx":"东南风","fl":"<3级","type":"晴","notice":"愿你拥有比阳光明媚的心情"},{"date":"26","sunrise":"05:22","high":"高温 21.0℃","low":"低温 12.0℃","sunset":"18:58","ymd":"2019-04-26","week":"星期五","fx":"东南风","fl":"3-4级","type":"多云","notice":"阴晴之间,谨防紫外线侵扰"},{"date":"27","sunrise":"05:21","high":"高温 21.0℃","low":"低温 10.0℃","sunset":"18:59","ymd":"2019-04-27","week":"星期六","fx":"南风","fl":"<3级","type":"阴","notice":"不要被阴云遮挡住好心情"},{"date":"28","sunrise":"05:19","high":"高温 23.0℃","low":"低温 12.0℃","sunset":"19:00","ymd":"2019-04-28","week":"星期日","fx":"北风","fl":"<3级","type":"阴","notice":"不要被阴云遮挡住好心情"},{"date":"29","sunrise":"05:18","high":"高温 22.0℃","low":"低温 12.0℃","sunset":"19:01","ymd":"2019-04-29","week":"星期一","fx":"北风","fl":"3-4级","type":"多云","notice":"阴晴之间,谨防紫外线侵扰"},{"date":"30","sunrise":"05:17","high":"高温 23.0℃","low":"低温 14.0℃","sunset":"19:02","ymd":"2019-04-30","week":"星期二","fx":"东南风","fl":"3-4级","type":"晴","notice":"愿你拥有比阳光明媚的心情"},{"date":"01","sunrise":"05:15","high":"高温 24.0℃","low":"低温 16.0℃","sunset":"19:03","ymd":"2019-05-01","week":"星期三","fx":"东南风","fl":"<3级","type":"多云","notice":"阴晴之间,谨防紫外线侵扰"},{"date":"02","sunrise":"05:14","high":"高温 25.0℃","low":"低温 15.0℃","sunset":"19:04","ymd":"2019-05-02","week":"星期四","fx":"东南风","fl":"3-4级","type":"阴","notice":"不要被阴云遮挡住好心情"},{"date":"03","sunrise":"05:13","high":"高温 24.0℃","low":"低温 14.0℃","sunset":"19:05","ymd":"2019-05-03","week":"星期五","fx":"西南风","fl":"4-5级","type":"阴","notice":"不要被阴云遮挡住好心情"},{"date":"04","sunrise":"05:12","high":"高温 24.0℃","low":"低温 14.0℃","sunset":"19:06","ymd":"2019-05-04","week":"星期六","fx":"东南风","fl":"<3级","type":"阴","notice":"不要被阴云遮挡住好心情"}]
*/ private String shidu;
private double pm25;
private double pm10;
private String quality;
private String wendu;
private String ganmao;
private YesterdayBean yesterday;
private List<ForecastBean> forecast; public String getShidu() {
return shidu;
} public void setShidu(String shidu) {
this.shidu = shidu;
} public double getPm25() {
return pm25;
} public void setPm25(double pm25) {
this.pm25 = pm25;
} public double getPm10() {
return pm10;
} public void setPm10(double pm10) {
this.pm10 = pm10;
} public String getQuality() {
return quality;
} public void setQuality(String quality) {
this.quality = quality;
} public String getWendu() {
return wendu;
} public void setWendu(String wendu) {
this.wendu = wendu;
} public String getGanmao() {
return ganmao;
} public void setGanmao(String ganmao) {
this.ganmao = ganmao;
} public YesterdayBean getYesterday() {
return yesterday;
} public void setYesterday(YesterdayBean yesterday) {
this.yesterday = yesterday;
} public List<ForecastBean> getForecast() {
return forecast;
} public void setForecast(List<ForecastBean> forecast) {
this.forecast = forecast;
} public static class YesterdayBean {
/**
* date : 19
* sunrise : 05:32
* high : 高温 18.0℃
* low : 低温 11.0℃
* sunset : 18:51
* aqi : 58.0
* ymd : 2019-04-19
* week : 星期五
* fx : 东南风
* fl : 3-4级
* type : 阴
* notice : 不要被阴云遮挡住好心情
*/ private String date;
private String sunrise;
private String high;
private String low;
private String sunset;
private double aqi;
private String ymd;
private String week;
private String fx;
private String fl;
private String type;
private String notice; public String getDate() {
return date;
} public void setDate(String date) {
this.date = date;
} public String getSunrise() {
return sunrise;
} public void setSunrise(String sunrise) {
this.sunrise = sunrise;
} public String getHigh() {
return high;
} public void setHigh(String high) {
this.high = high;
} public String getLow() {
return low;
} public void setLow(String low) {
this.low = low;
} public String getSunset() {
return sunset;
} public void setSunset(String sunset) {
this.sunset = sunset;
} public double getAqi() {
return aqi;
} public void setAqi(double aqi) {
this.aqi = aqi;
} public String getYmd() {
return ymd;
} public void setYmd(String ymd) {
this.ymd = ymd;
} public String getWeek() {
return week;
} public void setWeek(String week) {
this.week = week;
} public String getFx() {
return fx;
} public void setFx(String fx) {
this.fx = fx;
} public String getFl() {
return fl;
} public void setFl(String fl) {
this.fl = fl;
} public String getType() {
return type;
} public void setType(String type) {
this.type = type;
} public String getNotice() {
return notice;
} public void setNotice(String notice) {
this.notice = notice;
}
} public static class ForecastBean {
/**
* date : 20
* sunrise : 05:30
* high : 高温 16.0℃
* low : 低温 10.0℃
* sunset : 18:52
* aqi : 64.0
* ymd : 2019-04-20
* week : 星期六
* fx : 东北风
* fl : <3级
* type : 小雨
* notice : 雨虽小,注意保暖别感冒
*/ private String date;
private String sunrise;
private String high;
private String low;
private String sunset;
private double aqi;
private String ymd;
private String week;
private String fx;
private String fl;
private String type;
private String notice; public String getDate() {
return date;
} public void setDate(String date) {
this.date = date;
} public String getSunrise() {
return sunrise;
} public void setSunrise(String sunrise) {
this.sunrise = sunrise;
} public String getHigh() {
return high;
} public void setHigh(String high) {
this.high = high;
} public String getLow() {
return low;
} public void setLow(String low) {
this.low = low;
} public String getSunset() {
return sunset;
} public void setSunset(String sunset) {
this.sunset = sunset;
} public double getAqi() {
return aqi;
} public void setAqi(double aqi) {
this.aqi = aqi;
} public String getYmd() {
return ymd;
} public void setYmd(String ymd) {
this.ymd = ymd;
} public String getWeek() {
return week;
} public void setWeek(String week) {
this.week = week;
} public String getFx() {
return fx;
} public void setFx(String fx) {
this.fx = fx;
} public String getFl() {
return fl;
} public void setFl(String fl) {
this.fl = fl;
} public String getType() {
return type;
} public void setType(String type) {
this.type = type;
} public String getNotice() {
return notice;
} public void setNotice(String notice) {
this.notice = notice;
}
}
}
}

三、创建Api接口文件 WeatherApi.java

package com.jack.basemvp.api;

import com.jack.basemvp.bean.WeatherBean;

import java.util.Map;

import io.reactivex.Observable;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Path;
import retrofit2.http.QueryMap; public interface WeatherApi {
String BASE_URL = "http://t.weather.sojson.com/"; /**
* 普通方式
*
* @param cityId
* @return
*/
//get 传一个参数
@GET("api/weather/city/{cityId}")
Call<WeatherBean> weatherInfo(@Path("cityId") int cityId); //get 传多个参数 用 & 拼接
@GET("api/weather/city/101030100?")
Call<WeatherBean> weatherInfo2(@QueryMap Map<String, String> params); }

四、主UI界面中使用

RequestCommonActivity.java
package com.jack.basemvp.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView; import com.jack.basemvp.R;
import com.jack.basemvp.api.NewsRxApi;
import com.jack.basemvp.bean.WeatherBean;
import com.jack.basemvp.api.WeatherApi;
import com.jack.basemvp.util.http.RetrofitServiceManager; import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit; import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import okhttp3.OkHttpClient;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory; public class RequestCommonActivity extends AppCompatActivity implements View.OnClickListener {
private TextView tv_result;
private Button btn_req1, btn_req2; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_request_common); initView();
} private void initView() {
tv_result = (TextView) findViewById(R.id.tv_result);
btn_req1 = (Button) findViewById(R.id.btn_req1);
btn_req2 = (Button) findViewById(R.id.btn_req2);
btn_req1.setOnClickListener(this);
btn_req2.setOnClickListener(this);
} @Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btn_req1:
requestWeather1();
break;
case R.id.btn_req2:
requestWeather2();
break;
}
} //get 请求 传一个参数到url中
private void requestWeather1() {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(WeatherApi.BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
WeatherApi api = retrofit.create(WeatherApi.class);
int cityId = ; //城市ID
api.weatherInfo(cityId).enqueue(new Callback<WeatherBean>() {
@Override
public void onResponse(Call<WeatherBean> call, Response<WeatherBean> response) {
try {
//date":"20","sunrise":"05:30","high":"高温 16.0℃","low":"低温 10.0℃",
WeatherBean.DataBean.ForecastBean todayBean = response.body().getData().getForecast().get();
tv_result.setText(
"date1:" + todayBean.getDate() + "\n"
+ "high:" + todayBean.getHigh() + "\n"
+ "low:" + todayBean.getLow() + "\n"
);
} catch (Exception e) {
e.printStackTrace();
}
} @Override
public void onFailure(Call<WeatherBean> call, Throwable t) {
}
});
} //get 请求 传一个参数到url中
private void requestWeather2() {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(WeatherApi.BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
Map<String, String> params = new HashMap<>();
params.put("rand", "");
params.put("key", "4ea58de8a7573377cec0046f5e2469d5"); retrofit.create(WeatherApi.class).weatherInfo2(params).enqueue(new Callback<WeatherBean>() {
@Override
public void onResponse(Call<WeatherBean> call, Response<WeatherBean> response) {
try {
//date":"20","sunrise":"05:30","high":"高温 16.0℃","low":"低温 10.0℃",
WeatherBean.DataBean.ForecastBean todayBean = response.body().getData().getForecast().get();
tv_result.setText(
"date2:" + todayBean.getDate() + "\n"
+ "high:" + todayBean.getHigh() + "\n"
+ "low:" + todayBean.getLow() + "\n"
);
} catch (Exception e) {
e.printStackTrace();
}
} @Override
public void onFailure(Call<WeatherBean> call, Throwable t) {
}
});
} }

界面布局文件:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="activity.RequestCommonActivity"> <Button
android:id="@+id/btn_req1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="普通请求-接口1"
android:textAllCaps="false" /> <Button
android:id="@+id/btn_req2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="普通请求-接口2"
android:textAllCaps="false" /> <TextView
android:id="@+id/tv_result"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="结果展示" /> </LinearLayout>

本博客地址: wukong1688

本文原文地址:https://www.cnblogs.com/wukong1688/p/10745942.html

转载请著名出处!谢谢~~

[Android] Android RxJava2+Retrofit2+OkHttp3 的使用(一) --基础篇 Retrofit2 的使用的更多相关文章

  1. ArcGIS Runtime for Android开发教程V2.0(4)基础篇---MapView

    原文地址: ArcGIS Runtime for Android开发教程V2.0(4)基础篇---MapView - ArcGIS_Mobile的专栏 - 博客频道 - CSDN.NET http:/ ...

  2. ArcGIS Runtime for Android开发教程V2.0(3)基础篇---Hello World Map

    原文地址: ArcGIS Runtime for Android开发教程V2.0(3)基础篇---Hello World Map - ArcGIS_Mobile的专栏 - 博客频道 - CSDN.NE ...

  3. 【Android Api 翻译1】Android Texting(2)Testing Fundamentals 测试基础篇

    Testing Fundamentals The Android testing framework, an integral part of the development environment, ...

  4. ArcGIS Runtime for Android开发教程V2.0(8)基础篇-----地图事件

    转自:http://blog.csdn.net/arcgis_mobile/article/details/8263283 ArcGIS Runtime sdk for Android为我们提供了丰富 ...

  5. Android Texting(2)Testing Fundamentals 测试基础篇

    Testing Fundamentals The Android testing framework, an integral part of the development environment, ...

  6. 安装android Studio和运行react native项目(基础篇)

    ANDROID_HOME环境变量 确保ANDROID_HOME环境变量正确地指向了你安装的Android SDK的路径. 打开控制面板 -> 系统和安全 -> 系统 -> 高级系统设 ...

  7. [Android] Android RxJava2+Retrofit2+OkHttp3 的使用

    [Android] Android RxJava2+Retrofit2+OkHttp3 简单介绍Retrofit.OKHttp和RxJava之间的关系: Retrofit:Retrofit是Squar ...

  8. android -------- Retrofit + RxJava2.0 + Kotlin + MVP 开发的 WanAndroid 项目

    简介 wanandroid项目基于 Retrofit + RxJava2.0 + Kotlin + MVP 用到的依赖 implementation 'io.reactivex.rxjava2:rxj ...

  9. Retrofit2.0通俗易懂的学习姿势,Retrofit2.0 + OkHttp3 + Gson + RxJava

    Retrofit2.0通俗易懂的学习姿势,Retrofit2.0 + OkHttp3 + Gson + RxJava Retrofit,因为其简单与出色的性能,也是受到很多人的青睐,但是他和以往的通信 ...

随机推荐

  1. Vue学习之路1-集成环境安装

    1.前言 Vue 是一款友好的.多用途且高性能的javascript框架,与其它大型框架不同的是,Vue 被设计为可以自底向上逐层应用,它能够帮你创建可维护性和可测试性更强的代码库,Vue是渐进式的j ...

  2. Java操作Excel(使用POI)

    背景说明 以前写过使用 JXL 操作Excel的例子,但JXL对于Excel 2007版本以后的文件(即扩展名为 .xlsx)无法读取,也找不到可以支持的包.所以,有时不得不用 POI 来操作Exce ...

  3. 上传本地文件到GitHub上

    问题解决 今天在windows上上传本地文件到github,出现用户名和仓库不匹配的情况,解决方式如下: 打开控制面板,选择用户账户 把该删除的账户删除一下就行了. 上传文件的步骤如下: 将上传的文件 ...

  4. 【English Email】CIP payouts now in Workday

    simplification简化的[ˌsɪmplɪfɪˈkeɪʃn] quota配额[ˈkwoʊtə]  regional区域的[ˈriːdʒənl]  mechanics技工[məˈkænɪks]  ...

  5. nginx 499状态码

    Web服务器在用着nginx,在日志中偶尔会看到有499这个错误. rfc2616中,400-500间的错误码仅定义到了417,所以499应该是nginx自己定义的.后来想到读读nginx代码,疑问立 ...

  6. JavaScript-创建日志调试对象(面向对象实例)

    参考自http://www.2cto.com/kf/201312/261990.html IC.js文件 自己封装的js类库 /** * * @authors Your Name (you@examp ...

  7. zabbix问题-非常少的网络故障失败或罕见:Proxy超时的问题

    解决方案 在zabbix_agentd.conf中添加这些. BufferSend = 10 BufferSize = 150 MaxLinesPerSecond = 100 Timeout = 29 ...

  8. python之pickle

    #!/usr/bin/python # -*- coding: UTF- -*- ''' ''' import pickle # pickle 只能Python识别 不适用于别的语言 li = [, ...

  9. Filebeat配置参考手册

    Filebeat的配置参考 指定要运行的模块 前提: 在运行Filebeat模块之前,需要安装并配置Elastic堆栈: 安装Ingest Node GeoIP和User Agent插件.这些插件需要 ...

  10. 偶现bug如何处理?

    请先允许我对此类bug进行吐槽,相信做测试的同学都碰见过这种bug! 我们在测试过程中经常会碰见一类很头疼的bug,就是偶现性的bug,所谓偶现性,是相对于必现而言,这类bug有些可以有重现路径,但是 ...