java

Setting custom font color for XSSFWorkbook in Apache POI

回眸只為那壹抹淺笑 提交于 2021-02-18 21:01:43
问题 I'm having a little trouble with setting a custom font color for an XSSFWorkbook from Apache POI . When I do: yellow = workbook.createCellStyle(); Font whiteFont = workbook.createFont(); whiteFont.setColor(new XSSFColor(new Color(255, 255, 255)).getIndexed()); yellow.setFillForegroundColor(new XSSFColor(yellowRGB)); yellow.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND); yellow.setFont(whiteFont); The font stays black, I'm not sure what I'm doing wrong though. 回答1: You can do whiteFont

JDBC Prepared statement parameter inside json

梦想的初衷 提交于 2021-02-18 21:00:46
问题 I have a table which has a data column with an structure similar to following: {"title": "some title", "objects": [{"id": "id1"}, {"id": "id2"}]} now I want to find all rows that have an object with specific id in their objects array inside data. Following query works perfectly from PSQL console: SELECT id, data FROM table_name WHERE data->'objects' @> '[{"id": "id1"}]' however I can not get this to work as a prepared statement over JDBC driver. the value for id should be a parameter, so I

介绍一款 API 敏捷开发工具

左心房为你撑大大i 提交于 2021-02-18 21:00:34
点击上方 Java后端 , 选择 设为星标 优质文章,及时送达 初衷 用尽可能简单的方式,完成尽可能多的需求。通过约定的方式 实现统一的标准。告别加班,拒绝重复劳动,远离搬砖 特性 用于快速开发API接口。不再定义 Controller , Service , Dao , Mybatis , xml , Entity , VO 等对象和方法. 可视化界面,将入参自动封装到可执行的脚本上,支持所有关系性数据库SQL执行语句,非关系型 MONGODB 查询语句.欢迎扩展 完全基于springboot2.x 作为springboot项目的stater方式集成,无侵入性,新老项目都能快速集成 只需编写一行代码即可完成大部分的业务需求开发,使用难度级别(测试 or 运维)也可参与开发 在线动态编译,无需重启,即时生效,多数据源操作 版本控制,历史记录比对,回滚等功能 远程一键发布到线上环境 线上POSTMAN调试,保存POSTMAN信息或三方文档的自动生成,历史调用记录存储,回塑 代码提示,SQL提示,语法提示 用户管理控制,安全性控制,以及历史行为记录 经过多次项目验证,传统业务型开发,服务端效率能够提升3-5倍,前后端联调提升效率1倍,测试效率2倍提升 传统开发步骤: 增加一张表 创建实体对象,映射这张表 创建API入参VO 创建API出参VO 创建Controller

OkHttp enable/disable gzip compression on requests

懵懂的女人 提交于 2021-02-18 20:59:42
问题 I'm using Retrofit to manage my requests and want to make some tests to check de request size using or not using gzip. By default does OkHttp performs gzip compression to requests or it must be implemented with an interceptor? I've added @Headers({ "Accept-Encoding: gzip, deflate", "Content-Encoding: gzip" }) or: @Headers({ "Content-Type: application/json;charset=utf-8", "Accept: application/json" }) to my requests and did not see any change on the request length. 回答1: OkHttp will do

Setting custom font color for XSSFWorkbook in Apache POI

 ̄綄美尐妖づ 提交于 2021-02-18 20:59:40
问题 I'm having a little trouble with setting a custom font color for an XSSFWorkbook from Apache POI . When I do: yellow = workbook.createCellStyle(); Font whiteFont = workbook.createFont(); whiteFont.setColor(new XSSFColor(new Color(255, 255, 255)).getIndexed()); yellow.setFillForegroundColor(new XSSFColor(yellowRGB)); yellow.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND); yellow.setFont(whiteFont); The font stays black, I'm not sure what I'm doing wrong though. 回答1: You can do whiteFont

Kotlin cannot access kotlin.jvm.functions.Function1 when calling kotlin function with java lambda

筅森魡賤 提交于 2021-02-18 20:52:08
问题 I am trying to call the following Kotlin function from Java override fun First(list: LinqList<ElementType>, condition: (ElementType) -> Boolean) : ElementType like this int first = list.First(list,(x) -> x == 5); but i get the following error Error java: cannot access kotlin.jvm.functions.Function1 class file for kotlin.jvm.functions.Function1 not found I have tried googling it but i can not find the answer anywhere Thanks in advance 回答1: My problem got fixed when I configured Kotlin compiler

