OpenLLM-France/wikimedia huggingface dataset:
# Van Dwelling/Dating

The question of dating for Van Dwellers really has two sides to it. First, it can possibly scare some people when they discover they are dating a van dweller. Second, it can possibly scare a van dweller to be dating.
Many books about dating provide advice that is applicable to van dwellers, just as it is to the rest of society. Basically, before even contemplating dating, there are some things to consider:
* Do you have a way to maintain good personal hygiene?
* Do you have a steady way to make money? (Printing your own does not count).
* Do you have a stable place to live?
These are important questions to ask before beginning dating. It will be very difficult to get dates (or at least second dates) without good personal hygiene. Dating can be very well done on the cheap, but it will occasionally require some amount of money.
The third question may be of most interest to some van dwellers. A very small percentage of the population is open to the idea of dating somebody that they view as "homeless," even though you may not consider yourself homeless. As such, you probably only have 3 options:
* Only date people that accept your chosen mode of living.
* Just don't let people know.
* Don't date.
Since you're reading this, you probably don't consider #3 an option. Finding people that fit #1 may be difficult, but not impossible. Thus, we go to #2.
Since many people consider honesty to be one of those big cornerstones of a successful relationship, this one can get a bit tricky. Things can get even worse when a dating partner starts to question "why we never go back to your place." Therefore, it may be advisable to let somebody know about your situation after a certain number of dates if you plan on pursuing a steady relationship.
This is strictly a personal philosophy, but I would tell a potential partner somewhere around date number five, if I had any inclination of pursuing a long term relationship. My approach would be to start a discussion about the desire for personal freedom and the escape of rampant consumerism and the rat race, and use that as a segue into explaining my living choice.
Of course, if you pick up your date in at his/her house in your van, then they might perhaps be able to figure it out on their own and simply ask. :)
Considering the fact that you have chosen this mode of living for one reason or another, you may actually end up finding potential partners amongst people that are of similar mindset and inclination. If this is an idea you are open to, consider plugging into your local "alternative" community. Most cities have some semblance of a community of people interested in simpler lifestyles, reduced consumerism, and some sort of activism related to such concepts. Participating in groups, activities, and gatherings for these sort of things could provide a plugin to a pool of eligible partners that are open to the van dwelling lifestyle.
# Van Dwelling/Exercise

Keeping fit on the road can be more difficult, since you don't have a lot of room to store bulky training equipment.
The ideal exercise equipment for van dwelling would be:
* Lightweight
* Compact
* Inexpensive
* Durable
* Effective
* Multi-use
* Simple
And such exercise equipment exists! It's your own body. You don't need anything but your own flesh to stay in shape.
The primary question is whether you want others to know that you live in your van. If that is not an option, then you cannot exercise right next to it. You will have to move some distance away or go to a nearby park or playground.
You will need some kind of workout outfit, which you can pick up on the cheap, because wearing jeans or some other non-sportive clothes will make you look more of a homeless person in the park than a sport-minded individual.
The simplest regimen of 3 sets of 20 pushups, 3 sets of 20 situps, 2x12 chinups, and brisk walking or jogging for 15 minutes will give you the necessary workout to maintain health.
For better shape, you will need to plan out a more stern regimen.
A simple online search for calisthenics will provide you with enough information to plan out your exercise routine.
Three times a week is the minimum exercise you should get.
If you can work out next to your van, this will save you time and effort.
Remember, staying in shape means you'll live longer and healthier.

## Other ideas:

* Register at a (preferably 24 hour) health club.
* A magnetic resistance bike which doubles as a computer workstation.
* A soccer ball.
* An elastic workout device.
Yoga is an excellent form of exercise and you can do it in the center of your van if you stack things on the seats. Also removing one of your back seats will allow for more space.
# XQuery/XML Schema to XForms
## Motivation

You want to transform an XML Schema into an XForms application.

## Method

We will write an XQuery transform that will transform the XML Schema directly to an XForms file.
The following will be automatically generated:
* A sample Instance will be place into the model.
* All "boolean" data types will have a bind statement to the xs:booleantype.
* All "date" data types will have a bind statement to the xs:date type.
* Each element in the XML Schema will have an input field unless it has the words "text, description, or note" in the element name.
* All enumerated types with use an xs:select1 with a series of items in the enumeration.

