text:
package org.surfnet.crowd.model;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@XmlRootElement
@XmlAccessorType(value = XmlAccessType.FIELD)
public class ConextConfig {

  private ConextConfig() {
  }

  private String apiUrl;

  private String callbackUrl;

  private String apiKey;

  private String apiSecret;

  private List<GroupMapping> groupmappings = new ArrayList<GroupMapping>();

  private static final Logger LOG = LoggerFactory.getLogger(ConextConfig.class);

  public ConextConfig(String apiUrl, String callbackUrl, String apiKey, String apiSecret, List<GroupMapping> groupmappings) {
    this.apiUrl = apiUrl;
    this.callbackUrl = callbackUrl;
    this.apiKey = apiKey;
    this.apiSecret = apiSecret;

    if (groupmappings != null) {
      this.groupmappings = groupmappings;
    }
  }

  /**
   * Create a list of group mappings, based on form input that looks like:

   *

   *   group1=group2
   *   group3=group4
   *

   * @param input the textual input
   * @return the parsed list as List<GroupMapping>
   */
  public static List<GroupMapping> mappingsFromString(String input) {
    List<GroupMapping> result = new ArrayList<GroupMapping>();
    input = StringUtils.strip(input);
    if (input != null) {
      for (String line : input.split("\n")) {
        String[] elements = line.split("=");

        if (elements.length != 2) {
          LOG.info("Cannot parse line, will skip: " + line);
          continue;
        }
        result.add(new GroupMapping(StringUtils.strip(elements[0]), StringUtils.strip(elements[1])));
      }
    }
    return result;
  }

  public String getApiUrl() {
    return apiUrl;
  }

  public String getApiKey() {
    return apiKey;
  }
  public String getApiSecret() {
    return apiSecret;
  }

  public List<GroupMapping> getGroupmappings() {
    return groupmappings;
  }

  public String getGroupMappingAsString() {
    StringBuilder sb = new StringBuilder();
    for (GroupMapping gm : groupmappings) {
      sb.append(gm.getExternalGroupName())
          .append("=")
          .append(gm.getCrowdGroupName())
          .append("\n");
    }
    return sb.toString();
  }

  public String toString() {
    return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).toString();
  }

  public String getCallbackUrl() {
    return callbackUrl;
  }
}


text:
import fetch from 'isomorphic-fetch';
import Config from '../../server/config';

export const API_URL = (typeof window === 'undefined' || process.env.NODE_ENV === 'test') ?
  process.env.BASE_URL || (`http://localhost:${process.env.PORT || Config.port}/api`) :
  '/api';

export default function callApi(endpoint, method = 'get', body) {
  console.log(`${API_URL}/${endpoint}`);

  return fetch(`${API_URL}/${endpoint}`, {
    headers: { 'content-type': 'application/json' },
    method,
    body: JSON.stringify(body),
  })
  .then(response => response.json().then(json => ({ json, response })))
  .then(({ json, response }) => {
    if (!response.ok) {
      return Promise.reject(json);
    }

    return json;
  })
  .then(
    response => response,
    error => error
  );
}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <title>Analytical Insight</title>
    <link rel="shortcut icon" type="image/png" href="/favicon.png">
    <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
    <link href="/feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="Analytical Insight Full Atom Feed" />
    <link rel="stylesheet" href="/theme/css/screen.css" type="text/css" />
    <link rel="stylesheet" href="/theme/css/pygments.css" type="text/css" />
    <link rel="stylesheet" href="/theme/css/print.css" type="text/css" media="print" />
    <meta name="generator" content="Pelican" />

Home

Analytical Insight

Feb 23, 2017

                    Paper on BUDA Ratings

I submitted an abstract at the end of September in 2016 for the 2017 Sloan Sports Analytics Conference on the topic of player rating systems for recreational ultimate frisbee leagues. Two weeks later, I was excited to recieve an invitation to submit a full paper. I did so at the beginning of December. Unfortunately, I was not selected to present at the 2017 SSAC. I am a bit disappointed,  but not very surprised. The topic of the paper seems pretty far off the beaten path for SSAC due to the emphasis on recreational leagues as well as my choice of ultimate frisbee as the sport of interest. The good news is that I am now free to publish my paper anywhere I'd like -- so, here it is!

Published paper on player ratings in BUDA

                    posted at 09:31
                     · posts
                     ·
                     buda

Sep 22, 2016

                    Hat League Ratings

BUDA Rating and Team Performance¶

I'm excited to announce that I have been given access to the BUDA database of player ratings!  This means that I can compare my system of rating players with the one that is currently in use by BUDA.

Once again, let's dive straight in with the data: the relationship between BUDA Rating and team performance (represented by average plus/minus per game).  Each dot on this plot is a spring hat league team in the "JP Mixed (4/3)" division.  I've included teams from 2010 through the present.  The BUDA Rating shown is the average of the BUDA ratings for the players on that team.

Central conclusion: there is no obvious correlation between team performance and BUDA Rating.  The Pearson correlation coefficient is a paltry 0.095, and the p-value of 0.21 indicates that there is a 1-in-5 chance that this distribution of data could have been drawn randomly.  In other words, you can't use BUDA Rating to predict team performance.  This is a sensible result, since hat league is designed to assign players to teams in a way that maximizes parity league-wide, and BUDA Rating is the metric by which BUDA has assigned players to teams.

Club Rating and Team Performance¶

Now let's take a look at the relationship between team performance and the Club Rating that I've developed over the past few months.  As a brief refresher, it's based on the idea that most players participate in club leagues in which there is a vetting process that determines whether or not a player can join a team.  This vetting process can be as simple as a recommendation from a friend already on the team to something as complicated as a full tryout.  So if someone plays on a high-level club team, they will have a high Club Rating.  If they play on a low-level club team, they will have a low Club Rating.

Central conclusion: Club Rating correlates strongly with team performance!  The Pearson correlation coefficient is now 0.43, and the p-value is 3.9e-9--there is no chance this distribution of points was obtained randomly.  This means that Club Rating can be used to predict team performance.

Note: I've converted Club Rating to the same scale as BUDA Rating for convenience of comparison.

Note: Keen eyes may notice that the outlier from spring hat league 2016 is no longer as obvious in this diagram.  This is because I'm now using information from the BUDA player rating database to fill in when club playing experience data is not available.

We can dig a bit further to understand why BUDA Rating is less predictive of team performance than Club Rating.  Each player's BUDA Rating is the arithmetic mean of their Self Rating and their Captain Rating.  Self Rating is the rating that player has provided about themselves.  I.e., they indicate how far they can throw the disc, how fast they run, etc.  Captain Rating is the rating that one or more captains have provided about that player (based on answers to the same questions used to calculate Self Rating).

Captains are volunteers -- there is no requirement to provide ratings for their players, and often they don't.  In fact, about 55% of players have no Captain Rating.  In this situation, BUDA Rating is equal to Self Rating.

Note: a player's Captain Rating is used in place of Club Rating if experience at the club level is not available.  If no captains have rated a given player, then Self Rating is used in place of Captain Rating.  If no captains have rated a given player AND that player has no club experience, then Self Rating is used in place of Club Rating.

Self Rating and Team Performance¶

Let's compare Self Rating to team performance.

There is a striking, negative correlation between Self Rating and team performance!  In other words, the higher a team's average Self Rating, the more they are outscored by their opponents.  How can this be?  There are two plausible explanations, both of which are likely at work.

First, experienced players are aware that if they "sandbag" -- i.e., rate themselves lower than they actually are -- then they are likely to have stronger teammates and therefore likely to win more games.  There are many examples in the database of this effect, some more extreme than others.

Second, newer players lack the experience needed to rate themselves accurately.  They may under-rate or over-rate their skill level, simply because they are unfamiliar with the average league-wide skill level.  In a league with 24 teams (as is the case for spring hat league), there will be teams that randomly happen to have a cluster of players who over-rated themselves.  These teams will have a tough road ahead of them.

Captain Rating and Team Performance¶

Finally, let's compare Captain Rating to team performance.

Captain Rating correlates strongly with team performance, although not as strongly as Club Rating (Pearson correlation coefficient of 0.31 vs. 0.43).  It is clear that Captain Rating is far more predictive of true skill level than Self Rating.  This makes sense simply because captains have much more information at their disposal.  For example, they can rate the players on their team in a relative sense ("I need to make sure that Player X's rating is higher than Player Y's").  In fact, it might be the case that Captain Rating would outperform Club Rating if more than 45% of players had captain's ratings.  Given that captains are volunteers and busy people (like everyone else), it seems unreasonable to expect this percentage to change significantly in the future.

Recommendations¶

Going forward, I recommend that BUDA use  Club Rating and Captain Rating to determine player ratings in future hat leagues.  Self Rating should be avoided whenever possible for player ratings.

Next steps¶

Identify optimal combination of Club Rating and Captain Rating that yields New BUDA Rating.

Work with BUDA admins to implement New BUDA Rating for upcoming Holiday Hat League 2016 (starts in late October).

Investigate forecasting team performance not just by average Club Rating for players on the team, but also by average Club Rating for each quartile (i.e., average Club Rating for top 25% of players on the team, second-best 25%, third-best 25%, and bottom 25%).  The idea is that the top 25% of players on a team might be more impactful than the bottom 25%.  This method would be able to take this effect into account.

Submit an abstract on this work to the 2017 Sloan Sports Analytics Conference!

                    posted at 02:08
                     · posts
                     ·
                     buda

May 22, 2016

                    Spring Hat League 2016 Post-Mortem

Spring hat league 2016 wrapped up last week, so it's time to look at how my
predictions fared!

Let's jump straight in with the money plot.  This diagram shows the average
score differential per game for all of the teams in the "JP Mixed (4/3)"
division of spring hat league.  My team is highlighted by the red circle.  Yes,
that's us in the lower left corner of the diagram.  I projected my team to
finish near the bottom of the rankings, and we did.  I am proud and
embarrassed at the same time.

Another interesting feature of this diagram is the trend for teams with
higher predicted ratings to have better score differentials.  This is
compelling evidence in support of my methodology to rate BUDA teams.  I
suspect that putting this rating system into production for hat
league drafts would lead to more balanced teams than the current system.  To
test this hypothesis, I need access to the ratings that BUDA currently uses
for the draft.  I plan to contact BUDA to make this happen, with the eventual
 goal of implementing my ratings during hat league drafts.

One fun question we can ask right away is: how would my team have to change
to become an average spring hat league team?  To answer this question, we
need to know three things:

There are 16 players on each team.

A fantastic player has a rating of about 1800.

A complete novice has a rating of about 800.

