小编Abh*_*yan的帖子

致命:无法取消'branch.master.remote'

我想删除git remote.我刚刚用命令删除了heroku远程url

$ git remote rm heroku
Run Code Online (Sandbox Code Playgroud)

但是当我尝试在远程用于bitbucket(原点)时使用它.它失败并出现错误

git remote rm origin        
fatal: could not unset 'branch.master.remote'
Run Code Online (Sandbox Code Playgroud)

列出远程时的位置

$ git remote -v
Run Code Online (Sandbox Code Playgroud)

明确提到

origin  git@bitbucket.org:username/myapp.git (fetch)
origin  git@bitbucket.org:username/myapp.git (push)
Run Code Online (Sandbox Code Playgroud)

的.git /配置

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[branch "master"]
[branch "static-pages"]
[remote "origin"]
    url = git@bitbucket.org:myUserName/mY_Hidden_App.git
    fetch = +refs/heads/*:refs/remotes/origin/*
Run Code Online (Sandbox Code Playgroud)

git bitbucket

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

除了 aws ec2 vncserver 之外,看不到终端或其他任何东西

我按照本指南为 ec2 aws 实例设置 GUI:https ://youtu.be/9BAoJ7JZHr0

sudo apt-get install ubuntu-desktop vnc4server gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal 
Run Code Online (Sandbox Code Playgroud)

ec2 中的 Ubuntu 版本

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.6 LTS
Release:    16.04
Codename:   xenial
Run Code Online (Sandbox Code Playgroud)

更改:并使用此 ~/.vnc/xstartup 文件:

#!/bin/sh

export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &

gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &
Run Code Online (Sandbox Code Playgroud)

但我没有看到任何终端。我只看到窗户。无法打开终端

在此处输入图片说明

gnome amazon-ec2 vnc-viewer amazon-web-services ubuntu-16.04

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

.net核心中StreamReader的更短解决方案

我有这个基本代码来读取StreamReaderVS Code中带有Dotnet Core 的文件.我可以在Visual Studio中使用.net进行类似的操作,new StreamReader("file.json")它看起来小巧紧凑.

我正在寻找dotnet核心中的另一个类,它可以用更少的代码实现类似的结果

 using System;
 using System.IO;

namespace ConsoleApplication
{
    public class Program
    {
        public static void Main(string[] args)
        {
            StreamReader myReader = new StreamReader(new FileStream("project.json", FileMode.Open, FileAccess.Read)); 
            string line = " "; 

            while(line != null)
            {
                line = myReader.ReadLine(); 
                if(line != null)
                {
                    Console.WriteLine(line); 
                }
            }

            myReader.Dispose();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

c# .net-core .net-core-rc2

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

即使在成员函数成为朋友之后也无法访问成员

在下面的代码中,如果我成为College类的类朋友,University那么我可以访问University类的私有属性.但是在College类I中我只希望print函数访问那些私有属性.所以,我只把班级的print功能College作为朋友,但似乎没有用.我错过了什么或做错了什么?

错误:无法访问University类的名称私有属性.

#include <iostream>

//class college; 

class University{
    //friend class college;   // Works fine
    friend void College::print(University &ob);    // doesn't work

public:
    University() = default;

    University(int i, char *n) : buildings{ i }, name{ n } {}

private:
    int buildings; 
    char *name; 
};

class College{
public:
    void print(University &ob){
        std::cout << "I am a part of " << ob.name;   // <-----------
    }
};

int main()
{ …
Run Code Online (Sandbox Code Playgroud)

c++

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

为什么在模板和朋友功能的情况下出现LNK1120和LNK2019

我已经在Turbo-C中编译了第一个版本的代码,它编译时没有任何错误.但是当我在Visual Studio中编译它或从CommandLine编译普通g ++时,我会在帖子中看到错误.

我通过互联网搜索并阅读了一些StackOverflow问题和MSDN LNK1120问题文档.我找到了修复下面代码的方法.但是,没有明确的原因.如何定义摆脱该错误.从语法上讲,容易出错的代码看起来也很好.

1) Error    2   error LNK1120: 1 unresolved externals   

2) Error    1   error LNK2019: unresolved external symbol "void __cdecl  

totalIncome(class Husband<int> &,class Wife<int> &)" (?totalIncome@@YAXAAV?
$Husband@H@@AAV?$Wife@H@@@Z) referenced in function _main   
Run Code Online (Sandbox Code Playgroud)

注意:请注意程序中的箭头.我明确地说过了.所以,可能不会通过完整的程序.

错误易错代码:

#include <iostream>

using namespace std;

template<typename T> class Wife;           // Forward declaration of template    

template<typename T>
        class Husband{
        friend void totalIncome(Husband<T> &hobj, Wife<T> &wobj);

        public:
            Husband() = default;
            Husband(T new_salary): salary{new_salary} {}

        private:
            T salary;
        };

template<typename T>
        class Wife{
        friend void totalIncome(Husband<T> &hobj, …
Run Code Online (Sandbox Code Playgroud)

c++ templates class friend-function

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

未处理的承诺拒绝:类型错误:网络请求失败博览会节点后端

我有一个我的博览会应用程序正在查询的节点后端。node-express-mongo 后端工作得非常完美,我可以使用 Postman 的 GET 请求进行验证,但我的应用程序中出现未处理的承诺拒绝网络失败错误

完全错误:

[Unhandled promise rejection: TypeError: Network request failed]
- node_modules/whatwg-fetch/dist/fetch.umd.js:473:29 in xhr.onerror
- node_modules/event-target-shim/dist/event-target-shim.js:818:39 in EventTarget.prototype.dispatchEvent
- node_modules/react-native/Libraries/Network/XMLHttpRequest.js:574:29 in setReadyState
- node_modules/react-native/Libraries/Network/XMLHttpRequest.js:388:25 in __didCompleteResponse
- node_modules/react-native/Libraries/vendor/emitter/EventEmitter.js:190:12 in emit
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:436:47 in __callFunction
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:111:26 in __guard$argument_0
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:384:10 in __guard
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:110:17 in __guard$argument_0
* [native code]:null in callFunctionReturnFlushedQueue

Run Code Online (Sandbox Code Playgroud)

这是我的代码:

api.js

export const fetchMeetups = () =>
    fetch('http://localhost:3000/api/meetups')
        .then(res => res.json());
Run Code Online (Sandbox Code Playgroud)

应用程序.js

import * as React from 'react';
import { Platform, StyleSheet, Text, View, …
Run Code Online (Sandbox Code Playgroud)

android fetch react-native expo

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

快速连接字符时出错

我试图在 Swift 中连接两个字符,但它显示了错误

二元运算符不能应用于两个字符操作数。

let a: Character = "A"
let l: Character = "l"

let al = a + l 
Run Code Online (Sandbox Code Playgroud)

Swift 的字符串支持运算符重载,那么为什么不支持字符呢?

concatenation swift

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

没有从std :: string到int的合适转换

我试图使用标准C库的一些功能,但我得到了这个错误:没有从std :: string到int的合适转换.我刚从C学习C++.请不要用困难的术语解释这个问题.

#include <iostream>
#include <string> 
#include <cctype>

using namespace std; 

int main(void)
{
  string s1{ "Hello" }; 
  bool what{ isalnum(s1) }; 
  return 0; 
} 
Run Code Online (Sandbox Code Playgroud)

c++ c++11

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