小编Nic*_*ons的帖子

MongoDB查询超过30秒的文档

有没有人有一个很好的方法来查询超过30秒的文档的集合.我正在创建一个清理工作程序,在项目处于特定状态超过30秒后将其标记为失败.

并不重要,但我正在使用mongojs.

每个文档都有一个created与之关联的时间.

javascript mongodb mongodb-query mongojs

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

Nightmare.js与Docker

我试图在服务器上运行Nightmare.js.我很清楚它在Linux上是无头的,并且要求xvfb.我不明白为什么我在DEBUG模式下继续出现以下错误:

  nightmare queuing process start +0ms
  nightmare queueing action "useragent" +3ms
  nightmare queueing action "goto" for https://news.ycombinator.com +2ms
  nightmare queueing action "cookies" +1ms
  nightmare queueing action "goto" for https://news.ycombinator.com/login +0ms
  nightmare queueing action "type" +1ms
  nightmare queueing action "type" +0ms
  nightmare queueing action "click" +0ms
  nightmare queueing action "wait" +1ms
  nightmare queueing action "goto" for https://news.ycombinator.com/item?id=11878025 +0ms
  nightmare queueing action "click" +0ms
  nightmare queueing action "wait" +1ms
  nightmare running +0ms
  nightmare electron child process exited with code 2: …
Run Code Online (Sandbox Code Playgroud)

docker nightmare dockerfile

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

通过Magento中的自定义属性查找客户

我有一个名为rms_id的自定义属性.这是一个与我们在另一个数据库中的客户相关联的唯一帐号.我需要一种方法来通过此ID查找客户,而无需手动访问数据库.

截至目前,我可以通过电子邮件地址加载客户,如下所示:

$customer->loadByEmail($data['email']);
Run Code Online (Sandbox Code Playgroud)

这很棒,但电子邮件并不总是可用.RMS id是.有没有办法通过自定义属性加载用户?

从理论上讲,以下方法可行:

$customer->loadByRmsId($data['account_id']);
Run Code Online (Sandbox Code Playgroud)

但它出错了.任何帮助将非常感激.

magento

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

提取猫鼬与忏悔

我很好奇是否有人能够提供一些有关抽象使用Node.js + Restify + Mongoose构建的API的最佳方法的见解.在来自MVC/PHP背景之后,发现Node应用程序没有字符串/定义结构很有意思.

截至目前,我有我的app.js文件,自动加载我的routes.js文件,所有模型js文件等.

困惑主要在于我的路线应该如何与来自Mongo的数据进行交互.这是我的代码如何布局的基本概述.

app.js:

/**
 * Require Dependencies
 */
var restify    = require('restify')
    , mongoose = require('mongoose')
    , config   = require('./config')
    , routes   = require('./routes');

/**
 * Create Server & Define Settings
 */
var server = restify.createServer({
    name: config.name,
    version: config.version
});

/**
 * Common Handlers
 */
server.use(restify.acceptParser(server.acceptable));
server.use(restify.queryParser());
server.use(restify.bodyParser());
server.use(restify.jsonp());

