小编Ann*_*lee的帖子

Grails 2 - 无法创建spring安全域对象

我在运行grails s2-quickstart com.testApplication.secureApplication User Role后自动生成我所做的域对象时grails run-app,从grails插件页面安装了spring security app,并得到了以下异常:

|Loading Grails 2.3.4
|Configuring classpath
.
|Environment set to development
.................................
|Packaging Grails application
Precompiling AST Transformations ...
src C:\Users\GrailsWorkspace\testApplication\target\work\plugins\postgresql-extensions-0.6.1 C:\Users\GrailsWorkspace\testApplication\target\classes
Done precompiling AST Transformations!
..
|Compiling 3 source files
...................................................
|Running Grails application
Configuring Spring Security Core ...
... finished configuring Spring Security Core
Error |
2013-12-15 15:42:45,635 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - Unsuccessful: create table user (id int8 not null, version int8 not null, account_expired bool not …
Run Code Online (Sandbox Code Playgroud)

postgresql grails spring grails-2.0

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

类是受管理的,但未在persistence.xml文件中列出

我在我的项目中遇到以下异常:

管理类"com.testApp.domain.Register",但未在persistence.xml文件中列出

我的persistence.xml文件看起来像这样:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
    xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">

    <persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <properties>
            <property name="hibernate.archive.detection" value="class, hbm" />
            <property name="hibernate.show_sql" value="true" />
            <property name="hibernate.format_sql" value="true" />

            <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
            <property name="hibernate.hbm2ddl.auto" value="update" />

            <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver" />
            <property name="hibernate.connection.url" value="jdbc:hsqldb:mem:." />
            <property name="hibernate.connection.username" value="SA" />
            <property name="hibernate.connection.password" value="" />

            <property name="hibernate.c3p0.min_size" value="5" />
            <property name="hibernate.c3p0.max_size" value="20" />
            <property name="hibernate.c3p0.timeout" value="300" />
            <property name="hibernate.c3p0.max_statements" value="50" />
            <property name="hibernate.c3p0.idle_test_period" value="3000" />

        </properties>
    </persistence-unit>

</persistence>
Run Code Online (Sandbox Code Playgroud)

我已经尝试过这篇 …

java spring persistence hibernate jpa

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

Groovy:安装后编译器不匹配

我使用grails 2.3.4eclipse grails plugin(GGTS).但是,安装完成后我创建了一个项目并得到:

  Description   Resource    Path    Location    Type
    Groovy: compiler mismatch Project level is: 2.1 Workspace level is 1.8
    Groovy compiler level expected by the project does not match workspace compiler level. 
    Go to Project properties -> Groovy compiler to set the Groovy compiler level for this project   test        test    Groovy compiler mismatch problem
Run Code Online (Sandbox Code Playgroud)

我试图更改编译器首选项但没有任何变化......

在此输入图像描述

我非常感谢你的回答!

eclipse grails grails-2.0

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

仅查询最早可能日期的数值

我必须从oracle 11db 查询.通过下面的查询,我TAG_VALUE, TAG_DESC, INSERTION_DATE and PROJECT_ID从我的数据库中获取最新信息.

SELECT * 
FROM   (SELECT t.tag_value, 
               t.tag_desc, 
               u.update_as_of                    AS INSERTION_DATE, 
               p.proj_id                         AS PROJECT_ID, 
               Row_number() 
                 over( 
                   PARTITION BY p.proj_id 
                   ORDER BY u.update_as_of DESC) RN 
        FROM   project p 
               join update u 
                 ON p.project_id = u.project_id 
               join tag t 
                 ON t.tag_id = u.tag_id 
        WHERE  t.tag_desc LIKE 'Equity%') 
WHERE  rn = 1;
Run Code Online (Sandbox Code Playgroud)

但是,我遇到的情况是,我的请求的答案(没有按日期排序)看起来像这样:

+----------------------------------------------+
| TAG_VALUE TAG_DESC INSERTION_DATE PROJECT_ID |
+----------------------------------------------+
| null        Equity  14-DEC-14       1        |
| 0           Equity  14-DEC-14       1        |
| …
Run Code Online (Sandbox Code Playgroud)

sql oracle oracle11g

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

Laravel 4.2 Composer 安装错误:“无法扫描类”

我想通过 Composer 在我的新 Laravel 4.2 安装上安装一些软件包。但是,我得到了一个例外。

这是我的作曲家文件:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "license": "MIT",   
    "require": {
        "laravel/framework": "4.2.*",
        "zizaco/confide": "~4.0@dev",
        "zizaco/entrust": "1.2.*@dev",
        "barryvdh/laravel-ide-helper": "1.*",
        "fzaninotto/faker": "1.3.*@dev",
        "bllim/datatables": "~1.3",
        "barryvdh/laravel-debugbar": "~1.7"
    },
    "require-dev": {
        "way/generators": "~2.6",
        "barryvdh/laravel-ide-helper": "~1.11"
    },
    "autoload": {
        "classmap": [
            "app/commands",
            "app/controllers",
            "app/models",
            "app/database/migrations",
            "app/database/seeds",
            "app/tests/TestCase.php",
            "app/controllers/admin",
            "app/controllers/user"
        ]
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-update-cmd":[ …
Run Code Online (Sandbox Code Playgroud)

php laravel composer-php laravel-4

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

在云9环境中安装python包zipline支持工作区python

我试图在云9环境中安装python.

我在下面简单介绍一下,从安装教程:

pip install zipline
Run Code Online (Sandbox Code Playgroud)

但是,我得到:

Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_ubuntu/zipline
Storing debug log for failure in /home/ubuntu/.pip/pip.log
Run Code Online (Sandbox Code Playgroud)

我的完整日志如下所示:

------------------------------------------------------------
/usr/bin/pip run on Tue Sep 13 06:28:52 2016
Downloading/unpacking zipline
  Getting page https://pypi.python.org/simple/zipline/
  URLs to search for versions for zipline:
  * https://pypi.python.org/simple/zipline/
  Analyzing links from page https://pypi.python.org/simple/zipline/
    Found link https://pypi.python.org/packages/06/8e/8355df80f313706418ee9db3521c6f0578426d92b6dcddf396d58c4de2e6/zipline-1.0.2.tar.gz#md5=4c7958ad131ebbeeec7d4399bdeff12b (from https://pypi.python.org/simple/zipline/), version: 1.0.2
    Found link https://pypi.python.org/packages/17/d3/8c58193ec8052d86ff67c00a285a01f646d3d53106844716090c22bba15e/zipline-0.6.0.tar.gz#md5=75d818c291df133946bb15a1b08ae0d8 (from https://pypi.python.org/simple/zipline/), version: 0.6.0
    Found link https://pypi.python.org/packages/1f/8c/55ea3687c717bc532753860196222f12717201719625d043448ea94f4ff6/zipline-0.5.10.tar.gz#md5=48f394a5ea83848642d879cbeaba8342 (from https://pypi.python.org/simple/zipline/), version: 0.5.10
    Found link https://pypi.python.org/packages/22/4a/affbfd183fa4133d13ecebc069bf9887c7755e531175384b57879daecfe2/zipline-0.8.3.tar.gz#md5=042ffcee614d2279add9a1bfd27a33cf (from …
Run Code Online (Sandbox Code Playgroud)

python ubuntu c9.io

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

使用单个类别显示所有帖子和自定义帖子类型

我创建了一个帖子类型CPT UI:

add_action( 'init', 'cptui_register_my_cpts_matratze' );
function cptui_register_my_cpts_matratze() {
    $labels = array(
        "name" => __( 'Matratzen', '' ),
        "singular_name" => __( 'Matratze', '' ),
        );

    $args = array(
        "label" => __( 'Matratzen', '' ),
        "labels" => $labels,
        "description" => "",
        "public" => true,
        "publicly_queryable" => true,
        "show_ui" => true,
        "show_in_rest" => false,
        "rest_base" => "",
        "has_archive" => true,
        "show_in_menu" => true,
                "exclude_from_search" => false,
        "capability_type" => "post",
        "map_meta_cap" => true,
        "hierarchical" => false,
        "rewrite" => array( "slug" => …
Run Code Online (Sandbox Code Playgroud)

wordpress custom-post-type

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

ACL - 与护照一起实施acl

我正在尝试使用passport-local的node_acl.当我运行我的代码时,我无法确保路由,并且我被重定向到页面.admin-user '/admin'/login

在下面找到我的最小runnable示例:

require('dotenv').config()
const express = require('express')
// const fs = require('fs')
const path = require('path')
const logger = require('morgan')
const bodyParser = require('body-parser')
const cookieParser = require('cookie-parser')
const session = require('express-session')
const passport = require('passport')
const LocalStrategy = require('passport-local').Strategy
const ACL = require('acl')

// load user.json file
// const d = fs.readFileSync(path.join(__dirname, '/../data/user.json'))
// const userObj = JSON.parse(d)
const userObj = [{
  id: 1,
  username: 'admin',
  password: 'admin',
  email: 'admin@admin.com',
  role: 'admin',
}, …
Run Code Online (Sandbox Code Playgroud)

javascript acl node.js express

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

将过滤器添加到acf关系字段

我正在使用wordpress 4.9.7,我正在使用advanced custom fields 4.4.12.

在我的后端,我有一个被调用的帖子类型coins,它有一个叫做的关系字段related_coins和一个被调用的文本字段algorithm.基本上我的关系字段创建了与自定义帖子类型的关系products.所以产品可以与几个硬币有关系.

我目前只能按帖子类型过滤.但是,我想按algorithm帖子类型的自定义字段进行过滤coin.

在此输入图像描述

我尝试了以下方法:

function graphic_card_products_query( $args, $field, $post_id ) {

    $args['meta_query'] = array(
        array(
        'key' => 'algorithm', // name of custom field
        'value' => 'related_coins',
        'compare' => 'LIKE'
        )
    )

    // return
    return $args;

}

// filter for every field
add_filter('acf/fields/relationship/query/name=related_coins', 'graphic_card_products_query', 10, 3);
Run Code Online (Sandbox Code Playgroud)

基本上我试图得到自定义字段algorithm具有的所有值的列表,并将其作为过滤器选项返回到关系字段related_coin.

目前我什么都没收到.

有什么建议我做错了吗?

php wordpress advanced-custom-fields

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

使用 mocha/chai 进行测试时比较两个日期

我正在使用"chai": "^4.2.0""mocha": "^6.1.4",

assert.equal()用于比较两个日期时,即使这两个日期似乎相同,我也会出错:

在此处输入图片说明

这是我的示例测试:

  it('check if dates are correctly added', async () => {
let dataArr = [{'rating_date':'6/6/2019','impact_on_price':'Low'}]   
let priceServ = new PriceService()

// clear all records
priceServ.clearPriceTable()

// add 1 record
const res = await priceServ.createOrUpdatePrice(dataArr)

// get "all" records from the table that have a certain action attribute
const tableValues = await priceServ.getPricesByField('rating_date')
assert.equal(tableValues[0].rating_date, new Date(dataArr[0].rating_date));
Run Code Online (Sandbox Code Playgroud)

});

任何建议我做错了什么?

我感谢您的回复!

javascript mocha.js chai

6
推荐指数
2
解决办法
6638
查看次数