OpenLLM-France/wikimedia huggingface dataset:
# XRX/Save File Dialog
## Motivation

You want to allow the user to save form data into a named file in an eXist collection that will not conflict with existing files.

## Method

When the user selects a Save button we will use switch/case to open up a save dialogue. In this dialogue we will list all of the current files in a collection and allow the user to create a new file with a name that does not conflict with any existing file names. If the user selects a file from the list, we will replace the current file name with that file name.

## Using the get-child-resources Function

eXist provides a function that lists the files in a collection. You can get a sorted list of all the files in a collection with the following XQuery
When executed, this XQuery will return the files in a collection. For example here is the URL of an XQuery execution with the collection parameter passed as an argument:
list-files-in-collection.xq?collection=/db/rss
We can then use this XML listing to display a list of existing files and allow the user to select a name that is not on this list.

## Discussion

Back: Move a Resource • Next: Login and Session Management
# XRX/Product Ratings
## Motivation

You want a method for creating a rating system for items, such as a five-star rating for a product or service.

## Method

Each registered user in a system can rate items. A separate collection associates users with ratings. Ratings can be placed anywhere in a form and can associate a user to an item and that association has a numeric value of 1 to 5. Items can then display their average user rating.

## References

Sample Drupal Five Star rating system created with JQuery
Back: NIEM Services • Next: Business Rules Template
# XRX/Selection List Generator
## Motivation

You want to store all your code tables in a central location and have each form dynamically generate selection lists from these code tables.

## Method

We will create a very simple XML file format to store all our codes. We will store one code table per file and then write a simple XQuery that goes through all these files to build a sample selection list. This selection list will create an instance in the model to hold each selection list value. It will also populate the instance with the first value in the list.
In our sample, we will assume an XRX file naming standard such as /db/apps/app-name/code-tables/my-code-table.xml where each application contains its own code tables for maximum application portability between systems. Applications that share code tables can store these in a location such as /db/shared/code-tables/my-code-table.xml

## Sample XQuery

This query goes through all the files in the XRX application code-tables collection and looks for XML files that have code-table as the root element. It then creates a report that contains all the selection lists inside a working XForms application.
Note that this XQuery uses element constructors to create element names in the instance. It also uses the *:name notation to put data from the null namespace directly into the XForms namespace.
This file also puts the definition of the element directly into the hits of the XForms application. Under some XForms applications such as Firefox the hint appears in a floating ephemeral mode display in the left margin of the form.

## Sample CSS File

Here is the block-form.css file that can be used to make each selection appear on a separate line:
Back: File Locking • Next: Glossary Term Editor
# A Guide to the GRE/Math
## Introduction to GRE Math

The GRE tests only basic math universal to high school curricula. The exam generally does not test any math beyond high school geometry; there is no trigonometry or calculus on the test. Its math can be broken into essentially four categories.

### Math Operations

The GRE frequently tests knowledge of these mathematical concepts such as the rules of radicals, exponents, absolute value, positives, negatives, and inverses.

### Algebra

Algebra refers to the use of variables and equations to solve problems, such as by substituting a letter-value for an unknown. The GRE heavily tests algebra, particularly in problems involving rates or proportions.

### Geometry

Geometry refers to the variety of rules used to calculate attributes of lines and shapes. The GRE tests a great deal of geometry, especially triangles, squares and circles.

### Data Interpretation

Every GRE math section has a section of questions based on a chart, designed to test data interpretation skills. Many of the other questions test statistical concepts such as averages and standard deviation.
# Miscellaneous Passages

The GRE will also throw in more unusual topics on occasion.
1. How did the corporation originate?
2. How was the corporation as allowed by law in the United States, beginning in New Jersey, different from the original corporation used by the British?
3. What differences between Britain and the United States prompted this difference and change in the nature of a corporation?

## Answers to Practice Questions

1. According to the passage, corporations originated as royal charters by the British Crown to manage economic affairs in various parts of the world. This is explained on lines 6-12, which give examples of the Hudson's Bay Company and the British East India Company.
2. New Jersey's law allowed corporations to be created voluntarily by individuals, as opposed to formed by an act of the government. It thus differed from traditional English law in this regard.
3. As explained in lines 13-20, the economic expansion of the United States was primarily domestic, and thus the British model was of little use to Americans, who sought to have business entities to regulate things internally. Accordingly, the corporation which evolved under American law was one which private individuals could form to manage their affairs, with the permission and protection of the state.
# A Guide to the GRE/Order of Operations
## Order of Operations

