OpenLLM-France/wikimedia huggingface dataset:
# JSON/Introduction
## What is JSON?

JSON is short for "JavaScript Object Notation. It is not a programming language, but a markup language, just like XML. It is made for quick lightweight data exchange from the server to the client, and is not to make apps, but to supplement them. Unlike XML, JSON is much more lightweight. It is based off JavaScript, but can be read by virtually any programming language that exists, since hundreds of libraries exist. A JSON file is simply a list of variables of data.

## How this book will work

Nice and short, this book will be divided into a few sections to go over each part. Due to the nature of JSON, it will be very easy to learn. At the end of this book will be a section with a few exercises. There shall be pictures of the code etc. throughout to show real examples of JSON code. Each page has a header, short introduction, the relevant pictures and information for the section, links to the previous and next sections, and links at the bottom for references and further reading. All source code written in this book will be formatted as so.
Note: Contributors must please follow this structure mentioned above.

## What can JSON be used for?

JSON is used mainly for web applications, to exchange quick bits of data in a single file. This is not limited to websites, but also online games, for example. It can also be used for other purposes, like for an application to store its settings in a lightweight file. Or, perhaps, it can be used by a game to store a player's data. All types of JavaScript variables are usable here, from integers to arrays.

## How does JSON work?

JSON data is stored in a file, which is left as is. It is not compiled into binary code, just left as is. This is the nature of any markup language, not just JSON. It is up the application to open the file, scan the text and pick out the data it needs, and change whatever it needs to change. A developer would use a 'parser library' to do the work of scanning the text and loading certain variables into memory for the application to use. Variables, such as integers are created here and stored in the file. JSON files end with ".json" and are stored wherever the application needs it to be.

## Is JSON difficult?

Absolutely not. JSON, for starters is human-readable, so it is easy to get the understanding of it quickly. Syntax is simple and based on JavaScript. It helps to know JavaScript, since JSON is JavaScript. It takes only a day to learn, really, even if you don't know JavaScript.

## Are there any prerequisites?

Yes. You need to actually know and understand a programming language, since JSON is only there to complement your application, not make it. You will need a code editor to continue, like Atom or Visual Studio Code, though any text editor like Notepad will do. You can download both Visual Studio Code and Atom for free. Finally, for whatever programming language you use, you need a parser library to continue.

## References

* Wikipedia - JSON

## Further reading

* XML
* Markup language
* JavaScript
# Jakarta EE Programming/EJB-QL

EJB Query Language is used to define what a finder method of an Entity bean should return. The EJB 1.1 specification offered no way to query entity beans. It resulted in different query languages for different application servers. When Sun published the EJB 2.0 specification it added a query language to find entity beans more easily.

## Basic Syntax

Both SELECT_CLAUSE and FROM_CLAUSE must be used but WHERE_CLAUSE is optional.

## Finder methods

Finder methods are used to return a single or multiple Entities from the storage. The finder method is defined in entity's home interface. The return value of a finder is the beans remote interface or a collection of entity beans implementing the remote interface which were found.

### Basic finder method

The simplest possible EJB-Query would be one which return all Entities in a given table.
As you can see, the EJB-Query looks nearly the same as a standard SQL query, although it's not the name of the tables but the name of the EJB classes and it's not the name of the columns but the name of the EJB properties. The only difference is the terminal object(o) which is equivalent to: take all columns of a given row and transform the result into an entity bean instance.

### Finder method with WHERE clause

Look at the example above. It differs from the finder method above only that a conditional for the players which should be returned is added.
This finder method returns all Players which play at the position which is entered by parameter one. If you have more than one parameter you can use them in your query with ?2, ?3 and so on.

### Finder method which operates on relation

EJB Query differs from SQL especially if you want to use different relational tables.
This query return all players whose team plays in the city given with parameter one. In other words: return all Players who play in the team which is situated in a given city.

## Select methods

In opposite to finder methods select methods might return a persistence field or other entity beans. So it's possible to define a select method which returns a primitive data type instead of a complete object.
# JSON

