OpenLLM-France/wikimedia huggingface dataset:
# PHP and MySQL Programming/PHP Syntax
## PHP tags:
### <?php [code] ?>

* Enclose php code
* Can be configured in the php.ini to be <? ?>, <script language="php"> </script> etc.
* Embedded in normal HTML code
* Within php tags, statements are separated by a ; (generally also followed by a new line).
Example:
* Used if you just want to print out the value of a variable
Example:
Which will output Bobby.
Example:
Which will output something like 2005-11-09 19:40:05.

## Commenting

* Comments out one line
* Example:
* Example:
* Works just as in Java and JavaScript
* Same function as #

### /* (text) */

* Comments out everything between the /* and the */
* Example:

## Variables

➢ Variables in PHP are denoted by the $ prefix.
e.g. : $a = “Hello World”; # this assigns the string “Hello World” to $a.
e.g. : $b = “$a, I'm Ralfe”; # this assigns “Hello World, I'm Ralfe” to $b.
e.g. : $b = $a.”, I'm Ralfe”; # exactly the same as the previous example.
➢ PHP supports dynamic variables.
e.g. : $c = “response”;
e.g. : $$c = “Hello Ralfe”; # this assigns “Hello Ralfe” to $response.
➢ PHP variables do not have to be declared ahead of time, nor do they require a type definition. PHP handles all data type conversions.
e.g. : $a = 4;
e.g. : $b = 12;
e.g. : print “The value of a is $a.”; # Uses a as a String.
e.g. : $c = $a + $b; # $a is now used as an Integer again.
➢ PHP supports boolean variables, which can be assigned either a one or a zero, or a true or false.
e.g. : $a = true;
e.g. : $b = 1;
e.g. : # $a and $b are the same thing!
e.g. : $c = false;
e.g. : $d = 0;
e.g. : # $c and $d are the same thing!

## Operators

➢ Arithmetic Operators
$a = 4;
$b = 2;
// Addition: $a + $b = 6
// Subtraction: $a - $b = 2
// Multiplication: $a * $b = 8
// Division: $a / $b = 2
// Modulus: $a % $b = 0
// Increment: $a++
// Decrement: $a--
➢ Assignment Operators
$a = 4;
$b = $a;
// $b = 4;
➢ Comparison Operators
$a == $b // test if two values are equal
$a != $b // test if two values are not equal
$a < $b // test if the first value is less than the second
$a > $b // test if the first value is greater than the second
$a <= $b // test if the first value is less than or equal to the second
$a >= $b // test if the first value is greater than or equal to the second

## Concatenation

$a = “Fill the halls “;
$b = “with poisoned ivy...“;
$c = $a . $b; # the '.' operator concatenates two variables.
// $c = “Fill the halls with poisoned ivy...”

## Arrays

PHP supports both numerically indexed arrays as well as associative arrays.
$a = array(1, 2, 3, 4);
// $a[0] = 1;
// $a[1] = 2;
// $a[2] = 3;
// $a[3] = 4;
$b = array(“name” => ”Fred”, “age” => 30);
// $b['name'] = “Fred”;
// $b['age'] = 30;

## Decision and Loop Statements

IF THEN ELSE statement
SWITCH statement
FOR statement
FOREACH statement
WHILE statement
DO WHILE statement
# PHP and MySQL Programming/Syntax Overview
## PHP tags:
### <?php [code] ?>

* Enclose PHP code
* Embedded in normal HTML code
* Within PHP tags, statements are separated by a ; (generally also followed by a new line).
Example:

## Commenting

Comments out one line
Example:
Example:
Same function as //

### /* (text) */

Comments out everything between the /* and the */
Example:

## Variables

Variables in PHP are denoted by the $ prefix.
Example:
PHP supports dynamic variables.
Example:
PHP variables do not have to be declared ahead of time, nor do they require a type definition. PHP handles all data type conversions.
* Example:
PHP supports Boolean variables, which can be assigned either a one or a zero, or a true or false.
Example:

#### Helpful Definitions:
##### Equal

    values are equal in value, but may be of differing types. Uses == comparison operator. E.g. false is equal to 0.

