当前位置: 首页 > news >正文

Android MQTT连接阿里云使用Json解析数据

Android Studio 连接阿里云订阅主题然后使用JSON解析数据非常好用

  • 导入MQTT的JAR包
    • 1、在项目中添加依赖然后使用Studio 去下载库
    • 2、直接下载JAR包,然后作为库进行导入
  • 环境验证:
  • 给程序进行联网权限
  • XML布局文件
    • 效果如下:
  • MainActitive.java 主要代码如下:
  • End

导入MQTT的JAR包

这里有两种方法:

1、在项目中添加依赖然后使用Studio 去下载库

2、直接下载JAR包,然后作为库进行导入

这里先介绍第一种方法:
切换到Android 目录:
在这里插入图片描述按照如下图,添加依赖即可:
在这里插入图片描述

  implementation("org.eclipse.paho:mqtt-client:3-1.2.0")

在这里插入图片描述
第二种方法:
打开Android Studio 然后切换到Android 目录找到Lib文件夹,将MQTT的JAR包复制进去即可。
在这里插入图片描述
然后点击project目录然后将MQTT JAR包导进去
在这里插入图片描述
添加完成之后作为库导入工程中
在这里插入图片描述

环境验证:

在MainActivity 任取一个地方输入MQTT 看是否有提示弹窗。
在这里插入图片描述
到这里以及成功一半了。接下来就是设置一些权限问题

给程序进行联网权限

切换到按的Android 目录
在这里插入图片描述
找到如下的目录:
在这里插入图片描述
添加如代码:

 <uses-permission android:name="android.permission.INTERNET" /><!--允许程序获取网络状态--><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

