我正在尝试在我的 WSL Ubuntu 上安装 postgres。安装完成,但是当我运行时,psql显示以下错误。
psql: error: could not connect to server: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
当我运行sudo find /var/run/postgresql/.s.PGSQL.5432查找该文件时,它显示另一个类似这样的错误。
postgres is not in the sudoers file. This incident will be reported.
从截图中会更清楚。
如何继续?请帮忙...
截屏:
我是C#的初学者,我通过解决数据结构案例场景来解决它.我需要帮助可视化以下代码段中发生的事情
public void AddAtLast(object data)
{
Node newNode = new Node();
newNode.Value = data;
current.Next = newNode;
current = newNode;
Count++;
}
Run Code Online (Sandbox Code Playgroud)
我明白了什么部分
我知道在链表的末尾添加了一个新节点.此外,新节点从函数参数获取其值.
我需要帮助的是什么
我特别想到为什么current.Next指向newNode,不应该指向NULL,因为我newNode将被放置在链表的末尾,所以它应该指向NULL.
另外,我们为什么这样做current=newNode?
我理解为什么count++存在可能是因为想要跟踪添加新元素的位置,但如果我的理解错误,请纠正我.
这是我的代码..
var client = new SendGridClient(SendGridEmailEntity.Key);
var from = new EmailAddress(SendGridEmailEntity.Mail, SendGridEmailEntity.DisplayName);
var subject = templateRecord.EmailFrm.SubjectName;
var to = new EmailAddress(activeQueueEntities[i].EmailId, activeQueueEntities[i].Name);
var plainTextContent = "";
var htmlContent = templateRecord.TemplateContent;
Run Code Online (Sandbox Code Playgroud)
var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent);
我正在学习的基础知识,Java似乎有一个观察我无法理解。
下面是应该打印的代码的二进制执行一个的base10数量。没有错误或警告,但我正在寻找答案的逻辑异常。
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
public class Main
{
private static final Scanner scanner = new Scanner(System.in);
public static void main(String args[]) {
int n = scanner.nextInt();
scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");
int remainder, quotient, i=0;
int[] binary=new int[n];
/* Binary division -Extracting the 1's and 0's out of the base10 number and storing it in binary[] */
while(n!=0){
remainder=n%2;
quotient=n/2;
binary[i]=remainder;
n=quotient;
i++;
}
int k=i; …Run Code Online (Sandbox Code Playgroud) 我写了一个python代码来解决一个难题。它没有按预期工作。因此,在调试时,我看到了一些很奇怪的东西。行是列表的列表。将1附加到单个row[n]将追加到row内的所有列表!
def trap( height):
row = []
for index, i in enumerate(height):
if i == 0 and len(row) == 0:
continue
else:
if(i > len(row)):#time for a new row
#to old rows append 0 below
for j in range(0, len(row)):
row[j].append(0)
row = row + [[0]] * (i - len(row))
else:
for j in range(0,i):
row[j].append(0)
#PROBLEMATIC CODE START
for jo in range(i,len(row)):
if(index == 1):
print("jays are",row)
print("jo is",jo, row[jo])
row[jo].append(1)
#PROBLEMATIC CODE END (I GUESS?)
print(row) …Run Code Online (Sandbox Code Playgroud) 我在控制台上收到以下错误
newList = sorted(l,key=sort)
NameError: name 'sort' is not defined
Run Code Online (Sandbox Code Playgroud)
执行以下代码后:
if __name__ == '__main__':
l= [[input(), float(input())] for _ in range(int(input()))]
print( l)
new = sorted(l,key=sort)
print(new)
Run Code Online (Sandbox Code Playgroud)
从给定的文章中我了解到key参数 insorted()可以使用用户/内置的 Python 方法。我试图按字母顺序对我的列表进行排序,所以我通过了key=sort一个理解,它会按字母顺序对我的列表进行排序。
请帮我看看我哪里出了问题。
python ×2
arrays ×1
c# ×1
debugging ×1
java ×1
java-8 ×1
linked-list ×1
postgresql ×1
python-3.x ×1
sendgrid ×1
sorting ×1
su ×1
sudo ×1