h2

Java AWT生成滑动验证码

╄→гoц情女王★ 提交于 2019-12-06 05:10:28
最近工作需要在登录时使用滑动验证码验证。 网上能查到的做法基本上都是使用一张已存在的实际图片作为滑块的图形模板,然后按照此模板做二重循环逐像素地从源图像抠出滑块以及新图。 这种方式优点就是可以控制每个像素,如改变局部的 Alpha 值、做局部的高斯模糊等。缺点也显而易见——太麻烦,且二重循环对内存也是不小的负担。 笔者的想法是:首先生成滑块 1)根据规定好的路径生成闭合区间;2)设置 Graphics2D 的渲染区间( setClip 方法);3)使用原图来渲染当前 Image( drawImage 方法)。最后在源图扣掉滑块的地方加上阴影。 研究了一下 Java 的 awt 图像处理,这里对这几天的成果做一个记录,本文仅涉及图像处理方面,去掉了其它业务逻辑。 生成闭合区间 Java awt中提供了 Shape 接口,来代表任意一种几何图形。考虑我们要实现如下滑块图形: 上图左边的滑块可以先简化为右侧,原理是一样的。右边的图像一共有A、B、C、D、E、F六个定点。其中CD之间是一段圆弧。Graphics2D的坐标系从左上角开始,x轴往下是正方向,y轴往右是正方向。先算出每个点坐标:A(0,0)、B(0,50)、C(15,50)、D(35,50)、E(50,50)、F(50,0)。 注意到H1'和H2'两个点,CD间的圆弧由三阶贝塞尔曲线表示,H1'和H2'就是此贝塞尔曲线的控制点

H2 db not accessible at localhost:8080/h2-console when using webflux

天涯浪子 提交于 2019-12-06 05:05:27
H2 db is not accessible at localhost:8080/h2-console when using webflux. I read somewhere that this is available only when developing a Servlet based application. But I am using Webflux with Netty. So is there a way to see the h2 console in such an application? I had the same issue, I ended up booting the console server manually on another port: @Component @Profile("test") // <-- up to you public class H2 { private org.h2.tools.Server webServer; private org.h2.tools.Server server; @EventListener(org.springframework.context.event.ContextRefreshedEvent.class) public void start() throws java.sql

H2 database and functions in separate schemas

99封情书 提交于 2019-12-06 03:45:11
I'm trying to create a test database (with H2 database). I'm using Oracle in production, and it seems nice to have oracle compatibility mode in h2. However I've got a problem with translating oracle construction: create or replace PACKAGE permission_tools IS FUNCTION get_role_access_level( p_role_id IN NUMBER, p_permiss IN VARCHAR2) RETURN NUMBER; END permission_tools; which I'm calling with: select permission_tools.get_access_level(?, ?) from dual; into H2 equivalent. I've been trying something like: CREATE SCHEMA PERMISSION_TOOLS; CREATE ALIAS PERMISSION_TOOLS.GET_ACCESS_LEVEL as $$ String

How do you connect to H2 as a remote database instead of embedded mode using Spring Boot?

走远了吗. 提交于 2019-12-06 03:40:53
I have this configuration under src/main/resources for my little Spring Boot application: server.port = 8090 spring.datasource.driverClassName = org.h2.Driver spring.datasource.url = jdbc:h2:file:~/stapler I know this configuration is picked up properly, cause there is valid port number 8090 in application startup log. There is also a @PostConstruct initDb() method which creates and inserts data into 2 tables of that database: package com.avk.stapler.init; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org

H2 database create alias for function in package in schema