## Sample Source Code

http://code.google.com/p/xrx/source/browse/#svn/trunk/14-xml-schema-to-xforms
# XQuery/XHTML + Voice
## Motivation

You want to have your browser read Twitter updates using a text-to-speech conversion extension that is built into your browser.

## Method

XHTML + Voice is supported by the Opera Browser with the Voice extension installed. In this simple application it is used as a browser-based Text-to-Speech engine.

# Twitter Radio

This script creates a simple text-to-speech version of Twitter Search.
Obama

## Limitations

* Window has to be active for the T2S to play on refresh
* The cleaned text to speak is held in a div which is rendered as white on white text. Initially it was output as a block in the header but it did not seen possible to apply styles. Applying a style display:none hid the text from the T2S engine as well!
* Transforming the atom content to a a string suitable to speak needs more work.
* Retweets and similar tweets could be removed using levenstein
* Male and female voices are assigned randomly by tweet. I'd like to cache the voice assigned to a tweeter so that tweets are consistently spoken in the same voice
* The initial load doesn't seem to trigger playing, hence the play button, but this also re-fetches the page.
* This is an ideal situation to use AJAX instead of refresh
* The T2S engine is quite good at rendering the text but it needs be helped in places, for example by replacing texting abbreviations with their expanded form.
With the style sheet:
# XQuery/XML Schema to Instance
## Motivation

In order to generate a sample XML instance from an XML Schema file (XSD), this is useful for example if you would like to dynamically generate blank XForms instances for creating new documents from a schema.

## Method

