OpenLLM-France/wikimedia huggingface dataset:
# Choosing The Right File Format/Raster Images
## Images (Raster Graphics)

Most of your images are probably raster graphics, as vector graphics are less common. Although there are hundreds of formats to choose from two of the most popular are GIF (Graphics Interchange Format) and TIFF (Tagged Image File Format). Unfortunately these have been caught up in legal issues since 1994 over a Unisys patent on the LZW compression algorithm which both formats use. These patents have now expired although there is still an IBM patent valid until August 2006.
Thus the GIF and TIFF formats do not currently meet the requirement of being 'free from legal restriction in their use'.
The lossless PNG (Portable Network Graphic) format replaces GIF and has many advantages in quality, size and options (but lacks animation). Most importantly the PNG format is patent free and has been a W3C Recommendation and ISO Standard since 2003.
Another popular format for raster graphics is the lossy JPEG/JPG (Joint Photographic Experts Group) format, which is specially suited to storing photographic images.
   ...the JPEG committee have always tried to ensure in their standardisation work that the 'baseline' part of their standards should be implementable without payment of either royalty fees (volume related) or license fees (non-volume related)." JPEG Committee
   ...there are many patents associated with some optional features of JPEG, namely arithmetic coding and hierarchical storage. For this reason, these optional features should not be used for long-term storage of valuable images. W3C
Remember that JPEG is a lossy format, meaning that each time the image is modified and resaved there is some irretrievable data loss. Therefore it should be avoided for archival use unless shortage of space requires that lossy compression is used.
(Windows users should read Microsoft Security Bulletin MS04-028 and this press release)

## Recommendation

* Use the PNG format.
* Use the JPEG format, but avoid optional features.
* If your software supports it, you can save in TIFF format without compression.

## Comparison

* A photo showing multiple levels of JPEG compression. As the photo goes right, the quality and file size both increase.
* Lossless, JPEG, and Webp compression compared.
* A mad scientist cartoon, saved as a SVG.
* A PNG with a transparent background.
* Gifs can display animations, but have limited colors available, and take a great amount of space.

## References

* History of the Portable Network Graphics (PNG) Format
* Joint Photographic Experts Group
# Choosing The Right File Format/Vector 3D
## 3D vector format

Three-dimensional vector files can be divided into two groups in the same way as 2D file formats. Programmes for producing 3D files include AutoCAD, ArchiCAD, 3DStudioMax, Rhino etc. The main openly published standard format is VRML ( Virtual Reality Markup Language ). Another widely used format is DXF which is touted by AutoDesk (the makers of AutoCAD) as the transportable file format for 3D drawings. The DXF format, as implemented by AutoCAD is not an ideal solution as outlined in Why Isn't DXF Good Enough? by the Open Design Alliance. It is however a well supported format by many programmes and is widely used to transport files from one programme to another.
Recommendation
* Do not use vector graphics to store important information unless unavoidable.
* Keep original files on CD with copies in VRML and/or DXF format. Keep paper copies.
References
# Choosing The Right File Format/Vector Files
## Understanding Vector Formats

Vector Formats represent shapes by describing their geometric properties in points, lines, curves, and polygons. It follows mathematic calculation and commands to render a graphics. The difference between vector and raster images, and when to use each, is important, but outside the scope of this document.
Sadly there are no widely adopted standard formats for vector images. Part of the reason for this is the variety of uses for vector images. At one extreme of complexity is a DWG (pronounced drawing) file from AutoCAD which can represent a multi storey building in three dimensions. At the other extreme is an SVG (Structured Vector Graphics) file for the elegant graphics used in digital cartoons.
So which format one uses depends a lot on how long you will need the information to be stored and who will need to have access to it.
As a starting point here are some vector formats and things to consider:
| Typical uses | Formats | Status |
| Architecture, engineering and construction | DWG | Proprietary format of AutoDesk. The Open Design Alliance asserts that DWG 2004 is partially encrypted. |
| Architecture, engineering and construction | DWG | Also known as OpenDWG. The Open Design Alliance's version of the DWG file format used by Autodesk. Published as an open standard. |
| Architecture, engineering and construction | DXF (Drawing Interchange Format, or Drawing Exchange Format) | Promoted by AutoDesk as the preferred format for interoperability with other CAD software. Partially documented with partial support for functions contained in DWG files. Its limitations are described in more detail in the white paper "Why Isn't DXF Good Enough?" |
| Architecture, engineering and construction | DGN (DesiGN file) | Also known as OpenDGN. The native format of MicroStation, a product of Bentley Corp. DGN is |
In 2001, the Scalable Vector Graphics (SVG) format became a W3 recommended standard.
DOT files are a very compact graph description that can be read and written by many applications.
Dia ".dia" files are resolution-independent vector format for diagrams and schematics.
# Choosing The Right File Format/Introduction