If we replaced the lowest rated player on our roster with a complete stud, our
team rating would go up by (1800 - 800) / 16 = 62.5 points.  My team's rating
would become about 1120 -- we'd be significantly below average, but not the
worst team in the league anymore.  We'd reach about 1180 with another stud --
enough to be solidly in the upper half of the league.  Studs don't just grow on
trees, so what if we added a "reasonably good player" (i.e., rating of about
1400)?  In this case, we'd need about 3 players to get up to league average.

In future posts, I plan to discuss

methods to improve my ratings

interesting teams (what's going on with the team with a predicted rating
of 1050 and a score differential of +7??)

comparison to existing BUDA rating system (if I get access to the data)

interesting trends with time in the BUDA database

Note: In my last post, I ranked both the "JP Mixed (4/3)" and "Lexington Mixed
(4/3) Weekend" divisions, which is why I had 30 teams listed in the previous
post.

In [ ]:

                    posted at 22:13
                     · posts
                     ·
                     buda

Mar 30, 2016

                    Forecast for Spring Hat League 2016

I am playing on Team 20 in this year's Boston ultimate frisbee spring hat league.  Open spots for men in spring hat league fill up completely within an hour of registration starting, so I was super excited to get a roster spot.  Almost immediately after I got the confirmation email on March 22 that I was in the league, I began to wonder how good my team was going to be.

Disclaimer: This is hat league, in which players are (mostly) randomly assigned to teams.  The primary purpose of the league is to have fun playing ultimate frisbee.  I fully adhere to the principle that winning is secondary here.

With the disclaimer out of the way, I will admit that I am compulsively interested in quantifying talent at ultimate frisbee.  Fortunately, the Boston Ultimate Disc Alliance (BUDA) records the score of every game played in all leagues.  The roster for every team is available as well.  Game scores and rosters can be used to generate and assign a rating to every player in the database.

Over the past week, I scraped the BUDA website using BeautifulSoup, built the player rating database, and ranked each of the teams in spring hat league.  Check out the python code here that does all of this.

The upshot?  My assertion that winning is a secondary goal will be put to the test; I'm projecting team 20 to finish 25th out of 30.  Yikes!

Here is the full set of projected rankings.  The season starts tonight!  Looking forward to testing my projections!

Team 2

Team 3

Team 11

Team 14

Team 23

Team 10

Team 13

Team 19

Team 24

Team 21

Team 22

Team 30

Team 6

Team 12

Team 17

Team 8

Team 18

Team 9

Team 16

Team 15

Team 26

Team 25

Team 7

Team 1

Team 20

Team 4

Team 29

Team 5

Team 27

Team 28

                    posted at 21:12
                     · posts
                     ·
                     buda

                Blue Penguin Theme
                ·
                Powered by Pelican
                ·
                Atom Feed


text:
package com.alibaba.com.caucho.hessian.io;

import java.io.IOException;

/**
 * Exception for faults when the fault doesn't return a java exception.
 * This exception is required for MicroHessianInput.
 */
public class HessianProtocolException extends IOException {
  private Throwable rootCause;

  /**
   * Zero-arg constructor.
   */
  public HessianProtocolException()
  {
  }

  /**
   * Create the exception.
   */
  public HessianProtocolException(String message)
  {
    super(message);
  }

  /**
   * Create the exception.
   */
  public HessianProtocolException(String message, Throwable rootCause)
  {
    super(message);

    this.rootCause = rootCause;
  }

  /**
   * Create the exception.
   */
  public HessianProtocolException(Throwable rootCause)
  {
    super(String.valueOf(rootCause));

    this.rootCause = rootCause;
  }

  /**
   * Returns the underlying cause.
   */
  public Throwable getRootCause()
  {
    return rootCause;
  }

