diff options
-rw-r--r-- | coq.html.markdown | 8 | ||||
-rw-r--r-- | de-de/nix-de.html.markdown | 3 | ||||
-rw-r--r-- | docker.html.markdown | 13 | ||||
-rw-r--r-- | es-es/typescript-es.html.markdown | 2 | ||||
-rw-r--r-- | fr-fr/typescript-fr.html.markdown | 2 | ||||
-rw-r--r-- | pt-br/typescript-pt.html.markdown | 2 | ||||
-rw-r--r-- | python.html.markdown | 4 | ||||
-rw-r--r-- | set-theory.html.markdown | 2 | ||||
-rw-r--r-- | sv-se/nix-sv.html.markdown | 5 | ||||
-rw-r--r-- | zh-cn/c-cn.html.markdown | 2 | ||||
-rw-r--r-- | zh-cn/java-cn.html.markdown | 4 | ||||
-rw-r--r-- | zh-cn/qt-cn.html.markdown | 160 |
12 files changed, 187 insertions, 20 deletions
diff --git a/coq.html.markdown b/coq.html.markdown index 4c1ad690..3a924a19 100644 --- a/coq.html.markdown +++ b/coq.html.markdown @@ -61,8 +61,8 @@ Locate "+". (* Calling a function with insufficient number of arguments does not cause an error, it produces a new function. *) -Definition make_inc x y := x + y. (* make_inc is int -> int -> int *) -Definition inc_2 := make_inc 2. (* inc_2 is int -> int *) +Definition make_inc x y := x + y. (* make_inc is nat -> nat -> nat *) +Definition inc_2 := make_inc 2. (* inc_2 is nat -> nat *) Compute inc_2 3. (* Evaluates to 5 *) @@ -370,7 +370,7 @@ Close Scope string_scope. power series and results,...) • Relations : Relations (definitions and basic results) • Sorting : Sorted list (basic definitions and heapsort correctness) -• Strings : 8-bits characters and strings +• Strings : 8-bit characters and strings • Wellfounded : Well-founded relations (basic results) *) @@ -472,7 +472,7 @@ Proof. intros A B ab. destruct ab as [ a b ]. apply a. Qed. -(* We can prove easily prove simple polynomial equalities using the +(* We can easily prove simple polynomial equalities using the automated tactic ring. *) Require Import Ring. diff --git a/de-de/nix-de.html.markdown b/de-de/nix-de.html.markdown index ea02e81d..ffe8dffc 100644 --- a/de-de/nix-de.html.markdown +++ b/de-de/nix-de.html.markdown @@ -356,3 +356,6 @@ with builtins; [ * [Susan Potter - Nix Cookbook - Nix By Example] (https://ops.functionalalgebra.com/nix-by-example/) + +* [Rommel Martinez - A Gentle Introduction to the Nix Family] + (https://web.archive.org/web/20210121042658/https://ebzzry.io/en/nix/#nix) diff --git a/docker.html.markdown b/docker.html.markdown index 24f85247..1dad267a 100644 --- a/docker.html.markdown +++ b/docker.html.markdown @@ -3,9 +3,10 @@ language: docker filename: docker.bat
contributors:
- ["Ruslan López", "http://javapro.org/"]
+ - ["Michael Chen", "https://github.com/ML-Chen"]
---
-```
+```bat
:: download, install and run hello-world image
docker run hello-world
@@ -37,12 +38,12 @@ docker run hello-world :: For more examples and ideas, visit:
:: https://docs.docker.com/get-started/
-:: now lets see currently running images
+:: now let's see currently running images
docker ps
:: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
:: NAMES
-:: lets see the images we have ran previously
+:: let's see the images we have ran previously
docker ps -a
:: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
@@ -54,7 +55,7 @@ docker ps -a :: let's remove our previously generated image
docker rm happy_poincare
-:: lets test if it was really deleted
+:: let's test if it was really deleted
docker ps -a
:: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
:: NAMES
@@ -89,7 +90,7 @@ docker ps -a :: test_container
:: as you can see the name is now what we have specified
-:: retireve logs from a named container
+:: retrieve logs from a named container
docker logs test_container
:: Hello from Docker!
:: This message shows that your installation appears to be working correctly.
@@ -143,4 +144,4 @@ docker ps -a :: nifty_goldwasser
docker rm nifty_goldwasser
-```
\ No newline at end of file +```
diff --git a/es-es/typescript-es.html.markdown b/es-es/typescript-es.html.markdown index c42da4a4..fbe1290b 100644 --- a/es-es/typescript-es.html.markdown +++ b/es-es/typescript-es.html.markdown @@ -12,7 +12,7 @@ TypeScript es un lenguaje cuyo objetivo es facilitar el desarrollo de aplicacion TypeScript añade conceptos comunes como clases, módulos, interfaces, genéricos y (opcionalmente) tipeo estático a JavaScript. Es un superset de JavaScript: todo el código JavaScript es código válido en TypeScript de manera que se puede integrar fácilmente a cualquier proyecto . El compilador TypeScript emite JavaScript. -Este artículo se enfocará solo en la sintáxis extra de TypeScript, y no en [JavaScript] (../javascript/). +Este artículo se enfocará solo en la sintáxis extra de TypeScript, y no en [JavaScript] (../javascript-es/). Para probar el compilador de TypeScript, diríjase al [Área de Pruebas] (http://www.typescriptlang.org/Playground) donde podrá tipear código, y ver como se auto-completa al tiempo que ve el código emitido JavaScript. diff --git a/fr-fr/typescript-fr.html.markdown b/fr-fr/typescript-fr.html.markdown index 52d34650..8a761f61 100644 --- a/fr-fr/typescript-fr.html.markdown +++ b/fr-fr/typescript-fr.html.markdown @@ -12,7 +12,7 @@ TypeScript est un langage visant à faciliter le développement d'applications l TypeScript ajoute des concepts classiques comme les classes, les modules, les interfaces, les génériques et le typage statique (optionnel) à JavaScript. C'est une surcouche de JavaScript : tout le code JavaScript est valide en TypeScript ce qui permet de l'ajouter de façon transparente à n'importe quel projet. Le code TypeScript est transcompilé en JavaScript par le compilateur. -Cet article se concentrera seulement sur la syntaxe supplémentaire de TypeScript, plutôt que celle de [JavaScript] (../javascript/). +Cet article se concentrera seulement sur la syntaxe supplémentaire de TypeScript, plutôt que celle de [JavaScript] (../javascript-fr/). Pour tester le compilateur de TypeScript, rendez-vous au [Playground] (http://www.typescriptlang.org/Playground) où vous pourrez coder, profiter d'une autocomplétion et accéder directement au rendu JavaScript. diff --git a/pt-br/typescript-pt.html.markdown b/pt-br/typescript-pt.html.markdown index ed76959c..7d28bf53 100644 --- a/pt-br/typescript-pt.html.markdown +++ b/pt-br/typescript-pt.html.markdown @@ -12,7 +12,7 @@ Typescript é uma linguagem que visa facilitar o desenvolvimento de aplicações Typescript acrescenta conceitos comuns como classes, módulos, interfaces, genéricos e (opcional) tipagem estática para JavaScript. É um super conjunto de JavaScript: todo o código JavaScript é TypeScript válido então ele pode ser adicionado diretamente a qualquer projeto. O compilador emite TypeScript JavaScript. -Este artigo irá se concentrar apenas na sintaxe extra do TypeScript, ao contrário de [JavaScript](javascript-pt.html.markdown). +Este artigo irá se concentrar apenas na sintaxe extra do TypeScript, ao contrário de [JavaScript](../javascript-pt/). Para testar o compilador TypeScript, vá para o [Playground](http://www.typescriptlang.org/Playground), onde você vai ser capaz de escrever código, ter auto conclusão e ver diretamente o JavaScript emitido. diff --git a/python.html.markdown b/python.html.markdown index e21d7dde..39e60455 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -482,7 +482,7 @@ except (TypeError, NameError): pass # Multiple exceptions can be handled together, if required. else: # Optional clause to the try/except block. Must follow all except blocks print("All good!") # Runs only if the code in try raises no exceptions -finally: # Execute under all circumstances +finally: # Execute under all circumstances print("We can clean up resources here") # Instead of try/finally to cleanup resources you can use a with statement @@ -735,7 +735,7 @@ class Human: return "*grunt*" # A property is just like a getter. - # It turns the method age() into an read-only attribute of the same name. + # It turns the method age() into a read-only attribute of the same name. # There's no need to write trivial getters and setters in Python, though. @property def age(self): diff --git a/set-theory.html.markdown b/set-theory.html.markdown index 6be7aa00..ae8b5388 100644 --- a/set-theory.html.markdown +++ b/set-theory.html.markdown @@ -41,7 +41,7 @@ The cardinality, or size, of a set is determined by the number of items in the s For example, if `S = { 1, 2, 4 }`, then `|S| = 3`. ### The Empty Set -* The empty set can be constructed in set builder notation using impossible conditions, e.g. `∅ = { x : x =/= x }`, or `∅ = { x : x ∈ N, x < 0 }`; +* The empty set can be constructed in set builder notation using impossible conditions, e.g. `∅ = { x : x ≠ x }`, or `∅ = { x : x ∈ N, x < 0 }`; * the empty set is always unique (i.e. there is one and only one empty set); * the empty set is a subset of all sets; * the cardinality of the empty set is 0, i.e. `|∅| = 0`. diff --git a/sv-se/nix-sv.html.markdown b/sv-se/nix-sv.html.markdown index 15d9456b..647575fe 100644 --- a/sv-se/nix-sv.html.markdown +++ b/sv-se/nix-sv.html.markdown @@ -365,4 +365,7 @@ with builtins; [ (https://medium.com/@MrJamesFisher/nix-by-example-a0063a1a4c55) * [Susan Potter - Nix Cookbook - Nix By Example] - (http://funops.co/nix-cookbook/nix-by-example/) + (https://ops.functionalalgebra.com/nix-by-example/) + +* [Rommel Martinez - A Gentle Introduction to the Nix Family] + (https://web.archive.org/web/20210121042658/https://ebzzry.io/en/nix/#nix) diff --git a/zh-cn/c-cn.html.markdown b/zh-cn/c-cn.html.markdown index 7286fa9f..dbad5030 100644 --- a/zh-cn/c-cn.html.markdown +++ b/zh-cn/c-cn.html.markdown @@ -616,7 +616,7 @@ typedef void (*my_fnp_type)(char *); 如果你有问题,请阅读[compl.lang.c Frequently Asked Questions](http://c-faq.com/)。 -使用合适的空格、缩进,保持一致的代码风格非常重要。可读性强的代码比聪明的代码、高速的代码更重要。可以参考下[Linux内核编码风格](https://www.kernel.org/doc/Documentation/CodingStyle) +使用合适的空格、缩进,保持一致的代码风格非常重要。可读性强的代码比聪明的代码、高速的代码更重要。可以参考下[Linux内核编码风格](https://www.kernel.org/doc/Documentation/process/coding-style.rst) 。 除了这些,多多Google吧 diff --git a/zh-cn/java-cn.html.markdown b/zh-cn/java-cn.html.markdown index 27003f3e..1de7f3e6 100644 --- a/zh-cn/java-cn.html.markdown +++ b/zh-cn/java-cn.html.markdown @@ -297,8 +297,8 @@ class Bicycle { // Bicycle 类的成员变量和方法 public int cadence; // Public: 任意位置均可访问 private int speed; // Private: 只在同类中可以访问 - protected int gear; // Protected: 可以在同类与子类中可以访问 - String name; // default: 可以在包内中可以访问 + protected int gear; // Protected: 可以在同类与子类中访问 + String name; // default: 可以在包内访问 // 构造函数是初始化一个对象的方式 // 以下是一个默认构造函数 diff --git a/zh-cn/qt-cn.html.markdown b/zh-cn/qt-cn.html.markdown new file mode 100644 index 00000000..8681c85b --- /dev/null +++ b/zh-cn/qt-cn.html.markdown @@ -0,0 +1,160 @@ +--- +category: tool +tool: Qt Framework +language: c++ +filename: learnqt-cn.cpp +contributors: + - ["Aleksey Kholovchuk", "https://github.com/vortexxx192"] +translators: + - ["GengchenXU", "https://github.com/GengchenXU"] +lang: zh-cn + +--- + +**Qt** Qt是一个广为人知的框架,用于开发跨平台软件,该软件可以在各种软件和硬件平台上运行,代码几乎没有变化,同时具有本机应用程序的能力和速度。虽然**Qt**最初是用*C*++,但也有其他语言的端口: *[PyQt](https://learnxinyminutes.com/docs/pyqt/)*, *QtRuby*, *PHP-Qt*, 等等. + +**Qt** 非常适合使用图形用户界面 (GUI) 创建应用程序。本教程是关于如何用*C++*去实现。 + +```c++ +/* + * 让我们从最经典的开始 + */ + +// Qt框架的所有标头均以大写字母'Q'开头 +#include <QApplication> +#include <QLineEdit> + +int main(int argc, char *argv[]) { + // 创建一个对象来管理应用程序范围内的资源 + QApplication app(argc, argv); + + // 创建行编辑widgets并在屏幕上显示 + QLineEdit lineEdit("Hello world!"); + lineEdit.show(); + + // 启动应用程序的事件循环 + return app.exec(); +} +``` + +**Qt**与 GUI 相关的部分与*widgets*及其之间的*connection*有关。 + +[阅读更多有关widgets的信息](http://doc.qt.io/qt-5/qtwidgets-index.html) + +```c++ +/* + * 让我们创建一个标签和一个按钮。 + * 按下按钮时应显示一个标签。 + * Qt代码本身就可以说明问题。 + */ + +#include <QApplication> +#include <QDialog> +#include <QVBoxLayout> +#include <QPushButton> +#include <QLabel> + +int main(int argc, char *argv[]) { + QApplication app(argc, argv); + + QDialog dialogWindow; + dialogWindow.show(); + + // 添加垂直布局 + QVBoxLayout layout; + dialogWindow.setLayout(&layout); + + QLabel textLabel("Thanks for pressing that button"); + layout.addWidget(&textLabel); + textLabel.hide(); + + QPushButton button("Press me"); + layout.addWidget(&button); + + // 按下按钮时显示隐藏标签 + QObject::connect(&button, &QPushButton::pressed, + &textLabel, &QLabel::show); + + return app.exec(); +} +``` + +注意,*QObject :: connect*部分。 此方法用于将一个对象的*SIGNAL*连接到另一个对象的*SLOTS*。 + +**Signals** 会被发出当对象发生某些事情时,例如当用户按下QPushButton对象时会发出*push*的信号。 + +**Slots** 是可以响应于接收到的信号而执行的*action*。 + +[阅读有关SLOTS和SIGNALS的更多信息](http://doc.qt.io/qt-5/signalsandslots.html) + + +接下来,让我们了解到我们不仅可以使用标准的wigets,而且可以通过继承扩展其行为。 让我们创建一个按钮并计算其被按下的次数。 为此,我们定义了自己的类* CounterLabel *。 由于特定的Qt体系结构,必须在单独的文件中声明它。 + +```c++ +// counterlabel.hpp + +#ifndef COUNTERLABEL +#define COUNTERLABEL + +#include <QLabel> + +class CounterLabel : public QLabel { + Q_OBJECT // 在每个自定义wiget中必须存在的Qt定义的宏 + +public: + CounterLabel() : counter(0) { + setText("Counter has not been increased yet"); // QLabel方法 + } + +public slots: + // 将响应按钮按下而调用的操作 + void increaseCounter() { + setText(QString("Counter value: %1").arg(QString::number(++counter))); + } + +private: + int counter; +}; + +#endif // COUNTERLABEL +``` + +```c++ +// main.cpp +// 与前面的示例几乎相同 + +#include <QApplication> +#include <QDialog> +#include <QVBoxLayout> +#include <QPushButton> +#include <QString> +#include "counterlabel.hpp" + +int main(int argc, char *argv[]) { + QApplication app(argc, argv); + + QDialog dialogWindow; + dialogWindow.show(); + + QVBoxLayout layout; + dialogWindow.setLayout(&layout); + + CounterLabel counterLabel; + layout.addWidget(&counterLabel); + + QPushButton button("Push me once more"); + layout.addWidget(&button); + QObject::connect(&button, &QPushButton::pressed, + &counterLabel, &CounterLabel::increaseCounter); + + return app.exec(); +} +``` + +当然,Qt框架比本教程介绍的部分要复杂得多,因此请仔细阅读和练习。 + +## 进一步阅读 +- [Qt 4.8 tutorials](http://doc.qt.io/qt-4.8/tutorials.html) +- [Qt 5 tutorials](http://doc.qt.io/qt-5/qtexamplesandtutorials.html) + +祝你好运,生活愉快! |