Quantcast
Channel: Redino blog

VSCode SFTP plugin connecting with private key error:OPENSSL_internal:DECODE_ERROR

$
0
0

When I'm trying to upload file using SFTP extension in Visual Studio Code, following error is shown:

Error while signing data with privateKey: error:06000066:public key routines:OPENSSL_internal:DECODE_ERROR

Full stack trace is

[04-15 09:45:25] [error] Error: [120.55.113.108]: Error while signing data with privateKey: error:06000066:public key routines:OPENSSL_internal:DECODE_ERROR
    at Client. (/home/gbstack/.vscode/extensions/liximomo.sftp-1.12.9/dist/extension.js:70:107548)
    at Client.emit (events.js:327:22)
    at Client.EventEmitter.emit (domain.js:483:12)
    at /home/gbstack/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2/lib/client.js:578:16
    at SSH2Stream.authPK (/home/gbstack/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/ssh.js:1640:3)
    at SSH2Stream.onUSERAUTH_PK_OK (/home/gbstack/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2/lib/client.js:572:14)
    at Object.onceWrapper (events.js:421:28)
    at SSH2Stream.emit (events.js:315:20)
    at SSH2Stream.EventEmitter.emit (domain.js:483:12)
    at parse_USERAUTH (/home/gbstack/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/ssh.js:4171:12)
    at parsePacket (/home/gbstack/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/ssh.js:3862:12)
    at SSH2Stream._transform (/home/gbstack/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/ssh.js:694:13)
    at SSH2Stream.Transform._read (_stream_transform.js:191:10)
    at SSH2Stream._read (/home/gbstack/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/ssh.js:253:15)
    at SSH2Stream.Transform._write (_stream_transform.js:179:12)
    at doWrite (_stream_writable.js:403:12)
    at writeOrBuffer (_stream_writable.js:387:5)
    at SSH2Stream.Writable.write (_stream_writable.js:318:11)
    at Socket.ondata (_stream_readable.js:716:22)
    at Socket.emit (events.js:315:20)
    at Socket.EventEmitter.emit (domain.js:483:12)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:271:9)
    at Socket.Readable.push (_stream_readable.js:212:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:186:23)

The ssh connection is using public key authentication, and my sftp configuration (sftp.json) is like following:

{
    "name": "My Server",
    "host": "test",
    "protocol": "sftp",
    "privateKeyPath": "/home/test/.ssh/id_rsa",
    "port": 22,
    "username": "root",
    "remotePath": "/var/www/html/test/"
}

Solution

To fix this error, we can convert the private key file from OpenSSH private key format to PEM format.

ssh-keygen -p -m PEM -f /home/test/.ssh/id_rsa

Try again it will work now.

The post VSCode SFTP plugin connecting with private key error:OPENSSL_internal:DECODE_ERROR appeared first on Redino blog.


‘mvwin_wchnstr’ was not declared in this scope when compiling lnav

$
0
0

lnav is a great log file viewer. To use its latest features, we need to fetch the source code and compile manually.
When compiling lnav using make, following error is appeared

listview_curses.cc: In member function ‘virtual void listview_curses::do_update()’:
listview_curses.cc:293:76: error: ‘mvwin_wchnstr’ was not declared in this scope
             mvwin_wchnstr(this->lv_window, y, this->lv_x, row_ch, width - 1);
                                                                            ^
listview_curses.cc:297:77: error: ‘mvwadd_wchnstr’ was not declared in this scope
             mvwadd_wchnstr(this->lv_window, y, this->lv_x, row_ch, width - 1);

I have installed all requirements stated in documentation.

Solution

The lnav documentation only said ncurses library is needed, but not mention which version.
My current installed ncurses library is libncurses5-dev. Changing to libncursesw5-dev fixed this issue.

apt install libncursesw5-dev

(This command is for apt package manager, please change to corresponding command according to the package manager you use.)

The post ‘mvwin_wchnstr’ was not declared in this scope when compiling lnav appeared first on Redino blog.

IDEA Build got error: package org.springframework.web.servlet.config.annotation does not exist

$
0
0

When building project in IDEA 2021.1, following error appeared:

package org.springframework.web.servlet.config.annotation does not exist

And the weired thing is that running mvn compile in command line works well, but run Build in IDEA will got this error.