  /**
   * Returns the underlying cause.
   */
  public Throwable getCause()
  {
    return getRootCause();
  }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Dashboard</title>
<meta name="date" content="2017-08-19">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

registry

Class Dashboard

java.lang.Object

registry.Dashboard

All Implemented Interfaces:

java.io.Serializable

public class Dashboard
extends java.lang.Object
implements java.io.Serializable

This class holds the most recent information gathered for a patient.

See Also:

Serialized Form

Constructor Summary

Constructors

Constructor and Description

Dashboard()

Default constructor

<a href="../registry/Dashboard.html#Dashboard-registry.A1cResult-registry.ContinuousResult-registry.LdlResult-registry.ContinuousResult-registry.ContinuousResult-registry.TshResult-registry.ContinuousResult-registry.ContinuousResult-registry.ContinuousResult-registry.ContinuousResult-registry.ContinuousResult-registry.ContinuousResult-registry.BloodPressureResult-java.sql.Date-registry.CategoricalResult-registry.CategoricalResult-registry.PsychologicalScreeningResult-registry.DiscreteResult-java.sql.Date-java.sql.Date-java.sql.Date-java.sql.Date-java.sql.Date-java.sql.Date-registry.BooleanResult-registry.CategoricalResult-registry.ContinuousResult-registry.ContinuousResult-registry.ContinuousResult-java.sql.Date-registry.HealthyTargetStatus-registry.Therapy-java.util.ArrayList-">Dashboard(A1cResult a1c,
         ContinuousResult glucose,
         LdlResult ldl,
         ContinuousResult hdl,
         ContinuousResult triglycerides,
         TshResult tsh,
         ContinuousResult t4,
         ContinuousResult uacr,
         ContinuousResult egfr,
         ContinuousResult creatinine,
         ContinuousResult bmi,
         ContinuousResult waist,
         BloodPressureResult bloodPressure,
         java.sql.Date lastClass,
         CategoricalResult eyeScreening,
         CategoricalResult footScreening,
         PsychologicalScreeningResult psychologicalScreening,
         DiscreteResult physicalActivity,
         java.sql.Date influenzaVaccine,
         java.sql.Date pcv13Vaccine,
         java.sql.Date ppsv23Vaccine,
         java.sql.Date hepatitisBVaccine,
         java.sql.Date tdapVaccine,
         java.sql.Date zosterVaccine,
         BooleanResult smokingStatus,
         CategoricalResult telephoneFollowUp,
         ContinuousResult ast,
         ContinuousResult alt,
         ContinuousResult psa,
         java.sql.Date er,
         HealthyTargetStatus hts,
         Therapy therapy,
         java.util.ArrayList<Medication> medications)

Parameterized constructor

Method Summary

All Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

A1cResult
getA1c()

Get the value of a1c

ContinuousResult
getAlt()

Get the value of alt

ContinuousResult
getAst()

Get the value of ast

BloodPressureResult
getBloodPressure()

Get the value of bloodPressure

ContinuousResult
getBmi()

Get the value of bmi

ContinuousResult
getCreatinine()

Get the value of creatinine

ContinuousResult
getEgfr()

Get the value of egfr

java.sql.Date
getEr()

Get the value of er

CategoricalResult
getEyeScreening()

Get the value of eyeScreening

CategoricalResult
getFootScreening()

Get the value of footScreening

ContinuousResult
getGlucose()

Get the value of glucose

ContinuousResult
getHdl()

Get the value of hdl

java.sql.Date
getHepatitisBVaccine()

Get the value of hepatitisBVaccine

HealthyTargetStatus
getHts()

Get the value of hts

java.sql.Date
getInfluenzaVaccine()

Get the value of influenzaVaccine

java.sql.Date
getLastClass()

Get the value of lastClass

LdlResult
getLdl()

Get the value of ldl

java.util.ArrayList<Medication>
getMedications()

Get the value of medications

java.sql.Date
getPcv13Vaccine()

Get the value of pcv13Vaccine

DiscreteResult
getPhysicalActivity()

Get the value of physicalActivity

java.sql.Date
getPpsv23Vaccine()

Get the value of ppsv23Vaccine

ContinuousResult
getPsa()

Get the value of psa

PsychologicalScreeningResult
getPsychologicalScreening()

Get the value of psychologicalScreening

BooleanResult
getSmokingStatus()

Get the value of smokingStatus

ContinuousResult
getT4()

Get the value of t4

java.sql.Date
getTdapVaccine()

Get the value of tdapVaccine

CategoricalResult
getTelephoneFollowUp()

Get the value of telephoneFollowUp

Therapy
getTherapy()

Get the value of therapy

ContinuousResult
getTriglycerides()

Get the value of triglycerides

TshResult
getTsh()

Get the value of tsh

ContinuousResult
getUacr()

Get the value of uacr

ContinuousResult
getWaist()

Get the value of waist

java.sql.Date
getZosterVaccine()

Get the value of zosterVaccine

void
setA1c(A1cResult a1c)

Set the value of a1c

void
setAlt(ContinuousResult alt)

Set the value of alt

void
setAst(ContinuousResult ast)

Set the value of ast

void
setBloodPressure(BloodPressureResult bloodPressure)

Set the value of bloodPressure

void
setBmi(ContinuousResult bmi)

Set the value of bmi

void
setCreatinine(ContinuousResult creatinine)

Set the value of creatinine

void
setEgfr(ContinuousResult egfr)

Set the value of egfr

void
setEr(java.sql.Date er)

Set the value of er

void
setEyeScreening(CategoricalResult eyeScreening)

Set the value of eyeScreening

void
setFootScreening(CategoricalResult footScreening)

Set the value of footScreening

void
setGlucose(ContinuousResult glucose)

Set the value of glucose

void
setHdl(ContinuousResult hdl)

Set the value of hdl

void
setHepatitisBVaccine(java.sql.Date hepatitisBVaccine)

Set the value of hepatitisBVaccine

void
setHts(HealthyTargetStatus hts)

Set the value of hts

void
setInfluenzaVaccine(java.sql.Date influenzaVaccine)

Set the value of influenzaVaccine

void
setLastClass(java.sql.Date lastClass)

Set the value of lastClass

void
setLdl(LdlResult ldl)

Set the value of ldl

void
setMedication(java.util.ArrayList<Medication> medications)

Set the value of medication

void
setPcv13Vaccine(java.sql.Date pcv13Vaccine)

Set the value of pcv13Vaccine

void
setPhysicalActivity(DiscreteResult physicalActivity)

Set the value of physicalActivity

void
setPpsv23Vaccine(java.sql.Date ppsv23Vaccine)

Set the value of ppsv23Vaccine

void
setPsa(ContinuousResult psa)

Set the value of psa

void
setPsychologicalScreening(PsychologicalScreeningResult psychologicalScreening)

Set the value of psychologicalScreening

void
setSmokingStatus(BooleanResult smokingStatus)

Set the value of smokingStatus

void
setT4(ContinuousResult t4)

Set the value of t4

void
setTdapVaccine(java.sql.Date tdapVaccine)

Set the value of tdapVaccine

void
setTelephoneFollowUp(CategoricalResult telephoneFollowUp)

Set the value of telephoneFollowUp

void
setTherapy(Therapy therapy)

Set the value of therapy

void
setTriglycerides(ContinuousResult triglycerides)

Set the value of triglycerides

void
setTsh(TshResult tsh)

Set the value of tsh

void
setUacr(ContinuousResult uacr)

Set the value of uacr

void
setWaist(ContinuousResult waist)

Set the value of waist

void
setZosterVaccine(java.sql.Date zosterVaccine)

Set the value of zosterVaccine

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

Dashboard

public Dashboard()

Default constructor

<a name="Dashboard-registry.A1cResult-registry.ContinuousResult-registry.LdlResult-registry.ContinuousResult-registry.ContinuousResult-registry.TshResult-registry.ContinuousResult-registry.ContinuousResult-registry.ContinuousResult-registry.ContinuousResult-registry.ContinuousResult-registry.ContinuousResult-registry.BloodPressureResult-java.sql.Date-registry.CategoricalResult-registry.CategoricalResult-registry.PsychologicalScreeningResult-registry.DiscreteResult-java.sql.Date-java.sql.Date-java.sql.Date-java.sql.Date-java.sql.Date-java.sql.Date-registry.BooleanResult-registry.CategoricalResult-registry.ContinuousResult-registry.ContinuousResult-registry.ContinuousResult-java.sql.Date-registry.HealthyTargetStatus-registry.Therapy-java.util.ArrayList-">

Dashboard

public Dashboard(A1cResult a1c,
                 ContinuousResult glucose,
                 LdlResult ldl,
                 ContinuousResult hdl,
                 ContinuousResult triglycerides,
                 TshResult tsh,
                 ContinuousResult t4,
                 ContinuousResult uacr,
                 ContinuousResult egfr,
                 ContinuousResult creatinine,
                 ContinuousResult bmi,
                 ContinuousResult waist,
                 BloodPressureResult bloodPressure,
                 java.sql.Date lastClass,
                 CategoricalResult eyeScreening,
                 CategoricalResult footScreening,
                 PsychologicalScreeningResult psychologicalScreening,
                 DiscreteResult physicalActivity,
                 java.sql.Date influenzaVaccine,
                 java.sql.Date pcv13Vaccine,
                 java.sql.Date ppsv23Vaccine,
                 java.sql.Date hepatitisBVaccine,
                 java.sql.Date tdapVaccine,
                 java.sql.Date zosterVaccine,
                 BooleanResult smokingStatus,
                 CategoricalResult telephoneFollowUp,
                 ContinuousResult ast,
                 ContinuousResult alt,
                 ContinuousResult psa,
                 java.sql.Date er,
                 HealthyTargetStatus hts,
                 Therapy therapy,
                 java.util.ArrayList<Medication> medications)

Parameterized constructor

Parameters:

a1c - the latest A1C value

glucose - the latest glucose value

ldl - the latest LDL value

hdl - the latest HDL value

triglycerides - the latest triglycerides value

tsh - the latest TSH value

t4 - the latest T4 value

uacr - the latest UACR value

egfr - the latest eGFR value

creatinine - the latest creatinine value

bmi - the latest BMI value

waist - the latest waist value

bloodPressure - the latest blood pressure value

lastClass - the latest class attended

eyeScreening - the latest eye screening value

footScreening - the latest foot screening value

psychologicalScreening - the latest psychological screening value

physicalActivity - the latest weekly minutes of physical activity

influenzaVaccine - the latest influenza vaccine

pcv13Vaccine - the latest PCV-13 vaccine

ppsv23Vaccine - the latest PPSV-23 vaccine

hepatitisBVaccine - the latest hepatitis B vaccine

tdapVaccine - the latest TDAP vaccine

zosterVaccine - the latest zoster vaccine

smokingStatus - the latest smoking status

telephoneFollowUp - the latest telephone follow-up code

ast - the latest AST value

alt - the latest ALT value

psa - the PSA value

er - the latest ER date

hts - the latest healthy target status

therapy - the latest therapy

medications - the latest medications

Method Detail

getA1c

public A1cResult getA1c()

Get the value of a1c

Returns:

the value of a1c

setA1c

public void setA1c(A1cResult a1c)

Set the value of a1c

Parameters:

a1c - new value of a1c

getGlucose

public ContinuousResult getGlucose()

Get the value of glucose

Returns:

the value of glucose

setGlucose

public void setGlucose(ContinuousResult glucose)

Set the value of glucose

Parameters:

glucose - new value of glucose

getLdl

public LdlResult getLdl()

Get the value of ldl

Returns:

the value of ldl

setLdl

public void setLdl(LdlResult ldl)

Set the value of ldl

Parameters:

ldl - new value of ldl

getHdl

public ContinuousResult getHdl()

Get the value of hdl

Returns:

the value of hdl

setHdl

public void setHdl(ContinuousResult hdl)

Set the value of hdl

Parameters:

hdl - new value of hdl

getTriglycerides

public ContinuousResult getTriglycerides()

Get the value of triglycerides

Returns:

the value of triglycerides

setTriglycerides

public void setTriglycerides(ContinuousResult triglycerides)

Set the value of triglycerides

Parameters:

triglycerides - new value of triglycerides

getTsh

public TshResult getTsh()

Get the value of tsh

Returns:

the value of tsh

setTsh

public void setTsh(TshResult tsh)

Set the value of tsh

Parameters:

tsh - new value of tsh

getT4

public ContinuousResult getT4()

Get the value of t4

Returns:

the value of t4

setT4

public void setT4(ContinuousResult t4)

Set the value of t4

Parameters:

t4 - new value of t4

getUacr

public ContinuousResult getUacr()

Get the value of uacr

Returns:

the value of uacr

setUacr

public void setUacr(ContinuousResult uacr)

Set the value of uacr

Parameters:

uacr - new value of uacr

getEgfr

public ContinuousResult getEgfr()

Get the value of egfr

Returns:

the value of egfr

setEgfr

public void setEgfr(ContinuousResult egfr)

Set the value of egfr

Parameters:

egfr - new value of egfr

getCreatinine

public ContinuousResult getCreatinine()

Get the value of creatinine

Returns:

the value of creatinine

setCreatinine

public void setCreatinine(ContinuousResult creatinine)

Set the value of creatinine

Parameters:

creatinine - new value of creatinine

getBmi

public ContinuousResult getBmi()

Get the value of bmi

Returns:

the value of bmi

setBmi

public void setBmi(ContinuousResult bmi)

Set the value of bmi

Parameters:

bmi - new value of bmi

getWaist

public ContinuousResult getWaist()

Get the value of waist

Returns:

the value of waist

setWaist

public void setWaist(ContinuousResult waist)

Set the value of waist

Parameters:

waist - new value of waist

getBloodPressure

public BloodPressureResult getBloodPressure()

Get the value of bloodPressure

Returns:

the value of bloodPressure

setBloodPressure

public void setBloodPressure(BloodPressureResult bloodPressure)

Set the value of bloodPressure

Parameters:

bloodPressure - new value of bloodPressure

getLastClass

public java.sql.Date getLastClass()

Get the value of lastClass

Returns:

the value of lastClass

setLastClass

public void setLastClass(java.sql.Date lastClass)

Set the value of lastClass

Parameters:

lastClass - new value of lastClass

getEyeScreening

public CategoricalResult getEyeScreening()

Get the value of eyeScreening

Returns:

the value of eyeScreening

setEyeScreening

public void setEyeScreening(CategoricalResult eyeScreening)

Set the value of eyeScreening

Parameters:

eyeScreening - new value of eyeScreening

getFootScreening

public CategoricalResult getFootScreening()

Get the value of footScreening

Returns:

the value of footScreening

setFootScreening

public void setFootScreening(CategoricalResult footScreening)

Set the value of footScreening

Parameters:

footScreening - new value of footScreening

getPsychologicalScreening

public PsychologicalScreeningResult getPsychologicalScreening()

Get the value of psychologicalScreening

Returns:

the value of psychologicalScreening

setPsychologicalScreening

public void setPsychologicalScreening(PsychologicalScreeningResult psychologicalScreening)

Set the value of psychologicalScreening

Parameters:

psychologicalScreening - new value of psychologicalScreening

getPhysicalActivity

public DiscreteResult getPhysicalActivity()

Get the value of physicalActivity

Returns:

the value of physicalActivity

setPhysicalActivity

public void setPhysicalActivity(DiscreteResult physicalActivity)

Set the value of physicalActivity

Parameters:

physicalActivity - new value of physicalActivity

getInfluenzaVaccine

public java.sql.Date getInfluenzaVaccine()

Get the value of influenzaVaccine

Returns:

the value of influenzaVaccine

setInfluenzaVaccine

public void setInfluenzaVaccine(java.sql.Date influenzaVaccine)

Set the value of influenzaVaccine

Parameters:

influenzaVaccine - new value of influenzaVaccine

getPcv13Vaccine

public java.sql.Date getPcv13Vaccine()

Get the value of pcv13Vaccine

Returns:

the value of pcv13Vaccine

setPcv13Vaccine

public void setPcv13Vaccine(java.sql.Date pcv13Vaccine)

Set the value of pcv13Vaccine

Parameters:

pcv13Vaccine - new value of pcv13Vaccine

getPpsv23Vaccine

public java.sql.Date getPpsv23Vaccine()

Get the value of ppsv23Vaccine

Returns:

the value of ppsv23Vaccine

setPpsv23Vaccine

public void setPpsv23Vaccine(java.sql.Date ppsv23Vaccine)

Set the value of ppsv23Vaccine

Parameters:

ppsv23Vaccine - new value of ppsv23Vaccine

getHepatitisBVaccine

public java.sql.Date getHepatitisBVaccine()

Get the value of hepatitisBVaccine

Returns:

the value of hepatitisBVaccine

setHepatitisBVaccine

public void setHepatitisBVaccine(java.sql.Date hepatitisBVaccine)

Set the value of hepatitisBVaccine

Parameters:

hepatitisBVaccine - new value of hepatitisBVaccine

getTdapVaccine

public java.sql.Date getTdapVaccine()

Get the value of tdapVaccine

Returns:

the value of tdapVaccine

setTdapVaccine

public void setTdapVaccine(java.sql.Date tdapVaccine)

Set the value of tdapVaccine

Parameters:

tdapVaccine - new value of tdapVaccine

getZosterVaccine

public java.sql.Date getZosterVaccine()

Get the value of zosterVaccine

Returns:

the value of zosterVaccine

setZosterVaccine

public void setZosterVaccine(java.sql.Date zosterVaccine)

Set the value of zosterVaccine

Parameters:

zosterVaccine - new value of zosterVaccine

getSmokingStatus

public BooleanResult getSmokingStatus()

Get the value of smokingStatus

Returns:

the value of smokingStatus

setSmokingStatus

public void setSmokingStatus(BooleanResult smokingStatus)

Set the value of smokingStatus

Parameters:

smokingStatus - new value of smokingStatus

getTelephoneFollowUp

public CategoricalResult getTelephoneFollowUp()

Get the value of telephoneFollowUp

Returns:

the value of telephoneFollowUp

setTelephoneFollowUp

public void setTelephoneFollowUp(CategoricalResult telephoneFollowUp)

Set the value of telephoneFollowUp

Parameters:

telephoneFollowUp - new value of telephoneFollowUp

getAst

public ContinuousResult getAst()

Get the value of ast

Returns:

the value of ast

setAst

public void setAst(ContinuousResult ast)

Set the value of ast

Parameters:

ast - new value of ast

getAlt

public ContinuousResult getAlt()

Get the value of alt

Returns:

the value of alt

setAlt

public void setAlt(ContinuousResult alt)

Set the value of alt

Parameters:

alt - new value of alt

getPsa

public ContinuousResult getPsa()

Get the value of psa

Returns:

the value of psa

setPsa

public void setPsa(ContinuousResult psa)

Set the value of psa

Parameters:

psa - the new value of psa

getEr

public java.sql.Date getEr()

Get the value of er

Returns:

the value of er

setEr

public void setEr(java.sql.Date er)

Set the value of er

Parameters:

er - new value of er

getHts

public HealthyTargetStatus getHts()

Get the value of hts

Returns:

the value of hts

setHts

public void setHts(HealthyTargetStatus hts)

Set the value of hts

Parameters:

hts - new value of hts

getTherapy

public Therapy getTherapy()

Get the value of therapy

Returns:

the value of therapy

setTherapy

public void setTherapy(Therapy therapy)

Set the value of therapy

Parameters:

therapy - new value of therapy

getMedications

public java.util.ArrayList<Medication> getMedications()

Get the value of medications

Returns:

the value of medications

setMedication

public void setMedication(java.util.ArrayList<Medication> medications)

Set the value of medication

Parameters:

medications - new value of medication

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
require "salesforce/version"
require "salesforce/contact"

module Salesforce
end


text:
/**
 * @class Oskari.mapframework.bundle.publisher.PublisherBundle
 *
 * Definition for bundle. See source for details.
 */
Oskari.clazz.define("Oskari.mapframework.bundle.publisher.PublisherBundle", function () {

}, {
    "create": function () {
        var me = this;
        var inst = Oskari.clazz.create("Oskari.mapframework.bundle.publisher.PublisherBundleInstance");

        return inst;

    },
    "update": function (manager, bundle, bi, info) {

    }
}, {

    "protocol": ["Oskari.bundle.Bundle", "Oskari.mapframework.bundle.extension.ExtensionBundle"],
    "source": {

        "scripts": [{
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/instance.js"
        }, {
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/Flyout.js"
        }, {
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/Tile.js"
        }, {
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/event/MapPublishedEvent.js"
        }, {
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/event/ToolStyleChangedEvent.js"
        }, {
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/event/ColourSchemeChangedEvent.js"
        }, {
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/event/FontChangedEvent.js"
        }, {
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/event/LayerToolsEditModeEvent.js"
        }, {
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/view/NotLoggedIn.js"
        }, {
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/view/StartView.js"
        }, {
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/view/BasicPublisher.js"
        }, {
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/view/PublisherLocationForm.js"
        }, {
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/view/PublisherToolsForm.js"
        }, {
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/view/PublisherLayerForm.js"
        }, {
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/view/PublisherLayoutForm.js"
        }, {
            "type": "text/css",
            "src": "../../../../resources/framework/bundle/publisher/css/style.css"
        }, {
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/request/PublishMapEditorRequest.js"
        }, {
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/request/PublishMapEditorRequestHandler.js"
        }],

        "locales": [{
            "lang": "hy",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/hy.js"
        }, {
            "lang": "bg",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/bg.js"
        }, {
            "lang": "cs",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/cs.js"
        }, {
            "lang": "da",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/da.js"
        }, {
            "lang": "de",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/de.js"
        }, {
            "lang": "en",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/en.js"
        }, {
            "lang": "es",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/es.js"
        }, {
            "lang": "et",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/et.js"
        }, {
            "lang": "fi",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/fi.js"
        }, {
            "lang": "el",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/el.js"
        }, {
            "lang": "hr",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/hr.js"
        }, {
            "lang": "hu",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/hu.js"
        }, {
            "lang": "lv",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/lv.js"
        }, {
            "lang": "nl",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/nl.js"
        }, {
            "lang": "pl",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/pl.js"
        }, {
            "lang": "pt",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/pt.js"
        }, {
            "lang": "ro",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/ro.js"
        }, {
            "lang": "sr",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/sr.js"
        }, {
            "lang": "sl",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/sl.js"
        }, {
            "lang": "sk",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/sk.js"
        }, {
            "lang": "sq",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/sq.js"
        }, {
            "lang": "sv",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/sv.js"
        }, {
            "lang": "uk",
            "type": "text/javascript",
            "src": "../../../../bundles/framework/bundle/publisher/locale/uk.js"
        }]
    },
    "bundle": {
        "manifest": {
            "Bundle-Identifier": "publisher",
            "Bundle-Name": "publisher",
            "Bundle-Author": [{
                "Name": "jjk",
                "Organisation": "nls.fi",
                "Temporal": {
                    "Start": "2009",
                    "End": "2011"
                },
                "Copyleft": {
                    "License": {
                        "License-Name": "EUPL",
                        "License-Online-Resource": "http://www.paikkatietoikkuna.fi/license"
                    }
                }
            }],
            "Bundle-Name-Locale": {
                "fi": {
                    "Name": " style-1",
                    "Title": " style-1"
                },
                "en": {}
            },
            "Bundle-Version": "1.0.0",
            "Import-Namespace": ["Oskari", "jquery"],
            "Import-Bundle": {}
        }
    },

    /**
     * @static
     * @property dependencies
     */
    "dependencies": ["jquery"]

});

Oskari.bundle_manager.installBundleClass("publisher", "Oskari.mapframework.bundle.publisher.PublisherBundle");


text:
package cn.nonocast.service;

import cn.nonocast.model.BackupEntry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

@Service
public class BackupService {
	private static final Logger logger = LoggerFactory.getLogger(BackupService.class);