File formats are the language of a computer's memory. Choosing the right format for the electronic information we want to store is one important step in making good use of computers and minimising problems.
This book tries to help you choose the file format best suited to its use. It concentrates on two purposes of storing your information (data).
* Portability and interoperability
* Digital Preservation
Portability and Interoperability is the ability of your data to be read (interpreted) by different software and hardware. The most common portable format in use now is the PDF (Portable Document Format) for sending documents over the internet. Somewhat more troublesome is the exchanging of address information between email software.
Digital Preservation can be defined as long-term, error-free storage of digital information, with means for retrieval and interpretation of needed files from the long-term, error-free digital storage, for all the time span that the information is required for.
* Preservation
* Portability

## Old version of Introduction to merge in

Planning for an unpredictable future is known as future proofing, although you can't really know if you are future proof you can practice risk reduction and learn from the mistakes of history. This article focuses on future proofing of computer files. This article gives tips for creating files in a manner which makes them easy to preserve and later access, and for avoiding pitfalls that could make your files difficult to access later. Looking after the files you already have is known as digital preservation.
Where future proofing and digital preservation deal with the rather etheric matter of electronic files and their formats, then your next concern is the media on which your information is stored. That is an area of study in itself, and is not the subject of this article.
Both future proofing of information and the media it is stored on are vital in any thorough review of your IT systems. Will you be able to read the files you're working on now in 5 years time? Do you know if all the old files you have now are still readable?
The chance of electronic files being readable in 5 or 10 years is not something to leave up to chance. Active intervention is needed in most cases. Migrating to software/hardware that supports openly published standards is the most effective single step in any plan to future-proof.
# C++ Programming/Programming Languages/C++/Code/Keywords/asm

The asm keyword is used to declare an inline assembly code. When using the windows compiler, the __asm keyword is used instead. Here the asm keyword does not do anything.
# C++ Programming/Programming Languages/C++/Code/Keywords/auto

The auto keyword is used to have the compiler infer the type of the variable which follows it from the RHS or from its declaration.
# C++ Programming/Programming Languages/C++/Code/Keywords/dynamic cast

The dynamic_cast keyword is used to casts a datum from one pointer or reference of a polymorphic type to another, similar to static_cast but performing a type safety check at runtime to ensure the validity of the cast. Generally for the purpose of casting a pointer or reference up the inheritance chain (inheritance hierarchy) in a safe way, including performing so-called cross casts.

## Syntax

The target type must be a pointer or reference type, and the expression must evaluate to a pointer or reference.
If you attempt to cast to a pointer type, and that type is not an actual type of the argument object, then the result of the cast will be NULL.
If you attempt to cast to a reference type, and that type is not an actual type of the argument object, then the cast will throw a std::bad_cast exception.
When it doesn't fail, dynamic cast returns a pointer or reference of the target type to the object to which expression referred.
# C++ Programming/Programming Languages/C++/Code/Keywords/extern

The extern keyword tells the compiler that a variable is defined in another source module (outside of the current scope). The linker then finds this actual declaration and sets up the extern variable to point to the correct location. Variables described by extern statements will not have any space allocated for them, as they should be properly defined elsewhere. If a variable is declared extern, and the linker finds no actual declaration of it, it will throw an "Unresolved external symbol" error.
Examples:

## extern int i;

    declares that there is a variable named i of type int, defined somewhere in the program.

## extern int j = 0;

    defines a variable j with external linkage; the extern keyword is redundant here.

## extern void f;

    declares that there is a function f taking no arguments and with no return value defined somewhere in the program; extern is redundant, but sometimes considered good style.

## extern void f {;}

    defines the function f declared above; again, the extern keyword is technically redundant here as external linkage is default.

## extern const int k = 1;

    defines a constant int k with value 1 and external linkage; extern is required because const variables have internal linkage by default.
extern statements are frequently used to allow data to span the scope of multiple files.
When applied to function declarations, the additional "C" or "C++" string literal will change name mangling when compiling under the opposite language. That is, extern "C" int plain_c_func(int param); allows C++ code to execute a C library function plain_c_func.
# C++ Programming/Programming Languages/C++/Code/Keywords/for

