2023-10-31
This commit is contained in:
parent
6a3de67267
commit
4ed84bcb4f
9 changed files with 29 additions and 30 deletions
|
@ -16,8 +16,8 @@ and digits with the *Comic Sans* font — we will draw a simple captcha for a we
|
|||
|
||||
{% include picture.html id="captcha.png" src="/img/captcha.png" alt="Drawing simple captcha" %}
|
||||
|
||||
We'll consider special characters, but we won't use them, because it will be difficult for the
|
||||
user to guess them with such a text decoration. For example, the plus `+` is still possible
|
||||
We'll also consider special characters, but we won't use them, because it will be difficult for
|
||||
the user to guess them with such a text decoration. For example, the plus `+` is still possible
|
||||
to guess, but the minus `-` or the underscore `_` is already with difficulty, and even if you
|
||||
guess right, then to find these buttons with difficulty, especially on the phone. Therefore,
|
||||
for captcha we'll use a combination of only capital latin letters and digits.
|
||||
|
|
|
@ -15,9 +15,9 @@ in the form of text. We will use Java tools. For calculations, we will use the `
|
|||
to bypass the range of coordinates, we will use two nested `for` loops. We draw in the console a
|
||||
graph of a circle and graphs of a rhombus and a square inscribed in it.
|
||||
|
||||
Graph of a function with filling: [Drawing heart in console]({{ '/en/2023/03/08/drawing-heart-in-console.html' | relative_url }}).
|
||||
Graph of a function with filling: [Drawing heart in console]({{ '/en/2023/03/08/drawing-heart-in-console.html#heart-shaped-graph' | relative_url }}).
|
||||
|
||||
{% include heading.html text="Equations of functions" hash="equations-of-functions" type="3" %}
|
||||
{% include heading.html text="Equations of functions" hash="equations-of-functions" %}
|
||||
|
||||
We will check each point `(x,y)` from the output range of coordinates for belonging to function
|
||||
graphs and output in accordance with this. We define the parameters of the functions and the
|
||||
|
@ -49,7 +49,7 @@ alt="\sqrt{(x-a)^2+(y-b)^2}=r." %}
|
|||
|
||||
`c` — half a side of a square.
|
||||
|
||||
{% include heading.html text="Mathematical operations" hash="mathematical-operations" type="3" %}
|
||||
{% include heading.html text="Mathematical operations" hash="mathematical-operations" %}
|
||||
|
||||
To perform *basic* mathematical operations, Java uses the `FdLibm` library — *Freely Distributable
|
||||
Math Library*. Most of the methods are implemented at the platform level to increase performance.
|
||||
|
@ -67,7 +67,7 @@ For floating point calculations and rounding of results, we will use the methods
|
|||
|
||||
`floor(a)` — rounding down the argument `a`.
|
||||
|
||||
{% include heading.html text="Algorithm description" hash="algorithm-description" type="3" %}
|
||||
{% include heading.html text="Algorithm description" hash="algorithm-description" %}
|
||||
|
||||
We take a range of coordinates on the plane in such a way that the displayed figure completely fits
|
||||
in the printing area. We bypass the selected range with two nested `for` loops: first along the `y`
|
||||
|
|
|
@ -19,10 +19,9 @@ picture, and output the picture as text — console congratulations on the eight
|
|||
|
||||
Let's draw two half-circles and one half-rhombus, filled inside and outside. In the previous example,
|
||||
we output a [function graph to console]({{ '/en/2023/02/06/function-graph-in-console.html' | relative_url }})
|
||||
— we take the formulas for the circle and for the rhombus from it, and in this example, to fill the
|
||||
figure inside, in the formula instead of the *equals* sign we substitute the *less* sign, and to
|
||||
fill the outside, on the contrary, — the *greater* sign. There will be many conditions, unlike the
|
||||
previous example.
|
||||
— we take the formulas for the circle and for the rhombus from it, and in this example, we add the
|
||||
filling of the figure inside and outside — instead of the *equal* sign in the formulas, we substitute
|
||||
*less than* or *greater than* signs. There will be many conditions, unlike the previous example.
|
||||
|
||||
Let's draw a picture for clarity.
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@ date: 2023.08.04
|
|||
lang: en
|
||||
---
|
||||
|
||||
We write a Bash script for building a directory tree for a repository in the Markdown
|
||||
file. We use only Bash tools and basic Linux software — `ls`, `sed`, `tr` and `echo` —
|
||||
without additional programs. The obtained file
|
||||
We write a Bash script for building a directory tree for a repository in
|
||||
the Markdown file. We use only Bash tools and basic Linux software — `ls`,
|
||||
`sed`, `tr` and `echo` — without additional programs. The obtained file
|
||||
[`DIRECTORY_TREE.md`]({{ site.homepage_url }} "{{ site.homepage_name }}")
|
||||
will be used in the web interface to navigate through the objects of the repository.
|
||||
|
||||
|
|
|
@ -12,10 +12,10 @@ lang: en
|
|||
{%- assign articles = "" | split: "" %}
|
||||
{%- assign articles = articles | push: "Directory tree with links" %}
|
||||
{%- capture article_brief %}
|
||||
We write a Bash script for building a directory tree for a repository in the Markdown
|
||||
file. We use only Bash tools and basic Linux software — `ls`, `sed`, `tr` and `echo` —
|
||||
without additional programs. The obtained file `DIRECTORY_TREE.md` will be used in the
|
||||
web interface to navigate through the objects of the repository.
|
||||
We write a Bash script for building a directory tree for a repository in the Markdown file.
|
||||
We use only Bash tools and basic Linux software — `ls`, `sed`, `tr` and `echo` — without
|
||||
additional programs. The obtained file `DIRECTORY_TREE.md` will be used in the web interface
|
||||
to navigate through the objects of the repository.
|
||||
|
||||
We create a recursive function and use it to bypass all files and directories of the repository,
|
||||
excluding the list from `.gitignore`. We output tree elements as links `<a>`, collapse folders
|
||||
|
@ -57,8 +57,8 @@ Let's write an algorithm for displaying text as an image using the Java AWT libr
|
|||
and font can be any, but for this example we will use a combination of uppercase latin letters
|
||||
and digits with the *Comic Sans* font — we will draw a simple captcha for a website or blog.
|
||||
|
||||
We'll consider special characters, but we won't use them, because it will be difficult for the
|
||||
user to guess them with such a text decoration. For example, the plus `+` is still possible
|
||||
We'll also consider special characters, but we won't use them, because it will be difficult for
|
||||
the user to guess them with such a text decoration. For example, the plus `+` is still possible
|
||||
to guess, but the minus `-` or the underscore `_` is already with difficulty, and even if you
|
||||
guess right, then to find these buttons with difficulty, especially on the phone. Therefore,
|
||||
for captcha we'll use a combination of only capital latin letters and digits.
|
||||
|
|
|
@ -15,8 +15,8 @@ date: 2023.01.03
|
|||
|
||||
{% include picture.html id="captcha.png" src="/img/captcha.png" alt="Рисуем простую капчу" %}
|
||||
|
||||
Спецсимволы рассмотрим, но пользоваться ими не будем, потому что угадать их с таким оформлением
|
||||
текста пользователю будет сложно. Например, плюс `+` угадать ещё можно, а вот минус `-` или
|
||||
Спецсимволы тоже рассмотрим, но пользоваться ими не будем, потому что угадать их с таким оформлением
|
||||
текста будет сложно для пользователя. Например, плюс `+` угадать ещё можно, а вот минус `-` или
|
||||
нижнее подчёркивание `_` уже с трудом, и даже если угадаешь, тогда найти эти кнопки с трудом,
|
||||
особенно на телефоне. Поэтому для капчи будем использовать комбинацию только из заглавных
|
||||
латинских букв и цифр.
|
||||
|
|
|
@ -14,9 +14,9 @@ date: 2023.02.05
|
|||
координат — два вложенных цикла `for`. Нарисуем в консоли график окружности и графики вписанных
|
||||
в неё ромба и квадрата.
|
||||
|
||||
График функции с заполнением: [Рисуем сердечко в консоли]({{ '/ru/2023/03/08/drawing-heart-in-console.html' | relative_url }}).
|
||||
График функции с заполнением: [Рисуем сердечко в консоли]({{ '/ru/2023/03/08/drawing-heart-in-console.html#heart-shaped-graph' | relative_url }}).
|
||||
|
||||
{% include heading.html text="Уравнения функций" hash="equations-of-functions" type="3" %}
|
||||
{% include heading.html text="Уравнения функций" hash="equations-of-functions" %}
|
||||
|
||||
Каждую точку `(x,y)` из выводимого диапазона координат будем проверять на принадлежность графикам
|
||||
функций и в соответствии с этим выводить. Параметры функций и выводимый диапазон определим заранее
|
||||
|
@ -48,7 +48,7 @@ alt="\sqrt{(x-a)^2+(y-b)^2}=r." %}
|
|||
|
||||
`c` — половина стороны квадрата.
|
||||
|
||||
{% include heading.html text="Математические операции" hash="mathematical-operations" type="3" %}
|
||||
{% include heading.html text="Математические операции" hash="mathematical-operations" %}
|
||||
|
||||
Для выполнения *базовых* математических операций в Java используется библиотека `FdLibm` —
|
||||
*Свободно распространяемая математическая библиотека*. Большинство методов реализовано на уровне
|
||||
|
@ -66,7 +66,7 @@ alt="\sqrt{(x-a)^2+(y-b)^2}=r." %}
|
|||
|
||||
`floor(a)` — округление аргумента `a` в ме́ньшую сторону.
|
||||
|
||||
{% include heading.html text="Описание алгоритма" hash="algorithm-description" type="3" %}
|
||||
{% include heading.html text="Описание алгоритма" hash="algorithm-description" %}
|
||||
|
||||
Берём диапазон координат на плоскости таким образом, чтобы выводимая фигура полностью помещалась
|
||||
в печатаемой области. Обходим выбранный диапазон двумя вложенными циклами `for`: сначала по оси
|
||||
|
|
|
@ -18,9 +18,9 @@ date: 2023.03.08
|
|||
|
||||
Нарисуем два полукруга и один полуромб, заполненные внутри и снаружи. В предыдущем примере мы выводили
|
||||
[график функции в консоль]({{ '/ru/2023/02/05/function-graph-in-console.html' | relative_url }})
|
||||
— формулы для окружности и для ромба возьмём из него, а в этом примере для заполнения фигуры внутри,
|
||||
в формуле вместо знака *равно* подставляем знак *меньше*, а для заполнения снаружи, наоборот, — знак
|
||||
*больше*. Условий получится много, в отличие от предыдущего примера.
|
||||
— формулы для окружности и для ромба возьмём из него, а в этом примере добавим заполнение фигуры внутри и
|
||||
снаружи — вместо знака *равно* в формулах подставляем знаки *меньше* или *больше*. Условий получится много,
|
||||
в отличие от предыдущего примера.
|
||||
|
||||
Нарисуем картинку для наглядности.
|
||||
|
||||
|
|
|
@ -55,8 +55,8 @@ JavaScript, чтобы далеко не ходить.
|
|||
Символы и шрифт могут быть любыми, но для этого примера будем использовать комбинацию заглавных
|
||||
латинских букв и цифр со шрифтом *Comic Sans* — будем рисовать простую капчу для сайта или блога.
|
||||
|
||||
Спецсимволы рассмотрим, но пользоваться ими не будем, потому что угадать их с таким оформлением
|
||||
текста пользователю будет сложно. Например, плюс `+` угадать ещё можно, а вот минус `-` или
|
||||
Спецсимволы тоже рассмотрим, но пользоваться ими не будем, потому что угадать их с таким оформлением
|
||||
текста будет сложно для пользователя. Например, плюс `+` угадать ещё можно, а вот минус `-` или
|
||||
нижнее подчёркивание `_` уже с трудом, и даже если угадаешь, тогда найти эти кнопки с трудом,
|
||||
особенно на телефоне. Поэтому для капчи будем использовать комбинацию только из заглавных
|
||||
латинских букв и цифр.
|
||||
|
|
Loading…
Add table
Reference in a new issue