帅比萌擦擦* 提交于 2019-12-06 03:25:39
In my code I call stored procedure like this (and it works perfectly): { ? = call schema.package.function(?) } I need to call it like this because jdbc connection is set to another schema. But for now I can't test it because H2 database doesn't support packages. So if I change my jdbc url database name to the one I require and delete " schema " from the call everything is ok while testing. @Test fun test() { val session = em.entityManager.unwrap(Session::class.java) session.doWork { val st = it.createStatement() st.execute("create schema if not exists mySchema") st.execute("create alias

对话实录|华为云.通信云服务激活无限商业潜力

岁酱吖の 提交于 2019-12-06 02:06:32
在LiveVideoStackCon2019深圳音视频技术大会前夕,我们邀请到了华为云核心网产品线,高级架构师左俊老师接受采访,采访中左俊老师从自身十五年的架构师经验出发浅谈了自己对于近几年音视频通话技术的发展,并从覆盖场景、数据安全和视频质量审核等方面介绍了华为云通信云服务的优势。 文 / 左俊 整理 / LiveVideoStack LiveVideoStack:左俊你好,能否先向LiveVideoStack的读者介绍下自己,以及你目前主要的工作以及关注的技术方向? 左俊: 我目前主要的负责是华为云.通信云服务整个解决方案的架构和技术。华为云.通信云服务目前包括如下四个服务:视频通话服务、隐私保护通话服务、语音通话服务、短信服务。当下,我主要关注的有以下两点: 音视频方案中的效果及质量问题,这个是整个音视频解决方案最为基础的部分,华为在运营商市场实时音视频的成功实践,为解决互联网视频通话的效果和质量问题,提供有效的借鉴和支撑,这也是华为云.视频通话服务快速孵化的基础。 解决方案中的安全韧性及合法合规问题,虽然这不是基础业务的一部分,但是这个是客户能够获取持久保障的前提,华为很看重这一块,也能够保证向客户持续地提供可靠可信的服务。 此外还有系统的开放性灵活性,成本管理,客户的个性化服务等,也都是整个解决方案中不可或缺的一环。 LiveVideoStack

H2 database - CSVREAD - skip loading header line of the csv file into db

谁都会走 提交于 2019-12-06 01:13:21
I am using H2 DB in my java application. I want to load a .csv file to the DB. This file contains column headers as the first line of the file. So while loading the file into the DB through CSVREAD command, H2 is trying to parse the first line also and thus failing. So how to skip loading the first line. Below the query I am using to load the file to the DB: "CREATE TABLE TEST (CIRCLE VARCHAR_IGNORECASE(50), MSISDN VARCHAR_IGNORECASE(50), PORT_IN_DATE TIMESTAMP, OPERATOR VARCHAR_IGNORECASE(255), PRODUCT_TYPE VARCHAR_IGNORECASE(255), PORT_ID VARCHAR_IGNORECASE(255)) AS SELECT * FROM CSVREAD(

Play framework 2.4.3 evolutions not triggered

吃可爱长大的小学妹 提交于 2019-12-05 23:56:38
I'm doing the todo tutorial of Play. When I created the evolution in conf/evolutions/default/1.sql nothing happens. I just get the Exception JdbcSQLException: Table "TASK" not found which makes sense. I applied the evolution manually to the DB with h2-browser in activator console and after that it works. But the evolutions don't show up automatically. application.conf # Database configuration # ~~~~~ # You can declare as many datasources as you want. # By convention, the default datasource is named `default` # db.default.driver=org.h2.Driver db.default.url="jdbc:h2:mem:play" db.default

Query Failing in Postgres but Working in H2 (Postgres Mode)

烈酒焚心 提交于 2019-12-05 22:20:37
I often find myself in a situation where I want to write automated tests for my database queries. My current use case is a Spring MVC web app and a Postgres database. As far as I can tell, I have two options: Stand up an actual Postgres instance and initialize it with a test data set Utilize an in-memory database such as H2. I have used Option #1 in the past (albeit with an Oracle database and Oracle XE) with good success. The main downfall of this approach is that the tests aren't self contained. In order to successfully run the Integration Tests, you'd need to actually setup the database

Spring Data JPA Unable to locate Attribute with the the given name

女生的网名这么多〃 提交于 2019-12-05 21:25:25
问题 I was trying to use Spring Data JPA on Spring Boot and I kept getting error, I can't figure out what the problem is: Unable to locate Attribute with the the given name [firstName] on this ManagedType [com.example.h2demo.domain.Subscriber] FirstName is declared in my entity class. I have used a service class with DAO before with different project and worked perfectly. My Entity class (getters and setters are also in the class) : @Entity public class Subscriber { @Id @GeneratedValue private