小编Tom*_*lam的帖子

Android Studio - Estimote SDK - 找不到类

我正在使用Estimote Android SDK和Android Studio构建应用.我已将estimote-sdk-preview.jar添加到我的libs文件夹中,并且IDE识别它(我的任何.java文件中没有错误)但是当它上传到我的HTC One时我在logcat中得到以下错误而且我得到了我手机上的"抱歉此应用已崩溃"消息:

...
05-06 18:55:44.662  23179-23179/com.freshnode.daze E/dalvikvm? Could not find class 'com.estimote.sdk.Region', referenced from method com.freshnode.daze.MainActivity.<clinit>
05-06 18:55:44.662  23179-23179/com.freshnode.daze E/dalvikvm? Could not find class 'com.estimote.sdk.BeaconManager', referenced from method com.freshnode.daze.MainActivity.<init>
...
Run Code Online (Sandbox Code Playgroud)

我试过去项目结构并通过它添加库,在我的gradle属性中我有:

dependencies {
    compile files('libs/estimote-sdk-preview.jar')
    compile 'com.android.support:gridlayout-v7:19.0.0'
    compile 'com.android.support:appcompat-v7:19.0.0'
}
Run Code Online (Sandbox Code Playgroud)

这是我的.java文件的开头:

public class MainActivity extends ActionBarActivity {

    private static final String ESTIMOTE_PROXIMITY_UUID = "B9407F30-F5F8-466E-AFF9-25556B57FE6D";
    private static final Region ALL_ESTIMOTE_BEACONS = new Region("regionId", ESTIMOTE_PROXIMITY_UUID, null, null);

    private BeaconManager beaconManager = new BeaconManager(this);

    @Override
    protected void onCreate(Bundle …
Run Code Online (Sandbox Code Playgroud)

android ibeacon-android estimote

6
推荐指数
0
解决办法
1252
查看次数

环回 - 扩展内置模型的最简单方法

我一直在使用Loopback来创建API.文档通常非常好,但并没有真正回答我关于以下内容的问题:如何扩展(而不是替换)内置模型?

最有希望的信息来自这个页面 - 它通过继承指定了从另一个类创建类的方法.这很有用但不理想 - 我想从股票模型中创建自定义模型的关系,例如 - "角色"应该有很多"权限".

我提到的页面还显示了一个Javascript文件,位于common/models/<modelName>.js,它声明您可以根据您提供的属性和选项"扩展"模型.服务器似乎永远不会命中文件...例如 - 我将文件放入common/models/role.js以下内容:

var properties = {
  exampleProperty: {type: String, required: true}
};


var user = loopback.Model.extend('Role', properties);
console.log('test');
Run Code Online (Sandbox Code Playgroud)

首先,它似乎根本没有击中文件(没有console.log给出输出).其次,显然是因为第一点,它没有使用我创建的属性扩展模型.

我错过了一些明显的东西,或者文档是否完全错误?

orm inheritance node.js loopbackjs

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

MySQL SOURCE错误

我有一个MySQL SOURCE命令的问题.我收到以下错误:

1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SOURCE /var/www/apps/modx_install.sql' at line 1
Run Code Online (Sandbox Code Playgroud)

我正在执行的查询如下:

mysql_query('SOURCE /var/www/apps/modx_install.sql;')
Run Code Online (Sandbox Code Playgroud)

我想知道我在这里做错了什么,因为我从几个来源读到这是正确的语法.

谢谢

php mysql

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

在User.login()和User.getCurrent()Angular SDK中包含角色

我目前正在使用Loopback Angular SDK编写管理界面.在挖掘了文档和代码之后,我仍然没有明白如何在响应中包含用户的角色.它让我在前端遇到了真正的麻烦,因为我还没有足够的经验与Angular一起弄清楚如何对我的每个状态强制执行角色检查(我正在使用UI-Router).

客户端:/auth.js

        // Log the user in
        $scope.doAuth = function() {

            $scope.hasError = false;
            $scope.busy = true;

            $scope.loginResult = User.login({include: 'roles'}, $scope.credentials,

                function wasSuccessfulAuth(authResponse) {

                    $scope.busy = true;

                    $rootScope.isAuthenticated = true;
                    $rootScope.user = authResponse.user;

                    $location.path('dashboard');

                },

                function wasFailedAuth(authResponse) {

                    $timeout(function() {

                        $scope.hasError = true;
                        $scope.authError = authResponse.data.error.message || 'Unknown error';
                        $scope.busy = false;

                    }, 1000);

                }

            )
        }
Run Code Online (Sandbox Code Playgroud)

服务器:/common/models/user.json

{
  "name": "user",
  "plural": "Users",
  "base": "User",
  "properties": {

  },
  "relations": {
    "roles": {
      "type": "belongsTo",
      "model": "RoleMapping",
      "foreignKey": …
Run Code Online (Sandbox Code Playgroud)

angularjs loopbackjs

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