The for keyword is used as special case of a pre-conditional loop that supports constructors for repeating a loop only a certain number of times in the form of a step-expression that can be tested and used to set a step size (the rate of change) by incrementing or decrementing it in each loop.

## Syntax

The for construct is a general looping mechanism consisting of 4 parts:
* . the initialization, which consists of 0 or more comma-delimited variable initialization statements
* . the test-condition, which is evaluated to determine if the execution of the for loop will continue
* . the increment, which consists of 0 or more comma-delimited statements that increment variables
* . and the statement-list, which consists of 0 or more statements that will be executed each time the loop is executed.
The for loop is equivalent to next while loop:
Example 1
Example 2
can be rewritten as:
The for loop is a very general construct, which can run unbounded loops (Example 1) and does not need to follow the rigid iteration model enforced by similarly named constructs in a number of more formal languages. C++ (just as modern C) allows variables (Example 2) to be declared in the initialization part of the for loop, and it is often considered good form to use that ability to declare objects only when they can be initialized, and to do so in the smallest scope possible. Essentially, the for and while loops are equivalent. Most for statements can also be rewritten as while statements.
In C++11, an additional form of the for loop was added. This loops over every element in a range (usually a string or container).

## Syntax

Example 2
will print
# C++ Programming/Programming Languages/C++/Code/Keywords/goto

The goto keyword is discouraged as it makes it difficult to follow the program logic, this way inducing to errors. The goto statement causes the current thread of execution to jump to the specified label.

## Syntax

In some rare cases, the goto statement allows to write uncluttered code, for example, when handling multiple exit points leading to the cleanup code at a function exit (and neither exception handling or object destructors are better options). Except in those rare cases, the use of unconditional jumps is a frequent symptom of a complicated design, as the presence of many levels of nested statements.
In exceptional cases, like heavy optimization, a programmer may need more control over code behavior; a goto allows the programmer to specify that execution flow jumps directly and unconditionally to a desired label. A label is the name given to a label statement elsewhere in the function.
A goto can, for example, be used to break out of two nested loops. This example breaks after replacing the first encountered non-zero element with zero.
Although simple, they quickly lead to illegible and unmaintainable code.
is much less understandable than the equivalent:
Gotos are typically used in functions where performance is critical or in the output of machine-generated code (like a parser generated by yacc.)
The goto statement should almost always be avoided, but there are rare cases where it enhances the readability of code. One such case is an "error section".
Example
This construct avoids hassling with the origin of the error and is cleaner than an equivalent construct with control structures. It is thus less error prone.
# C++ Programming/Programming Languages/C++/Code/Keywords/and eq

and_eq is the bitwise and operator. The alternative writing is &.
example:
| variable | bit | hex |
| a | 0011 | 3 |
| b | 0110 | 6 |
| a and_eq b | 0010 | 2 |
# C++ Programming/Programming Languages/C++/Code/Keywords/const cast

The const_cast keyword can be used to remove the const or volatile property from an object. The target data type must be the same as the source type, except (of course) that the target type doesn't have to have the same const qualifier. The type TYPE must be a pointer or reference type.

## Syntax

For example, the following code uses const_cast to remove the const qualifier from an object:
# C++ Programming/Programming Languages/C++/Code/Keywords/explicit

The explicit keyword is used to avoid implicit type conversions.
Here's an example class with a constructor that can be used for implicit conversions:
Here's a simple function that takes a Foo object:
and here's where the DoBar function is called.
The argument is not a Foo object, but an int. However, there exists a constructor for Foo that takes an int so this constructor can be used to convert the parameter to the correct type.
The compiler is allowed to do this once for each parameter.
Prefixing the explicit keyword to the constructor prevents the compiler from using that constructor for implicit conversions. Adding it to the above class will create a compiler error at the function call DoBar(42). It is now necessary to call for conversion explicitly with DoBar(Foo(42))

## References

* ↑ What does the explicit keyword mean?, 2008
# Digital Circuits/Sigma-Delta Modulators

A Sigma-Delta Modulator (ΣΔ modulator) allows to operate Analog to Digital Conversion (ADC) or Digital to Analog Conversion (DAC) by the means of a one-bit signal.
The usage of a single bit signal is also used by Pulse-Width Modulation (PWM), where the Signal-to-Noise Ratio (SNR) is worse but the switching is slower.

## Application

ΣΔ modulation is a good candidate for medium-speed ADC and for very high precision low-speed ADC. Symmetrically, ΣΔ modulation is interesting for signal-level DAC. Compared to PWM, its higher switching speed is redhibitory for high-power (class-D) switching, at least with conventional silicon devices.
ΣΔ modulation is widely used for audio signal conversion and coding.