The order of mathematical operations is parentheses, exponents, multiplication and division, and finally, addition and subtraction.
The acronym is “Please Excuse My Dear Aunt Sally.”
Within these categories, it doesn't matter which operation is performed first. Init doesn't matter whether 6 is divided by the 7 first or multiplied by the 8 first; the result will be the same. However, with parentheses, the interior parentheses must be worked out prior to working out any exterior parentheses. 2(3(4 + 5)) requires adding the 4 and 5 before multiplying the result by 3.
“Divide bars” operate as parentheses.
Inthe 6 and 7 are added first, unlike inor a similar expression.

### Practice

1. What is the value of?
2. If= 45 then what does q equal?
3. If 5(6$^2$)(3 + 2) = 5 + e, what is the value of e?

### Answers to Practice Questions

1. 6
Subtract the 2 from the 3 first, then multiply the 5 by the 1, then add the 4 to the 5. Multiply the 6 by the 9, then divide by 9 to arrive at 6.
2. 13
Start with the initial equation.
Work out the parentheses.
Multiply both sides by 7.
Expand the parentheses.
Subtract 24 from both sides.
Divide both sides by 3. q is 13.
3. 895
5(6$^2$)(3 + 2) = 5 + e Start with the initial equation.
5(36)(5) = 5 + e Work out the operations inside the parentheses.
900 = 5 + e Multiply the parenthetical amounts together.
895 = e Subtract 5 from both sides. e is 895.
# Other Shapes
## Rules

A polygon's angles add up to 180º plus an additional 180º for every side over 3.
The angles of a pentagon add up to 540º.
The angles of a enneakaidecagon add up to 3060º.
(An enneakaidecagon is a figure with 19 sides). Polygons other than triangles and quadrilaterals are rare on the GRE; when they do appear, they are typically shapes which employ a combination of triangles and quadrilaterals.

## Practice

1. In the figure to the left, angles a, d, h, and e are each equal to half of the measures of each of angles b, c, g, and f. What is the measure of angle a?
2. How many degrees do the angles of a 102-sided figure add up to?
3. The angles of a particular polygon add up to 2340º. How many sides does the polygon have?

## Answers to Practice Questions

1. 90º
The angles of an octagon add up to 1080º. Since a, d, h, and e are equal and are each half of the b, c, g, or f, then it can be inferred that 4(a) + 4(2a) = 1080º. This means that 12a = 1080º and that a is equal to 90º.
2. 18,000º
A polygon has 180º plus an additional 180º for every side over 3. Thus, the angles of a 102-sided figure equal (102-2)180º or 18,000º.
3. 15
A polygon has 180º plus an additional 180º for every side over 3. Thus, the question can be solved using algebra. Let n equal the number of sides of the polygon.
(n -2)180º = 2340º Take the initial equation.
180ºn - 360º = 2340º Expand the parentheses.
180ºn = 2700º Add 360º to both sides.
n = 15 Divide both sides by 180º.
The polygon has 15 sides.
# A Guide to the GRE/Least Common Multiple
## Least Common Multiple

The least common multiple of two numbers is the number that contains all of each's prime factors in the appropriate quantities, but nothing more.
For instance, the least common multiple of 12 and 15 is 60.
12 15
The prime factorizations of 12 and 15 are 2(2)(3) and (3)(5). Their least common multiple is 2(2)(3)(5), or 60. The numbers share a prime factor, 3.
If numbers do not share any prime factors, the least common multiple is the product of the two numbers. For instance, the least common multiple of 7 and 12 is 84.
If numbers share all of the same factors, such as 16 and 32 (which are 2(2)(2)(2) and 2(2)(2)(2)(2), respectively), the least common multiple is the greater number.

### Practice

1. What is the least common multiple of 20 and 15?
2. If the least common multiple of two numbers is 36, and one of the numbers is 9, what is the other number?
3. The least common multiple of 14 and 16 is how much greater than the least common multiple of 5 and 12?

### Answers to Practice Questions