JSON or JavaScript Object Notation is an open-standard format for data exchange. It is used for mainly web applications to exchange data with the end-user's browser on-the-fly.

## Sections

* Introduction
* Syntax
* Data types
* Parsing in JavaScript and using in your web applications
* Using with other languages
* Exercises

## External links

* JSON homepage
# Jakarta EE Programming

Jakarta EE was renamed from Java EE (Java Platform, Enterprise Edition) and J2EE (Java 2 Platform, Enterprise Edition). This book will describe how to build Jakarta EE based applications. The implementation is done with the help of XDoclet which simplifies the process of building an application.

#### Aim

How to design and develop various Jakarta EE components.

#### Prerequisites

Basic Understanding of
* Java
* XML
* SQL
* JDBC
* MVC Architecture

#### Topics

* Introduction into Jakarta EE architecture (use some information from Oracle webpage)
* History (including the major changes in the versions, technically)
** Project JPE
** J2EE 1.2
** J2EE 1.3
** J2EE 1.4
** Java EE 5
** Java EE 6
* Frameworks
* Setup your development environment
** Choose an Application Server
*** Glassfish (Default application server)
*** WildFly (formerly JBoss)
*** Geronimo
** Choose your IDE
*** Eclipse
*** NetBeans
* Deployment descriptors
* Build a web based Jakarta EE application
** Servlets
** Jakarta Server Pages (JSP; formerly JavaServer Pages)
** Jakarta Server Pages syntax
** Access the Jakarta EE Application
** Web deployment files
** External JAR files (library files)
* Jakarta Enterprise Beans (EJB; formerly Enterprise JavaBeans)
** Entity Beans
*** Bean Managed Persistence (BMP)
*** Container Managed Persistence (CMP)
*** EJB-QL
** Session Beans
*** Stateless Session Beans
*** Stateful Session Beans
** Message Driven Bean
** Container Managed Transactions
* XDoclet
* Jakarta Server Faces (JSF; formerly JavaServer Faces)
* Data Access Objects (DAO)
* Java Database Connectivity (JDBC)
* Object Based Persistence
** Java Data Objects (JDO)
* Java middleware technology
** Remote Method Invocation (RMI)
** CORBA
** Jakarta Messaging (JMS; formerly Java Messaging Service)
** Jakarta Mail (formerly JavaMail)
* Security Services
** Java Authentication and Authorization Services (JAAS)
** JACC (Java Authorization service provider contract for containers)
* Web Services
** Jakarta XML Web Services (JAX-WS; formerly Java API for XML Web Services)
** Jakarta RESTful Web Services (JAX-RS; formerly Java API for RESTful Web Services)
* Jakarta EE Management
** Java Management Extensions (JMX)
** Managed Objects
** Events
** State Management
** Performance Monitoring
* Index

#### Related Concepts

* IDE
* Database
* Web Engine
* Attribute Oriented Programming
* JavaBeans

#### See Also

* Java Persistence (EJB JPA)
# JPEG - Idea and Practice/When the width or the height is not divisible by 8

In our program that produces the JPEG file, we have only used the largest part of the picture (beginning at the left top corner) which can be regularily divided up in 8x8-(or 16x16)-squares. If the dividing up does not fit the picture, the width or/and the height of the picture must be increased by the necessary number of pixels, and the new vertical and horizontal lines are usually coloured as the last vertical and horizontal line of the picture, respectively. The program that draws the picture from the file needs no changes: it draws in reality the extended picture, but we do only see the true part of it, because the drawing window is given the true width and height. The top picture (shown on an enlarged scale) has width and height of 33 pixels, and the width and the height must be increased by 7 pixels in order to be divisible by 8. If we extend the width and the height of the drawing window by 7 pixels, we will see the bottom picture:
# JSON/Syntax

In JSON, the syntax is similar to Javascript, as it was derived from Javascript, although now it is independent and separate language.
It's composed of key-value pairs delimited with braces. Ex:
# JSON/Data types
## Quick Review

JSON is a notation language that stores data. An example is storing playerData.

## Data Types

