小编Nei*_*ter的帖子

git:错误:src refspec master与any不匹配

将git存储库克隆到目录"hggit"并设置远程源

mbm:hggit my name$ git remote add origin git@code.getpantheon.com:"mystringhere"
Run Code Online (Sandbox Code Playgroud)

编辑文件后,我提交了更改(位于子目录中)

mbm:handelgroup michaelmausler$ git commit -m "first commit"
[master 5a29bc8] first commit
 1 files changed, 2 insertions(+), 2 deletions(-)
Run Code Online (Sandbox Code Playgroud)

然后我尝试推送文件更改并收到以下错误

mbm:hggit myname$ git push origin master
error: src refspec master does not match any.
error: failed to push some refs to 'git@code.getpantheon.com:"mystringhere"'
Run Code Online (Sandbox Code Playgroud)

git

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

如果网格大于120个三角形,则Matlab会正确停止在网格上插入颜色

我正在尝试使用trimesh函数在Matlab中绘制一个大网格,顶点的z坐标控制颜色.不幸的是,当网格的大小超过120个三角形时,Matlab会停止正确插值颜色.这是一张展示问题的图片,左边是120个三角形,右边是121个三角形.

一张图片展示了这个问题

如您所见,对于大网格,Matlab直接从一个顶点的颜色插值到另一个顶点的颜色.这可能是出于性能原因而做的,但我正在尝试为我的论文生成漂亮的图片,而我并不关心计算它们需要多长时间.有没有办法禁用这种近似值?

这是生成图片的代码:

function test(n)
    %%% Generate a mesh with n triangles.

    oneTriVerts = [0 0 0;
                   1 0 0;
                   1 0 1];

    offset = [0 (1/n) 0;
              0 (1/n) 0;
              0 (1/n) 0];

    verts = zeros(0,3);
    tris  = zeros(0,3);
    for i = 0:(n-1)
        verts = [verts; (oneTriVerts + i * offset)];
        tris = [tris; i*3+1, i*3+2, i*3+3];
    end

    %%% Draw the mesh, with color corresponding to the z coordinate.

    trimesh(tris, verts(:,1), verts(:,2), verts(:,3), verts(:,3));
    title(sprintf('n = %d', …
Run Code Online (Sandbox Code Playgroud)

3d matlab plot mesh

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

难以让Parsec解析器正确跳过空格

我是Parsec的新手(以及一般的解析器),我写的这个解析器遇到了一些麻烦:

list = char '(' *> many (spaces *> some letter) <* spaces <* char ')'
Run Code Online (Sandbox Code Playgroud)

我的想法是以这种格式解析列表(我正在研究s表达式):

(firstElement secondElement thirdElement and so on)
Run Code Online (Sandbox Code Playgroud)

我写了这段代码来测试它:

import Control.Applicative
import Text.ParserCombinators.Parsec hiding (many)

list = char '(' *> many (spaces *> some letter) <* spaces <* char ')'

test s = do
  putStrLn $ "Testing " ++ show s ++ ":"
  parseTest list s
  putStrLn ""

main = do
  test "()"
  test "(hello)"
  test "(hello world)"
  test "( hello world)"
  test "(hello world …
Run Code Online (Sandbox Code Playgroud)

haskell parsec

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

如何在haskell中编写递归函数

如何在Haskell中编写一个函数,它接受一个列表和一个数字,并删除大于该数字的所有元素并返回列表.

删除[5,4,3,9,1] 5应该返回[5,4,3,1]

我编写了以下方法,当它达到大于给定数字时,它变成无限循环.我出去了[5,4,3然后程序没有结束.

remove l1 x = if (null l1 == True)
                then l1
                else if (head l1 > x)
                       then remove (drop 0 l1) x
                       else ((head l1) : remove (tail l1) x)
Run Code Online (Sandbox Code Playgroud)

这是我第一次尝试Haskell程序,请告诉我这里我做错了什么.

谢谢

haskell

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

标签 统计

haskell ×2

3d ×1

git ×1

matlab ×1

mesh ×1

parsec ×1

plot ×1