小编kxy*_*xyz的帖子

如果指定了绝对位置和overflow-x hidden,则无法滚动到元素

我有动画ng-view.我正在使用幻灯片动画,它需要元素的绝对位置以及overflow-x: hidden剪辑内容.在一个子页面中,我必须使用scrollTo元素功能,但如果指定了两个值,则它不起作用.这是ng-view正确动画所需的主类

.wrapper {
    position: absolute !important; 
    left: 0;
    top: 0;
    height: 100%;
    min-height: 100%;
    min-width: 100%;
    overflow-x: hidden;
  }
Run Code Online (Sandbox Code Playgroud)

和结构:

<div class="wrapper ng-view-div">
 <nav>
        <ul>
          <li><a href du-smooth-scroll="section-1" du-scrollspy>Section 1</a></li>
            <li><a href du-smooth-scroll="section-2" du-scrollspy>Section 2</a></li>
            <li><a href du-smooth-scroll="section-3" du-scrollspy>Section 3</a></li>
        </ul>
    </nav>

<section id="section-1" style="background-color: red">
  C
</section>
<section id="section-2"  style="background-color: blue">
  C
</section>
<section id="section-3"  style="background-color: green">
  C
</section>
</div>
Run Code Online (Sandbox Code Playgroud)

我准备了plnkr来轻松展示它现在的样子.有没有其他方法来实现滚动工作,但有这两个值?

javascript css angularjs

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

C OMP omp_get_wtime()返回时间0.00

我使用了omp_get_wtime(),但是当我想打印时间总是得到0.00时,问题出在哪里?

#define SIZE 500
#define nthreads 10

(...)

void sumTab(int mX[][SIZE], int mY[][SIZE], int mZ[][SIZE]) {
int i,k;
double start = omp_get_wtime();
#pragma omp parallel for schedule(dynamic,3) private(i) num_threads(nthreads)
for(i=0 ; i<SIZE ; i++)
{

   for(k=0 ; k<SIZE ; k++)  
   {

     mZ[i][k]=mX[i][k]+mY[i][k];
     printf("Thread no %d \t  [%d] [%d] result: %d\n", omp_get_thread_num(),i,k, mZ[i][k]); 
     }
}

printf("Time: \t %f \n", omp_get_wtime()-start); 
}
Run Code Online (Sandbox Code Playgroud)

c multithreading openmp

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

在ui-router中重定向$ transition.onBefore

我在组件和ui-router 1.0.0-beta.3中使用了angular。该版本不发送与更改状态相关的事件,有钩子。在每个状态更改之前,我想重新验证用户是否已通过身份验证以及是否具有必需的角色。如果不是,我想将他重定向到登录页面。

$transitions.onBefore({}, $transition => {

        const $toState = $transition.$to();

        if ($toState.data && $toState.data.authentication) {

            PrincipalService.identity().then(() => {
                return true;
            }, () => {
                console.log('redirecting');
                let $state = $transition.router.stateService;

                // not works
                //return $state.target('home');
                //return $transition.router.stateService.t('login');
            });
        } else {
            return Promise.resolve(false);
        }
    });
Run Code Online (Sandbox Code Playgroud)

如何使它起作用?在这些情况下,我遇到了有关中断过渡的错误。

我根据官方文档

angularjs angular-ui-router

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

Spring @Cacheable 带过滤器

每个实体类都有 user.id 值,我在所有服务上都有过滤器,它们在数据库级别按 principal.id 和实体 user.id 过滤数据,只需添加 where 子句。我开始使用@Cacheable spring 选项。但是过滤器不适用于 spring-cache。如何从缓存中过滤数据?

@Override
@Cacheable(value = "countries")
public List<Country> getAll() {
    return countryDao.findAll();
}
Run Code Online (Sandbox Code Playgroud)

如果值在缓存中,不同的用户可以访问其他用户的值。

spring spring-mvc ehcache spring-security spring-cache

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