Integers are easy to make. Just put the integer!
Strings are in double quotes
Booleans are either true or false

### Arrays

Arrays are pretty much lists of data.
To get data from an array do this

### Objects

And the best part! Objects, Objects are the core of JSON You can't have json without objects! To make a object just add curly brackets and (i can't come up with something, ill just show it in code)
# OpenClinica User Manual/Calculations
## Calculations and functions in a CRF

In your XL for the CRF you can choose in column N, RESPONSE_TYPE, the type "calculation". In other programs this is sometimes called a Derived Field. You can use it for example to add the values of two items, Item1 and Item2, both integers.
The way to do this is make an item SumOfItem1AndItem2, type calculation. Now, we will start with column Q RESPONSE_VALUES_OR_CALCULATIONS. Here we put our calculation in format func: Item1 + Item2. Because of the fact that we fill in something in this column, we must also complete the two preceding columns, RESPONSE_OPTIONS_TEXT and RESPONSE_LABEL. To keep things easy, we just fill in "calc" for both.

### Using the pow-functions in your calculations

In the example above we added the values of two items and likewise we can subtract them, but what if we want the difference between the two items? And not just Item1 - Item2: we want the absolute difference between Item1 and Item2. In our calculations, we can use two functions, POW and DECODE. POW stands of course for Power and it works with two parameters: a number and the power (surprise!) For example pow(2,3) is 8. We can use 1/2 for the square-root, so pow(25, 0.5) is 5. We set this to work in our quest for the absolute, by typing in column Q: func: pow(pow(Item1-Item2,2),1/2). This functions first takes the power of 2 of the difference and then takes the square-root, resulting in the absolute difference.

### Using the decode-function

Another example of using a function in your CRF can be when you want your users to enter temperature in both Fahrenheit and Celsius. You design your CRF with a field Temperature and a field TempUnit and also a calculated field TempInCelsius. In TempUnit the user chooses between Fahrenheit or Celsius and the result is F or C. In our calculation to degrees Celsius, we will use the decode-function. The syntax of this function is
* a variable to evaluate
* one or more key-value pairs
* a default
In our case we will test item TempUnit. If this is "C", then we will take the value of Item Temperature. In the other case, so the default, it will be Fahrenheit, so we will subtract 32 and then multiply it with 5/9. The function then looks like func: decode(TempUnit,C,Temperature,((Temperature-32)*5/9)).
# OpenClinica User Manual/CRFDefinitionQuirks
## Quirks

Numeric fields
* OpenClinica stores numbers as strings, so will happily store both .72 and 0.72 (though they are equivalent) as they both validate as numbers.
* When defining a numeric field in a CRF, note that the width of a decimal field includes the space required for the decimal point. So 4(2) [width:4; 2 decimal places] will accommodate 9.72, but not 11.72. 11.72 would require a 5(2) definition. It may be simpler to define the field width as w(2), and rely on the range to limit the results.
# OpenClinica User Manual/AssigningACRFToAStudy
## Assigning a CRF to a study
### Study Event Definitions

Once you have created one or more CRFs, you'll want to assign them to a study. There is a level in between however: the event. This is also called an EventDefinition or StudyEventDefinition (SED) and is (more or less) a study visit. If you want to use a CRF in a study, you must first define the EventDefinitions / visits in that study. If you haven't done this already, click on "Tasks" -> "Study setup" -> "Build study".
Go to step 3 "Create Event Definitions" in the screen that now opens, click on the + sign and follow the instructions. (For more detailed instructions, see Create a New Event Definition.) After you have added your event/visit, you'll get a list of available CRFs and you can link any number of them to this event/visit (see instructions below).

### How to add a CRF to a study event

If you already have one or more EventDefinitions in your study, return to the "Build study" page and this time click on the magnifier icon in step 3 "Create Event Definitions".
You will get a list of your EventDefinitions titled "Manage All Event Definitions in Study X".
Click the pencil icon ("Edit") on the right of the event/visit you want to assign the CRF to.
This opens the edit form for the event, which has an upper part for editing details about the event itself and a lower part that shows the CRFs associated with this event. Click on the link "Add a New CRF".
A list appears with all available CRFs. Check the box on the right and click the "Add" button.

