小编Fab*_* N.的帖子

AngularJS和ngRepeat - 每n次重复插入一个额外的元素

我正在尝试创建一个结构,其中每7个重复的div有一个额外的div插入.这个div必须属于父级,而不是其中一个重复div的子级.

改变类是不够的,整个内容将是不同的,完全不同的ngShow逻辑将与额外的div一起使用.

例如:

<div id="parent">
  <div class="child"></div>
  <div class="child"></div>
  <div class="child"></div>
  <div class="child"></div>
  <div class="child"></div>
  <div class="child"></div>
  <div class="child"></div>
  <div class="special-child"></div>
  <div class="child"></div>
  <div class="child"></div>
  <div class="child"></div>
  <div class="child"></div>
  <div class="child"></div>
  <div class="child"></div>
  <div class="child"></div>
  <div class="special-child"></div>
  <div class="child"></div>
  <div class="child"></div>
  <div class="child"></div>
  <div class="child"></div>
  <div class="child"></div>
  <div class="special-child"></div>
</div>
Run Code Online (Sandbox Code Playgroud)

该示例使用特定数量的div,ngRepeat可以是任何数字.同样重要的是,ngRepeat的最后结果是在它之后放入一个额外的div,即使它不是7的精确倍数.

我正在使用的当前ngRepeat逻辑是:

<div id="parent">
  <div class="child" ng-repeat="o in data"></div>
  <div class="special-child"></div>
</div>
Run Code Online (Sandbox Code Playgroud)

但这不能正常工作,因为额外的div只在所有重复的div之后插入一次.

用工作示例更新

<div id="parent">
  <div class="child" ng-repeat-start="o in data"></div>
  <div class="special-child" ng-if="( $index + 1 ) % 7 …
Run Code Online (Sandbox Code Playgroud)

angularjs angularjs-ng-repeat

12
推荐指数
1
解决办法
4766
查看次数

在Heroku上部署Django应用程序:我可以在.env文件中手动设置环境变量吗?我是否需要安装autoenv,heroku-config等工具?

我的目标:

我打算遵循"The Twelve-Factor App"方法在Heroku上构建我的Django应用程序.

介绍:

我正在关注"Heroku上的Django入门"快速入门指南.目前我有以下目录结构:

~/Projects/
    hellodjango_rep/
        .env (empty)
        .git
        .gitignore
        Procfile
        requirements.txt
        hellodjango/
            manage.py
            hellodjango/
                __init__.py
                settings/
                urls.py
                wsgi.py
Run Code Online (Sandbox Code Playgroud)

我安装了django-toolbelt,创建了我的简单Django应用程序,在我的Procfile中启动了这个过程...一切似乎工作正常,但是当我为Heroku环境配置应用程序并添加时问题就开始了:

import dj_database_url
DATABASES['default'] =  dj_database_url.config()
Run Code Online (Sandbox Code Playgroud)

到我的settings.py文件的底部.

我将应用程序的存储库推送到Heroku,$ heroku open成功访问了我的浏览器中的应用程序,但是本地:dj_database_url.config() 返回了一个空字典.

本地:

OS X 10.8.4
pip == 1.4.1
virtualenv == 1.10.1
virtualenvwrapper == 4.1.1
wsgiref == 0.1.2
Postgres.app在5432端口上运行

环境变量:

mac-pol:hellodjango_rep oubiga$ python
>>> import os
>>> os.environ

{
  'PROJECT_HOME': '/Users/oubiga/Projects'... 
  'PATH': '/usr/local/heroku/bin:/usr/local/share/python:/usr/local/bin:/Applications/Postgres.app/Contents/MacOS/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin'... 
  'HOME': '/Users/oubiga'... 
  'WORKON_HOME': '/Users/oubiga/Envs'... 
  'VIRTUALENVWRAPPER_HOOK_DIR': '/Users/oubiga/Envs'... 
  'PWD': '/Users/oubiga/Projects/hellodjango_rep'
}
Run Code Online (Sandbox Code Playgroud)

hellodjango_venv:

Django == 1.5.2 …

django heroku environment-variables gunicorn 12factor

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

Sbt项目取决于外部和私有github存储库

本教程清楚地解释了如何使用以下命令在sbt项目中具有远程github依赖性依赖性:

lazy val reponame = RootProject(uri("git://github.com/group/reponame.git"))
lazy val root = Project(id = "MLSS", base = file("."), settings = sharedSettings) dependsOn(reponame)
Run Code Online (Sandbox Code Playgroud)

但是,如果远程仓库是私有的,它似乎不起作用并抛出一个

Repository not found.
Cloning into '/Users/.../b6958781f05b85672849/reponame'...
[error] Nonzero exit code (128): git clone git://github.com/group/reponame.git
Run Code Online (Sandbox Code Playgroud)

它似乎是一个auth错误,但如何指定密钥?谢谢

scala github sbt

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

由于操作系统Ubuntu 16.04中缺少驱动程序,不允许我在android studio上运行模拟器

我在ubuntu 16.04中使用android studio 2.0并且让我运行模拟器avd因为显然它缺少驱动程序.我怎么能解决这个问题?

这是我运行模拟器后抛出的异常

Cannot launch AVD in emulator.

Output:
libGL error: unable to load driver: radeonsi_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: radeonsi
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  155 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  49
  Current serial number in output stream:  48
libGL error: unable …
Run Code Online (Sandbox Code Playgroud)

android-virtual-device android-emulator android-studio ubuntu-16.04

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

在scikit-learn中进行10*10倍交叉验证?