什么是无代码?无代码开发平台的优劣势比对!

ⅰ亾dé卋堺 提交于 2021-02-18 20:46:17
近年来,很多传统的企业正在面临数字化转型的压力,为了能够快速适应行业变化和超越竞争对手,在高级技术人才缺乏的情况下,低代码和无代码开发获得了众多传统企业的青睐。 特别是在2020年疫情爆发以来,带火了数字化办公,这让企业IT系统和业务的结合更加紧密。 无代码开发的理念就是根据:云办公,表单工具、视频会议、直播等业务需求不断衍生而来的新事物。 目前国内无代码这类开发工具还不算多,如明道云、织信Informat等,它们与VB等开发工具非常相似。都是提供了可视化编程方法,通过拖拽组件,更高效的构建业务应用程序。 一、什么是无代码? 无代码开发从字面上就很容易理解,开发软件过程中,不需要编写代码,只需通过拖拽的方式就可以实现各种软件的构建。这就是无代码。 在以前的话,企业想要一套系统软件,还需要找程序员通过机器语言、计算机语言来进行编程,例如C、C#、Java等、告诉计算机自己的逻辑和想法。但无代码就是可以使用自然语言,人类语言进行编程。 例如我想要一套公司人事管理系统,你把自己的需求和设计样式告诉电脑以后,电脑就可以知道你的想法,并帮你制作出来一套人事管理系统。 更抽象的你可以直接理解为,平时你使用office软件时,使用到的各种居中、合并、左对齐、间隔多少之类的排版,都是只通过一个按键就实现的,无代码开发也可以理解为,只要我给一个需求,按一个健就能实现功能。

How can I use ant <exec> to execute commands on linux?

房东的猫 提交于 2021-02-18 20:42:05
问题 I would like to use ant to exectue a command like below: <exec executable="echo ptc@123 | sudo -S /app/Windchill_10.0/Apache/bin/apachectl -k stop"> </exec> But it replies an error say The ' characters around the executable and arguments are not part of the command. The background is: I want to use ant to stop the apache server but it doesn't installed by the same user I run the command. Anyone could help or give me some clues? Thanks in advance 回答1: Ant's <exec> task uses Java's Process

throws、throw和try catch

…衆ロ難τιáo~ 提交于 2021-02-18 20:33:46
在学习代理模式的时候,编写动态生成代理类.java文件时,用try{}catch(){}捕获异常发现catch(Exception e)报错,得换成catch(Throwable e),然后又查了查两者的区别,在文章最后附上。 这里还是要码一码throws、throw和try catch三者的关系,关键让自己加深印象。 先介绍一下 try catch finally的基本运行流程 : 在try语句块中,放入的是你感觉会出现错误的代码,在catch语句块中放入的就是如果try语句块中的代码抛出异常之后所要执行的代码。 try { 代码1; 代码2; } catch (Exception e){ 代码3; } finally { 代码4; } 代码5 1. 正常执行,代码1没有抛出异常,程序的执行顺序就是代码1,代码2,代码4,代码5,。因为没有抛出异常所以跳过了catch语句块。 2. 代码1抛出异常,被catch语句块捕获,而catch语句块中的代码没有抛出新的异常,这样的执行顺序就是代码1,代码3,代码4,代码5。 3. 代码1抛出异常,catch语句块捕获并抛出新的异常,这时候的执行顺序应该为代码1,代码3,代码4,并抛出异常。不执行代码5。 4. 代码1抛出异常,而catch语句块没有与之匹配的异常,那么它的执行顺序就是代码1,代码4.并将异常返回给方法调用者。不执行代码5。

Java Junit test HTTP POST request

六月ゝ 毕业季﹏ 提交于 2021-02-18 20:30:14
问题 I need to test the following method with out altering the method itself. The method makes a POST method to a server. But I need to make a test case that's independent from the server. I tested a similar method before redirecting it to a local file. But that for that I was giving protocol as file, hostname as localhost and port as -1. My problem is that this method does a post and casts to HttpURLConnection and wr = new DataOutputStream(conn.getOutputStream()); wont work on an local txt file