## Analog model

The most simple (first order) analog-to digital ΣΔ modulator is made out of an integrator and a comparator. The comparator triggers when the integrator output has reached a given level. That signal is sampled, and if it has reached the trigger level, then a given quantity is taken out of the integrator, due to the negative feedback. Having the integrator output stabilized around the trigger value, plus/minus one feedback pulse amplitude, means that the mean number of feedback pulses is proportional the input amplitude.
The digital signal is given as a sequence of pulses whose mean value corresponds to the analog input signal. In order to retrieve a Pulse-Code Modulation (PCM) signal from this bit stream, a lowpass filter is to be used.
If the phase of the result is of importance, then 2 types of filters are of interest:
* the Cascaded Integrator Comb filter (CIC), which is a optimized circuit for calculating a running average
* a filter with a maximally flat group delay such as the Bessel Filter

## Digital circuit
### First Order Modulator

The digital counterpart of the first order analog ΣΔ modulator consists out of an accumulator and a comparator.
The function of this circuit is very similar to the one of the analog modulator. Here too, the output is a bit stream and a full-fledged analog signal requires a lowpass filter to reconstruct a copy of the original digital input signal.
Here, the lowpass filter is analog. A close to linear phase is achieved with the use of a filter with a maximally flat group delay.
When its input is constant, a first order modulator will provide a cyclic pattern. This pattern can become quite long for specific input values, and this leads to low-frequency ringing tones in the modulated signal. As these tones go lower in frequency, they become more and more difficult to separate from the original signal. Higher order modulators show less repetitive patterns and are thus preferred to first order ones.

### Second Order Modulator

A second order ΣΔ modulator will require 2 accumulators. Different topologies are possible. The following circuit shows a typical second order circuit.
The 2 coefficients allow to control the digital to analog transfer function together with the corresponding noise shaping characteristic.
The analysis of the modulator transfer function allows to choose optimal values for the coefficients c$_1$ and c$_2$.
# Digital Circuits/Subtractor

Full Subtractor Circuit
The subtraction of two binary numbers may be accomplished by taking the complement of the subtrahend and adding it to the minuhend. By this method, the subtraction operation becomes an addition operation requiring full adders for its machine implementation. It is possible to implement subtraction with logic circuits in a direct manner. By this method, each subtrahend bit of the number is subtracted from its corresponding significant minuhend bit to form a different bit. If the minuhend bit is smaller than the subtrahend bit, a 1 is borrowed from the next significant position. The fact that a 1 has been borrowed must be conveyed to the next higher pair of bits by means of a binary signal coming out (output) of a given stage and going into (input) the next higher stage. It is same for the half-adder and full-adder, half-subtractor and full-subtractor circuits.
A full-subtractor is a combinational circuit that performs a subtraction between two bits, taking into account that a 1 may have been borrowed by a lower significant stage. The circuit has three inputs and two outputs. The three inputs is denoted by a, b and c which represent
The simplified boolean functions for the two oututs of the full subtractor are derived from the K-maps and can be represented as
D=a'b'c+a'bc'+ab'c'+abc
B=a'b+a'c+bc
# Digital Circuits/Transistor Basics/MOSFET

MOSFET stands for "metal oxide semiconductor field effect transistor". A MOSFET can be of three types p-type, n-type, c-type (complementary type).
# Digital Electronics
## Table of Contents
### Digital Electronics Introduction

Digital Electronics are a form of Electronics that use binary signals represent information.
* Number Base System
* Logic Operations
* Mathematical Operations
* Building Circuits with Breadboards

### Digital Logic Gates

* Logic Gates
** Logic Gates/Fundamental Digital Gates
** Logic Gates/Combinational Gates
** Logic Gates/Basic Logic Gates Summary
* Logic Gates Summary

### Digital Device

* Mathematic and Logic Operations
* Synchronous Device
* Asychronous Device

### Digital Signal Processing

* Digital Data
* Data Encoder
* Data Selector

### Digital Controllers

* Controller Concepts
* Arduino
* Blinking Light

### Communication Standards

* Open Standards
* ANSI
* ISO

## Further reading

* Electronics, Electronics Fundamentals, Electronics Handbook, Electronics Communication
* Circuit Theory, Communication Systems, Signals and Systems
# Digital Circuits/XNOR gate
## Truth Table

| A | B | Q |
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
# Digital Circuits/XOR gate
## Truth Table

| A | B | Q |
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |