OpenLLM-France/wikimedia huggingface dataset:
# DBI - Perl database interface

There is a comprehensive library of modules for connecting to databases from Perl programs. It is maintained by Tim Bunce and it is called DBI - database interface. The main Website for DBI is http://dbi.perl.org/.

## Installing the necessary modules

To use DBI to connect to a database, you need at least two CPAN modules. One is the main DBI module, simply called DBI. The other one is a DBD - a database driver module. There are DBI drivers for many mainstream database management systems, such as MySQL and Oracle. The examples in this tutorial concern Oracle; accordingly, the database driver for Oracle is called DBD::Oracle.
So, to run the examples in this chapter you need the modules DBI and DBD::Oracle.

### Installing DBI

Installing DBI is straightforward. (For information about installing CPAN modules, see the chapter about CPAN.)

### Installing DBD::Oracle

When installing DBD::Oracle, there are a few things that you need to prepare.

#### Getting the correct version

First of all, when installing DBD::Oracle, make sure that you get a version by Pythian. Pythian maintains DBD::Oracle since version 1.17 (February 2006).

#### Preparing environment variables

You need to create the environment variables ORACLE_USERID and ORACLE_SID. They are needed to test the connection to your database after DBD::Oracle is installed. The value for ORACLE_USERID must be a valid username and password for your database. ORACLE_SID must be set to database name as it appears in TNSNAMES.ORA. On a Unix-like system run:
export ORACLE_USERID="username/password" export ORACLE_SID="DATABASE_NAME"
On Windows, you only need ORACLE_USERID:
set ORACLE_USERID="username/password@DATABASE_NAME"
When you have finished defining these environment variables, install DBD::Oracle from CPAN the usual way.

## Using DBI

Here is a very simple test script to get you going.
# Perl Programming/Data types

Perl has four fundamental data types: scalars, lists, hashes, and typeglobs.

## scalar

    is a funny way of saying a single value; it may be a number, a string, or a reference.

## list

    is an ordered collection of scalars. A variable that holds a list is called an array. Items in a list or array can be accessed by their position in the list; programs can retrieve the first, second, third, etc. item in a list.

## hash

    is like an array, in that a hash holds many values, but the values are identified by a unique "key", rather than an ordinal index position.

## typeglob

    is a variable representing an entry within the internal symbol table. It is used to manipulate file handles, and to create references or aliases.
All variables are marked by a leading sigil, which identifies the data type. The same name may be used for variables of different types, without conflict.
# Perl Programming/Declarations
### Declarations

You don't need to worry about declaring anything in Perl other than report formats and subroutines (sometimes not even subroutines). A scalar variable ($) will hold an undef value until it has been properly assigned a definite value (anything other than undef). When the scalar is used as a number, it will be treated as 0. When used as a string, it will be treated as an empty string "". If you use warnings you will normally be warned when there is an uninitialised value in your code, but not always.
Say for example you had:
This would not raise an error, as it is a boolean value. Boolean values are treated as true or false and do not require to be defined.
A declaration can be put anywhere a statement can and will not affect the overall running of the program. The declarations will be read when the program is being compiled. Typically, however, declarations are commonly defined at the beginning or the end of the program and other developers will appreciate this more than you just randomly declaring them.
Declaring a subroutine allows a subroutine name to be used as if it were a list operator. It is acceptable to declare a subroutine without defining it:
# Perl Programming/Editors and IDEs
### Integrated Development Environments (IDEs)

If you feel up to it, you may want to try using an Integrated Development Environment (IDE). An IDE is a program that provides a workspace for writing and debugging programs. Some programmers find they are more productive with the assistance of an IDE. Using an IDE can also eliminate some of the pain of the command prompt, especially when one lacks experience with the established tools.
This book will make no assumptions about the IDE you are using beyond the capabilities of a basic text editor.
# Oracle Database/Administering Users

Within Oracle, users may be managed through the webpage under the administration section, and within the Database Users subsection.

## Creating and managing database user accounts
### Adding users

