是否可以使用条件查询grails并接收地图列表而不是列表列表?我想在结果中使用列名称,然后使用"关联数组"而不是数组数组偏移.我现在做的事情就像
def topFiveUsers = BlogEntry.createCriteria().list {
projections {
count('id')
groupProperty('author')
}
maxResults 5
}
Run Code Online (Sandbox Code Playgroud)
结果[[123, app.User:1][111, app.User:2][...]...],即列表列表.我宁愿想要类似的东西[[posts:123, author: app.User:1][posts: 111, author app.User:2][...]...].
一如既往:非常感谢帮助!
我正在向公共领域的一些同事展示一个grails应用程序.到目前为止,我正在开发模式,并没有通过战争部署.
我需要确保应用程序安全,以防止他们查看/播放它.我已经有一个用户mgmt,但在sb看到任何我希望有.htpasswd之类的保护之前.如果可能的话,我不想用插件扩展应用程序本身(例如,shiro).
有什么想法/建议?
非常感谢!
我javax.imageio.ImageIO用来将a BufferedImage b写入字节数组,最后写入文件。创建字节数组时,十分之十java.lang.IndexOutOfBoundsException会抛出a。但是,仅使用相同的图像是无法复制的。
BufferedImage img = ...
ByteArrayOutputStream baos = new ByteArrayOutputStream();
// the next line will lead to the exception being thrown
ImageIO.write(img, "png", baos);
byte[] byteArray = baos.toByteArray()
Run Code Online (Sandbox Code Playgroud)
结果是:
java.lang.IndexOutOfBoundsException
Line | Method
->> 166 | seek in
javax.imageio.stream.FileCacheImageOutputStream
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - …Run Code Online (Sandbox Code Playgroud)