小编Abd*_*ebi的帖子

对象之间的CBO耦合

我不明白"对象类之间的CBO耦合"究竟意味着什么.我发现的定义太短了,我觉得我错过了一些东西,所以如果你帮我举个例子会很棒.

这是我发现的定义:"对象类之间的耦合是它所耦合的其他类的数量的计数."

提前致谢.

oop coupling decoupling

5
推荐指数
3
解决办法
8935
查看次数

找不到错误C.

我必须写两个线程.每个人打印5个偶数/奇数从1到100这样(奇数是impair法语,偶数pair).

even 2,4,6,8,10
odd 1,3,5,7,9
even 12,14,16,18,20
odd 13,15,17,19,21
etc...
Run Code Online (Sandbox Code Playgroud)

我写了这段代码:

#include <stdio.h>
#include <semaphore.h>
#include <pthread.h>

#define maxi 100

pthread_mutex_t mutex;
sem_t p;
sem_t imp;
int tour = 0;

void *pair(void *arg);
void *impair(void *arg);

int main() {
  pthread_t tidp, tidimp;

  pthread_mutex_init(&mutex, NULL);
  sem_init(&p, 0, 1);
  sem_init(&imp, 0, 1);

  pthread_create(&tidp, NULL, pair, (void *)2);
  pthread_create(&tidimp, NULL, impair, (void *)1);

  pthread_join(tidp, NULL);
  pthread_join(tidp, NULL);

  sem_destroy(&imp);
  sem_destroy(&p);
  pthread_mutex_destroy(&mutex);

  return 0;
}

void *pair(void *arg) {
  int i …
Run Code Online (Sandbox Code Playgroud)

c multithreading mutex semaphore ipc

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

无法更新实体

在Symfony 2(最新版本)下,我正在尝试更新我的实体:

php app/console doctrine:schema:upate --force
Run Code Online (Sandbox Code Playgroud)

我收到此错误消息到我的终端:

[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]
"security.firewalls.access_control"下无法识别的选项"0,1,2,3"

我是Symfony的新手,我不知道在哪里可以搜索来解决这个问题.

这是security.yml文件:

# To get started with security, check out the documentation:
Run Code Online (Sandbox Code Playgroud)

http://symfony.com/doc/current/book/security.html

安全性:编码器:FOS\UserBundle\Model\UserInterface:bcrypt

role_hierarchy:
    ROLE_ADMIN:       ROLE_USER
    ROLE_SUPER_ADMIN: ROLE_ADMIN

# http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
providers:
    fos_userbundle:
        id: fos_user.user_provider.username

firewalls:
    # disables authentication for assets and the profiler, adapt it according to your needs
    main:
        pattern: ^/
        form_login:
            provider: fos_userbundle
            csrf_provider: security.csrf.token_manager # Use form.csrf_provider instead for Symfony <2.4

        logout:       true
        anonymous:    true
    dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false

    #main:
        #anonymous: ~
        # activate different ways …
Run Code Online (Sandbox Code Playgroud)

symfony fosuserbundle symfony-security

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