	@Value("${data.backup.path}")
	private String backupPath;

	@Value("${spring.datasource.username}")
	private String username;

	@Value("${spring.datasource.password}")
	private String password;

	private Path path;

	private List<BackupEntry> backupEntries;

	public int getBackupEntryCount() {
		return this.backupEntries.size();
	}

	public void sync() throws IOException {
		this.path = Paths.get(backupPath.replaceFirst("~", System.getProperty("user.home")));
		if(Files.exists(path)) {
			backupEntries = Files.list(path).filter(p -> p.toString().endsWith(".sql")).map(p -> new BackupEntry(p)).collect(Collectors.toList());
			Collections.sort(backupEntries, Collections.reverseOrder());
		} else {
			logger.warn("Path didn't exists: " + this.path);
		}
	}

	public Page<BackupEntry> findAll(Pageable pageable) {
		List<BackupEntry> entries = this.backupEntries.stream().skip(pageable.getOffset()).limit(pageable.getPageSize()).collect(Collectors.toList());

		if(backupEntries.size() > 0) {
			return new PageImpl<>(
				entries,
				pageable,
				this.backupEntries.size()
			);
		}

		return new PageImpl<BackupEntry>(new ArrayList<>());
	}

	public Optional<BackupEntry> findByName(String q) {
		return backupEntries.stream().filter(p -> p.getFileName().toString().equals(q)).findFirst();
	}

	public void exportEntry() throws IOException, InterruptedException {
		Path q = Paths.get(
			backupPath.replaceFirst("~", System.getProperty("user.home")),
			String.format("data-%s.sql", LocalDateTime.now().toString().replace(":", "_"))
		);

		ProcessBuilder p = new ProcessBuilder("mysqldump", "todolist", "-u"+username, "-p"+password);
		p.redirectOutput(new File(q.toString()));
		p.start().waitFor();

		this.sync();
	}

	public void importEntry(BackupEntry entry) throws IOException {
		Path q = Paths.get(
			backupPath.replaceFirst("~", System.getProperty("user.home")),
			entry.getFileName()
		);

		ProcessBuilder p = new ProcessBuilder("mysql", "todolist", "-u"+username, "-p"+password);
		p.redirectInput(new File(entry.getPath().toString()));
		p.start();
	}
}


text:
#ifndef __ORANGE_ERROR_H__
#define __ORANGE_ERROR_H__

#include "file.h"
#include "AST.h"

enum CMessageType {
	ERROR,
	WARNING,
	NO_COMPILE,
	NO_FILE
};

/**
 * CompilerMessage is a class to inform the user to know about errors and warnings.
 * It provides an interface to print out helpful information, like line numbers and
 * printing out the code where the message occured.
 */
class CompilerMessage {
private:
	CMessageType m_type;
	std::string m_what;
	path m_file_path;
	int m_line_begin, m_line_end;
	int m_column_begin, m_column_end;
public:
	/**
	 * Returns whether or not there is line information in this message.
	 *
	 * @return True if there is line info, false otherwise.
	 */
	bool hasLineInfo() const;

	/**
	 * Returns the type of compiler message. Valid types are either an error
	 * or a warning.
	 *
	 * @return The type of compiler message.
	 */
	CMessageType type() const;

	/**
	 * Returns the message string that the compiler generated.
	 *
	 * @return The message string generated by the compiler.
	 */
	std::string what() const;

	/**
	 * Returns a helpful message string, containing the what message
	 * and a picture of what the line of code looked like from the file.
	 *
	 * @return Complete string of the message.
	 */
	std::string string() const;

	/**
	 * Returns the file path that this message occured on.
	 *
	 * @return File this message occured on.
	 */
	path file_path() const;

	/**
	 * Returns the first line that this message occured on in the file.
	 *
	 * @return The first line in the file that this message occured on.
	 */
	int line_begin() const;

	/**
	 * Returns the last line that this message occured on in the file, which
	 * may be the same as the first line. If not, this indicates a range.
	 *
	 * @return The last line in the file that this message occured on.
	 */
	int line_end() const;

	/**
	 * Returns the first column that this message occured on in the file.
	 *
	 * @return The first column in the file that this message occured on.
	 */
	int column_begin() const;

	/**
	 * Returns the last column that this message occured on in the file, which
	 * may be the same as the first column. If not, this indicates a range.
	 *
	 * @return The last column in the file that this message occured on.
	 */
	int column_end() const;

