我需要针对 Postgres 列触发选择查询jsonb:
entityManager.createNativeQuery(
"select * from table where jsonbcol -> 'usernames' ? :un"
).setParameter("un", userName).getResultList()
Run Code Online (Sandbox Code Playgroud)
运行时抛出异常:
org.hibernate.engine.query.ParameterRecognitionException: Mixed parameter strategies -
use just one of named, positional or JPA-ordinal strategy
Run Code Online (Sandbox Code Playgroud)
我尝试像\\?和 一样逃避??,但这没有帮助。
如何正确地进行该调用?
给定以下课程:
class A {
B b
int data
int data2
}
class B {
C c
String data
}
class C {
Date data
}
Run Code Online (Sandbox Code Playgroud)
该代码工作正常:
Date now = new Date()
def a = [ data:42, data2:84, b:[ data:'BBB', c:[ data:now ] ] ] as A
assert a.b.c.data == now
assert a.data == 42
assert a.data2 == 84
Run Code Online (Sandbox Code Playgroud)
现在,如果我省略data2:84,代码仍然可以正常工作,当然除了最后一个assert。
但!如果我“拼错”属性名称,例如:
def a = [ data:42, data22:84, b:[ data:'BBB', c:[ data:now ] ] ] as A
Run Code Online (Sandbox Code Playgroud)
我越来越 …
我有 2 个相对简单的 Gradle 6.1.1 配置,一个是使用https://plugins.gradle.org/plugin/com.github.node-gradle.node来构建一个 React 应用程序,另一个是基于https: //plugins.gradle.org/plugin/com.bmuschko.tomcat并在嵌入式 tomcat 中运行一个简单的 wicket 应用程序。
npm 任务的第一个配置是:
apply plugin: 'com.github.node-gradle.node'
node {
version = '12.16.0'
download = true
workDir = file "$project.buildDir/nodejs"
}
task "npmBuild"( type:NpmTask ) {
args = [ 'run', 'build' ]
}
Run Code Online (Sandbox Code Playgroud)
并在 Windows 10 中产生以下输出:
>gradlew.bat npmBuild
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :npmBuild
> layer-selection@0.1.0 build .....
> react-scripts build
Creating an optimized production build...
Compiled with warnings. …Run Code Online (Sandbox Code Playgroud) 我有这样的代码:
\nimport React, { Component } from 'react'\nimport MapboxGL from '@react-native-mapbox-gl/maps'\n\nMapboxGL.setAccessToken( 'xxxx' )\n\nexport default class DebugMap extends Component {\n\n render() {\n return <View style={{ flex: 1}}>\n \n <MapboxGL.MapView\n ref={(c) => (this.map = c)}\n onPress={v => this.map.moveTo( 40, 10 )}\n style={{flex: 1}}>\n\n <MapboxGL.Camera\n zoomLevel={10}\n centerCoordinate={[50, 20]}\n />\n </MapboxGL.MapView>\n\n </View>\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n地图通常显示为以 为中心50, 20,但如果我按下它,则会引发错误:
TypeError: _this3.map.moveTo is not a function. (In '_this3.map.moveTo(48, 11)', '_this3.map.moveTo' is undefined)\nRun Code Online (Sandbox Code Playgroud)\n我缺少什么?
\n更新:
\n如果我console.info( 'load map', this.map ) …
在我的应用程序中,我有以下代码:
<Svg width={W} height={H} viewBox={viewBox} style={style} preserveAspectRatio="none">
<Defs>
<Mask id="mask" x={0} y={0} width={W} height={H} maskUnits="userSpaceOnUse" maskContentUnits='userSpaceOnUse'>
<Nested name="Path" animated d={path} stroke="white" strokeLinejoin="round" strokeWidth={10} strokeDasharray="5 60" strokeDashoffset={pathOffset}/>
</Mask>
</Defs>
<G mask="url(#mask)">
<Nested name="Path" d={path} stroke="orange" strokeLinejoin="round"/>
{fields.map( f => <Nested key={f.id} {...f}/>)}
</G>
</Svg>
Run Code Online (Sandbox Code Playgroud)
其中是、和其他 RN-SVG 元素Nested的委托。PathCircle
现在,如果G@mask删除了,Android 模拟器或真实设备上的元素将如下所示:
它的G@mask显示精度降低/像素化/模糊:
我准备了一份小吃 -> https://snack.expo.dev/@injecteer/react-native-svg-mask,在网络模式下,带有动画的蒙版看起来很好(底线):
如何完全精确地显示屏蔽元素?我缺少什么?
在我自己编写之前,有没有人知道Groovy或Java是否预先构建了类似于Excel的sumproduct函数的东西?
sumproduct的准语法是这样的
def list1 = [2,3,4]
def list2 = [5,10,20]
SUMPRODUCT(list1, list2 ...) = 120
Run Code Online (Sandbox Code Playgroud)
你会得到120((2*5)+(3*10)+(4*20)= 120)
我正在使用Grails Criteria(类似于hibernate标准)来获取给定表中每个部门中获得最高分的学生列表.而我想要的只是Name,Division和Grade领域.
Name | Division | Grade | Std_id
---------------------------------
AA1 | A | 2 | 1
AA2 | A | 4 | 2
BB1 | B | 2 | 3
BB2 | B | 5 | 4
Run Code Online (Sandbox Code Playgroud)
我想要的结果是
Name | Division | Grade |
--------------------------
AA2 | A | 4 |
BB2 | B | 5 |
Run Code Online (Sandbox Code Playgroud)
如果我使用以下标准
def criteria = Student.createCriteria()
def resultlt = criteria.list {
projections {
groupProperty('divison')
max('grade') …Run Code Online (Sandbox Code Playgroud) grails hibernate criteria hibernate-criteria nhibernate-projections
我对事件总线/ Hazelcast 的工作原理缺乏一点了解。
想象一下消费者和生产者 Verticle 通过集群 EB 进行通信的情况。消耗部分是进行CPU/内存/IO密集型计算。
当在某个时刻由于负载而消费者无法立即处理消息时,会发生什么?
消息是否会在环形缓冲区内排队并最终在稍后处理(考虑到 NettySingleThreadEventLoop根据vert.x 中事件总线的大小限制为 20 亿条)?达到上限后会被丢弃吗?
一般来说,只要集群中没有组件崩溃, EB 中的消息是否可以被认为是持久的并且具有传递保证?
我的设置很简单:
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swiperefresh"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="220dp"/>
</android.support.v4.widget.SwipeRefreshLayout>
Run Code Online (Sandbox Code Playgroud)
内容onCreate():
layoutManager = new LinearLayoutManager( this );
layoutManager.setOrientation( LinearLayoutManager.HORIZONTAL );
topTopicRecyclerView.setLayoutManager( layoutManager );
Run Code Online (Sandbox Code Playgroud)
现在,当我向左或向右滑动recyclelerView并且滑动角度不是完全水平时,SwipeRefreshLayout会跳入并接管滚动控件.这会导致recyclerView内部出现恼人的视觉"打嗝".
如果禁用SwipeRefreshLayout,一切都很好.
那么,如何在RecyclerView的区域上停用SwipeRefreshLayout的滚动控件?
我正在试验递归:
def fac
//fac = { int curr, res = 1G -> 1 >= curr ? res : fac( curr - 1, res * curr ) }
fac = { int curr, res = 1G -> 1 >= curr ? res : fac.trampoline( curr - 1, res * curr ) }
fac = fac.trampoline()
def rnd = new Random()
long s = System.currentTimeMillis()
100000.times{ fac rnd.nextInt( 40 ) }
println "done in ${System.currentTimeMillis() - s} ms / ${fac(40)}"
Run Code Online (Sandbox Code Playgroud)
如果我像这样使用它,我会得到这个:
在 …
我想在带有 gradle 的 groovy 类上使用 Mapstruct 映射器。build.gradle 中的配置看起来像 Java 项目中的配置。
dependencies {
...
compile 'org.mapstruct:mapstruct:1.4.2.Final'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.2.Final'
testAnnotationProcessor 'org.mapstruct:mapstruct-processor:1.4.2.Final' // if you are using mapstruct in test code
}
Run Code Online (Sandbox Code Playgroud)
问题是没有生成映射器的实现类。我还尝试为 groovy 编译任务应用不同的选项,但它不起作用。
compileGroovy {
options.annotationProcessorPath = configurations.annotationProcessor
// if you need to configure mapstruct component model
options.compilerArgs << "-Amapstruct.defaultComponentModel=default"
options.setAnnotationProcessorGeneratedSourcesDirectory( file("$projectDir/src/main/generated/groovy"))
}
Run Code Online (Sandbox Code Playgroud)
有谁知道 Mapstruct 是否可以与 groovy 类一起工作以及我必须如何配置它?
groovy ×4
javascript ×3
react-native ×3
hibernate ×2
java ×2
android ×1
casting ×1
criteria ×1
font-size ×1
gradle ×1
grails ×1
hazelcast ×1
jpa ×1
jsonb ×1
mapbox-gl-js ×1
mapstruct ×1
node.js ×1
postgresql ×1
recursion ×1
svg ×1
tomcat ×1
trampolines ×1
vert.x ×1