首页 文章 精选 留言 我的

精选列表

搜索[Cookie处理],共10000篇文章
优秀的个人博客,低调大师

阿里云人脸识别典型问题处理

1.子账号使用需要给子账号授权AliyunYundunCloudAuthFullAccess 2.报没有权限(NoPermissionError)的错误需要注意:目前人脸识别有两个版本 接口 endpoint 功能 老版本 dtplus-cn-shanghai.data.aliyuncs.com 人脸检测定位、人脸属性识别、人脸对比 新版本 face.cn-shanghai.aliyuncs.com 人脸检测定位、人脸属性识别、人脸对比、人脸检索(1:N人脸查找) 目前新版本已经正式商业化了,如果之前没有购买新版本,但代码还在调用,就有可能报NoPermissionError的。目前新版本仅支持按QPS预付费所以,如果使用人脸检测定位、人脸属性识别、人脸对比这三个接口,可以继续使用老版本,老版本目前支持按量付费和资源包的形式。但如果要使用人脸检索(1:N)目前只支持按QPS预付费,需要购买以后才可以使用,QPS要大于0 3.一个账户的全部图片的上限是5万,但Group、Person没有限制 4.Q:使用效率,调用需要多久?A:这个和具体图片有关系,比如待检测的图片中存在多个人脸,时间就会久一点,一般几秒钟就可以返回结果的。

优秀的个人博客,低调大师

Aspose-Words文档处理类库

简介 Aspose.Words for Java is a class library that enables your applications to perform a great range of document processing tasks. Aspose.Words supports DOC, DOCX, RTF, HTML, OpenDocument, PDF, XPS, EPUB and other formats. With Aspose.Words you can generate, modify, convert, render and print documents without using Microsoft Word®. 官网文档: https://docs.aspose.com/display/wordsjava/Home官网代码示例: https://github.com/aspose-words/Aspose.Words-for-Java.git 同类别软件: Apache POI 注: Aspose需要商业授权,POI开源免费 对于简单的文档关键字替换使用POI 复杂的表格编辑,使用Aspose中的标签替换 对于替换参数(数字,文本,表格,图片等),可封装替换参数,增强代码的适用性 代码示例 Java类库 Maven <dependency> <groupId>com.aspose</groupId> <artifactId>aspose-words</artifactId> <version>19.5</version> <classifier>jdk17</classifier> </dependency> 直接引入Jar aspose-words-19.5-jdk17.jar 简单示例 加载license try { License license = new License(); license.setLicense("Aspose.Words.lic"); System.out.println("License set successfully."); } catch (Exception e) { System.out.println("There was an error setting the license: " + e.getMessage()); } Word->PDF File file = new File("/Test-01.docx"); Document document = new Document(new FileInputStream(file)); PdfSaveOptions pdfSaveOptions = new PdfSaveOptions(); pdfSaveOptions.getOutlineOptions().setHeadingsOutlineLevels(5); OutputStream outputStream = new FileOutputStream("/Test-01.pdf"); document.save(outputStream,pdfSaveOptions); 书签文本替换 document.getRange().getBookmarks().get(bookMakeName).setText(word);

优秀的个人博客,低调大师

计算广告与流处理技术综述

案例与解决方案汇总页:阿里云实时计算产品案例&解决方案汇总 1.计算广告背景 广告仍然是互联网公司的主要变现手段,其市场规模2017年已达3000亿元,据统计全球互联网市值前十的公司广告收入占比高达40%,可见其重要性。在这种情况下,与互联网广告相关的技术,我们称之为计算广告,也是最为成熟,市场规模最大的大数据应用领域。 互联网广告领域经过长期发展,分工逐渐精细化,除了各种代理商之外,还出现了ADN、SSP、ADX、DSP等各种平台,市场结构极为复杂,成为了一个巨大的生态。LUMA Partners针对北美市场绘制了一幅全景图,如下。 从经济学上看,上面复杂的市场结构可以认为是社会化大生产的产物,而广告的本质其实非常简单,无非是在合适的上下文中寻求受众与广告的匹配,追求媒体、用户和广告主的三方共赢。 2.计算广告技术架构 互联网广告从