	CompilerMessage(CMessageType type, std::string what, path filePath, int lineBegin, int lineEnd, int colBegin, int colEnd);
	CompilerMessage(CodeElement element, std::string what);
};

#endif


text:
describe :file_unlink, :shared => true do
  before :each do
    @file1 = 'test.txt'
    @file2 = 'test2.txt'
    File.send(@method, @file1) if File.exists?(@file1)
    File.send(@method, @file2) if File.exists?(@file2)

    File.open(@file1, "w") {} # Touch
    File.open(@file2, "w") {} # Touch
  end

  after :each do
    File.send(@method, @file1) if File.exists?(@file1)
    File.send(@method, @file2) if File.exists?(@file2)

    @file1 = nil
    @file2 = nil
  end

  it "returns 0 when called without arguments" do
    File.send(@method).should == 0
  end

  it "deletes a single file" do
    File.send(@method, @file1).should == 1
    File.exists?(@file1).should == false
  end

  it "deletes multiple files" do
    File.send(@method, @file1, @file2).should == 2
    File.exists?(@file1).should == false
    File.exists?(@file2).should == false
  end

  it "raises an TypeError if not passed a String type" do
    lambda { File.send(@method, 1) }.should raise_error(TypeError)
  end

  it "raises an Errno::ENOENT when the given file doesn't exist" do
    lambda { File.send(@method, 'bogus') }.should raise_error(Errno::ENOENT)
  end

  it "coerces a given parameter into a string if possible" do
    class Coercable
      def to_str
        "test.txt"
      end
    end

    File.send(@method, Coercable.new).should == 1
  end

  ruby_version_is "1.9" do
    it "accepts an object that has a #to_path method" do
      File.send(@method, mock_to_path(@file1)).should == 1
    end
  end
end


text:
layout: post
permalink: /gotcha-wordpress-option-form-not-posting
title: "Wordpress Option Form Not Posting"
category: "Gotcha"
tags: action form form-not-posting gotcha options strrpos substr wordpress wordpress-admin-page-not-posting wordpress-form-not-posting
---
### Introduction
I was working on creating a theme with an Admin Options page for WordPress but ran into an issue from [the article I was following](http://www.1stwebdesigner.com/wordpress/how-to-create-an-options-page-for-your-wordpress-theme/) where the form wouldn't post. Normally, this is because there is either no action, or no interpreter for the `$_GET` or `$_POST`. Knowing this, I noticed there was no form action. Easy fix. With WordPress, your actions are managed by your URI, example:

```php
function.php?page=called.php
```

When you bring that to different environments, not all servers will handle the request within the same `$_SERVER` variable. So what's the best way to POST your form the page serving you?

## Putting a Fix In Place
You can fix it by using a combination of `substr` and `strrpos`. `substr`, or sub string, will allow you to return only the characters within the specified offsets. `strrpos`, or string reverse position, will return the first integer position of the character you specified, starting from the end of the string. Understanding your URI, ex: `http://www.highonphp.com/wordpress/wp-admin/admin.php?page=functions.php`, you know that the page you need to post your form to is `admin.php?page=functions.php`. So, by using the following function, we will get the position of the / after `wp-admin/` and use that as the starting point for `substr`.

```php
echo substr($_SERVER['REQUEST_URI'], strrpos($_SERVER['REQUEST_URI'], '/')+1);
```

When you put it all together the FORM tag looks like this:

```php
<form method="post" action="<?=substr($_SERVER['REQUEST_URI'], strrpos($_SERVER['REQUEST_URI'], '/')+1);?>">
```
Enjoy.


text:
// Description: Entity Framework Bulk Operations & Utilities (EF Bulk SaveChanges, Insert, Update, Delete, Merge | LINQ Query Cache, Deferred, Filter, IncludeFilter, IncludeOptimize | Audit)
// Website & Documentation: https://github.com/zzzprojects/Entity-Framework-Plus
// Forum & Issues: https://github.com/zzzprojects/EntityFramework-Plus/issues
// License: https://github.com/zzzprojects/EntityFramework-Plus/blob/master/LICENSE
// More projects: http://www.zzzprojects.com/
// Copyright © ZZZ Projects Inc. 2014 - 2016. All rights reserved.

using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Z.Test.EntityFramework.Plus
{
    public class Property_AllType
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int ID { get; set; }

        public int ColumnInt { get; set; }

        public long? BigIntColumn { get; set; }
        public byte[] BinaryColumn { get; set; }
        public bool? BitColumn { get; set; }
        public string CharColumn { get; set; }
        public DateTime? DateColumn { get; set; }
        public DateTime? DateTimeColumn { get; set; }
        public DateTime? DateTime2Column { get; set; }
        public DateTimeOffset? DateTimeOffsetColumn { get; set; }
        public decimal? DecimalColumn { get; set; }
        public double? FloatColumn { get; set; }
        public byte[] ImageColumn { get; set; }
        public int? IntColumn { get; set; }
        public decimal? MoneyColumn { get; set; }
        public string NCharColumn { get; set; }
        public string NTextColumn { get; set; }
        public decimal? NumericColumn { get; set; }
        public string NVarcharColumn { get; set; }
        public string NVarcharMaxColumn { get; set; }
        public float? RealColumn { get; set; }
        public DateTime? SmallDateTimeColumn { get; set; }
        public short? SmallIntColumn { get; set; }
        public decimal? SmallMoneyColumn { get; set; }
        public string TextColumn { get; set; }
        public byte? TinyIntColumn { get; set; }
        public Guid? UniqueIdentifierColumn { get; set; }
        public byte[] VarBinaryColumn { get; set; }
        public byte[] VarBinaryMaxColumn { get; set; }
        public string VarcharColumn { get; set; }
        public string VarcharMaxColumn { get; set; }
        public string XmlColumn { get; set; }
    }
}


text:
{% setvar category "DevTools" %}
{% setvar label "JS / Get Started / (3) Paused On Correct Line" %}
{% setvar url %}https://github.com/google/webfundamentals/issues/new?title=[{{ category }} / {{ label }}] {% endsetvar %}
{% setvar success_button "I'm paused on line 19" %}
{% setvar success_response "Great. You're right where you should be." %}
{% setvar fail_button "I'm paused on another line" %}
{% setvar fail_response %}Hmm, something's wrong. Please open an issue and tell us what line you're paused on.{% endsetvar %}
{% include "web/_shared/feedback.html" %}


text:
Motif.Page.include("Motif.Collections.List.js");
Motif.Page.include("Motif.Data.Row.js");
Motif.Page.include("Motif.Data.Table.js");

/**
 * Data row collection
 * @extends Motif.Collections.List
 * @requires Motif.Collections.List
 * @requires Motif.Data.Row
 * @requires Motif.Data.Table
 * @constructor
 * @author Rayraegah
 */
Motif.Data.RowCollection = function(config) {
    /** @ignore */
    Motif.Utility.extend(this, "Motif.Collections.List");
    this.__class.push("Motif.Data.RowCollection");

    /** Reference to a parent object if any @type Motif.Data.Table */
    this.parent = null;

    /** Configure this row collection object @type Motif.Data.RowCollectionConfig */
    this.configure = function RowCollection_configure(config) {
        config = this.Motif$Collections$List.configure(config);
        if (config.parent) {
            this.parent = config.parent;
        }
        return config;
    };

    /** @ignore */
    this.main = function RowCollectionConfig_main(config) {
        if (config) {
            this.configure(config);
        }
    };
    this.main(config);
};

Motif.Data.RowCollectionConfig = function() {
    /** Reference to a parent object if any @type Motif.Data.Table */
    this.parent = null;
};


text:
namespace hyrise {

class AbstractOperator;
class AbstractLQPNode;

using SQLPhysicalPlanCache = GDFSCache<std::string, std::shared_ptr<AbstractOperator>>;
using SQLLogicalPlanCache = GDFSCache<std::string, std::shared_ptr<AbstractLQPNode>>;

}  // namespace hyrise


text:
namespace OmniXaml.Tests
{
    using System.Collections.Generic;
    using Classes;
    using Classes.WpfLikeModel;
    using Common;
    using ObjectAssembler;
    using Resources;
    using TypeConversion;
    using Xunit;

    public class NameScopeTests : GivenARuntimeTypeSource
    {
        private readonly InstructionResources source;
        private readonly ObjectAssembler sut;

        public NameScopeTests()
        {
            var topDownValueContext = new TopDownValueContext();
            sut = new ObjectAssembler(RuntimeTypeSource, new ValueContext(RuntimeTypeSource, topDownValueContext, new Dictionary<string, object>()));
            source = new InstructionResources(this);
        }

        [Fact]
        public void RegisterOneChildInNameScope()
        {
            RuntimeTypeSource.ClearNamescopes();
            RuntimeTypeSource.EnableNameScope<DummyClass>();

            sut.Process(source.ChildInNameScope);
            var actual = sut.Result;
            var childInScope = ((DummyObject)actual).Find("MyObject");
            Assert.IsType(typeof(ChildClass), childInScope);
        }

        [Fact]
        public void RegisterChildInDeeperNameScope()
        {
            RuntimeTypeSource.ClearNamescopes();
            RuntimeTypeSource.EnableNameScope<Window>();

            sut.Process(source.ChildInDeeperNameScope);
            var actual = sut.Result;
            var textBlock1 = ((Window)actual).Find("MyTextBlock");
            var textBlock2 = ((Window)actual).Find("MyOtherTextBlock");

            Assert.IsType(typeof(TextBlock), textBlock1);
            Assert.IsType(typeof(TextBlock), textBlock2);
        }