XML布局文件

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".MainActivity"><LinearLayoutandroid:layout_width="match_parent"android:background="#51CCDC"android:orientation="vertical"android:layout_height="match_parent"><LinearLayoutandroid:layout_width="match_parent"android:background="#673AB7"android:layout_height="wrap_content"><TextViewandroid:layout_width="match_parent"android:text="桂航果蔬种植基地"android:textSize="25sp"android:textColor="#060A0C"android:layout_height="match_parent"></TextView></LinearLayout><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="200dp"android:layout_gravity="center"android:layout_marginTop="20dp"><androidx.cardview.widget.CardViewandroid:layout_width="wrap_content"android:layout_height="200dp"android:layout_marginLeft="10dp"android:layout_marginRight="10dp"app:cardCornerRadius="20dp"><ImageViewandroid:id="@+id/m_img2"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/bg3"/></androidx.cardview.widget.CardView></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_marginTop="10dp"android:background="#51CCDC"android:orientation="vertical"><LinearLayoutandroid:layout_marginBottom="3dp"android:layout_marginLeft="10dp"android:layout_marginRight="10dp"android:layout_width="match_parent"android:background="@drawable/shape_corner"android:layout_height="wrap_content"android:orientation="vertical"android:layout_marginTop="5dp"android:padding="30dp"><!--左文字--><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="学号:2020070230226"android:textColor="@color/black"android:textSize="16sp"></TextView><!--左文字--><TextViewandroid:id="@+id/m_mqtt"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text= "姓名:xiao!"android:textColor="@color/black"android:textSize="16sp"></TextView></LinearLayout></LinearLayout><!-- vertical 竖直排列 --><!-- horizontal 竖直排列 --><!-- 数据解析界面 --><LinearLayoutandroid:layout_marginTop="10dp"android:orientation="vertical"android:layout_width="match_parent"android:layout_height="match_parent"android:background="#FFFF"><!-- 包裹其他界面--><LinearLayoutandroid:layout_margin="5px"android:padding="3dp"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_marginTop="10dp"android:orientation="vertical"><LinearLayoutandroid:layout_width="match_parent"android:gravity="center"android:layout_weight="1"android:orientation="horizontal"android:layout_height="match_parent"><!--气温--><LinearLayoutandroid:layout_width="160dp"android:layout_weight="1"android:gravity="center"android:background="@drawable/shape_corner"android:layout_height="105dp"><ImageViewandroid:id="@+id/test"android:layout_width="80dp"android:layout_height="80dp"android:layout_marginTop="10dp"android:src="@drawable/air_temp"android:layout_marginRight="15dp"></ImageView><LinearLayoutandroid:layout_width="wrap_content"android:orientation="vertical"android:layout_height="wrap_content"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="5dp"android:text="温度"android:textSize="25sp"></TextView><!-- 数值 --><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"><TextViewandroid:id="@+id/air_temp"android:layout_width="wrap_content"android:text=" 0 "android:textSize="25sp"android:layout_height="wrap_content"></TextView></LinearLayout></LinearLayout></LinearLayout><!--The End --><!-- 湿度--><LinearLayoutandroid:layout_marginLeft="25dp"android:layout_width="160dp"android:layout_weight="1"android:gravity="center"android:background="@drawable/shape_corner"android:layout_height="105dp"><ImageViewandroid:layout_width="80dp"android:layout_height="80dp"android:layout_marginTop="10dp"android:src="@drawable/air_humi"android:layout_marginRight="15dp"></ImageView><LinearLayoutandroid:layout_width="wrap_content"android:orientation="vertical"android:layout_height="wrap_content"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="5dp"android:text="湿度"android:textSize="20sp"></TextView><!-- 数值 --><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"><TextViewandroid:id="@+id/air_humi"android:layout_width="wrap_content"android:text=" 0 "android:textSize="25sp"android:layout_height="wrap_content"></TextView></LinearLayout></LinearLayout></LinearLayout></LinearLayout><!--The End --></LinearLayout><!-- 2 --><LinearLayoutandroid:layout_width="match_parent"android:background="#FFFF"android:layout_margin="5px"android:padding="3dp"android:layout_height="wrap_content"><!-- Layout1--><LinearLayoutandroid:layout_width="match_parent"android:gravity="center"android:layout_height="match_parent"><!--气温--><!--Left1 --><LinearLayoutandroid:layout_width="160dp"android:layout_weight="1"android:gravity="center"android:background="@drawable/shape_corner"android:layout_height="105dp"><ImageViewandroid:layout_width="80dp"android:layout_height="80dp"android:layout_marginTop="10dp"android:src="@drawable/soil_humi"android:layout_marginRight="15dp"></ImageView><LinearLayoutandroid:layout_width="wrap_content"android:orientation="vertical"android:layout_height="wrap_content"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="5dp"android:text="土壤湿度"android:textSize="20sp"></TextView><!-- 数值 --><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"><TextViewandroid:id="@+id/sloi_humi"android:layout_width="wrap_content"android:text=" 0 "android:textSize="25sp"android:layout_height="wrap_content"></TextView></LinearLayout></LinearLayout></LinearLayout><!--The End --><!-- 湿度--><LinearLayoutandroid:layout_width="160dp"android:layout_weight="1"android:gravity="center"android:layout_marginLeft="25dp"android:background="@drawable/shape_corner"android:layout_height="105dp"><ImageViewandroid:layout_width="80dp"android:layout_height="80dp"android:layout_marginTop="10dp"android:src="@drawable/n2"android:layout_marginRight="15dp"></ImageView><LinearLayoutandroid:layout_width="wrap_content"android:orientation="vertical"android:layout_height="wrap_content"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="5dp"android:text="土壤含氮"android:textSize="20sp"></TextView><!-- 数值 --><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"><TextViewandroid:id="@+id/soli_n"android:layout_width="wrap_content"android:text=" 0 "android:textSize="25sp"android:layout_height="wrap_content"></TextView></LinearLayout></LinearLayout></LinearLayout></LinearLayout></LinearLayout><!-- The End --><!-- 3 --><LinearLayoutandroid:layout_margin="5px"android:padding="3dp"android:layout_width="match_parent"android:orientation="horizontal"android:gravity="center"android:layout_height="wrap_content"><LinearLayoutandroid:layout_width="160dp"android:background="@drawable/shape_corner"android:layout_weight="1"android:gravity="center"android:layout_height="105dp"><ImageViewandroid:layout_weight="1"android:layout_width="80dp"android:layout_height="80dp"android:layout_marginTop="10dp"android:src="@drawable/p2"android:layout_marginRight="15dp"></ImageView><LinearLayoutandroid:layout_width="wrap_content"android:orientation="vertical"android:layout_height="wrap_content"><TextViewandroid:layout_marginTop="5dp"android:layout_marginRight="5dp"android:layout_width="wrap_content"android:text="土壤含磷"android:textSize="20sp"android:layout_height="wrap_content"></TextView><TextViewandroid:id="@+id/soil_p"android:layout_marginTop="5dp"android:layout_width="wrap_content"android:text=" 0 "android:textSize="25sp"android:layout_height="wrap_content"></TextView></LinearLayout></LinearLayout><!--L1--><LinearLayoutandroid:layout_marginLeft="25dp"android:gravity="center"android:layout_weight="1"android:layout_width="160dp"android:orientation="horizontal"android:background="@drawable/shape_corner"android:layout_height="105dp"><ImageViewandroid:layout_weight="1"android:layout_width="80dp"android:layout_height="80dp"android:layout_marginTop="10dp"android:src="@drawable/k2"android:layout_marginRight="15dp"></ImageView><LinearLayoutandroid:layout_width="wrap_content"android:orientation="vertical"android:layout_height="wrap_content"><TextViewandroid:layout_marginRight="5dp"android:layout_width="wrap_content"android:text="土壤含钾"android:textSize="20sp"android:layout_height="wrap_content"></TextView><TextViewandroid:id="@+id/soil_k"android:layout_width="wrap_content"android:text=" 0 "android:textSize="25sp"android:layout_height="wrap_content"></TextView></LinearLayout></LinearLayout><!--Layout2--></LinearLayout><!-- The End --></LinearLayout></LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

