text:
package com.subterranean_security.crimson.viewer.ui.screen.netman.listener;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.List;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.border.BevelBorder;
import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;

import com.subterranean_security.crimson.core.attribute.keys.singular.AKeySimple;
import com.subterranean_security.crimson.core.util.IDGen;
import com.subterranean_security.crimson.core.util.ValidationUtil;
import com.subterranean_security.crimson.proto.core.net.sequences.Listener.ListenerConfig;
import com.subterranean_security.crimson.sv.permissions.Perm;
import com.subterranean_security.crimson.sv.profile.ViewerProfile;
import com.subterranean_security.crimson.viewer.net.command.ListenerCom;
import com.subterranean_security.crimson.viewer.store.ViewerProfileStore;
import com.subterranean_security.crimson.viewer.ui.UIStore;
import com.subterranean_security.crimson.viewer.ui.common.components.labels.StatusLabel;
import com.subterranean_security.crimson.viewer.ui.common.panels.sl.epanel.EPanel;

public class AddListener extends JPanel {

	private static final long serialVersionUID = 1L;
	private final JPanel contentPanel = new JPanel();
	private JTextField fld_name;
	private JTextField fld_port;
	private JCheckBox chckbxUseUpnp;
	private JCheckBox chckbxRestrictToLocalhost;
	private JCheckBox chckbxAcceptClients;
	private JCheckBox chckbxAcceptViewers;
	private JComboBox<String> owner;
	private StatusLabel sl;
	private JButton okButton;

	private EPanel ep;
	private JPanel panel_1;

	public AddListener(EPanel ep) {
		this.ep = ep;

		init();
		updateOwners();
	}

	public void init() {
		setBounds(100, 100, 592, 212);
		setLayout(new BorderLayout(0, 0));
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		add(contentPanel);
		contentPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
		{
			JPanel panel = new JPanel();
			panel.setPreferredSize(new Dimension(250, 130));
			panel.setBorder(new TitledBorder(new LineBorder(new Color(184, 207, 229)), "Details", TitledBorder.LEADING,
					TitledBorder.TOP, null, null));
			contentPanel.add(panel);
			panel.setLayout(null);
			{
				JLabel lblOptionalName = new JLabel("Optional Name:");
				lblOptionalName.setHorizontalAlignment(SwingConstants.TRAILING);
				lblOptionalName.setBounds(8, 20, 97, 13);
				lblOptionalName.setFont(new Font("Dialog", Font.BOLD, 10));
				panel.add(lblOptionalName);
			}
			{
				fld_name = new JTextField();
				fld_name.setBounds(113, 16, 125, 19);
				panel.add(fld_name);
				fld_name.setColumns(10);
			}
			{
				JLabel lblPort = new JLabel("Port:");
				lblPort.setHorizontalAlignment(SwingConstants.TRAILING);
				lblPort.setBounds(8, 45, 97, 13);
				lblPort.setFont(new Font("Dialog", Font.BOLD, 10));
				panel.add(lblPort);
			}
			{
				fld_port = new JTextField();
				fld_port.setBounds(113, 41, 70, 19);
				fld_port.addKeyListener(new KeyAdapter() {
					@Override
					public void keyReleased(KeyEvent arg0) {
						refreshFields();
					}
				});
				panel.add(fld_port);
				fld_port.setColumns(6);
			}
			{
				JLabel lblOwner = new JLabel("Owner:");
				lblOwner.setHorizontalAlignment(SwingConstants.TRAILING);
				lblOwner.setBounds(8, 70, 97, 13);
				lblOwner.setFont(new Font("Dialog", Font.BOLD, 10));
				panel.add(lblOwner);
			}
			{
				owner = new JComboBox<String>();
				owner.setBounds(113, 66, 125, 19);
				panel.add(owner);
			}
		}
		{
			JPanel panel = new JPanel();
			panel.setPreferredSize(new Dimension(250, 130));
			panel.setBorder(new TitledBorder(new LineBorder(new Color(184, 207, 229)), "Flags", TitledBorder.LEADING,
					TitledBorder.TOP, null, new Color(51, 51, 51)));
			contentPanel.add(panel);
			{
				chckbxUseUpnp = new JCheckBox("Use UPnP");
				chckbxUseUpnp.setBounds(5, 17, 86, 22);
				chckbxUseUpnp.addMouseListener(new MouseAdapter() {
					@Override
					public void mouseEntered(MouseEvent arg0) {
						sl.setInfo("UPnP attemps to automatically port forward the router");
					}

					@Override
					public void mouseExited(MouseEvent e) {
						sl.setDefault();
					}
				});
				panel.setLayout(null);
				chckbxUseUpnp.setFont(new Font("Dialog", Font.BOLD, 11));
				panel.add(chckbxUseUpnp);
			}
			{
				chckbxRestrictToLocalhost = new JCheckBox("Restrict to localhost");
				chckbxRestrictToLocalhost.setBounds(5, 44, 154, 22);
				chckbxRestrictToLocalhost.addMouseListener(new MouseAdapter() {
					@Override
					public void mouseEntered(MouseEvent e) {
						sl.setInfo("Only connections originating from localhost will be accepted");
					}

					@Override
					public void mouseExited(MouseEvent e) {
						sl.setDefault();
					}
				});
				chckbxRestrictToLocalhost.setFont(new Font("Dialog", Font.BOLD, 11));
				panel.add(chckbxRestrictToLocalhost);
			}
			{
				chckbxAcceptClients = new JCheckBox("Accept clients");
				chckbxAcceptClients.setBounds(5, 71, 115, 22);
				chckbxAcceptClients.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent arg0) {
						refreshBoxes();
					}
				});
				chckbxAcceptClients.addMouseListener(new MouseAdapter() {
					@Override
					public void mouseEntered(MouseEvent e) {
						sl.setInfo("Allow clients to connect?");
					}

					@Override
					public void mouseExited(MouseEvent e) {
						sl.setDefault();
					}
				});
				chckbxAcceptClients.setSelected(true);
				chckbxAcceptClients.setFont(new Font("Dialog", Font.BOLD, 11));
				panel.add(chckbxAcceptClients);
			}
			{
				chckbxAcceptViewers = new JCheckBox("Accept viewers");
				chckbxAcceptViewers.setBounds(5, 98, 122, 22);
				chckbxAcceptViewers.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent e) {
						refreshBoxes();
					}
				});
				chckbxAcceptViewers.addMouseListener(new MouseAdapter() {
					@Override
					public void mouseEntered(MouseEvent e) {
						sl.setInfo("Allow viewers to connect?");
					}

					@Override
					public void mouseExited(MouseEvent e) {
						sl.setDefault();
					}
				});
				chckbxAcceptViewers.setSelected(true);
				chckbxAcceptViewers.setFont(new Font("Dialog", Font.BOLD, 11));
				panel.add(chckbxAcceptViewers);
			}
		}
		{
			JPanel buttonPane = new JPanel();
			buttonPane.setLayout(new FlowLayout(FlowLayout.CENTER));
			add(buttonPane, BorderLayout.SOUTH);
			{
				JButton cancelButton = new JButton("Cancel");
				cancelButton.setMargin(new Insets(2, 4, 2, 4));
				cancelButton.setFont(new Font("Dialog", Font.BOLD, 11));
				cancelButton.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent e) {
						resetEPanels();
						ep.drop();
					}
				});
				buttonPane.add(cancelButton);
			}
			{
				okButton = new JButton("Add");
				okButton.setMargin(new Insets(2, 6, 2, 6));
				okButton.setFont(new Font("Dialog", Font.BOLD, 11));
				okButton.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent arg0) {
						new Thread(() -> {
							if (!verify()) {
								return;
							}
							ListenerCom.addListener(ListenerConfig.newBuilder()
									.setName(fld_name.getText().isEmpty() ? "Unnamed Listener" : fld_name.getText())
									.setClientAcceptor(chckbxAcceptClients.isSelected())
									.setViewerAcceptor(chckbxAcceptViewers.isSelected())
									.setLocalhostExclusive(chckbxRestrictToLocalhost.isSelected())
									.setPort(Integer.parseInt(fld_port.getText()))
									.setOwner((String) owner.getSelectedItem()).setId(IDGen.listener()).build());
							resetEPanels();
							ep.drop();
						}).start();

					}
				});
				buttonPane.add(okButton);
			}
		}
		{
			panel_1 = new JPanel();
			panel_1.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
			add(panel_1, BorderLayout.NORTH);
			panel_1.setLayout(new BorderLayout(0, 0));
			{
				sl = new StatusLabel("Create new listener");
				panel_1.add(sl);
			}
		}
	}

	public boolean verify() {
		if (!ValidationUtil.port(fld_port.getText())) {
			sl.setBad("Invalid port");
			return false;
		}

		for (ListenerConfig lc : ViewerProfileStore.getServer().listeners) {
			if (lc.getPort() == Integer.parseInt(fld_port.getText())) {
				sl.setBad("Port in use");
				return false;
			}
		}

		return true;
	}

	public void refreshFields() {
		if (verify()) {
			okButton.setEnabled(true);
			sl.setDefault();
		} else {
			okButton.setEnabled(false);
		}

	}

	public void refreshBoxes() {
		if (!chckbxAcceptClients.isSelected() && !chckbxAcceptViewers.isSelected()) {
			sl.setBad("Must accept some connections");
			okButton.setEnabled(false);
		} else {
			sl.setDefault();
			okButton.setEnabled(true);
		}
	}

	public void updateOwners() {
		String[] o = null;
		if (ViewerProfileStore.getLocalViewer().getPermissions().getFlag(Perm.Super)) {
			List<ViewerProfile> viewers = ViewerProfileStore.getViewers();
			o = new String[viewers.size()];
			for (int i = 0; i < o.length; i++) {
				o[i] = viewers.get(i).get(AKeySimple.VIEWER_USER);
			}
		} else {
			o = new String[] { ViewerProfileStore.getLocalViewer().get(AKeySimple.VIEWER_USER) };
		}
		owner.setModel(new DefaultComboBoxModel<String>(o));
	}

	public void resetEPanels() {
		UIStore.EAddListener = null;
	}
}


text:
<!DOCTYPE html>

    <title>CPT</title>
    <meta charset="utf-8" />

    <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
    <link rel="shortcut icon" href="../core/img/favicon.ico"/>
    <link rel="stylesheet" href="../core/css/tabcat.css">
    <link rel="stylesheet" href="css/examiner.css">
    <link rel="stylesheet" href="css/cpt.css">

redpajama_set_name: RedPajamaGithub


text:
package woko.actions.nestedvalidation;

import net.sourceforge.stripes.action.*;
import net.sourceforge.stripes.validation.ValidateNestedProperties;

public class MyActionTyped implements ActionBean {

  private ActionBeanContext context;

  public ActionBeanContext getContext() {
    return context;
  }

  public void setContext(ActionBeanContext context) {
    this.context = context;
  }

  @ValidateNestedProperties({})
  private MyPojo myPojo;

  public MyPojo getMyPojo() {
    return myPojo;
  }

  public void setMyPojo(MyPojo myPojo) {
    this.myPojo = myPojo;
  }

