Translate

ubuntu系统下/var/log文件夹占用过大的问题

Issue:

        ubuntu系统中 /var/log 文件夹过大

        查看方法:

                cd /var/log
                sudo du -sh *| grep G


Solution:

        su
        cat /dev/null > /var/log/syslog.1
        cat /dev/null > /var/log/syslog
        cat /dev/null > /var/log/journal




Kafka - Failed with result 'exit-code'

Error:

    Failed with result 'exit-code'


Solution:

   1) Open the file meta.properties.

         In my case, it was located at the path /home/kafka/logs/meta.properties

    3) Just comment the the cluster.id with a #

    4) Restart zookeeper and kafka. (sudo systemctl restart kafka)








AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'

 YOLOv5 error:

    AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'

Solution:
    把154行左右的内容删掉即可,
    从

    
    变成











python string to url format

 Solution:


from urllib.parse import quote

# 原始字符串

raw_string = "Hello, World! How are you?"


# 对字符串进行 URL 编码

encoded_string = quote(raw_string)


print("原始字符串:", raw_string)

print("URL 编码后:", encoded_string)


Dockerfile构建速度过慢,更换国内源方法 (apt / pip)

apt方法:

       在Dockerfile中添加如下两句代码:

RUN  sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list

RUN  apt-get clean


/archive.ubuntu.com/        ->        /原本的地址(可以在/etc/apt/sources.list中查看)/




pip方法:

        在Dockerfile中添加:

RUN pip install -U pip

RUN pip config set global.index-url http://mirrors.aliyun.com/pypi/simple

RUN pip config set install.trusted-host mirrors.aliyun.com


or


RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn -r requirements.txt