效果如下:

在这里插入图片描述

MainActitive.java 主要代码如下:

package com.example.ks_wfs;import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.content.DialogInterface;
import android.net.wifi.aware.DiscoverySession;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
import org.json.JSONException;
import org.json.JSONObject;import java.util.concurrent.ScheduledExecutorService;
public class MainActivity extends AppCompatActivity {private Handler handler;private String serverUri = "自己的IP地址";
/*    private String serverUri = "tcp://iot.qaeb.cn:1883";*//*这里可以填上各种云平台的物联网云平的域名+1883端口号,什么阿里云腾讯云百度云天工物接入都可以,这里我填的是我在我的阿里云服务器上搭建的EMQ平台的地址,注意:前缀“tcp://”不可少,之前我没写,怎么都连不上,折腾了好久*/private String userName = " ";private String passWord = " ";private String clientId = "app"+System.currentTimeMillis(); //clientId很重要,不能重复,否则就会连不上,所以我定义成 app+当前时间private String mqtt_sub_topic = "/iotsoil/post";          //需要订阅的主题private String mqtt_pub_topic = "xiao";                  //需要发布的主题private MqttClient mqtt_client;                         //创建一个mqtt_client对象MqttConnectOptions options;private  TextView air_temp;private  TextView air_humi;private  TextView sloi_humi;private  TextView soli_n;private  TextView soil_p;private  TextView soil_k;private ImageView test;private ScheduledExecutorService scheduler;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);/** xiaobai* 2023.10.10* Version V1.0*//*绑定UI文件*/UI_Init();/*类似单片机的初始化*/mqtt_init_Connect();/*初始化连接函数*//*回调函数,数据会在回调函数里面*/mqtt_client.setCallback(new MqttCallback() {@Overridepublic void connectionLost(Throwable throwable) {}@Overridepublic void messageArrived(String s, MqttMessage mqttMessage) throws Exception {/*数据到这了*/final String msg = new String(mqttMessage.getPayload());Log.d("MQTTRCV", msg);//日志信息,可以查看System.out.println(msg);/*打印得到的数据*//*更新UI线程*//*               runOnUiThread(new Runnable() {@Overridepublic void run() {*//*开始解析数据*//**//*数据解析部分这里使用的是Json解析*//**//*为了避免闪退,使用try来处理异常情况*//*try {JSONObject jsonObject = new JSONObject(String.valueOf(msg));String method = jsonObject.getString("method");JSONObject params = jsonObject.getJSONObject("params");int soilHumidity = params.getInt("soilHumidity");int currentTemperature = params.getInt("CurrentTemperature");int currentHumidity = params.getInt("CurrentHumidity");int n = params.getInt("N");int p = params.getInt("P");int k = params.getInt("K");*//*更新数据到UI*//*air_temp.setText(String.valueOf(currentTemperature));air_humi.setText(String.valueOf(currentHumidity));sloi_humi.setText(String.valueOf(soilHumidity));soli_n.setText(String.valueOf(n));soil_p.setText(String.valueOf(p));soil_k.setText(String.valueOf(k));*//*打印日志信息*//*Log.d("TAG", "method: " + method);Log.d("TAG", "soilHumidity: " + soilHumidity);Log.d("TAG", "currentTemperature: " + currentTemperature);Log.d("TAG", "currentHumidity: " + currentHumidity);Log.d("TAG", "N: " + n);Log.d("TAG", "P: " + p);Log.d("TAG", "K: " + k);}catch (JSONException e){e.printStackTrace();Toast.makeText(MainActivity.this ,"数据解析异常!",Toast.LENGTH_LONG).show();}}});*//*下面是带弹窗显示的代码数据已经解析完成,解开注释即可*/runOnUiThread(new Runnable() {@Overridepublic void run() {AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);builder.setTitle("MQTT消息");builder.setMessage(msg);builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface dialogInterface, int i) {// 点击确定按钮后的操作/*   开始解析数据*//*    数据解析部分这里使用的是Json解析为了避免闪退,使用try来处理异常情况*/try {JSONObject jsonObject = new JSONObject(String.valueOf(msg));String method = jsonObject.getString("method");JSONObject params = jsonObject.getJSONObject("params");int soilHumidity = params.getInt("soilHumidity");int currentTemperature = params.getInt("CurrentTemperature");int currentHumidity = params.getInt("CurrentHumidity");int n = params.getInt("N");int p = params.getInt("P");int k = params.getInt("K");/*     更新UI*/air_temp.setText(String.valueOf(currentTemperature));air_humi.setText(String.valueOf(currentHumidity));sloi_humi.setText(String.valueOf(soilHumidity));soli_n.setText(String.valueOf(n));soil_p.setText(String.valueOf(p));soil_k.setText(String.valueOf(k));/*     打印输出的信息*/Log.d("TAG", "method: " + method);Log.d("TAG", "soilHumidity: " + soilHumidity);Log.d("TAG", "currentTemperature: " + currentTemperature);Log.d("TAG", "currentHumidity: " + currentHumidity);Log.d("TAG", "N: " + n);Log.d("TAG", "P: " + p);Log.d("TAG", "K: " + k);}catch (JSONException e){e.printStackTrace();Toast.makeText(MainActivity.this ,"数据解析异常!",Toast.LENGTH_LONG).show();}}});builder.show();}});}@Overridepublic void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {}});/*点击事件*/test.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {PublishMessage(mqtt_pub_topic,"{\"params\":{\"我是小白,你好呀\":999 } }");}});}public void mqtt_init_Connect(){try {//实例化mqtt_client,填入我们定义的serverUri和clientId,然后MemoryPersistence设置clientid的保存形式,默认为以内存保存mqtt_client = new MqttClient(serverUri,clientId,new MemoryPersistence());//创建并实例化一个MQTT的连接参数对象options = new MqttConnectOptions();//然后设置对应的参数options.setUserName(userName);                  //设置连接的用户名options.setPassword(passWord.toCharArray());    //设置连接的密码options.setConnectionTimeout(30);               // 设置超时时间,单位为秒options.setKeepAliveInterval(50);               //设置心跳,30soptions.setAutomaticReconnect(true);            //是否重连//设置是否清空session,设置为false表示服务器会保留客户端的连接记录,设置为true表示每次连接到服务器都以新的身份连接options.setCleanSession(false);/*初始化成功之后就开始连接*/connect();Toast.makeText(MainActivity.this,"连接成功",Toast.LENGTH_LONG).show();}catch (Exception e) {e.printStackTrace();Toast.makeText(MainActivity.this,"失败",Toast.LENGTH_LONG).show();}}public void connect(){//连接mqtt服务器try {mqtt_client.connect(options);mqtt_client.subscribe(mqtt_sub_topic);Toast.makeText(this ,"开始建立连接.....!",Toast.LENGTH_LONG).show();}catch (Exception e) {e.printStackTrace();Log.d("MQTTCon","mqtt连接失败");Toast.makeText(this ,"mqtt连接失败!",Toast.LENGTH_LONG).show();}}/*绑定各个UI控件*/public void UI_Init(){air_temp  =  findViewById(R.id.air_temp); //空气温度air_humi  =  findViewById(R.id.air_humi);//空气湿度sloi_humi =  findViewById(R.id.sloi_humi);//土壤湿度soli_n    =  findViewById(R.id.soli_n);//土壤含N量soil_p    =  findViewById(R.id.soil_p);//土壤含P量soil_k    =  findViewById(R.id.soil_k);//土壤含K量test      =  findViewById(R.id.test);//测试按钮}/*发布函数!*/private void PublishMessage(String topic,String Message2){if(mqtt_client ==null || !mqtt_client.isConnected()){return;}MqttMessage message = new MqttMessage();message.setPayload(Message2.getBytes());try{mqtt_client.publish(topic,message);}catch (MqttException e){e.printStackTrace();}}}

End

完整的代码工程可以进QQ群获取!
764452437

相关文章:

Android MQTT连接阿里云使用Json解析数据

Android Studio 连接阿里云订阅主题然后使用JSON解析数据非常好用 导入MQTT的JAR包1、在项目中添加依赖然后使用Studio 去下载库2、直接下载JAR包&#xff0c;然后作为库进行导入 环境验证&#xff1a;给程序进行联网权限XML布局文件效果如下&#xff1a; MainActitive.java 主…...

生成二维码

Qt本地生成二维码-第三方库Libqrencode Chapter1 Qt本地生成二维码-第三方库Libqrencode一、功能简介二、本地生成二维码三、在线生成二维码 Chapter2 Qt生成二维码图片方法QRCode二维码简介如何选定QR码版本&#xff1f;主要方法(1) 下载qrencode源码(2) 将qrencode源码移植到…...

【C++入门 一 】学习C++背景、开启C++奇妙之旅

目录 1.什么是C2. C的发展史3. C的重要性3.1 语言的使用广泛度3.2 在工作领域1. 操作系统以及大型系统软件开发2. 服务器端开发3. 游戏开发4. 嵌入式和物联网领域5. 数字图像处理6. 人工智能7. 分布式应用 3.3 在校招领域3.3.1 岗位需求3.3.2 笔试题 4. 如何学习C4.1 别人怎么学…...

oracle 表空间详解以及配置操作

Oracle 数据库是由若干个表空间构成的。任何数据库对象在存储时都必须存储在某个 表空间中。表空间对应于若干个数据文件&#xff0c;即表空间是由一个或多个数据文件构成的。 1、常用表空间&#xff1a; 系统表空间 (system tablespace) 是每个 Oracle 数据库都必须具备的。…...

php判断是否是email格式

要判断一个字符串是否是有效的电子邮件地址&#xff0c;你可以使用正则表达式和PHP内置函数来完成。以下是一个示例代码&#xff1a; $email "exampleexample.com"; // 你要检查的电子邮件地址// 使用正则表达式检查电子邮件格式 if (filter_var($email, FILTER_VA…...

AJAX与JSON

1.AJAX 1.AJAX概述 AJAX(Asynchronous JavaScript And XML)&#xff1a;异步的 JavaScript 和 XML 本身不是一种新技术&#xff0c;而是多个技术综合。用于快速创建动态网页的技术 一般的网页如果需要更新内容&#xff0c;必需重新加载个页面。 而 Ajax通过浏览器与服务器…...

1024常玩到的漏洞(第十六课)

1024常玩到的两个漏洞(第十六课) 漏洞扫描工具 1024渗透OpenVas扫描工具使用(第十四课)-CSDN博客 流程 一 ms12-020漏洞分析 MS12-020漏洞是一种远程桌面协议(RDP)漏洞。在攻击者利用该漏洞之前,它需要将攻击者的计算机连接到受害者的计算机上。攻击者可以通过向受害者计算…...

【Edabit 算法 ★★★★★★】【两个大整数相加】Recursion: Sum of Two Numbers (With A Twist!)

Recursion: Sum of Two Numbers (With A Twist!) Instructions This is an “expert” challenge!!! Why is a sum of two numbers an “expert” challenge!!! Well, the numbers can have 1000 digits or even beyond such count… So, what’s the twist? You have to do …...

电容屏物体识别手工制作

电容屏识别物体效果2 电容屏识别物体效果1 电容屏识别物体效果3 电容屏识别物体效果4 电容识别物理效果5 我们感兴趣的是找到让我们的平面屏幕与物理三维物体和表面交互的方法。 触摸屏无处不在&#xff0c;成千上万的应用程序中有多种设备和屏幕格式&#xff0c;但我们只找到…...

13JVM进阶

JVM内存模型 1、线程私有的数据区 1)、程序计数器 我们知道&#xff0c;线程是CPU调度的基本单位。在多线程情况下&#xff0c;当线程数超过CPU数量或CPU内核数量时&#xff0c;线程之间就要根据 时间片轮询抢夺CPU时间资源。也就是说&#xff0c;在任何一个确定的时刻&#…...

