各种小问题的解决记录

日常和开发时遇到各种稀奇古怪小问题的解决记录。

Windows 下 CLion Remote 模式乱码

中文环境下 CLion 控制台连英文 debug 信息都乱码,非常离谱。

修改语言和编码

  1. remote Linux 的语言改成全英文、shell 编码改成 UTF-8

  2. Windows 系统语言设置成英文,区域改成英语(美国)、打开全局 UTF-8(Control Panel -> Clock and Region -> Region 的两个选项卡都要改)

  3. CLion 的 SSH 选项中把 Communication Encoding 改成 UFT-8,Settings -> Editor -> File Encodings 下相关的编码选项全部改成 UFT-8

修改 CLion VM options

Help -> Edit Custom VM Options 添加如下:

-Dconsole.encoding=UTF-8
-Dfile.encoding=UTF-8

修改后就能在 CLion 里看到无乱码的 Debug 信息了:

以上同样适用于 tomcat 控制台、IDEA 等乱码情况。

语言其实可以不用改,只用改 IDE 的 Encoding,另外修改系统 encoding 可能导致一些中文软件和 VS 出问题。我喜欢一刀切所以全改了(


卡巴斯基导致 SMB 等局域网服务不可用

打开卡巴斯基-设置-保护-防火墙-配置包规则,修改以下红框中的四项:

删除 Local Services (TCP)Local Services (UDP) 中被阻止的 139,445 端口:

Any incoming ICMPICMPv6 Echo Request (in) 规则中的地址由任意地址改为子网地址-公用网络,即不拦截局域网地址和受信任网络:

IDEA 和 Maven

使用 IDEA 创建 Maven 项目时最好用 IDEA 自带的 Maven,否则可能造成 IDEA 相关的兼容性问题。

在国内懒得配代理的话可以使用阿里的 maven 镜像,不要直接修改捆绑的 maven 配置,不然 toolbox 更新一下又得重写配置。可以在其他目录建一个 xml 文件来覆盖默认设置,比如我的配置 mirror.xml

<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->

<!--
 | This is the configuration file for Maven. It can be specified at two levels:
 |
 |  1. User Level. This settings.xml file provides configuration for a single user,
 |                 and is normally provided in ${user.home}/.m2/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -s /path/to/user/settings.xml
 |
 |  2. Global Level. This settings.xml file provides configuration for all Maven
 |                 users on a machine (assuming they're all using the same Maven
 |                 installation). It's normally provided in
 |                 ${maven.conf}/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -gs /path/to/global/settings.xml
 |
 | The sections in this sample file are intended to give you a running start at
 | getting the most out of your Maven installation. Where appropriate, the default
 | values (values used when the setting is not specified) are provided.
 |
 |-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror>
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
     <mirror>
      <id>alimaven</id>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>
    </mirror> 
  </mirrors>
</settings>

在创建项目时做如下调整即可:

Manjaro 无法启用 SMB 服务

可以参考这篇 wiki:Using Samba in your File Manager - Manjaro Linux

其实我嫌麻烦所以干脆开了个 SSH 服务,用 SFTP 代替 SMB,Android 上 Solid Explorer 能够正常访问,IOS 自带文件管理器没试过,ComicShare 能够正常访问。

sudo systemctl enable sshd.service
sudo systemctl start sshd.service
加载评论