突突唧之家

我的疑问 & 我的解决方案

If you use Adobe software on Windows, you may run into an issue where you get a logtransport2 error on shutdown of Windows. The issue is probably that the LogTransport2.exe can't connect to its servers to send log data. Adobe offers you a way to opt-out of a few privacy settings through your online account, and once those changes sync back into your Adobe software suite, the Logtransport2 error on shutdown should be fixed.

In an Adobe app or the Creative Cloud app you can click on your profile icon then click on Adobe Account. As of this article, you can also go directly to your Adobe Account Privacy Settings. To fix the LogTransport2.exe error, you'll need to uncheck the box under Desktop And App Usage that says

Yes, I'd like to share information on how I use Adobe desktop apps.

As a privacy best practice, it is also recommended that you uncheck the box under Machine Learning that says

Yes, allow my content to be analyzed by Adobe using machine learning techniques.

Once you make these changes, you shouldn't get the LogTransport2 error when shutting down or rebooting Windows.

When using os.rename() to try to move files between drives, you will receive this error:

OSError: [WinError 17] The system cannot move the file to a different disk drive

This is because os.rename() changes the path of the file but doesn't move its actual data on the disk. this is why you can't move (rename) it from one drive to another.

Moving between drives is actually copy it first, and then delete the source file. you can use shutil.move() method, which do it when you trying to transfer files between two drives.

import shutil

shutil.move(src, dest)

问题描述

在 Ubuntu 执行 sudo apt-get 时,出现了 dpkg: error processing package *** (--configure) 的错误。

解决方案

通过执行下面的命令可能可以解决该问题:

1
2
3
4
5
6
7
8
9
10
11
12
13
sudo mv /var/lib/dpkg/info/ /var/lib/dpkg/info_old/

sudo mkdir /var/lib/dpkg/info/

sudo apt-get update

sudo apt-get -f install

sudo mv /var/lib/dpkg/info/* /var/lib/dpkg/info_old/

sudo rm -rf /var/lib/dpkg/info

sudo mv /var/lib/dpkg/info_old/ /var/lib/dpkg/info/

Use the following command to recursively rename files matching a specific pattern (file* here).

find . -type f -name 'file*' -execdir mv {} {}_renamed ';'

卸载通过 runfile 安装的程序和驱动

Use the following command to uninstall a Toolkit runfile installation:

sudo /usr/local/cuda-X.Y/bin/cuda-uninstaller

Use the following command to uninstall a Driver runfile installation:

sudo /usr/bin/nvidia-uninstall

卸载通过包管理器安装的程序和驱动

sudo apt-get remove --purge '^nvidia-.*'
sudo apt-get remove --purge '^libnvidia-.*'
sudo apt-get remove --purge '^cuda-.*'

Standard font size for article, report, book, and letter.

Command 10pt 11pt 12pt
\tiny 5pt 6pt 6pt
\scriptsize 7pt 8pt 8pt
\footnotesize 8pt 9pt 10pt
\small 9pt 10pt 11pt
\normalsize 10pt 11pt 12pt
\large 12pt 12pt 14pt
\Large 14pt 14pt 17pt
\LARGE 17pt 17pt 20pt
\huge 20pt 20pt 25pt
\Huge 25pt 25pt 25pt

Standard font size for beamer. The default font size for beamer is 11pt.

Command 8pt 9pt 10pt 11pt 12pt 14pt 17pt 20pt
\tiny 5pt 5pt 5pt 6pt 6pt 6pt 8pt 10pt
\scriptsize 5pt 6pt 7pt 8pt 8pt 8pt 10pt 12pt
\footnotesize 6pt 7pt 8pt 9pt 10pt 10pt 12pt 14pt
\small 7pt 8pt 9pt 10pt 11pt 12pt 14pt 17pt
\normalsize 8pt 9pt 10pt 11pt 12pt 14pt 17pt 20pt
\large 10pt 10pt 12pt 12pt 14pt 17pt 20pt 25pt
\Large 11pt 11pt 14pt 14pt 17pt 20pt 25pt 29.86pt
\LARGE 12pt 12pt 17pt 17pt 20pt 25pt 29.86pt 35.83pt
\huge 14pt 14pt 20pt 20pt 25pt 29.86pt 35.83pt 42.99pt
\Huge 17pt 17pt 25pt 25pt 25pt 35.83pt 42.99pt 51.59pt

Windows Terminal 某次更新以后,透明效果消失。在系统“颜色”设置中已经将“透明效果”设置为“开”。

观察以后,可以认为透明效果不生效。“设置”界面、开始菜单、计算器程序,都是纯色,没有毛玻璃效果。

解决方案

运行注册表编辑器 regedit,定位到:

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize

有一个值名称为 EnableTransparency,如果已经启用透明,数据应该是 1

接下来改成 0。然后关机,再开机。接着将数据值改为 1。这时候应该就能看到透明效果回来了。

You can take advantage of the complex type:

# build a complex array of your points
z = np.array([complex(p.x, p.y) for p in points])

First Solution

# mesh this array so that you will have all combinations
m, n = np.meshgrid(z, z)
# get the distance via the norm
distance_matrix = abs(m - n)

Second Solution

Meshing is the main idea. But numpy is clever, so you don't have to generate m & n. Just compute the difference using a transposed version of z. The mesh is done automatically:

distance_matrix = abs(z[..., np.newaxis] - z)

And if z is directly set as a 2-dimensional array, you can use z.T instead of the weird z[..., np.newaxis]. So finally, your code will look like this:

z = np.array([[complex(p.x, p.y) for p in points]])  # notice the [[ ... ]]
distance_matrix = abs(z.T - z)

Matroska (MKV)

This will stream copy (re-mux) all streams:

ffmpeg -i input.ts -map 0 -c copy output.mkv

The -map 0 option is used to include all streams. Otherwise it will use the default stream selection behavior which would only result in one stream per stream type being selected. Since Matroska can handle most arbitrary streams I included -map 0.

MP4

This will stream copy (re-mux) all streams:

ffmpeg -i input.ts -map 0 -c copy output.mp4

If your inputs formats are not compatible with MP4 you will get an error. Your player/device may not support all arbitrary, less common, or legacy formats even if they are supported by MP4. If in doubt re-encode to H.264 + AAC as shown below.

This will re-encode the video to H.264 and stream copy the audio:

ffmpeg -i input.ts -c:v libx264 -c:a copy output.mp4

The next example will re-encode both video and audio:

ffmpeg -i input.ts -c:v libx264 -c:a aac output.mp4

Lossless H.264 example:

ffmpeg -i input.ts -c:v libx264 -crf 0 -c:a copy output.mp4

Lossless files will be huge.

For example I have two dicts:

dict_a = {'a': 1, 'b': 2, 'c': 3}
dict_b = {'b': 3, 'c': 4, 'd': 5}

I need a pythonic way of 'combining' two dicts such that the result is:

{'a': 1, 'b': 5, 'c': 7, 'd': 5}

That is to say: if a key appears in both dicts, add their values, if it appears in only one dict, keep its value.

Use collections.Counter:

from collections import Counter
a = Counter({'a':1, 'b':2, 'c':3})
b = Counter({'b':3, 'c':4, 'd':5})
c = a + b # c = Counter({'c': 7, 'b': 5, 'd': 5, 'a': 1})

Counters are basically a subclass of dict, so you can still do everything else with them you'd normally do with that type, such as iterate over their keys and values.