OpenLLM-France/wikimedia huggingface dataset:
# Computer Science Design Patterns/Bridge

Bridge pattern is useful when a code often changes for an implementation as well as for a use of code. In your application, you should have provider classes and client classes:
| Client1 -provider: Provider | Client2 -provider: Provider | ... | ClientN -provider: Provider | ◊— | Provider +doProcess | Provider +doProcess | Provider +doProcess | Provider +doProcess | Provider +doProcess |
| | | | | | Provider1 +doProcess | | Provider2 +doProcess | ... | ProviderN +doProcess |
Each client class can interact with each provider class. However, if the implementation changes, the method signatures of the Provider interface may change and all the client classes have to change. In the same way, if the client classes need a new interface, we need to rewrite all the providers. The solution is to add a bridge, that is to say a class that will be called by the clients, that contains a reference to the providers and forward the client call to the providers.
| Client1 -bridge: Bridge | Client2 -bridge: Bridge | ... | ClientN -bridge: Bridge | ◊— | Bridge -provider: Provider +doProcessForClient | ◊— | Provider +doProcess | Provider +doProcess | Provider +doProcess | Provider +doProcess | Provider +doProcess |
| | | | | | | | Provider1 +doProcess | | Provider2 +doProcess | ... | ProviderN +doProcess |
In the future, the two interfaces (client/bridge and bridge/provider) may change independently and the bridge may trans-code the call order.

## Examples

It's hard to find an example in a library as this pattern is designed for versatile specifications and a library does not change constantly between two versions.

## Cost

The cost of this pattern is the same as the adapter. It can be planned at design time but the best way to decide to add it is the experience feedback. Implement it when you have frequently changed an interface in a short time.

### Creation

Its implementation is easy but can be expensive. It depends on the complexity of the interface. The more methods you have, the more expensive it will be.

### Maintenance

If you always update the client/bridge interface and the bridge/provider interface the same way, it would be more expensive than if you do not implement the design pattern.

### Removal

This pattern can be easily removed as automatic refactoring operations can easily remove its existence.

## Advices

* Put the bridge term in the name of the bridge class to indicate the use of the pattern to the other developers.

## Implementation

The following Java (SE 6) program illustrates the bridge pattern.
It will output:
Output:

### C#

The following C# program illustrates the "shape" example given above and will output:

### C# using generics

The following C# program illustrates the "shape" example given above and will output:
The following Python program illustrates the "shape" example given above and will output:
An example in Ruby.
A Scala implementation of the Java drawing example with the same output.
An example in D.
This example in Perl uses the MooseX::Declare module.
The following Delphi program illustrates the "shape" example given above and will output:
# Cryptography/Linear Cryptanalysis

Linear Cryptanalysis is using Linear mathematics (such as linear algebra) to break cryptosystems. This approach was strong against the now-obsolute cryptosystems based on Linear Shift Registers. Modern cryptosystems like AES and RSA use non-linear elements to prevent an attack based on linear cryptanalysis. In AES, the S-box provides non-linearity. In RSA, modular exponentiation provides non-linearity.
# Cryptography/Key Lengths
## Key Length

Key length is directly proportional to security. In modern cryptosystems, key length is measured in bits (e.g. AES uses 256-bit keys), and each bit of a key increases the difficulty of a brute-force attack exponentially. It is important to note that in addition to adding more security, each bit slows down the cryptosystem as well. Because of this, key length -- like all things security -- is a tradeoff. In this case between practicality and security.
Furthermore, different types of cryptosystems require vastly different key lengths to maintain security. For instance, modulo-based public key systems such as Diffie-Hellman and RSA require rather long keys (generally around 1,024 bits), whereas symmetric systems, both block and stream, are able to use shorter keys (generally around 256 bits). Furthermore, elliptic curve public key systems are capable of maintaining security at key lengths similar to those of symmetric systems. While most block ciphers will only use one key length, most public key systems can use any number of key lengths.
As an illustration of relying on different key lengths for the same level of security, modern implementations of public key systems (see GPG and PGP) give the user a choice of keylengths. Usually ranging between 768 and 4,096 bits. These implementations use the public key system (generally either RSA or ElGamal) to encrypt a randomly generated block-cipher key (128 to 256 bits) which was used to encrypt the actual message.

## Entropy

Equal to the importance of key length is information entropy. Entropy, defined generally as "a measure of the disorder of a system", implies randomness. i.e. If all of the bits of a key are not securely generated and equally random (whether truly random or the result of a cryptographically secure PRNG operation), then the system lacks entropy and is much more vulnerable to attack. For example, if a 128-bit key has only 64 bits of entropy, then the effective length of the key is 64 bits. This can be seen in the DES algorithm. DES actually has a key length of 64 bits; however, the effective key length is 56 bits because 8 bits are used for parity.

## Common Mistakes

The fundamental deficiency in advantages of long block cipher keys when compare it to short cipher keys could be in difficulties to screening physical random entropy in short digits. Perhaps we can't store screening mechanism of randomness in secret, so we can't get randomness of entropy 2^256 without energy, which will be liner to appropriate entropy. For example, typical mistake of random generator implementation is simple addiction of individual digits with probability 0.5. This generator could be easy broken by bruteforce by neighbor bits wave functions. In this point of view, using block ciphers with large amount of digits, for ex. 10^1024 and more have a practical sense.
Other typical mistake is using public key infrastructure to encrypt session keys, because in this key more preferable to use Diffie-Hellman algorithm. Using the Diffie-Hellman algorithm to create session keys gives "forward secrecy".
# Cryptography/Goals of Cryptography

Crytography is the science of secure communication in the presence of third parties (sometimes called "adversaries").
Modern cryptographers and cryptanalysts work in many areas including
* data confidentiality
* data integrity
* authentication
* forward secrecy
* end-to-end auditable voting systems
* digital currency
Classical cryptography focused on "data confidentiality"—keeping pieces of information secret, i.e. of designing technical systems such that an observer can infer as few as possible - optimally none - information from observing the system. The motivation for this is that the owner of the system wants to prevent the observer from taking advantage (e.g. monetary, influential, emotional) of the possible intelligence.
This secrecy or hiding is achieved by removing contextual information from the system's observable state and/or behaviour, without which the observer cannot gain intelligence about the system.

## Examples

The term is very often used in conjunction in the context of message exchange between two entities, but of course not restricted to this case.

### Hiding System State Alone

It may be advantageous for an ATM machine to hide the information as to how much cash is still available in the machine. It may e.g. only disclose the information that no more bank notes are available from it to the holder of a valid debit card.

### Hiding Communication Content

Two companies doing business with each other may not wish to disclose the information on pricing of their products to third parties tapping into their communications.

### Hiding the Fact of Communicating

Well known entities with well known fields of activity may wish to hide the fact that they are communicating at all since an observer aware of their fields of activity may already from the fact of some communication happening, be able to infer information.
# Cryptography/Index of coincidence

The index of coincidence for a ciphertext is the probability that two letters selected from it are identical. Usually denoted by I, it is a statistical measure of the redundancy of text. The index of coincidence of totally random collection (uniform distribution) of letters is around 0.0385.

## References

* ↑ "Index of Coincidence".
This page or section of the Cryptography book is a stub. You can help Wikibooks by expanding it.
# Bourne Shell Scripting/Appendix B: Environment reference

In the section on the environment we discussed the concept of environment variables. We also mentioned that there are usually a large number of environment variables that are created centrally in /etc/profile. There are a number of these that have a predefined meaning in the Bourne Shell. They are not set automatically, mind, but they have meaning when they are set.
On most systems there are far more predefined variables than we list here. And some of these will mean something to your shell (most shells have more options than the Bourne Shell). Check your shell's documentation for a listing. The ones below are meaningful to the Bourne Shell and are usually also recognized by other shells.
Bourne Shell environment variables :
| Variable | Meanings |
| HOME | The user's home directory. Set automatically at login from the user's login directory in the password file |
| PATH | The default search path for executables. |
| CDPATH | The search path used with the cd builtin, to allow for shortcuts. |
| LANG | The directory for internationalization files, used by localizable programs. |
| MAIL | The name of a mail file, that will be checked for the arrival of new mail. |
| MAILCHECK | The frequency in seconds that the shell checks for the arrival of mail. |
| MAILPATH | A colon “:” separated list of file names, for the shell to check for incoming mail. |
| PS1 | The control string for your prompt, which defaults to “$ ”, unless you are the superuser, in which case it defaults to “# ”. |
| PS2 | The control string for your secondary prompt, which defaults to “> ”. The secondary prompt is what you see when you break a command over more than one line. |
| PS4 | The character string you see before the output of an execution trace (set -x); defaults to “+ ”. |
| IFS | Input Field Separators. Basically the characters the shell considers to be whitespace. Normally set to 〈space〉, 〈tab〉, and 〈newline〉. |
| TERM | The terminal type, for use by the shell. |
# Botany/Plant structure discussion
## Further Discussion

The questions posed in Chapter 3. Plant Structure are discussed further on this page. Remember, some questions are intended to be thought-provoking and more than one answer may be "correct".
Question:
* At this point the conceptual differences between cell types, tissues, organs, and organisms may be somewhat confusing. Using the leaf as an example, describe this structure in a way that considers the cell types, tissues, and organs for that part of the leaf where photosynthesis is concentrated.
Photosynthesis is concentrated in the mesophyll of the leaf. The mesophyll is a type of tissue composed of two layers or arrangements of chlorenchyma cells: an upper pallisade layer of tightly packed parenchyma (called pallisade chlorenchyma), and a lower spongy layer of loosely packed parenchyma (or spongy chlorenchyma). One could regard these layers as different tissue types (simple tissues) and the mesophyll as a complex tissue. The mesophyll is packed between two protective layers of epidermal cells (tissue: epidermis of epidermal cells and cuticle), which along with the vascular tissue and perhaps other structural tissues form an organ called the leaf whose primary function is food production for the organsim: the plant.
Leaves usually have a stem-like structural part called a petiole by which they attach to another plant organ termed the stem.
<< Chapter 3
# Botany/Plant structure laboratory

