Primefaces Signature组件曲线拟合,以保持字符串值小于4000个字符。

huangapple go评论51阅读模式
英文:

Primefaces Signature component curve fitting to keep String value to less than 4000 characters

问题

需要将p:signature的值持久化到Oracle。我正在使用该组件的字符串值(JSON行),但经常用户在他们的草书签名上过于精细,导致字符串超过Oracle字段的4000字符限制。我实施了一个验证器来确保不超过4k字符,但当表单被退回时,用户感到沮丧,因为他们不得不重试。

是否有一种方法可以缩小生成的行数据的JSON表示,但仍然使签名在视觉上看起来相同?就像曲线拟合函数一样。如果我只是将字符串截断为4k,那只是截断了签名的末尾。

如果该组件能够设置曲线的精度或最大标志,以自动保持JSON表示字符数不超过最大字符数,那将是不错的。

英文:

I need to persist the value of p:signature in Oracle. I'm using the String value (JSON lines) of the component but often users get too elaborate with their cursive signature and the string exceeds the 4000 character limit on the Oracle field. I implemented a validator to ensure 4k or less but users get frustrated when form kicks back and they have to retry.

Is there a way to minify the json representation of the line data generated but still have the signature still visually look the same? Like a curve fitting function. If I simply truncate the string to 4k, that just truncates the end of the signature.

It would be nice if the component had a way to set precision of the curve or max flag that would automatically keep the JSON representation to less a maximum number of characters.

答案1

得分: 1

你试图将一个方形销子塞进一个圆孔中。签名的大小就是它的大小。即使你对其进行压缩,也不能保证它会小于4k。你应该为你的数据使用正确的列类型。在这种情况下,可以使用CLOB(或BLOB)。

英文:

You are trying to hammer a square peg in a round hole. A signature is as big as it is. Even if you compress it, it's never guaranteed to be less than 4k. You should use the correct column type for your data. In this case either a CLOB (or a BLOB).

huangapple
  • 本文由 发表于 2023年2月10日 04:58:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/75404354.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定