我有一个带有单个子模块的 git 存储库sub/x。(该子模块不包含其自己的任何子模块。)
在超级项目的存储库中, 的输出git status显示以下(未暂存的)修改
modified: sub/x (new commits)
Run Code Online (Sandbox Code Playgroud)
如果我现在跑步
git submodule update
Run Code Online (Sandbox Code Playgroud)
...在超级项目上,以下行被打印到终端(仅此而已):
Skipping submodule 'sub/x'
Run Code Online (Sandbox Code Playgroud)
此后,git status超级项目的输出保持如上所示,没有变化。
(如果我添加--init到git submodule update命令中,则同上。)
问:如何确定git submodule update [--init]跳过sub/x子模块的原因?
我想将一些二进制图像数据编码/压缩为序列(如果是位).(通常,此序列的长度不能完全适合整数个标准整数类型.)
如何在不浪费空间的情况下做到这一点?(我意识到,除非比特序列具有"漂亮"的长度,否则在最后总是必须有少量[<1字节]的剩余空间.)
FWIW,我估计,对于我想要编码的每个符号,最多需要3位.Python有这种工作的内置工具吗?
我想要一个f这样的功能
(outer(X, Y, f))[i, j]是X的第i个元素和Y的第j个元素的并排连接,类似于c(X[i], Y[j])或具有类似的结构.
此外,我希望这个结果能够重复这个过程,并且通过这种方式,我们得到了这个结果
(outer(outer(X, Y, f), Z, f))[i, j, k]是X的第i个元素,Y的第j个元素和Z的第k个元素的并排串联,即相等或具有类似于的结构c(X[i], Y[j], Z[k]).
最终我的目标是定义这样的函数:
foo <- function(a.list) {
Reduce(function(x, y) outer(x, y, f), a.list)
}
Run Code Online (Sandbox Code Playgroud)
这样,如果
A <- foo(list(v_1, ..., v_p))
Run Code Online (Sandbox Code Playgroud)
那dim(A)将是c(length(v_1), ..., length(v_p)),和
A[i_1, ..., i_p] == c(v_1[i_1], ..., v_p[i_p])
Run Code Online (Sandbox Code Playgroud)
对于所有有效的索引集(i_1,...,i_p).
例如:
> foo(list(LETTERS[1:2], c(3, 4, 5), letters[6:7]))
, , 1
[,1] [,2] [,3]
[1,] c("A", 3, "f") c("A", 4, "f") c("A", 5, "f") …Run Code Online (Sandbox Code Playgroud) (注意:请参阅另一篇文章,了解为什么我没有使用dpkg/apt-get/etc进行此安装.)
我可以在Debian的virtualenv中安装numpy,例如pip:
(base)[1778]% pip -v install numpy
Downloading/unpacking numpy
...
<output omitted>
...
Successfully installed numpy
Cleaning up...
Removing temporary dir /home/jones/.virtualenvs/base/build...
Run Code Online (Sandbox Code Playgroud)
但在此之后立即:
(base)[1779]% python
Python 2.7.1 (r271:86832, Jun 22 2011, 15:39:05)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
>>> ^D
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
1 class test {
2 public static int compare0(Comparable x, Comparable y) {
3 return x.compareTo(y);
4 }
5 public static int compare1(Object x, Object y) {
6 return ((Comparable) x).compareTo((Comparable) y);
7 }
8 public static int compare2(Object x, Object y) {
9 Comparable p = (Comparable) x;
10 Comparable q = (Comparable) y;
11 return (p).compareTo(q);
12 }
13 public static void main(String[] args) {
14 Comparable zero = new Integer(0);
15 Comparable one = new Integer(1);
16 …Run Code Online (Sandbox Code Playgroud) 是否可以定义一个MATLAB类,以便可以像调用任何其他函数一样调用此类中的对象?
IOW,我问的是,是否可以在MATLAB中编写类似以下Python类的内容:
# define the class FxnClass
class FxnClass(object):
def __init__(self, template):
self.template = template
def __call__(self, x, y, z):
print self.template % locals()
# create an instance of FxnClass
f = FxnClass('x is %(x)r; y is %(y)r; z is %(z)r')
# call the instance of FxnClass
f(3, 'two', False)
...
[OUTPUT]
x is 3; y is 'two'; z is False
Run Code Online (Sandbox Code Playgroud)
谢谢!
假设这f是一个参数的函数,其输出是n维(m 1 × m 2 ...× m n)数组,并且它B是长度为k的向量,其元素都是有效参数f.
我正在寻找一个方便的,更重要的是,"形状无关"的MATLAB表达式(或配方),用于生成由(n +1)维(m 1 × m 2 ×...× m n × k)数组得到的"堆叠" k n维数组
f(b),其中参数的b范围超过B.
要做到这一点numpy,我会使用这样的表达式:
C = concatenate([f(b)[..., None] for b in B], -1)
Run Code Online (Sandbox Code Playgroud)
在情况下,它有什么用途,下面我将解开这个numpy的表达(见附录),但现在我要强调它的特点是,它是完全不可知有关的形状/大小 f(b) 和 B.对于我想到的应用类型,编写这种"形状无关"代码的能力至关重要.(我强调这一点,因为我为实现这种操作而遇到的许多MATLAB代码绝对不是"与形状无关",而且我不知道如何实现它.)
附录
通常,如果A是一个numpy数组,那么表达式A[..., None]可以被认为是"重塑",A以便它获得一个额外的,微不足道的维度.因此,如果f(b)是n维(m 1 …
我正在寻找一种无插件的方法来获取可见视口右边缘的x坐标,同样,使用jQuery或"普通"JavaScript获取其底边的y坐标.
谢谢!
我正在尝试通过 GitHub 的 v3 API 添加一个 ssh 密钥,但它似乎不起作用。
我正在做的是基于这里给出的说明。
更具体地说,我正在使用以下内容:
KEY=$( cat ~/.ssh/id_rsa.pub )
TITLE=${KEY/* }
# the '/* ' above deletes every character in $KEY up to and including the last
# space.
JSON=$( printf '{"title": "%s", "key": "%s"}' "$TITLE" "$KEY" )
TOKEN=$( cat /path/to/tokenfile )
curl -s -d "$JSON" "https://api.github.com/user/keys?access_token=$TOKEN"
Run Code Online (Sandbox Code Playgroud)
当我运行上面的程序时,我得到的响应是:
{
"message": "Not Found"
}
Run Code Online (Sandbox Code Playgroud)
...而且,果然,当我签入我的 GitHub 帐户时,$KEY不在列出的 ssh-keys 1 中。
我究竟做错了什么?
额外细节
"message": "Not Found"如果我只是运行,我会得到相同的响应
curl -s "https://api.github.com/user/keys?access_token=$TOKEN"
Run Code Online (Sandbox Code Playgroud)
如果我-s …
如何仅使用Git管道命令完成以下基本序列?
% git init
% git add this that
% git commit -m 'initial commit'
% vim this
# ... edit this ...
% git add this
% git commit -m 'update this'
Run Code Online (Sandbox Code Playgroud) git ×2
matlab ×2
python ×2
bit-packing ×1
comparable ×1
easy-install ×1
generics ×1
github ×1
github-api ×1
interface ×1
java ×1
javascript ×1
jquery ×1
memory ×1
numpy ×1
oop ×1
pip ×1
r ×1
reduce ×1
scipy ×1
tooltip ×1
unchecked ×1