I'm experimenting here with the practicality of having laboratory excercises as part of the Botany Study Guide Comments invited.

## Chapter 3. Plant Structure Laboratory
### Leaves

Examine this 'marsh purslane' plant and determine the following about its leaves:
3-1. Leaf arrangement is:
    a) opposite
    b) alternate
    c) whorled
    d) entire
    e) smooth
3-2. Which of the following describes the leaves:
    a) sessile, margin toothed
    b) peltate, margin entire
    c) sessile, margin entire
    d) petiolate, margin crenate
    e) petiolate and hirsute
3-3. Only one of the following statements is true:
    a) A monocot with clasping leaves
    b) A dicot with hairy, waxy leaves to reduce water loss
    c) A monocot growing in relatively wet areas
    d) A dicot with leaves opposite, leaf bases attenuate
    e) A wetland plant with compound leaves
<< Chapter 3
Answers to Laboratory Questions:
    3-1 ~ a
    3-2 ~ d (but tricky, as petiole is about 1 mm long and margins weakly crenate).
    3-3 ~ d
# Botany/Plant tissues

<< Contents Page | << Chapter 2 | Chapter 3 | Chapter 4 >>|
Chapter 3. Plant Tissues

## Plant Tissues

Most plant cells are specialized to a greater or lesser degree, and arranged together in tissues. A plant tissue can be simple or complex depending upon whether it is composed of one or more than one type of cell. The simplest tissue found in plants is called parenchyma. The cells are not very specialized, more or less rounded or angular where packed together, and thin-walled. A type of parenchyma called chlorenchyma because the cells contain chloroplasts forms tissue (usually in the leaves) responsible for most of the photosynthesis occurring in the plant. Note that in simple tissues at least (tissues comprised mostly of one cell type), the tissue name follows from the cell type. However, tissues may also have unique anatomical names related to where in the plant they occur.

### Meristems

The growth of a plant requires a source of undifferentiated cells located in places where growth is needed and can be initiated to further the body plan (in comparison to animals, plants are rather open in this regard). Some enlargement in size is always possible by elongation or enlargement of existing cells, or by existing cells simply dividing. But differentiation of one cell type into another is only possible if the initial cell (mother cell) is not very specialized. Tissues composed of cells that remain undifferentiated and supply, by their divisions, cells to form new tissues and organs, are called meristems. Meristem tissue occurs in places that allow for a very orderly pattern of growth.
* Botany Study Guide ~ Wiki Contents Table Section I
* Chapter 1 - Introduction ~ Chapter 2 - Plant cells Chapter 3 - Plant Tissues ~
* Chapter 4 - Plant Organs Chapter 5 - Plant Reproduction ~ Chapter 6 - Plant Morphology
# Computer Programming/Linux Programming
## About the platform

The GNU operating system was started by Richard Stallman as a free replacement for the UNIX operating system. At the same time Linus Torvalds was working on a kernel, which he adapted to fit the GNU operating system. As time progressed, many applications from UNIX and DOS were ported to GNU/Linux as well as the thousands of new applications written for it. GNU/Linux has become a completely self-sufficient operating system with applications ranging from the many console applications to the numerous highly advanced GUI applications (many of which are based on lower level console applications) and everything else in between.
The most popular languages for use on the GNU/Linux platform include C/C++ and Java, however the range of programming languages supported by the GNU/Linux platform cover the entire spectrum of the software development world. Other popular languages are Perl, Python and Ruby. Shell scripting is often used for administrative tasks but cannot be called a complete high level language.

## Basic information

Most UNIX code is instantly portable to GNU/Linux systems - it can be compiled as on a UNIX system. GNU/Linux programming tools are mostly from the GNU project at http://www.gnu.org, including gcc (free C/C++ compiler), and equivalents of make, ld, as, etc. Numerous others are available for various languages, including java.

## Further reading

* "Secure Programming for Linux and Unix HOWTO -- Creating Secure Software" by David A. Wheeler 2003
# Computer Programming/OS Programming
## Operating System (OS) Programming

