新浪微博开发步骤:
1、进入新浪开发者平台,注册账号并完善开发者信息,然后根据他的提示创建应用,根据自己需要创建不同类型的应用(我的是网页应用)。
2、点击我的应用-->应用信息,我们可以查看到自己应用的App key和App Secret 和应用地址,点击高级信息在授权设置里面设置你的回调地址,这个随便你写,我写的是新浪的默认地址:https://api.weibo.com/oauth2/default.html。
3、下载新浪微博开发的java SDK。把他导入到开发工具,可以看到项目下有几个包:
3.1:src包配置文件config.properties和相关的java文件。
3.2:example包是微博开发的用例。
3.3:(重要)lib目录下的架包,如果要在其他项目用到微博开发,千万别忘记把这些包进 去,可以手动放到lib目录下再build apth 或者maven添加都行。
4、config的配置:
client_ID =自己应用的App key
client_SERCRET =应用的App secret
baseURL=https://api.weibo.com/2/
redirect_URI =https://api.weibo.com/oauth2/default.html
accessTokenURL=https://api.weibo.com/oauth2/access_token
authorizeURL=https://api.weibo.com/oauth2/authorize
rmURL=https://rm.api.weibo.com/2/
5、模拟登录进行开发,通常情况下我们要转发或者发布微博都要经过授权,授权就需要登录,所以我们使用httpCilent模拟登陆,返回用户授权的code以此来获取taken的值,也就是授权的code,然后进行相应的微博操作,代码:
public static AccessToken getToken(String username, String password) throws HttpException, IOException { String clientId = WeiboConfig.getValue("client_ID"); String redirectURI = WeiboConfig.getValue("redirect_URI"); String url = WeiboConfig.getValue("authorizeURL"); PostMethod postMethod = new PostMethod(url); // 应用的App Key postMethod.addParameter("client_id", clientId); // 应用的重定向页面 postMethod.addParameter("redirect_uri", redirectURI); // 模拟登录参数 // 开发者或测试账号的用户名和密码 postMethod.addParameter("userId", username); postMethod.addParameter("passwd", password); postMethod.addParameter("isLoginSina", "0"); postMethod.addParameter("action", "submit"); postMethod.addParameter("response_type", "code"); HttpMethodParams param = postMethod.getParams(); param.setContentCharset("UTF-8"); // 添加头信息 List<Header> headers = new ArrayList<Header>(); headers.add(new Header("Referer", "https://api.weibo.com/oauth2/authorize?action=submit&client_id=" + clientId + "&redirect_uri=" + redirectURI + "&response_type=code")); headers.add(new Header("Host", "api.weibo.com")); headers.add(new Header("User-Agent", "Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20100101 Firefox/11.0")); HttpClient client = new HttpClient(); client.getHostConfiguration().getParams() .setParameter("http.default-headers", headers); client.executeMethod(postMethod); int status = postMethod.getStatusCode(); System.out.println(status); if (status != 302) { System.out.println("token刷新失败"); return null; } // 解析Token Header location = postMethod.getResponseHeader("Location"); if (location != null) { System.out.println(location); String retUrl = location.getValue(); int begin = retUrl.indexOf("code="); if (begin != -1) { int end = retUrl.indexOf("&", begin); if (end == -1) end = retUrl.length(); String code = retUrl.substring(begin + 5, end); if (code != null) { System.out.println(code); Oauth oauth = new Oauth(); try { AccessToken token = oauth.getAccessTokenByCode(code); return token; } catch (Exception e) { e.printStackTrace(); } } } } return null; }
6、获取了taken的值,就可以进行微博发、/获取用户信息等的操作。发布微博的代码如下:
public static boolean sinaSendWeibo(AccessToken aToken, String content) throws Exception { String token = aToken.getAccessToken(); System.out.println(token + "token的值:"); boolean flag = false; Timeline timeline = new Timeline(); timeline.client.setToken(token); try { timeline.UpdateStatus(content); flag = true; } catch (WeiboException e) { flag = false; System.out.println(e.getErrorCode()); } return flag; }
腾讯微博开发:
1、同样需要注册为开发者,建立应用。
2、
public class UpdateTencentWeibo { private DefaultHttpClient httpClient; private static final int CONNECT_TIME_OUT = 5000; private static final int SOCKET_TIME_OUT = 5000; private static final int MAX_CONNECTIONS_PRE_HOST = 20; private static final int MAX_TOTAL_CONNECTIONS = 200; public UpdateTencentWeibo() { this(CONNECT_TIME_OUT, SOCKET_TIME_OUT, MAX_CONNECTIONS_PRE_HOST, MAX_TOTAL_CONNECTIONS, null, null); } public UpdateTencentWeibo(int connectTimeOut, int socketTimeOut, int maxConnectionsPreHost, int maxTotalConnections, List<RouteCfg> routeCfgs, HttpHost proxy) { //注册ssl协议 SSLContext ssl = null; SchemeRegistry schemeRegistry = null; X509TrustManager x509TrustManager = null; SSLSocketFactory sslSocketFactory = null; try { ssl = SSLContext.getInstance("TLS"); x509TrustManager = new X509TrustManager() { @Override public X509Certificate[] getAcceptedIssuers() { // TODO Auto-generated method stub return null; } @Override public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { // TODO Auto-generated method stub } @Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { } }; ssl.init(null, new TrustManager[]{x509TrustManager}, null); sslSocketFactory = new SSLSocketFactory(ssl); sslSocketFactory.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); //注册http和https协议 schemeRegistry = new SchemeRegistry(); schemeRegistry.register(new Scheme("https", 443, sslSocketFactory)); // schemeRegistry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory())); } catch (NoSuchAlgorithmException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (KeyManagementException e) { // TODO Auto-generated catch block e.printStackTrace(); } //配置客户端链接管理类 ThreadSafeClientConnManager connManager = new ThreadSafeClientConnManager(schemeRegistry); connManager.setDefaultMaxPerRoute(maxConnectionsPreHost); connManager.setMaxTotal(maxTotalConnections); //配置http请求连接参数 HttpParams httpParams = new BasicHttpParams(); httpParams.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, connectTimeOut); httpParams.setParameter(CoreConnectionPNames.SO_TIMEOUT, socketTimeOut); //http协议参数配置 HttpProtocolParams.setVersion(httpParams, HttpVersion.HTTP_1_1); HttpProtocolParams.setUseExpectContinue(httpParams, false); //启用cookie HttpClientParams.setCookiePolicy(httpParams, CookiePolicy.BROWSER_COMPATIBILITY); //对特定ip端口修改最大连接数 if (routeCfgs != null) { for (RouteCfg routeCfg : routeCfgs) { HttpHost host = new HttpHost(routeCfg.getHost(), routeCfg.getPort()); connManager.setMaxForRoute(new HttpRoute(host), routeCfg.getMaxConnetions()); } } //初始化httpClient httpClient = new DefaultHttpClient(connManager,httpParams); //添加headers List<Header> headers = new ArrayList<Header>(); headers.add(new BasicHeader(HttpHeaders.ACCEPT, "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")); headers.add(new BasicHeader(HttpHeaders.ACCEPT_LANGUAGE, "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3")); headers.add(new BasicHeader(HttpHeaders.ACCEPT_CHARSET, "UTF-8")); headers.add(new BasicHeader(HttpHeaders.USER_AGENT, "Mozilla/5.0 (Windows NT 5.1; rv:25.0) Gecko/01 Firefox/25.0")); headers.add(new BasicHeader(HttpHeaders.CONNECTION, "keep-alive")); headers.add(new BasicHeader("X-Forwarded-For", "..0.1")); headers.add(new BasicHeader("Client-IP", "..0.1")); headers.add(new BasicHeader("API-RemoteIP", "..0.1")); httpClient.getParams().setParameter("http.default-headers", headers); //设置代理 if (proxy != null) { httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); } } /** * 模拟腾讯微博登陆 * @return code值 */ public TLoginParams doLogin(String username, String password) { Properties properties = initProperties(); String clientID = properties.getProperty("client_id"); String redirectURI = properties.getProperty("redirect_uri"); HashMap<String, String> urlMap = getUrlMap(clientID, redirectURI); String dataRedirect = urlMap.get("data-redirect"); HashMap<String, String> loginInfoMap = preLogin(urlMap); String loginSig = loginInfoMap.get("login_sig"); String loginUrl = loginInfoMap.get("login_url"); HashMap<String, String> checkMap = isHasVC(dataRedirect, username, loginSig, loginUrl); String isHasVC = checkMap.get("isHasVC"); String vc = checkMap.get("vc"); String saltUin = checkMap.get("saltUin"); TLoginParams tLoginParams = new TLoginParams(); if (Integer.parseInt(isHasVC) != 0) { tLoginParams.setDataRedirect(dataRedirect); tLoginParams.setLoginSig(loginSig); tLoginParams.setLoginUrl(loginUrl); tLoginParams.setSaltUin(saltUin); tLoginParams.setImgURl(getVCode(username)); return tLoginParams; } String checkSigUrl = finalLogin(vc, saltUin, dataRedirect, username, password, loginSig, loginUrl); System.out.println(checkSigUrl); Properties result = authorize(loginUrl, checkSigUrl); tLoginParams.setProp(result); return tLoginParams; } /** * 有验证码时验证登陆 * @param vc * @param saltUin * @param dataRedirect * @param username * @param password * @param loginSig * @param loginUrl * @return */ public TLoginParams doLoginByVC(String vc, String saltUin, String dataRedirect, String username, String password, String loginSig, String loginUrl) { TLoginParams tLoginParams = new TLoginParams(); String checkSigUrl = finalLogin(vc, saltUin, dataRedirect, username, password, loginSig, loginUrl); if (checkSigUrl.equals("您输入的验证码不正确,请重新输入。")) { tLoginParams.setLogin(false); return tLoginParams; } Properties prop = authorize(loginUrl, checkSigUrl); tLoginParams.setProp(prop); return tLoginParams; } /** * 初始化登陆,获取含有sessionkey的url提交链接 * @param clientID 应用ID * @param redirectURI 应用回调地址 * @return */ private HashMap<String, String> getUrlMap(String clientID, String redirectURI) { String url = "https://open.t.qq.com/cgi-bin/oauth2/authorize?" + "client_id=" + clientID + "&response_type=code" + "&redirect_uri=" + redirectURI + "&forcelogin=true"; Header[] headers = new BasicHeader[]{ new BasicHeader(HttpHeaders.HOST, "open.t.qq.com") }; String htmlDatas = httpGetDatas(url, headers); HashMap<String, String> map = new HashMap<String, String>(); String data_redirect = null; String data_proxy = null; htmlDatas = htmlDatas.substring(htmlDatas.indexOf("<noscript"),htmlDatas.indexOf("/noscript>")); System.out.println(htmlDatas); data_redirect = htmlDatas.substring(htmlDatas.indexOf("data-redirect")+15,htmlDatas.indexOf("data-proxy")-2); data_proxy = htmlDatas.substring(htmlDatas.indexOf("data-proxy")+12,htmlDatas.indexOf("\">")); System.out.println(data_redirect); System.out.println(data_proxy); map.put("data-redirect", data_redirect); map.put("data-proxy", data_proxy); return map; } /** * 预登陆腾讯微博,获取login_sig * @param urlMap 初始化登陆返回的urlMap * @return */ private HashMap<String, String> preLogin(HashMap<String, String> urlMap) { String s_url_encode = null; String proxy_url_encode = null; String script = null; try { s_url_encode = URLEncoder.encode(urlMap.get("data-redirect"), "UTF-8"); proxy_url_encode = URLEncoder.encode(urlMap.get("data-proxy"), "UTF-8"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } String url = "https://ui.ptlogin2.qq.com/cgi-bin/login?appid=01" + "&s_url=" + s_url_encode + "&proxy_url=" + proxy_url_encode + "&f_url=loginerroralert" + "&style=13" + "&daid=6" + "&pt_no_auth=1" + "&hide_close_icon=1" + "&link_target=blank" + "&target=blank" + "&hide_title_bar=1" + "&no_drop_domain=1" + "&dummy=1" + "&bgcolor=ffffff" + "&r=" + Math.random(); Header[] headers = new BasicHeader[]{ new BasicHeader(HttpHeaders.HOST, "ui.ptlogin2.qq.com") }; String htmlDatas = httpGetDatas(url, headers); String headConetnt = htmlDatas.substring(htmlDatas.indexOf("<head"),htmlDatas.indexOf("/head>")); script = headConetnt.substring(headConetnt.indexOf("<script"),headConetnt.indexOf("/script>")); String login_sig = script.substring(script.indexOf("login_sig:"), script.indexOf("\",clientip")); String login_sig_key = login_sig.substring(login_sig.indexOf("\"") + 1); HashMap<String, String> loginMap = new HashMap<String, String>(); loginMap.put("login_sig", login_sig_key); loginMap.put("login_url", url); return loginMap; } /** * 检查预登陆时是否需要验证码 * @param dataRedirect 初始化登陆返回的map * @param username 用户名 * @param loginSig TODO * @param loginUrl TODO * @return */ private HashMap<String, String> isHasVC(String dataRedirect, String username, String loginSig, String loginUrl){ String url = null; try { url = "https://ssl.ptlogin2.qq.com/check?" + "regmaster=" + "&uin=" + username + "&appid=01" + "&js_ver=52" + "&js_type=1" + "&login_sig=" + loginSig + "&u1=" + URLEncoder.encode(dataRedirect, "UTF-8") + "&r=" + Math.random(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } Header[] headers = new BasicHeader[]{ new BasicHeader(HttpHeaders.REFERER, loginUrl) }; String htmlDatas = httpGetDatas(url, headers); String str = htmlDatas.substring(htmlDatas.indexOf("(") + 1, htmlDatas.indexOf(");")); String[] strs = str.split(","); String isHasVC = strs[0].substring(strs[0].indexOf("'") + 1, strs[0].lastIndexOf("'")); HashMap<String,String> checkVCMap = new HashMap<String, String>(); checkVCMap.put("isHasVC", isHasVC); String vc = strs[1].substring(strs[1].indexOf("'") + 1, strs[1].lastIndexOf("'")); checkVCMap.put("vc", vc); String saltUin = strs[2].substring(strs[2].indexOf("'") + 1, strs[2].lastIndexOf("'")); checkVCMap.put("saltUin", saltUin); return checkVCMap; } /** * 获取当前用户登陆所需要的验证码 * @param username 用户名 * @return */ public String getVCode(String username) { String imageUrl = "https://ssl.captcha.qq.com/getimage?" + "uin=" +username + "&aid=01" + "&" + Math.random(); return imageUrl; } /** * 保存验证码 * @param url 验证码链接 */ public void saveVCodeImg(String url) { HttpGet getImages = new HttpGet(url); HttpResponse response = null; try { response = httpClient.execute(getImages); byte[] imageBytes = EntityUtils.toByteArray(response.getEntity()); FileOutputStream fileWrite = new FileOutputStream("vc.jpg"); fileWrite.write(imageBytes); fileWrite.close(); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * 模拟最终登陆 * @param vc 验证码信息 * @param dataRedirect 链接信息 * @param username 用户名 * @param password 密码 * @param loginSig TODO * @param loginUrl TODO * @param saltUin TODO * @return */ private String finalLogin(String vc, String saltUin, String dataRedirect, String username, String password, String loginSig, String loginUrl){ String p = null; try { p = TencentWeiboEncryption.getPassword(saltUin, password, vc); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } String url = null; try { url = "https://ssl.ptlogin2.qq.com/login?" + "u=" + URLEncoder.encode(username, "UTF-8") + "&p=" + p + "&verifycode=" + vc + "&aid=01" + "&u1=" + URLEncoder.encode(dataRedirect, "UTF-8") + "&h=1" + "&ptredirect=1" + "&ptlang=2" + "&daid=6" + "&from_ui=1" + "&dumy=" + "&low_login_enable=0" + "®master=" + "&fp=loginerroralert" + "&action=2-20-" + new Date().getTime() + "&mibao_css=" + "&t=1" + "&g=1" + "&js_ver=52" + "&js_type=1" + "&login_sig=" + loginSig + "&pt_rsa=0"; } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } Header[] headers = new BasicHeader[]{ new BasicHeader(HttpHeaders.REFERER, loginUrl) }; String htmlDatas = httpGetDatas(url, headers); String str = htmlDatas.substring(htmlDatas.indexOf("(") + 1, htmlDatas.indexOf(");")); String[] strs = str.split(","); String checkUrl = strs[2].substring(strs[2].indexOf("'") + 1, strs[2].lastIndexOf("'")); String loginResult = strs[4].substring(strs[4].indexOf("'") + 1, strs[4].lastIndexOf("'")); if (loginResult.equals("登录成功!")) { return checkUrl; } return loginResult; } /** * 获取最终授权 * @param loginUrl * @param checkSigUrl * @return */ private Properties authorize(String loginUrl, String checkSigUrl) { Properties prop = null; if (checkSigUrl != null) { Header[] headers = new BasicHeader[]{ new BasicHeader(HttpHeaders.REFERER, loginUrl) }; String htmlDatas = httpGetDatas(checkSigUrl, headers); System.out.println(htmlDatas); String content = htmlDatas.substring(htmlDatas.indexOf("<meta")); // Document document = Jsoup.parse(htmlDatas); // // Element element = document.getElementsByTag("meta").first(); // // String content = element.attr("content");; // String subContent = content.substring(content.indexOf("?") + 1); String propStr = subContent.replace("&", "\n"); System.out.println("propStr"+propStr); prop = new Properties(); InputStream stream = new ByteArrayInputStream(propStr.getBytes()); try { prop.load(stream); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return prop; } /** * 提交URL,并获取页面数据(GET方式) * @param url 请求页面 * @param headers http请求header * @return */ private String httpGetDatas(String url,Header[] headers) { String response =null; HttpResponse httpResponse = null; if (url == null) { throw new NullPointerException("URL is null"); } HttpGet httpGet = new HttpGet(url); httpGet.setHeaders(headers); try { httpResponse = httpClient.execute(httpGet); response = EntityUtils.toString(httpResponse.getEntity()); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return response; } /** * 初始化配置信息 * @return */ public Properties initProperties() { Properties properties = new Properties(); InputStream inputStream = Thread.currentThread(). getContextClassLoader().getResourceAsStream("cfg.properties"); try { properties.load(inputStream); } catch (IOException e) { e.printStackTrace(); } return properties; } public static void init(OAuthV2 oAuth){ oAuth.setClientId("801535535"); oAuth.setClientSecret("615b9601f90625572ec9d4effe55a93b"); oAuth.setRedirectUri("http%3A%2F%2Fwww.baidu.com"); } public static void main(String[] args) { OAuthV2 authV2 = new OAuthV2(); init(authV2); updateStatus(authV2,"测试,"); } public static void updateInfo(String content){ OAuthV2 authV2 = new OAuthV2(); init(authV2); updateStatus(authV2,content); } public static void updateStatus(OAuthV2 authV2,String content){ UpdateTencentWeibo loginer = new UpdateTencentWeibo(); TLoginParams tLoginParams = loginer.doLogin("hzhbgfwb@sina.com","xjzx8484"); //有验证码时 if (tLoginParams.getProp() == null) { String saltUin = tLoginParams.getSaltUin(); String dataRedirect = tLoginParams.getDataRedirect(); String loginSig = tLoginParams.getLoginSig(); String loginUrl = tLoginParams.getLoginUrl(); String imgUrl = tLoginParams.getImgURl(); //要返回的验证码 System.err.println(imgUrl); //测试再次获取验证码 imgUrl = loginer.getVCode(""); //保存验证码(用于测试并查看验证码) loginer.saveVCodeImg(imgUrl); Scanner input = new Scanner(System.in); String vc = input.nextLine(); TLoginParams loginresult =loginer.doLoginByVC(vc, saltUin, dataRedirect, "", "", loginSig, loginUrl); //如果验证码录入错误,则重新获取并返回验证码 if (!loginresult.isLogin()) { System.err.println("验证码错误!重新录入"); imgUrl = loginer.getVCode(""); loginer.saveVCodeImg(imgUrl); Scanner input2 = new Scanner(System.in); String vc1 = input2.nextLine(); Properties codeProp = loginer.doLoginByVC(vc1, saltUin, dataRedirect, "", "", loginSig, loginUrl).getProp(); //System.out.println(TencentWeiboOAuth.getOAuthV2Instance(codeProp)); }else { //验证码正确则直接输出结果 Properties codeProp = loginresult.getProp(); //System.out.println(TencentWeiboOAuth.getOAuthV2Instance(codeProp)); } }else { //无验证码时 Properties codeProp = tLoginParams.getProp(); System.out.println(codeProp); authV2.setOpenid(codeProp.getProperty("openid")); authV2.setOpenkey(codeProp.getProperty("openkey")); authV2.setAuthorizeCode(codeProp.getProperty("code")); authV2.setGrantType("authorize_code"); try { OAuthV2Client.accessToken(authV2); System.out.println(authV2.getAccessToken()+"taken的值"); UserAPI getuser = new UserAPI(authV2.getOauthVersion()); String userJson = getuser.otherInfo(authV2, "json", "", authV2.getOpenid()); JSONObject userJsonObject = JSONObject.fromObject(userJson); Integer errcode = (Integer) userJsonObject.get("errcode"); if (errcode == 0) { JSONObject userdataJsonObject = (JSONObject) userJsonObject.get("data"); System.out.println(userdataJsonObject.toString()); } TAPI tapi = new TAPI(authV2.getOauthVersion()); tapi.add(authV2, "json", content, "218.108.6.124"); } catch (Exception e) { e.printStackTrace(); } } } }
具体请参考:http://blog.csdn.net/chengxuyuan20100425/article/details/8773393
相关推荐
本文将深入探讨如何使用Java中的HttpClient4库来实现对新浪和腾讯微博的模拟登录。HttpClient4是一个强大的HTTP客户端库,它允许开发者执行HTTP请求并处理响应,非常适合进行网页交互。 首先,我们来看`Sina.java`...
基于arm64版本的docker-compose文件
台区终端电科院送检文档
埃夫特机器人Ethernet IP 通讯配置步骤
rv320e机器人重型关节行星摆线减速传动装置研发
气缸驱动爬杆机器人的设计().zip
56tgyhujikolp[
内容概要:本文档提供了基于OpenCV的数字身份验证系统的Python代码示例,涵盖人脸检测、训练和识别三个主要功能模块。首先,通过调用OpenCV的CascadeClassifier加载预训练模型,实现人脸检测并采集多张人脸图像用于后续训练。接着,利用LBPH(局部二值模式直方图)算法对面部特征进行训练,生成训练数据集。最后,在实际应用中,系统能够实时捕获视频流,对比已有的人脸数据库完成身份验证。此外,还介绍了必要的环境配置如依赖库安装、文件路径设置以及摄像头兼容性的处理。 适合人群:对计算机视觉感兴趣的研发人员,尤其是希望深入了解OpenCV库及其在人脸识别领域的应用者。 使用场景及目标:适用于构建安全认证系统的企业或机构,旨在提高出入管理的安全性和效率。具体应用场景包括但不限于门禁控制系统、考勤打卡机等。 其他说明:文中提供的代码片段仅为基本框架,可根据实际需求调整参数优化性能。同时提醒开发者注意隐私保护法规,合法合规地收集和使用个人生物识别信息。
内容概要:本文档详细介绍了Java并发编程的核心知识点,涵盖基础知识、并发理论、线程池、并发容器、并发队列及并发工具类等方面。主要内容包括但不限于:多线程应用场景及其优劣、线程与进程的区别、线程同步方法、线程池的工作原理及配置、常见并发容器的特点及使用场景、并发队列的分类及常用队列介绍、以及常用的并发工具类。文档旨在帮助开发者深入理解和掌握Java并发编程的关键技术和最佳实践。 适合人群:具备一定Java编程经验的研发人员,尤其是希望深入了解并发编程机制、提高多线程应用性能的中级及以上水平的Java开发者。 使用场景及目标:①帮助开发者理解并发编程的基本概念和技术细节;②指导开发者在实际项目中合理运用多线程和并发工具,提升应用程序的性能和可靠性;③为准备Java技术面试的候选人提供全面的知识参考。 其他说明:文档内容详尽,适合用作深度学习资料或面试复习指南。建议读者结合实际编码练习,逐步掌握并发编程技巧。文中提到的多种并发工具类和容器,均附有具体的应用场景和注意事项,有助于读者更好地应用于实际工作中。
这个数据集包含了日常步数统计、睡眠时长、活跃分钟数以及消耗的卡路里,是个人健康与健身追踪的一部分。 该数据集非常适合用于以下实践: 数据清洗:现实世界中的数据往往包含缺失值、异常值或不一致之处。例如,某些天的步数可能缺失,或者存在不切实际的数值(如10,000小时的睡眠或负数的卡路里消耗)。通过处理这些问题,可以学习如何清理和准备数据进行分析。 探索性分析(发现日常习惯中的模式):可以通过分析找出日常生活中的模式和趋势,比如一周中哪一天人们通常走得最多,或是睡眠时间与活跃程度之间的关系等。 构建可视化图表(步数趋势、睡眠与活动对比图):将数据转换成易于理解的图形形式,有助于更直观地看出数据的趋势和关联。例如,绘制步数随时间变化的趋势图,或是比较睡眠时间和活动量之间的关系图。 数据叙事(将个人风格的追踪转化为可操作的见解):通过讲述故事的方式,把从数据中得到的洞察变成具体的行动建议。例如,根据某人特定时间段内的活动水平和睡眠质量,提供改善健康状况的具体建议。
资源内项目源码是来自个人的毕业设计,代码都测试ok,包含源码、数据集、可视化页面和部署说明,可产生核心指标曲线图、混淆矩阵、F1分数曲线、精确率-召回率曲线、验证集预测结果、标签分布图。都是运行成功后才上传资源,毕设答辩评审绝对信服的保底85分以上,放心下载使用,拿来就能用。包含源码、数据集、可视化页面和部署说明一站式服务,拿来就能用的绝对好资源!!! 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、大作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.txt文件,仅供学习参考, 切勿用于商业用途。
nginx
资源内项目源码是来自个人的毕业设计,代码都测试ok,包含源码、数据集、可视化页面和部署说明,可产生核心指标曲线图、混淆矩阵、F1分数曲线、精确率-召回率曲线、验证集预测结果、标签分布图。都是运行成功后才上传资源,毕设答辩评审绝对信服的保底85分以上,放心下载使用,拿来就能用。包含源码、数据集、可视化页面和部署说明一站式服务,拿来就能用的绝对好资源!!! 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、大作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.txt文件,仅供学习参考, 切勿用于商业用途。
资源内项目源码是来自个人的毕业设计,代码都测试ok,包含源码、数据集、可视化页面和部署说明,可产生核心指标曲线图、混淆矩阵、F1分数曲线、精确率-召回率曲线、验证集预测结果、标签分布图。都是运行成功后才上传资源,毕设答辩评审绝对信服的保底85分以上,放心下载使用,拿来就能用。包含源码、数据集、可视化页面和部署说明一站式服务,拿来就能用的绝对好资源!!! 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、大作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.txt文件,仅供学习参考, 切勿用于商业用途。
模拟知识付费小程序,可流量主运营模式
什么是普通上传 调用接口一次性完成一个文件的上传。 普通上传2个缺点 文件无法续传,比如上传了一个比较大的文件,中间突然断掉了,需要重来 大文件上传太慢 解决方案 分片上传
英二2010-2021阅读理解 Part A 题干单词(补).pdf
2023-04-06-项目笔记-第四百五十五阶段-课前小分享_小分享1.坚持提交gitee 小分享2.作业中提交代码 小分享3.写代码注意代码风格 4.3.1变量的使用 4.4变量的作用域与生命周期 4.4.1局部变量的作用域 4.4.2全局变量的作用域 4.4.2.1全局变量的作用域_1 4.4.2.453局变量的作用域_453- 2025-04-01
微信小程序项目课程设计,包含LW+ppt
GP300单缸液压圆锥破碎机CAD().zip