java与c++中的交换方法

最近在写算法的时候&#xff0c;遇到一个问题。 java中编写swap&#xff08;交换&#xff09;方法还需要传入一个数组&#xff0c;但是在c中则不需要。 可以看到&#xff0c;在没有传入数组进行交换数组元素的时候&#xff0c;交换前与交换后的值是一样的。 而在c中&#xff…...

OpenCV中world模块介绍

OpenCV中有很多模块&#xff0c;模块间保持最小的依赖关系&#xff0c;用户可以根据自己的实际需要链接相关的库&#xff0c;而不需链接所有的库&#xff0c;这样在最终交付应用程序时可以减少总库的大小。但如果需要依赖OpenCV的库太多,有时会带来不方便&#xff0c;此时可以使…...

IMX6ULL板开发——第一个应用程序

实现第一个应用程序&#xff1a;在IMX6ULL开发板上运行程序hello.c #include <stdio.h>/* 执行命令: ./hello weidongshan* argc 2* argv[0] ./hello* argv[1] weidongshan*/int main(int argc, char **argv) {if (argc > 2)printf("Hello, %s!\n", arg…...

MyBatis Generator - 快速生成 实体类 和 映射文件

目录 一、MyBatis Generator 的使用 1.1、生成类和映射文件 1.1.1、在 pom.xml 中引入依赖 1.1.2、根据 configurationFile 标签中配置的路径 创建 generatorConfig.xml 文件 1.1.3、自动生成类 和 映射文件 1.1.4、在 Insert 标签中添加获取主键值的选项 1.1.5、扫描配置…...