The building process works before, but recently I modified source code of one of my dependency JHCommonLibrary which is depending on spring-webmvc

<dependency>
        <groupId>com.juhe</groupId>
        <artifactId>JHCommonLibrary</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </dependency>

I remove spring-webmvc dependency from JHCommonLibrary but it didn't work.

<dependency>
        <groupId>com.juhe</groupId>
        <artifactId>JHCommonLibrary</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <exclusions>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-webmvc</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

Then add spring-webmvc explicitly, and it didn't work as well.

<dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-webmvc</artifactId>
          <version>4.3.9.RELEASE</version>
      </dependency>

Solution

Finally, I move JHCommonLibrary to end of <dependencies>, now it works. Or adding spring-webmvc dependency before JHCommonLibrary also works.

(I need to state again, this issue only appeared in IDEA but not appear if running mvn compile in command line. So it's likey a bug in IDEA)

The post IDEA Build got error: package org.springframework.web.servlet.config.annotation does not exist appeared first on Redino blog.

RuntimeError: view size is not compatible with input tensor’s size and stride (at least one dimension spans across two contiguous subspaces)

$
0
0

RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.

The causing code is

def accuracy(output, target, topk=(1,)):
    """Computes the accuracy over the k top predictions for the specified values of k"""
    with torch.no_grad():
        maxk = max(topk)
        batch_size = target.size(0)

        _, pred = output.topk(maxk, 1, True, True)
        pred = pred.t()
        correct = pred.eq(target.view(1, -1).expand_as(pred))

        res = []
        for k in topk:
            correct_k = correct[:k].view(-1).float().sum(0, keepdim=True)
            res.append(correct_k.mul_(100.0 / batch_size))
        return res

This error didn't happen before, so it's introduced by new version of pytorch (now my current used pytorch is 1.8.1).

And printing the array, I found it's a boolean array.

Solution

Add .contiguous() before view() or use reshape to replace view

So change the line

correct_k = correct[:k].view(-1).float().sum(0, keepdim=True)

to

correct_k = correct[:k].contiguous().view(-1).float().sum(0, keepdim=True)

or

correct_k = correct[:k].reshape(-1).float().sum(0, keepdim=True)

The post RuntimeError: view size is not compatible with input tensor’s size and stride (at least one dimension spans across two contiguous subspaces) appeared first on Redino blog.

error: GL/gl.h: No such file or directory

$
0
0

When compling the Qt based program on Ubuntu, following error is shown

/home/gbstack/app/Qt/5.15.2/gcc_64/include/QtGui/qopengl.h:141: error: GL/gl.h: No such file or directory
In file included from ../../../app/Qt/5.15.2/gcc_64/include/QtGui/qopengltexture.h:47,
from ../../../app/Qt/5.15.2/gcc_64/include/QtGui/QOpenGLTexture:1,
from ../../QtScrcpy/QtScrcpy/device/render/qyuvopenglwidget.cpp:2:
../../../app/Qt/5.15.2/gcc_64/include/QtGui/qopengl.h:141:13: fatal error: GL/gl.h: No such file or directory
141 | # include <GL/gl.h>
| ^~~~~

I tried apt install libopengl-dev but it doesn't work.

Solution

apt install libgl-dev

The post error: GL/gl.h: No such file or directory appeared first on Redino blog.

ImportError: cannot import name ‘pad’ from ‘skimage.util’

$
0
0

Got error after upgrading skimage

Traceback (most recent call last):
  File "afy/yanderify.py", line 21, in 
    from afy.predictor_local import PredictorLocal
  File "K:\QQData\519329064\FileRecv\yanderifier\yanderify\cuda100\afy\afy\predictor_local.py", line 9, in 
    from animate import normalize_kp
  File "K:\QQData\519329064\FileRecv\yanderifier\yanderify\cuda100\afy\fomm\animate.py", line 7, in 
    from frames_dataset import PairedDataset
  File "K:\QQData\519329064\FileRecv\yanderifier\yanderify\cuda100\afy\fomm\frames_dataset.py", line 10, in 
    from augmentation import AllAugmentationTransform
  File "K:\QQData\519329064\FileRecv\yanderifier\yanderify\cuda100\afy\fomm\augmentation.py", line 12, in 
    from skimage.util import pad
ImportError: cannot import name 'pad' from 'skimage.util' (L:\ProgramData\Anaconda3\envs\fomm\lib\site-packages\skimage\util\__init__.py)

It's because skimage has removed pad API starting from version 0.18 (https://github.com/scikit-image/scikit-image/issues/4147)

So we should use np.pad instead of skimage.util.pad

The post ImportError: cannot import name ‘pad’ from ‘skimage.util’ appeared first on Redino blog.

Querying the mapped value of map before task compileDebugJavaWithJavac has completed is not supported

$
0
0

I exported Unity project and then imported it into Android Studio, but following error occurred when building

Execution failed for task ':unityLibrary:unity-android-resources:compileDebugJavaWithJavac'.

Failed to calculate the value of task ':unityLibrary:unity-android-resources:compileDebugJavaWithJavac' property 'options.generatedSourceOutputDirectory'.
Querying the mapped value of map(java.io.File property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, /home/gbstack/Unity/Projects/ads-test/android-export/unityLibrary/unity-android-resources/build/generated/ap_generated_sources/debug/out)) org.gradle.api.internal.file.DefaultFilePropertyFactory$ToFileTransformer@481ca56c) before task ':unityLibrary:unity-android-resources:compileDebugJavaWithJavac' has completed is not supported

  • Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':unityLibrary:unity-android-resources:compileDebugJavaWithJavac'.
    at org.gradle.api.internal.tasks.properties.DefaultTaskProperties.resolve(DefaultTaskProperties.java:82)
    at org.gradle.execution.plan.LocalTaskNode.resolveMutations(LocalTaskNode.java:200)
    ...

    Caused by: org.gradle.api.InvalidUserCodeException: Querying the mapped value of map(java.io.File property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, /home/gbstack/Unity/Projects/ads-test/android-export/unityLibrary/unity-android-resources/build/generated/ap_generated_sources/debug/out)) org.gradle.api.internal.file.DefaultFilePropertyFactory$ToFileTransformer@481ca56c) before task ':unityLibrary:unity-android-resources:compileDebugJavaWithJavac' has completed is not supported
    at org.gradle.api.internal.provider.TransformBackedProvider.lambda$beforeRead$0(TransformBackedProvider.java:84)
    at org.gradle.api.internal.provider.ValueSupplier$TaskProducer.visitContentProducerTasks(ValueSupplier.java:136)
    at org.gradle.api.internal.provider.TransformBackedProvider.beforeRead(TransformBackedProvider.java:81)
    at org.gradle.api.internal.provider.TransformBackedProvider.calculateOwnValue(TransformBackedProvider.java:63)
    at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:103)
    ...