A computer is a series of electrical pathways some of which can be changed by use of some of its own electrical pathways.
A computer instruction is a series of electrical signals that make use of a computer.
A computer program is a series of computer instructions.
An operating system (OS) is a computer program with the purposes of:
* allowing user input in its operation
* maintaining itself
* switching computer operation to other computer programs (tasks)
* maintaining other computer programs (tasks)
* controlling hardware
* allocating memory to software as needed
OS programming is ...
Many people are dissatisfied with currently-available operating systems, and research ways to improve them—or introduce entirely new replacements.
Some computer engineers develop entirely new computing hardware, and need to write a new OS for it (typically by adapting parts of some pre-existing OS).
* A Neutral Look at Operating Systems
* Wikiversity:Operating System
* Wikipedia:Operating system
* http://c2.com/cgi/wiki?OperatingSystemsResearch
* http://c2.com/cgi/wiki?OperatingSystemsDesignPrinciples
* the TUNES Project Wiki http://cliki.tunes.org/
# Computer Programming/Mathematical calculations
## Simple Arithmetic

Most any programming language can use addition, subtraction, multiplication, and division between Computer programming/Variables to put the results into new Variables. Watch out for risk of Divide by Zero, which can give serious indigestion to some programming languages.

## Date Math

Many programming languages can calculate the number of days weeks months between two dates, provided the dates are defined using consistent Computer programming/Types.

## Higher Math

Some programming languages can compute values using mathematics beyond simple arithmetic, such as Square Roots, Sine, Cosine, Logarithms, Imaginary Numbers.

## See also

If you want to know more you should read the sister article Ada Programming/Mathematical calculations which is a lot more elaborate.
# Computer Programming/Physics/Motion of an object through space (piecemeal approximation)

<Wikisource:Source code
The problem with the Position of an accelerating body function is that although it is theoretically correct, it's not very adaptive in describing the motion of an object through space. To rectify this we attack the calculations piece-meal.
We refer back to the Taylor series form of the position function:
    $\mathbf {s} (t+t_{0})=\sum {\frac {t^{n}}{n!}}\mathbf {s} ^{(n)}(t_{0})$.
This can be reduced to the Maclaurin series if we synchronize our clock so that $t_{0}$ is zero:
    $\mathbf {s} (t)=\sum {\frac {t^{n}}{n!}}\mathbf {s} _{0}^{(n)}$.
Herein lies the solution to the problem. The equation, as is, describes the complete path based on the initial constant factors $\mathbf {s} _{0}^{(n)}$. However if we treat this piece-meal, as in we calculate the numerical solution for $t$ equal some small incremental time $\Delta t$ and re-synchronize $t_{0}$ to $t_{previous}$ after each calculation cycle, then we can dynamically build the path of the object through successive calculations using the following incremental form of the function:
    $\mathbf {s} (t)=\mathbf {s} (\Delta t+t_{previous})=\sum {\frac {\Delta t^{n}}{n!}}\mathbf {s} _{previous}^{(n)}$.
Notice that we gain accuracy as $\Delta t\rightarrow 0$ and if we use more and more terms.
After calculating the initial change in position of the object based on the initial constant factors $\mathbf {s} _{0}^{(n)}$, we need only provide any external accelerations that affect the object, $\mathbf {s} ^{(2)}$, from which we can calculate the next position $\mathbf {s} ^{(0)}$ and velocity $\mathbf {s} ^{(1)}$ of the object as well as the next set of constant factors $\mathbf {s} ^{(n)}$, of which $\mathbf {s} ^{(0)}$, $\mathbf {s} ^{(1)}$ and $\mathbf {s} ^{(2)}$ are already known.
Velocity is calculated by
    $\mathbf {v} (t)=\sum {\frac {\Delta t^{n}}{n!}}\mathbf {v} _{previous}^{(n)}$
or
    $\mathbf {s} ^{(1)}(t)=\sum {\frac {\Delta t^{n}}{n!}}\mathbf {s} _{previous}^{(n+1)}$.
The other $\mathbf {s} ^{(n)}(t)$ values can be approximated by
    $\mathbf {s} ^{(n)}(t)={\frac {\mathbf {s} ^{(n-1)}(t)-\mathbf {s} _{previous}^{(n-1)}}{\Delta t}}$ for $n>2$,
provided that $\Delta t$ is very small.
That is,
    $\mathbf {s} ^{(n)}(t)={\frac {ds^{(n-1)}}{dt}}=\lim _{\Delta t\rightarrow 0}{\frac {\Delta s^{(n-1)}}{\Delta t}}$.
# Computer Programming/Physics/Position of an accelerating body function (constant acceleration)

<Wikisource:Source code
The position of an accelerating body is a mathematical function expressed as:
    $\mathbf {s} (t)={\begin{matrix}{\frac {1}{2}}\end{matrix}}\mathbf {a} t^{2}+\mathbf {v} _{0}t+\mathbf {s} _{0}\quad \$ if a is constant.
a is acceleration v is initial velocity t is time s is starting position
It is expressed below in various programming languages