/**
 * Connect to Mongo Database
 */
 mongoose.connect(config.mongo.uri, function(err) {

    // assign connection to var so we can pass it down the chain
    var …
Run Code Online (Sandbox Code Playgroud)

javascript mongoose mongodb node.js restify

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

Redshift-使用node-orm-2的自动增量ID的不支持类型“ serial”

关于如何获得自动增量ID的任何见解?据我了解,默认情况下会添加一个id列;但是,由于我使用的是Redshift,因此默认的“串行”类型将不起作用,因为它不受支持。

{ [error: Column "probe.id" has unsupported type "serial".]
  name: 'error',
  length: 165,
  severity: 'ERROR',
  code: '0A000',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: '/home/awsrsqa/padb/src/pg/src/backend/parser/parser_analyze.c',
  line: '3600',
  routine: 'transformColumnDefinition',
  model: 'probe' }
Run Code Online (Sandbox Code Playgroud)

node.js amazon-redshift node-orm2

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

使用Navicat在Postgres中设置自动增量ID

我对Postgres不太熟悉,而Navicat是我遇到的唯一功能齐全的GUI。就是说,我正在尝试为id实现一个简单的自动递增。Navicat似乎不支持bigserial或serial,或者没有任何东西可以指定带有自动增量的主键。有什么想法吗?

postgresql navicat

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

停止添加到购物车并在Magento中向用户提供消息

我已经成功地在Magento中建立了一个观察者,它结合了自定义的添加到购物车事件.现在,在某种情况下,我需要停止添加到购物车事件(或者甚至将其删除?),并向用户发送消息.

目前,此产品设置为允许每个订单的最大数量为1.如果用户尝试添加超过1,Magento将显示错误消息并阻止将该项添加到购物车.

屏幕截图:[link] http://cl.ly/image/3V2C2j1S0f37

理想情况下,我想模仿观察者的相同功能,但我完全不知道如何解决这个问题,因为我是Magento的新手.

我读过我需要抛出异常.但是当我这样做时,它只是把我带到了一个错误页面.想知道我是否需要以某种方式添加此修改版本:

Mage::helper('cataloginventory')->__('The maximum quantity allowed for purchase is %s.', '<span class="sku-failed-qty" id="sku-stock-failed-' . $item->getId() . '">' . ($item->getQtyMaxAllowed()  * 1) . '</span>');
Run Code Online (Sandbox Code Playgroud)

任何帮助或指针将不胜感激.

magento

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

在AWS Elastic Beanstalk上部署后运行PHP脚本

我已经创建了一个PHP脚本,它为Magento生成一个local.xml文件,其中包含所需的数据库设置和凭据.我需要在部署应用程序后运行它; 但我似乎无法找到一种方法.我的理解是我需要.config.ebextensions目录中创建一个文件.有人有解决方案吗?

magento amazon-elastic-beanstalk

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

Mongoose 中的错误处理

我正在使用RestifyMongoose创建一个 API ,我对这两者都是全新的。我似乎无法找出处理 Mongoose / Node.js 中错误的正确方法。

到目前为止,我正在尝试做这样的事情:

Submission.findById(req.params.submission_id, function(err, data) {

    if (err) 
        return next(err);

    res.send(data);

});
Run Code Online (Sandbox Code Playgroud)

我正在尝试对此调用 GET (对于不存在的用户)。而不是发回简单的错误消息,它会导致我的整个节点应用程序失败。我对 return next(err) 的用户以及它到底应该做什么感到有些困惑。

任何帮助是极大的赞赏。

mongoose node.js restify

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

通过观察员捕捉Magento事件

我的观察者似乎未捕获Magento v1.12.0.2发出的事件。我正在密切关注来自http://inchoo.net/ecommerce/magento/dispatching-before-and-after-events-to-magento-core-actions/的教程,并且似乎无法复制。

app / etc / modules / Require_Additional_Product.xml

<?xml version="1.0"?>
<config>
    <modules>
        <RequireAdditionalProduct>
            <active>true</active>
            <codePool>local</codePool>
        </RequireAdditionalProduct>
    </modules>
</config>
Run Code Online (Sandbox Code Playgroud)

app / code / local / Hatclub / RequireAdditionalProduct / etc / config.xml

<modules>
    <RequireAdditionalProduct>
        <version>1.0.0</version>
    </RequireAdditionalProduct>
</modules>

<global>

    <models>
        <dispatcher>
            <class>Hatclub_RequireAdditionalProduct_Model</class>
        </dispatcher>
    </models>

    <events>

         <!-- Hooking to Magento's default event "controller_action_predispatch" -->
        <controller_action_predispatch>
            <observers>
                <controller_action_before>
                    <class>dispatcher/observer</class>
                    <method>hookToControllerActionPreDispatch</method>
                </controller_action_before>
            </observers>
        </controller_action_predispatch>

        <!-- Hooking to Magento's default event "controller_action_postdispatch" -->
        <controller_action_postdispatch>
            <observers>
                <controller_action_after>
                    <class>dispatcher/observer</class>
                    <method>hookToControllerActionPostDispatch</method>
                </controller_action_after>
            </observers>
        </controller_action_postdispatch> …
Run Code Online (Sandbox Code Playgroud)

magento

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