小编fir*_*iel的帖子

使用createCriteria时如何在GORM中设置偏移量?

我只是想知道'createCriteria'是否可以指定类似于动态查找器(findAll等)的paginateParams(即偏移量)

请注意,此代码无效,因为http://www.greils.org/doc/1.2.1/ref/Domain%20Classes/createCriteria.html中未记录"offset" .

def c = SnbrItemActDistance.createCriteria()
def results = c.list {
    eq('iid', newsId)
    ge('distance', cap)

    maxResults(count)
    offset(offset)
    order('distance', 'desc')
}
Run Code Online (Sandbox Code Playgroud)

grails grails-orm

3
推荐指数
1
解决办法
4735
查看次数

使用Mail插件在Grails中附加文件

我正在使用邮件0.9,似乎附件功能仍然没有?直到现在这个项目还没有包括在内吗?

如果是这种情况,请告诉我如何扩展Grails插件而不直接破解代码.

谢谢.

email grails plugins

2
推荐指数
1
解决办法
3974
查看次数

MSSQL在GORM中的varchar(n)等价物

我想知道如果数据库是MS SQL 2005,是否可以设置VARCHAR列的大小.这是我的域名:

class UpdateTable {

    static mapping = {
        table 'UpdateTable'
        id column: 'UpdateFileId', generator: 'increment'
        version false
        fileName column: 'FileName', size: 50
    }

    String fileName
}
Run Code Online (Sandbox Code Playgroud)

请注意,它使用VARCHAR(255)生成"FileName"列.我想将它设置为VARCHAR(25).也试过这个,但它没有用

static mapping = {
    ..
    fileName column: 'FileName', length: 50
}
Run Code Online (Sandbox Code Playgroud)

感谢您的任何线索.

grails grails-orm

2
推荐指数
1
解决办法
2298
查看次数

如何在TabActivity中访问Activity的方法

我想使用TabActivity访问由Activity运行的Activity的公共方法:

TabHost tabHost = getTabHost();
Intent intentMsgsView = new Intent().setClass(this, TeamHuddleScreenMsgsView.class);
tabHost.addTab(tabHost.newTabSpec("msgs").setIndicator("Messages").setContent(intentMsgsView));
Run Code Online (Sandbox Code Playgroud)

基本上,我是什么让父Activity调用子Activity中的方法才能做某事.这可能吗?

我试过这个:

((TeamHuddleScreenMsgsView)getTabHost().getCurrentTabView().getContext()).refreshModel();
Run Code Online (Sandbox Code Playgroud)

但我遇到了ClassCastException.似乎getContext()仍然提供TabActivity.有关如何获取子Activity的任何帮助?

谢谢.

android

1
推荐指数
1
解决办法
1946
查看次数

可以成功解析格式错误的JSON字符串吗?

这是一个示例字符串:

String s = "{\"source\": \"another \"quote inside\" text\"}";
Run Code Online (Sandbox Code Playgroud)

解析这个的最佳方法是什么?我已经尝试了4个解析器:json-lib,json-simple,gsonGrails内置的JSON解析器.

我正在使用Java,我想知道在捕获MalformedJsonException之后是否有办法修复字符串.

注意:或者这可能是Twitter API中的错误?这是一个示例响应字符串:

{
    "coordinates": null,
    "user": {
        "is_translator": false,
        "show_all_inline_media": false,
        "following": null,
        "geo_enabled": false,
        "profile_background_color": "C0DEED",
        "listed_count": 11,
        "profile_background_image_url": "http://a3.twimg.com/a/1298064126/images/themes/theme1/bg.png",
        "favourites_count": 4,
        "followers_count": 66,
        "contributors_enabled": false,
        "statuses_count": 1078,
        "time_zone": "Tokyo",
        "profile_text_color": "333333",
        "friends_count": 51,
        "profile_sidebar_fill_color": "DDEEF6",
        "id_str": "107723125",
        "profile_background_tile": false,
        "created_at": "Sat Jan 23 14:16:03 +0000 2010",
        "profile_image_url": "http://a3.twimg.com/profile_images/652140488/--------------_normal.jpg",
        "description": "Mu8ecdu56e3u306eu56e3u9577u3068u30eau30fcu30c0u30fcu3067u3059u3002u8da3u5473u306fu7af6u99acu306eu4e88u60f3u3068u30b0u30e9u30c3u30d7u30eau30f3u30b0u3068u6253u6483u3092u30e1u30a4u30f3u3068u3057u3066u3044u307eu3059u3063uff01",
        "location": "u5bccu5c71u770c",
        "notifications": null,
        "profile_link_color": "0084B4",
        "protected": false,
        "screen_name": …
Run Code Online (Sandbox Code Playgroud)

java json

0
推荐指数
1
解决办法
3275
查看次数

标签 统计

grails ×3

grails-orm ×2

android ×1

email ×1

java ×1

json ×1

plugins ×1