Solution

Changing gradle from 7.1 to version to 6.x will fix this problem. I tried both 6.1 and 6.9, and both works

The post Querying the mapped value of map before task compileDebugJavaWithJavac has completed is not supported appeared first on Redino blog.

npm UNMET PEER DEPENDENCY cli@3.3.12 > webpack-cli@3.3.12

$
0
0

Now in my project there are some unmet peer dependencies:

$ npm list|grep webpack

├── @webpack-cli/serve@1.7.0
├─┬ html-webpack-plugin@4.5.0
│ ├─┬ @types/webpack@4.41.25
│ │ ├─┬ @types/webpack-sources@2.1.0
├─┬ UNMET PEER DEPENDENCY webpack@5.10.0
│ ├─┬ terser-webpack-plugin@5.0.3
│ └─┬ webpack-sources@2.2.0
├─┬ UNMET PEER DEPENDENCY webpack-cli@3.3.12
└─┬ webpack-dev-server@3.11.0
  ├── UNMET PEER DEPENDENCY webpack@^4.0.0
  ├─┬ webpack-dev-middleware@3.7.2
  │ └── webpack-log@2.0.0 deduped
  ├─┬ webpack-log@2.0.0

Then I tried to remove unmet webpack-cli dependency

$ npm uninstall webpack-cli

npm WARN @webpack-cli/serve@1.7.0 requires a peer of webpack-cli@4.x.x but none is installed. You must install peer dependencies yourself.
npm WARN webpack-dev-middleware@3.7.2 requires a peer of webpack@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN webapp@1.0.0 No description
npm WARN webapp@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

removed 35 packages and audited 557 packages in 3.721s

Run webpack serve now and but it's saying webpack is not found

$ webpack serve

