小编Ric*_*old的帖子

BrowserSync非常慢

我很乐意使用BrowserSync进行开发.但是,页面加载(不仅仅是在更改后重新加载)非常慢.

我用的是proxy模式.在没有BrowserSync的情况下浏览页面应该很快.

安装BrowserSync时,一个原因可能是以下错误:

> ws@0.4.31 install /usr/local/lib/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
SOLINK_MODULE(target) Release/bufferutil.node
SOLINK_MODULE(target) Release/bufferutil.node: Finished
CXX(target) Release/obj.target/validation/src/validation.o
SOLINK_MODULE(target) Release/validation.node
SOLINK_MODULE(target) Release/validation.node: Finished
Run Code Online (Sandbox Code Playgroud)

我从头开始安装节点(使用brew和包安装程序),但无法摆脱错误.

此外,如果使用Gulp或命令行运行BrowserSync,则没有任何区别.

任何的想法?

browser performance sync node.js browser-sync

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

流星铁路由器从模板助手中的参数获取当前路径

在模板助手中,我从Iron.Router(iron:router)获取当前路径,如下所示:

Router.current().route.path()
Run Code Online (Sandbox Code Playgroud)

这工作正常,除非路径路径确实包含参数(例如/client/:_id/edit).在那种情况下,path()函数返回null.

当路由包含参数时,如何获取模板助手中的当前路径?

我正在使用Meteor 1.0和iron:router1.0.1

meteor iron-router

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

TYPO3流体模板获取语言代码

是否可以在TYPO3 Fluid模板中获取当前语言键(或代码)?

与此同时,我发现了另一种使用此处的视图助手的解决方案:

<?php
class Tx_AboUnitReservation_ViewHelpers_LanguageViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {

    /**
     * Get the current language
     */
    protected function getLanguage() {
        if (TYPO3_MODE === 'FE') {
            if (isset($GLOBALS['TSFE']->config['config']['language'])) {
                return $GLOBALS['TSFE']->config['config']['language'];
            }
        } elseif (strlen($GLOBALS['BE_USER']->uc['lang']) > 0) {
            return $GLOBALS['BE_USER']->uc['lang'];
        }
        return 'en'; //default
    }

    /**
     * Return current language
     * @return  string
     */
    public function render() {
        return $this->getLanguage();
    }

}

?>
Run Code Online (Sandbox Code Playgroud)

我在流体模板中使用如下.

<f:alias map="{isGerman: 'de'}">
    <f:if condition="{aboUnitReservation:language()} == {isGerman}">
        <script type="text/javascript" src="{f:uri.resource(path:'js/jquery.ui.datepicker-de-CH.js')}"></script>
    </f:if>
</f:alias>
Run Code Online (Sandbox Code Playgroud)

typo3 fluid

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

Angular2中的复选框组处理和验证

我不明白,应该如何在angular2中以模型驱动的形式处理复选框组.

该模型有一个languages我实例化的属性,如下所示:

this.model = {
  languages: []
};
Run Code Online (Sandbox Code Playgroud)

使用FormBuilder创建的形式:

this.modelForm = this.formBuilder.group({
  'languages': [model.languages, Validators.required],
});
Run Code Online (Sandbox Code Playgroud)

和模板:

<div *ngFor="let language of translateService.get('languages') | async | key_value">
  <input type="checkbox" name="languages[]" formControlName="languages" value="{{ language.key }}" id="language_{{ language.key }}">
  <label attr.for="language_{{ language.key }}">{{ language.value }}</label>
</div>
Run Code Online (Sandbox Code Playgroud)

div需要对造型的目的(定制复选框),key_value使按键和循环使用的语言,明显的价值.

第一个问题来自验证.如果检查并取消选中一个复选框(并且未选中其他复选框),则输入仍然有效 - 不知何故很奇怪.

第二个问题伴随着价值,即true如果检查两种或更多种语言,则false另外.

然后有第三个问题,其初始值languages只是一个空数组,但会导致所有复选框最初被检查(如果初始值设置为a string,则不会发生),尽管我无法发现任何checked属性DOM.

我正在使用最新的离子beta(2.0.0-beta.10),它使用角度/核心版本2.0.0-rc.4和角度/形式版本0.2.0.

那么,有没有关于如何使用复选框组的指南?有什么建议或想法吗?

ionic-framework ionic2 angular2-forms angular

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

如何在NetBeans中本地化@Messages注释

我想@Messages在NetBeans中使用注释来简化我的应用程序中的本地化.但是,我找不到任何有关如何使用此机制为其他语言添加翻译(包)的信息.