        [Fact]
        public void NameWithNoNamescopesToRegisterTo()
        {
            sut.Process(source.NameWithNoNamescopesToRegisterTo);
        }
    }
}


text:
// Boost.Geometry (aka GGL, Generic Geometry Library)

// Copyright (c) 2014-2015 Samuel Debionne, Grenoble, France.

// This file was modified by Oracle on 2015.
// Modifications copyright (c) 2015, Oracle and/or its affiliates.

// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle

// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.

// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#ifndef BOOST_GEOMETRY_UTIL_COMBINE_IF_HPP
#define BOOST_GEOMETRY_UTIL_COMBINE_IF_HPP

#include <boost/mpl/fold.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/bind.hpp>
#include <boost/mpl/set.hpp>
#include <boost/mpl/insert.hpp>
#include <boost/mpl/placeholders.hpp>

namespace boost { namespace geometry
{

namespace util
{

/*!
    \brief Meta-function to generate all the combination of pairs of types
        from a given sequence Sequence except those that does not satisfy the
        predicate Pred
    \ingroup utility
    \par Example
    \code
        typedef boost::mpl::vector<boost::mpl::int_<0>, boost::mpl::int_<1> > types;
        typedef combine_if<types, types, always<true_> >::type combinations;
        typedef boost::mpl::vector<
            pair<boost::mpl::int_<1>, boost::mpl::int_<1> >,
            pair<boost::mpl::int_<1>, boost::mpl::int_<0> >,
            pair<boost::mpl::int_<0>, boost::mpl::int_<1> >,
            pair<boost::mpl::int_<0>, boost::mpl::int_<0> >
        > result_types;

        BOOST_MPL_ASSERT(( boost::mpl::equal<combinations, result_types> ));
    \endcode
*/
template <typename Sequence1, typename Sequence2, typename Pred>
struct combine_if
{
    struct combine
    {
        template <typename Result, typename T>
        struct apply
        {
            typedef typename boost::mpl::fold<Sequence2, Result,
                boost::mpl::if_
                <
                    boost::mpl::bind
                        <
                            typename boost::mpl::lambda<Pred>::type,
                            T,
                            boost::mpl::_2
                        >,
                    boost::mpl::insert
                        <
                            boost::mpl::_1, boost::mpl::pair<T, boost::mpl::_2>
                        >,
                    boost::mpl::_1
                >
            >::type type;
        };
    };

    typedef typename boost::mpl::fold
        <
            Sequence1, boost::mpl::set0<>, combine
        >::type type;
};

} // namespace util

}} // namespace boost::geometry

#endif // BOOST_GEOMETRY_UTIL_COMBINE_IF_HPP


text:
package org.apache.wicket.ajax;

import java.util.Collections;

import org.apache.wicket.Application;
import org.apache.wicket.markup.head.HeaderItem;
import org.apache.wicket.markup.head.JavaScriptHeaderItem;
import org.apache.wicket.request.resource.JavaScriptResourceReference;
import org.apache.wicket.request.resource.ResourceReference;

/**
 * @author hoeve
 */
public class WicketAjaxDebugJQueryResourceReference extends JavaScriptResourceReference
{
	private static final long serialVersionUID = 1L;

	private static final WicketAjaxDebugJQueryResourceReference INSTANCE = new WicketAjaxDebugJQueryResourceReference();

	/**
	 * @return the singleton INSTANCE
	 */
	public static WicketAjaxDebugJQueryResourceReference get()
	{
		return INSTANCE;
	}

	private WicketAjaxDebugJQueryResourceReference()
	{
		super(AbstractDefaultAjaxBehavior.class, "res/js/wicket-ajax-jquery-debug.js");
	}

	@Override
	public Iterable<? extends HeaderItem> getDependencies()
	{
		final ResourceReference wicketAjaxReference;
		if (Application.exists())
		{
			wicketAjaxReference = Application.get().getJavaScriptLibrarySettings().getWicketAjaxReference();
		}
		else
		{
			wicketAjaxReference = WicketAjaxJQueryResourceReference.get();
		}
		return Collections.singletonList(JavaScriptHeaderItem.forReference(wicketAjaxReference));
	}
}


text:
.. toctree::
   :hidden:

================
Examples Gallery
================

This gallery shows many examples of figures that can be rendered using
Plantweb. All these examples were taken from the website of each project.

You can check the `source code of this page`_.

.. _source code of this page: https://raw.githubusercontent.com/carlos-jenkins/plantweb/master/doc/examples.rst

For the original source of this examples or for more information and examples
please visit the website of each project as shown in each section.

This section can be seen as a display of capabilities of the individual
projects, but it is mostly a medium to test Plantweb Sphinx_ directives.

.. _Sphinx: http://www.sphinx-doc.org/

.. contents::
   :local:

PlantUML
========

   PlantUML is a component that allows to quickly write many UML diagrams using
   a simple and intuitive language.

For more examples and information visit the official website:

- http://plantuml.com/

.. contents::
   :local:

Sequence
--------

   A Sequence diagram is an interaction diagram that shows how objects operate
   with one another and in what order.

   - *Wikipedia, "Sequence Diagram".*

For detailed explanation see:

- http://plantuml.com/sequence.html

.. uml::

   Alice -> Bob: Authentication Request
   Bob --> Alice: Authentication Response

   Alice -> Bob: Another authentication Request
   Alice <-- Bob: another authentication Response

-------------------------

.. uml::

   actor Foo1
   boundary Foo2
   control Foo3
   entity Foo4
   database Foo5
   Foo1 -> Foo2 : To boundary
   Foo1 -> Foo3 : To control
   Foo1 -> Foo4 : To entity
   Foo1 -> Foo5 : To database

-------------------------

.. uml::

   autonumber 10 10 "[000]"
   Bob -> Alice : Authentication Request
   Bob <- Alice : Authentication Response

   autonumber stop
   Bob -> Alice : dummy

   autonumber resume "Message 0  "
   Bob -> Alice : Yet another authentication Request
   Bob <- Alice : Yet another authentication Response

   autonumber stop
   Bob -> Alice : dummy

   autonumber resume 1 "Message 0  "
   Bob -> Alice : Yet another authentication Request
   Bob <- Alice : Yet another authentication Response

Use Case
--------

   A use case diagram at its simplest is a representation of a user's
   interaction with the system that shows the relationship between the user and
   the different use cases in which the user is involved.

   - *Wikipedia, "Use Case Diagram".*

For detailed explanation see:

- http://plantuml.com/usecase.html

.. uml::

   :Main Admin: as Admin
   (Use the application) as (Use)

   User <|-- Admin
   (Start) <|-- (Use)

-------------------------

.. uml::

   left to right direction
   skinparam packageStyle rect
   actor customer
   actor clerk
   rectangle checkout {
     customer -- (checkout)
     (checkout) .> (payment) : include
     (help) .> (checkout) : extends
     (checkout) -- clerk
   }

Class
-----

   A class diagram is a type of static structure diagram that describes the
   structure of a system by showing the system's classes, their attributes,
   operations (or methods), and the relationships among objects.

   - *Wikipedia, "Use Class Diagram".*

For detailed explanation see:

- http://plantuml.com/classes.html

.. uml::

   class Foo1 {
     You can use
     several lines
     ..
     as you want
     and group
     ==
     things together.
     __
     You can have as many groups
     as you want
     --
     End of class
   }

   class User {
     .. Simple Getter ..
     + getName()
     + getAddress()
     .. Some setter ..
     + setName()
     __ private data __
     int age
     -- encrypted --
     String password
   }

-------------------------

.. uml::

   package "Classic Collections" #DDDDDD {
     Object <|-- ArrayList
   }

   package net.sourceforge.plantuml {
     Object <|-- Demo1
     Demo1 *- Demo2
   }

   package foo6 <<Database>> {
     class Class6
   }

Activity
--------

   Activity diagrams are graphical representations of workflows of stepwise
   activities and actions with support for choice, iteration and concurrency. In
   the Unified Modeling Language, activity diagrams are intended to model both
   computational and organizational processes (i.e. workflows). Activity
   diagrams show the overall flow of control.

   - *Wikipedia, "Use Activity Diagram".*

For detailed explanation see:

- http://plantuml.com/activity2.html

.. uml::

   start
   :Hello world;
   :This is on defined on
   several **lines**;
   stop

-------------------------

.. uml::

   start
   if (condition A) then (yes)
     :Text 1;
   elseif (condition B) then (yes)
     :Text 2;
     stop
   elseif (condition C) then (yes)
     :Text 3;
   elseif (condition D) then (yes)
     :Text 4;
   else (nothing)
     :Text else;
   endif

-------------------------

.. uml::

   start

   if (multiprocessor?) then (yes)
     fork
       :Treatment 1;
     fork again
       :Treatment 2;
     end fork
   else (monoproc)
      partition Partition {
         :Process 1;
         :Process 2;
      }
     :Treatment 1;
     :Treatment 2;
   endif

Component
---------

   A component diagram depicts how components are wired together to form larger
   components and or software systems. They are used to illustrate the
   structure of arbitrarily complex systems.

   - *Wikipedia, "Component Diagram".*

For detailed explanation see:

- http://plantuml.com/component.html

.. uml::

   DataAccess - [First Component]
   [First Component] ..> HTTP : use

-------------------------

.. uml::

   package "Some Group" {
     HTTP - [First Component]
     [Another Component]
   }

   node "Other Groups" {
     FTP - [Second Component]
     [First Component] --> FTP
   }

   cloud {
     [Example 1]
   }

   database "MySql" {
     folder "This is my folder" {
       [Folder 3]
     }
     frame "Foo" {
       [Frame 4]
     }
   }

   [Another Component] --> [Example 1]
   [Example 1] --> [Folder 3]
   [Folder 3] --> [Frame 4]

State
-----

   A state diagram, also called a state machine diagram or statechart diagram,
   is an illustration of the states an object can attain as well as the
   transitions between those states.

   - *TechTarget, "State Diagram".*

For detailed explanation see:

- http://plantuml.com/state.html

.. uml::

   [*] --> State1
   State1 --> [*]
   State1 : this is a string
   State1 : this is another string

   State1 -> State2
   State2 --> [*]

-------------------------

.. uml::

   scale 350 width
   [*] --> NotShooting

   state NotShooting {
     [*] --> Idle
     Idle --> Configuring : EvConfig
     Configuring --> Idle : EvConfig
   }

   state Configuring {
     [*] --> NewValueSelection
     NewValueSelection --> NewValuePreview : EvNewValue
     NewValuePreview --> NewValueSelection : EvNewValueRejected
     NewValuePreview --> NewValueSelection : EvNewValueSaved

     state NewValuePreview {
        State1 -> State2
     }

   }

Object
------

   An object diagram is a graph of instances, including objects and data
   values. A static object diagram is an instance of a class diagram; it shows
   a snapshot of the detailed state of a system at a point in time. The use of
   object diagrams is fairly limited, namely to show examples of data
   structure.

   - *Object Management Group (2001), "UML specification 1.4".*

.. uml::

   object Object01
   Object01 : name = "Dummy"
   Object01 : id = 123

   object Object02
   object Object03
   object Object04
   object Object05
   object Object06
   object Object07
   object Object08

   Object01 <|-- Object02
   Object03 *-- Object04
   Object05 o-- "4" Object06
   Object07 .. Object08 : some labels

Graphviz
========

   Graphviz is open source graph visualization software. Graph visualization is
   a way of representing structural information as diagrams of abstract graphs
   and networks.

   It has important applications in networking, bioinformatics, software
   engineering, database and web design, machine learning, and in visual
   interfaces for other technical domains.

For more examples and information visit the official website:

- http://www.graphviz.org/Gallery.php

