JueLuo's Blog


  • Home

  • Categories

  • Archives

  • Tags

  • Search

脚本语言的第一行应该写什么?

Posted on 2020-10-02 | In Python

脚本语言共同遵守的规则:当第一行为 #!/path/to/script/interpreter 时,指定了用来执行本脚本的解释器

例如:

解释器路径 脚本语言
#!/bin/sh shell 脚本
#!/usr/bin/perl perl 脚本
#!/usr/bin/python python 脚本
#!/usr/bin/python3 python3 脚本
#!/usr/bin/python2 python2 脚本
Read more »

修改 Eclipse 的默认编码为 UTF-8

Posted on 2020-09-26 | In Java

在 Eclipse 2020-03 版本中,发现默认保存文件使用的编码格式为 GBK

将其修改为 UTF-8 的步骤如下:

  1. 依次打开 Windows -> Preferences
  2. 找到 General -> Workspace -> 右侧选项界面中的左下角 Text file encoding -> 选择所需的编码格式

图

Read more »

表名是数字开头的,在 sql 语句中必须得用 [ ] 把表名括起来

Posted on 2020-08-31 | In SQL

例如如下语句:

1
2
3
SELECT '3DS' as 平台, [3DS].游戏名称, [3DS].通关日期, [3DS].游戏评分
FROM 3DS
WHERE (([3DS].游戏游玩状态)='愿望单') OR (([3DS].游戏游玩状态)='排队中');

若不带 [] 则会提示语法错误

Read more »

解决 Python 处理 json 时报错“Unexpected UTF-8 BOM”

Posted on 2020-03-10 | In Python

出现错误

在使用 requests 库发送请求后,接收的返回值解析成 json 时出错

即执行

1
result = session.post(url).json()

时,出现如下错误

1
json.decoder.JSONDecodeError: Unexpected UTF-8 BOM (decode using utf-8-sig)

原因分析

疑似返回的值内包含了一个 BOM 头

解决方法

导入 json 库

1
import json

先使用该库配合处理返回的 json 后在对其进行操作

1
2
3
4
result = result.text
    if result.startswith(u'\ufeff'):
        result = result.encode('utf8')[3:].decode('utf8')
    result = json.loads(result)
Read more »

在树莓派(Linux)上部署 ASF

Posted on 2019-10-11 | In 树莓派

因为给树莓派升级了基于 debian 10 “buster” 的新系统,故重新配置了一遍在其上运行的服务与应用。

参考自己整理的步骤部署 ASF 时发现,似乎并不用安装 .NET SDK,直接运行即可使用。

参考资料:

  1. 前面的文章
  2. https://github.com/JustArchiNET/ArchiSteamFarm(ASF 的 Github 页面)
Read more »

解决树莓派初始不支持读写 exFAT 文件系统的问题

Posted on 2019-06-04 | In Linux

挂载文件系统为exfat的U盘时提示: mount: unknown filesystem type 'exfat'

运行如下命令后,尝试重新挂载: sudo apt install exfat-utils

Read more »

解决使用 SecureCRT/Xshell 连接至 Linux 服务器使用 vim 时小键盘输入乱码的问题

Posted on 2019-04-16 | In Linux

SecureCRT

Options -> Session Options -> Terminal -> Emulation -> Modes -> Mode switching -> 取消勾选 Enable keypad mode switching

Xshell

会话管理器 -> 在需要修改的会话上右击 -> 终端 -> VT模式 -> 初始数字键盘模式(DECNKM) -> 设置为普通


参考链接:https://vi.stackexchange.com/questions/11581/why-doesnt-my-numpad-work-right-in-my-terminal

Read more »

Python 获取当前运行的文件名

Posted on 2019-03-14 | In Python

os.path.basename(__file__)

Read more »

自己常用的软件 / 工具整理

Posted on 2019-02-17 | In 工具 , Linux , Windows
Read more »

使用 rz 命令上传文件时出现错误:xxx was skipped

Posted on 2019-02-16 | In Linux

可能是权限不够,改用 sudo rz xxx 即可

Read more »
1 … 4 5 6 7
JueLuo

JueLuo

The better we get at getting better, the faster we will get better.

65 posts
21 categories
86 tags
GitHub Weibo Steam
© 2015 - 2024 JueLuo
Powered by Jekyll
Theme - NexT.Pisces