New users can be created by an administrator or a user who has a "CREATE USER" privilege using Oracle Enterprise Manager GUI by clicking on the "Create" link in the "Users" section . Enter the username and password for the new user. You can also set the password to expire (where the user must change the password on the next login), and whether an account is locked (to prevent a user from connecting to the system).
In most cases, users should belong to the Connect role. If the user needs to create tables or have more advanced capability, the user should be placed within the Resource role. Database admins should appear in the DBA role. If desired, users may be given individual permissions within Directly Grant Privileges section.
Alternatively, users can also be created using the "CREATE USER" SQL command.
Eg:
After creating the user, the "CONNECT" role needs to be granted for the user to connect to the database.

### Removing users

When a user no longer needs to be present within the database, you click the drop button within the web interface.
To script it:
To remove the attached objects to the user:

## Creating and managing roles

The roles list is available with:
Personalized roles can be created:
Then it's possible to use it with the users:

## Revoking privileges

We can revoke a privilege from a user or a role:

## Modifying privileges

We can change a password with:

## Deleting a role

We can remove a role:

## References

* ↑ https://docs.oracle.com/cd/B14117_01/server.101/b10759/statements_9008.htm
* ↑ https://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_6012.htm
# Oracle Database/Backup and Recovery Concepts
## Recovering from loss of a control file

Using RMAN (the Recovery Manager provided since Oracle 8):
If flash recovery area is configured and control file auto backup is on then:
This will restore the control file to the location specified by the initialization parameter CONTROL_FILES mentioned in initialization parameter.
If flash recovery area is configured and control file auto backup is off then:
This will restore the control file to the location specified by the initialization parameter CONTROL_FILES mentioned in initialization parameter.
If restoration is being done using recovery catalog then:
This will restore the control file to the location specified by the initialization parameter CONTROL_FILES mentioned in initialization parameter.
If no flash recovery area is configured, no recovery catalog is available and RMAN backup piece is available at default location then:
# Oracle Database/Database Interfaces
## SQL*Plus

SQL*Plus is a command interface provided with the DBMS. On Windows it can be launched either from:
* The start menu, Oracle folder, Run SQL Command Line shortcut.
* The path C:\oraclexe\app\oracle\product\11.2.0\server\bin\sqlplus.exe.
* But the best is to use the environment variable and to connect to the DBMS at the same time, with a shell console. By default it can be done with:
Otherwise if you already have an account, the syntax is:
The first step is to create a user (eg: root):
The second allow him to connect and to confer him the necessary privileges:

## Web interface

A second interface is provided with the DBMS: the web interface. It can be accessed from:
* For SE 12c :
** https://localhost:5500/em/shell
* For XE 11g :
** The start menu, Oracle folder, Get Started shortcut.
** The URL http://localhost:8080/apex/f?p=4950.
* For XE 10g :
** The start menu, Oracle folder, Database control.
** http://localhost:1158/em/console/logon/logon.
Then we must connect to the DBMS:
* User name: sys (sometimes sysman for system manager)
* Password: the one chosen during the installation.
* Connect as: SYSDBA.
The console appears after, allowing to modify the database configuration (service restart, architecture, performances, backups...).
By clicking on Application Express, we can optionally create a new connection user account, which will be used to connect to Oracle. Once logged, it can access to some the database manipulation tools, for example SQL Workshop\SQL Commands to enter some SQL code.
Attention: if you create a first account with the GUI, they will need the default SQL*Plus account for GRANT.

## Oracle SQL Developer

Oracle SQL Developer is an IDE developed in Java. It's provided with SE, but for XE the rich client must be downloaded on http://www.oracle.com/technetwork/developer-tools/sql-developer/overview/index.html.
Once installed and launched, we have to set a connection to let it be authenticated on the Oracle databases. Just fill the account created on the web interface, to access to the data manipulation options.
For example by clicking on the top left on New (the plus icon or CTRL + N), we can open an SQL file to begin to execute some code.

## DBCA

Database Configuration Assistant (DBCA) is a graphical interface available on Windows or the *nixes.

## Hello world

Once one SQL console of those seen previously launched, it becomes possible to execute some PL/SQL (Procedural Language/Structured Query Language): the procedural language created by Oracle, and specific to its relational database.
The slash tells the program to stop the multiline instruction.

## References