##### Identical

    values are equal in value and of the same type. Uses === comparison operator. E.g. false is identical only to false, it is not identical to 0.

## Operators
### Arithmetic Operators

Example:

### Assignment Operators

Example:

### Comparison Operators

Example:

## Concatenation

Example:

## Arrays

PHP supports both numerically indexed arrays as well as associative arrays.
Example:

## Decision and Loop Statements
### If ... else statement

Example:

### Switch statement

Example:

### For statement

Example:

### Foreach statement

Example:

### While statement

Example:

### Do ... while statement

Example:

## Functions

Example:

## Classes

Example:
As of PHP 5.3.3, functions with the same name as the class will no longer act as a constructor. Versions prior to 5.3.3 the
line could be replaced with
to achieve the same effect.
* ↑ http://php.net/manual/en/language.oop5.decon.php
# PHP and MySQL Programming/Database Connectivity

You can only do so much with storing information in files. When you need to store large amounts of data, and perform intensive number crunching on that data, there is nothing better than a good SQL database. In this section, we'll discuss connecting PHP to a MySQL database and perform queries and retrieve data back from the database.

## Opening a Connection to a MySQL Database

The first thing that we need to do before we can interact with any database, is to open up a connection to that database server. This is done by using the mysql_connect function, which returns a database handler, much like a file handler when dealing with files. The database handler is then used to select the active database to use.
Here is the code to setup a connection to the database server, and to select a database to use:
Or

## Creating a Query

Once a connection to a database has been made, you will inevitably want to perform a database query. To create a query on the selected database, we use the mysql_query function. If you use a SELECT query, then the data returned from that query will be passed to the mysql_query function, which will in turn return it to a variable which you can specify. In the following example, two queries are made, the first does not return any data, and the second does.

## Retrieving data from a SELECT Query

There are many methods for retrieving data from a SELECT query.
If we take, for example, the following code:
To now retrieve the data from the $result variable, we can use one of many methods. The recommended method, however, is to sequentially go through each row of the table, storing it into a one-dimensional array. We do this by using the mysql_fetch_row function, passing it the variable into which the result is stored. Here is a simple example:
This will simply output the result in table-like format.
Here is another example of using this method:
The above example, simply splits the results up into multiple one-dimensional arrays, for easy manipulation.

## Closing a Database Connection

It is not always necessary to close a connection when you are finished, but it is advised. It is, however, necessary to close the connection to the database if you want to open up a new connection to a different database.
To close a connection to a database, we use the mysql_close function, as follows:

## Error Handling

It is useful when debugging, and even when you just want to make sure that a database does not behave unexpectedly. Once a query has been created via the mysql_query function, any error messages generated will be stored in the mysql_error function. Here is a sample code snippet to display a error message. However, when there is no error messages, a blank string is returned.
# PHP and MySQL Programming/Introduction
## Welcome to PHP

PHP started off as a collection of Perl scripts used to aid in the maintaining of personal home pages. Hence, it originally stood for "Personal Home Page." However, the language has grown into a huge open source initiative, used by thousands of amateur and professional programmers world wide. It now is officially known as "PHP: Hypertext Preprocessor," which is a recursive acronym (For some strange reason, open source programmers seem to love recursive acronyms).
The reason it is known as a preprocessor and not merely as a processor, is due to the fact that the php files are sent by the webserver to the PHP preprocessor to be processed. the resulting HTML (Hyper Text Markup Language), is then sent across the internet to the web browser requesting the php page.
PHP has traditionally been used for adding dynamic content onto previously static webpages; however, due to the rapid development of the language, it is now used for writing command line tools, and now has GTK bindings allowing the programmer to write GUI applications!
Since the beginning of version 5 of PHP, with the inclusion of Zend Engine II as PHP's foundation, PHP now can be used to write Object Oriented applications.
You can download PHP free of charge (as it is an Open Source programming language) from http://www.php.net
# PHP and MySQL Programming/Introduction to MySQL
## Introduction to MySQL