优秀的个人博客,低调大师

JAVA时间格式处理工具类

import java.text.DateFormat;import java.text.ParseException;import java.text.SimpleDateFormat;import java.util.Calendar;import java.util.Date; public class DateUtil { /** * 默认日期格式 */ public static String DEFAULT_FORMAT = "yyyy-MM-dd"; private static final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); private static final SimpleDateFormat formatMs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.sss"); /** * 格式化日期 * @param date 日期对象 * @return String 日期字符串 */ public static String formatDate(Date date){ SimpleDateFormat f = new SimpleDateFormat(DEFAULT_FORMAT); String sDate = f.format(date); return sDate; } /** * 格式化日期 * @param str 日期对象 * @return String 日期字符串 */ public static Date formatDate(String str){ Date date = null; try{ SimpleDateFormat f = new SimpleDateFormat(DEFAULT_FORMAT); date = f.parse(str); }catch (Exception e){ e.printStackTrace(); } return date; } /** * 获取某年第一天日期 * @param date 账期 * @return Date */ public static String getYearFirst(String date){ Calendar calendar = Calendar.getInstance(); calendar.clear(); calendar.set(Calendar.YEAR, Integer.parseInt(date.substring(0, 4))); Date currYearFirst = calendar.getTime(); return formatDate(currYearFirst); } /** * 获取上年第一天日期 * @param date 账期 * @return Date */ public static String getLastYearFirst(String date){ Calendar calendar = Calendar.getInstance(); calendar.clear(); calendar.set(Calendar.YEAR, Integer.parseInt(date.substring(0, 4))); calendar.add(Calendar.YEAR, -1); Date currYearFirst = calendar.getTime(); return formatDate(currYearFirst); } /** * 获取某日的前一天日期 * @return Date */ public Date getDaysBefore(String dateString, int days) throws ParseException { DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); Date inputDate = dateFormat.parse(dateString); Calendar cal = Calendar.getInstance(); cal.setTime(inputDate); int dayOfYear = cal.get(Calendar.DAY_OF_YEAR); cal.set(Calendar.DAY_OF_YEAR, dayOfYear - days); return cal.getTime(); } /** * 获取某月上一个月份 * @return Date */ public Date getMonthsBefore(String dateString, int months) throws ParseException { DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); Date inputDate = dateFormat.parse(dateString); Calendar cal = Calendar.getInstance(); cal.setTime(inputDate); int monthOfYear = cal.get(Calendar.MONTH); cal.set(Calendar.MONTH, monthOfYear - months); return cal.getTime(); } /** * 获取某月第一天日期 * @return Date */ public Date getFisrtDayOfMonth(String dateString) throws ParseException { DateFormat dateFormat = new SimpleDateFormat("yyyyMM"); Date inputDate = dateFormat.parse(dateString); Calendar cal = Calendar.getInstance(); cal.setTime(inputDate); int firstDay = cal.getActualMinimum(Calendar.DAY_OF_MONTH); cal.set(Calendar.DAY_OF_MONTH, firstDay); return cal.getTime(); } /** * 获取某月最后一天日期 * @return Date */ public Date getLastDayOfMonth(String dateString) throws ParseException { DateFormat dateFormat = new SimpleDateFormat("yyyyMM"); Date inputDate = dateFormat.parse(dateString); Calendar cal = Calendar.getInstance(); cal.setTime(inputDate); int lastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH); cal.set(Calendar.DAY_OF_MONTH, lastDay); return cal.getTime(); } /** * 获取最后一个月的第一天日期 * @return Date */ public static String getLastMonthFirstDay() { Calendar cal_1 = Calendar.getInstance(); cal_1.add(Calendar.MONTH, -1); cal_1.set(Calendar.DAY_OF_MONTH, 1); String firstDay = format.format(cal_1.getTime()); System.out.println("-----1------firstDay:" + firstDay); return firstDay; } /** * 获取最后一个月最后一天日期 * @return Date */ public static String getLastMonthlastDay() { Calendar cale = Calendar.getInstance(); cale.set(Calendar.DAY_OF_MONTH, 0); String lastDay = format.format(cale.getTime()); System.out.println("-----2------lastDay:" + lastDay); return lastDay; } /** * 获取当前月第一天日期 * @return Date */ public static String getCurrentMonthFirstDay() { Calendar c = Calendar.getInstance(); c.add(Calendar.MONTH, 0); c.set(Calendar.DAY_OF_MONTH, 1); String first = format.format(c.getTime()); System.out.println("===============first:" + first); return first; } /** * 获取当前月最后一天日期 * @return Date */ public static String getCurrentMonthlastDay() { Calendar ca = Calendar.getInstance(); ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH)); String last = format.format(ca.getTime()); System.out.println("===============last:" + last); return last; } /** * 获取当前年份第一天日期 * @return Date */ public static Date getCurrYearFirst() { Calendar currCal = Calendar.getInstance(); int currentYear = currCal.get(Calendar.YEAR); return getYearFirst(currentYear); } /** * 根据传入的参数获取该年的第一天 * @return Date */ public static Date getCurrYearFirst(String dateString) throws ParseException { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date inputDate = dateFormat.parse(dateString); Calendar cal = Calendar.getInstance(); cal.setTime(inputDate); int currentYear = cal.get(Calendar.YEAR); return getYearFirst(currentYear); } /** * 根据传入的参数获取该年月 * @return Date */ public static String getMonth(String dateString) throws ParseException { DateFormat dateFormat = new SimpleDateFormat("MM"); Date inputDate = dateFormat.parse(dateString); Calendar cal = Calendar.getInstance(); cal.setTime(inputDate); return formatDate(cal.getTime()); } /** * 获取当前年份最后一天 * @return Date */ public static Date getCurrYearLast() { Calendar currCal = Calendar.getInstance(); int currentYear = currCal.get(Calendar.YEAR); return getYearLast(currentYear); } /** * 根据传入的参数获取该年 * @return Date */ public static Date getYearFirst(int year) { Calendar calendar = Calendar.getInstance(); calendar.clear(); calendar.set(Calendar.YEAR, year); Date currYearFirst = calendar.getTime(); return currYearFirst; } /** * 根据传入的参数获取该年 * @return Date */ public static Date getYearLast(int year) { Calendar calendar = Calendar.getInstance(); calendar.clear(); calendar.set(Calendar.YEAR, year); calendar.roll(Calendar.DAY_OF_YEAR, -1); Date currYearLast = calendar.getTime(); return currYearLast; } /** * 根据传入的参数获取该年月 * @return Date */ public static String getCurrentYear(){ SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); Date date = new Date(); return sdf.format(date);} /** * 根据传入的参数获取该年月 * @return Date */ public static String getLastYear() { Calendar date = Calendar.getInstance(); date.add(Calendar.YEAR, -1); String year = String.valueOf(date.get(Calendar.YEAR)); return year; } /** * 现在时间+6个月与next_time比较 * @return */ public static String getStaleDated(){ SimpleDateFormat sdfTimeStamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.sss"); Date date= new Date(); Calendar cd = Calendar.getInstance(); cd.setTime(date); cd.add(Calendar.MONTH, 6); date=cd.getTime(); String stale_dated = sdfTimeStamp.format(date); return stale_dated; } /** * 获取当前时间 * @return */ public static String currentDatetime(){ SimpleDateFormat tempDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String datetime = tempDate.format(new java.util.Date()); return datetime; } /** * 获取当前时间 * * @return */ public static String getYyMmtime() { SimpleDateFormat tempDate = new SimpleDateFormat("yyyy-MM"); String datetime = tempDate.format(new java.util.Date()); return datetime; } /** * 日期计算 * @param date * @param type * @param number * @return */ public static String calculateDate(String date,String type,int number){ try{ // SimpleDateFormat sdfTimeStamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.sss"); SimpleDateFormat sdfTimeStamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //String create_time = sdfTimeStamp.format(new Date()); Date tmpDate = sdfTimeStamp.parse(date); Calendar cd = Calendar.getInstance(); cd.setTime(tmpDate); if(type.equals("m")){ cd.add(Calendar.MONTH, number); }else if (type.equals("d")){ cd.add(Calendar.DAY_OF_MONTH, number); }else { return "type is unknown"; } tmpDate = cd.getTime(); String dateRuslt = sdfTimeStamp.format(tmpDate); return dateRuslt; }catch(Exception ex){ return "calculate failed"; } } public static Date getDateByStr(String string){ //String string = "2016-10-24 21:59:06"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date =null; try{ date = sdf.parse(string); System.out.println(sdf.parse(string)); }catch (Exception e){ e.printStackTrace(); } return date; } public static String getStrByDate(Date date) { //String string = "2016-10-24 21:59:06"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String dateTime = null; try { dateTime = sdf.format(date); } catch (Exception e) { e.printStackTrace(); } return dateTime; } public static String getUpdateTime(){ //当前时间重写更新时间 SimpleDateFormat sdfTimeStamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.sss"); String update_time = sdfTimeStamp.format(new Date()); return update_time; } public static void main(String[] args) throws ParseException { DateUtil dateTest = new DateUtil(); // DateFormat df = new SimpleDateFormat("yyyyMMdd"); // Date before7Day = dateTest.getDaysBefore("20140301", 7); // System.out.println(df.format(before7Day)); // Date testFirstDay = dateTest.getLastDayOfMonth("201407"); // System.out.println(df.format(testFirstDay)); // Date testBeforeMonth = dateTest.getMonthsBefore("20140712", 12); // System.out.println(df.format(testBeforeMonth)); // DateFormat df2 = new SimpleDateFormat("yyyyMM"); // Date getFisrtDayOfMonth = dateTest.getFisrtDayOfMonth("201407"); // System.out.println(df2.format(getFisrtDayOfMonth)); System.out.println(getStaleDated()); // System.out.println(formatDate(getCurrYearLast()));// String stObj="2016-3-21";// String[] timeDay = stObj.split("-");// System.out.println(timeDay[1]); } }

优秀的个人博客,低调大师

Flask跨域请求的处理方法

在Flask开发RESTful后端时,前端请求会遇到跨域的问题。下面是解决方法: 使用 flask-cors库可以很容易的解决 pip install flask-cors 两种方法,一个是全局/批量的,一个是单一独立的: 安全起见,一般来说使用独立的方式会常用一些。 1.独立方式 通过给路由添加@cross_origin标识即可 from flask import Flask, jsonify from flask_cors import cross_origin @app.route('/upload', methods=['POST', 'OPTIONS']) @cross_origin() def upload(): # todo result_text = {"result": "True"} return jsonify(result_text) 2.全局方式 也很简单: from flask import Flask from flask_cors import CORS app = Flask(__name__) CORS(app) if __name__ == '__main__': app.run(host='0.0.0.0', threaded=True, debug=True) 这样所有的路由都会支持跨域了,新版本好像不好用了,ke'yi'shi'shi 3.批量方式 还有根据路由正则来批量控制等方式,更加灵活,可以查阅官方文档。 from flask import Flask from flask_cors import CORS app = Flask(__name__) CORS(app, resources={r"/api/*": {"origins": "*"}}) if __name__ == '__main__': app.run(host='0.0.0.0', threaded=True, debug=True)

优秀的个人博客,低调大师

Java 异常处理 之 运行期异常

http://www.verejava.com/?id=16992970828178 package com.exception; public class TestException { public static void main(String[] args) { //对运行期异常, 我们可以不捕获, 也可以捕获 int[] scores = { 60, 70, 80 }; // java.lang.ArrayIndexOutOfBoundsException: 数组越界 try { //试一试 System.out.println(scores[3]); } catch (ArrayIndexOutOfBoundsException e) { System.out.println("发生了数组越界异常"); } } } http://www.verejava.com/?id=16992970828178

资源下载

更多资源
优质分享App

优质分享App

近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

用户登录
用户注册
修改密码
忘记密码