  @DefaultHandler
  public Resolution doIt() {
    return new ForwardResolution("/foo");
  }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
		>
	<TextView
			android:id="@+id/textView1"
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			android:layout_gravity="center|top"
			android:layout_margin="20dp"
			android:text="Scan"
			android:textColor="#000000"
			android:textSize="30dp" />

	<Button
			android:id="@+id/scanner"
			android:layout_width="250dp"
			android:layout_height="80dp"
			android:layout_gravity="center"
			android:layout_margin="10dp"
			android:gravity="center"
			android:onClick="scanQR"
			android:text="QR Code"
			android:textSize="18dp" >
	</Button>

	<Button
			android:id="@+id/scanner2"
			android:layout_width="250dp"
			android:layout_height="80dp"
			android:layout_gravity="center"
			android:layout_margin="10dp"
			android:gravity="center"
			android:onClick="scanBar"
			android:text="Bar Code"
			android:textSize="18dp" >
	</Button>
</LinearLayout>


text:
"""
Manage AWS Lambda functions and their event sources
"""

import os, sys, argparse, hashlib, base64

from .ls import register_parser, register_listing_parser
from .util import Timestamp, paginate
from .util.printing import page_output, tabulate
from .util.aws import resources, clients

def _lambda(args):
    lambda_parser.print_help()

lambda_parser = register_parser(_lambda, name="lambda")

def ls(args):
    paginator = getattr(clients, "lambda").get_paginator("list_functions")
    page_output(tabulate(paginate(paginator), args, cell_transforms={"LastModified": Timestamp}))

parser_ls = register_listing_parser(ls, parent=lambda_parser, help="List AWS Lambda functions")

def event_source_mappings(args):
    paginator = getattr(clients, "lambda").get_paginator("list_event_source_mappings")
    page_output(tabulate(paginate(paginator), args))

parser_event_source_mappings = register_listing_parser(event_source_mappings, parent=lambda_parser,
                                                       help="List event source mappings")

def update_code(args):
    with open(args.zip_file, "rb") as fh:
        payload = fh.read()
    payload_sha = hashlib.sha256(payload).digest()
    res = getattr(clients, "lambda").update_function_code(FunctionName=args.function_name, ZipFile=payload)
    assert base64.b64decode(res["CodeSha256"]) == payload_sha
    return res

update_code_parser = register_parser(update_code, parent=lambda_parser, help="Update function code")
update_code_parser.add_argument("function_name")
update_code_parser.add_argument("zip_file")

def update_config(args):
    update_args = dict(FunctionName=args.function_name)
    if args.role:
        update_args.update(Role=args.role)
    if args.timeout:
        update_args.update(Timeout=args.timeout)
    if args.memory_size:
        update_args.update(MemorySize=args.memory_size)
    if args.environment:
        cfg = getattr(clients, "lambda").get_function_configuration(FunctionName=args.function_name)
        cfg["Environment"]["Variables"].update(args.environment)
        update_args.update(Environment=cfg["Environment"])
    return getattr(clients, "lambda").update_function_configuration(**update_args)

def role_name_completer(**kwargs):
    return [r.name for r in resources.iam.roles.all()]

update_config_parser = register_parser(update_config, parent=lambda_parser, help="Update function configuration")
update_config_parser.add_argument("function_name")
update_config_parser.add_argument("--role", help="IAM role for the function").completer = role_name_completer
update_config_parser.add_argument("--timeout", type=int,
                                  help="The amount of time that Lambda allows a function to run before stopping it")
update_config_parser.add_argument("--memory-size", type=int,
                                  help="The amount of memory that your function has access to")
update_config_parser.add_argument("--environment", nargs="+", metavar="NAME=VALUE", type=lambda x: x.split("=", 1),
                                  help="Read environment variables for function, update with given values, write back")


text:
Apache Tomcat est le conteneur de servlet recommandé à utiliser avec uPortal. Alors que uPortal requiert
un conteneur de servlet compatible avec Servlet 3.0, aussi un autre conteneur servlet peut être utilisé,
mais la plupart des implémenteurs d'uPortal le déploient sur Apache Tomcat. Choisir Tomcat 8.x permettra probablement
aux utilisateurs d'obtenir les meilleurs conseils de la communauté.

Voir aussi

+ [Mettre Httpd en front de Tomcat](fronting-with-httpd.md)
+ [Utiliser SSL](ssl-configuration.md)

## Installation Linux/Unix

### 1. Téléchargement

[Télécharger](http://tomcat.apache.org/download-80.cgi) Apache Tomcat 8.x.

### 2. Extraction

Extraire le package comme suit :

```shell_session
tar -zxvf apache-tomcat-8.0.33.tar.gz
```

### 3. Renommer

*Optionnellement* renommer votre installation en quelquechose de plus signifiant :

```shell_session
mv apache-tomcat-8.0.33 uportal-tomcat
```

### 4. Modifier vos variables d'environnement

Modifier vos variables d'environnement :

```shell
export JAVA_HOME=/path/to/your/java
export TOMCAT_HOME=/path/to/your/tomcat
```

### 5.Tester votre installation de Tomcat

#### a. Démarrer Tomcat

Premièrement, démarrer Tomcat

```shell_session
$TOMCAT_HOME/bin/startup.sh
```

#### b. Vérifier dans un navigateur

Aller sur http://localhost:8080/

Vous devriez voir la page d'accueil de Apache Tomcat.

#### c. Fermer Tomcat

```shell_session
TOMCAT_HOME/bin/shutdown.sh
```

## Installation sur Windows

### 1. Téléchargement

Télécharger [Apache Tomcat 8.x](http://tomcat.apache.org/download-80.cgi) pour Windows.

### 2. Désarchiver

Désarchiver le téléchargement dans un répertoire adéquat. Par exemple, vous pouvez extraire le fichier dans le répertoire `C:\`. Ceci va créer un répertoire du type `C:\apache-tomcat-8.x` contenant tous les fichiers de Tomcat.

### 3. Modifier vos variables d'environnement

Vous devez définir une variable d'environnement `JAVA_HOME`.

```shell
JAVA_HOME : C:\Program Files\Java\jdk1.x
```
Pour Windows (cela peut varier selon les versions), vous pouvez créer ces variables d'environnement en procédant comme suit:
cliquer avec le bouton droit sur 'Poste de travail', sélectionnez dans propriétés l'onglet Avancé.
Puis cliquer sur Variables d'environnement et sous Variables système, cliquer sur Nouveau.
À partir d'ici, entrer le nom et la valeur de `JAVA_HOME` s'il n'est pas déjà créé.

### 4. Démarrer Tomcat

Essayez de démarrer Tomcat en exécutant le fichier de commandes `C:\apache-tomcat-8.x\bin\startup.bat`.

### 5. Vérifier dans un navigateur

Aller dans votre navigateur sur http://localhost:8080 et vous devriez voir la page d'accueil Tomcat par défaut.

### 6. Fermer Tomcat

Pour arrêter le serveur, exécutez le fichier de commandes `C:\apache-tomcat-8.x\bin\shutdown.bat`.

## Configuration de Tomcat pour uPortal

### Bibliothèques partagées

uPortal place les bibliothèques dans `CATALINA_BASE/shared/lib`. Par défaut, Tomcat 7 ou 8 n'autorise pas le chargement des bibliothèques à partir de ce répertoire.

Pour résoudre ce problème, vous devez éditer `CATALINA_BASE/conf/catalina.properties` et changer la ligne commençant par `shared.loader=`par ce qui suit :

```properties
shared.loader=${catalina.base}/shared/lib/*.jar
```

Soyez **absolument certain** que la propriété `shared.loader` est configurée exactement comme indiqué. Un caractère espace supplémentaire à la fin de la ligne peut l'empêcher de fonctionner comme prévu, ce qui est très difficile à résoudre.

### Sessions partagées

Les portlets Jasig, ainsi que de nombreux autres portlets JSR-168 et JSR-286, reposent sur la possibilité de partager des données de session utilisateur entre l'application Web du portail et les applications de portlet.

Pour activer cette fonctionnalité pour Tomcat 7 ou 8, ajoutez `sessionCookiePath="/"` à `CATALINA_BASE/conf/context.xml`.

```xml
<Context sessionCookiePath="/">
```

### Augmenter la taille du cache de ressources

uPortal et la collection typique de ses portlets prennent beaucoup de place. Tomcat 8.5 émet des avertissements sur l'épuisement de l'espace de cache des ressources. Ajoutez la configuration de cache suivante juste avant la _fermeture_ du noeud `Context`.

```xml
<Resources cachingAllowed="true" cacheMaxSize="100000" />
</Context>
```

### Configuration Heap JVM

uPortal requiert un espace `PermGen` plus grand que la norme (Java 7 uniquement) et plus de segments de mémoire que ceux alloués par défaut. Un bon ensemble de paramètres de Heap est

```
-XX:MaxPermSize=384m (Java 7 only) -Xmx2048m
```

Pour les ajouter, créer un fichier appelé `setenv.sh` (Linux / Mac) ou `setenv.bat` (Windows) dans votre répertoire `bin` de Tomcat et ajouter la configuration suivante. Note pour les paramètres de production, vous avez besoin généralement de plus d'espace de mémoire, au moins 4 Go. Voir la configuration Tomcat additionnelle ci-dessous.

```
JAVA_OPTS="$JAVA_OPTS -XX:+PrintCommandLineFlags -XX:MaxPermSize=384m -Xms1024m -Xmx2048m -Djsse.enableSNIExtension=false"
```

### Autorisations requises de fichier

Plusieurs applications web d'uPortal écrivent dans leur dossier webapps -déployé- pour ajouter un contenu dynamique au portail (la modification de la Skin dynamique Respondr et la gestion des pièces jointes téléchargées sur uPortal sont deux cas d'utilisation). Assurez-vous que le processus Tomcat est en cours d'exécution tout comme l'accès en écriture aux répertoires `CATALINA_BASE/webapps/*`. Généralement, cela se fait en ayant le même compte tomcat en cours d'exécution que le compte que vous utilisez pour construire et déployer uPortal.

### HTML GZip-ping

(Facultatif mais FORTEMENT SUGGÉRÉ à moins de le faire avec Apache httpd ou un appareil externe).

Les performances côté navigateur peuvent être améliorées par GZip-ping du contenu téléchargé le cas échéant. uPortal 4 "GZippe" déjà quelques CSS et JavaScript. uPortal ne fait cependant pas le GZip-ping de la page HTML d'uPortal en elle-même.

Le GZipping du contenu HTML peut être effectué via Tomcat. Pour activer cette fonctionnalité, définissez `compression="on"` dans le connecteur Tomcat utilisé, et définissez éventuellement la liste des types MIME compressibles. Vous trouverez plus d'informations sur cette fonctionnalité dans la [page de configuration Tomcat][].

```xml
<Connector port="8080" protocol="HTTP/1.1"
  connectionTimeout="20000" redirectPort="8443"
  compression="on"
  compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript,application/javascript"/>
```

Vous pouvez éventuellement spécifier `compressionMinSize` ou le laisser à sa valeur par défaut de 2048 octets.

Si vous avez [Apache httpd en front de Tomcat](fronting-with-httpd.md) ou d'autres systèmes matériels, vous pouvez effectuer la compression dans Apache ou dans ces systèmes à la place.

### Démarrage parallèle de Tomcat 7/8

(Facultatif.)

Tomcat 7.0.23+ peut être [configuré pour démarrer en parallèle plusieurs webapps au démarrage][faster Tomcat startup wiki page], reduisant ainsi le temp de démarrage du serveur. Modifier l'attribut `startStopThreads` d'un `Host` avec une valeur supérieur à 1.

### Délai de session HTTP

Pour définir la durée des sessions HTTP, modifier `CATALINA_BASE/conf/web.xml` et remplacer l'élément session-timeout par le nombre de minutes souhaité.

La valeur par défaut de Tomcat est de 30 minutes.

```xml
<session-config>
  <session-timeout>30</session-timeout>
</session-config>
```

### Autres configurations de Tomcat

#### paramétrages JVM

+ [Exemple de paramètrage JVM](https://wiki.jasig.org/display/UPC/JVM+Configurations)
+ [Heap tuning](https://wiki.jasig.org/display/UPC/uPortal+Heap+Tuning)

#### Désactiver SSLv3

(Ceci est un peu à propos du SSL sortant. La [Documentation sur la configuration SSL entrante](ssl-configuration.md) est sur une autre page.)

Certains sites ont choisi de désactiver SSLv3 sur leur serveur CAS en raison de diverses vulnérabilités. Cela peut provoquer des problèmes avec le client CAS utilisé dans uPortal, celui-ci n'étant pas en mesure d'établir une connexion HTTPS avec le serveur CAS pour valider le ticket de service et lance donc une exception.

```
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
```
Une solution consiste à définir les protocoles utilisés par Java lors de la création de connexions SSL. Vous pouvez le faire en ajoutant la propriété suivante à `JAVA_OPTS` (ou `CATALINA_OPTS` si vous l'utilisez) :

Oracle Java7: `-Dhttps.protocols="TLSv1,TLSv1.1,TLSv1.2"`

Votre serveur CAS doit être configuré pour utiliser l'un des protocoles mentionnés ou l'établissement de liaison (handshake) échouera. Si votre serveur CAS de test est accessible au public, vous pouvez voir les protocoles qu'il prend en charge en [testant son nom de domaine via SSL Labs](https://www.ssllabs.com/ssltest/).

Si vous rencontrez des problèmes :

+ [Diagnostiquer TLS, SSL, et HTTPS](https://blogs.oracle.com/java-platform-group/entry/diagnosing_tls_ssl_and_https)

[page de configuration Tomcat]: http://tomcat.apache.org/tomcat-7.0-doc/config/http.html
[faster Tomcat startup wiki page]: http://wiki.apache.org/tomcat/HowTo/FasterStartUp


text:
package org.wildfly.camel.test.box;

import java.util.HashMap;
import java.util.Map;

import org.apache.camel.CamelContext;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.box.BoxComponent;
import org.apache.camel.component.box.BoxConfiguration;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.support.IntrospectionSupport;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.wildfly.extension.camel.CamelAware;

import com.box.sdk.BoxFolder;

@CamelAware
@RunWith(Arquillian.class)
public class BoxIntegrationTest {

    // Enum values correspond to environment variable names
    private enum BoxOption {
        BOX_USERNAME("userName"),
        BOX_PASSWORD("userPassword"),
        BOX_CLIENT_ID("clientId"),
        BOX_CLIENT_SECRET("clientSecret");

        private String configPropertyName;

        BoxOption(String configPropertyName) {
            this.configPropertyName = configPropertyName;
        }
    }

    @Deployment
    public static JavaArchive createDeployment() {
        return ShrinkWrap.create(JavaArchive.class, "camel-box-tests.jar");
    }

    @Test
    public void testBoxComponent() throws Exception {
        Map<String, Object> boxOptions = createBoxOptions();

        // Do nothing if the required credentials are not present
        Assume.assumeTrue(boxOptions.size() == BoxOption.values().length);

        CamelContext camelctx = new DefaultCamelContext();
        camelctx.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:start").
                to("box://folders/createFolder");
            }
        });

        BoxConfiguration configuration = new BoxConfiguration();
        configuration.setAuthenticationType(BoxConfiguration.STANDARD_AUTHENTICATION);
        IntrospectionSupport.setProperties(configuration, boxOptions);

        BoxComponent component = new BoxComponent(camelctx);
        component.setConfiguration(configuration);
        camelctx.addComponent("box", component);

        BoxFolder folder = null;

        camelctx.start();
        try {
            Map<String, Object> headers = new HashMap<>();
            headers.put("CamelBox.parentFolderId", "0");
            headers.put("CamelBox.folderName", "TestFolder");

            ProducerTemplate template = camelctx.createProducerTemplate();
            folder = template.requestBodyAndHeaders("direct:start", null, headers, BoxFolder.class);

            Assert.assertNotNull("Folder was null", folder);
            Assert.assertEquals("Expected folder name to be TestFolder", "TestFolder", folder.getInfo().getName());
        } finally {
            // Clean up
            if (folder != null) {
                folder.delete(true);
            }

            camelctx.close();
        }
    }

    private Map<String, Object> createBoxOptions() throws Exception {
        final Map<String, Object> options = new HashMap<>();

        for (BoxOption option : BoxOption.values()) {
            String envVar = System.getenv(option.name());
            if (envVar == null || envVar.length() == 0) {
                options.clear();
            } else {
                options.put(option.configPropertyName, envVar);
            }
        }

        return options;
    }
}


text:
package fate.webapp.blog.service.impl;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import fate.webapp.blog.model.PingRecord;
import fate.webapp.blog.persistence.PingRecordDao;
import fate.webapp.blog.service.PingRecordService;

@Service
@Transactional
public class PingRecordServiceImpl implements PingRecordService {

	@Autowired
	private PingRecordDao pingRecordDao;

	@Override
	public List<PingRecord> findAll(int curPage, int pageSize) {
		return pingRecordDao.findAll(curPage, pageSize);
	}

	@Override
	public void save(PingRecord pingRecord) {
		pingRecordDao.save(pingRecord);
	}

	@Override
	public PingRecord update(PingRecord pingRecord) {
		return pingRecordDao.update(pingRecord);
	}

	@Override
	public PingRecord findByThemeGuid(String guid) {
		return pingRecordDao.findByThemeGuid(guid);
	}

	@Override
	public long count() {
		return pingRecordDao.count();
	}

	@Override
	public PingRecord find(int id) {
		return pingRecordDao.find(id);
	}

}


text:
using System;

namespace Burden
{
	/// <summary>	Values that represent JobResultType - similar in spirit to System.Reactive.NotificationKind.  </summary>
	/// <remarks>	7/14/2011. </remarks>
	public enum JobResultType
	{
		/// <summary> The job completed.  </summary>
		Completed,
		/// <summary> An error occurred during the job, which could include cancellation.  </summary>
		Error
	}
}


text:
layout: post
title: "GitHub Pages, Docker, and Jekyll"
date: 2019-01-17 00:00:00 +0000
categories: github docker jekyll
published: true
image: /assets/headers/2019-01-17-GitHub-Pages-Docker-and-Jekyll.png
---

It's been a while since I wrote about [setting up my blog for local testing](/2016/10/08/Getting-started-with-Jekyll-Part-4/) using [Docker](https://www.docker.com/) and Docker Toolbox, and the rest of the ecosystem has moved on. So it's time for an update...

<!--description-->
![2019-01-17-GitHub-Pages-Docker-and-Jekyll](/assets/headers/2019-01-17-GitHub-Pages-Docker-and-Jekyll.png)

For those of you that followed along at the beginning, I wrote about how to set up your blog to [run locally](/2016/10/08/Getting-started-with-Jekyll-Part-4/), how to [run from GitHub Pages](/2016/10/22/Getting-started-with-Jekyll-Part-8/), and I even provided [BuildAndRun](https://github.com/PHeonix25/PHeonix25.github.io/blob/fd951c2fecfc9efc96792f8ac388ed680cf5936b/Docker.BuildAndRun.ps1) and [StopAndRemove](https://github.com/PHeonix25/PHeonix25.github.io/blob/fd951c2fecfc9efc96792f8ac388ed680cf5936b/Docker.StopAndRemove.ps1) scripts, but as I'm getting back into writing in 2019, and I wanted to update some parts of my site, those ... stopped working!

Keeping in mind I've changed laptops 3 times in the past few years, and have just been "pushing small changes to master" (aka. lazy trunk-based development) for about as long (_I know, I know_), so today I spent far too much time trying to work around the bugs I was experiencing in getting Jekyll running locally before I decided to step back and "read the docs".

I figured I'd type this up so that you - _and future me_ - don't have the same troubles I did today. In this post, I'll step through the errors I experienced, and how I solved them., Let's get straight into it:

## Issues I experienced

<!-- TOC depthFrom:2 -->

- [Docker Hub credentials were invalid](#docker-hub-credentials-were-invalid)
- [Docker Compose command changed](#docker-compose-command-changed)
- [Container "running", but no content returning from 0.0.0.0](#container-running-but-no-content-returning-from-0000)
- [Website rendered without CSS](#website-rendered-without-css)
- [Starefossen no longer up to date](#starefossen-no-longer-up-to-date)
- [Container not accepting updates](#container-not-accepting-updates)

<!-- /TOC -->

### Docker Hub credentials were invalid

My Docker script (note, not Docker Compose) refused to find images, and even though my Docker icon in the notification area showed me as "logged in", it wouldn't locate any images because "my credentials for Docker Hub were invalid". I went to [hub.docker.com](https://hub.docker.com) and confirmed that my credentials that were saved had not been changed, and everything looked fine locally.

Thankfully the solution was quite simple: Right click on the Docker icon in the Windows notification area, and choose "Sign out". Wait for it to finish logging you out and then sign in again.

![Even though it looks fine, sign out to refresh the credentials](/assets/img/docker-signout.png)

Simple, right? Unfortunately, I lost about half an hour to this because everything "looked right", but the credentials had expired in the background.

### Docker Compose command changed

Previously, I was using raw Docker commands, [like this, in a Dockerfile](https://github.com/PHeonix25/PHeonix25.github.io/blob/65c0e178f8056ba5caaeb7421334769838f7e888/Dockerfile) to get the site up and running. I even tried out a `docker-compose.yml` [years ago](https://github.com/PHeonix25/PHeonix25.github.io/blob/368f8e55827dd4c1c2de8f6b950c6d9dd397fece/docker-compose.yml) and... that worked back then, but like I said in the intro, the community has moved on. It was time to get with the cool new kid in town: Docker Compose 2.0 (or 2.1, or 3.0), but a lot of the syntax has changed.

You can see the changes I needed to make in [this diff](https://github.com/PHeonix25/PHeonix25.github.io/commit/bd24ad1bcab071545105ff9bc23fde34aded3362#diff-4e5e90c6228fd48698d074241c2ba760) that I pushed once I'd solved all the problems below.

### Container "running", but no content returning from 0.0.0.0

Great, so now we have our container up and running, and we can watch Jekyll recompile the pages on the command line as we're making changes... but we go to <http://0.0.0.0:4000> and ... nothing! Weird, the config looks fine, and this did work before. Changing it from using the `ANY` IP (0.0.0.0) to `localhost` or the loopback IP (127.0.0.1) did nothing different. Nothing was servicing those IP/Port combinations.

Now this is nothing new, there has been a limitation on [Windows networking + Docker](https://blog.sixeyed.com/published-ports-on-windows-containers-dont-do-loopback/) for a long time, but my scripts were aware of this, and we were using the right IP for the specific container up until we moved to Windows version 1809, and now "it should just work", but it didn't.

> NOTE: If you're using a Windows version LESS THAN 1809, you can follow the steps [in this StackOverflow answer](https://stackoverflow.com/questions/47010047/localhost-not-working-docker-windows-10/47011886#47011886).

After a long time, I had realised that this laptop had recently been re-configured, and the Windows firewall was blocking this as "outbound traffic". After recategorising [my WiFi network to Private](https://support.microsoft.com/en-us/help/4043043/windows-10-make-network-public-private), everything "just worked" as expected.

### Website rendered without CSS

Jekyll, when it starts, looks for the configured `host:port/baseurl` structure by lifting that out of `_config.yml`, and uses this combination when rendering URLS for the site - including CSS & Javascript files. My configuration was set to use `http://hermens.com.au` as `site.url`, but no `HOST` was specified.

The solution for me was to use configuration overloading in the Docker Compose command: `jekyll serve --config  _config.yml,_config.docker.yml`, which [according to the docs](https://jekyllrb.com/docs/configuration/environments/) mean that any values that match in later files will replace earlier files. Adding the `_config.docker.yml` and overriding the `url` value to `http://localhost:4000` fixed this for me.

Since I've been looking into it though, this is NOT the suggested way to do this, and instead I should be setting the [site.host and site.port values](https://jekyllrb.com/docs/configuration/options/#serve-command-options) for use when debugging locally. Looks like I still have an outstanding change to make here :)

### Starefossen no longer up to date

For a long time, I advised people to use the latest image from [Starefossen](https://github.com/Starefossen/docker-github-pages), but this is now a bit out of date. To get a better experience locally with Jekyll, it's advised to use the official [jekyll/jekyll:pages](https://github.com/envygeeks/jekyll-docker) instead. I don't think there's anything _wrong_, per-se with the Starefossen image, it's just that it's not actively updated in the same way that the official Jekyll images are.

### Container not accepting updates

This was a fun one. After I changed from Starefossen to Jekyll docker images, my files weren't being watched.
Everything was running, but the build wasn't recompiling pages.

According to [the documentation](https://jekyllrb.com/docs/step-by-step/01-setup/#build) `--watch` should be enabled by default when using `jekyll serve`, but wasn't for me... I needed to manually add `--watch` and `--force_polling` to the Docker Compose command, so it became even longer: `jekyll serve --force_polling --watch --config  _config.yml,_config.docker.yml`. Quite a mouthful by now.

## Results

I have a bunch of new/updated scripts & config to run everything locally for me:

- `Docker.BuildAndRun.ps1` and `Docker.StopAndRemove.ps1` - the [diff is here](https://github.com/PHeonix25/PHeonix25.github.io/commit/04fccfac9fc1461bb2e6638418a569823420269d#diff-68d5e20a6c7789c1049261ed6760be99).
- `docker-compose.yml` [was updated](https://github.com/PHeonix25/PHeonix25.github.io/commit/bd24ad1bcab071545105ff9bc23fde34aded3362#diff-4e5e90c6228fd48698d074241c2ba760).
- `_config.yml` was expanded & is overridden by `_config.docker.yml` that matches the `JEKYLL_ENV` environment variable.
- ...and the old `dockerfile` can now be removed.

As an added bonus, thanks to these upgrades, I can now just do `docker-compose up` and `docker-compose down` if I wish!

I hope this helps you as much as it will help future me :) Cheers.


text:
module ngApp.components.ui.file {

  angular.module("ui.file", [
    "file.filters"
  ]);
}


text:
#ifndef _RegisterTypes_OsimPlugin_h_
#define _RegisterTypes_OsimPlugin_h_
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#include "osimPluginDLL.h"

extern "C" {

OSIMPLUGIN_API void RegisterTypes_osimPlugin();

}

class dllObjectInstantiator
{
public:
        dllObjectInstantiator();
private:
        void registerDllClasses();
};

#endif // _RegisterTypes_OsimPlugin_h_


text:
package convalida.validators;

import android.text.Editable;
import android.widget.EditText;

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

/**
 * @author wellingtoncosta on 25/04/18
 */
public class BetweenValidatorTest {

    private EditText startEditText;
    private EditText limitEditText;

    private static String startErrorMessage = "Value cannot greater then limit field value";
    private static String limitErrorMessage = "Value cannot less then start field value";

    @Before public void setUp() {
        startEditText = mock(EditText.class);
        limitEditText = mock(EditText.class);
        when(startEditText.getText()).thenReturn(mock(Editable.class));
        when(limitEditText.getText()).thenReturn(mock(Editable.class));
    }

    @Test public void emptyValues() {
        BetweenValidator validator = new BetweenValidator(
                startEditText,
                limitEditText,
                startErrorMessage,
                limitErrorMessage,
                true,
                true);

        when(startEditText.getText().toString()).thenReturn("");
        when(limitEditText.getText().toString()).thenReturn("");

        assertFalse(validator.validate());
    }

    @Test public void startFieldWithValueAndLimitFieldWithEmptyValue() {
        BetweenValidator validator = new BetweenValidator(
                startEditText,
                limitEditText,
                startErrorMessage,
                limitErrorMessage,
                true,
                true);

        when(startEditText.getText().toString()).thenReturn("123");
        when(limitEditText.getText().toString()).thenReturn("");

        assertFalse(validator.validate());
    }

    @Test public void startValueGreaterThanLimitValue_Numeric() {
        BetweenValidator validator = new BetweenValidator(
                startEditText,
                limitEditText,
                startErrorMessage,
                limitErrorMessage,
                false,
                false);

        when(startEditText.getText().toString()).thenReturn("2000");
        when(limitEditText.getText().toString()).thenReturn("1000");

        assertFalse(validator.validate());
    }

    @Test public void startValueGreaterThanLimitValue_Text() {
        BetweenValidator validator = new BetweenValidator(
                startEditText,
                limitEditText,
                startErrorMessage,
                limitErrorMessage,
                false,
                false);

        when(startEditText.getText().toString()).thenReturn("zzzz");
        when(limitEditText.getText().toString()).thenReturn("aaaa");

        assertFalse(validator.validate());
    }

    @Test public void startValueEqualsToLimitValue_Numeric() {
        BetweenValidator validator = new BetweenValidator(
                startEditText,
                limitEditText,
                startErrorMessage,
                limitErrorMessage,
                true,
                true);

        when(startEditText.getText().toString()).thenReturn("2222");
        when(limitEditText.getText().toString()).thenReturn("2222");

        assertTrue(validator.validate());
    }

    @Test public void startValueEqualsToLimitValue_Text() {
        BetweenValidator validator = new BetweenValidator(
                startEditText,
                limitEditText,
                startErrorMessage,
                limitErrorMessage,
                true,
                true);

        when(startEditText.getText().toString()).thenReturn("xxxx");
        when(limitEditText.getText().toString()).thenReturn("xxxx");

        assertTrue(validator.validate());
    }

    @Test public void startValueLessThanLimitValue_Numeric() {
        BetweenValidator validator = new BetweenValidator(
                startEditText,
                limitEditText,
                startErrorMessage,
                limitErrorMessage,
                true,
                true);

        when(startEditText.getText().toString()).thenReturn("1111");
        when(limitEditText.getText().toString()).thenReturn("2222");

        assertTrue(validator.validate());
    }

    @Test public void startValueLessThanLimitValue_Text() {
        BetweenValidator validator = new BetweenValidator(
                startEditText,
                limitEditText,
                startErrorMessage,
                limitErrorMessage,
                true,
                true);

        when(startEditText.getText().toString()).thenReturn("xxxx");
        when(limitEditText.getText().toString()).thenReturn("zzzz");

        assertTrue(validator.validate());
    }

}


text:
exports.run = function (bot, msg, args) {
  msg.delete()
  msg.channel.send(`osusig :arrow_forward:https://osusig.ppy.sh/image1.png?uid=${args.join(' ')}&m=0`);
};

exports.info = {
    name: 'osu',
    usage: 'osu',
    description: 'osu! signatue'
};


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>Configuration options</title>

<link rel="stylesheet" type="text/css" href="chromium.css">

Provided SPU's

This page describes the Stream Processing Units (SPUs) provided with
Chromium, including all their options.

Example of setting SPU parameters are:

spu = SPU('render')

spu.Conf('window_geometry', [0, 0, 512, 512])

spu.Conf('window_title', 'my window')

spu.Conf('resizable', 1)

spu = SPU('tilesort')

spu.Conf('bucket_mode', 'Uniform Grid')

Users should examine the sample Chromium configuration files to see how
some of these SPUs are used.

Note that brackets must be put around configuration parameters when
there's more than one value (i.e. use Python's list syntax).
For example, the hiddenline SPU's fog_color parameter is specified with
three floating point values.
They must be contained in brackets:

spu = SPU('hiddenline')

spu.Conf('fog_color', [ 1.0, 0.5, 0.25 ])

SPU index

Array

Binaryswap

Distributed Texture

Expando

Feedback

Fps

Hiddenline

Injector

Matte

Motionblur

Nop

Pack

Perf

Print

Readback

Render

Replicate

Saveframe

Simplequery

Tilesort

VNC

Wet

ZPix

Array SPU

The Array SPU implement's OpenGL's vertex arrays.  If your application uses
vertex arrays, the array SPU should be the first one in the SPU chain.
The Array SPU has no configuration options.

Binaryswap SPU

The Binaryswap SPU implements the well known
binary swap method of image compositing for parallel rendering.
It works similar to the Readback SPU.
Since the Binaryswap SPU is derived from the Render SPU, all the Render SPU
options are applicable to the Binaryswap SPU.
See cr/mothership/configs/psubmit_bswap.conf for an example of how to use
this SPU.

For background information on the binary swap algorithm read

Parallel Volume Rendering Using Binary-Swap Image Composition (pdf).

    Parameter Name
    Value Types
    Description

    local_visualization
    Boolean

    If true, intermediate rendering will be displayed in the binary swap
    SPU's window.

    node_number
    Integer

    The number of the node in relation to the swap ordering.  Binary swap
    compositing requires a specific ordering of the nodes to correctly do
    alpha compositing.  A power-of-two ordering defines this order such that
    nodes 0 and 1 swap, 2 and 3 swap, etc.  The next phase has 0 and 2 swap,
    then 1 and 3, etc.  The number defined here specifies where in this
    compositing order the node should be placed.  If your final image is
    composited incorrectly, double check the node ordering you setup here.

    peers
    String

      A comma-separated list of peer node names of the form
      PROTOCOL://HOSTNAME[:PORT].

      For example: "sdp://render1.foo.com" or "tcpip://render2.foo.com:7100".

      The port number is optional and
      will be automatically chosen if not present.

      An example list for a 4-node binary swap configuration is
      "tcpip://render1.foo.com,tcpip://render2.foo.com,
      tcpip://render3.foo.com,tcpip://render4.foo.com".

      The number of node names listed must be a power of two.
      The list of nodes must also be listed in the order
      the nodes are defined in, e.g. node0 must be listed before node1.

    type
    Enum

      Controls whether depth or alpha buffers are used to composite images.
      Possible value are depth and alpha.

Distributed Texture

The dist_texture SPU supports server-side loading of texture images.
The goal is to avoid the cost of transmitting texture image data over
the "wire" with the Pack and Tilesort SPUs.

The dist_texture SPU is typically placed before the Render SPUs on the
crservers in tilesort configurations.

The dist_texture SPU implements a new version of the glTexImage2D function.
Specifically, the type parameter will accept two new values:
GL_TRUE and GL_FALSE.

If type==GL_TRUE, then the dist_texture SPU will operate in write mode.
The glTexImage2D pixels parameter will point to
pixel data which is prefixed by a NULL-terminated filename (i.e. the
pointer points to a block of data consisting of a filename, a zero byte
and then tightly-packed GL_RGB/GL_UNSIGNED byte image data.
The dist_texture SPU will write the image data to a PPM image file using
the given name.

If type==GL_FALSE, then the dist_texture SPU will operate in read mode.
The glTexImage2D pixels parameter will point to a NULL-terminated
filename.
The dist_texture SPU will read that named PPM image file and give it to
OpenGL as the texture image.

The idea is that a program can use write-mode to distribute texture image
data on a rendering cluster the first time the program is run.
Then, the second and subsequent runs can use read-mode to quickly read
the texture data from the render servers, instead of passing it all
through the Chromium tilesort SPU.

See the
NCSA Pixel Blaster program for an example of how this features is used.

The dist_texture SPU has no configuration options.

Expando SPU

The Expando SPU records the contents of display lists, then replays the
commands when glCallList is called.  The Expando SPU has no options.

Feedback SPU

The Feedback SPU implement's OpenGL's selection and feedback features.
If your application needs either of these features, you should use the
Feedback SPU in your configuration.

    Parameter Name
    Value Types
    Description

    default_viewport
    Boolean

      The feedbackSPU will answer glGet's for GL_VIEWPORT. When
      enabled the feedbackSPU will return the applications viewport size
      rather than the tilesortSPU returning the scaled viewport size.
      Default 0.

FPS SPU

The FPS SPU measures the time between calls to
glXSwapBuffers(), and issues performance
reports to stderr at regular intervals.  It's useful
for determining rendering performance of a Chromium configuration.

    Parameter Name
    Value Types
    Description

    report_seconds
    Float

    If the given number of seconds have passed since the last time a report
    was issued, a new report is issued.  If set to 0.0, time-based
    report triggers are disabled.  The default value is 10.0,
    meaning a report will be issued about every 10 seconds (although a report
    could be issued sooner if the report_frames option, below,
    is used).

    report_frames
    Integer

    If the given number of frames have been rendered since the last time a
    report was issued, a new report is issued.  If set to 0,
    frame-based report triggers are disabled.  The default value is 0,
    meaning that frame-count-based reports are by default disabled.
    (Elapsed-time-based reports, as configured by report_seconds
    above, will still be in effect.)

    report_at_end
    Boolean

    If set, an additional report with the average FPS across the entire
    run of the SPU is issued as the SPU is closing down.  The default
    value is set.

Hiddenline SPU

The Hiddenline SPU draws objects in hidden-line mode.

    Parameter Name
    Value Types
    Description

    buffer_size
    int

          The size of command buffer used for recording OpenGL commands
          (in bytes).  Default is 32768.

    fog_color
    3 Floats

      Sets the fog color (red, green, blue) when using silhouette mode.

    line_color
    3 Floats

      Sets the line color (red, green, blue).
      Default is pale black (0, 0, 0).

    line_width
    Float

      Sets the line width (in pixels).  Default is 3.

    poly_color
    3 Floats

      Sets the polygon color (red, green, blue).
      Default is white (1, 1, 1).

    silhouette_mode
    Boolean

      If set, just render silhouette lines instead of all polygon edges.

    single_clear
    Boolean

      Controls whether glClear commands are ignored when issued but
      later called in SwapBuffers.  Default is true.
      You may need to set this to false for sort-last rendering.

Injector SPU

XXX no description?

    Parameter Name
    Value Types
    Description

    oob_url
    String
    XXX

Matte SPU

The Matte SPU forces all rendering to be within
a subwindow of a render window, initializing the area outside
of the subwindow to a matte color.

Beyond simple visual effects (e.g. effectively having a color border around an
application's rendering area), the Matte SPU can be used to meet constraints
for some types of hardware tile composition. For example, consider a
hardware compositor that will only use a 512x512 pixel subarea of a display,
but requires that subarea to be precisely placed on the screen, with the
rest of the screen completely black; this can be managed by using
the Render SPU configured with a full-screen
window, in conjunction with the Matte SPU to fill that window with black
and place the rendering tile in the appropriate position.
the accumulation buffer to simulate motion blur of
moving objects.

    Parameter Name
    Value Types
    Description

    matte_region
    4 Integers

    This specifies the subarea of a window that will actually be used
    for rendering, as an array of four integers [x,y,width,height].
    The first two specify the lower-left corner of the subarea,
    relative to the lower-left corner of the parent window.  The second
    two specify the width and height of the subarea.

    The default is [0,0,1024,1024], a 1024x1024-pixel
    region with the lower-left corner aligned with the lower-left corner
    of the parent window.

    use_matte_color
    Boolean

    This specifies that the matte area (the area outside the render subarea)
    will be initialized to a constant color (specified with the
    matte_color configuration option, below).
    The default value is 1, meaning that the matte area will be cleared
    to the given color.

    matte_color
    4 Floats

    This specifies the color that will be used to initialize the matte
    area (the area outside the render subarea), as an array of four
    floats representing [red,green,blue,alpha].

    The default value of [0.0,0.0,0.0,0.0] means that the
    matte area will be painted black.  [1.0,1.0,1.0,0.0]
    would mean that the matte area would be painted white.

    every_clear
    Boolean

    This specifies whether the matte area (the area outside the
    render subarea) will be painted every time the application
    requests that the render subarea be cleared, or only the first time.

    The default value of 0 means that the matte area will
    be painted only the first time the render subarea is cleared; this
    value is appropriate for windows that will never need to repaint
    the matte area (e.g., a full-screen window that will never be
    obscured by other windows).

    A value of 1 means that the matte area will be painted
    every time the render subarea is cleared.  This is appropriate for
    windows that will have to respond to exposure, or that might
    for any other reason have to repaint the matte area.
    require

Motionblur SPU

The Motionblur SPU uses the accumulation buffer to simulate motion blur of
moving objects.

    Parameter Name
    Value Types
    Description

    blur
    Enum

      This specifies the amount of motion blur.
      Legal values are 'Little', 'Medium', 'Lots', and 'Extreme'.
      The default is 'Medium'.

Nop SPU

The Nop (No-operation) SPU effectively discards all commands sent to it.
One use of the Nop SPU is to replace the Render SPU in order to measure
system performance without doing any rendering.

Pack SPU

The Pack SPU simply packs all the OpenGL commands into buffer which are
sent to the downstream server.

    Parameter Name
    Value Types
    Description

    emit_GATHER_POST_SWAPBUFFERS
    Bool
    Purpose?

    swapbuffer_sync
    Boolean
    If set to 1, do a
      synchronization operation in SwapBuffers to that the pack SPU
      doesn't buffer up frames faster than can be rendered downstream.
      The default is 1.

Perf SPU

The Perf SPU is used to collect
performance statistics while running Chromium.

    Parameter Name
    Value Types
    Description

    dump_on_finish
    Boolean

      Will cause performance data to be 'dumped' when glFinish is called.
      Useful if SwapBuffers is not used. Default 0.

    dump_on_flush
    Boolean

      Will cause performance data to be 'dumped' when glFlush is called.
      Useful if SwapBuffers is not used. Default 0.

    dump_on_swap_count
    Integer

      Trigger when data is to be 'dumped' on hitting this amount of
      SwapBuffer calls. Default 0.

    token
    String

      Mark 'interesting' performance data with tokens. Default is 'tab'.

    log_separator
    String

      Field separator for logged data. Default is 'tab'.

    mothership_log
    Boolean

      Send performance data to a mothership log file. Set
      CR_PERF_MOTHERSHIP_LOGFILE to a file on the mothership for data
      collection. This allows for gathering of data from multiple nodes.
      Default 0.

    token
    String

      Mark 'interesting' performance data with tokens. Default is 'tab'.

Print SPU

The Print SPU prints each OpenGL command to stderr or a file.
It's useful for debugging Chromium and inspecting the OpenGL commands
issued by applications

    Parameter Name
    Value Types
    Description

    log_file
    String
    Name of log file to generate.
          If this parameter is not specified, the Print SPU will send
          its output to standard error.
	  If this is a relative path, the file will be created relative
	  to the current directory, which will usually be either the directory
	  that the server was launched from, or the start directory specified
	  for the application node.  If no start directory was specified, the
	  client log file will appear in the directory that
	  crappfaker was run from.

Readback SPU

The Readback SPU is very similar to the Render SPU.  It's special in
that when SwapBuffers is called, the Readback SPU uses glReadPixels to
read the contents of the color/depth buffer(s) and sends them to the
next SPU in the chain with glDrawPixels.
This SPU is commonly used to implement sort-last rendering configurations.

Since the readback SPU is derived from the render SPU, it accepts all
configuration options that the render SPU accepts, plus a few more:

    Parameter Name
    Value Types
    Description

    extract_alpha
    Boolean
    If set to 1, the alpha
      values will be sent along with the RGB values.
      The default is 0.

    extract_depth
    Boolean
    If set to 1, the depth
      buffer values will be used to do Z-compositing of the color
      images.  This is used for sort-last configurations.
      The default is 0.

    gather_mtu
    Integer
    ???

    gather_url
    String
    ???

    local_visualization
    Boolean
    If set to 1, SwapBuffers
      will be issued by the readback SPU so that you can actually see what's
      being rendered by the SPU.  The default is 0.

    visualize_depth
    Boolean
    If set to 1, the depth
      buffer values will be sent downstream as a luminance image, rather
      than sending the RGB image.  This allows one to see the Z buffer
      values as a grayscale image.  The default is 0.

Render SPU

The Render SPU renders OpenGL commands into a window.  Virtually every
Chromium configuration uses this SPU.

    Parameter Name
    Value Types
    Description

    borderless
    Boolean

          If non-zero, remove the window border/decoration.
          Only supported on X at this time.
          Default is 0.

    default_visual
    String
    The default visual used
      for windows and rendering contexts can be set by specifying a
      comma-separated list of the following tokens: rgb, alpha,
      depth (or z), double, stencil, accum, stereo, multisample.
      The visual is normally determined by the application program, but
      in some cases, this option is useful.
      The default is "rgb".

    display_string
    String

          Name of the X display to create windows on.  The default is the
          null string, so the DISPLAY environment variable will be used.
          This option is only recognized when using the X Window System.

    force_direct
    Boolean

      If true, do not allow the SPU to start if a direct rendering
      visual is not available.  X-Windows ONLY.  The default is 0.

    fullscreen
    Boolean
    If this flag is set, the window_geometry
      parameters will be ignored, and the created window will cover the entire
      screen.  The default is 0.

    gather_url
    String

	Gatherer URL (default NULL)

    gather_userbuf_size
    Integer

	XXX Size of Buffer to Allocate for Gathering (default 0).

    is_swap_master
    Boolean

	Specify if this render spu is the master of a "swap group". Default
	value is 0. There should only be one master per group.

    lut8
    768 Integers

	Specify an eight-bit/channel color lookup table. The first
	256 integers makeup the red lookup values, the next 256 make up the
	green lookup values, and the final make up the blue lookup values. For
	example,

	spu.Conf('lut8', [0, 1, 2, ..., 255, 0, 1, 2, ..., 255, 0, 1, 2, ..., 255])

	would provide the identity mapping.
	X-Windows ONLY.

    num_swap_clients
    Integer

	This specifies the number of clients in a swap group, not counting
	the master. This should be set for all swap masters.

    nv_swap_clients
    Integer

	XXX How many swaps to wait on (default 1).

    nv_swap_group
    Integer

	NVIDIA Swap Group Number (default 0).

    ontop
    Boolean
    If this flag is set, the
	  window will appear on top of all other windows.

    render_to_app_window
    Boolean

          If non-zero, the render SPU will render back into the original
          application window, instead of creating a new window.
          Default is 0.

          Note: this option only works if the render SPU is using the same
          X display as the application.
          You may have to set the display_string option to match the
          application display.
          Otherwise, the render SPU will print a warning that the application
          window ID is invalid for the render SPU's display.

    render_to_crut_window
    Bool

      If set, a window ID will be obtained from the mothership and OpenGL
      rendering will go to that window.
      The window ID is set by the CRUT server.
      The default is 0.

    resizable
    Boolean

      If non-zero, the render SPU window will be resizable by the user.
      The readback SPU also recognizes this flag and will adjust its
      window size accordingly.
      Default is 0.

    title
    String

      Specifies the text to display in the titlebar of the window.
      If the string contains %i it'll be replaced by the
      window ID number.
      Default is "Chromium Render SPU".

    try_direct
    Boolean
     If true, try to create a
	direct rendering visual.  X-Windows ONLY.  The default is 1.

    system_gl_path
    String

          Specifies the directory (path to) the OpenGL library to use.
          Default (on IRIX/Linux) is /usr/lib.

    show_cursor
    Boolean

          If non-zero, render a virtual cursor which tracks the
          location of the user's mouse pointer in the application window.
          This typically only works well with applications that constantly
          redraw the 3D window's contents.  Default is 0.

          Note: you must also set the application node's show_cursor
          option to make this work.

    swap_master_url
    String

	Specify the url to a master to attempt to better sync SwapBuffers.
	Setting this option also enables the attempted sync. See also
	is_swap_master and num_swap_clients

    use_osmesa
    Boolean

      If set (and Chromium's compiled for it - see options.mk)
      use OSMesa for off-screen rendering.

    window_geometry
    4 Integers
    Geometry of the window to
      create.  This is specified as four floating point numbers.  The
      first two give the (x,y) position of the upper left corner
      of the window, relative to the upper left corner of the screen.  The
      last two numbers give the width and height of the window,
      respectively.  The default is [0, 0, 256, 256].

    pbuffer_size
    2 Integers

      If non-zero, specifies a fixed width and height for pbuffers.
      All pbuffers will be allocated at this fixed size.
      This can avoid graphics memory fragmentation issues.
      The default is [0, 0] - allow any size of pbuffers.

    use_glxchoosevisual
    Boolean

      If zero, don't use the glXChooseVisual function.
      This is used as a work-around for some OpenGL drivers on Linux
      which seem to have a problem with symbol resolution (ATI).
      The default is 1 (use glXChooseVisual).

Replicate SPU

The Replicate SPU works in conjunction with the

XF4VNC project.  It gives a specially enhanced-VNC client
developed by Tungsten Graphics, Inc. the ability to do direct
rendering and gain the performance of the local graphics card at the
viewer.  Contact  Tungsten Graphics, Inc. for more information.

    Parameter Name
    Value Types
    Description

    render_to_crut_window
    Boolean

      If set, the replicate SPU will work with the CRUT window.

Saveframe SPU

The Savefame SPU saves the image from the colorbuffer to a file whenever
SwapBuffers is called.  It's useful for "screengrabs".

    Parameter Name
    Value Types
    Description

    basename
    String

      Note: This option is obsolete. Use the spec option instead.
      Base of the filename to which to save files.  All files will have a
      four-digit frame number and .ppm appended to them.  Example:
      frame0000.ppm.  This parameter allows you to modify the
      filename.  There is no default. If both a basename and spec option are
      given, the spec option overrides the basename.

    binary
    Boolean

          Specifies whether the PPM should be binary or not.
          If this parameter is set to true, saved images will be in "raw"
          PPM format.  If this parameter is set to false, saved images will
          be in "ascii" PPM format.  The default is true (binary).

    enabled
    Boolean

          Specifies whether the SPU should start off saving images or not.
          If false, the SPU will not save frames until it receives a
          glChromiumParameteri(GL_SAVEFRAME_ENABLED_CR,
          GL_TRUE) call.
          The default is true.

    format
    String

      The format option specifies the file format used to save frames.
      Currently, it must be "ppm" or "jpeg".
      The default is "ppm".

    geometry
    4 Integers

      Geometry of the frame to save.  This is specified as four integer
      numbers.  The first two give the (x,y) position of
      the upper left corner of the frame, relative to the upper left corner
      of the window.  The last two numbers give the width and height
      of the frame, respectively.  Any call to glViewport will override any
      settings given in this parameter.  If no glViewport call has been
      made, and no geometry is set, the saveframe SPU does nothing.

    single
    Integer

          Specifies saving a single frame.
          If this parameter is set, the saveframe SPU will only save a
          single frame.  Set this to the frame number of the frame to save.
          The default is unset.

    spec
    String

      A full specification of the filename to which to save frames. This
      should include a path (absolute or relative to the working directory
      of the crserver) and a filename.

      The filename should have %d
      in it to indicate where the frame number should be inserted.
      If the window is a stereo window, the filename should contain
      %c which will be replaced by L or R for each image.

      Note: In Python strings, the percent sign is interpreted, so
      you must insert a percent sign with %% instead of %.
      For example, saveframespu.Conf( "spec", "myMovie/frame%%d.ppm" )
      would save frames in the myMovie directory (assumed to be
      present in the working directory where crserver is started). Frames
      would be named frame1.ppm, frame2.ppm,
      frame3.ppm, ...  framen.ppm.
      The default is "frame%04d.ppm".

    format
    String

      The format option specifies the file format used to save frames.
      Currently, it must be "ppm" or "jpeg".
      The default is "ppm".

    stride
    Integer

      Sets the number of frames to skip.  The default is 1.  This means
      that every frame is saved.  Setting to 2 means to only save every
      other frame.

Simplequery SPU

The Simplequery SPU intercepts all OpenGL glGet*() functions and returns
simple default values.  This is useful when using file networking
which records command streams to files.

Tilesort SPU

The Tilesort SPU is used to divide the framebuffer into tiles which are
rendered by separate render servers.
The tilesort SPU is usually used to drive tiled, cluster displays (murals).
The tilesort SPU must be the last SPU in the chain and be connected to
one or more downstream servers.

    Parameter Name
    Value Types
    Description

    auto_dlist_bbox
    Boolean

	If set, automatically compute/use bounding boxes for display lists
        and bucketing.
        Without bounding boxes, all glCallList calls are broadcast to all
	servers.
        The default is 0 (off).

    bbox_line_width
    Float
    The width in pixels of the
      lines used to draw the bounding box.  If the draw_bbox
      flag is not set, this parameter has no effect.  The default is 5.

    bbox_scale
    Float

        Specifies a scaling factor for bounding boxes.
        This is useful for vertex programs which perturb vertex positions.
        By setting the scale factor to 2.0, for example, you can be sure
        that warped/perturbed geometry still lies inside the bounding box.
	The default is 1.

    bucket_mode
    Enum

      This option controls how primitives are bucketed or sorted among the
      render servers.
      Possible values are:

'Broadcast' - send all primitives to all servers.

'Test All Tiles' - test each primitive's bounding box
         against all tile's bounds.  This is the default value.

'Uniform Grid' - the tiles form a regular grid with
         uniform column widths and row heights.  Use a specially optimized
         bucketing algorithm.

'Non-Uniform Grid' - the tiles form a regular grid but
         the columns and rows don't all have the same width or height.  An
         optimized bucketing algorithm will be used, but it's not as efficient
         as the Uniform Grid option.

'Random' - primitives are sent to a randomly-chosen
         server.

'Warped Grid' - the grid tiles do not form a uniform
         grid of any sort.  Test primitive's bounding boxes against all tiles,
         without trivial rejection (slow).

'Frustum' - intended for use with
          non-planar tilesort.
          Geometry is tested for intersection with each server's viewing
          frustum.

    dlist_state_tracking
    Boolean

      If set, record state changes in display lists to keep GL state
      consistant.
      There is a performance penalty for enabling state tracking.
      The default is 0 (off).

    draw_bbox
    Boolean
    If this flag is set, the
      Tilesort SPU will add commands to the stream to draw the object-space
      bounding box around each block of geometry that is sent.  This is
      useful for seeing the computed granularity of work, but it makes the
      stream of graphics commands more complex and uses some slow OpenGL
      commands like glPushAttrib.  The default is 0.

    emit_GATHER_POST_SWAPBUFFERS
    Boolean

      Emit a glChromiumParameteri After SwapBuffers.
      The default is 0 (off).

    force_quad_bufferingf
    Boolean

      If set, force a non-stereo application into stereo mode.
      Each frame will be rendered twice, once with glDrawBuffer(GL_LEFT) and
      once with glDrawBuffer(GL_RIGHT).
      Off by default.

    scale_to_mural_size
    Boolean
    If set to 1, the OpenGL
      viewport will be rescaled to match the mural size (usually the desired
      behaviour).  If set to 0, the viewport will not be rescaled.  This is
      useful for conformance testing.  The default is 1.

    retile_on_resize
    Boolean
    If non-zero, when the
      tilesort SPU's WindowSize() function is called, the SPU will try to
      find a new mural size and tile layout to match the new window size.
      Typically, the WindowSize() function is called only if the application
      node's track_window_size option is set.  The default is 1.

      With some applications, setting track_window_size to 1 and
      retile_on_resize to 0 is needed to get reasonable results.

    fake_window_dims
    2 Integers
    Specifies the default
      window/mural size when the application doesn't create an X or Win32
      application window (i.e. parallel applications, like psubmit).
      This is needed in order for glViewport and
      glScissor to work correctly.
      The Tilesort SPU's glViewport implementation will
      determine the size of the client window (if it exists)
      to determine what part of the output space the client is trying to
      restrict drawing to.  However, if the Chromium context has been
      created out of thin air (i.e., with the
      crCreateContext
      call), the fake window dimensions will be returned.  If these
      parameters are not set, and there is no client window, using
      glViewport
      or glScissor will cause a fatal run-time error.

    glasses_type
    Enum

      Specifies the type of colored glasses used for anaglyph stereo mode.
      May be one of RedBlue, RedGreen, RedCyan, BlueRed, GreenRed,
      CyanRed.
      The default is RedBlue.

    lazy_send_dlists
    Boolean

      Send display lists to servers only when needed (lazy).
      Display lists are sent to each server as needed (by testing bounding
      boxes) instead of broadcasting the lists to all servers.
      The default is 0 (off; broadcast to all servers).

    local_tile_spec
    Boolean

      Specify Tiles Relative to Displays (see
      Warped
      Tile Sorting) .
      The default is 0 (off).

    scale_images
    Boolean

    If set, the images passed to glDrawPixels and glBitmap are scaled to
    match the mural's size.  glCopyPixels images are also scaled.
    The default is 0 (don't scale).

    split_begin_end
    Boolean
    If this flag is set, the
      Tilesort SPU will break blocks of geometry into pieces if they happen to
      fall on a buffer boundary.  This can happen if a lot of geometry is
      specified with no state changes, or if the MTU is small.  If the
      flag is not set, then the Tilesort SPU will simply grow the
      geometry buffer beyond the MTU.  The default is 1.

    stereo_mode
    Enum

      Specifies the stereo rendering mode to use.
      May be one of None, Passive, CrystalEyes, SideBySide, Anaglyph.
      The default is None.

    sync_on_swap
    Boolean
    If this flag is set, the
      Tilesort SPU will wait for a SwapBuffers call to be executed
      by all servers before continuing.  This will keep the client
      application from getting more than one frame ahead of any of the servers,
      but it requires a round-trip network packet from each server.  The
      default is 1.

    sync_on_finish
    Boolean
    If this flag is set, the
      Tilesort SPU will wait for a glFinish call to be executed by
      all servers before continuing.  The default is 1.

    use_dmx
    Boolean

      This should be set to 1 if using DMX.  When set, this option makes the
      tilesort SPU query the DMX server for updated window size/position
      information whenever the application window size/position changes.
      The DMX server information will be used to compute a new tile arrangment.
      The default is 0.

    render_to_crut_window
    Boolean

      If set, a window ID will be obtained from the mothership and OpenGL
      rendering will go to that window.
      The window ID is set by the CRUT server.
      The default is 0.

    display_string
    String

      Specifies the DMX display string.
      This may be used to override the setting of the DISPLAY environment
      variable.

    track_window_position
    Boolean

      If set, poll DMX windows for position changes and update tiling
      parameters.
      Default is 0 (off).

Additional notes on the Tilesort SPU and display lists

Normally, when display lists are created they're sent to all servers.
    Also, each glCallList() is sent to all servers.
    This inefficiency can be avoided if the display lists have
    associated bounding boxes.

A display list can be given a bounding box by two methods:

Call glChromiumParametervCR(GL_OBJECT_BBOX_CR, GL_FLOAT, 6, bbox)
        prior to glNewList() to specify a bounding box for the subsequent
        list.  Be sure to reset the bounding box after creating the list.

Set the Tilesort SPU's auto_dlist_bbox option.  This causes the
        Tilesort SPU to automatically compute a bounding box from the
        glVertex commands compiled into the list.
        If the display list contains matrix transformations, the bounding
        box may be computed incorrectly.

Normally, display lists are immediately sent to all servers as
    they're compiled.
    Instead, display lists can be sent to the servers only when they're
    drawn for the first time if the Tilesort SPU option lazy_send_dlists
    is set.

Normally, state changes encapsulated inside display lists are
    ignored by the Tilesort SPU.  This can result in rendering errors.
    To solve this, set the dlist_state_tracking option.
    Unfortunately, there is a performance penalty for using this option.

There may be problems with nested display lists.  Fortunately,
    few OpenGL applications use nested display lists.

VNC SPU

The VNC SPU allows one to view Chromium rendering remotely with a VNC viewer.
The VNC SPU is derived from the Render SPU.
It renders the incoming OpenGL command stream into a window.
Upon SwapBuffers, the window contents are read back and saved into a buffer.
In another thread, a VNC server is running.
It accepts connections from VNC viewers and returns the window image that
was saved in the buffer.

For more information about VNC see
RealVNC, or
TightVNC.

    Parameter Name
    Value Types
    Description

    server_port
    Integer

       The VNC port number.  Default is 5905.

    screen_size
    2 Integers

       Width and height of the screen buffer.
       Default is [1024, 768].

    max_update_rate
    Integer

       Maximum frame rate at which to send updates to VNC clients/viewers.
       Useful for load balancing.
       Default is 10 frames per second.

Wet SPU

The Wet SPU causes the image to appear wavy, as if viewed through water.

    Parameter Name
    Value Types
    Description

    density
    Integer

          Description?
          Default is 5.

ior	Float
          Index of refraction (between air and water?).
          Default is 1.2.

mesh_dice	Integer
          Number of rows and columns of control points in the underlying
          quadrilateral mesh which is distorted.
          Default is 100 rows and columns.

    raininess
    Integer

          Description?
          Default is 10.

    ripple_freq
    Float

          Ripple frequency.  Default is 2.

    ripple_scale
    Float

          Scale factor for water ripples.  Default is 1.

    time_scale
    Float

          Time scale factor.  Default is 1.

ZPix SPU

The ZPix SPU offers frame differencing and some simple-minded compression
schemes to reduce network bandwidth for glDrawPixels.
ZPix was built to work with the ReadbackSPU and currently only
handles frame buffer writes which begin at 0,0.
Frame differences are tracked in three logical buffers;
one each for color, depth, and stenciling.

For applications with a lot of image coherence, frame differencing
often results in many unchanged pixels which compress significantly..
The default GNU zlib compression scheme minimizes network
bandwidth while the PLE compression scheme takes advantage of
the special case of zero data values in the differenced frames to
get good compression with much less CPU resource.

When multiple clients feed a server, it is necessary to track
differences on a per client basis.
To disambiguate multiple instances use the client_id
to assign a unique integer id for each client.

Frame differencing is independent of compression and can be suppressed
with the no_diff option.
A useful artifact of suppressing frame differencing can be
obtained by just suppressing it on the server. What results is a
display where identical pixels are black and changed ones
are not (although the colors may be whimsical and the
depth buffer may become quite comical).

Several additional options provide for more verbose output
and debugging.

    Parameter Name
    Value Types
    Description

client_id	Int
	  Client identification to use for tracking differences

Default = 0

debug	Bool
          If TRUE, then perform additional debugging checks
          with each frame

no_diff	Bool

 0 - (default) do frame differencing

 1 - suppress frame differencing

verbose	Bool
          If TRUE, compression statistics  printed for each frame

    ztype
    Enum

	  This specifies the compress algorithm to use:

 0 - None

 1 - GNU zlib compression (zparm -1 or 1-9)

 2 - RLE (unimplemented)

 3 - PLE a chromium-inspired RLE

Default is 1 (GNU zlib)

    ztype_parm
    Int

	  Arbitrary parameter to pass to compression.

Default = -1 (what zlib expects)


text:
var boot = require('../bin/www').boot,
    shutdown = require('../bin/www').shutdown,
    port = require('../bin/www').port,
    superagent = require('superagent'),
    expect = require('expect.js');

describe('server', function() {
    before(function() {
        boot();
    });

    describe('homepage', function() {
        it('should respond to GET', function(done) {
            console.log("port: " + port.toString());
            superagent.get('http://localhost:' + port)
                .end(function (res) {
                    expect(res.status).to.equal(200);
                    done();
                });
        });
    });

    describe('roomsJSON', function() {
        it('should respond to GET s4f/data/rooms.json', function(done) {
            console.log("port: " + port.toString());
            superagent.get('http://localhost:' + port + '/s4f/data/rooms.json')
                .end(function (res) {
                    expect(res.status).to.equal(200);
                    done();
                });
        });
    });

    describe('simpleJSON', function() {
        it('should respond to GET s4f/data/simple.json', function(done) {
            console.log("port: " + port.toString());
            superagent.get('http://localhost:' + port + '/s4f/data/simple.json')
                .end(function (res) {
                    expect(res.status).to.equal(200);
                    done();
                });
        });
    });

    describe('shapesJSON', function() {
        it('should respond to GET s4f/data/shapes.json', function(done) {
            console.log("port: " + port.toString());
            superagent.get('http://localhost:' + port + '/s4f/data/shapes.json')
                .end(function (res) {
                    expect(res.status).to.equal(200);
                    done();
                });
        });
    });

    after(function () {
        shutdown();
    });
});


text:
:title: Install Harbur Captain

Install Harbur Captain
----------------------

Captain is a CLI build tool that converts Git workflow to Docker containers.

To install Captain follow the instructions provided in `Captain repo <https://github.com/harbur/captain>`_.

A quick-start guide is to launch the following script:

.. sourcecode:: bash

    curl -L https://github.com/harbur/captain/releases/download/v0.7.0/captain-`uname -s`-`uname -m` > /usr/local/bin/captain
    chmod +x /usr/local/bin/captain

To validate installation, run the following command:

.. sourcecode:: bash

    captain version

It should respond with the appropriate version number.


text:
require_relative '../../puppet_x/puppetlabs/netdev_stdlib/check'
if PuppetX::NetdevStdlib::Check.use_old_netdev_type
  Puppet::Type.newtype(:snmp_user) do
    @doc = 'Set the SNMP contact name'

    apply_to_all
    ensurable

    newparam(:name, namevar: true) do
      desc 'The name of the SNMP user'

      validate do |value|
        if value.is_a? String then super(value)
        else raise "value #{value.inspect} is invalid, must be a String."
        end
      end
    end

    newproperty(:version) do
      desc 'SNMP version [v1|v2|v2c|v3]'

      newvalues(:v1, :v2, :v2c, :v3)
    end

    newproperty(:roles, array_matching: :all) do
      desc 'A list of roles associated with this SNMP user'

      validate do |value|
        if value.is_a? String then super(value)
        else raise "value #{value.inspect} is invalid, must be a String."
        end
      end

      def should_to_s(new_value = @should)
        self.class.format_value_for_display(new_value)
      end

      def is_to_s(current_value = @is)
        self.class.format_value_for_display(current_value)
      end
    end

    newproperty(:auth) do
      desc 'Authentication mode [md5|sha]'
      newvalues(:md5, :sha)
    end

    newproperty(:password) do
      desc 'Cleartext password for the user'

      validate do |value|
        if value.is_a? String then super(value)
        else raise "value #{value.inspect} is invalid, must be a String."
        end
      end
    end

    newproperty(:privacy) do
      desc 'Privacy encryption method [aes128|des]'
      newvalues(:aes128, :des)
    end

    newproperty(:private_key) do
      desc 'Private key in hexadecimal string'

      validate do |value|
        if value.is_a? String then super(value)
        else raise "value #{value.inspect} is invalid, must be a String."
        end
      end
    end

    newparam(:localized_key) do
      desc 'If true, password needs to be a hexadecimal value'
      newvalues(:true, :false)
    end

    newparam(:enforce_privacy) do
      desc 'If true, message encryption is enforced'
      newvalues(:true, :false)
    end

    newproperty(:engine_id) do
      desc 'Necessary if the SNMP engine is encrypting data'

      validate do |value|
        if value.is_a? String then super(value)
        else raise "value #{value.inspect} is invalid, must be a String."
        end
      end
    end

    def self.title_patterns
      identity = nil # optimization in Puppet core
      name = [:name, identity]
      version = [:version, ->(x) { x.to_sym }]
      [
        [/^([^:]*)$/,                 [name]],
        [/^([^:]*):([^:]*)$/,         [name, version]]
      ]
    end
  end
else
  require 'puppet/resource_api'

  Puppet::ResourceApi.register_type(
    name: 'snmp_user',
    docs: 'Set the SNMP contact name',
    features: ['canonicalize','simple_get_filter'] + ( Puppet::Util::NetworkDevice.current.nil? ? [] : ['remote_resource'] ),
    attributes: {
      ensure: {
        type:       'Enum[present, absent]',
        desc:       'Whether the SNMP User should be present or absent on the target system.',
        default:    'present'
      },
      # TODO: NETDEV-36: composite namevars
      name: {
        type:       'String',
        desc:       'Composite ID of username / version (if applicable)',
        behaviour:  :namevar
      },
      version: {
        type:      'Optional[Enum["v1", "v2", "v2c", "v3"]]',
        desc:      'SNMP version [v1|v2|v2c|v3]'
      },
      roles: {
        type:       'Optional[Array[String]]',
        desc:       'A list of roles associated with this SNMP user'
      },
      auth: {
        type:      'Optional[Enum["md5", "sha"]]',
        desc:      'Authentication mode [md5|sha]'
      },
      password: {
        type:      'Optional[String]',
        desc:      'Cleartext password for the user'
      },
      privacy: {
        type:      'Optional[Enum["aes128", "aes192", "aes256", "des", "3des"]]',
        desc:      'Privacy encryption method [aes128|aes192|aes256|des|3des]'
      },
      private_key: {
        type:      'Optional[String]',
        desc:      'Private key in hexadecimal string'
      },
      localized_key: {
        type:      'Optional[Boolean]',
        desc:      'If true, password needs to be a hexadecimal value [true|false]'
      },
      enforce_privacy: {
        type:      'Optional[Boolean]',
        desc:      'If true, message encryption is enforced [true|false]'
      },
      engine_id: {
        type:      'Optional[String]',
        desc:      'Necessary if the SNMP engine is encrypting data'
      }
    }
  )
end


text:
<!DOCTYPE html>

  First move your mouse cursor to the page, you will see the text under the mouse cursor changed to "currently hovered".

  Scroll mouse wheel slowly, you should not see any text under the mouse changed to "currently hovered" while the scrolling is in process and finishes.

hover over me

hover over me

hover over me

hover over me

hover over me


text:
package org.apache.polygene.bootstrap;

import java.util.Map;
import org.apache.polygene.api.association.Association;
import org.apache.polygene.api.association.ManyAssociation;
import org.apache.polygene.api.property.Property;
import org.apache.polygene.test.AbstractPolygeneTest;
import org.junit.Test;

import static org.hamcrest.core.StringContains.containsString;
import static org.junit.Assert.assertThat;

public class ErrorReportingTest extends AbstractPolygeneTest
{
    private static final String NL = System.getProperty( "line.separator" );

    @Override
    public void assemble( ModuleAssembly module )
    {
        module.values( Person.class );
        module.values( Pet.class );
    }

    @Override
    protected void assemblyException( AssemblyException exception )
    {
        assertThat( exception.getMessage(), containsString( "Composition Problems Report:" + NL ) );
        assertThat( exception.getMessage(), containsString( "    message: No implementation found for method" + NL
                                                            + "    method: Map doAnotherThing(String name, int value)" + NL
                                                            + "    types: [Person,ValueComposite]" + NL ) );

        assertThat( exception.getMessage(), containsString( "    message: No implementation found for method" + NL
                                                            + "    method: void doOneThing()" + NL
                                                            + "    types: [Person,ValueComposite]" + NL ) );

        assertThat( exception.getMessage(), containsString( "    message: No implementation found for method" + NL
                                                            + "    method: void goForWalk(int minutes)" + NL
                                                            + "    types: [Pet,ValueComposite]" + NL ) );
    }

    @Test
    public void dummy()
    {

    }

    public interface Person
    {
        void doOneThing();

        Map<String, Integer> doAnotherThing( String name, int value );

        Property<String> name();

        Association<Person> spouse();

        ManyAssociation<Pet> pets();
    }

    public interface Pet
    {
        void goForWalk( int minutes );
    }
}


text:
<?php

/**
 * Our homepage. Show a table of all the author pictures. Clicking on one should show their quote.
 * Our quotes model has been autoloaded, because we use it everywhere.
 *
 * controllers/Welcome.php
 *
 * ------------------------------------------------------------------------
 */
class Welcome extends Application {

	function __construct()
	{
		parent::__construct();
	}

	//-------------------------------------------------------------
	//  The normal pages
	//-------------------------------------------------------------

	function index()
	{
		$this->data['pagebody'] = 'homepage';	// this is the view we want shown
		// build the list of authors, to pass on to our view
		$source = $this->quotes->all();
		$authors = array();
		foreach ($source as $record)
		{
			$authors[] = array('who' => $record['who'], 'mug' => $record['mug'], 'href' => $record['where']);
		}
		$this->data['authors'] = $authors;

		$this->render();
	}

        function shucks()
        {
            $record = $this->quotes->get(2);

            $this->data = array_merge($this->data, $record);
            $this->data['pagebody'] = 'justone';
            $this->render();
        }

}

/* End of file Welcome.php */
/* Location: application/controllers/Welcome.php */


text:
/*
 * Open Source Software published under the Apache Licence, Version 2.0.
 */

package io.github.vocabhunter.gui.services;

import io.github.vocabhunter.analysis.filter.WordFilter;
import io.github.vocabhunter.gui.model.FilterSettings;
import io.github.vocabhunter.gui.model.FilterSettingsTool;
import io.github.vocabhunter.gui.model.MainModel;

import javax.inject.Inject;
import javax.inject.Singleton;

@Singleton
public class FilterService {
    private static final WordFilter NOP_FILTER = w -> true;

    private final MainModel model;

    private final FilterSettingsTool tool;

    @Inject
    public FilterService(final MainModel model, final FilterSettingsTool tool) {
        this.model = model;
        this.tool = tool;
    }

    public void setFilterSettings(final FilterSettings settings) {
        if (!settings.equals(model.getFilterSettings())) {
            model.setFilter(tool.filter(settings));
            model.setFilterSettings(settings);
        }
    }

    public WordFilter getFilter(final boolean isEnableFilters) {
        if (isEnableFilters) {
            return model.getFilter();
        } else {
            return NOP_FILTER;
        }
    }
}


text:
require 'colored'

# A Logger utility help class
#
class XCRes::Logger

  # @return [Bool]
  #         if set to false, calls to #log will be ignored
  #         otherwise they will be printed, false by default.
  attr_accessor :verbose
  alias :verbose? verbose

  # @return [Bool]
  #         if set to true, all log calls of all kinds will be ignored
  #         otherwise they will be printed, false by default.
  attr_accessor :silent
  alias :silent? silent

  # @return [Bool]
  #         if set to true, ANSI colors will be used to color the output
  #         otherwise it will output plain text, true by default.
  attr_accessor :colored
  alias :colored? colored

  # @return [String]
  #         the indentation of the output, empty string by default.
  attr_accessor :indentation

  # Initialize a new logger
  #
  def initialize
    self.silent = false
    self.verbose = false
    self.colored = true
    self.indentation = ''
  end

  # Prints a formatted message
  #
  # @param [String] message
  #        the message, which can have format placeholders
  #
  # @param [#to_s...] format_args
  #        will be passed as right hand side to the percent operator,
  #        which will fill the format placeholders used in the message
  #
  def inform message, *format_args
    puts indentation + message % format_args unless silent?
  end

  # Prints a formatted message in a given color, and prints its arguments
  # with bold font weight
  #
  # @param [String] message
  #        the message, which can have format placeholders
  #
  # @param [Symbol] color
  #        the color, String has to #respond_to? this
  #
  # @param [#to_s...] format_args
  #        will be passed as right hand side to the percent operator,
  #        which will fill the format placeholders used in the message
  #
  def inform_colored message, color, *format_args
    if colored?
      parts = message
         .gsub(/%[\ +#]?\d*\.?\d*[a-z]/, "\0"+'\0'+"\0")
         .split("\0")
         .reject(&:empty?)
      message = parts.map do |part|
        if part[0] == '%' && part[1] != '%'
          (part % [format_args.shift]).bold.gsub('%', '%%')
        else
          part
        end
      end.map(&color).join('')
    end
    inform message, *format_args
  end

  # Print a log message of log level verbose
  #
  # @param [String] message
  #        the message, which can have format placeholders
  #
  # @param [#to_s...] format_args
  #        will be passed as right hand side to the percent operator,
  #        which will fill the format placeholders used in the message
  #
  def log message, *format_args
    inform_colored 'Ⓥ' + ' ' + message, :magenta, *format_args if verbose?
  end

  # Print a log message to indicate success of an operation in green color
  #
  # @param [String] message
  #        the message, which can have format placeholders
  #
  # @param [#to_s...] format_args
  #        will be passed as right hand side to the percent operator,
  #        which will fill the format placeholders used in the message
  #
  def success message, *format_args
    inform_colored '✓' + ' ' + message, :green, *format_args
  end

  # Print a warning log message in yellow color
  #
  # @param [String|Exception] message_or_exception
  #        the message, which can have format placeholders
  #
  # @param [#to_s...] format_args
  #        will be passed as right hand side to the percent operator,
  #        which will fill the format placeholders used in the message
  #
  def warn message_or_exception, *format_args
    message, _ = coerce_to_message(message_or_exception)
    inform_colored '⚠' + ' ' + message, :yellow, *format_args
  end

  # Print a log message to indicate failure of an operation in red color
  #
  # @param [String|Exception] message_or_exception
  #        The message, which can have format placeholders,
  #        can also be a kind of Exception, then its message would been
  #        used instead. The backtrace will be only printed, if the verbose
  #        mode is enabled.
  #
  # @param [#to_s...] format_args
  #        will be passed as right hand side to the percent operator,
  #        which will fill the format placeholders used in the message
  #
  def fail message_or_exception, *format_args
    message, exception = coerce_to_message(message_or_exception)
    inform_colored '✗' + ' ' + message, :red, *format_args

    if verbose? && exception != nil
      log "Backtrace:\n"+exception.backtrace.join("\n"), :red
    end
  end

  private

  # Coerces the given message or an exception to a string, and yields them as
  # separated parameters to a block, which allows further handling.
  #
  # @param [#to_s] message_or_exception
  #        Can be a String message or an exception
  #
  # @return [String,Exception?] message,exception
  #         An array on first place is either the first argument or the
  #         exception's message. If the given argument +message_or_exception+
  #         is an exception, then it is the second element in the result.
  #
  def coerce_to_message(message_or_exception)
    exception = nil
    if message_or_exception.kind_of? Exception
      exception = message_or_exception
      message = exception.message
    else
      message = message_or_exception.to_s
    end

    return message, exception
  end

end