MySQL, the most popular open source SQL database, is developed and provided by MySQL AB, a commercial company which gets its income from providing services around the MySQL database. The MySQL software delivers a very fast, multi-threaded, multi-user, and robust SQL database server, intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software.
The official way to pronounce MySQL is "My Ess Que Ell" (though in practice many users pronounce it as "my sequel"). Michael ("Monty") Widenius, the creator of MySQL, is unsure where the name originally came from, though he says that it may have come from his daughter My. Two more of Widenius's children, Max and Maria, have also lent their names to MySQL products (MaxDB and the Maria table type respectively).

## MySQL Licenses

The MySQL software is released under the GNU General Public License (GPL), which is probably the best known open source license. The software is provided "as is" and is without any warranty.
The MySQL software has Dual Licensing, which means you can use the MySQL software free of charge under the GPL. You can also purchase commercial MySQL licenses from MySQL AB if you do not wish to be bound by the terms of the GPL.
You need to purchase commercial non-GPL MySQL licenses:
* If you distribute MySQL Software with your non open source software.
* If you want warranty from MySQL AB for the MySQL software.
* If you want to support MySQL development.
# Pinyin/Singer

See also
# Pinyin/Size

A size is how large or small something is.
chiicuhn shih moouwuh d dah-xiaao.
# Pinyin/Singapore

Singapore, officially the Republic of Singapore, is a modern city-state and island country in Southeast Asia. It lies off the southern tip of the Malay Peninsula and is 137km north of the equator. It has an area of 718.3km$^2$ with a population of about 5.5 mln.
Singapore, quánchēng Singapore gònghéguó, Dōngnányà xiàndàihuà chéngshì guójiā hé hǎidǎo guójiā. Zài Malay Bàndǎo nánmiàn, chìdào yǐběi 137km. Miànjī 718.3km$^2$, rénkǒu yuē 550 wàn.
# Pinyin/Situation

Situation is all the circumstances and things that are happening at a particular time and in a particular place.
qirngkuahng shih tehdihng shirjian her tehdihng dihfang fasheng d suooyoou zhuahngkuahng her shihqirng.
# Pinyin/Skill

A skill is a particular ability.
jihnerng shih tehdihng d nernglih.
# People's Tactics/PBEM

There is currently one issue with playing by email. Certain web-mail clients will to corrupt the .pt1 save file. A workaround for this issue is to zip your file before you email it.
# People's Tactics

People's Tactics is a freeware turn-based strategy game and scenario editor programmed by Victor Reijkersz, with graphics by Joshua Ross. The game operates at an abstract tactical level and combines the features of empire-building and war games. This may make the game look daunting at first, but take heart, most of the game's complexities are handled behind the scenes and there are actually very few rules for you to take in to account.
The game play basically breaks down in to two distinct theaters: The home front and the front lines. On the home front, the player must decide which new technologies to pursue, decide which military units to place into production, hire and organize his officer-corps and form new combat units and headquarters. The front-lines sees the player making strategic decisions about the composition of his forces, managing supply lines, maneuvering his armies and formulating the tactics required to defeat his adversaries.
People's Tactics is a game that rewards patience and long-term planning. Solid, consistent victories cannot be achieved with overwhelming force alone, smart tactics are required to win. Enemy units must be isolated, supply lines cut and harbors blockaded if you wish to defeat a larger or equal sized opponent. A smart general will tailor his research and production to most benefit his master plan -- producing a badly organized army, or being forced to disband and restructure often may prove fatal in a close-pitched battle.
An archive of the official website and the community forums can be found at the Wayback Machine.

## Table of contents

* Interface
* Command & Officers
* Supply
* Production
* Units
* Movement
* Combat
* Transfers
* Scenario Editor
** Engine Variables
** Events
** Research
* PBEM
* Shortcuts
Or see the manual all as one file (useful for backing-up):
All Chapters

## Credits

Victor Reijkersz – Programming, game design, scenario design, documentation
Joshua Ross – Graphics, scenario design, documentation
Testing and feedback by:
Koen Fasten, Chris Garden, DavidSHQ and Panzeh
# People's Tactics/Production

