作者归档:admin

在manjaro/archlinux中设置dbeaver指定的java版本

找到 dbeaver 的执行位置,查看它的安装位置:

$ which dbeaver
/usr/bin/dbeaver
$ cat /usr/bin/dbeaver
export GTK_OVERLAY_SCROLLING=0
/usr/lib/dbeaver/dbeaver $@

进入 /usr/lib/dbeaver/ 目录,编辑 dbeaver.ini ,在 -vmargs 上面,添加以下内容:

-vm
/usr/lib/jvm/java-17-openjdk/bin

注意:确保已经安装了dbeaver指定的 jre/jdk 版本,并获取其目录。

docker容器的重启策略

Use a restart policy

To configure the restart policy for a container, use the --restart flag when using the docker run command. The value of the --restart flag can be any of the following:

FlagDescription
noDo not automatically restart the container. (the default)
on-failure[:max-retries]Restart the container if it exits due to an error, which manifests as a non-zero exit code. Optionally, limit the number of times the Docker daemon attempts to restart the container using the :max-retries option.
alwaysAlways restart the container if it stops. If it is manually stopped, it is restarted only when Docker daemon restarts or the container itself is manually restarted. (See the second bullet listed in restart policy details)
unless-stoppedSimilar to always, except that when the container is stopped (manually or otherwise), it is not restarted even after Docker daemon restarts.

参考:https://docs.docker.com/config/containers/start-containers-automatically/

Manjaro中VMwareWorkstation网卡无法连接的解决办法

提示信息可能像这样:

Could not connect 'Ethernet0' to virtual network '/dev/vmnet0'. More information can be found in the vmware.log file.

Failed to connect virtual device 'Ethernet0'.

尝试以下操作:

  1. 启动网络服务
sudo systemctl restart vmware-networks
  1. 尝试重装内核
# 61 改为自己的版本
yay -S linux61 linux61-headers

重启后再试。

  1. 重置网卡设置
sudo touch /etc/vmware/x && sudo vmware-networks --migrate-network-settings /etc/vmware/x && sudo rm /etc/vmware/x && sudo modprobe vmnet && sudo vmware-networks --start

参考:

  1. https://www.jianshu.com/p/d01e65ea8d09
  2. https://communities.vmware.com/t5/VMware-Workstation-Pro/Network-services-failed-in-Linux-installation-VMware-workstation/td-p/2317431

php 框架执行存储过程(stored procedure) 并获取返回

laravel

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use PDO;

class TestController extends Controller
{
    public function index()
    {
        $pdo = DB::getPdo();
        $int = 1;
        $res = 0;
        $stmt = $pdo->prepare("EXEC dbo.test :int,:res");
        $stmt->bindParam(':int', $res, PDO::PARAM_INT);
        $stmt->bindParam(':res', $res, PDO::PARAM_STR | PDO::PARAM_INPUT_OUTPUT, 400);
        $stmt->execute();
        dd($res);
    }
}

参考:

  • https://stackoverflow.com/questions/71321858/api-laravel-call-store-procedure-with-in-and-out-parameter-using-oci8-or-pdo
  • https://laracasts.com/discuss/channels/general-discussion/running-stored-procedures

thinkphp 5.0

tp5 需要修改原码才可以使用:

  • 找到文件 thinkphp/library/think/db/Connection.php
  • 第 388 行,在 catch (\PDOException $e) 内,修改为如下代码:
    if ($procedure == true) { return; } elseif ($this->isBreak($e)) { return $this->close()->query($sql, $bind, $master, $pdo); }

控制器执行:

<?php

namespace app\api\controller;

use PDO;
use think\Db;

class Test extends Common {
    public function index() {
        $int = 1;
        $res = 1;
        Db::query('exec test :int,:res', [
            'int' => $int,
            'res' => [&$res, PDO::PARAM_STR | PDO::PARAM_INPUT_OUTPUT, 4000],
        ]);
        print_r($res);
    }
}

参考:

  • https://blog.csdn.net/Drug_/article/details/95474776

以上示例使用的存储过程如下:

ALTER PROC [dbo].[test]
-- 创建:CREATE PROC [dbo].[test]
 @IntInput int,
 @StrResult varchar(20) out
as
begin
         if (@IntInput>1)
           Set
        @StrResult = '>1'
        else 
            Set
        @StrResult = '<=1'
end

SQL 执行:

declare @strResult varchar(20)
exec test -1,@strResult output
print @strResult

nextcloud配置

商店代理

配置目录:config/config.php ,在配置数组中添加以下项:

 'installed' => true, # 原有配置项
'appstoreenabled' => true,
# 以下二选一
'appstoreurl' => 'https://www.orcy.net/ncapps/v1/', # 仅加速目录列表
'appstoreurl' => 'https://www.orcy.net/ncapps/v2/', # 加速github,推荐

删除目录缓存:data/appdata_<xxx>/appstore/apps.json

安装应用

  • Office & text
    • Plain text editor
继续阅读

svn 迁移到 git

用户迁移配置 userinfo.txt

svn_user = git_user <git_user_email>
svn_user2 = git_user2 <git_user_email2>

迁移项目

git svn clone <https://server/svn/xx> --username <user> [--password <password>] --prefix=svn/ --no-metadata --authors-file=<userinfo.txt> --stdlayout

如果出现 Author: VisualSVN Server not defined in userinfo.txt file ,应当在 userinfo.txt 中添加缺失的用户。

如果出现 Can't locate Term/ReadKey.pm in @INC ,执行以下命令(以 manjaro 系统为例):

yay -S perl-term-readkey