* ↑ http://www.snapdba.com/2013/05/creating-an-oracle-11g-database-using-dbca-non-asm/
* ↑ http://docs.oracle.com/cd/B16351_01/doc/server.102/b14196/install003.htm
# Oracle Database/Multimedia Databases
## Description

Oracle Multimedia is a services suite provided with Oracle Database (excluding the Express version where it can't be added) since the version 8 (in 1997), to manage the multimedia databases.
It's composed by the package ORDSYS ("ORD" for object-relational data) allowing the multimedia objects management into the database. This package includes several classes:
* ORDMultimedia: abstract superclass storage the common attributes and methods to the classes ORDAudio, ORDImage, and ORDVideo.
* ORDAudio: sound properties storage.
* ORDDoc: heterogeneous properties storage.
* ORDImage: images properties storage.
* ORDVideo: videos properties storage.
* ORDSource: multimedia BLOB or BFILE (accessible in HTTP) properties storage.
* DICOM (Digital Imaging and Communications in Medicine).
Attributes :
| ORDAudio | ORDDoc | ORDImage | ORDVideo |
| description | source | source | description |
| source | format | height | source |
| format | mimeType | width | format |
| mimeType | contentLength | contentLength | mimeType |
| comments | comments | fileFormat | comments |
| encoding | | contentFormat | width |
| numberOfChannels | | compressionFormat | height |
| sampleSize | | mimeType | frameResolution |
| compressionType | | | frameRate |
| audioDuration | | | videoDuration |
| | | | numberOfFrames |
| | | | compressionType |
| | | | numberOfColors |
| | | | bitRate |

## Oracle HTTP Server

Oracle HTTP Server (OHS) allows to execute PL/SQL requests from a navigator. It's a Web Tier component of the Oracle Fusion Middleware, based on Apache 2.

## References

* ↑ "Managing Oracle Multimedia Installations".
* ↑ "Gestion avancée d'image sous Oracle avec Java" (in French).
* ↑ "Common Methods and Notes for Oracle Multimedia Object Types". {{cite web}}: Unknown parameter |site= ignored (help)
* ↑ "Common Methods and Notes for Oracle Multimedia Object Types". {{cite web}}: Unknown parameter |site= ignored (help)
* ↑ Lynne Dunckley, Larry Guros (8 avril 2011). Digital Press (ed.). Oracle 10g Developing Media Rich Applications. {{cite book}}: Check date values in: |date= (help)CS1 maint: uses authors parameter (link)
* ↑ "Medical Imaging and Communication". {{cite web}}: Unknown parameter |site= ignored (help)
* ↑ "ORDAudio". {{cite web}}: Unknown parameter |site= ignored (help)
* ↑ "ORDDoc". {{cite web}}: Unknown parameter |site= ignored (help)
* ↑ "ORDImage". {{cite web}}: Unknown parameter |site= ignored (help)
* ↑ "ORDVideo". {{cite web}}: Unknown parameter |site= ignored (help)
* "Multimedia User's Guide". {{cite web}}: Unknown parameter |site= ignored (help)
# Oracle Database/Introduction

Oracle RDBMS is one of the most used relational database management system. It has been created in 1979 and its request language is called the PL/SQL.

## Installing Oracle

As with most software products, it must be installed; Windows, Linux and Unix versions are available for use, and there are different editions available.
* Express Edition (XE) is free but uses a slightly older version of the Oracle database engine, and has upper RAM and storage limits of 4 GB in mono-processor. It is not available for Unix and needs to register online.
* Standard Edition One removes the basic limitations for storage, and will support multi-cpu systems.
* Standard Edition (SE) provides additional features pertaining to cluster management (Oracle Real Application Clusters, alias Oracle RAC), and may be run on systems containing additional CPUs.
* Enterprise Edition (EE) has no limitations, and may also include optional features that are suitable to large corporations.
* Personal Edition (PE) is not provided for the 12th version. It was a kind of single user Enterprise Edition.
Once downloaded, the .zip file(s) must be extracted, if they are two their folders must be merged (they are named "database"). Then launch to install:
* In Linux, runInstaller.sh.
* In Windows, setup.exe.

### Starting script

Oracle Database launches automatically at each boot, which is useful for a server but slows the system significantly for a PC which isn't supposed to use it in full time. To avoid this we can create a simple script to launch and stop Oracle manually:
* In Linux : remove Oracle from the daemons (eg: /etc/init.d).
* In Windows : execute services.msc, and toggle the services OracleServiceXE and OracleXETNSListener in manual start. When you need to use Oracle, launch as an administrator, the following script Oracle.cmd:
** For the XE version: net start OracleServiceXE net start OracleXETNSListener pause net stop OracleXETNSListener net stop OracleServiceXE
** For the SE version: net start OracleServiceORCL net start OracleDB12Home1TNSListener pause net stop OracleDB12Home1TNSListener net stop OracleServiceORCL
If the message "Access denied" occurs, relaunch the script with a right click, as an administrator.

### Identifying system requirements

The database server needs at least:
* 1 GB free space on a hard drive for XE, 3.5 for SE.
* 1 GB RAM.
* Windows, Linux, Oracle Solaris, or IBM AIX.
Since the version 12c, a 64 bits processor is mandatory.
The environment variables settings are automatic.
The system objects naming follows the Optimal Flexible Architecture (OFA).

## References

* ↑ http://db-engines.com/en/ranking
* ↑ https://docs.oracle.com/html/B13614_01/preinsta.htm#i1067829
* ↑ https://docs.oracle.com/cd/E11882_01/install.112/e47689/appendix_ofa.htm#LADBI1381
# Oracle Database/Managing Data
## Using Data Pump to import data

SQL Dump should either Exports in CSV or Plain SQL Format.
# Microsoft SQL Server/Configuring Mail

First of all: SQL Server Mail does not depend on Extended Mapi.
Prerequesites for Database Mail:
* Database Mail has to be enabled via the Surface Area Configuration Tool, Database Mail Configuration Wizard or the sp_configure.
* Service Broker needs to be enabled in the Database Mail host database msdb
* The Database Mail externals executables need access to the SMTP Server

## Architecture

Four Components: Configuration Component, Messaging Component, Database Mail executable, Logging and auditing component.
The configuration components consists of a database Mail account and a Database Mail profile. The Database Mail account contains the information that SQL Server uses to send e-mail messages to the SMTP server, such as the SMTP server name, the authentication type, and the e-mail address.

## References

* ↑ https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/database-mail-xps-server-configuration-option
# Microsoft Project Crash Course

Welcome to the Microsoft Project Crash Course. This text book will provide you with what you need to know to get started on MS Project quickly!
The book is divided into levels which progressively elaborate on recurring topics. It's suggested that you first read and apply level 1 on all topics before you move onto the next level.

## Level 1
### Working with tasks

* Creating a basic schedule
* Document progress and update forecasts
* Displaying data effectively using views and tables
* Sorting, grouping and filtering data

## Level 2
### Working with resources

* Capturing the project resources
* Making basic assignments

### Working with tasks

* Document progress and update forecasts
# Microsoft SQL Server/Connecting to MS SQL Server from *nix

This tutorial assumes you are using a Debian-based distribution of Linux; if not, you might have to modify the instructions appropriately for your distro.

## Downloading

To install both freetds and the drivers for iODBC and unixodbc use apt-get, i.e.,
If you plan to use iODBC, you'll want to run
If you're using Perl, after you install FreeTDS you'll want to install the DBD for Sybase:

## Glossary
### TDS

    Designed by Sybase, the Tabular Data Stream Protocol (TDS) describes how to communicate with MS-SQL and Sybase databases.

## Troubleshooting

Many of the errors here are to assist those with Google searches and the users.

### Failing to set SYBASE

The following error is a result of not setting the Sybase configuration variable

## External Links

* iODBC
* FreeTDS

## References

* Haynes, Tim (2004-03-23). "ODBC-Perl HOWTO". OpenLink Software. Retrieved 2008-03-04.
* Bruns, Brian (2006). "FreeTDS User Guide: A Guide to Installing, Configuring, and Running FreeTDS". Retrieved 2008-03-04. {{cite web}}: Unknown parameter |otherauthors= ignored (help)
# Microsoft SQL Server/Functions
## min, max

The functions Min and Max respectively return the minimum and the maximum of one field list.

## cast

Modify a variable type:

## convert

Modify a variable type in first parameter, and its length in second.
Attention: all the variable types are not compatible between them.
Problem examples:
Dates are not systematically recognized without convert. The solution is to store them in the datetime format:
On the other hand, if an above paragraph date is stored in varchar with slashes, it becomes mandatory to reformat it to be able to compare.
Numerous date formats are available.

## left, right, and substring

Allow to cut strings according to some of their characters positions.
For example with the slashes date case above:

## replace and stuff

Search and replace: allow to replace some string characters according to their values.
For example, to update a given folder path :

## isnull

Returns true the variable is null.

## Dates
### Date format

The function GETDATE is used to get the current date. To get another date in the good format, it's necessary to use CONVERT:

### Date cut

The function DATEPART extracts a date part without specifying manually its position.
However, three functions allow to accelerate these extractions writing:

### Days addition and subtraction

Herewith two dates manipulation functions:
* DATEDIFF calculates the interval between two dates.
* DATEADD returns the date resulting from another plus an interval.
Example:
gives:

## References

* ↑ man CONVERT
* ↑ http://stackoverflow.com/questions/74385/how-to-convert-datetime-to-varchar
* ↑ man SUBSTRING
* ↑ man STUFF
* ↑ man REPLACE
* ↑ man DATEPART
* ↑ http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/
* ↑ man DATEDIFF
* ↑ man DATEADD
# Microsoft SQL Server/Database manipulation
### Creation

To create a database, its files have to be defined:
* Master Database File (.mdf)
* Log Database File (.ldf)

### Reading

Then to select it, it's either possible to set it at the beginning of the script:
or to call all the objects with their full path. Eg:

### Restoration

If the database to restore doesn't exist on the destination server, it's necessary to create it empty first. In SSMS, with a right click on Databases, New database.
The process is a right click on the database to restore, and Restore the database, select the .bak.
Otherwise in SQL it gives:
# Microsoft SQL Server/Best Practices

* Always qualify objects by owner.=
* Use query "with (nolock)" when you don't require high transactional consistency.
* Do not use GOTO.
* Avoid CURSOR use because it's significantly slower. If necessary, always declare the correct type of cursor (FAST_FORWARD).
* Avoid SELECT INTO for populating temp tables. Create the table then use INSERT SELECT.
* Always use ANSI join syntax.
* Always check for object existence.
* Use SCOPE_IDENTITY instead of @@IDENTITY.
* Always check @@TRANCOUNT and commit/rollback as necessary.
* Order DML to avoid deadlocks.
* Always check @@ERROR and @@ROWCOUNT by assigning to a variable.
* Always check sp return values.
* Do not create cross-database dependencies.
* Avoid table value UDF – performance problems.
* Avoid dynamic SQL – if necessary use sp_executesql over EXEC.
* Avoid using NULL values.
* When there are only two values, ISNULL is more efficient than COALESCE.
* Always specify columns; try to avoid "SELECT *". Exceptions include these two cases: "WHERE EXISTS (SELECT * ...)" and aggregate functions.
# PWCT/Lessons/Firstapp
## Creating your first application using PWCT

1. Run PWCT
2. From the menu bar select "File" then "New"
3. Select the template "Console Application without coding"
4. Determine the visual source file name, for example Hello.SSF
5. from the components browser window, select the domain (Print Text) then select the component (Print Text to console) then click OK button or press CTRL+W
6. In the interaction page (data-entry form), type the text then click OK button or press CTRL+W
7. Now we see a new step added to the program, Press CTRL+R to run the application
# PWCT/Lessons/Projects
## Open Source Projects

Open source projects developed using PWCT
* Critical Nodes, Free Open Source Implementation of a new Localized Algorithm for detection of Critical Nodes.
* Smart POS System, Sales management software.
* Supernova programming language, Scripting language presents the concept of programming with direct Fiction Description using Clear subset of pure Human Language.
* People Counter, Simple Client-Server application for People Counting
# PWCT/Lessons/Resources
## Resources available to use in PWCT

There are many samples, tutorials and movies to learn PWCT.
* Online Documentation
* Tutorials and Samples
* PWCT Movies
* PWCT Blog
* PWCT Forum
* PWCT Page (facebook)
* PWCT Group (facebook)
* Free remote-learning in Arabic language