Without production, no supply will be produced for your units, nor new troops and equipment. Each town automatically produces supply and sends it to its SHQ, as long as there is a land or sea (using 2 harbours) connection.
Next to this, you can set the production of a town, either to Political Points or to a specific unit type. Any units produced in the town will be delivered to your choice of SHQ (see production screen). The selected SHQ must be within a land supply line to the town, however, having a town sending production to an overseas SHQ will not work. The game will show a little red “N” in the bottom of the town hex to warn you if this situation might occur.
If a town has no reachable SHQ set, even using ports, it displays a little red “NP” in the bottom of the hex indicating that it cannot produce anything since it cannot deliver the production anywhere.
Not every people can produce every unit type depending upon the scenario you are playing.
# Perl Programming/Keywords/push
## The push keyword

The push function treats ARRAY as a stack by appending LIST values to ARRAY. Returns the number of elements in the ARRAY after push is completed.
From Perl 5.14.0 onwards, a scalar EXPRESSION can be passed that should hold a reference to an unblessed array. The argument is dereferenced automatically. This is a highly experimental aspect of push and may change in future Perl versions.

### See also

* pop
* shift
# Perl Programming/Keywords/our
## The our keyword

our makes a lexical alias to a global package variable with the same name and the current package to be used in the current lexical scope, same as my or state. In contrast to these commands, however, our creates an alias to an already existing variable having the same name, and does not create a new one.
If the variable list VARIABLES of our has more than one element, the list has to be placed in brackets.
If more than one our with the same name are declared within the same lexical scope, Perl issues a warning, as it is the case with multiple my declarations, but they are seen as redundant.
An our declaration may have also a list of ATTRIBUTES with it. The exact semantics and interface of TYPE and ATTRIBUTES are still evolving. TYPE is bound to the use of the fields pragma, and ATTRIBUTES are handled using the attributes pragma. Starting from Perl 5.8.0 on, also via the Attribute::Handlers module can also be used.

### See also

* my
* state
# Perl Programming/Keywords/pack
## The pack keyword

pack takes a LIST of values and converts it into a string using the rules defined in the TEMPLATE. The string returned is the concatenation of the appropriately converted values.

### Example
## See also

* unpack
# Perl Programming/Keywords/pop
## The pop keyword

pop pops and returns the last value of the array by shortening it by this element. Returns undef, if the array is empty. If ARRAY is omitted, it pops @ARGV in the main program, and @_ array in subroutines, just like shift.
From Perl 5.14.0 onwards, a scalar EXPRESSION can be passed that should hold a reference to an unblessed array. The argument is dereferenced automatically. This is a highly experimental aspect of pop and may change in future Perl versions.

### See also

* push
* shift
# Perl Programming/Keywords/pos
## The pos keyword

pos returns the offset of the last m//g search left off for the variable in question. If no variable is passed, $_ is used instead. 0 is a valid match offset. An undef indicates that the search position is reset. This may occur due to a match failure or no match has yet been run on this scalar.

### See also

* m
# Perl Programming/Keywords/pipe
## The pipe keyword

The pipe function opens a pair of connected pipes like the corresponding system call. It returns true on success.
A loop of piped processes may result in deadlock. Also, pipes use I/O buffering, so depending on the application, it may be a good idea to set $| to flush the WRITEHANDLE after each command.

### See also

* alarm
* syscall
# Perl Programming/Keywords/print
## The print keyword

print prints a string or a list of strings and returns true, if successful. The parametre FILEHANDLE may be a scalar variable with a reference to the file handle. This introduces a level indirection for the print.
If FILEHANDLE is a variable followed term, it may be misinterpretedby the system as an operator unless a + is added inbetween, or all arguments are put in parentheses. Without the FILEHANDLE, the last selected output handle is used. Without LIST, the function prints $_ to the current output handle.
To use FILEHANDLE and use the $_, a real filehandle like FH and not an indirect filehandle like $fh is required.

### See also

* printf
* select
* sprintf
# Perl Programming/Keywords/printf
## The printf keyword

The printf function is equivalent to print FILEHANDLE sprintf(FORMAT, LIST). The only difference to print is that the output record separator, $\, is not appended. The parametres FORMAT and LIST are parsed as a single list, where fhe first argument is understood as the format information.
If the list is omitted, the contents of $_ is used as format information. To use the printf without a printf, a real filehandler like FH and not an indirect filehandler like $fh is required. In this case, if $_ contains formatting information, it will be replaced by an empty string and a warning will be emitted, if they are enabled. So, it's better to use print when the contents of $_ are to be used as formatting information.
print is simpler and less errorprone than printfǃ