class sklearn.cross_validation.ShuffleSplit(
    n, 
    n_iterations=10, 
    test_fraction=0.10000000000000001, 
    indices=True, 
    random_state=None
)
Run Code Online (Sandbox Code Playgroud)

在scikit-learn中10*10倍CV的正确方法?(通过将random_state更改为10个不同的数字)

因为我没有发现任何random_state参数Stratified K-FoldK-Fold从单独的K-Fold,始终是相同的数据相同.

如果ShuffleSplit是正确的,一个问题是提到它

注意:与其他交叉验证策略相反,随机拆分并不能保证所有折叠都不同,尽管这对于相当大的数据集来说仍然很可能

这总是10*10倍CV的情况?

python machine-learning scikits scikit-learn

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

MongoDB YAML"无法识别的选项:安全性"

我在Windows Server 2012上运行Mongo DB版本2.6.我在设置YAML配置文件时遇到安全和授权问题.当我有下面的配置文件时,我只收到一条错误,上面写着"无法识别的选项:安全性".我的配置有什么问题?

mongod_test.conf:

security:
    authorization: enabled
    authenticationMechanisms: MONGODB-CR
storage:
   dbPath: F:\MongoData
Run Code Online (Sandbox Code Playgroud)

命令行:

mongod.exe --config mongod_test.conf
Run Code Online (Sandbox Code Playgroud)

我已经在我的文件中添加了空格,并修复了部分问题.使用上面的更新配置,我得到的当前错误是:

c:\MongoDBFolder\bin>mongod.exe --config mongod_test.conf
    Unrecognized option: security.authenticationMechanisms
    try 'mongod.exe --help' for more information
Run Code Online (Sandbox Code Playgroud)

yaml mongodb

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

在涉及edmx的项目上失败了脚手架

我有两个项目的演示解决方案,如下所示:

在此输入图像描述

我安装了T4Scaffolding.Install-Package T4Scaffolding

我已经添加了AdventureWorksModel对我的RepoLayer项目的引用并安装了EF6.


现在,当我尝试运行以下命令时:

scaffold repository AdventureWorksModel.Customer到我的RepoLayer项目

我得到以下异常:

Get-ProjectType : Cannot find a type matching the name
'AdventureWorksModel.Customer'. Try specifying the fully-qualified
type name, including namespace.`
Run Code Online (Sandbox Code Playgroud)

虽然当我在AdventureWorksModel项目上运行它时,相同的命令成功运行 !

c# entity-framework scaffolding edmx t4scaffolding

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

cmake 命令 CXX 编译器 ABI 信息失败

我正在尝试安装 opengl 并运行 cmake 文件,它给出了这些错误。请帮忙看看是什么原因以及如何纠正​

-- The CXX compiler identification is Clang 5.0.0
-- The C compiler identification is Clang 5.0.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
Run Code Online (Sandbox Code Playgroud)

compiler-construction gcc cmake ios

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

iOS 9企业应用验证失败

Apple改变了企业应用在iOS 9上验证的方式,但当我在"设置 - 常规 - 配置文件"中验证我们的应用时,我得到了这个 验证失败

我查了一下日志:

Oct 15 21:32:21 Nix-iPhone online-auth-agent[216] <Error>: Caller does not have required entitlement 'com.apple.private.mis.trust.set'
Oct 15 21:32:21 Nix-iPhone online-auth-agent[216] <Error>:  SecTrustEvaluate  [leaf AnchorTrusted]
Oct 15 21:32:31 Nix-iPhone online-auth-agent[216] <Notice>: Server returned no data
Oct 15 21:32:31 Nix-iPhone online-auth-agent[216] <Notice>: Could not complete online authentication
Oct 15 21:32:31 Nix-iPhone online-auth-agent[216] <Warning>: session error: The request timed out.
Oct 15 21:32:31 Nix-iPhone Preferences[223] <Warning>: Failed to verify provisioning profile d43b2b57-8def-4c46-88c9-fc57503890ad with error 32
Oct 15 21:32:31 …
Run Code Online (Sandbox Code Playgroud)

enterprise adhoc ios ios9

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

有没有办法在 react-native-webview 中禁用 hapticFeedback

 <ScrollView
      ref={scrollRef}
      horizontal
      scrollEnabled={isScroll}
      contentContainerStyle={{height: HEIGHT, overflow: 'hidden'}}
      style={{
        width: metrics.screenWidth - widthOffset,
      }}
      onScroll={_onScroll}>
      <WebView
        ref={webviewRef}
        automaticallyAdjustContentInsets={false}
        scrollEnabled={false}
        showsHorizontalScrollIndicator={false}
        showsVerticalScrollIndicator={false}
        onLoadEnd={_loadEnd}
        bounces={false}
        source={{
          html: getHtml(final, scale),
        }}
        style={{
          height: HEIGHT,
          width: WIDTH,
          backgroundColor: 'transparent',
        }}
        onMessage={_onMessage}
        javaScriptEnabled={true}
        textZoom={90}
      />
    </ScrollView>
Run Code Online (Sandbox Code Playgroud)

还有

source.replace(
    '<img',
    '<img ontouchend="window.ReactNativeWebView.postMessage(`imgsrc__`+this.src)"',
)
Run Code Online (Sandbox Code Playgroud)

所以问题是当我在 html img 上滚动这个滚动视图时,它会得到触摸并且手机会振动。有没有办法从源端(html)或 react-native-webview 端禁用 webview 触觉反馈?

我认为这是因为在滚动 img 标签时将交互视为 longtouch,因此它在 webview 中启用 longtouch。

html javascript css react-native react-native-webview

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