Java代码通过经纬度计算省份。

 直接上代码,需要市区县可自己解析

String areaName = addressUtil.getPosition(longitude, latitude);
package com.skyable.device.utils.velicle;import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Synchronized;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;/*** @author Administrator*/
@Component
public class AddressUtil {@Autowiredprivate JsonUtil jsonUtil;private static final List<Map<String, Object>> LIST = new ArrayList<>();private static final Map<Integer, Map<String, Object>> MAP = new HashMap<>();@Synchronizedpublic String getPosition(Double longitude, Double latitude) {String areaName = "中国";Map<String, Object> resultMap = new HashMap<>();resultMap.put("code", 500);resultMap.put("message", "失败");if (longitude == null || latitude == null) {return areaName;}if (LIST.isEmpty()) {LIST.addAll(jsonUtil.readJson());}if (MAP.isEmpty()) {for (Map<String, Object> jsonMap : LIST) {MAP.put(Integer.valueOf(jsonMap.get("id").toString()), jsonMap);}}double minDistance = 0.0D;Map<String, Object> shopAreaMap = new HashMap<>();boolean first = true;for (Map<String, Object> areaMap : LIST) {String level = areaMap.get("level").toString();String lng = areaMap.get("lng").toString().replace("\"", "");String lat = areaMap.get("lat").toString().replace("\"", "");if (!("1".equals(level) || "2".equals(level)) && (!"null".equals(lng)) && (!"null".equals(lat))) {double distance = CoordTransform.getDistance(latitude, longitude, Double.parseDouble(lat), Double.parseDouble(lng));if (minDistance == 0.0D && first) {minDistance = distance;shopAreaMap = areaMap;first = false;} else if (distance < minDistance) {minDistance = distance;shopAreaMap = areaMap;}}}if (!shopAreaMap.isEmpty() && shopAreaMap.get("level") != null) {int level = Integer.parseInt(shopAreaMap.get("level").toString());if (level == 4 || level == 3) {Map<String, Object> parentMap = MAP.get(Integer.valueOf(shopAreaMap.get("parentid").toString()));if (parentMap != null) {if (level == 4) {Map<String, Object> cityMap = MAP.get(Integer.valueOf(parentMap.get("parentid").toString()));if (cityMap != null) {shopAreaMap = cityMap;}shopAreaMap.put("county", parentMap);} else {shopAreaMap.put("county", shopAreaMap);}shopAreaMap = parentMap;}}shopAreaMap.put("shortname", MAP.get(Integer.valueOf(shopAreaMap.get("parentid").toString())).get("areaname").toString());}resultMap.put("data", shopAreaMap);Object parentId = shopAreaMap.get("parentid");for (Map<String, Object> record : LIST) {Object id = record.get("id");if (parentId.equals(id)) {parentId = record.get("parentid");}}for (Map<String, Object> map : LIST) {if (map.get("id").equals(parentId)) {areaName = map.get("areaname").toString().replaceAll("\"", "");}}return areaName;}
}
package com.skyable.device.utils.velicle;/*** @author Administrator*/
public class CoordTransform {private static final double X_PI = 52.359877559829883;private static final double PI = 3.141592653589793;private static final double A = 6378245.0;private static final double EE = 0.006693421622965943;public static double getDistance(double x1, double y1, double x2, double y2) {double x = (x1 - x2) * PI * A *Math.cos((y1 + y2) / 2.0 * PI / 180.0) / 180.0;double y = (y2 - y1) * PI * A / 180.0;return Math.sqrt(x * x + y * y);}
}
package com.skyable.device.utils.velicle;public class IPEntry {public String beginIp;public String endIp;public String country;public String area;public IPEntry() {this.beginIp = (this.endIp = this.country = this.area = "");}@Overridepublic String toString() {return this.area + "  " + this.country + "IP范围:" + this.beginIp + "-" +this.endIp;}
}
package com.skyable.device.utils.velicle;import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteOrder;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.util.*;public class IPSeeker {private static final String IP_FILE = PropertiesUtil.getProperty("IP_DATA_URL");private static final int IP_RECORD_LENGTH = 7;private static final byte AREA_FOLLOWED = 1;private static final byte NO_AREA = 2;private static Hashtable<String, Object> ipCache;private static RandomAccessFile ipFile;private static MappedByteBuffer mbb;private static IPSeeker instance = new IPSeeker();private static long ipBegin;private static long ipEnd;private static IPLocation loc;private static byte[] buf;private static byte[] b4;private static byte[] b3;private IPSeeker() {ipCache = new Hashtable();loc = new IPLocation();buf = new byte[100];b4 = new byte[4];b3 = new byte[3];try {ipFile = new RandomAccessFile(IP_FILE, "r");} catch (FileNotFoundException e) {System.out.println(IP_FILE);System.out.println("IP地址信息文件没有找到,IP显示功能将无法使用");ipFile = null;}if (ipFile != null) {try {ipBegin = readLong4(0L);ipEnd = readLong4(4L);if ((ipBegin == -1L) || (ipEnd == -1L)) {ipFile.close();ipFile = null;}} catch (IOException e) {System.out.println("IP地址信息文件格式有错误,IP显示功能将无法使用");ipFile = null;}}}public static IPSeeker getInstance() {return instance;}public List<IPEntry> getIPEntriesDebug(String s) {List ret = new ArrayList();long endOffset = ipEnd + 4L;for (long offset = ipBegin + 4L; offset <= endOffset; offset += 7L) {long temp = readLong3(offset);if (temp != -1L) {IPLocation loc = getIPLocation(temp);if ((loc.country.indexOf(s) != -1) || (loc.area.indexOf(s) != -1)) {IPEntry entry = new IPEntry();entry.country = loc.country;entry.area = loc.area;readIP(offset - 4L, b4);entry.beginIp = Utils.getIpStringFromBytes(b4);readIP(temp, b4);entry.endIp = Utils.getIpStringFromBytes(b4);ret.add(entry);}}}return ret;}public List<IPEntry> getIPEntries(String s) {List ret = new ArrayList();try {if (mbb == null) {FileChannel fc = ipFile.getChannel();mbb = fc.map(FileChannel.MapMode.READ_ONLY, 0L, ipFile.length());mbb.order(ByteOrder.LITTLE_ENDIAN);}int endOffset = (int) ipEnd;for (int offset = (int) ipBegin + 4; offset <= endOffset; offset += 7) {int temp = readInt3(offset);if (temp != -1) {IPLocation loc = getIPLocation(temp);if ((loc.country.indexOf(s) != -1) ||(loc.area.indexOf(s) != -1)) {IPEntry entry = new IPEntry();entry.country = loc.country;entry.area = loc.area;readIP(offset - 4, b4);entry.beginIp = Utils.getIpStringFromBytes(b4);readIP(temp, b4);entry.endIp = Utils.getIpStringFromBytes(b4);ret.add(entry);}}}} catch (IOException e) {System.out.println(e.getMessage());}return ret;}private int readInt3(int offset) {mbb.position(offset);return mbb.getInt() & 0xFFFFFF;}private int readInt3() {return mbb.getInt() & 0xFFFFFF;}public static String getCountry(byte[] ip) {if (ipFile == null) {return "错误的IP数据库文件";}String ipStr = Utils.getIpStringFromBytes(ip);if (ipCache.containsKey(ipStr)) {IPLocation loc = (IPLocation) ipCache.get(ipStr);return loc.country;}IPLocation loc = getIPLocation(ip);ipCache.put(ipStr, loc.getCopy());return loc.country;}public static String getCountry(String ip) {return getCountry(Utils.getIpByteArrayFromString(ip));}public String getArea(byte[] ip) {if (ipFile == null) {return "错误的IP数据库文件";}String ipStr = Utils.getIpStringFromBytes(ip);if (ipCache.containsKey(ipStr)) {IPLocation loc = (IPLocation) ipCache.get(ipStr);return loc.area;}IPLocation loc = getIPLocation(ip);ipCache.put(ipStr, loc.getCopy());return loc.area;}public String getArea(String ip) {return getArea(Utils.getIpByteArrayFromString(ip));}private static IPLocation getIPLocation(byte[] ip) {IPLocation info = null;long offset = locateIP(ip);if (offset != -1L) {info = getIPLocation(offset);}if (info == null) {info.country = "未知国家";info.area = "未知地区";}return info;}private long readLong4(long offset) {long ret = 0L;try {ipFile.seek(offset);ret |= ipFile.readByte() & 0xFF;ret |= ipFile.readByte() << 8 & 0xFF00;ret |= ipFile.readByte() << 16 & 0xFF0000;return ret | ipFile.readByte() << 24 & 0xFF000000;} catch (IOException e) {}return -1L;}private static long readLong3(long offset) {long ret = 0L;try {ipFile.seek(offset);ipFile.readFully(b3);ret |= b3[0] & 0xFF;ret |= b3[1] << 8 & 0xFF00;return ret | b3[2] << 16 & 0xFF0000;} catch (IOException e) {}return -1L;}private static long readLong3() {long ret = 0L;try {ipFile.readFully(b3);ret |= b3[0] & 0xFF;ret |= b3[1] << 8 & 0xFF00;return ret | b3[2] << 16 & 0xFF0000;} catch (IOException e) {}return -1L;}private static void readIP(long offset, byte[] ip) {try {ipFile.seek(offset);ipFile.readFully(ip);byte temp = ip[0];ip[0] = ip[3];ip[3] = temp;temp = ip[1];ip[1] = ip[2];ip[2] = temp;} catch (IOException e) {System.out.println(e.getMessage());}}private void readIP(int offset, byte[] ip) {mbb.position(offset);mbb.get(ip);byte temp = ip[0];ip[0] = ip[3];ip[3] = temp;temp = ip[1];ip[1] = ip[2];ip[2] = temp;}private static int compareIP(byte[] ip, byte[] beginIp) {for (int i = 0; i < 4; i++) {int r = compareByte(ip[i], beginIp[i]);if (r != 0) {return r;}}return 0;}private static int compareByte(byte b1, byte b2) {if ((b1 & 0xFF) > (b2 & 0xFF)) {return 1;}if ((b1 ^ b2) == 0) {return 0;}return -1;}private static long locateIP(byte[] ip) {long m = 0L;readIP(ipBegin, b4);int r = compareIP(ip, b4);if (r == 0) {return ipBegin;}if (r < 0) {return -1L;}long i = ipBegin;for (long j = ipEnd; i < j; ) {m = getMiddleOffset(i, j);readIP(m, b4);r = compareIP(ip, b4);if (r > 0) {i = m;} else if (r < 0) {if (m == j) {j -= 7L;m = j;} else {j = m;}} else {return readLong3(m + 4L);}}m = readLong3(m + 4L);readIP(m, b4);r = compareIP(ip, b4);if (r <= 0) {return m;}return -1L;}private static long getMiddleOffset(long begin, long end) {long records = (end - begin) / 7L;records >>= 1;if (records == 0L) {records = 1L;}return begin + records * 7L;}private static IPLocation getIPLocation(long offset) {try {ipFile.seek(offset + 4L);byte b = ipFile.readByte();if (b == 1) {long countryOffset = readLong3();ipFile.seek(countryOffset);b = ipFile.readByte();if (b == 2) {loc.country = readString(readLong3());ipFile.seek(countryOffset + 4L);} else {loc.country = readString(countryOffset);}loc.area = readArea(ipFile.getFilePointer());} else if (b == 2) {loc.country = readString(readLong3());loc.area = readArea(offset + 8L);} else {loc.country = readString(ipFile.getFilePointer() - 1L);loc.area = readArea(ipFile.getFilePointer());}return loc;} catch (IOException e) {}return null;}private IPLocation getIPLocation(int offset) {mbb.position(offset + 4);byte b = mbb.get();if (b == 1) {int countryOffset = readInt3();mbb.position(countryOffset);b = mbb.get();if (b == 2) {loc.country = readString(readInt3());mbb.position(countryOffset + 4);} else {loc.country = readString(countryOffset);}loc.area = readArea(mbb.position());} else if (b == 2) {loc.country = readString(readInt3());loc.area = readArea(offset + 8);} else {loc.country = readString(mbb.position() - 1);loc.area = readArea(mbb.position());}return loc;}private static String readArea(long offset)throws IOException {ipFile.seek(offset);byte b = ipFile.readByte();if ((b == 1) || (b == 2)) {long areaOffset = readLong3(offset + 1L);if (areaOffset == 0L) {return "未知地区";}return readString(areaOffset);}return readString(offset);}private String readArea(int offset) {mbb.position(offset);byte b = mbb.get();if ((b == 1) || (b == 2)) {int areaOffset = readInt3();if (areaOffset == 0) {return "未知地区";}return readString(areaOffset);}return readString(offset);}private static String readString(long offset) {try {ipFile.seek(offset);int i = 0;for (buf[i] = ipFile.readByte(); buf[i] != 0; ) {buf[(++i)] = ipFile.readByte();}if (i != 0) {return Utils.convertBytesToString(buf, 0, i, "GBK");}} catch (IOException e) {System.out.println(e.getMessage());}return "";}private String readString(int offset) {try {mbb.position(offset);int i = 0;for (buf[i] = mbb.get(); buf[i] != 0; buf[(++i)] = mbb.get()) {if (i != 0) {return Utils.convertBytesToString(buf, 0, i, "GBK");}}} catch (IllegalArgumentException e) {System.out.println(e.getMessage());}return "";}public String getAddress(String ip) {String country = getCountry(ip).equals(" CZ88.NET") ? "null" :getCountry(ip);String area = getArea(ip).equals(" CZ88.NET") ? "null" : getArea(ip);String address = country + "|" + area;return address.trim();}public static String getAddressByCity(String ip) {String country = getCountry(ip).equals(" CZ88.NET") ? "null" :getCountry(ip);String address = country;return address.trim();}public static Map<String, Object> jqCity(String str) {String shortname = "";String areaname = "";Map map = new HashMap();boolean status = str.contains("省");if (status) {String[] splitstr = str.split("省");shortname = splitstr[0] + "省";areaname = splitstr[1];if (areaname.contains("市")) {areaname = areaname.split("市")[0] + "市";}}boolean xj = str.contains("新疆");if (xj) {String[] splitstr = str.split("新疆");for (String string : splitstr) {System.out.println(string);}shortname = "新疆";areaname = splitstr[1];}boolean xz = str.contains("西藏");if (xz) {String[] splitstr = str.split("西藏");for (String string : splitstr) {System.out.println(string);}shortname = "西藏";areaname = splitstr[1];}boolean nmg = str.contains("内蒙古");if (nmg) {String[] splitstr = str.split("内蒙古");for (String string : splitstr) {System.out.println(string);}shortname = "内蒙古";areaname = splitstr[1];}boolean nx = str.contains("宁夏");if (nx) {String[] splitstr = str.split("宁夏");for (String string : splitstr) {System.out.println(string);}shortname = "宁夏";areaname = splitstr[1];}boolean gx = str.contains("广西");if (gx) {String[] splitstr = str.split("广西");for (String string : splitstr) {System.out.println(string);}shortname = "广西";areaname = splitstr[1];}boolean bjs = str.contains("北京市");boolean tjs = str.contains("天津市");boolean shs = str.contains("上海市");boolean cqs = str.contains("重庆市");boolean xg = str.contains("香港");boolean am = str.contains("澳门");if ((am) || (xg) || (cqs) || (shs) || (tjs) || (bjs)) {System.out.println(str);shortname = str;areaname = str;}map.put("shortname", shortname);map.put("areaname", areaname);return map;}public static void main(String[] args) {IPSeeker is = new IPSeeker();System.out.println(is.getAddress("119.123.225.83"));System.out.println(is.getAddress("14.215.177.39"));System.out.println(is.getAddress("113.78.255.221"));System.out.println(is.getAddress("182.34.16.127"));System.out.println(is.getAddress("180.118.240.225"));System.out.println(is.getAddress("119.29.252.90"));System.out.println(is.getAddress("61.128.101.255"));System.out.println(is.getAddress("110.157.255.255"));System.out.println(is.getAddress("220.182.44.228"));System.out.println(is.getAddress("1.183.255.255"));System.out.println(is.getAddress("123.125.71.38"));System.out.println(is.getAddress("203.186.145.250"));System.out.println(is.getAddress("111.113.255.255"));System.out.println(is.getAddress("180.143.255.255"));}private class IPLocation {public String country;public String area;public IPLocation() {this.country = (this.area = "");}public IPLocation getCopy() {IPLocation ret = new IPLocation();ret.country = this.country;ret.area = this.area;return ret;}}
}
package com.skyable.device.utils.velicle;import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;import java.util.*;public class JsonToMap {public static JsonObject parseJson(String json) {JsonParser parser = new JsonParser();return parser.parse(json).getAsJsonObject();}public static Map<String, Object> toMap(String json) {return toMap(parseJson(json));}public static Map<String, Object> toMap(JsonObject json) {Map<String, Object> map = new HashMap<>();Set<Map.Entry<String, JsonElement>> entrySet = json.entrySet();for (Map.Entry<String, JsonElement> entry : entrySet) {String key = entry.getKey();JsonElement value = entry.getValue();if (value.isJsonArray()) {map.put(key, toList(value.getAsJsonArray()));} else if (value.isJsonObject()) {map.put(key, toMap(value.getAsJsonObject()));} else {map.put(key, value);}}return map;}public static List<Object> toList(JsonArray json) {List<Object> list = new ArrayList<>();for (JsonElement element : json) {if (element.isJsonArray()) {list.add(toList(element.getAsJsonArray()));} else if (element.isJsonObject()) {list.add(toMap(element.getAsJsonObject()));} else {list.add(element);}}return list;}
}
package com.skyable.device.utils.velicle;import com.google.gson.*;
import com.google.gson.stream.JsonReader;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;@Component
public class JsonUtil {@Value("${vehicle.jsonFile}")private String filePath;public List<Map<String, Object>> readJson() {List<Map<String, Object>> list = new ArrayList<>();if (filePath == null) {System.out.println("File path is null.");return list;}try (JsonReader reader = new JsonReader(new FileReader(filePath))) {Gson gson = new Gson();reader.beginObject(); // Start reading the root objectwhile (reader.hasNext()) {String name = reader.nextName();if ("RECORDS".equals(name)) {reader.beginArray(); // Start reading the arraywhile (reader.hasNext()) {JsonObject subObject = gson.fromJson(reader, JsonObject.class);list.add(subObject.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)));}reader.endArray(); // End reading the array} else {reader.skipValue(); // Skip other fields}}reader.endObject(); // End reading the root object} catch (IOException e) {e.printStackTrace();}return list;}}
package com.skyable.device.utils.velicle;import org.slf4j.Logger;
import org.slf4j.LoggerFactory;import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;public class PropertiesUtil {private static final Logger logger = LoggerFactory.getLogger(PropertiesUtil.class);private static Properties props;static {// 更具描述性的文件名String fileName = "application.test";props = new Properties();try (InputStreamReader reader = new InputStreamReader(PropertiesUtil.class.getClassLoader().getResourceAsStream(fileName), "UTF-8")) {props.load(reader);} catch (IOException e) {logger.error("配置文件读取异常", e);}}public static String getProperty(String key) {String value = props.getProperty(key.trim());return value != null ? value.trim() : null;}public static String getProperty(String key, String defaultValue) {String value = props.getProperty(key.trim());return value != null ? value.trim() : defaultValue;}
}
package com.skyable.device.utils.velicle;import org.slf4j.Logger;
import org.slf4j.LoggerFactory;import java.io.UnsupportedEncodingException;
import java.util.StringTokenizer;/*** @author Administrator*/
public class Utils {private static final Logger logger = LoggerFactory.getLogger(Utils.class);public static byte[] getIpByteArrayFromString(String ip) {byte[] ret = new byte[4];StringTokenizer st = new StringTokenizer(ip, ".");try {ret[0] = (byte) (Integer.parseInt(st.nextToken()) & 0xFF);ret[1] = (byte) (Integer.parseInt(st.nextToken()) & 0xFF);ret[2] = (byte) (Integer.parseInt(st.nextToken()) & 0xFF);ret[3] = (byte) (Integer.parseInt(st.nextToken()) & 0xFF);} catch (Exception e) {logger.error("Error while getting IP byte array from string: {}", e.getMessage());}return ret;}public static String convertString(String input, String sourceEncoding, String targetEncoding) {try {return new String(input.getBytes(sourceEncoding), targetEncoding);} catch (UnsupportedEncodingException e) {logger.error("Error while converting string: {}", e.getMessage());}return input;}public static String convertBytesToString(byte[] byteArray, String encoding) {try {return new String(byteArray, encoding);} catch (UnsupportedEncodingException e) {logger.error("Error while converting bytes to string: {}", e.getMessage());}return new String(byteArray);}public static String convertBytesToString(byte[] byteArray, int offset, int length, String encoding) {try {return new String(byteArray, offset, length, encoding);} catch (UnsupportedEncodingException e) {logger.error("Error while converting bytes to string: {}", e.getMessage());}return new String(byteArray, offset, length);}public static String getIpStringFromBytes(byte[] ipBytes) {StringBuilder sb = new StringBuilder();sb.append(ipBytes[0] & 0xFF);sb.append('.');sb.append(ipBytes[1] & 0xFF);sb.append('.');sb.append(ipBytes[2] & 0xFF);sb.append('.');sb.append(ipBytes[3] & 0xFF);return sb.toString();}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/110641.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

LiveNVR监控流媒体Onvif/RTSP功能-支持语音对讲支持非国标摄像头SDK语音对讲GB28181级联国标平台非国标转国标语音对讲

LiveNVR支持语音对讲支持非国标摄像头SDK语音对讲GB28181级联国标平台非国标转国标语音对讲 1、确认摄像头是否支持对讲2、摄像头视频类型复合流3、通道配置SDK接入4、视频广场点击播放5、相关问题5.1、如何配置通道获取直播流&#xff1f;5.2、如何GB28181级联国标平台&#x…

C语言每日一练------(Day3)

本专栏为c语言练习专栏&#xff0c;适合刚刚学完c语言的初学者。本专栏每天会不定时更新&#xff0c;通过每天练习&#xff0c;进一步对c语言的重难点知识进行更深入的学习。 今天练习题的关键字&#xff1a; 尼科彻斯定理 等差数列 &#x1f493;博主csdn个人主页&#xff1a…

服务器数据恢复-reiserfs文件系统损坏如何恢复数据?

服务器数据恢复环境&#xff1a; 一台IBM X系列服务器&#xff0c;4块SAS硬盘组建一组RAID5阵列&#xff0c;采用的reiserfs文件系统。服务器操作系统分区结构&#xff1a;boot分区LVM卷swap分区&#xff08;按照前后顺序&#xff09;。LVM卷中直接划分了一个reiserfs文件系统&…

时序预测 | MATLAB实现DBN-SVM深度置信网络结合支持向量机时间序列预测(多指标评价)

时序预测 | MATLAB实现DBN-SVM深度置信网络结合支持向量机时间序列预测(多指标评价) 目录 时序预测 | MATLAB实现DBN-SVM深度置信网络结合支持向量机时间序列预测(多指标评价)效果一览基本描述程序设计参考资料 效果一览 基本描述 MATLAB实现DBN-SVM深度置信网络结合支持向量机…

Nuxt3打包部署到Linux(node+pm2安装和运行步骤+nginx代理)

最近&#xff0c;我们项目组的工作接近尾声&#xff0c;需要把项目部署上线。由于前端第一次使用Nuxt3框架&#xff0c;后端也是第一次部署Nuxt3项目&#xff0c;所以刚开始出现了很多问题。在我上网搜索很多教程后&#xff0c;得到了基本的流程。 1.服务器安装node.js环境 N…

jdk 03.stream

01.集合处理数据的弊端 当我们在需要对集合中的元素进行操作的时候&#xff0c;除了必需的添加&#xff0c;删除&#xff0c;获取外&#xff0c;最典型的操作就是集合遍历 package com.bobo.jdk.stream; import java.util.ArrayList; import java.util.Arrays; import java.ut…

乡村振兴战略下传统村落文化旅游设计书辉瑞

乡村振兴战略下传统村落文化旅游设计书辉瑞

新KG视点 | Jeff Pan、陈矫彦等——大语言模型与知识图谱的机遇与挑战

OpenKG 大模型专辑 导读 知识图谱和大型语言模型都是用来表示和处理知识的手段。大模型补足了理解语言的能力&#xff0c;知识图谱则丰富了表示知识的方式&#xff0c;两者的深度结合必将为人工智能提供更为全面、可靠、可控的知识处理方法。在这一背景下&#xff0c;OpenKG组织…

【VLDB 2023】基于预测的云资源弹性伸缩框架MagicScaler,实现“高QoS,低成本”双丰收

开篇 近日&#xff0c;由阿里云计算平台大数据基础工程技术团队主导&#xff0c;与计算平台MaxCompute团队、华东师范大学数据科学与工程学院、达摩院合作&#xff0c;基于预测的云计算平台资源弹性伸缩框架论文《MagicScaler: Uncertainty-aware, Predictive Autoscaling 》被…

深度学习之反卷积

具体推理可以参考https://blog.csdn.net/zhsmkxy/article/details/107073350

SpringBoot中间件ElasticSearch

Elasticsearch是一个基于 Lucene 的搜索服务器。它提供了一个分布式多用户能力的 全文搜索引擎 &#xff0c;基于RESTful web 接口。 Elasticsearch 是用 Java 语言开发的&#xff0c;并作为 Apache 许可条款下的开放源码发布&#xff0c;是一种流行的企业级搜索引擎。Elastics…

【力扣每日一题】2023.8.24 统计参与通信的服务器

目录 题目&#xff1a; 示例&#xff1a; 分析&#xff1a; 代码&#xff1a; 题目&#xff1a; 示例&#xff1a; 分析&#xff1a; 题目顾名思义&#xff0c;要我们统计参与通信的服务器&#xff0c;给我们一个二维矩阵&#xff0c;元素为1的位置则表示是一台服务器。 …

ChatGPT Prompting开发实战(二)

一、基于LangChain源码react来解析prompt engineering 在LangChain源码中一个特别重要的部分就是react&#xff0c;它的基本概念是&#xff0c;LLM在推理时会产生很多中间步骤而不是直接产生结果&#xff0c;这些中间步骤可以被用来与外界进行交互&#xff0c;然后产生new con…

Leetcode 易错题整理(一)5. 7. 11. 15. 33. 34

5. 最长回文子串 给你一个字符串 s&#xff0c;找到 s 中最长的回文子串。 如果字符串的反序与原始字符串相同&#xff0c;则该字符串称为回文字符串。 示例 1&#xff1a; 输入&#xff1a;s "babad" 输出&#xff1a;"bab" 解释&#xff1a;"aba&q…

4. 池化层相关概念

4.1 池化层原理 ① 最大池化层有时也被称为下采样。 ② dilation为空洞卷积&#xff0c;如下图所示。 ③ Ceil_model为当超出区域时&#xff0c;只取最左上角的值。 ④ 池化使得数据由5 * 5 变为3 * 3,甚至1 * 1的&#xff0c;这样导致计算的参数会大大减小。例如1080P的电…

NVIDIA DLI 深度学习基础 答案 领取证书

最后一节作业是水果分类的任务&#xff0c;一共6类&#xff0c;使用之前学习的知识在代码段上进行填空。 加载ImageNet预训练的基础模型 from tensorflow import kerasbase_model keras.applications.VGG16(weights"imagenet",input_shape(224, 224, 3),include_t…

基于数据湖的多流拼接方案-HUDI实操篇

目录 一、前情提要 二、代码Demo &#xff08;一&#xff09;多写问题 &#xff08;二&#xff09;如果要两个流写一个表&#xff0c;这种情况怎么处理&#xff1f; &#xff08;三&#xff09;测试结果 三、后序 一、前情提要 基于数据湖对两条实时流进行拼接&#xff0…

Viobot基本功能使用及介绍

设备拿到手当然是要先试一下效果的&#xff0c;这部分可以参考本专栏的第一篇 Viobot开机指南。 接下来我们就从UI开始熟悉这个产品吧&#xff01; 1.状态 设备上电会自动运行它的程序&#xff0c;开启了一个服务器&#xff0c;上位机通过连接这个服务器连接到设备&#xff0c…

面试现场表现:展示你的编程能力和沟通技巧

&#x1f337;&#x1f341; 博主猫头虎 带您 Go to New World.✨&#x1f341; &#x1f984; 博客首页——猫头虎的博客&#x1f390; &#x1f433;《面试题大全专栏》 文章图文并茂&#x1f995;生动形象&#x1f996;简单易学&#xff01;欢迎大家来踩踩~&#x1f33a; &a…

成功项目风险预防可控的5个重点

成功的项目往往重视项目风险的预防和管控&#xff0c;这样有利于可能风险的及时控制和解决&#xff0c;将其不利影响降到最小。如果不重视对风险的预防和管控&#xff0c;不及时发现和处理项目风险&#xff0c;那么项目风险往往会为我们带来意想不到的不利后果&#xff0c;往往…