点击查看详情 | 网页版微信客户管理系统如何操作试用?

微信作为我们日常生活中最常用的社交应用之一&#xff0c;早已成为我们与朋友、家人和同事保持联系的重要工具&#xff0c;也是营销引流的重要平台。 通过微信营销&#xff0c;可以比较精准定向亲近用户。而微信的功能并没有很能满足做微信营销的人群&#xff0c;所以我们需要借…...

新加坡攻略

文章目录 基础信息入境行李App电信交通餐饮购物法规旅游牛车水&#xff08;Chinatown&#xff09;克拉码头&#xff08;Clarke Quay&#xff09;东海岸&#xff08;East Coast&#xff09;丹戎巴葛&#xff08;Tanjong Pagar&#xff09;滨海湾&#xff08;Marina Bay&#xff…...

AM@导数的应用@二阶导数的应用@函数的性态研究@函数图形的绘制

文章目录 概念称呼说明驻点极值和极值点最值极值点和最值比较曲线的凹凸性凹凸性判定定理&#x1f47a;例证明 凹凸性和单调性无必然关系拐点寻找拐点&#x1f47a; 函数图形的绘制例 概念 本文讨论导数的应用:利用导数研究函数的性态相关定理主要通过Lagrange中值定理进行推导…...

【2024秋招】2023-9-14 最右后端开发线下一面

