小编con*_*ile的帖子

在一个尺寸上确定设备方向及其产生的角度?

我有以下设置:

在此输入图像描述

iPhone将显示器放在桌子上的天花板上(alpha = 0度).当iPhone向上移动时,如上图所示,alpha角度增加.

如何在不考虑可能发生变化的其他轴的情况下计算α角的值.我只对这一轴感兴趣.

如何从桌子上抬起iPhone时获得正确的alpha角度?当alpha的值发生变化时,如何收到通知?

iphone objective-c ios gyroscope swift

10
推荐指数
2
解决办法
7463
查看次数

处理GWT中铁列表的键盘事件?

我使用谷歌聚合物的铁列表.

<iron-list items="[[data]]" as="item">
  <template>
    <div tabindex$="[[tabIndex]]">
      Name: [[item.name]]
    </div>
  </template>
</iron-list>
Run Code Online (Sandbox Code Playgroud)

我知道你可以使用Polymer.IronA11yKeysBehavior但是即使是这个例子,我也不知道如何将它添加到我的铁列表中.

使用Vaadin Polymer GWT lib.在这个lib你有

IronList list; 
list.setKeyBindings(???);  // don't know how to use this function
list.setKeyEventTarget(????);  // don't know how to use this function
Run Code Online (Sandbox Code Playgroud)

当我检查键绑定的当前值时,我定义了一个print函数来将变量记录到控制台:

public native void print(JavaScriptObject obj)/ - {console.log(obj); } - /;

然后我打印当前值:

print(list.getKeyBindings());
Run Code Online (Sandbox Code Playgroud)

结果是:

Object {up: "_didMoveUp", down: "_didMoveDown", enter: "_didEnter"}
Run Code Online (Sandbox Code Playgroud)

似乎已经定义了一些键绑定,但我不知道在哪里找到这些函数_didMoveUp,_didMoveDown并且_didEnter.

当我做

print(list.getKeyEventTarget());
Run Code Online (Sandbox Code Playgroud)

我明白了:

<iron-list class="fit x-scope iron-list-0" …
Run Code Online (Sandbox Code Playgroud)

html javascript gwt polymer polymer-1.0

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

Grails findAll有sort,order,max和offset吗?

我想在findAll查询中集成sort,order,max和offset.以下工作正常:

def books = Book.findAll("from Book as b where b.approved=true order by b.dateCreated  desc", [max: max, offset: offset])
Run Code Online (Sandbox Code Playgroud)

但我想要的是:

def books = Book.findAll("from Book as b where b.approved=true", [sort: 'dateCreated', order: 'desc', max: max, offset: offset])
Run Code Online (Sandbox Code Playgroud)

这不起作用.我该如何重写呢?

grails groovy grails-orm

9
推荐指数
3
解决办法
2万
查看次数

Ehcache,Redis和Gemfire哪个缓存哪个场景?

Grails提供了三个扩展缓存插件:

  1. 的Ehcache

  2. Redis缓存

  3. Gemfire缓存

这些缓存有哪些优点和缺点,我应该在哪种情况下使用哪个缓存?

java grails spring caching grails-2.0

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

Cordova:如何设置特定于平台的config.xml文件,在cordova构建之后没有被覆盖?

我使用Cordova有两个平台ios和android.当我改变我的东西时

Project/config.xml 
Run Code Online (Sandbox Code Playgroud)

它将被合并到

Project/platforms/android/res/xml/config.xml  
Project/platforms/ios/Project/config.xml
Run Code Online (Sandbox Code Playgroud)

做完cordova之后.

如何设置平台特定的设置,不会被cordova构建覆盖?

javascript android ios cordova

9
推荐指数
2
解决办法
5971
查看次数

找不到org.codehaus.groovy.grails.cli.support.GrailsS​​tarter错误

从Grails 2.3.10更新到2.3.11并将路径变量更新为

export GRAILS_HOME=/Applications/grails/grails-2.3.11
Run Code Online (Sandbox Code Playgroud)

当我运行:grails我收到以下错误:

Error: Main class org.codehaus.groovy.grails.cli.support.GrailsStarter could not be found
Run Code Online (Sandbox Code Playgroud)

java grails groovy grails-2.0

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

"在Grails 2.3数据库迁移中加载插件管理器:TomcatGrailsPlugin时出错"

我使用Grails 2.3和Grails数据库迁移插件(1.3.6).

当我做grails dbm-update时,我收到以下错误.我该如何解决这个错误?

 Error Error loading plugin manager: TomcatGrailsPlugin (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
java.lang.ClassNotFoundException: TomcatGrailsPlugin
    at _GrailsBootstrap_groovy$_run_closure2.doCall(_GrailsBootstrap_groovy:40)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
    at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
    at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at _GrailsBootstrap_groovy$_run_closure6.doCall(_GrailsBootstrap_groovy:64)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
    at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
    at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
    at org.codehaus.gant.GantMetaClass.processClosure(GantMetaClass.java:81)
    at org.codehaus.gant.GantMetaClass.processArgument(GantMetaClass.java:95)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:128)
    at _DatabaseMigrationCommon_groovy$_run_closure1.doCall(_DatabaseMigrationCommon_groovy:25)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
    at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
    at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy) …
Run Code Online (Sandbox Code Playgroud)

grails spring database-migration grails-plugin grails-2.0

8
推荐指数
2
解决办法
3494
查看次数

iPhone地址栏阻止HTML页眉按钮?

我有一个带有两个标题按钮的移动网站.在iPhone上的纵向模式下它工作正常.我可以按下按钮.

这是问题所在:

当我切换到纵向模式并尝试点击按钮时,本机iPhone地址栏会出现.它来自标题,所以我无法按下按钮.

图像显示了问题:

在此输入图像描述

按下一个按钮后,您会看到:

在此输入图像描述

我该如何防止这个问题?

有没有办法检测到我向用户显示iPhone浏览器栏?

编辑:当您使用Safari时,无论您使用哪个页面,并将手机转为横向,并在页面顶部点击太多,地址栏就会显示出来.如果您的页面有一个固定的标题栏,则无法访问它.

编辑:当我修改标题位置时,当方向更改为横向并且地址栏显示时,我不能再点击标题按钮.

编辑:这是我使用的一个示例项目:http://mobilegwt.appspot.com/showcase/您可以在iPhone上试一试,看看我在图像中显示的效果.

html css iphone mobile html5

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

如何测试实例是否在GORM数据库中保留?

当我将实例保存为:

test.save() 
Run Code Online (Sandbox Code Playgroud)

保存可能会失败.我可以

if (!test.save(flush:true) {
  // save failed
} 
Run Code Online (Sandbox Code Playgroud)

考虑一下我从另一个函数获取实例并且无法执行此检查的情况,因为我不会再次保存实例.

有没有办法检查实例是否仍然存在于数据库中还是具有未保存状态?

grails grails-orm grails-domain-class

8
推荐指数
2
解决办法
4450
查看次数

阻止Interface Builder自动创建约束?

我在这里创建了一个演示项目.我有一个视图,我在.xib文件中创建了一个ScrollView.在界面构建器中,我没有设置任何约束.在我的viewDidLoad方法中,我使用SnapKit设置约束:

scrollView.snp_makeConstraints { (make) -> Void in
  make.edges.equalTo(self.view)
}
Run Code Online (Sandbox Code Playgroud)

当我运行代码时,我得到以下控制台输出:

Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the …
Run Code Online (Sandbox Code Playgroud)

interface-builder ios xcode-storyboard autolayout nslayoutconstraint

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