### Edit the properties of the CRF

Now there's one last thing to do: edit the properties of the CRF for this particular event. If you're in a hurry, just untick "Required", click "Confirm" and you're done.

### View all CRFs in your study

To view a list of all the CRFs assigned to your study you have to follow almost the same steps as described above: "Tasks" -> "Study Setup" -> "Build Study" -> "Create Event Definitions" and then click the magnifier icon to display the "Manage All Event Definitions in Study X" screen. You will see no CRFs in this list, unless you click on "Show More". Now two more columns are displayed: all the CRFs and their respective default versions.
# OpenClinica User Manual/ACRFWithAFile
## A CRF with a file

One of the neat things of OpenClinica is the option to "attach" a file to a CRF. This can be useful if in your study X-rays are used. Another example could be pdf's of letters of specialists, etc.

### Setting up

Setting up this facility is very straight-forward: in your CRF-XLS file you add an item for the file. Give ITEM_NAME etc. as appropriate. For both RESPONSE_TYPE (N) and RESPONSE_LABEL (O) fill in "file"; for DATA_TYPE (T) "FILE".
You can upload this XL-file in the normal way and assign it to one or more of your events. When data-entry opens it, a button "Click to upload file" is displayed and the user can browse in the normal way to the file, confirm the upload and that's it.
Once the file is uploaded, the CRF changes: now two buttons appear: "Replace" and "Remove". Clicking on the file will open it in the application, associated with this type of file.

### Where are these files stored?

All the "normal" data of your study are stored in your PostgreSQL or Oracle database, but not so the uploaded files. They are renamed uniquely and stored in the directory that also contains XL-s, XML-files, etc. This directory is (for Linux) /usr/local/tomcat/openclinica.data/attached_files. If you browse to that directory, you'll see subdirectories with the names of your studies, i.e. the Unique Protocol ID. The consequence of this is that you must not change the Unique Protocol ID after you have uploaded one or more files, because then OpenClinica can not retrieve them anymore! And this is one more reason for including this directory in your backup-procedures.

### Limitations and how to get around them

OpenClinica's code limits the size of a file to upload to a max of 10 MB. The Apache Commons code is used and documentation about how to change the max file size can be found at http://commons.apache.org/fileupload/using.html This would involve editing the source code, more specifically the file FileUploadHelper.java, located under the src/main/java/org/akaza/openclinica/bean/rule directory. Before you do this, always make a backup of the original files. And document your changes, so you can easily repeat them in case you want to install a newer version of OpenClinica (which will overwrite the changed code).
# OpenClinica User Manual/AnErrorHasOccured
## Explanation

If an error occurs while using OpenClinica® you will be shown the OpenClinica® Generic Error Page. The page contains no informations about the exact error. Further Investigations have to be done to find out what caused this error and to get help by others (users, support, etc.). Providing this page or the page text to others isn't enough.

## Generic Error Page

OpenClinica: An error has occurred
An error has occurred in the application. This can be for a number of reasons, not all of them might have to do with the actual Web application. If there are any messages above this text, please cut and paste them into any email you send about the issue.
If there are no messages, you might try clicking on the links in the header, and see what happens. This might reinitialize your connection with the database. Or click here to take you back where you came from.
In any event, if you cant get back to a working page, please contact OpenClinica LLC (if you have a support contract) or the mailing lists. Please be sure to include
* what you were doing when it happened
* and any other details (like error messages) that might be important.

## Further Investigation

To find out what caused the error start with the OpenClinica®/Tomcat log files (e.g. openclinica*.log, localhost*.log, catalina*.log). Contact your technical support or administrator if you don't know where to find these files. If you need help investigating contact the OpenClinica® forum and provide the relevant log files.

## Log File Locations

The log file location depends on the used operating system. Below is a list with typical locations for different systems.

### Ubuntu

/var/lib/tomcat6/logs/
or
/var/log/tomcat6/

### RedHat

