小编fph*_*ipe的帖子

Fastlane对Jenkins的测试失败

我试图在Jenkins上运行fastlane扫描,测试执行良好,通过,但在最后一部分它似乎失败,因为它无法访问或启动模拟器:

[32;1m   Executed 337 tests, with 0 failures (0 unexpected) in 5.657 (5.702) seconds
[0m
2018-12-19 11:09:41.006 xcodebuild[87795:568022] [MT] IDETestOperationsObserverDebug: 34.991 elapsed -- Testing started completed.
2018-12-19 11:09:41.006 xcodebuild[87795:568022] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start
2018-12-19 11:09:41.007 xcodebuild[87795:568022] [MT] IDETestOperationsObserverDebug: 34.991 sec, +34.991 sec -- end
2018-12-19 11:09:41.007 xcodebuild[87795:568022] Error Domain=IDETestOperationsObserverErrorDomain Code=6 "Early unexpected exit, operation never finished bootstrapping - no restart will be attempted" UserInfo={NSLocalizedDescription=Early unexpected exit, operation never finished bootstrapping - no restart will be attempted, …
Run Code Online (Sandbox Code Playgroud)

groovy ios jenkins fastlane

14
推荐指数
0
解决办法
788
查看次数

这是一个做JS OOP的好方法吗?

我想问一下以下OOP风格的优点.我用以下方式编写JS类.

var MyClass = function() {
    // private vars
    var self = this,
        _foo = 1,
        _bar = "test";

    // public vars
    this.cool = true;

    // private methods
    var initialize = function(a, b) {
        // initialize everything
    };

    var doSomething = function() {
        var test = 34;
        _foo = cool;
    };

    // public methods
    this.startRequest = function() {

    };

    // call the constructor
    initialize.apply(this, arguments);
};

var instance_1 = new MyClass();
var instance_2 = new MyClass("just", "testing");
Run Code Online (Sandbox Code Playgroud)

这是一个好方法吗?有什么缺点吗?我不使用继承,但它会以这种方式实现继承吗?

提前致谢.

javascript oop

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

仅在存在时重命名列

PostgreSQL不允许

ALTER TABLE t RENAME COLUMN IF EXISTS c1 TO c2
Run Code Online (Sandbox Code Playgroud)

...或类似的东西。但是,能够编写修改DB结构的脚本非常方便,该脚本可以再次运行而无需先检查它是否已经运行。

我该如何编写PostgreSQL函数来做到这一点?

postgresql

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

为什么 mconcat 需要一个列表而不是一个可折叠的?

在查看Monoid我的定义时,我注意到mconcat具有以下定义():

mconcat :: Monoid a => [a] -> a
mconcat = foldr mappend mempty
Run Code Online (Sandbox Code Playgroud)

为什么签名将其限制为[a]而不是Foldable像这样更通用?

mconcat' :: (Foldable t, Monoid a) => t a -> a
mconcat' = foldr mappend mempty
Run Code Online (Sandbox Code Playgroud)

这是历史原因吗?或者这种更通用的实现是否会使特定类型更难提供它的优化版本,例如[]使用列表理解(source)的情况?

haskell monoids foldable

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

为to_json:方法使用不同的键

使用:methodsto_json,有没有办法重命名密钥?我正在尝试用它的base62版本替换真实的id,我希望base62_id得到密钥的值:id.

@obj.to_json(
    :except => :id
    :methods => :base62_id
)
Run Code Online (Sandbox Code Playgroud)

我试着这样做

@obj.to_json(
    :except => :id
    :methods => { :id => :base62_id }
)
Run Code Online (Sandbox Code Playgroud)

但那没用.

有什么建议?

json ruby-on-rails

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

为什么在消息nil无效时检查self!= nil in -init?

假设我们的-init方法只调用消息self,为什么通常检查self != nil消息nil是否无效?

假设我们有一个初始化器如下:

- (id)init
{
    self = [super init];
    if (self) {
        [self doThis];
        [self setFoo:@"Bar"];
    }

    return self;
}
Run Code Online (Sandbox Code Playgroud)

self我们可以写下:而不是检查:

- (id)init
{
    self = [super init];
    [self doThis];
    [self setFoo:@"Bar"];

    return self;
}
Run Code Online (Sandbox Code Playgroud)

现在如果由于某种原因[super init]返回nil,据我所知,该方法的结果没有区别.为什么我们会经常执行此检查?

objective-c

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

在java中使用array_agg序列化psql结果集

我有 2 个包含数据的表

tripsheet=# select * from t1;
 c1 | c2 
----+----
  1 |  2
  1 |  3
(2 rows)

tripsheet=# select * from t2;
 c3 | c4 
----+----
  1 | 11
  1 | 12
(2 rows)
Run Code Online (Sandbox Code Playgroud)

有查询

tripsheet=# select t1.*,array_agg(t2.*) from t1, t2 where t1.c1 = t2.c3 group by t1.c1, t1.c2;
 c1 | c2 |      array_agg      
----+----+---------------------
  1 |  3 | {"(1,11)","(1,12)"}
  1 |  2 | {"(1,11)","(1,12)"}
(2 rows)
Run Code Online (Sandbox Code Playgroud)

我正在使用 java jdbc 来处理结果集,我无法将 (1,11) 转换为相应的 pojo。

以下是我的代码

String sql="select …
Run Code Online (Sandbox Code Playgroud)

java jdbc

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

Ruby dig set - 使用 Hash#dig 分配值

基本上我想使用 #dig.

我的必须是这样的:

hash = {
   :first => {
      :second => [1,2,3,4]
  }
}
Run Code Online (Sandbox Code Playgroud)

我会用 Hash#dig

hash.dig(:first, :second) = [1,2,3,4]
Run Code Online (Sandbox Code Playgroud)

我怎样才能分配这个值?

ruby

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

如何从 pg_dump 输出中删除注释和设置?

我正在尝试仅使用 PostgreSQL 数据库转储数据pg_dump,然后将这些数据恢复到另一个数据库中。但是使用此工具生成 sql 脚本也会在输出文件中添加一些注释和设置。

运行此命令:

pg_dump --column-inserts --data-only my_db > my_dump.sql
Run Code Online (Sandbox Code Playgroud)

我得到类似的东西:

--
-- PostgreSQL database dump
--

-- Dumped from database version 8.4.22
-- Dumped by pg_dump version 10.8 (Ubuntu 10.8-0ubuntu0.18.04.1)

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET escape_string_warning = off;
SET row_security = off;

-- …
Run Code Online (Sandbox Code Playgroud)

database postgresql pg-dump

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

CakePHP无法保存到Postgres数据库中,但成功返回

以前有人遇到过这个问题吗?

在CakePHP中,我有这个.

    $this->loadModel('BankBalance');
    $data = array("BankBalance"=> array(bla bla bla...);
    $this->BankBalance->save($data);
    $log = $this->BankBalance->getDataSource()->getLog(false, false); debug($log);
Run Code Online (Sandbox Code Playgroud)

并且调试将此返回给我

array(
'log' => array(
    (int) 0 => array(
        'query' => 'BEGIN',
        'params' => array(),
        'affected' => null,
        'numRows' => null,
        'took' => null
    ),
    (int) 1 => array(
        'query' => 'INSERT INTO bla bla bla...)',
        'params' => array(),
        'affected' => (int) 1,
        'numRows' => (int) 1,
        'took' => (float) 7
    ),
    (int) 2 => array(
        'query' => 'COMMIT',
        'params' => array(),
        'affected' => (int) …
Run Code Online (Sandbox Code Playgroud)

postgresql cakephp

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