小编Ser*_*hyk的帖子

开玩笑没有测试

运行docker mhart/alpine-node:8在macOS上

nodejs(6.10.3-r0)(18/18)纱线0.24.6 jest 20.0.4

但是,在运行代码时,我有一个__tests __/index.test.js文件

node_modules/.bin/jest --watchAll 我得到以下输出

未检测到
/usr/src/app
5个文件已检查.
testMatch:/ __ tests __ / /*.js?(x),**/?(*.)(spec|test).js?(x) - 1匹配
testPathIgnorePatterns:/ node_modules /,/ src,src - 0匹配
模式:"" - 0场比赛

我已经重新安装了包裹号码,但无济于事.

javascript unit-testing node.js jestjs

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

UnicodeEncodeError:'ascii'编解码器不能编码位置0-5的字符:序数不在范围内(128)

我只是想解码\ uXXXX\uXXXX\uXXXX之类的字符串.但是我收到一个错误:

$ python
Python 2.7.6 (default, Sep  9 2014, 15:04:36) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print u'\u041e\u043b\u044c\u0433\u0430'.decode('utf-8')
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)

    UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-4: ordinal not in range(128)
Run Code Online (Sandbox Code Playgroud)

我是Python新手.有什么问题?谢谢!

python decode utf-8 python-2.7

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

PhantomJS:操作在通过AJAX加载资源时取消

这是我的代码:

page.onResourceRequested = function (requestData, networkRequest) {
    console.log(requestData.url); // This message shows http://website-with-jquery-included.com/page.html!
}

page.onResourceError = function(resourceError) {
  console.log('Unable to load resource (#' + resourceError.id + 'URL:' + resourceError.url + ')');
  console.log('Error code: ' + resourceError.errorCode + '. Description: ' + resourceError.errorString);
};

page.open('http://website-with-jquery-included.com/', function(status) {
    if (status === "success") {

        page.evaluate(function() {

            console.log('I can see this message');

            $.ajax({url: 'http://website-with-jquery-included.com/page.html', success: function(resp) {
                console.log('I cannot see this message!');
            }});
        });
    }
});
Run Code Online (Sandbox Code Playgroud)

函数page.onResourceError打印错误消息:

无法加载资源(#35URL:http://website-with-jquery-included.com/page.html )

错误代码:5.说明:操作已取消 …

ajax asynchronous jquery-callback phantomjs

8
推荐指数
0
解决办法
1110
查看次数

在不触及Core和VQMOD/OCMOD的情况下修改OpenCart的最佳方法

有没有比使用VQMOD/ OCMOD更改OpenCart's核心文件更好的方法?

是否存在一些"覆盖"文件夹,以便我可以简单地创建PHP与文件结构相对应的任何文件,并简单地覆盖核心文件?(就像它可能在PrestaShopMagento).

VQMOD/ OCMOD高度不便.有人使用任何黑客和技巧来实现结果吗?

我不想触摸任何核心文件以保持系统清洁和可管理.

非常感谢!

overriding core opencart vqmod opencart2.x

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

Paradox DB SQL 多重连接

我正在处理一个遗留的 VB6 项目,我需要像这样进行 JOIN 调用:

SELECT C.Cnum, C.RealDate, M.Name, R.Price, R.Qnt, R.RealPrice, R.QntP, R.QntR, M.Name
FROM "CHECK" C 
LEFT JOIN "RCHECK" R ON C.Cnum = R.Cnum 
LEFT JOIN "PCHECK" P ON C.Cnum = P.Cnum 
LEFT JOIN "MONEY" M ON P.Curency = M.Sifr 
LEFT JOIN "MENU" MN ON R.Sifr = MN.Sifr 
WHERE C.Cnum > 0 ORDER BY C.Cnum
Run Code Online (Sandbox Code Playgroud)

"Driver={Microsoft Paradox Driver (*.db )};DriverID=538"用作连接字符串的一部分,但它似乎不支持多个连接!这很奇怪。

任何想法如何解决/解决它?

是的,当我在 Borland Database Desktop 中运行此查询时,它运行良好。

更新 1:

我的VB代码:

Dim Conn As New ADODB.Connection
Dim sConnStr …
Run Code Online (Sandbox Code Playgroud)

sql vb6 paradox

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

如何在大量数据中preg_replace_all

我只是制作了一个升级脚本,用于将所有MODX片段标记替换为更新的格式:

老一: [~123~]

新的一个: [[~123]]

(当然,123 - 这是一个例子 - 有很多不同的数字)

此外,我想将所有自定义片段替换为较新的片段:

旧片段格式:

[!MySnippetName? &param1=`value1` &param2=`value2` !]
Run Code Online (Sandbox Code Playgroud)

新的一个:

[[!MySnippetName? &param1=`value1` &param2=`value2` ]]
Run Code Online (Sandbox Code Playgroud)

(当然,&param1=value1 &param2=value2这只是一个例子,它在真正的片段中有所不同)

如何使用preg_replace函数进行全局替换?我应该像这样创建:

$doc[ 'content' ] = $this->preg_replace_all(
        array(
                '/\[~([0-9]+)~\]/',
                '\[!LatestUpdates(.*)!\]',
                '\[!ArticleSummary(.*)!\]',
            ), array(
                '[[~\1]]',
                '[[!LatestUpdates\1]]',
                '[[!ArticleSummary\1]]',
            ),
            $doc[ 'content' ]
        );
Run Code Online (Sandbox Code Playgroud)

preg_replace_all函数:

private function preg_replace_all( $find, $replacement, $s )
{
    while(preg_match($find, $s)) {
        $s = preg_replace($find, $replacement, $s);
    }
    return $s;
}
Run Code Online (Sandbox Code Playgroud)

但它不起作用.请帮助找出问题所在.提前致谢.

php regex upgrade preg-replace modx-revolution

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

AWS EB:WebSocket握手期间出错:意外的响应代码:400

在AWS上托管了一个Laravel / Vue.JS应用,该应用在Classic Load Balancer(Elastic Beanstalk)之后,并通过Nginx内部代理到socket.io服务器。SSL在Nginx上终止。

这是nginx配置:

location /socket.io {
    proxy_pass          http://127.0.0.1:6001;
    proxy_http_version  1.1;
    proxy_set_header    Upgrade           $http_upgrade;
    proxy_set_header    Connection        "upgrade";
    proxy_set_header    Host $host;
    proxy_set_header    X-Real-IP         $remote_addr;
    proxy_set_header    X-Forwarded-For   $proxy_add_x_forwarded_for;
    proxy_set_header    X-Forwarded-Proto $scheme;
}
Run Code Online (Sandbox Code Playgroud)

现在,长轮询模式可以正常运行,但是无法启动升级:

WebSocket与'wss://example.com/socket.io/?EIO = 3&transport = websocket&sid = HmDFtq-aj1WgfGUyAAAJ'的连接失败:WebSocket握手期间出错:意外的响应代码:400

PS Chrome的Frames标签中,我只能看到以下奇怪消息:(Opcode -1)

有没有人成功让socket.io在AWS Elastic Beanstalk环境中工作?我只花了两个星期来处理这个问题,非常感谢任何建议或想法。谢谢!

更新。我打开了详细的日志记录,这是Nginx中的变量:

$host example.com
$proxy_add_x_forwarded_for 134.xxx.xxx.xxx
$http_upgrade -
$remote_addr 172.31.10.208
$remote_user -
$server_name _
$upstream_addr 127.0.0.1:6001
$request GET /socket.io/?EIO=3&transport=polling&t=Lw26sYn&sid=6L5iHma-GJOeE3JQAAAX HTTP/1.1
$upstream_response_time 24.658 msec
$request_time 24.658
Run Code Online (Sandbox Code Playgroud)

也许有人会发现其中一些值不正确,所以我将不胜感激。

nginx amazon-web-services socket.io amazon-elastic-beanstalk laravel-echo

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

Twig中的Symfony2内部路由渲染功能

我的layout.html.twig:

{{ render(controller('AcmeDemoBundle:Page:mainmenu')) }}
Run Code Online (Sandbox Code Playgroud)

Page控制器检索来自主义的所有页面,并呈现mainmenu.html.twig一组页面.

我的mainmenu.html.twig:

{% if menu_pages is defined %}
    {% for page in menu_pages %}
        <li class="{% if app.request.attributes.get('_internal') == '_page_show' and app.request.get('id') == page.id %}active{% endif %}"><a href="{{ path('_page_show', {id: page.id}) }}">{{ page.title|e }}</a></li>
    {% endfor %}
{% endif %}
Run Code Online (Sandbox Code Playgroud)

但是没有active显示课程.据我所知,问题出在内部路由上.如何解决?

php routing symfony doctrine-orm twig

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

启动eclipse时出现java.lang.ClassNotFoundException

用dpkg(Ubuntu)清除并重新安装eclipse之后会出现错误:

cat     /home/sergiy/.eclipse/org.eclipse.platform_3.7.0_155965261/configuration/1337883707989.log
!SESSION Thu May 24 21:21:48 EEST 2012 -----------------------------------------
!ENTRY org.eclipse.equinox.launcher 4 0 2012-05-24 21:21:48.242
!MESSAGE Exception launching the Eclipse Platform:
!STACK
java.lang.ClassNotFoundException: org.eclipse.core.runtime.adaptor.EclipseStarter
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
Run Code Online (Sandbox Code Playgroud)

这是/usr/lib/eclipse/configuration/config.ini文件:

#This configuration file was written by:     org.eclipse.equinox.internal.frameworkadmin.equinox.EquinoxFwConfigFileParser
#Wed Apr 04 13:29:31 UTC 2012
org.eclipse.update.reconcile=false
eclipse.p2.profile=PlatformProfile
osgi.instance.area.default=@user.home/workspace
osgi.framework=file\:plugins/org.eclipse.osgi_3.7.2.dist.jar
equinox.use.ds=true
eclipse.buildId=I20110613-1736
osgi.bundles=reference\:file\:org.eclipse.equinox.simpleconfigurator_1.0.200.dist.jar@1\:start
org.eclipse.equinox.simpleconfigurator.configUrl=file\:org.eclipse.equinox.simpleconfigurator/bundles.info
eclipse.product=org.eclipse.platform.ide
osgi.splashPath=platform\:/base/plugins/org.eclipse.platform
osgi.framework.extensions=
osgi.bundles.defaultStartLevel=4
eclipse.p2.data.area=@config.dir/../p2/
eclipse.application=org.eclipse.ui.ide.workbench
osgi.bundlefile.limit=100
Run Code Online (Sandbox Code Playgroud)

如何解决这个问题?提前致谢!

java eclipse exception reinstall

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