/var/lib/tomcat6/logs/
or
/var/log/tomcat6/
# OpenClinica User Manual/AgeField
## Age calculation

Sometimes you may want to calculate the age of a StudySubject, for example at the date on which the Informed Consent is signed. You can do this by using the following script, which uses three CRF-items:
* date of birth, DateOfBirth,
* an other date, OtherDate, such as the date of signing the informed consent and
* the field that will hold the calculated age, CalculatedAge.

## Identifying the three items

The jscript uses three variables it reads from the CRF-items, but before it can do that, we must label them in the CRF. We do this by using the <spanid=xxx>-tag. We put these labels in either the left- or the right-item-text.

## the script

Here is the script and you can put it for example in the instructions column of the section with the items.

## How it works

The code begins by including jQuery 1.9.1. You could also point to the one OpenClinica provides.
Furthermore, to prevent a possible conflict with OpenClinica's code, we add the noConflict statement:
The script takes the two dates and creates two date objects, based on the day, month and year. The months are compared with the array of available months, which is declared in the start of the script. As you can see these are given in the English notation, so change these abbreviations if your users have another browser language. The script converts the given name to lowercase and then finds the ordinal number of the month and uses the number to set the month:
It then calculates the age by subtracting the years and comparing the months and if necessary days:
Now we have the age, but we must transfer it to our field, but only if the age has really changed. Furthermore, if the value did change, we call the field's change method, to ensure OpenClinica writes the value to the database:
The age is calculated when we leave the date of birth field, the sign field, or when we press one of the two save buttons, called "srh" and "srl":
# Muggles' Guide to Harry Potter/Characters/Dorcas Meadowes
## Overview

Dorcas Meadowes is a past member of the Order of the Phoenix, who had been killed in Voldemort's previous reign of terror.

## Role in the Books
### Order of the Phoenix

Alastor Moody shows Dorcas' picture to Harry in the kitchen at Grimmauld Place, saying that she had been personally killed by Lord Voldemort while in the Order of the Phoenix.

## Strengths

She was a likely strong and powerful witch as (said by Alastor Moody) she was killed personally by Voldemort.

## Relationships with Other Characters

It is assumed that due to her similar age to the rest of the order that she would have been at Hogwarts at similar times to James Potter, Sirius Black, Remus Lupin, Peter Pettigrew and Lily Evans.

## Questions

Study questions are meant to be left for each student to answer; please don't answer them here.
# Muggles' Guide to Harry Potter/Characters/Eileen Snape
## Overview

Eileen Snape (née Prince) was the mother of Severus Snape. She was a pure-blooded witch who married a Muggle man named Tobias Snape. It is said that she was the original owner of the advanced Potions book that her son and Harry Potter would later come to own. During her time as a student she was the captain of the Hogwarts gobstones team.

## Role in the Books
### Order of the Phoenix

We first see Eileen briefly during Harry's occlumency lessons with Snape. We get a brief look into some of Severus's memories, in one of which we see a man shouting at a frightened looking woman while young Severus cries in the corner of the room. Though we don't learn their names, it is implied that these are Snape's parents.

### Half-Blood Prince

We learn about Eileen at the end of the book. Hermione shows Harry and Ron some old Daily Prophet articles featuring an announcement that Eileen married the Muggle Tobias Snape, and one about how she had given birth to Severus. It is also stated that she was the original owner of Snape's potions book.

### Deathly Hallows

We see Eileen very briefly in Snape's memories where she is accompanying her son to Platform Nine and Three Quarters.

## Relationships with Other Characters

Based on what we see in Snape's memories, Eileen and Tobias didn't seem to have a happy marriage. Judging by the way she was cowering while he yelled at her, Tobias may have been abusive or at least highly unpleasant.
It's unknown how well she got along with her son, however he would later go on to use her maiden name to create his own nickname The Half-Blood Prince.

## Analysis

Eileen was the original owner of the potions book which is described as being around fifty years old. Interestingly this places her at Hogwarts around the same time as Tom Riddle.

## Questions

Study questions are meant to be left for each student to answer; please don't answer them here.