1 自我介绍 2 计算机网络 2.1 说说你对tcp滑动窗口的理解 TCP 滑动窗口是 TCP 协议流量控制的一个重要机制。它的主要目的是确保发送方不会因为发送太多数据而使接收方不堪重负。下面我会详细地描述滑动窗口的概念&#xff1a; 窗口的大小&#xff1a; 滑动窗口的大小&#…...

uniapp无感刷新token实现过程

路漫漫其修远兮&#xff0c;前端道路逐渐迷茫&#xff0c;时隔好久好久终于想起了我还有一个小博客&#xff0c;最近在一直在弄uniapp&#xff0c;属实有被恶心到&#xff0c;但也至少会用了&#xff0c;最近实现了一个比较通用的功能&#xff0c;就是无感刷新token&#xff0c…...

一步步掌握Java IO的奥秘:深入学习BIO、NIO,实现客户端与服务器通信

众所周知&#xff0c;Java IO是一个庞大的知识体系&#xff0c;很多人在学习的过程中会感到迷茫&#xff0c;甚至学得一头雾水&#xff0c;而我也曾有同样的困惑。因此&#xff0c;本文的目标是帮助大家一步一步深入学习Java IO&#xff0c;从BIO开始&#xff0c;然后引出JDK1.…...

XCTF-web-easyupload