1. 60
20 15
The prime factorization of 20 is 2(2)(5), while the prime factorization of 15 is (3)(5). Their least common multiple will thus be 2(2)(3)(5) - the number which contains all of the prime factors of each in the appropriate quantities, but nothing more. The numbers share a common factor - 5 - thus, the 5 need not be repeated.
2. 4
36
The prime factorization of 36 is 2(2)(3)(3). The prime factorization of 9 is 3(3). Since 36 is the least common multiple of 9 and the other number, this other number must be 2(2), or 4, since the least common multiple of two numbers is the number which contains the prime factors of each in the appropriate quantities, but nothing more.
3.
14=7(2)
16=2(2)2(2).
LCM of 14 and 16 → 7(2)2(2)2 = 112.
5=5
12=3(2)2.
LCM of 5 and 12 → 2(2)3(5) = 60.
112-60=52.
# A Guide to the GRE/Odds and Evens
## Odds & Evens
### Adding & Subtracting

An odd plus an odd equals an even.
5 + 7 = 12 = even
An even plus an even equals an even.
6 + 4 = 10 = even
An odd plus an even equals an odd.
6 + 5 = 11 = odd

### Multiplying & Dividing

An odd multiplied by an odd equals an odd.
5(5) = 25 = odd
An odd multiplied by an even equals an even.
5(2) = 10 = even
An even multiplied by an even equals an even.
4(8) = 32 = even
When in doubt, test this with two known numbers. If unsure, try 1 + 3 or (2)(5) and see what type of number it yields.

### Practice

1. xy is even and xz is odd. Is y odd or even?
2. a + b + c is even. If a is odd, then could b and c be
both odd?
both even?
odd and even?
3. (f + g)h is an odd number. If f is even, is g + h odd or even?

### Answers to Practice Questions

1. y must be even.
The product of two numbers is only odd if both numbers are odd. Since xz is odd, both x and z must be odd. However, xy is even. This means that between x and y, one must be even. Since x is odd, y must be even.
2. b and c must be odd and even, not necessarily in that order.
An odd plus an odd equals an even, as does an even plus an even. Only an odd plus an even equals an odd. Since a + b + c is even and a is odd, b + c must be odd. This means that, between b and c, one must be odd, and one must be even. If they were both odd or even, b + c would be even, meaning a + b + c would be even, but it isn't.
3. g + h must be even.
Only an odd and another odd multiply to make an odd. Therefore, since (f + g)h is odd, f + g must be odd. Since f is even, g must be odd, since only an even and an odd add up to an odd. h also must be odd, since it multiplies to make an odd. Therefore, since an odd plus an odd equals an even, g + h must be even.
# Mean, Median & Mode

The GRE frequently tests the three different mathematical averages, known as the mean, median, and mode.

## Rules

The “mean” is the sum of all elements divided by the number of elements in the set.
The “median” is the middle number in a series. If there are two middle numbers, the median is halfway between them.
The “mode” is the number that appears the most frequently.
“Average” is a term used for various data measures to determine what is “normal” in a series of numbers. For example, suppose in four quarters of a basketball game, the basketball team scores 14, 15, 14, and 13 points. The median number of points scored is 14 - the middle number. The mode is also 14.
As mentioned above, "mean" is calculated by adding all the numbers together and dividing by the number of elements in the set. For example the numbers 6, 10, and 20, would have a mean value of 12. (6 + 10 + 20 = 36, divided by 3 = 12)
“Mean” as used on the GRE refers to “arithmetic mean.” There is also a concept called “geometric mean” which the appropriate root of the product of all the numbers. It is not tested on the GRE.

## Practice

1. Four friends each spend money at a shoe store. Andy spends $145, Becky spends $122, Carla spends $140, and Donald spends $182. What is the median expenditure on shoes?
2. H&T Holdings' stock portfolio had a value of $1.1 million in February, $1.5 million in March, and $1.6 million in April. What was the average (arithmetic mean) value of H&T's stock portfolio over these months?
3. Erin works 14 overtime hours during week 1, 16 overtime hours during week 2, and 17 overtime hours during weeks 3 and 4. Which is greater - the median overtime hours Erin worked, or the arithmetic mean of overtime hours that Erin worked?

## Comments