使用的动作示例@Messages如下

@ActionID(category = "category",
id = "AddAction")
@ActionRegistration(iconBase = "actions/action-icon.png",
displayName = "#CTL_AddAction")
@ActionReferences({
    @ActionReference(path = "Menu/Shapes", position = 160),
    @ActionReference(path = "Toolbars/Shapes", position = 5133)
})
@Messages("CTL_AddAction=Add Action")
Run Code Online (Sandbox Code Playgroud)

如何根据语言改变添加操作?

netbeans localization internationalization netbeans-platform netbeans-7

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

Laravel 4应用程序中的浏览器缓存问题

我遇到了浏览器缓存干扰我的Laravel应用程序的问题.

如果禁用浏览器缓存,一切正常.但是,如果启用,并且重复单击相同的链接,则甚至不会执行用于创建视图或收集数据的Laravel方法.

其影响是多方面的.例如,编辑资源的表单或显示数据的网格(使用ajax从服务器加载)在重新加载浏览器之前不会显示当前值.

我在我的一些方法中添加了一行记录当前时间戳以证明这一点.

public function index()
{
    Log::info( microtime() );

    return View::make( $this->templates_root . 'index' );
}
Run Code Online (Sandbox Code Playgroud)

当重复单击链接或再次访问视图时,日志中不会显示任何行.但是如果我重新加载浏览器就会这样.

我该怎么做才能阻止浏览器缓存我的观点?

php caching browser-cache laravel laravel-4

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

Vuex 计算属性仅适用于 getter

当我把它放在我的 Vue 组件中时......

// using store getter

computed: {
  authenticated() {
    return this.$store.getters.authenticated
  }
}
Run Code Online (Sandbox Code Playgroud)

... 有用。的值authenticated是响应式的,true当 vuex 存储中的值为 时,计算属性返回true

这应该有效......(并且根据文档将是正确的方法)

// using store state

computed: {
  authenticated() {
    return this.$store.state.authenticated
  }
}
Run Code Online (Sandbox Code Playgroud)

......但没有。计算属性始终为false

它甚至不适用于初始状态,所以我猜它与动作或突变无关。vuex 存储在stategetters(Firefox Vue DevTools) 中保存正确的值。

我的商店看起来像这样:

const state = {
    authenticated: authenticate.isAuthenticated(),
};

const getters = {
    authenticated () {
        return state.authenticated
    }
};

