小编Ken*_*ter的帖子

Composer 内存不足 - 需要替代方法来增加 PHP memory_limit

我正在尝试通过 Composer 在客户端的 Magento 2 上安装扩展,但我遇到了旧的 PHP 内存不足错误。

我的客户端由 Bluehost 托管,不幸的是,这意味着我不能进入并更改 php.ini 中的 memory_limit,因为它是只读的,而且他们的 cPanel MultiPHP INI 编辑器不会影响 SSH。我的客户一直与 Bluehost 联系,他们被告知 Bluehost 不允许更改 SSH memory_limit,但是,我的客户最近才不得不安装不同的扩展,这需要增加 memory_limit,但他们自己做了他们不记得他们使用了什么命令或他们编辑的文件。

我可以确认 Composer 已正确安装在服务器上,因为我可以运行命令composer require path/to/extension. 这只会导致内存不足错误。

运行命令会COMPOSER_MEMORY_LIMIT=-1 composer require amasty/advanced-review导致相同的错误:

mmap() failed: [12] Cannot allocate memory

mmap() failed: [12] Cannot allocate memory

Fatal error: Out of memory (allocated 809508864) (tried to allocate 4096
bytes) in phar:///opt/cpanel/composer/bin/composer/src/Composer
/DependencyResolver/RuleSetGenerator.php on line 126
Run Code Online (Sandbox Code Playgroud)

任何人都对我可以做些什么来使事情正常工作有任何建议?

php magento composer-php

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

不尝试使用任何属性时出现 AttributeError

早上好!

我正在使用在本地 PC 和 ssh 服务器中运行的代码(使用 python 3.8)。有一点,我正在使用下一段代码从泡菜加载数据:

from os.path  import exists
import _pickle as pickle

def load_pickle(pickle_file):

    if exists(pickle_file):
    
        with open(pickle_file, 'rb') as f:
            loaded_dic = pickle.load(f)

        return loaded_dic

    else:
        return 'Pickle not found'
Run Code Online (Sandbox Code Playgroud)

pickle_file是带有泡菜路径的字符串。如果pickle 存在,函数返回一个字典,如果它不存在,它返回字符串'Pickle not found'。

在我的本地 PC 中,代码运行良好,加载 dict 没有问题。但是,在 ssh 服务器中,理论上,dict 已加载,但是,如果我尝试访问它,只需键入loaded_dic,它就会引发以下错误:

AttributeError: 'NoneType' object has no attribute 'axes'
Run Code Online (Sandbox Code Playgroud)

因此,我的其余代码在尝试使用变量时失败loaded_dic

非常感谢您提前!

pickle python-3.x

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

Apex初学者 - 从触发器发送电子邮件

这是我用APEX编写的第一段代码,所以我正在学习...知道一点Java(到研究生水平),但我不知道为什么这不起作用.

我知道它不会像之前告诉我那样给salesforce一个错误(因此最后注释掉了调试.我更改了联系人电子邮件,它只是这样做,但我没有收到任何电子邮件!这是代码,谢谢你有任何帮助!

trigger Test1 on Contact (after update) {

//IF Email has changed (look at the old email and compare to new)
if(trigger.old[0].Email != trigger.new[0].Email){


    //Commit current transaction, reserver email capacity
    Messaging.reserveSingleEmailCapacity(1);
    //Create an email message object
    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

    //List<Messaging.SendEmailResult> results = new list<Messaging.SendEmailResult>();
    //hold email address
    String[] toAddresses = new String[] {trigger.new[0].Email};

    //Assign new address string
    mail.setToAddresses(toAddresses);
    //specify return ad (assuming as being sent from server)    
    mail.setReplyTo('XXX@example.com');
    //sender name
    mail.setSenderDisplayName('Mr Apex Tester');
    //Subject Specification
    mail.setSubject('Subjected to …
Run Code Online (Sandbox Code Playgroud)

email salesforce soql apex-code

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

如何在 XCode 4.6.3 上添加 Apple ID 帐户?

我正在尝试将新的 Apple ID 帐户添加到 XCode 4.6.3。

说明是打开首选项对话框并单击“帐户”选项卡。

但我的 XCode 中没有这样的选项卡。

现在我该怎么做?

xcode ios xcode4

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

如何对 awk 命令的结果输出进行 gzip 压缩?

我尝试过这个,但没有成功。如何从 awk 命令生成 gz 文件的输出?

 awk -v someVariable="$VAR1" '
        BEGIN {
         . . .
        }

        {
           SOME CODES HERE
        }
        END {}
    ' $FILES> gzip $RESULTING_OUTPUT
Run Code Online (Sandbox Code Playgroud)

bash awk gzip

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

数据集成软件和 ESB 有什么区别?

我一直在从事一个项目,该项目从各种第三方数据源收集数据并将数据挖掘到我们的数据存储 (DI) 中。为此,我们一直在使用 Pentaho。

我想知道这是否也可以用 ESB(骆驼或骡子)来完成?ESB 带来了哪些 DI 没有提供的其他特性?

我已经阅读了很多关于 ESB 和 DI 的文章,但没有一篇能够解决这个查询。我还阅读了有关第三方数据源的 mule 数据连接器的信息。

dependency-injection esb pentaho apache-camel mule

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

如何通过ssh获取远程命令的退出代码

我通过ssh从远程机器运行脚本:

ssh 'some_cmd;my_script'  
Run Code Online (Sandbox Code Playgroud)

现在,我想在我的本地机器上存储shell脚本的退出状态.我该怎么做?

linux ssh bash

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

Camel 测试 - java.lang.IllegalArgumentException:必须指定 defaultEndpoint

我正在尝试使用http://camel.apache.org/mock.html为我的骆驼路线创建测试用例。我需要验证路由中的处理器。但是简单的测试对我不起作用。

public class CamelRouteTest  extends CamelTestSupport {

  @Override
  public String isMockEndpointsAndSkip() {
    // override this method and return the pattern for which endpoints to mock,
    // and skip sending to the original endpoint.
    return "mock:result";
  }

  @Test
  public void verifyMessageCount() throws Exception {
    template.sendBody("Test");
    getMockEndpoint("mock:result").expectedMessageCount(1);
    assertMockEndpointsSatisfied();
  }

  @Override
  protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start").to("mock:result");
        }
    };
  }
}
Run Code Online (Sandbox Code Playgroud)

堆栈跟踪:

java.lang.IllegalArgumentException: defaultEndpoint must be specified
    at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:308) …
Run Code Online (Sandbox Code Playgroud)

java apache-camel camel-test

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

骆驼 - 无法访问休息服务

我正在通过spring和camel boot使用嵌入式tomcat运行camel.我有一个简单的骆驼路由正确配置和消耗,我可以在日志中看到,但当我尝试访问它时,它给404 localhost:8080/hi.

我的路线

 @Component
 public class ServiceRoute extends RouteBuilder {

 @Autowired
 private SampleBean sampleBean;

 @Override
 public void configure() throws Exception {
   from("rest:get:hi").to("bean:sampleBean");
 }
}
Run Code Online (Sandbox Code Playgroud)

我的主要课程

@Configuration
@SpringBootApplication
@ComponentScan(basePackages = { "routes", "service" },
    excludeFilters = {@ComponentScan.Filter(value = Controller.class,     
    type = FilterType.ANNOTATION)})

public class Application  {

public static void main(String[] args) {
    SpringApplication.run(Application.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)

Gradle依赖项

dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'

compile 'org.apache.camel:camel-spring-boot-starter:2.17.0'

compile group: 'org.springframework.boot', name: 'spring-boot-starter-
web', version: '1.4.2.RELEASE'

compile group: 'org.apache.camel', …
Run Code Online (Sandbox Code Playgroud)

java spring apache-camel spring-boot

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

骆驼路线多个如果条件

我必须写信给骆驼的多个 if 条件,我需要帮助才能解决问题。

if(token is NULL)
if(condition is NULL) 
if(Dates does not match)
Then execute this...
Run Code Online (Sandbox Code Playgroud)

我正在尝试的是

.choice
.when(token is NULL)
.when(condition is NULL)
.when(Dates does not match)
.log(update DB)
.endchoice()
Run Code Online (Sandbox Code Playgroud)

哪个不起作用..请帮忙

apache-camel

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