.. contents::
   :local:

Cluster
-------

   This small example illustrates dot's feature to draw nodes and edges in
   clusters or separate rectangular layout regions. Clusters are encoded as
   subgraphs whose names have the prefix 'cluster'. The color attribute of a
   cluster is interpreted as its outline color or its background color if its
   style is 'filled'. Mdiamond and Msquare are modified symbols for data flow
   diagrams.

   - http://www.graphviz.org/content/cluster

.. graph::

   digraph G {

      subgraph cluster_0 {
         style=filled;
         color=lightgrey;
         node [style=filled,color=white];
         a0 -> a1 -> a2 -> a3;
         label = "process #1";
      }

      subgraph cluster_1 {
         node [style=filled];
         b0 -> b1 -> b2 -> b3;
         label = "process #2";
         color=blue
      }
      start -> a0;
      start -> b0;
      a1 -> b3;
      b2 -> a3;
      a3 -> a0;
      a3 -> end;
      b3 -> end;

      start [shape=Mdiamond];
      end [shape=Msquare];
   }

Data Structures
---------------

   The graph file was generated automatically from a session with the LDBX
   graphical interface to the standard DBX debugger.

   Nodes are drawn with the ``'record'`` shape. Labels of this shape are
   interpreted specially as nested horizontal and vertical box lists formatted
   as tables. In a record label, curly braces ``{ }`` enclose lists, vertical
   bar ``|`` separates list items, and creates a port identifier for attaching
   edges. Edges are also labeled with ``'id'`` attributes. Though not
   demonstrated in this particular file, these attributes allow referencing
   multiple (parallel) edges between the same node pair.

   - http://www.graphviz.org/content/datastruct

.. graph::

   digraph g {
      graph [
         rankdir = "LR"
      ];
      node [
         fontsize = "16"
         shape = "ellipse"
      ];
      edge [];
      "node0" [
         label = "<f0> 0x10ba8| <f1>"
         shape = "record"
      ];
      "node1" [
         label = "<f0> 0xf7fc4380| <f1> | <f2> |-1"
         shape = "record"
      ];
      "node2" [
         label = "<f0> 0xf7fc44b8| | |2"
         shape = "record"
      ];
      "node3" [
         label = "<f0> 3.43322790286038071e-06|44.79998779296875|0"
         shape = "record"
      ];
      "node4" [
         label = "<f0> 0xf7fc4380| <f1> | <f2> |2"
         shape = "record"
      ];
      "node5" [
         label = "<f0> (nil)| | |-1"
         shape = "record"
      ];
      "node6" [
         label = "<f0> 0xf7fc4380| <f1> | <f2> |1"
         shape = "record"
      ];
      "node7" [
         label = "<f0> 0xf7fc4380| <f1> | <f2> |2"
         shape = "record"
      ];
      "node8" [
         label = "<f0> (nil)| | |-1"
         shape = "record"
      ];
      "node9" [
         label = "<f0> (nil)| | |-1"
         shape = "record"
      ];
      "node10" [
         label = "<f0> (nil)| <f1> | <f2> |-1"
         shape = "record"
      ];
      "node11" [
         label = "<f0> (nil)| <f1> | <f2> |-1"
         shape = "record"
      ];
      "node12" [
         label = "<f0> 0xf7fc43e0| | |1"
         shape = "record"
      ];
      "node0":f0 -> "node1":f0 [id = 0];
      "node0":f1 -> "node2":f0 [id = 1];
      "node1":f0 -> "node3":f0 [id = 2];
      "node1":f1 -> "node4":f0 [id = 3];
      "node1":f2 -> "node5":f0 [id = 4];
      "node4":f0 -> "node3":f0 [id = 5];
      "node4":f1 -> "node6":f0 [id = 6];
      "node4":f2 -> "node10":f0 [id = 7];
      "node6":f0 -> "node3":f0 [id = 8];
      "node6":f1 -> "node7":f0 [id = 9];
      "node6":f2 -> "node9":f0 [id = 10];
      "node7":f0 -> "node3":f0 [id = 11];
      "node7":f1 -> "node1":f0 [id = 12];
      "node7":f2 -> "node8":f0 [id = 13];
      "node10":f1 -> "node11":f0 [id = 14];
      "node10":f2 -> "node12":f0 [id = 15];
      "node11":f2 -> "node1":f0 [id = 16];
   }

Finite Automaton
----------------

   This is a drawing of a finite automaton. The rankdir and orientation request
   a left-to-right drawing in landscape mode. Note the use of text labels on
   edges.

   - http://www.graphviz.org/content/fsm

.. graph::

   digraph finite_state_machine {
      rankdir=LR;
      size="8,5"
      node [shape = doublecircle]; LR_0 LR_3 LR_4 LR_8;
      node [shape = circle];
      LR_0 -> LR_2 [ label = "SS(B)" ];
      LR_0 -> LR_1 [ label = "SS(S)" ];
      LR_1 -> LR_3 [ label = "S($end)" ];
      LR_2 -> LR_6 [ label = "SS(b)" ];
      LR_2 -> LR_5 [ label = "SS(a)" ];
      LR_2 -> LR_4 [ label = "S(A)" ];
      LR_5 -> LR_7 [ label = "S(b)" ];
      LR_5 -> LR_5 [ label = "S(a)" ];
      LR_6 -> LR_6 [ label = "S(b)" ];
      LR_6 -> LR_5 [ label = "S(a)" ];
      LR_7 -> LR_8 [ label = "S(b)" ];
      LR_7 -> LR_5 [ label = "S(a)" ];
      LR_8 -> LR_6 [ label = "S(b)" ];
      LR_8 -> LR_5 [ label = "S(a)" ];
   }

Ditaa
=====

For more examples visit the official website:

- http://ditaa.sourceforge.net/

Ditaa rendering is particularly usefull when using ASCII drawing tools like:

- http://asciiflow.com/

.. diagram::

   +--------+   +-------+    +-------+
   |        +---+ ditaa +--> |       |
   |  Text  |   +-------+    |diagram|
   |Document|   |!magic!|    |       |
   |     {d}|   |       |    |       |
   +---+----+   +-------+    +-------+
       :                         ^
       |       Lots of work      |
       +-------------------------+

-------------------------

.. diagram::

   /--------\   +-------+
   |cAAA    +---+Version|
   |  Data  |   |   V3  |
   |  Base  |   |cRED{d}|
   |     {s}|   +-------+
   \---+----/

-------------------------

.. diagram::

   +---+-----+   +----------+
   | cBLU    |   | {io}     |
   | Ext-Foo |   |  S-ATA   |
   |   +-----+   |   cFEA   |
   |   |cPNK |   +----------+
   |   | Foo |
   +---+-----+

-------------------------

.. diagram::

   /-------------+-------------\
   |cRED RED     |cBLU BLU     |
   +-------------+-------------+
   |cGRE GRE     |cPNK PNK     |
   +-------------+-------------+
   |cAAA               AAA     |
   +-------------+-------------+
   |cCCC               CCC     |
   +-------------+-------------+
   |cBLK BLK     |cYEL YEL     |
   \-------------+-------------/

-------------------------

.. diagram::

   +---------------+                       +----------+
   | This was      |                       | And it is|
   | created with  +-----------+---------->+ great!   |
   | asciiflow.com |           |           |          |
   +---------------+           |           +----------+
                               |
                               |
       +-----------+           |
       |           |           |
       | Awesome!  +<----------+
       |           |
       +-----------+


text:
import unittest
from conans.test.utils.tools import TestClient
from conans.util.files import load, save

class ConditionalReqsTest(unittest.TestCase):

    def conditional_requirements_test(self):
        conanfile = """from conans import ConanFile

class TestConanLib(ConanFile):
    name = "Hello"
    version = "0.1"
    settings = "os", "build_type", "product"
        """
        test_conanfile = '''
from conans import ConanFile

class TestConanLib(ConanFile):
    requires = "Hello/0.1@lasote/testing"
    settings = "os", "build_type", "product"
    def requirements(self):
        self.output.info("Conditional test requirement: %s, %s, %s"
                         % (self.settings.os, self.settings.build_type, self.settings.product))

    def test(self):
        pass
'''
        client = TestClient()
        settings_path = client.client_cache.settings_path
        client.client_cache.settings
        settings = load(settings_path)
        settings += "\nproduct: [onion, potato]"
        save(settings_path, settings)
        client.save({"conanfile.py": conanfile,
                     "test_package/conanfile.py": test_conanfile})
        client.run("create . lasote/testing -s os=Windows -s product=onion -s build_type=Release")
        self.assertIn("PROJECT: Conditional test requirement: Windows, Release, onion",
                      client.user_io.out)


text:
@class AVPlayerItem;

@interface NSPAudioPlaylistItem : NSObject

@property (nonatomic, strong) NSURL* mediaURL;
@property (nonatomic, strong) NSString* artistName;
@property (nonatomic, strong) NSString* albumTitle;
@property (nonatomic, strong) NSString* title;
@property (nonatomic, strong) UIImage* image;

@property (nonatomic, strong) AVPlayerItem* playerItem;

@end


text:
/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author Tobias Koppers @sokra
*/
var ConcatSource = require("webpack-core/lib/ConcatSource");

function SetVarMainTemplatePlugin(varExpression, copyObject) {
	this.varExpression = varExpression;
	this.copyObject = copyObject;
}
module.exports = SetVarMainTemplatePlugin;
SetVarMainTemplatePlugin.prototype.apply = function(compilation) {
	var mainTemplate = compilation.mainTemplate;
	compilation.templatesPlugin("render-with-entry", function(source, chunk, hash) {
		var varExpression = mainTemplate.applyPluginsWaterfall("asset-path", this.varExpression, {
			hash: hash,
			chunk: chunk
		});
		if(this.copyObject) {
			return new ConcatSource("(function(e, a) { for(var i in a) e[i] = a[i]; }(" +
				varExpression + ", ", source, "))");
		} else {
			var prefix = varExpression + " =\n";
			return new ConcatSource(prefix, source);
		}
	}.bind(this));
	mainTemplate.plugin("global-hash-paths", function(paths) {
		if(this.varExpression) paths.push(this.varExpression);
		return paths;
	});
	mainTemplate.plugin("hash", function(hash) {
		hash.update("set var");
		hash.update(this.varExpression + "");
		hash.update(this.copyObject + "");
	}.bind(this));
};