[webpack-cli] It looks like webpack is not installed.
✔ Would you like to install 'webpack' package? (That will run 'npm install -D webpack') (Y/n) · false

But webpack is installed locally and globally, while webpack-cli is only installed globally.

$ npm list|grep webpack

├── @webpack-cli/serve@1.7.0
├─┬ html-webpack-plugin@4.5.0
│ ├─┬ @types/webpack@4.41.25
│ │ ├─┬ @types/webpack-sources@2.1.0
├─┬ webpack@5.10.0
│ ├─┬ terser-webpack-plugin@5.0.3
│ └─┬ webpack-sources@2.2.0
├── UNMET PEER DEPENDENCY webpack-cli@4.x.x
└─┬ webpack-dev-server@3.11.0
  ├── UNMET PEER DEPENDENCY webpack@^4.0.0
  ├─┬ webpack-dev-middleware@3.7.2
  │ └── webpack-log@2.0.0 deduped
  ├─┬ webpack-log@2.0.0
npm ERR! peer dep missing: webpack-cli@4.x.x, required by @webpack-cli/serve@1.7.0
npm ERR! peer dep missing: webpack@^4.0.0, required by webpack-dev-middleware@3.7.2

$ npm list -g|grep webpack

│ ├── @vue/cli-ui-addon-webpack@4.5.12
├─┬ webpack@5.10.0
│ ├─┬ terser-webpack-plugin@5.1.1
│ └─┬ webpack-sources@2.2.0
├─┬ webpack-cli@4.6.0
│ ├── @webpack-cli/configtest@1.0.2
│ ├─┬ @webpack-cli/info@1.2.3
│ ├── @webpack-cli/serve@1.3.1
│ └─┬ webpack-merge@5.7.3

Install webpack-cli again will fix this problem

npm install --dev webpack-cli

Now npm list output has no peer dependency warnings.

$ npm list|grep webpack

├── @webpack-cli/serve@1.7.0
├─┬ html-webpack-plugin@4.5.0
│ ├─┬ @types/webpack@4.41.25
│ │ ├─┬ @types/webpack-sources@2.1.0
├─┬ webpack@5.10.0
│ ├─┬ terser-webpack-plugin@5.0.3
│ └─┬ webpack-sources@2.2.0
├─┬ webpack-cli@4.10.0
│ ├── @webpack-cli/configtest@1.2.0
│ ├─┬ @webpack-cli/info@1.5.0
│ ├── @webpack-cli/serve@1.7.0 deduped
│ └─┬ webpack-merge@5.8.0
└─┬ webpack-dev-server@3.11.0
  ├── UNMET PEER DEPENDENCY webpack@^4.0.0
  ├─┬ webpack-dev-middleware@3.7.2
  │ └── webpack-log@2.0.0 deduped
  ├─┬ webpack-log@2.0.0

The post npm UNMET PEER DEPENDENCY cli@3.3.12 > webpack-cli@3.3.12 appeared first on Redino blog.


mysql docker connection error: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’

$
0
0

I started docker mysql container and try to connect it outside docker using mysql command but got error:

$ mysql -uroot -proot

mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

It's because mysql clinet will use unix socket protocol as default protocol value to connect to mysql server if not specifying protocol or host argument, but mysql docker container is listening on tcp socket.

Solution

$ mysql -uroot -proot -h127.0.0.1

Specify IP address as host argument value in mysql command will make mysql to connect using TCP protocol instead of default unix socket.
(Note that using localhost as host argument value will still using unix socket protocol)

Or use

$ mysql -uroot -proot --protocol tcp

This command will specify protocol argument explicitly

The post mysql docker connection error: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ appeared first on Redino blog.

git error setting certificate verify location

$
0
0

After installing Windows on another drive and logged in the new Windows, previous Git installation drive path is changed: for my case, it's changing from D:\ to J:\

Then I updated the PATH variable to add Git path, but when running git clone using https url, following error appeared:

fatal: unable to access ..: error setting certificate verify locations:
CAfile: d:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
CApath: none

the CAfile location should be H:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt for current newly installed Windows, while the error information indicates it's still using the old path.

Solution

To fix it, we need modify git system config variable: http.sslcainfo

git config --system --unset http.sslcainfo
git config --system --add http.sslcainfo "J:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt"

Try git clone again, it works now.

The post git error setting certificate verify location appeared first on Redino blog.





Latest Images