### See also

* print
* sprintf
# Perl Programming/Keywords/package
## The package keyword

The package keyword declares the BLOCK or the rest of the compilation unit within the given namespace. The package scope is given by either the supplied BLOCK or from the declaration through the end of the current scope, which may be the enclosing block, eval, or file. In other words, without BLOCK, the scopes are just like with my, our, and state operators. Only overridden or special identifiers such as ARGV, ENV, and STDOUT that qualify into main:: are exempted.
Only dynamic variables are affected by the package keyword. Lexically-scoped created with my, our, and state are exempted. It is allowed to switch into a package at more than one place, as this only determines which default symbol table the compiler uses for the rest of that block. An identifier prefixed by it's package name can access another package, like $SomePack::var or ThatPack::INPUT_HANDLE. Without the package name, the main package is assumed: $::sail is understood as $main::sail.
With VERSION, the package sets the $VERSION variable in the given namespace to a version object with the provided VERSION. VERSION must be a strict-style version number with at least three components, as defined by the version module, $VERSION should be set only once in a package.

### See also

* my
* our
* pop
* shift
* state
# Perl Programming/Keywords/prototype
## The prototype keyword

The prototype function returns the prototype of a function with the name "FUNCTION" as a string. If FUNCTION is a string that starts with CORE::, the rest is understood as a Perl builtin. If the arguments cannot be expressed by a prototype or the function does not have any, undef is returned. Otherwise, the string describing the equivalent prototype is returned.
From Perl 5.14.0 onwards, a scalar EXPRESSION can be passed that should hold a reference to an unblessed array. The argument is dereferenced automatically. This is a highly experimental aspect of prototype and may change in future Perl versions.

### See also

* pop
* shift
# Programming Fundamentals/Specific Task Functions

A general explanation of specific task functions.

## Prerequisite Material

Critical to this module is the review of two Connexions modules:
* Modularization and Program Layout
* Program Control Functions
You should review these materials before proceeding.

## General Concept

Program Control functions which might have similar identifier names usually perform slightly different tasks in one program to another. Looking at the organizational chart or hierarchy chart for two companies, both might have a vice president of production, but producing automobiles is different than producing ice cream. Similar but different. As you go down deeper into an organization you might find the job title of security guard. Notice that the security guard at the automobile plant and the security guard at the ice cream plant have exactly the same job. In fact, they are most likely interchangeable. Within programming when a task gets specific it might be useable in several programs. The calculation of leap year is a good example. Needed for the verification of dates, is there or is there not a 29th of February for this year. Needed in thousands of programs.

## Specific Task Functions

To create good Specific Task functions you need to do all communication needed via parameter passing. Thus all programs that will use the function will communicate in precisely the same way. In our leap year example, you would communicate into the function the year and the function would return the communication of true or false; meaning it is a leap year and there is a 29th of February (true) or it is not a leap year (false).
The ability to modularize our program into specific task functions means that we can write the specific task function once making sure it works correctly, then reuse it over and over in many programs. As you can guess there is a balance. Most programs will have some program control functions and some specific task functions. The key to deciding if the function should be a specific task function is usually rooted in the uniqueness of the task so that it can be used in many programs. Specific task functions once created are usually placed into a user defined library then shared with others for use in many programs.

## Definitions
### user defined library

    A file containing specific task functions created by individuals to be used in many programs.
# Programming Fundamentals/String Examples CSharp
## References

* Wikiversity: Computer Programming
# Programming Fundamentals/String Examples Java
## References

* Wikiversity: Computer Programming
# Programming Fundamentals/String Examples Swift
## References

* Wikiversity: Computer Programming
# Programming Fundamentals/String Examples C++
## References

* Wikiversity: Computer Programming
# Programming Fundamentals/String Examples JavaScript
## Files

Note: For security reasons, JavaScript in a browser requires the user to select the file to be processed. This example is based on node.js rather than browser-based JavaScript.

### Output
## References

* Wikiversity: Computer Programming