text:
module.exports = {

	// ---------------------------------------
	// Custom settings
	// ---------------------------------------

	// The objects folder of your RealFlow scene
	source_directory: 'example',

	// Name of the RealFlow object you wish to track
	object_name: 'pyramid',

	// Where to export the files to
	export_directory: 'export',

	// Which frame numbers would you like to track?
	track_frames: [0, 40, 81, 98],

	// Track object vertices or midpoint
	// Either 'mid' or 'vert'
	track_mode: 'vert',

	// ---------------------------------------
	// Development settings
	// ---------------------------------------

	// The object extension
	object_ext: '.obj',

	// Which operation to perform
	operation: process.argv[2],

	// Write files
	write: true,

	// Detailed write logs
	log: true

}


text:
namespace Microsoft.Azure.Management.StorSimple1200Series.Models
{
    using Newtonsoft.Json;
    using Newtonsoft.Json.Converters;
    using System.Runtime;
    using System.Runtime.Serialization;

    /// <summary>
    /// Defines values for SupportedDeviceCapabilities.
    /// </summary>
    [JsonConverter(typeof(StringEnumConverter))]
    public enum SupportedDeviceCapabilities
    {
        [EnumMember(Value = "Invalid")]
        Invalid,
        [EnumMember(Value = "FileServer")]
        FileServer,
        [EnumMember(Value = "IscsiServer")]
        IscsiServer
    }
    internal static class SupportedDeviceCapabilitiesEnumExtension
    {
        internal static string ToSerializedValue(this SupportedDeviceCapabilities? value)
        {
            return value == null ? null : ((SupportedDeviceCapabilities)value).ToSerializedValue();
        }

        internal static string ToSerializedValue(this SupportedDeviceCapabilities value)
        {
            switch( value )
            {
                case SupportedDeviceCapabilities.Invalid:
                    return "Invalid";
                case SupportedDeviceCapabilities.FileServer:
                    return "FileServer";
                case SupportedDeviceCapabilities.IscsiServer:
                    return "IscsiServer";
            }
            return null;
        }

        internal static SupportedDeviceCapabilities? ParseSupportedDeviceCapabilities(this string value)
        {
            switch( value )
            {
                case "Invalid":
                    return SupportedDeviceCapabilities.Invalid;
                case "FileServer":
                    return SupportedDeviceCapabilities.FileServer;
                case "IscsiServer":
                    return SupportedDeviceCapabilities.IscsiServer;
            }
            return null;
        }
    }
}


text:
<?php
namespace App\Module\Api\Action\User;

use App\Middleware\Action\Action;
use App\Module\Api\Domain\Entity\User;
use App\Module\Api\Domain\Validator\UserValidator;
use App\Module\Api\Responder\ValidationJsonResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\RequestInterface;
use Zend\Diactoros\Response\JsonResponse;

/**
 * Action that create an new user
 *
 * @package App\Module\Api
 */
class CreateAction extends Action
{
    /**
     * Action logic
     *
     * @param RequestInterface $request Petición
     * @param ResponseInterface $response Respuesta
     * @return ResponseInterface
     */
    public function run(RequestInterface $request, ResponseInterface $response)
    {
        /** @var \Psr\Http\Message\ServerRequestInterface $request */
        /** @var \Doctrine\ORM\EntityManager $entityManager */

        // data is validated
        $validator = new UserValidator('new', $request, $this->container);

        if (!$validator->validate()) {
            return new ValidationJsonResponse($validator->errors());
        }

        // insert the user
        $entityManager = $this->container->get('EntityManager');

        $data = $request->getParsedBody();
        $user = new User();

        foreach ($data as $field => $value) {
            $user->{'set'.ucfirst($field)}($value);
        }

        $entityManager->persist($user);
        $entityManager->flush();

        return new JsonResponse(['status' => 'created'], 201);
    }
}


text:
@interface AddCommentRespBody : RespBody
{
    NSString *result;
}
@property (nonatomic, retain) NSString *result;
@end


text:
require "knowledge/engine"
require "knowledge/settings"
require "knowledge/page"
require "knowledge/version"

module Knowledge
end


text:
FactoryBot.define do
  factory :collection_type, class: Hyrax::CollectionType do
    sequence(:title) { |n| "Collection Type #{n}" }
    sequence(:machine_id) { |n| "title_#{n}" }

    description { 'Collection type with all options' }
    nestable { true }
    discoverable { true }
    sharable { true }
    brandable { true }
    share_applies_to_new_works { true }
    allow_multiple_membership { true }
    require_membership { false }
    assigns_workflow { false }
    assigns_visibility { false }

    transient do
      creator_user { nil }
      creator_group { nil }
      manager_user { nil }
      manager_group { nil }
    end

    after(:create) do |collection_type, evaluator|
      CollectionTypeFactoryHelper.process_access(collection_type, evaluator)
    end

    trait :nestable do
      nestable { true }
    end

    trait :not_nestable do
      nestable { false }
    end

    trait :discoverable do
      discoverable { true }
    end

    trait :not_discoverable do
      discoverable { false }
    end

    trait :brandable do
      brandable { true }
    end

    trait :not_brandable do
      brandable { false }
    end

    trait :sharable do
      sharable { true }
      share_applies_to_new_works { true }
    end

    trait :sharable_no_work_permissions do
      sharable { true }
      share_applies_to_new_works { false }
    end

    trait :not_sharable do
      sharable { false }
      share_applies_to_new_works { false }
    end

    trait :allow_multiple_membership do
      allow_multiple_membership { true }
    end

    trait :not_allow_multiple_membership do
      allow_multiple_membership { false }
    end
  end

  factory :user_collection_type, class: Hyrax::CollectionType do
    initialize_with { Hyrax::CollectionType.find_or_create_default_collection_type }
  end

  factory :admin_set_collection_type, class: Hyrax::CollectionType do
    initialize_with { Hyrax::CollectionType.find_or_create_admin_set_type }

    transient do
      creator_user { nil }
      creator_group { nil }
      manager_user { nil }
      manager_group { nil }
    end

    after(:create) do |collection_type, evaluator|
      CollectionTypeFactoryHelper.process_access(collection_type, evaluator)
    end
  end

  class CollectionTypeFactoryHelper
    def self.process_access(collection_type, evaluator) # rubocop:disable Metrics/MethodLength
      if evaluator.creator_user
        Array(evaluator.creator_user).each do |user|
          attributes = { hyrax_collection_type_id: collection_type.id,
                         access: Hyrax::CollectionTypeParticipant::CREATE_ACCESS,
                         agent_id: user,
                         agent_type: Hyrax::CollectionTypeParticipant::USER_TYPE }
          FactoryBot.create(:collection_type_participant, attributes)
        end
      end

      if evaluator.creator_group
        Array(evaluator.creator_group).each do |group|
          attributes = { hyrax_collection_type_id: collection_type.id,
                         access: Hyrax::CollectionTypeParticipant::CREATE_ACCESS,
                         agent_id: group,
                         agent_type: Hyrax::CollectionTypeParticipant::GROUP_TYPE }
          FactoryBot.create(:collection_type_participant, attributes)
        end
      end

      if evaluator.manager_user
        Array(evaluator.manager_user).each do |user|
          attributes = { hyrax_collection_type_id: collection_type.id,
                         access: Hyrax::CollectionTypeParticipant::MANAGE_ACCESS,
                         agent_id: user,
                         agent_type: Hyrax::CollectionTypeParticipant::USER_TYPE }
          FactoryBot.create(:collection_type_participant, attributes)
        end
      end

      return unless evaluator.manager_group

      Array(evaluator.manager_group).each do |group|
        attributes = { hyrax_collection_type_id: collection_type.id,
                       access: Hyrax::CollectionTypeParticipant::MANAGE_ACCESS,
                       agent_id: group,
                       agent_type: Hyrax::CollectionTypeParticipant::GROUP_TYPE }
        FactoryBot.create(:collection_type_participant, attributes)
      end
    end
  end
end


text:
/***********************************************************************************************************
 * @Author : nanyuantingfeng
 **********************************************************************************************************/
var app, page, nf;
nf = sm("do_Notification");
app = sm("do_App");
page = sm("do_Page");

page.on("back", function(){ app.closePage() });
ui("action_back").on("touch", function(){ app.closePage() });

/**********************************************************************************************************/

var do_label_alert = ui("do_label_alert");
var do_label_confirm = ui("do_label_confirm");
var do_label_toast = ui("do_label_toast");
var bn_alert = ui("bn_alert");
var bn_toast = ui("bn_toast");
var bn_confirm = ui("bn_confirm");

bn_alert.on("touch", function(){
    nf.alert("Alert");
    do_label_alert.text = "Alert";
    //alert ??TODO bug
});

bn_toast.on("touch", function(){
    nf.toast("Toast"); //toast  异步无回调;
    do_label_toast.text = "Toast";
});

bn_confirm.on("touch", function(){
    nf.confirm("Confirm", function(data){
        do_label_confirm.text = JSON.stringify(data, null, "  ");
    });
});


text:
<bill session="115" type="h" number="2027" updated="2017-09-11T16:45:10Z">
  <state datetime="2017-04-06">REFERRED</state>
  <status>
    <introduced datetime="2017-04-06"/>
  </status>
  <introduced datetime="2017-04-06"/>
  <titles>
    <title type="official" as="introduced">To amend title 40, United States Code, to include as part of the buildings and grounds of the National Gallery of Art any buildings and other areas within the boundaries of any real estate or other property interests acquired by the National Gallery of Art.</title>
    <title type="display">To amend title 40, United States Code, to include as part of the buildings and grounds of the National Gallery of Art any buildings and other areas within the boundaries of any real estate or other property interests acquired by the National Gallery of Art.</title>
  </titles>
  <sponsor bioguide_id="H001045"/>
  <cosponsors>
    <cosponsor bioguide_id="B001227" joined="2017-04-06"/>
  </cosponsors>
  <actions>
    <action datetime="2017-04-06">
      <text>Introduced in House</text>
    </action>
    <action datetime="2017-04-06" state="REFERRED">
      <text>Referred to the House Committee on House Administration.</text>
    </action>
  </actions>
  <committees>
    <committee subcommittee="" code="HSHA" name="House Administration" activity="Referral"/>
  </committees>
  <relatedbills/>
  <subjects>
    <term name="Government operations and politics"/>
    <term name="Art, artists, authorship"/>
    <term name="District of Columbia"/>
    <term name="Government buildings, facilities, and property"/>
    <term name="Museums, exhibitions, cultural centers"/>
    <term name="Roads and highways"/>
  </subjects>
  <amendments/>
  <summary date="2017-04-06T04:00:00Z" status="Introduced in House">This bill includes as part of the National Gallery of Art all buildings, service roads, walks, and other areas within the exterior boundaries of any real estate or interest in land that the Gallery acquires and that its director determines to be necessary for the adequate protection of individuals or property in the Gallery and suitable for administration as a part of it.</summary>
  <committee-reports/>
</bill>