From 2f23834d888cfe713c84ff14a56623781379e0b3 Mon Sep 17 00:00:00 2001 From: Miloslav Ciz Date: Fri, 12 Aug 2022 22:38:13 +0200 Subject: [PATCH] Update --- cpp.md | 2 +- jokes.md | 6 +-- linear_algebra.md | 101 ++++++++++++++++++++++++++++++++++++++++++++-- rms.md | 10 ++--- watchdog.md | 11 +++++ 5 files changed, 117 insertions(+), 13 deletions(-) create mode 100644 watchdog.md diff --git a/cpp.md b/cpp.md index b3be53b..5d143b3 100644 --- a/cpp.md +++ b/cpp.md @@ -1,3 +1,3 @@ # C++ -C++ is an [object-obsessed](oop.md) [joke](jokes.md) language based on [C](c.md) to which it adds only [capitalist](capitalist_software.md) features and [bloat](bloat.md). Most good programmers agree that C++ is hilariously messy and also tragic in that it actually succeeded to become mainstream. \ No newline at end of file +C++ is an [object-obsessed](oop.md) [joke](jokes.md) language based on [C](c.md) to which it adds only [capitalist](capitalist_software.md) features and [bloat](bloat.md). Most good programmers agree that C++ is hilariously messy and also tragic in that it actually succeeded to become mainstream. As someone once said, "C++ is not an increment, it is excrement". \ No newline at end of file diff --git a/jokes.md b/jokes.md index 2521a84..9933b05 100644 --- a/jokes.md +++ b/jokes.md @@ -1,14 +1,14 @@ # Jokes -Here you can shitpost your jokes that are somehow related to this wiki's topic. Just watch out for [copyright](copyright.md) (co copy-pastes, no pastes of long jokes)! +Here you can shitpost your jokes that are somehow related to this wiki's topic. Just watch out for [copyright](copyright.md) (no copy-pasting jokes from other sites)! Please do NOT post lame "big-bang-theory" jokes like *sudo make sandwich* or *there are 10 types of people*. -{ Many of the jokes are original, some are shamelessly pulled from other sites and reworded. I don't believe [copyright](copyright.md) can apply if the expression of a joke is different, ideas can't be copyrighted. ~drummyfish } +{ Many of the jokes are original, some are shamelessly pulled from other sites and reworded. I don't believe [copyright](copyright.md) can apply if the expression of a joke is different, ideas can't be copyrighted. Also the exact origins of jokes are difficult to track so it's probably a kind of folklore. ~drummyfish } - [C++](cpp.md) - What's the worst kind of [lag](lag.md)? Gulag. -- Ingame chat: "What's the country in the middle of west Africa?" [{BANNED}](niger.md) +- Ingame chat: "What's the country in the middle of north Africa?" [{BANNED}](niger.md) - I have a mentally ill friend who tried to design the worst [operating system](os.md) on purpose. It boots for at least 10 minutes, then it changes the user's desktop background to random ads and it randomly crashes to make the user angry. He recently told me he is getting sued by [Microsoft](microsoft.md) for violating their look and feel. - Do you use [Emacs](emacs.md)? No, I already have an [operating system](os.md). - `alias bitch=sudo` diff --git a/linear_algebra.md b/linear_algebra.md index 8e2d251..ae00a4f 100644 --- a/linear_algebra.md +++ b/linear_algebra.md @@ -4,9 +4,9 @@ In [mathematics](math.md) linear algebra is an extension of the classical elemen Why is it called *linear* algebra? Basically because it deals with [linear equations](linear.md) which is kind of about proportionality, function plots being lines etc. A mathematician will probably puke at this explanation but it gives some intuition :) -## The Basics +## Basics -In "normal" algebra our basic elements are [numbers](number.md); we learn to add then, multiply then, solve equation with them etc. In linear algebra we call these "single numbers" [scalars](scalar.md) but also add more complex elements: [vectors](vector.md) and [matrices](matrix.md) and we learn to perform similar operations with them, even though they sometimes behave a bit differently. +In "normal" algebra our basic elements are [numbers](number.md); we learn to add then, multiply then, solve equation with them etc. In linear algebra we call these "single numbers" **[scalars](scalar.md)** (e.g. 1, -10.5 or [pi](pi.md) are scalars), and we also add more complex elements: **[vectors](vector.md)** and **[matrices](matrix.md)**, with which we may perform similar operations, even though they sometimes behave a bit differently (e.g. the order in multiplication of matrices matters, unlike with scalars). Vectors are basically sequences ([arrays](array.md)) of numbers, e.g. a vector of length 3 may be [1.5, 0, -302]. A matrix can be seen as a [two dimensional](2d.md) vector (a 2D array of numbers), e.g. a 2x3 matrix may look like this: @@ -15,9 +15,102 @@ Vectors are basically sequences ([arrays](array.md)) of numbers, e.g. a vector o |24 -3 0 | ``` -Why work with vectors and matrices? Because these can represent certain things we encounter in math and programming better than numbers, e.g. vectors may represent points in space or velocities with directions and matrices may represent transformations. +Similarly we may see vectors as matrices that have either only one column, so called **column vectors**, or only one row, so called **row vectors** -- it is only a matter of convention which type of vectors we choose to use (this affects e.g. "from which side" we will multiply vectors by matrices). For example a column vector -With vectors and matrices we can perform similar operations as with "normal numbers", i.e. addition, subtraction, multiplication, but there are also new operations and some operations may behave differently. E.g. when dealing with vectors, there are multiple ways to "multiply" them: we may multiply a vector with a scalar but also a vector with vector (and there are multiple way to do this such as [dot product](dot_product.md) and [cross product](cross_product.md)). Matrix multiplication is, unlike multiplication of real numbers, non-[commutative](commutativity.md) (A times B doesn't necessarily equal B times A), but its still [distributive](distributivity.md). We can also multiply vectors with matrices but only those that have "compatible sizes". And we can also solve equations and systems of equations which have vectors and matrices in them. +``` +|5 7.3 -2| +``` + +is really a 3x1 matrix that as a row vector (1x3 matrix) would look as + +``` +|5 | +|7.3| +|-2 | +``` + +Why do we even work with vectors and matrices? Because these can represent certain things we encounter in math and programming better than numbers, e.g. vectors may represent points in space or velocities with directions and matrices may represent transformations such as rotations (this is not obvious but it's true). + +With vectors and matrices we can perform similar operations as with "normal numbers", i.e. addition, subtraction, multiplication, but there are also new operations and some operations may behave differently. E.g. when dealing with vectors, there are multiple ways to "multiply" them: we may multiply a vector with a scalar but also a vector with vector (and there are multiple ways to do this such as [dot product](dot_product.md) which results in a scalar and [cross product](cross_product.md) which results in a vector). Matrix multiplication is, unlike multiplication of real numbers, non-[commutative](commutativity.md) (A times B doesn't necessarily equal B times A), but it's still [distributive](distributivity.md). We can also multiply vectors with matrices but only those that have "compatible sizes". And we can also solve equations and systems of equations which have vectors and matrices in them. + +There is an especially important matrix called the **[identity matrix](identity_matrix.md)** (sometimes also *unit matrix*), denoted *I*, an NxN matrix by which if we multiply any matrix we get that same matrix. The identity matrix has 1s on the main diagonal and 0s elsewhere. E.g. a 3x3 identity matrix looks as + +``` +|1 0 0| +|0 1 0| +|0 0 1| +``` + +Now let's see some the details of basic operations with vectors and matrices: + +- **matrix/vector addition/subtraction**: We can add (subtract) vectors and matrices only if they have exactly the same size. We perform the operation very simply element-wise. E.g. adding vector `[1 0 -2]` to vector `[3 1.1 3]` results in vector `[4 1.1 1]`. +- **matrix/vector multiplication by scalar**: We simply multiply each element of the vector/matrix by the scalar, e.g. `[2 0 -3] * 7 = [14 0 -21]`. +- **matrix/vector multiplication**: We can multiply matrix (vector) *A* by matrix (vector) *B* only if *A* has the number of columns equal to the number of rows of *B*. I.e. we can e.g. multiply a 2x3 (2 rows, 3 columns) matrix by a 3x5 matrix, but NOT a 2x4 matrix by 2x4 matrix. Note that unlike with real numbers, **order in matrix multiplication matters** (matrix multiplication is non-[commutative](commutativity.md)), i.e. `AB` is not generally equal to `BA`. Multiplying a MxN matrix by NxO matrix results in a MxO matrix (e.g. 2x3 matrix times 3x4 matrix results in a 2x4 matrix) in which each element is a [dot product](dot_product.md) of the corresponding row from the first matrix with the corresponding column of the second matrix. An example will follow later. +- **matrix/vector "division"**: We mention just for clarity that the term *matrix division* isn't really used but we can achieve the principle of division by multiplication by inverse matrices (similarly to how division on real numbers is really a multiplication by [reciprocal](reciprocal.md) of a number). +- **matrix/vector transpose**: Transpose of a matrix *A* is denoted as *A^T*. It is the matrix *A* flipped by its main (top left to bottom right) diagonal, i.e. the transpose of an NxM matrix is an MxN matrix. Transpose makes column vectors into row vectors and back. +- **matrix inverse**: The inverse matrix of an NxN matrix *A* is denoted as *A^-1* and it is a matrix such that if we multiply *A* by it we get the identity matrix (*I*). Inverse matrix is similar to a [reciprocal value](reciprocal.md) in the world of real numbers. Note that non-square matrices don't have inverses and even some square matrices don't have inverses. How to invert a matrix? A general method is to simply solve the equation that defines it. +- **matrix [determinant](determinant.md)**: Determinant of a matrix is a scalar computed in a specific way from the matrix that reflects some of the properties of the matrix (e.g. its invertibility). It appears in many equations so it's good to know about it. + +**Example of matrix multiplication**: this is a super important operation so let's see an example. Let's have a 2x3 matrix *A*: + +``` + |1 2 3| +A = |4 5 6| +``` + +and a 3x4 matrix *B*: + +``` + |7 8 9 10| +B = |11 12 13 14| + |15 16 17 18| +``` + +The result, *AB*, will be a 2x4 matrix in which e.g. the top-left element is equal to 1 * 7 + 2 * 11 + 3 * 15 = 74 (the dot product of the row `1 2 3` with the column `7 11 15`). On paper we usually draw the matrices conveniently as follows: + +``` + |7 8 9 10 | + |11 12 13 14 | + |15 16 17 18 | + |7 8 9 10| +|1 2 3| |11 12 13 14| = |1 2 3| |74 80 86 92 | +|4 5 6| |15 16 17 18| |4 5 6| |173 188 203 218| +``` + +In case it's still not clear, here is a [C](c.md) code of the above shown matrix multiplication: + +``` +#include + +int main() +{ + int A[2][3] = { + {1, 2, 3}, + {4, 5, 6}}; + + int B[3][4] = { + {7, 8, 9, 10}, + {11, 12, 13, 14}, + {15, 16, 17, 18}}; + + for (int row = 0; row < 2; ++row) + { + for (int col = 0; col < 4; ++col) + { + int sum = 0; + + for (int i = 0; i < 3; ++i) + sum += A[row][i] * B[i][col]; + + printf("%d ",sum); + } + + putchar('\n'); + } + + return 0; +} +``` ## See Also diff --git a/rms.md b/rms.md index 4b88de5..fee563b 100644 --- a/rms.md +++ b/rms.md @@ -1,15 +1,15 @@ # Richard Stallman -The great doctor Richard Matthew Stallman (RMS, born 1953 in New York) is one of the biggest figures in software history, inventor of [free software](free_software.md), founder of the [GNU project](gnu.md), [free software foundation](fsf.md) and the author of a famous text editor [emacs](emacs.md). +The great doctor Richard Matthew Stallman (RMS, born 1953 in New York) is one of the biggest figures in software history, inventor of [free software](free_software.md), founder of the [GNU project](gnu.md), [free software foundation](fsf.md), a great [hacker](hacking.md) and the author of a famous text editor [emacs](emacs.md). Stallman's life along with free software's history is documented by a free-licensed book named *Free as in Freedom: Richard Stallman's Crusade for Free Software* on which he collaborated. You can get it for free e.g. at [Project Gutenberg](https://www.gutenberg.org/ebooks/5768). You should read this! -Stallman has a beautifully minimalist website http://www.stallman.org where he actively comments on current news and issues. +As [anarchists](anarchism.md) we of course despise the idea of worshiping people, creating heroes and cults of personalities, but the enormous historical significance of Stallman has to be stressed as a plain and simple fact. Even though in our days his name is overshadowed in the mainstream by rich businessman and creators of commercially successful technology and even though we ourselves disagree with Stallman on some points, in the future history may well see Stallman as perhaps the greatest man of the software era, and rightfully so. Stallman isn't a mere creator of a commercially successful software product, he is literally as important as the great philosophers of ancient Greece -- he brilliantly foresaw the course of history and quickly defined ethics needed for the new era of mass available programmable computers, and not only that, he also basically alone established this ethics as a standard IN SPITE of all the world's corporations fighting back. He is also extremely unique in not pursuing self interest, in TRULY living his own philosophy, dedicating his whole life to his cause and refusing to give in even partially. All of this is at much higher level than simply becoming successful and famous within the contemporary capitalist system, his life effort is pure, true and timeless, unlike things achieved by pieces of shit such as [Steve Jobs](steve_jobs.md). -Regarding [software](software.md) he has for his whole life strongly and tirelessly promoted free software and [copyleft](copyleft.md) and has himself only used such software; he has always practiced what he preched and led the best example of how to live without [proprietary](proprietary.md) software. This is amazing. Nevertheless he isn't too concerned about [bloat](bloat.md) (judging by the GNU software and his own creation, [emacs](emacs.md)) and he also doesn't care that much about [free culture](free_culture.md) (some of his written works prohibit modification and his GNU project allows proprietary non-functional data). Sadly he has also shown signs of being a [type A fail](fail_ab.md) personality by writing about some kind of newspeak "*gender neutral language*" and by seeming to be caught in a [fight culture](fight_culture.md) (e.g. by supporting copyleft). +Regarding [software](software.md) Stallman has for his whole life strongly and tirelessly promoted free software and [copyleft](copyleft.md) and has himself only used such software; he has always practiced what he preched and led the best example of how to live without [proprietary](proprietary.md) software. This is amazing. Nevertheless he isn't too concerned about [bloat](bloat.md) (judging by the GNU software and his own creation, [emacs](emacs.md)) and he also doesn't care that much about [free culture](free_culture.md) (some of his written works prohibit modification and his GNU project allows proprietary non-functional data). Sadly he has also shown signs of being a [type A fail](fail_ab.md) personality by writing about some kind of newspeak "*gender neutral language*" and by seeming to be caught in a [fight culture](fight_culture.md) (e.g. by supporting copyleft). Nevertheless he definitely can't be accused of populism as he basically tells what he considers to be the truth no matter what, and he is very consistent in this. Some of his unpopular opinions brought him a lot of trouble, e.g. the wrath of SJWs in 2019 for his criticism of the [pedo](pedophile.md) witch hunt. -RMS made the free software song (well, only the lyrics, the melody is taken from a Bulgarian folk song Sadi Moma). +He is a weird guy, having been recorded on video eating dirt from his feet before giving a lecture. In the book *Free as in Freedom* he admits he might be autistic. Nevertheless he's pretty smart, has magna cum laude degree in physics from Harvard, 10+ honorary doctorates, fluently speaks English, Spanish and French and has many times proven his superior programming skills (even though he later stopped programming to fully work on promoting the FSF). -He is a weird person, having been recorded on video eating dirt from his feet before giving a lecture. In the book *Free as in Freedom* he admits he might be autistic. Nevertheless he's pretty smart, has magna cum laude degree in physics from Harvard, 10+ honorary doctorates, fluently speaks English, Spanish and French and has many times proven his superior programming skills (even though he later stopped programming to fully work on promoting the FSF). +Stallman has a beautifully minimalist website http://www.stallman.org where he actively comments on current news and issues. He also made the famous free software song (well, only the lyrics, the melody is taken from a Bulgarian folk song Sadi Moma). In 2019 Stallman was [cancelled](cancel_culture.md) by [SJW](sjw.md) fascists for merely commenting rationally on the topic of child sexuality following the Epstein scandal. He resigned from the position of president of the FSF but continues to support it. \ No newline at end of file diff --git a/watchdog.md b/watchdog.md new file mode 100644 index 0000000..bd0d0f4 --- /dev/null +++ b/watchdog.md @@ -0,0 +1,11 @@ +# Watchdog + +Watchdog is a special [timer](timer.md) that serves as a safety mechanism for detecting malfunction of computer programs at [run time](run_time.md) by requiring programs to periodically reset the timer. + +Basically watchdog keeps counting up and a correctly behaving program is supposed to periodically reset this count ("feed the dog") -- if the reset doesn't happen for a longer period, the watchdog counts up to a high value and alerts that something's wrong ("the dog starts barking"), e.g. with an [interrupt](interrupt.md) or a [signal](signal.md). This can mean for example that the program has become stuck in an [infinite loop](infinite_loop.md) or that its instructions were corrupted and the program control jumped to some unintended area of RAM and is doing crazy [shit](shit.md). This is usually handled by resetting the system so as to prevent possible damage by the program gone insane, also [logs](log.md) can be made etc. Watchdogs are very often used in [embedded systems](embedded.md). [Operating systems](os.md) may also use them to detect nonresponsive [processes](process.md). + +Watchdog is similar to the dead man's switch used e.g. in trains where the operator is required to periodically push a button otherwise the train will automatically activate brakes as the operator is probably sleeping or dead. + +## See Also + +- [dog](dog.md) \ No newline at end of file