const mutations = {
    isAuthenticated (state, isAuthenticated) {
        state.authenticated = …
Run Code Online (Sandbox Code Playgroud)

vue.js vue-component vuex

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

如何在PropertyPlaceholderConfigurer中获取tomcat环境变量

我尝试server.xml在我的jpa-spring.xml文件中的'PropertyPlaceholderConfigurer' 中获取Tomcat 中指定的Environment变量.

到目前为止,设置如下:

Tomcat的 server.xml

<Environment description="Identifies the server environement" 
             name="server-env" 
             type="java.lang.String" 
             value="dev" />
Run Code Online (Sandbox Code Playgroud)

WebContent/META-INF/context.xml:

<Context>
    <ResourceLink name="server-env" global="server-env" type="java.lang.String"/>
</Context>
Run Code Online (Sandbox Code Playgroud)

哪个引用WebContent/WEB-INF/web.xml如下:

<resource-env-ref>
    <description>Identifies server environement</description>
    <resource-env-ref-name>server-env</resource-env-ref-name>
    <resource-env-ref-type>java.lang.String</resource-env-ref-type>
</resource-env-ref>

<!-- Spring Integration -->

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
        /WEB-INF/config/jpa-spring.xml
</param-value>
</context-param>
Run Code Online (Sandbox Code Playgroud)

/WEB-INF/config/jpa-spring.xml我尝试将该变量作为替代品:

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
        <list>
            <value>WEB-INF/config/db.${server-env}.properties</value>
        </list>
    </property>
</bean>
Run Code Online (Sandbox Code Playgroud)

这是我使用网上发现的几篇文章中的信息整理的设置.

但是,我得到一个像......的错误

Could not resolve placeholder 'server-env' in [WEB-INF/config/db.${server-env}.properties] as system property: neither system property nor environment variable found
05 …
Run Code Online (Sandbox Code Playgroud)

java spring hibernate

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

Opentok屏幕共享与音频

我尝试使用opentok JS客户端创建一个屏幕共享应用程序,该客户端也共享发布者音频.

屏幕共享工作正常.但音频永远不会共享.

现在,我注意到控制台(Firefox)中的警告说Invalid audioSource passed to Publisher - when using screen sharing no audioSource may be used.这是否意味着根本不可能,或音频源无效?

tokbox opentok

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

Laravel Mix / Webpack环境相关变量的客户端代码

我正在寻找一种在开发机器上使用Laravel Mix构建资产的方法,该方法随后将与生产中的参数匹配。

例如,我的API有一个基本URL,http://foo.test/api/v1用于本地开发和https://foo.com/api/v1生产服务器上。

因此,在我的客户代码(例如http.js)中,我想执行以下操作:

Vue.axios.defaults.baseURL = API_BASE_URL;
Run Code Online (Sandbox Code Playgroud)

现在,API_BASE_URL应该会被替换成http://foo.test/api/v1我运行时npm run devhttps://foo.com/api/v1当我运行npm run prod

我已经尝试了以下无效的方法。

webpack.mix.js

mix.webpackConfig(webpack => {
   return {
      plugins: [
        new webpack.DefinePlugin({
            API_BASE_URL: JSON.stringify('https://foo.com/api/v1'),
        })
      ]
   }
});
Run Code Online (Sandbox Code Playgroud)

然后在http.js中

Vue.axios.defaults.baseURL = API_BASE_URL;
Run Code Online (Sandbox Code Playgroud)

编译为:

Object({"NODE_ENV":"production"}).API_BASE_URL;

我也尝试过这种方法process.env.API_BASE_URL

webpack laravel-mix

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

TYPO3 RealURL postVarSets隐藏关键字

我有一个如下所示的URL:

http://domain.com/leistungen/industrial-design/?tx_fsproject_fsprojectfp%5Bproject%5D=2&tx_fsproject_fsprojectfp%5Baction%5D=show&tx_fsproject_fsprojectfp%5Bcontroller%5D=Project&cHash=7c405bcde49853af9a7e78bdf465002c
Run Code Online (Sandbox Code Playgroud)

使用具有以下配置的RealURL(以及此处说明的一些钩子函数):

'postVarSets' => array(
        '_DEFAULT' => array(
            // projects
            'industrial-design' => array(
                array(
                    'GETvar' => 'tx_fsproject_fsprojectfp[controller]',
                ),
                array(
                    'GETvar' => 'tx_fsproject_fsprojectfp[action]',
                ),
                array(
                    'GETvar' => 'tx_fsproject_fsprojectfp[project]',
                    'lookUpTable' => array(
                        'table' => 'tx_fsproject_domain_model_project',
                        'id_field' => 'uid',
                        'alias_field' => 'title',
                        'addWhereClause' => ' AND deleted !=1 AND hidden !=1',
                        'useUniqueCache' => 1,
                        'useUniqueCache_conf' => array(
                            'strtolower' => 1,
                            'spaceCharacter' => '-',
                        )
                    )
                ),
            ),
        ),
    ),
Run Code Online (Sandbox Code Playgroud)

我得到一个如下所示的网址:

http://domain.com/leistungen/industrial-design/industrial-design/projekt/project-b/
Run Code Online (Sandbox Code Playgroud)

这不错.但是,为什么这部industrial-design/分会出现两次?

typo3 realurl

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

Fine Uploader仅适用于单批文件

我的Fine Uploader实现-使用核心模式和jQuery-可以正常工作,直到我尝试上传第二批文件。

当第一批文件成功上传后,我可以单击按钮添加文件,然后弹出对话框选择文件。但是,在确认文件选择后,什么也没有发生。

complete处理程序中的以下代码引起了问题:

$('#attachments-upload').button('reset'); // Bootstrap stateful button
Run Code Online (Sandbox Code Playgroud)

#attachments-upload是也设置为button:选项的按钮的ID 。这是完整的JS代码清单:

$('#attachments-list').fineUploader({
    uploaderType: 'basic',
    button: $('#attachments-upload'),
    debug: true,
    request: {
        endpoint:   $route_atatachments_upload,
        inputName: 'attachments'
    },
    validation: {
        allowedExtensions: ['png', 'jpeg', 'gif', 'pdf', 'doc', 'bmp'],
        sizeLimit: 10485760 // 10MB
    }
})
.on('upload', function(event, id, fileName) {

    $('#attachments-upload-error').hide();
    $('#attachments-upload').button('loading');
    $('#attachments-upload-progress').show().attr('aria-valuenow', 0);

})
.on('progress', function(event, id, fileName, loaded, total) {

    if (loaded < total) {
        var progress = Math.round(loaded / total * 100) + '% of ' + Math.round(total …
Run Code Online (Sandbox Code Playgroud)

fine-uploader

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