The GRE likes to ask questions which test the nuances of the rules, such as what the median is in an even-numbered set. The test will also commonly scramble numbers and ask the test taker to pick out the median or mode - in which case sorting the numbers numerically can be useful.
A commonly asked question is what the "mode" is in a series where two numbers both show up an equal number of times. The answer from a statistical perspective is that both of these numbers are modes (this is known as a multimodular dataset). However, the answer from a GRE preparation perspective is that this is not tested on the GRE.

## Answers to Practice Questions

1. $142.50
The median is the middle number, or halfway between two middle numbers.
The numbers are $122, $140, $145, and $182; thus, the median is $142.50 - halfway between $140 and $145.
2. $1.4 million
Mean is the sum of all values divided by how many values there were.
= $1.4 million
3. The median is greater.
The median is the middle number, or halfway between two middle numbers. The three numbers in this case are 14, 16, and 17; thus, the median is 16.
Mean is the sum of all values divided by how many values there were. The mean in this case is thus:
# A Guide to the GRE/Lines and Angles
## Lines & Angles

Opposite angles are equal. Adjacent angles on a line add up to 180º.
* Angles n and p are equal.
* Angles q and o are equal.
* Angles n and o add up to 180º.
* Angles o and p add up to 180º.
* Angles p and q add up to 180º.
* Angles q and n add up to 180º.
A line intersecting two parallel lines forms the same angles with each.
Parallel lines are those which are a constant distance apart. A line intersecting them is known as a “transversal.”
Assume both sets of lines are parallel; therefore:
* Angles f and g are equal.
* Angles h and i add up to 180º.
* Angles f and h are equal.
* Angles g and i add up to 180º.

### Practice

1. In this figure, both pairs of lines are parallel, and w is 10º greater than u. What are the measures of angles t, u, v and w?

### Answers to Practice Questions

1. t, u, v, and w have measures of 95º, 95º, 85º, and 95º, respectively.
Because lines make the same angles through any parallel lines they intersect, angle w is identical to angle v as well as the angle directly opposite t. Because opposite angles are equal, angles t and w are equal.
All three of these angles are equal to either of the angles adjacent to angle u along the line (either the line running from t to u or from v to u); thus u + v = 180º. Since w = u + 10º, we can solve for u.
u + v = 180º Take the initial equation.
u + (u + 10º) = 180º Substitute for v in terms of u.
2u + 10º = 180º Add the variables.
2u = 170º Subtract 10º from both sides.
u = 85º Divide both sides by 2. u is 85º, making the other three angles 95º.
# A-level Physics (Advancing Physics)/Signal Frequencies

The frequency of a wave describes how many waves go past a certain point in one second. Frequency is measured in Hertz (usually abbreviated Hz), and can be calculated using the formula:
V = fλ
where V is the velocity of the wave (in ms$^{−1}$), f is the frequency of the wave (in Hz), and λ (the Greek letter lambda) is the wavelength of the wave (distance from one peak / trough to the next, in m).

## Multiple Frequencies

Let us consider the following signal (time is in ms, and the y-axis represents volts):
This signal is constructed from a number of different sine waves, with different frequencies, added together. These sine waves are as follows:

## Frequency Spectra

Each of these sine waves has a different frequency. You can see this, as they have different distances between their peaks and troughs. These frequencies can be plotted against the amplitude of the wave, as in the table, and chart drawn from it, below:
| Wave (y=) | Period (ms) | Amplitude (V) | Frequency (Hz) |
| 3sin x | 6.284 | 3 | 159 |
| sin(0.5x + 40) | 12.566 | 1 | 80 |
| 2sin(3x - 60) | 2.093 | 2 | 478 |
This chart is known as the frequency spectrum of a signal.

## Fundamental Frequency

The fundamental frequency is the lowest frequency that makes up a signal. In the above example, the fundamental frequency is 80 Hz. It is always the frequency farthest to the left of a frequency spectrum, ignoring noise. Other frequencies are known as overtones, or harmonics.

## Questions