试了试php&#xff0c;php7&#xff0c;pht&#xff0c;phtml等&#xff0c;都没有用 尝试.user.ini 抓包修改将.user.ini修改为jpg图片 在上传一个123.jpg 用蚁剑连接&#xff0c;得到flag...

React Native 导航系统实战(React Navigation)

导航系统实战&#xff08;React Navigation&#xff09; React Navigation 是 React Native 应用中最常用的导航库之一&#xff0c;它提供了多种导航模式&#xff0c;如堆栈导航&#xff08;Stack Navigator&#xff09;、标签导航&#xff08;Tab Navigator&#xff09;和抽屉…...

安宝特方案丨XRSOP人员作业标准化管理平台:AR智慧点检验收套件

在选煤厂、化工厂、钢铁厂等过程生产型企业&#xff0c;其生产设备的运行效率和非计划停机对工业制造效益有较大影响。 随着企业自动化和智能化建设的推进&#xff0c;需提前预防假检、错检、漏检&#xff0c;推动智慧生产运维系统数据的流动和现场赋能应用。同时&#xff0c;…...

线程同步:确保多线程程序的安全与高效!

全文目录&#xff1a; 开篇语前序前言第一部分&#xff1a;线程同步的概念与问题1.1 线程同步的概念1.2 线程同步的问题1.3 线程同步的解决方案 第二部分&#xff1a;synchronized关键字的使用2.1 使用 synchronized修饰方法2.2 使用 synchronized修饰代码块 第三部分&#xff…...

Objective-C常用命名规范总结

【OC】常用命名规范总结 文章目录 【OC】常用命名规范总结1.类名&#xff08;Class Name)2.协议名&#xff08;Protocol Name)3.方法名&#xff08;Method Name)4.属性名&#xff08;Property Name&#xff09;5.局部变量/实例变量&#xff08;Local / Instance Variables&…...

ffmpeg(四):滤镜命令

FFmpeg 的滤镜命令是用于音视频处理中的强大工具&#xff0c;可以完成剪裁、缩放、加水印、调色、合成、旋转、模糊、叠加字幕等复杂的操作。其核心语法格式一般如下&#xff1a; ffmpeg -i input.mp4 -vf "滤镜参数" output.mp4或者带音频滤镜&#xff1a; ffmpeg…...

ServerTrust 并非唯一

NSURLAuthenticationMethodServerTrust 只是 authenticationMethod 的冰山一角 要理解 NSURLAuthenticationMethodServerTrust, 首先要明白它只是 authenticationMethod 的选项之一, 并非唯一 1 先厘清概念 点说明authenticationMethodURLAuthenticationChallenge.protectionS…...

Axios请求超时重发机制

Axios 超时重新请求实现方案 在 Axios 中实现超时重新请求可以通过以下几种方式&#xff1a; 1. 使用拦截器实现自动重试 import axios from axios;// 创建axios实例 const instance axios.create();// 设置超时时间 instance.defaults.timeout 5000;// 最大重试次数 cons…...

稳定币的深度剖析与展望

一、引言 在当今数字化浪潮席卷全球的时代&#xff0c;加密货币作为一种新兴的金融现象&#xff0c;正以前所未有的速度改变着我们对传统货币和金融体系的认知。然而&#xff0c;加密货币市场的高度波动性却成为了其广泛应用和普及的一大障碍。在这样的背景下&#xff0c;稳定…...

html css js网页制作成品——HTML+CSS榴莲商城网页设计(4页)附源码

目录 一、&#x1f468;‍&#x1f393;网站题目 二、✍️网站描述 三、&#x1f4da;网站介绍 四、&#x1f310;网站效果 五、&#x1fa93; 代码实现 &#x1f9f1;HTML 六、&#x1f947; 如何让学习不再盲目 七、&#x1f381;更多干货 一、&#x1f468;‍&#x1f…...