Search results for [ %s ] - 79 hit

[Python]对于 Decorator 装饰器的理解

Decorator 装饰器

程式设计中的“函式”是为了解决程式码的重复利用、模组化,同时也增加可读性。而 Python 的“装饰器”可以在不改变原本函式的功能之下,又再进一步强化 (简化) 不同函式之间程式码的共用。

Python 的“函式”是所谓的“一级函式”,支援“高阶函式”的用法,可被当成参数来传递。“装饰器”就是一个“两层”的函式,先接收一个函式进行包装 (处理),包装完再回传新的函式。就是“吃进去又吐出来”的意思!

Read more

[Python]Miniconda 的使用说明

Anaconda、Miniconda

一般用过 Anaconda 的人应该都是直接安装 Anaconda 的“全家桶”来开发 Python 程式。维基百科记载: Anaconda 是一个开源的 Python 和 R 语言的发行版本,用于计算科学 (资料科学、机器学习、大数据处理和预测分析),拥有超过 1400 个套件...。

2023/10 最新的 Anaconda 版本为 v2023.09-0,安装好约 4.6GB

但如果你像我一样,根本用不到那么多套件,只想使用 Anaconda 中的虚拟环境、套件管理、Spyder IDE,那么你应该选择精简版的 Miniconda,再另外安装最新版的 Spyder,或其它 Python 的 IDE 来使用。
Read more

[Python]Spyder IDE 5.5 繁体中文语言套件,以及一些 Spyder 的操作说明

Spyder 中文套件

Spyder 是一个功能强大的 Python 程式语言整合开发环境 (IDE),程式内建的多国语言有支援“简体中文”,但没有“繁体中文”。

本来我只是打算把“简体中文”转成“繁体中文”就拿来使用,但却发现他的中文翻译有很多不通顺跟错误的地方!

于是我鼓起勇气,硬著头皮,一行一行对照着英文把它给翻译完毕! Spyder 整合了很多套件,文字量比我想像的庞大,也有很多专业用语,费了一翻功夫才翻译到我觉得还算满意的成果,才敢丢出来给大家使用。

虽然说我不认为这种 IDE 需要特别翻译成中文,但对于一些刚入门 Python 的新手,希望仍有帮助。
Read more

[Python]如何安装 pip 套件管理程式,以及 pip 常用指令

pipPython 的套件管理程式,如果你从官网下载并安装 Python,里面就有 pip 可直接使用。但如果你是独立安装的 Spyder IDE,那么 Spyder IDE v5.4.* 所附带的 Python 并没有包含 pip! 在 Spyder 的 IPython 主控台执行 pip 会出现错误:

In []: pip list
Note: you may need to restart the kernel to use updated packages.
 C:\Program Files\Spyder\Python\python.exe: No module named pip

PS. Spyder IDE v6.0.0 已经有包含 pip。
Read more

Visual Studio Code 的安装说明,以及推荐的延伸模组 (Windows/Linux)

微软开发的 Visual Studio Code (简称 VS Code) 是一套非常热门的“编辑器”! VS Code 跨平台,且开放原始码。它虽然仅是一个轻量版的编辑器,却可经由安装延伸模组来支援程式码语法突显、侦错、自动补全、重构、Markdown...等琳瑯满目功能,打造你梦想中的 IDE (整合开发环境)。

VS Code 默认仅支援 JavaScript、TypeScript、CSS、HTML,同样能透过下载延伸模组来支援 Python、C/C++、Java、Perl、Go... 等其他程式语言。

Read more

[Perl]如何在 Visual Studio Code 建立 Perl 的程式开发环境 (Windows/Linux)

据说 Perl 可能是近几年会消失的 5 种程式语言之一,另外 4 个语言分别是 RubyHaskellObject-CR! 现在在 Visual Studio Code (简称 VS Code) 建立 Perl 的程式开发环境也算是帮 Perl 续一下命,大慈大悲、功德无量。

要建立好整个 Perl 的开发环境主要分为三个步骤:

  1. 安装 Perl 的执行环境
  2. 安装 VS Code Editor
  3. 在 VS Code 安装 Perl 的延伸模组 (Extension)

Read more

如何制作简繁转换的中文字型

我在四年前制作了给电子书用的伪直排字型,后来也有加入了“简体中文转繁体中文”的功能。以下说明如何使用 FontForge 来制作简入繁出的字库。

指令档

下载 Simp2Trad-v1.zip,这是本文的重点。

Simp2Trad-v1.zip 解压缩后会有三个档案:

  1. simp2trad.txt: 简繁转换的指令码
  2. simp2trad-Reference.txt: 简繁转换的指令码
  3. result.html: 全部转换的文字

(我有加入几个引号的转换)

Read more

如何找回 Skype 的分割检视模式,如何让 skype 停止自动更新

大家都知道 Microsoft Windows 是一个图形接口、支援多视窗、多工环境的作业系统,那么在 Windows 上使用聊天软件,开启多个视窗跟不同人聊天也是合理的,没错吧?!

工作上我会用到 Skype 与同事对话,虽然 Skype for Desktop 默认是单一视窗接口,一次只能看到与一个对象的聊天内容,但 Skype (v8.96 及之前的版本),只要于选项中“启用分割检视模式 (Split View)”,就能让你每次点选不同的聊天对象就开启一个新视窗,方便同时跟不同人聊天、对话:


因为可以开启多个视窗,我时常会用来:

  • 开多个对话视窗来比对或复制资料
  • 保留未结束的对话视窗
  • 保留重要的对话视窗

对我而言,Skype 能同时开启多个视窗是很重要且必要的功能。
Read more

如何解决 SSH Server 使用了不安全的加密算法: ARCFOUR、CBC、HMAC-MD5、HMAC-RIPEMD160

弱点扫瞄

弱点 1: SSH Supports Weak Cipher

The SSH server is configured to support either Arcfour or Cipher Block Chaining (CBC) mode cipher algorithms. SSH can be configured to use Counter (CTR) mode encryption instead of CBC. The use of Arcfour algorithms should be disabled.

  • Severity: Medium
  • Risk: A weak cipher has been detected.
  • Recommendation: Configure the SSH server to disable Arcfour and CBC ciphers.

弱点 2: SSH Supports Weak MAC

The SSH server is configured to support MD5 algorithm. The cryptographic strength depends upon the size of the key and algorithm that is used. A Modern MAC algorithms such as SHA1 or SHA2 should be used instead.

  • Severity: Medium
  • Risk: A weak Message Authentication Code (MAC) algorithm has been detected.
  • Recommendation: Configure the SSH server to disable the use of MD5.

Read more

如何自动将网站的 http:// 网址转址为 https://

弱点扫瞄

弱点: Site does not enforce HTTPS

The site responds to HTTP requests without ultimately redirecting the browser to a secure version of the page. Since the site allows plaintext traffic, a man-in-the-middle attacker is able to read and modify any information passed between the site and the user. There are a variety of situations in which an attacker can intercept plaintext traffic in a man-in-the-middle position, including but not limited to:

  1. Open Wi-Fi Hotspots
  2. WPA/WPA2 encrypted hot-spots where the attacker connected before the victim
  3. Malicious Wi-Fi access points
  4. Compromised switches and routers
  5. ARP poisoning on the same wired network

It's important to remember that in many of the above situations, an attacker can not only read traffic, but also actively modify the traffic. Even if a site that does not contain sensitive information, an attacker can still inject malicious content to a user’s browser.

  • Severity: High
  • Risk: Site does not enforce the use of HTTPS encryption, leaving the user vulnerable to man-in-the-middle attackers (who can falsify data and inject malicious code).
  • Recommendation: Any site served to a user (possibly at the end of a redirect chain) should be served over HTTPS.

Read more

return top