1. What is the frequency of an X-ray (wavelength 0.5 nm)?
2. A sound wave, with a frequency of 44 kHz, has a wavelength of 7.7mm. What is the speed of sound?
3. What is the fundamental frequency of the following signal?
4. Approximately how many harmonics does it contain?
5. The three sine waves sin x°, 4sin(2x-50)° and 0.5sin(3x+120)° are added together to form a signal. What are the frequencies of each of the waves? What is the signal's fundamental frequency? Assume that the waves are travelling at the speed of light, and that 60° = 1mm.
Worked Solutions
# A-level Physics (Advancing Physics)/Semiconductors

A semiconductor has a conductivity between that of a conductor and an insulator. They are less conductive than metals, but differ from metals in that, as a semiconductor heats up, its conductivity rises. In metals, the opposite effect occurs.
The reason for this is that, in a semiconductor, very few atoms are ionised, and so very few electrons can move, creating an electric current. However, as the semiconductor heats up, the covalent bonds (atoms sharing electrons, causing the electrons to be relatively immobile) break down, freeing the electrons. As a result, a semiconductor's conductivity rises at an increasing rate as temperature rises.
Examples of semiconductors include silicon and germanium. A full list of semiconductor materials is available at Wikipedia. At room temperature, silicon has a conductivity of about 435 μS m$^{−1}$.
Semiconductors are usually 'doped'. This means that ions are added in small quantities, giving the semiconductor a greater or lesser number of free electrons as required. This is controlled by the charge on the ions.

## Questions

1. What is the resistivity of silicon, at room temperature?
2. What sort of variable resistor would a semiconductor be useful in?
3. If positive ions are added to silicon (doping it), how does its conductivity change? Worked Solutions
4. What is a practical application of a Semi-Conductor?

## See also

* The book on Semiconductors.
# A-level Physics (Advancing Physics)/Sensors/Worked Solutions

Note to the reader: I am not entirely happy with the answers given on this page. --Sjlegg (talk) 15:01, 19 December 2007 (UTC)
An LDR's resistance decreases from a maximum resistance of 2kΩ to a minimum resistance of 0Ω as light intensity increases. It is used in a distance sensing system which consists of a 9V power supply, a 1.6 kΩ resistor, the LDR and a multimeter which displays voltage to 2 decimal places measuring the potential difference across one of the two resistors.
1. Across which resistor should the multimeter be connected in order to ensure that, as the distance from the light source to the sensor increases, the potential difference recorded increases?
As light intensity increases, distance decreases. So, as distance increases, light intensity decreases. As light intensity decreases, the LDR's resistance increases, as does the potential difference across it. So, as distance increases, the potential difference increases. Since we want the potential difference to change in the same direction as the distance, the multimeter must go across the LDR, not the resistor.
2. In complete darkness, what voltage is recorded on the multimeter?
The voltage is split between the 1.6kΩ resistor and the LDR, which currently has a resistance of 2kΩ. Therefore, the potential difference across the LDR is:
$V={\frac {2}{2+1.6}}\times 9=5V$
3. When a light source moves 0.5m away from the sensor, the voltage on the multimeter increases by 2V. What is the sensitivity of the sensing system when using this light source, in V m$^{−1}$?
$S={\frac {2}{0.5}}=4{\mbox{ Vm}}^{-1}$
4. When the same light source is placed 0m from the sensor, the potential difference is 0V. When the light source is 1m away, what voltage is displayed on the multimeter?
Assuming a linear relationship between distance and potential difference, we know that:
$0.25={\frac {m}{V}}$
Hence:
$V={\frac {m}{0.25}}={\frac {1}{0.25}}=4V$
5. What is the resolution of the sensing system?
The multimeter measures to 2 decimal places, so the smallest measurable voltage is 0.01V.
$0.25={\frac {m}{V}}$
Hence:
$m=0.25\times V=0.25\times 0.01=0.0025{\mbox{ m}}=2.5{\mbox{ mm}}$
6. Draw a circuit diagram showing a similar sensing system to this, using a Wheatstone bridge and amplifier to improve the sensitivity of the system.
7. What is the maximum potential difference that can reach the amplifier using this new system (ignore the amplification)?
The maximum potential difference will occur when the LDR has no resistance. This will result in 9V on the left-hand side of the voltmeter, and 5V on the right-hand side. The difference is 4V.
8. If this signal were to be amplified 3 times, would it exceed the maximum voltage of the system? What would the limits on the signal be?
$4\times 3=12V>9V$
The signal would be limited to the range -9V < V < 9V.