小编Kac*_*che的帖子

Rails:rake db:structure:load 在 CircleCI 2.0 上超时

当前,rake db:schema:load运行以在 CircleCI 上设置数据库。在从 using 迁移schema.rb到 时structure.sql,命令已更新为:rake db:structure:load

不幸的是,它似乎挂起并且没有返回:

$ bin/rake db:structure:load --trace
** Invoke db:structure:load (first_time)
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:structure:load
WARNING: terminal is not fully functional

 set_config 
------------

(1 row)

(END)rake aborted!
Interrupt:
<STACK TRACE>
bin/rake:9:in `<main>'
Tasks: TOP => db:structure:load
Too long with no output (exceeded 10m0s)
Run Code Online (Sandbox Code Playgroud)

在 CircleCI 上发现其他人有同样的问题,但没有答案。

database postgresql ruby-on-rails circleci circleci-2.0

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

使用unrar库 - 将文件提取到文件流缓冲区中

我需要的是能够将.rar文件中的文件提取到流中.我正在创建一个测试用例,以了解如何使用unrar源代码.我一直在寻找和修补一段时间,但我无法弄清楚如何使用该库.我很惊讶我甚至找不到文档或教程,考虑到常见的.rar档案.

我自己取得了一些进步,但并不总是有效.正确提取某些文件.其他文件由于某种原因混乱(但不完全是 "垃圾"二进制数据).到目前为止我所知道的通常是(但并不总是):

  • 不工作的文件fileInfo.Method = 48.它们似乎是压缩率为100%的文件 - 即没有压缩

  • 工作文件有fileInfo.Method = 49,50,51,52,或者53,它们分别对应于压缩速度最快,快速,正常,良好最好,

但我不知道为什么会这样.仍然找不到文档或工作示例.

下面是我到目前为止的测试用例源和一个示例rar存档,当使用此程序解压缩时,它具有工作文件和不工作文件.

/* put in the same directory as the unrar source files
 * compiling with:
 *   make clean
 *   make lib
 *   g++ rartest.cpp -o rartest libunrar.so -lboost_filesystem
 */

#include  <cstring>
#include  <iostream>
#include  <fstream>

#include  <boost/filesystem.hpp>

#define _UNIX
#define  RARDLL
#include  "dll.hpp"

using namespace std;
namespace fs = …
Run Code Online (Sandbox Code Playgroud)

c++ compression unrar

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

用于端元感知读取原始文件流元数据的c ++库?

我有来自图像文件的原始数据流,例如:

vector<char> rawData(fileSize);
ifstream inFile("image.jpg");
inFile.read(&rawData[0]);
Run Code Online (Sandbox Code Playgroud)

我想解析不同图像格式的标题高度和宽度.是否有一个可以从缓冲区/流中读取整数,长整数,短路等的可移植库,转换为指定的字节顺序?

我希望能够做类似的事情:short x = rawData.readLeShort(offset);long y = rawData.readBeLong(offset)

更好的选择是可以处理原始图像数据的轻量级和便携式图像元数据库(没有图像处理库的额外重量).我发现那里的Exif库不支持pnggif.

c++ metadata image filestream endianness

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

Git - 如何使用当前索引(当前状态)中的一些非暂存更改来编辑旧(不是之前的)提交?

我已经看过这些先前的问题了:

但它们并没有完全解决特定问题 - 索引中还有其他变化!运行rebase命令时,git抱怨:Cannot rebase: You have unstaged changes.

场景:

最后一个之前的提交(我将其称为"2 HEADs前"吗?)是一个重构提交.我目前在索引中有许多非分段更改,但我只想将其中一些添加到上一次提交的上一次.

我想象这样做的方法是:

  1. stash 我目前的所有变化
  2. rebase -i 到最后一次提交(更改索引并移动Head,对吧?)
  3. 将存储加载到我的索引而不更改Head(如何?)
  4. 使用add -pcommit --amend有选择地修改此旧提交
  5. rebase --continue 完成(更新孩子,移动回到我开始的地方,索引会发生什么?)
  6. 然后弹出/清除存储(索引回到我开始的地方).

它是否正确?如果是,我该如何做第3步?如果不是,我应该做什么呢?

另外,请注意我还在学习git,我仍然不能100%确定我正确地引用了git(Head,index,stash等)中的东西.


解:

对于其他任何人都可以提供帮助,这些是我实际采取的步骤:

  1. git stash 我目前的所有变化
  2. git rebase -i <ID>到前一次提交的父级,更改索引并移动Head
  3. git stash apply 将存储加载到我的索引中而不更改Head
    • 如果您有冲突,git reset HEAD <file>请卸载文件暂存.确保分期清晰.
  4. 使用add -pcommit --amend有选择地进行更改并提交它们
  5. git reset --hard 丢弃索引,使其与Head匹配
  6. git rebase --continue完成.更新孩子,移动头回到最开始,但有变化
    • 历史现在分为两个版本.另一个分支在WIP之前结束
  7. 然后弹出存储将索引带回我开始的地方.另一个分支也被清除.

git

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

Python requests &amp; urllib3 Retry - 如何从内部重试循环内部模拟 ConnectionError?

给出以下示例用法:

adapter = HTTPAdapter(max_retries=Retry(
    total=5,
    backoff_factor=0.1,
    status_forcelist=[429, 500, 502, 503, 504],
    method_whitelist=["HEAD", "GET", "OPTIONS"]
))
session = requests.Session()
session.mount("http://", adapter)
session.mount("https://", adapter)
rsp = session.post(url, json=my_json, params=my_params)
Run Code Online (Sandbox Code Playgroud)

我偶尔会得到:

('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
Run Code Online (Sandbox Code Playgroud)

我也想围绕这个问题建立重试(相关问题),并且我希望能够通过从库的重试循环内部发出这样的错误来测试它。

我怎么做?

python urllib3 python-requests

6
推荐指数
0
解决办法
680
查看次数

提取,然后将原始数据传递到另一个类 - 如何在保持封装的同时避免复制两次?

考虑一个class Book带有stl容器的class Page.每个Page都有一个截图,就像page10.jpg原始vector<char>形式一样.

Book打开A ,其中包含zip,rar或包含这些屏幕截图的目录的路径,并使用提取原始数据的相应方法,如ifstream inFile.read(buffer, size);,或unzReadCurrentFile(zipFile, buffer, size).然后它调用Page(const char* stream, int filesize)构造函数.

现在,很明显原始数据被复制了两次.一次提取到Book的本地buffer,第二次在Pagector中Page::vector<char>.有没有办法在摆脱中间人缓冲区的同时保持封装?

c++ copy filestream

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

每页最多Web部件/ Web部件区域数量?(Microsoft SharePoint 2007)

我已经找到了每页的最大网页数量:

但是,我一直无法找到:

  • 每个Web部件区域的最大Web部件数

  • 每页的最大Web部件区域数

sharepoint web-parts sharepoint-2007

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

以编程方式生成的查找字段导致"System.ArgumentException:Value不在预期范围内"创建新项目时

我创建了一个内容类型TypeA,它具有基本ListB的查找字段.然后我创建一个使用TypeA的ListA.一切都是以编程方式创建的.

当ListA的'添加新项'模态应该加载时抛出异常.它只发生在ListB中有项目的情况下.如果ListB为空,则listA的'添加新项'模态加载,并且正确显示ListB的查找字段(None)

堆栈跟踪:

System.ArgumentException: Value does not fall within the expected range.

at Microsoft.SharePoint.SPFieldMap.GetColumnNumber(String strFieldName, Boolean bThrow)
at Microsoft.SharePoint.SPListItemCollection.GetColumnNumber(String groupName, Boolean bThrowException)
at Microsoft.SharePoint.SPListItemCollection.GetRawValue(String fieldname, Int32 iIndex, Boolean bThrow)
at Microsoft.SharePoint.SPListItem.GetValue(SPField fld, Int32 columnNumber, Boolean bRaw, Boolean bThrowException)
at Microsoft.SharePoint.SPListItem.GetValue(String strName, Boolean bThrowException)
at Microsoft.SharePoint.SPListItem.get_Item(String fieldName)
at Microsoft.SharePoint.WebControls.LookupField.get_DataSource()
at Microsoft.SharePoint.WebControls.LookupField.CreateChildControls()
at System.Web.UI.Control.EnsureChildControls()
at Microsoft.SharePoint.WebControls.BaseFieldControl.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive() …
Run Code Online (Sandbox Code Playgroud)

c# lookupfield sharepoint-2010

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

双指针转换,使用`const void**ptr`参数传递给函数

海湾合作委员会给了我以下警告:

note: expected 'const void **' but argument is of type 'const struct auth **
Run Code Online (Sandbox Code Playgroud)

有没有可能导致问题的情况?

更大的片段是

struct auth *current;
gl_list_iterator_next(&it, &current, NULL);
Run Code Online (Sandbox Code Playgroud)

函数只存储在current一些void *指针中.

c gcc pointers

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

Python 静态类型提示/检查 Iterable[AnyStr] 与 Iterable[str] 之间的不匹配 | 可迭代[字节]

我遇到了这个静态类型提示不匹配(使用 Pyright):

from __future__ import annotations
from typing import AnyStr, Iterable


def foo(i: Iterable[AnyStr]):
    return i


def bar(i: Iterable[str] | Iterable[bytes]):
    return i


def baz(i: Iterable[str | bytes]):
    return i


def main():
    s = ['a']

    # makes sense to me
    baz(foo(s))  # allowed
    foo(baz(s))  # not allowed

    # makes sense to me
    baz(bar(s))  # allowed
    bar(baz(s))  # not allowed

    bar(foo(s))  # allowed
    foo(bar(s))  # nope -- why?
Run Code Online (Sandbox Code Playgroud)

什么之间的区别Iterable[AnyStr]Iterable[str] | Iterable[bytes]

它们不应该是“等效的”吗?(除了AnyStr在上下文中引用单个一致类型)

更具体地说:键入提示以下内容的正确方法是什么?

import random …
Run Code Online (Sandbox Code Playgroud)

python covariance contravariance type-hinting python-typing

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