[Note: See also the article XQuery/XQuery and XML Schema which has the same objective. If the author would like to contact me, I'm trying to get this code working to compare with the code I developed. ChrisWallace (talk) 15:09, 13 May 2009 (UTC)ChrisWallace]
Create an xquery function that reads in a URI to an XML Schema file (.xsd), along with a set of display parameters, and generates a sample XML instance. These parameters are:
* $schemaURI = the location of the .xsd file (e.g. db/cms/schemas/MySchema.xsd)
* $rootElementName = the root element for the sample XML file you wish to generate (i.e. doesn't have to be the root of the whole schema)
* $maxOccurances = for elements with a maxOccurs attribute greater than one, how many times should the element be repeated in the sample instance?
* $optionalElements = Should optional elements (i.e. minOccurs="0") be included? 'true' or 'false'
* $optionalAttributes = Should optional attributes (i.e. use="optional") be included? 'true' or 'false'
* $choiceStrategy = Where there is a choice between elements or groups of elements, should the sample include a random selection from the choices, or simply use the first choice? 'random' or 'first'
Call the function with the following:

## Notes

The function currently cannot dynamically set the namespaces in the sample instance. Any assistance in getting this to work would be much appreciated.
The function requires that the xsd file use the xs namespace prefix (i.e. xs:element). Attempts to use a wildcard prefix in the xpath statements did not work for some reason (i.e. $xsdFile/*:schema/*:element). An alternative approach is to determine the prefix, assign it to a variable and then concatenate it to all the xpath statements (e.g. $xsdFile/concat($prefix,':schema/',$prefix,'element') but that makes for some pretty ugly code. Another alternative is to use another function to reset whatever the xsd file prefix is to xs. This does work fine but adds a bit more code. Any more efficient alternative suggestions would be welcome.
The function uses two internal queries assigned to variables, $subElementsQuery and $attributesQuery, and then called using util:eval. This enables the recursive collection sub-elements and attributes without having to call an external function. These two queries could just has easily been declared as external functions.
# XQuery/XML Schema to SVG
## Motivation

You would like a graphical way to view your XML Schemas. These diagrams should allow you to view the structure of a XML Schema file in a graphical way. These graphical views of XML Schemas make XML Schema development and review easier for non-programmers to view "business rules" in a graphical way. For example required elements may have solid boarders and optional elements have a dashed line around an XML Schema.

## Challenges

There are no functions in SVG to automatically estimate the size of text. We will need a small function to estimate the width of a text string based on the count of letters and the type of letters. Although this is only an estimation it usually good enough for non-publishing viewers.
A sample of these utilities is given here: SVG Utilities to estimate text width

## Approach

We will use an XQuery typeswitch function to dispatch XML Schema elements to various functions.

## Sample Models

The following is a SVG file that can be used to display the models for XML Schema. Sample Models in SVG
# XQuery/XML to SQL

Tabular XML such as
can be exported to an SQL table by generating the create statement:
and the insert statements:
and using these two functions in a script:
Generate SQL
This SQL is very general, with all fields defined as varchar because of the lack of a schema. With a Schema, appropriate datatypes could be defined in SQL.
# XQuery/Wikipedia Page scraping

Page scraping allows any web page to be the source of raw data suitable for transformation. This example takes the data on the Wikipedia current events page 24 September 2007 and transforms to a simple HTML page
The key components of an XQuery page scraper are:
* The fn:doc function which accepts a URL and retrieves the page as XML. Many pages are not well-formed XML, but the Wikipedia pages are.
* Setting a namespace if the page has a default namespace. This page has a default namespace of "http://www.w3.org/1999/xhtml" so a namespace must be declared and its namespace prefix used in path expressions which access the page's XML.
* Identification of a path to the selected content. In this case, the content is located in a td tag with a class of 'description'
* Re-basing any relative URLs. Here the links to Wikipedia articles have relative URLs. To re-base these, the XML is serialized to a string with util:serialize, the relative URLs edited with replace, and the string converted back to XML using util:parse

## Sample XQuery to Extract Data from Wikipedia Current Events Page

In this example, there is some date re-formating to do since the date format in the page's URL is not the XML formated date. Links to the previous and next days are included, making use of XQuery date arithmetic.
# XQuery/Wikipedia Lookup

Page scraping is one way to retrieve a specific fact from a page provided its structure is stable.
Here the task is to use wikipedia to find the Latin name for a bird, given its common name.
Here, the path to locate the data required, assuming the page is in Bird page format, involves complex XPath expressions. For example, the genus is the second cell in a table row whose first cell is 'Genus'.
Black Swan Wikipedia
The script often fails because:
* the name is ambiguous ThrushWikipedia
* the name is too broad Kiwi Wikipedia
It is not hard to see that more semantic markup with ontological relationships would be preferable to these uncertain contortions.
# XRX/Autoincrement File ID
## Motivation

You want to create a new file and automatically create a new identifier for the file.

## Method

Create an XML file with a single counter in it. Use this counter as part of the file name. After you confirm that the file has been saved, increment the counter using the update function.

### Sample XML File to Hold Next ID
## Sample Code for save-new.xq

The following example works with an incoming HTTP POST request.

## Taking into account concurrent access

Same as above but with locking the node holding the identifier.
The following example works with an incoming HTTP POST request.

## Adding and Incrementing an Attribute

Note that the syntax for inserting an attribute is the following:
The keyword attribute must be used and be followed with the attribute name and value.
If you want to store a new id in an attribute the syntax is:
Note: if the attribute already exists in the target node then insert works as replace
And if you are updating the id you can use the replace function with the @ in the path expression:
Back: Regular Expression Builder • Next: Move a Resource
# XQuery/XSL-FO Tables
## Motivation

You want to be able to create high-quality tabular outputs suitable for book-publishing.

## Method

To accomplish this we will convert our XML into XSL-FO tables. Unlike HTML, XML-FO allows you to create flows of text and you can set up rules on how objects span page boundaries.

## Sample Input

Here is a sample XML file that contains a table with two columns.
We would like this XML file to be rendered with two columns, the first containing the person's name and the second their phone extension. It should look like the following.
Department Phone Extensions :
| Name | Extension |
| John Doe | 1234 |
| Sue Smith | 5678 |

## Example FO File

The following is the core of the XML-FO layout that you will need to create the table (without control on the column widths).

## Transform with XSLT

NOTE: This example should be moved to a book on XSLT. XQuery typeswitch transforms should be used to do this.
We can transform the XML structure to XSL-FO using an XSLT script. This generic script only requires that the root of the XML table is called table with a heading attribute.

## XQuery integration

Finally we can generate the full XSL-FO document and render as PDF with an XQuery script. We use the XSLT to transform the table, and then embed that XSL-FO fragment in the XSL-FO master before rendering as PDF and streaming the binary document. There are of course other ways to assemble the full XSLT-FO document.
Execute

## Database data

As a further example, the following XQuery selects all employees and renders them in a PDF table:
Execute
# XQuery/XUnit Testing
## Motivation

You want to understand what XML-centered unit testing is and how you can use it to make your software more reliable.

## Background

We live in a constantly changing world. Each of the tools that we used may be constantly changing and the underlying libraries that these tools use may also be changing. Some people say that the only software that does not change is software that is never used.
In order to deal with these ever changing conditions we need to be able to continually upgrade our dependencies and then have the confidence that our applications will work. The heart of this testing is to develop a fine-grained set of tests that can be automatically rerun each time you create new versions of your application.

## XUnit The role of XML standards

If each unit tests generates a standardized XML we can load the test results into unit testing frameworks such as Jenkins.

## References

XUnit XML Schema https://gist.github.com/jzelenkov/959290
# Imports and Declarations
## XQuery declaration
## Standard eXist modules

Optional in an XQuery script but required in a module in 1.2 but not in 1.3

## declare a default element namespace

Be VERY careful if you use a default namespace. This means that everything that does not have a namespace prefix will automatically be serialized into this namespace. It also PREVENTS you from using the null namespace unless you specifically declare it as xmlns="". Note that you do NOT associate a prefix with the default namespace.

## declare a java binding namespace

Note that the java binding is disabled by default due to security issues. Math functions can now be invoked via the maths extension module.

# Serialization Options
## output XML document

This is the default, but can be declared explictly:

## output XHTML document

If your code contains a lot of XML fragments that are in the NULL namespace (xmlns="") then there is a method of automatically converting everything in the null namespace to automatically get put into the XHTML namespace.

## output XForms document
# Modules and Functions
## function declaration

* in the default namespace in an XQuery script
* in the namespace of a module

## declare variable

in a module with namespace prefix fxx:

## Get HTTP POST URL Parameters

To get two URL parameters from an HTTP POST
Add the following:
If no color parameter is supplied a default color of "red" will be used.

## Get HTTP POST Data

To get all the XML data from an HTTP POST

## Extend the Output Size Limit

By default the output size in 10,000 bytes. You can extend this by adding the following
declare option exist:output-size-limit "new-size";
For example to triple the size limit of the output use the following line:
declare option exist:output-size-limit "30000";
# XQuery/eXist demo server

The sample scripts are executed on a server running a release of the eXist XML database. This server is based in the Faculty of Computing, Engineering and Mathematical Sciences at the University of the West of England, Bristol.
The demo server is currently running release 1.4.0
We appreciate the use of this free server and hope you use its resources respectfully.
# XRX/Application Modularity
## Motivation

You want to be able to package and reuse XRX applications.

## Method

We will use the collection structure of native XML databases to package XRX applications.
Our XRX Application framework uses the following conventions:
* All applications are placed in a common collection called apps. This is similar to the "/Applications" folder on a Mac(TM) or the "Program Files" folder in Microsoft Windows(TM).
* Each application has a collection of its own within the apps collection. We use REST-friendly application names that have only lowercase letters and dashes. For example a tool that manages organization business terms might be located in a collection called "/db/apps/terms". Databases that host multiple organizations might store each application collection in a separate apps collection for each organization. For example "/db/org/my-company/apps"
* All user-manageable data that is contained within the application is contained with a "data" collection within the application collection.
* XQuery functions that are common to multiple applications should be stored in a sibling folder to the "apps" collection. This allows each application to use relative module imports so that applications can be quickly re-installed on other sites.
# XQuery/XSL-FO SVG
## Motivation

You want to convert XML into PDF and embed SVG graphics in the output.

## Method

eXist since version 2 supports placing svg in fop rendered pdf out of the box, the only step being to activate the XSLFO module before building the source:
echo "include.module.xslfo = true" > $EXIST_HOME/extensions/local.build.properties
Beware: On headless *nix systems, make sure that there is no DISPLAY environment variable set, when eXist-db is started, otherwise the apache batik svg renderer may throw an exception.

## Sample XQuery

Highlights of the xquery: The FO is created from an xsl transform: I know, this could be done with xquery, but I can reuse the xsl in other places. The document is found through a search. The xsl stylesheet resides in "views", as the pdf.xq does. I create lots of variables, but its better that way. Filename deduced from request. There may be errors, as I stripped down working code! It may be overly complicated due to my ignorance of xquery features. I think you will find your way. Application directory laid out as advised in the XRX wiki.
Another, possibly higher performance, way to source the svgfile by the xmldb:exist qualifier:
# Topology/Mayer-Vietoris Sequence

A Mayer-Vietoris Sequence is a powerful tool used in finding Homology groups for spaces that can be expressed as the unions of simpler spaces from the perspective of Homology theory.

## Definition

If X is a topological space covered by the interiors of two subspaces A and B, then
    ${\begin{aligned}\cdots \rightarrow H_{n+1}(X)\,&{\xrightarrow {\partial _{*}}}\,H_{n}(A\cap B)\,{\xrightarrow {(i_{*},j_{*})}}\,H_{n}(A)\oplus H_{n}(B)\,{\xrightarrow {k_{*}-l_{*}}}\,H_{n}(X){\xrightarrow {\partial _{*}}}\,H_{n-1}(A\cap B)\rightarrow \\&\quad \cdots \rightarrow H_{0}(A)\oplus H_{0}(B)\,{\xrightarrow {k_{*}-l_{*}}}\,H_{0}(X)\rightarrow \,0.\end{aligned}}$
is an exact sequence where $i:A\cap B\hookrightarrow A,j:A\cap B\hookrightarrow B,l:A\hookrightarrow X,k:B\hookrightarrow X$. There is a slight adaptation for the reduced homology where the sequence ends instead
    $\cdots \rightarrow {\tilde {H}}_{0}(A\cap B){\xrightarrow {(i_{*},j_{*}))}}{\tilde {H}}_{0}(A)\oplus {\tilde {H}}_{0}(B)\,{\xrightarrow {k_{*}-l_{*}}}\,{\tilde {H}}_{0}(X)\rightarrow \,0.$

## Examples

Consider the cover of $S^{2}$ formed by 2-discs A and B in the figure.
The space $A\cap B$ is homotopy equivalent to the circle. We know that the homology groups are preserved by homotopy and so $H_{n}(A\cap B)\cong 0$ for $n\neq 1$ and $H_{1}(A\cap B)\cong \mathbb {Z}$. Also note how the homology groups of A and B are trivial since they are both contractable. So we know that
    $0\rightarrow {\tilde {H}}_{2}(S^{2})\xrightarrow {\partial _{*}} \mathbb {Z} \rightarrow 0$
This means that ${\tilde {H}}_{2}(S^{2})\cong \mathbb {Z}$ since $\partial _{*}$ is an isomorphism by exactness.
Consider the cover of the torus by 2 open ended cylinders A and B.

## Exercises

(under construction)
# Topology/Introduction

As we will mention repeatedly (and something the reader should always keep in the back of their mind to ground themselves when things seem confusing), topology generalises the notions of distance or even more precisely, it generalises the notions of "closeness". One can see why topology is often considered the loosest structure one can impose on a set (other structures being groups, rings, etc. which provide very strong relations between elements).
The reader may ask why we wish to generalise these notions or why generalising them is useful. There may be many motivations but we provide one here. Consider, for example, differentiation, which allows us to measure how a function behaves close to a given point. Doing so makes many problems easier since we can get a nice approximation of the function and it also provides us with useful information about the function (e.g. whether it is increasing or decreasing, existence of extrema, etc.). In order to similarly gain information in more general contexts, we at least need some notion of "closeness".