text:
package net.java.sip.communicator.plugin.setup;

import java.io.*;
import net.java.sip.communicator.common.*;
import net.java.sip.communicator.common.Console;

import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.text.html.*;
import java.util.Hashtable;

public class ServerInformationPage
    extends JPanel
    implements SetupWizardPage
{
    private static final Console console = Console.getConsole(ServerInformationPage.class);

    /** Use this variable if we fail to load html file */
    public static final String DEFAULT_SERVER_TEXT_CONTENT =
        "Enter the name of your SIP Server (for example,\"sip.company.com\")";
    public static final String DEFAULT_UNAME_TEXT_CONTENT =
        "Enter the user name given to you by your SIP provider (for example, \"jsmith\".";

    public static final String REGISTRAR_PROPERTY_NAME = "net.java.sip.communicator.sip.REGISTRAR_ADDRESS";
    public static final String REGISTRAR_HR_PROPERTY_NAME = "SIP Server";
    public static final String USER_NAME_PROPERTY_NAME = "net.java.sip.communicator.sip.USER_NAME";
    public static final String USER_NAME_HR_PROPERTY_NAME = "User Name";

    private WizardPropertySet pageProperties = new WizardPropertySet();

    JEditorPane serverHelpMessage = new JEditorPane();
     JPanel serverPane = new JPanel();
     JEditorPane userNameHelpMessage = new JEditorPane();
     JPanel userNamePane = new JPanel();
     JLabel serverLabel = new JLabel();
     JTextField serverField = new JTextField();
     JLabel userNameLabel = new JLabel();
     JTextField userNameField = new JTextField();
     BorderLayout borderLayout1 = new BorderLayout();
     BorderLayout borderLayout2 = new BorderLayout();
     Border border1;
     JPanel userNameContainer = new JPanel();
     JPanel serverContainer = new JPanel();
     BorderLayout borderLayout3 = new BorderLayout();
     BorderLayout borderLayout4 = new BorderLayout();
     JEditorPane addressHelpMessage1 = new JEditorPane();
    GridLayout gridLayout1 = new GridLayout();
    Border border2;

     public ServerInformationPage ()
     {
         initComponents();
         try
         {
             jbInit();
         }
         catch(Exception e)
         {
             e.printStackTrace();
         }
     }

     public void initComponents()
     {
         try{
             console.logEntry();
             setPreferredSize(new Dimension(100, 100));
             serverHelpMessage.setEditable(false);
             serverHelpMessage.setEditorKit(new HTMLEditorKit());

             userNameHelpMessage.setEditable(false);
             userNameHelpMessage.setEditorKit(new HTMLEditorKit());

            try {
                serverHelpMessage.setText(readFile(
                    "SetupWizardServerInformationPage-Part1.html"));
            }
            catch (IOException ex) {
                console.error("Failed to load SetupWizardServerInformationPage-Part1.html");
                serverHelpMessage.setText(DEFAULT_SERVER_TEXT_CONTENT);
            }
            try {
                userNameHelpMessage.setText(readFile(
                    "SetupWizardServerInformationPage-Part2.html"));
            }
            catch (IOException ex) {
                console.error("Failed to load SetupWizardServerInformationPage-Part2.html");
                userNameHelpMessage.setText(DEFAULT_UNAME_TEXT_CONTENT);
            }

             setBackground(userNameHelpMessage.getBackground());
             serverPane.setBackground(serverHelpMessage.getBackground());
             userNamePane.setBackground(userNameHelpMessage.getBackground());

             String server = Utils.getProperty(
                 REGISTRAR_PROPERTY_NAME);
             String userName = Utils.getProperty(
                 USER_NAME_PROPERTY_NAME);

             if (server != null)
                 serverField.setText(server);
             if (userName != null)
                 userNameField.setText(userName);

         }
         finally
         {
             console.logExit();
         }

     }

     /**
     * Read the html file with the page instructions. An IOException is thrown
     * if the method fails reading the html content
     * @param file name of the file (without the path)
     * @return the (html) string contained by the file.
     * @throws IOException if we fail reading html content
     */
    private String readFile(String file)
        throws IOException
    {
        try{
            console.logEntry();

            BufferedReader reader = null;

            try {
                reader = new BufferedReader( new InputStreamReader(
                    getClass().getResourceAsStream( "resource" + File.separator + file)));
            }
            catch (Exception ex) {
                console.error("Failed to read html content.");
                throw new IOException("Failed to read html content.");
            }

            String line = "";
            StringBuffer buff = new StringBuffer();
            try {
                while ( (line = reader.readLine() ) != null) {
                    buff.append(line).append(" ");
                }
            }
            finally{
                console.error("Failed to read html content.");
            }
            return buff.toString();
        }
        finally
        {
            console.logExit();
        }
    }

     public String getName()
     {
         return "Server Information";
     }
     private void jbInit() throws Exception
     {
         border1 = BorderFactory.createEmptyBorder(10,40,40,40);
         border2 = BorderFactory.createEmptyBorder(10,40,20,40);
        this.setLayout(gridLayout1);
         serverLabel.setText("SIP Server: ");
         userNameLabel.setText("User Name: ");
         serverHelpMessage.setMaximumSize(new Dimension(400, 2147483647));
        serverHelpMessage.setPreferredSize(new Dimension(400, 21));
         serverPane.setLayout(borderLayout1);
         userNamePane.setLayout(borderLayout2);
         userNamePane.setBorder(border1);
         userNamePane.setMaximumSize(new Dimension(2147483647, 100));
         serverPane.setBorder(border2);
        serverPane.setDebugGraphicsOptions(0);
        serverPane.setMaximumSize(new Dimension(2147483647, 100));
         userNameHelpMessage.setMaximumSize(new Dimension(400, 2147483647));
         serverContainer.setLayout(borderLayout3);
         userNameContainer.setLayout(borderLayout4);
         addressHelpMessage1.setMaximumSize(new Dimension(400, 2147483647));
         gridLayout1.setColumns(1);
        gridLayout1.setRows(2);
        userNameContainer.add(userNameHelpMessage, BorderLayout.CENTER);
         userNameContainer.add(userNamePane,  BorderLayout.SOUTH);
         serverPane.add(serverLabel, BorderLayout.WEST);
         serverPane.add(serverField, BorderLayout.CENTER);
         serverContainer.add(serverHelpMessage, BorderLayout.CENTER);
         serverContainer.add(serverPane, BorderLayout.SOUTH);
         userNamePane.add(userNameLabel,  BorderLayout.WEST);
         userNamePane.add(userNameField, BorderLayout.CENTER);
         this.add(serverContainer, null);
         this.add(userNameContainer, null);
     }

    /**
     * Verifies whether the server information was validly entered by the user.
     *
     * @throws IllegalArgumentException
     */
    public void validateContent() throws IllegalArgumentException
    {
        try{
           console.logEntry();
           if(serverField.getText() == null | serverField.getText().trim().length() == 0)
               throw new IllegalArgumentException("Please enter a valid server name!");

           if(userNameField.getText() == null | userNameField.getText().trim().length() == 0)
               throw new IllegalArgumentException("Please enter a valid user name!");

       }
       finally
       {
           console.logExit();
       }

    }

    /**
     * getProperties
     *
     * @return Hashtable
     * @todo Implement this
     *   net.java.sip.communicator.plugin.setup.SetupWizardPage method
     */
    public WizardPropertySet getPageProperties()
    {

        pageProperties.setProperty(REGISTRAR_PROPERTY_NAME, REGISTRAR_HR_PROPERTY_NAME, serverField.getText());
        pageProperties.setProperty(USER_NAME_PROPERTY_NAME, USER_NAME_HR_PROPERTY_NAME, userNameField.getText());

        return pageProperties;
    }

    public void setPageProperties(WizardPropertySet pageProperties)
    {
        this.pageProperties = pageProperties;
    }

}


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/api/backend.proto

package com.google.api;

/**
 *

 * `Backend` defines the backend configuration for a service.
 *

 *
 * Protobuf type {@code google.api.Backend}
 */
public  final class Backend extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:google.api.Backend)
    BackendOrBuilder {
private static final long serialVersionUID = 0L;
  // Use Backend.newBuilder() to construct.
  private Backend(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private Backend() {
    rules_ = java.util.Collections.emptyList();
  }

  @Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return this.unknownFields;
  }
  private Backend(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    this();
    if (extensionRegistry == null) {
      throw new NullPointerException();
    }
    int mutable_bitField0_ = 0;
    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
        com.google.protobuf.UnknownFieldSet.newBuilder();
    try {
      boolean done = false;
      while (!done) {
        int tag = input.readTag();
        switch (tag) {
          case 0:
            done = true;
            break;
          case 10: {
            if (!((mutable_bitField0_ & 0x00000001) != 0)) {
              rules_ = new java.util.ArrayList<com.google.api.BackendRule>();
              mutable_bitField0_ |= 0x00000001;
            }
            rules_.add(
                input.readMessage(com.google.api.BackendRule.parser(), extensionRegistry));
            break;
          }
          default: {
            if (!parseUnknownField(
                input, unknownFields, extensionRegistry, tag)) {
              done = true;
            }
            break;
          }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(
          e).setUnfinishedMessage(this);
    } finally {
      if (((mutable_bitField0_ & 0x00000001) != 0)) {
        rules_ = java.util.Collections.unmodifiableList(rules_);
      }
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return com.google.api.BackendProto.internal_static_google_api_Backend_descriptor;
  }

  @Override
  protected FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.api.BackendProto.internal_static_google_api_Backend_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            Backend.class, Builder.class);
  }

  public static final int RULES_FIELD_NUMBER = 1;
  private java.util.List<com.google.api.BackendRule> rules_;
  /**
   *

   * A list of API backend rules that apply to individual API methods.
   * **NOTE:** All service configuration rules follow "last one wins" order.
   *

   *
   * repeated .google.api.BackendRule rules = 1;
   */
  public java.util.List<com.google.api.BackendRule> getRulesList() {
    return rules_;
  }
  /**
   *

   * A list of API backend rules that apply to individual API methods.
   * **NOTE:** All service configuration rules follow "last one wins" order.
   *

   *
   * repeated .google.api.BackendRule rules = 1;
   */
  public java.util.List<? extends com.google.api.BackendRuleOrBuilder>
      getRulesOrBuilderList() {
    return rules_;
  }
  /**
   *

   * A list of API backend rules that apply to individual API methods.
   * **NOTE:** All service configuration rules follow "last one wins" order.
   *

   *
   * repeated .google.api.BackendRule rules = 1;
   */
  public int getRulesCount() {
    return rules_.size();
  }
  /**
   *

   * A list of API backend rules that apply to individual API methods.
   * **NOTE:** All service configuration rules follow "last one wins" order.
   *

   *
   * repeated .google.api.BackendRule rules = 1;
   */
  public com.google.api.BackendRule getRules(int index) {
    return rules_.get(index);
  }
  /**
   *

   * A list of API backend rules that apply to individual API methods.
   * **NOTE:** All service configuration rules follow "last one wins" order.
   *

   *
   * repeated .google.api.BackendRule rules = 1;
   */
  public com.google.api.BackendRuleOrBuilder getRulesOrBuilder(
      int index) {
    return rules_.get(index);
  }

  private byte memoizedIsInitialized = -1;
  @Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @Override
  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    for (int i = 0; i < rules_.size(); i++) {
      output.writeMessage(1, rules_.get(i));
    }
    unknownFields.writeTo(output);
  }

  @Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    for (int i = 0; i < rules_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(1, rules_.get(i));
    }
    size += unknownFields.getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @Override
  public boolean equals(final Object obj) {
    if (obj == this) {
     return true;
    }
    if (!(obj instanceof Backend)) {
      return super.equals(obj);
    }
    Backend other = (Backend) obj;

    if (!getRulesList()
        .equals(other.getRulesList())) return false;
    if (!unknownFields.equals(other.unknownFields)) return false;
    return true;
  }

  @Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    if (getRulesCount() > 0) {
      hash = (37 * hash) + RULES_FIELD_NUMBER;
      hash = (53 * hash) + getRulesList().hashCode();
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static Backend parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static Backend parseFrom(
      java.nio.ByteBuffer data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static Backend parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static Backend parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static Backend parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static Backend parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static Backend parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static Backend parseFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }
  public static Backend parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static Backend parseDelimitedFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
  }
  public static Backend parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static Backend parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }

  @Override
  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }
  public static Builder newBuilder(Backend prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }
  @Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE
        ? new Builder() : new Builder().mergeFrom(this);
  }

  @Override
  protected Builder newBuilderForType(
      BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   *

   * `Backend` defines the backend configuration for a service.
   *

   *
   * Protobuf type {@code google.api.Backend}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:google.api.Backend)
      com.google.api.BackendOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.google.api.BackendProto.internal_static_google_api_Backend_descriptor;
    }

    @Override
    protected FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.api.BackendProto.internal_static_google_api_Backend_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              Backend.class, Builder.class);
    }

    // Construct using com.google.api.Backend.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(
        BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }
    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3
              .alwaysUseFieldBuilders) {
        getRulesFieldBuilder();
      }
    }
    @Override
    public Builder clear() {
      super.clear();
      if (rulesBuilder_ == null) {
        rules_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
      } else {
        rulesBuilder_.clear();
      }
      return this;
    }

    @Override
    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return com.google.api.BackendProto.internal_static_google_api_Backend_descriptor;
    }

    @Override
    public Backend getDefaultInstanceForType() {
      return Backend.getDefaultInstance();
    }

    @Override
    public Backend build() {
      Backend result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @Override
    public Backend buildPartial() {
      Backend result = new Backend(this);
      int from_bitField0_ = bitField0_;
      if (rulesBuilder_ == null) {
        if (((bitField0_ & 0x00000001) != 0)) {
          rules_ = java.util.Collections.unmodifiableList(rules_);
          bitField0_ = (bitField0_ & ~0x00000001);
        }
        result.rules_ = rules_;
      } else {
        result.rules_ = rulesBuilder_.build();
      }
      onBuilt();
      return result;
    }

    @Override
    public Builder clone() {
      return super.clone();
    }
    @Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        Object value) {
      return super.setField(field, value);
    }
    @Override
    public Builder clearField(
        com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }
    @Override
    public Builder clearOneof(
        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }
    @Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        int index, Object value) {
      return super.setRepeatedField(field, index, value);
    }
    @Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        Object value) {
      return super.addRepeatedField(field, value);
    }
    @Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof Backend) {
        return mergeFrom((Backend)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(Backend other) {
      if (other == Backend.getDefaultInstance()) return this;
      if (rulesBuilder_ == null) {
        if (!other.rules_.isEmpty()) {
          if (rules_.isEmpty()) {
            rules_ = other.rules_;
            bitField0_ = (bitField0_ & ~0x00000001);
          } else {
            ensureRulesIsMutable();
            rules_.addAll(other.rules_);
          }
          onChanged();
        }
      } else {
        if (!other.rules_.isEmpty()) {
          if (rulesBuilder_.isEmpty()) {
            rulesBuilder_.dispose();
            rulesBuilder_ = null;
            rules_ = other.rules_;
            bitField0_ = (bitField0_ & ~0x00000001);
            rulesBuilder_ =
              com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ?
                 getRulesFieldBuilder() : null;
          } else {
            rulesBuilder_.addAllMessages(other.rules_);
          }
        }
      }
      this.mergeUnknownFields(other.unknownFields);
      onChanged();
      return this;
    }

    @Override
    public final boolean isInitialized() {
      return true;
    }

    @Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      Backend parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (Backend) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }
    private int bitField0_;

    private java.util.List<com.google.api.BackendRule> rules_ =
      java.util.Collections.emptyList();
    private void ensureRulesIsMutable() {
      if (!((bitField0_ & 0x00000001) != 0)) {
        rules_ = new java.util.ArrayList<com.google.api.BackendRule>(rules_);
        bitField0_ |= 0x00000001;
       }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
        com.google.api.BackendRule, com.google.api.BackendRule.Builder, com.google.api.BackendRuleOrBuilder> rulesBuilder_;

    /**
     *

     * A list of API backend rules that apply to individual API methods.
     * **NOTE:** All service configuration rules follow "last one wins" order.
     *

     *
     * repeated .google.api.BackendRule rules = 1;
     */
    public java.util.List<com.google.api.BackendRule> getRulesList() {
      if (rulesBuilder_ == null) {
        return java.util.Collections.unmodifiableList(rules_);
      } else {
        return rulesBuilder_.getMessageList();
      }
    }
    /**
     *

     * A list of API backend rules that apply to individual API methods.
     * **NOTE:** All service configuration rules follow "last one wins" order.
     *

     *
     * repeated .google.api.BackendRule rules = 1;
     */
    public int getRulesCount() {
      if (rulesBuilder_ == null) {
        return rules_.size();
      } else {
        return rulesBuilder_.getCount();
      }
    }
    /**
     *

     * A list of API backend rules that apply to individual API methods.
     * **NOTE:** All service configuration rules follow "last one wins" order.
     *

     *
     * repeated .google.api.BackendRule rules = 1;
     */
    public com.google.api.BackendRule getRules(int index) {
      if (rulesBuilder_ == null) {
        return rules_.get(index);
      } else {
        return rulesBuilder_.getMessage(index);
      }
    }
    /**
     *

     * A list of API backend rules that apply to individual API methods.
     * **NOTE:** All service configuration rules follow "last one wins" order.
     *

     *
     * repeated .google.api.BackendRule rules = 1;
     */
    public Builder setRules(
        int index, com.google.api.BackendRule value) {
      if (rulesBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureRulesIsMutable();
        rules_.set(index, value);
        onChanged();
      } else {
        rulesBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     *

     * A list of API backend rules that apply to individual API methods.
     * **NOTE:** All service configuration rules follow "last one wins" order.
     *

     *
     * repeated .google.api.BackendRule rules = 1;
     */
    public Builder setRules(
        int index, com.google.api.BackendRule.Builder builderForValue) {
      if (rulesBuilder_ == null) {
        ensureRulesIsMutable();
        rules_.set(index, builderForValue.build());
        onChanged();
      } else {
        rulesBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *

     * A list of API backend rules that apply to individual API methods.
     * **NOTE:** All service configuration rules follow "last one wins" order.
     *

     *
     * repeated .google.api.BackendRule rules = 1;
     */
    public Builder addRules(com.google.api.BackendRule value) {
      if (rulesBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureRulesIsMutable();
        rules_.add(value);
        onChanged();
      } else {
        rulesBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     *

     * A list of API backend rules that apply to individual API methods.
     * **NOTE:** All service configuration rules follow "last one wins" order.
     *

     *
     * repeated .google.api.BackendRule rules = 1;
     */
    public Builder addRules(
        int index, com.google.api.BackendRule value) {
      if (rulesBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureRulesIsMutable();
        rules_.add(index, value);
        onChanged();
      } else {
        rulesBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     *

     * A list of API backend rules that apply to individual API methods.
     * **NOTE:** All service configuration rules follow "last one wins" order.
     *

     *
     * repeated .google.api.BackendRule rules = 1;
     */
    public Builder addRules(
        com.google.api.BackendRule.Builder builderForValue) {
      if (rulesBuilder_ == null) {
        ensureRulesIsMutable();
        rules_.add(builderForValue.build());
        onChanged();
      } else {
        rulesBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     *

     * A list of API backend rules that apply to individual API methods.
     * **NOTE:** All service configuration rules follow "last one wins" order.
     *

     *
     * repeated .google.api.BackendRule rules = 1;
     */
    public Builder addRules(
        int index, com.google.api.BackendRule.Builder builderForValue) {
      if (rulesBuilder_ == null) {
        ensureRulesIsMutable();
        rules_.add(index, builderForValue.build());
        onChanged();
      } else {
        rulesBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *

     * A list of API backend rules that apply to individual API methods.
     * **NOTE:** All service configuration rules follow "last one wins" order.
     *

     *
     * repeated .google.api.BackendRule rules = 1;
     */
    public Builder addAllRules(
        Iterable<? extends com.google.api.BackendRule> values) {
      if (rulesBuilder_ == null) {
        ensureRulesIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(
            values, rules_);
        onChanged();
      } else {
        rulesBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     *

     * A list of API backend rules that apply to individual API methods.
     * **NOTE:** All service configuration rules follow "last one wins" order.
     *

     *
     * repeated .google.api.BackendRule rules = 1;
     */
    public Builder clearRules() {
      if (rulesBuilder_ == null) {
        rules_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
        onChanged();
      } else {
        rulesBuilder_.clear();
      }
      return this;
    }
    /**
     *

     * A list of API backend rules that apply to individual API methods.
     * **NOTE:** All service configuration rules follow "last one wins" order.
     *

     *
     * repeated .google.api.BackendRule rules = 1;
     */
    public Builder removeRules(int index) {
      if (rulesBuilder_ == null) {
        ensureRulesIsMutable();
        rules_.remove(index);
        onChanged();
      } else {
        rulesBuilder_.remove(index);
      }
      return this;
    }
    /**
     *

     * A list of API backend rules that apply to individual API methods.
     * **NOTE:** All service configuration rules follow "last one wins" order.
     *

     *
     * repeated .google.api.BackendRule rules = 1;
     */
    public com.google.api.BackendRule.Builder getRulesBuilder(
        int index) {
      return getRulesFieldBuilder().getBuilder(index);
    }
    /**
     *

     * A list of API backend rules that apply to individual API methods.
     * **NOTE:** All service configuration rules follow "last one wins" order.
     *

     *
     * repeated .google.api.BackendRule rules = 1;
     */
    public com.google.api.BackendRuleOrBuilder getRulesOrBuilder(
        int index) {
      if (rulesBuilder_ == null) {
        return rules_.get(index);  } else {
        return rulesBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     *

     * A list of API backend rules that apply to individual API methods.
     * **NOTE:** All service configuration rules follow "last one wins" order.
     *

     *
     * repeated .google.api.BackendRule rules = 1;
     */
    public java.util.List<? extends com.google.api.BackendRuleOrBuilder>
         getRulesOrBuilderList() {
      if (rulesBuilder_ != null) {
        return rulesBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(rules_);
      }
    }
    /**
     *

     * A list of API backend rules that apply to individual API methods.
     * **NOTE:** All service configuration rules follow "last one wins" order.
     *

     *
     * repeated .google.api.BackendRule rules = 1;
     */
    public com.google.api.BackendRule.Builder addRulesBuilder() {
      return getRulesFieldBuilder().addBuilder(
          com.google.api.BackendRule.getDefaultInstance());
    }
    /**
     *

     * A list of API backend rules that apply to individual API methods.
     * **NOTE:** All service configuration rules follow "last one wins" order.
     *

     *
     * repeated .google.api.BackendRule rules = 1;
     */
    public com.google.api.BackendRule.Builder addRulesBuilder(
        int index) {
      return getRulesFieldBuilder().addBuilder(
          index, com.google.api.BackendRule.getDefaultInstance());
    }
    /**
     *

     * A list of API backend rules that apply to individual API methods.
     * **NOTE:** All service configuration rules follow "last one wins" order.
     *

     *
     * repeated .google.api.BackendRule rules = 1;
     */
    public java.util.List<com.google.api.BackendRule.Builder>
         getRulesBuilderList() {
      return getRulesFieldBuilder().getBuilderList();
    }
    private com.google.protobuf.RepeatedFieldBuilderV3<
        com.google.api.BackendRule, com.google.api.BackendRule.Builder, com.google.api.BackendRuleOrBuilder>
        getRulesFieldBuilder() {
      if (rulesBuilder_ == null) {
        rulesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.api.BackendRule, com.google.api.BackendRule.Builder, com.google.api.BackendRuleOrBuilder>(
                rules_,
                ((bitField0_ & 0x00000001) != 0),
                getParentForChildren(),
                isClean());
        rules_ = null;
      }
      return rulesBuilder_;
    }
    @Override
    public final Builder setUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

    @Override
    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }

    // @@protoc_insertion_point(builder_scope:google.api.Backend)
  }

  // @@protoc_insertion_point(class_scope:google.api.Backend)
  private static final Backend DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new Backend();
  }

  public static Backend getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<Backend>
      PARSER = new com.google.protobuf.AbstractParser<Backend>() {
    @Override
    public Backend parsePartialFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return new Backend(input, extensionRegistry);
    }
  };

  public static com.google.protobuf.Parser<Backend> parser() {
    return PARSER;
  }

  @Override
  public com.google.protobuf.Parser<Backend> getParserForType() {
    return PARSER;
  }

  @Override
  public Backend getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}

redpajama_set_name: RedPajamaGithub


text:
package net.authorize;

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

/**
 *
Java class for anonymous complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="merchantAuthentication" type="{https://api.authorize.net/soap/v1/}MerchantAuthenticationType" minOccurs="0"/>
 *         <element name="splitTenderId" type="{http://www.w3.org/2001/XMLSchema}long"/>
 *         <element name="splitTenderStatus" type="{https://api.authorize.net/soap/v1/}SplitTenderStatusEnum"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "merchantAuthentication",
    "splitTenderId",
    "splitTenderStatus"
})
@XmlRootElement(name = "UpdateSplitTenderGroup")
public class UpdateSplitTenderGroup {

    protected MerchantAuthenticationType merchantAuthentication;
    protected long splitTenderId;
    @XmlElement(required = true)
    protected SplitTenderStatusEnum splitTenderStatus;

    /**
     * Gets the value of the merchantAuthentication property.
     *
     * @return
     *     possible object is
     *     {@link MerchantAuthenticationType }
     *
     */
    public MerchantAuthenticationType getMerchantAuthentication() {
        return merchantAuthentication;
    }

    /**
     * Sets the value of the merchantAuthentication property.
     *
     * @param value
     *     allowed object is
     *     {@link MerchantAuthenticationType }
     *
     */
    public void setMerchantAuthentication(MerchantAuthenticationType value) {
        this.merchantAuthentication = value;
    }

    /**
     * Gets the value of the splitTenderId property.
     *
     */
    public long getSplitTenderId() {
        return splitTenderId;
    }

    /**
     * Sets the value of the splitTenderId property.
     *
     */
    public void setSplitTenderId(long value) {
        this.splitTenderId = value;
    }

    /**
     * Gets the value of the splitTenderStatus property.
     *
     * @return
     *     possible object is
     *     {@link SplitTenderStatusEnum }
     *
     */
    public SplitTenderStatusEnum getSplitTenderStatus() {
        return splitTenderStatus;
    }

    /**
     * Sets the value of the splitTenderStatus property.
     *
     * @param value
     *     allowed object is
     *     {@link SplitTenderStatusEnum }
     *
     */
    public void setSplitTenderStatus(SplitTenderStatusEnum value) {
        this.splitTenderStatus = value;
    }

}


text:
// Copyright 2007-2015 Chris Patterson, Dru Sellers, Travis Smith, et. al.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
namespace MassTransit.Saga.SubscriptionConfigurators
{
    using System.Collections.Generic;
    using System.Linq;
    using Configurators;
    using Connectors;
    using PipeConfigurators;

    public class SagaConfigurator<TSaga> :
        ISagaConfigurator<TSaga>,
        IReceiveEndpointSpecification
        where TSaga : class, ISaga
    {
        readonly IList<IPipeSpecification<SagaConsumeContext<TSaga>>> _pipeSpecifications;
        readonly ISagaRepository<TSaga> _sagaRepository;

        public SagaConfigurator(ISagaRepository<TSaga> sagaRepository)
        {
            _sagaRepository = sagaRepository;
            _pipeSpecifications = new List<IPipeSpecification<SagaConsumeContext<TSaga>>>();
        }

        public void Configure(IReceiveEndpointBuilder builder)
        {
            SagaConnectorCache<TSaga>.Connector.ConnectSaga(builder, _sagaRepository, _pipeSpecifications.ToArray());
        }

        public IEnumerable<ValidationResult> Validate()
        {
            if (_sagaRepository == null)
                yield return this.Failure("The saga repository cannot be null. How else are we going to save stuff? #facetopalm");

            foreach (ValidationResult result in _pipeSpecifications.SelectMany(x => x.Validate()))
                yield return result;
        }

        public void AddPipeSpecification(IPipeSpecification<SagaConsumeContext<TSaga>> specification)
        {
            _pipeSpecifications.Add(specification);
        }
    }
}


text:
A demo Mac OS X app from the BNR Cocoa book.

<https://www.bignerdranch.com/we-write/cocoa-programming/>


text:
/* $Id$ */

#include <stdarg.h>

#ifndef RND_H
#define RND_H 1

#define RND_ER_LOOPST 0
#define RND_ER_LOOPEL 1
#define RND_ER_CTYPE 2
#define RND_ER_BADSTART 3
#define RND_ER_BADMORE 4
#define RND_ER_BADEXPT 5
#define RND_ER_BADLIST 6
#define RND_ER_BADATTR 7

extern void (*rnd_verror_handler)(int er_no,va_list ap);

extern void rnd_default_verror_handler(int erno,va_list ap);

extern void rnd_init(void);
extern void rnd_clear(void);

extern int rnd_fixup(int start);

#endif


text:
using System;
using System.Windows;

namespace Hardcodet.Wpf.TaskbarNotification
{
    /// <summary>
    /// Helper class used by routed events of the
    /// <see cref="TaskbarIcon"/> class.
    /// </summary>
    internal static class RoutedEventHelper
    {
        #region RoutedEvent Helper Methods

        /// <summary>
        /// A static helper method to raise a routed event on a target UIElement or ContentElement.
        /// </summary>
        /// <param name="target">UIElement or ContentElement on which to raise the event</param>
        /// <param name="args">RoutedEventArgs to use when raising the event</param>
        internal static void RaiseEvent(DependencyObject target, RoutedEventArgs args)
        {
            if (target is UIElement)
            {
                (target as UIElement).RaiseEvent(args);
            }
            else if (target is ContentElement)
            {
                (target as ContentElement).RaiseEvent(args);
            }
        }

        /// <summary>
        /// A static helper method that adds a handler for a routed event
        /// to a target UIElement or ContentElement.
        /// </summary>
        /// <param name="element">UIElement or ContentElement that listens to the event</param>
        /// <param name="routedEvent">Event that will be handled</param>
        /// <param name="handler">Event handler to be added</param>
        internal static void AddHandler(DependencyObject element, RoutedEvent routedEvent, Delegate handler)
        {
            UIElement uie = element as UIElement;
            if (uie != null)
            {
                uie.AddHandler(routedEvent, handler);
            }
            else
            {
                ContentElement ce = element as ContentElement;
                if (ce != null)
                {
                    ce.AddHandler(routedEvent, handler);
                }
            }
        }

        /// <summary>
        /// A static helper method that removes a handler for a routed event
        /// from a target UIElement or ContentElement.
        /// </summary>
        /// <param name="element">UIElement or ContentElement that listens to the event</param>
        /// <param name="routedEvent">Event that will no longer be handled</param>
        /// <param name="handler">Event handler to be removed</param>
        internal static void RemoveHandler(DependencyObject element, RoutedEvent routedEvent, Delegate handler)
        {
            UIElement uie = element as UIElement;
            if (uie != null)
            {
                uie.RemoveHandler(routedEvent, handler);
            }
            else
            {
                ContentElement ce = element as ContentElement;
                if (ce != null)
                {
                    ce.RemoveHandler(routedEvent, handler);
                }
            }
        }

        #endregion
    }
}


text:
/* ###
 * IP: GHIDRA
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package ghidra.app.util.viewer.listingpanel;

import docking.widgets.EventTrigger;
import ghidra.program.util.ProgramSelection;

/**
 * Listener that is notified when the program selection changes
 */
public interface ProgramSelectionListener {

	/**
	 * Called whenever the program selection changes.
	 *
	 * @param selection the new program selection.
	 * @param trigger the cause of the change
	 */
	public void programSelectionChanged(ProgramSelection selection, EventTrigger trigger);
}


text:
require 'test_helper'

class SrpmControllerTest < ActionController::TestCase
  test "should get main" do
    get :main
    assert_response :success
  end

end


text:
namespace JsonToEnum.Export {
 	public enum  DestinyExplorerOrderBy
 	{
 		 None = 0,
 		 Name = 1,
 		 ItemType = 2,
 		 Rarity = 3,
 		 ItemTypeName = 4,
 		 ItemStatHash = 5,
 		 MinimumRequiredLevel = 6,
 		 MaximumRequiredLevel = 7
 	}
 }


text:
console.log("starting laser pointer tracker 4")

var addon = require('../build/Release/addon');
var sys = require('sys');
var PNG = require('pngjs').PNG;
var http = require('http');
var url = require('url');
var socketio = require('socket.io')
var utils = require('./utils/utils.js')
var timer = require('../timer.js').timer

var _camwidth = 640;
var _camheight = 480;
var readTimeout = 10;
var SEND_MSG_THRESHOLD = 100;
var _PORT = 3000;
var LoopTimeout = null;
var averageImage;
var cam = new addon();
var whiteDelay = 0.005//0.004;
var darkDelay = 0.001//0.0075;
var socket;
var whiteExpo = 240//90
var blackExpo = 20

//  smoothing
var smoothed = [0, 0]; // or some likely initial value
var smoothing = 100//15; // or whatever is desired
var lastUpdate = new Date;
var lastXY = [0, 0]
var maxLastDist = 0.02

	function init() {

		console.log("starting camera")
		cam.verbose(true)
		var camCount = cam.getNumCameras();
		console.log('num cameras', camCount)
		if (!camCount) {
			console.error(" No Camera Detected ")
			process.exit(1) // maybe I should have the server emit an error message
		}
		console.log("start Camera 0 ", cam.startCamera())
		console.log("started camera")

		setCamDefaults(cam)
		cam.takePhoto();
		cam.takePhoto();
		cam.takePhoto();

		//findLightDark(cam)
		//setCamDefaults(cam)

		// initialise an array or 2
		averageImage = new Float32Array(_camwidth * _camheight) //new Array(_camwidth * _camheight);
		for (var i = 0; i < averageImage.length; i++) {
			averageImage[i] = 0
		}

		startServer()
		searchLoop()
	}
	//
	// search for the dark and light frame for our laser. Note the projector should be displaying a whiteish screen for this to work.
	//
	function findLightDark(cam) {
		// Find the dark and light frames
		timer.start()
		cam.takePhoto();
		cam.takePhoto();
		var keyFrames = utils.findMinMax(cam)
		whiteDelay = keyFrames.high.ms;
		darkDelay = keyFrames.low.ms;
		console.log(keyFrames)
		console.log('time to callibrate light and dark frames', timer.stop())
		setCamDefaults(cam)
		return keyFrames
	}
	//
	// default camera parameters. for this....
	//
	function setCamDefaults(cam) {
		cam.autoGain(false);
		cam.autoExposure(false);
		cam.autoWhiteBalance(false);
		cam.gain(2);
		cam.exposure(whiteExpo);
		cam.triggerOff(true); //True is off, waits for hardware trigger
		cam.frameRate();
		cam.triggerDelay(whiteDelay)
		cam.takePhoto();
	}
	//
	//  Search for laser pointer
	//
var oldVariance = 0;
var lastSearchIter = new Date

	function searchLoop() {
		//console.log('search LOOOPPPPPP!!!!!!!!!!!!!!!!!!!!')
		timer.start()
		var radius = 5;
		//console.log( darkDelay, blackExpo)
		utils.setDelay(cam, darkDelay, blackExpo)
		var buf = cam.takePhoto();

		if (buf) {
			var bestVal = Number.MIN_VALUE;
			var bestIndex = 0;
			var mean = 0
			var variance = 0;
			var samples = 0
			var thresh =  new Float32Array(1)
			var rgb =  new Float32Array(3)
			for (var x = 0; x < _camwidth; x++) {
				for (var y = 0; y < _camheight; y++) {
					var i1 = y * _camwidth + x;
					var i2 = i1 * 3;
					 rgb[0] = buf[i2]/255;
					 rgb[1] = buf[i2 + 1]/255;
					rgb[2] = buf[i2 + 2]/255;

					//thresh = //400//Math.floor(brightness(r, g, b));
					thresh[0] = redThreshold(rgb)//brightness(rgb)
					//var gright =  Math.floor(brightness(r, g, b));
					var diff = thresh[0] - averageImage[i1];
					if (diff > bestVal) {
						bestVal = diff;
						bestIndex = i1;
					}

					//if (oldVariance > 1000) {
					//	averageImage[i1] = Math.floor(0.6 * averageImage[i1] + 0.4 * thresh)
					//} else {
					//averageImage[i1] = Math.floor(0.5 * averageImage[i1] + 0.5 * thresh[0])
					//}
					//  find variance because for some reason its slooooow
					//
					/*if (i1 % 1323 == 0) {
						variance += diff * diff
						samples++
					}
*/
				}
			}

			//console.log(variance)

			variance = parseInt(variance / ((samples) - 1))
			oldVariance = variance

			var bestxy = [Math.floor(bestIndex % (_camwidth)), Math.floor(bestIndex / (_camwidth))]
			var now = new Date
			if (now - lastSearchIter > 2000) {
				console.log('search for laser. searchtime:', timer.stop(), 'bestval: ', bestVal, 'x,y:', bestxy, 'variance', variance)
				lastSearchIter = now
			}
			//console.log('xy', bestxy, 'value', bestVal)
			emitLaserMsg((bestxy[0]) / _camwidth, (bestxy[1]) / _camheight,  bestVal)

			LoopTimeout = setTimeout(searchLoop, readTimeout)
		} else {
			console.log("FAIL")
		}
	}

	//
	//  functions needed by the laser point loop
	//
var redThreshold = function(rgb) {
	dx = rgb[0] ,
	dy = ( rgb[1] ) / 2,
	dz = ( rgb[2]) / 4;
	return Math.sqrt(dx * dx + dy * dy + dz * dz);
}
var brightness = function(rgb) {

	return Math.sqrt(rgb[0] * rgb[0] + rgb[1] * rgb[1] + rgb[2] * rgb[2]);
}

	function emitLaserMsg(x, y, confidence) {
		confidence = 255*confidence
		//console.log('sending',x,y, confidence)
		var smoo = smoothedValue([x, y])
		//console.log(smoo[0].toPrecision(4), smoo[1].toPrecision(4))
		if (confidence > SEND_MSG_THRESHOLD) {
			console.log('sending', 'x,y: ', x, y, 'confidence: ', confidence)
			socket.sockets.emit('laser', {
				x: smoo[0],
				y: smoo[1],
				rawX: x,
				rawY: y,
				c: Math.abs(confidence)
			});
		}
	}

	//
	//  Start the damn server
	//  	start a server on 127.0.0.1
	//
	function startServer() {

		console.log(cam.getWidth(), cam.getHeight())
		var server = http.createServer(function(req, res) {
			var request = url.parse(req.url, true);
			var querydata = url.parse(req.url, true).query;
			//console.log(querydata)
			var action = request.pathname;
			if (action == '/image.png') {
				console.log(' image requested', querydata)
				clearTimeout(LoopTimeout)
				var myexp = whiteExpo
				var mydelay = whiteDelay
				console.log(myexp, mydelay)
				if( querydata.exposure &&  Number(querydata.exposure) > 0){
					myexp = Math.min(1000,Math.max(1,Number(querydata.exposure)))
				}
				if( querydata.delay &&  Number(querydata.delay) > 0){
					mydelay = Math.min(1,Math.max(0,Number(querydata.delay)))
				}
				utils.setDelay(cam, mydelay, myexp)
				res.writeHead(200, utils.CORSheaders);
				var pnger = new PNG({
					width: 640,
					height: _camheight
				})
				var photo2 = cam.takePhoto('rgba');
				for (var i = 0; i < pnger.data.length; i++) {
					pnger.data[i] = photo2[i];
				}
				pnger.pack()
				pnger.pipe(res);
				LoopTimeout = setTimeout(searchLoop, 2000)

			} else if (action == "/findMinMax") {
				clearTimeout(LoopTimeout)
				utils.setDelay(cam, whiteDelay, whiteExpo)
				var keyFrames = findLightDark(cam)
				res.writeHead(200, {
					'Content-Type': 'text/plain'
				});
				res.end(" " + JSON.stringify(keyFrames) + " \n");
				LoopTimeout = setTimeout(searchLoop, 500)
			} else {
				res.writeHead(200, {
					'Content-Type': 'text/plain'
				});
				res.end('Hello World \n');
			}
		});
		server.listen(_PORT);
		console.log(" server listening on port 127.0.0.1:" + _PORT)

		//
		//  start socket io server
		//
		socket = socketio.listen(server);
		socket.sockets.on('connection', function(client) {
			console.log('socket on called')
			client.emit('laser', {
				hello: 'world'
			});
			client.on('my other event', function(data) {
				//console.log(data);
			});
		});
		socket.set('log level', 1);
	}

	function smoothedValue(newValue) {
		var now = new Date;
		var elapsedTime = now - lastUpdate;
		//smoothed = [smoothed[0] + elapsedTime * ( newValue[0] - smoothed[0] ) / smoothing, smoothed[1] + elapsedTime * ( newValue[1] - smoothed[1] ) / smoothing];
		var dist = Math.sqrt(Math.pow(smoothed[0] - newValue[0], 2) + Math.pow(smoothed[1] - newValue[1], 2))
		if (dist > maxLastDist) {
			smoothed = newValue
		} else {
			var smoothing2 = 1/(smoothing*dist) + 1
			//smoothed = [smoothed[0] + (newValue[0] - smoothed[0]) / smoothing, smoothed[1] + (newValue[1] - smoothed[1]) / smoothing];
			smoothed = [smoothed[0] + (newValue[0] - smoothed[0]) / smoothing2
			, smoothed[1] + (newValue[1] - smoothed[1]) / smoothing2];

		}
		lastUpdate = now;
		return smoothed;
	}

init()


text:
<?php

namespace AppBundle\Menu;

use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerAware;

/**
 * Class SideMenuBuilder
 */
class SideMenuBuilder extends ContainerAware
{
    protected $container;

    /**
     * {@inheritDoc}
     */
    public function setContainer(ContainerInterface $container = null)
    {
        $this->container = $container;
    }

    public function mainMenu(FactoryInterface $factory, array $options)
    {
        $security = $this->container->get('security.context');
        $menu = $factory->createItem('root', array(
            'childrenAttributes'    => array(
                'class'             => 'nav navbar-nav side-nav',
            ),
        ));

        $menu->addChild($this->container->get('translator')->trans('Home'), array('route' => 'glance'));
        if($security->isGranted('ROLE_PAIDUSER'))
        {
            $menu->addChild($this->container->get('translator')->trans('Articles'), array('route' => 'articleOverview'));
        }
        $menu->addChild($this->container->get('translator')->trans('Notices'), array('route' => 'noticeOverview'));
        $menu->addChild($this->container->get('translator')->trans('Agenda'), array('route' => 'agenda'));
        $menu->addChild($this->container->get('translator')->trans('Editors'), array('route' => 'editors'));
        $menu->addChild($this->container->get('translator')->trans('Guidelines for authors'), array('route' => 'guidelines'));
        $menu->addChild($this->container->get('translator')->trans('Interesting links'), array('route' => 'links'));
        $menu->addChild($this->container->get('translator')->trans('Vacancies & messages'), array('route' => 'vacancies'));
        $menu->addChild($this->container->get('translator')->trans('Contact'), array('route' => 'contact'));
        return $menu;
    }
}


text:
package uk.co.pilllogger.fragments;

import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.support.v4.widget.ContentLoadingProgressBar;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.SparseIntArray;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import com.echo.holographlibrary.BarGraph;
import com.echo.holographlibrary.LineGraph;
import com.echo.holographlibrary.PieGraph;
import com.echo.holographlibrary.StackBarGraph;
import com.getbase.floatingactionbutton.FloatingActionButton;
import com.getbase.floatingactionbutton.FloatingActionsMenu;
import com.path.android.jobqueue.JobManager;
import com.squareup.otto.Subscribe;

import org.joda.time.DateTime;
import org.joda.time.Days;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.inject.Inject;

import hugo.weaving.DebugLog;
import timber.log.Timber;
import uk.co.pilllogger.R;
import uk.co.pilllogger.activities.AddConsumptionActivity;
import uk.co.pilllogger.activities.DialogActivity;
import uk.co.pilllogger.adapters.ConsumptionRecyclerAdapter;
import uk.co.pilllogger.adapters.GraphPillListAdapter;
import uk.co.pilllogger.adapters.SimpleSectionedRecyclerViewAdapter;
import uk.co.pilllogger.decorators.DividerItemDecoration;
import uk.co.pilllogger.events.AfterCreatedConsumptionEvent;
import uk.co.pilllogger.events.AfterDeletedConsumptionEvent;
import uk.co.pilllogger.events.CreatedConsumptionEvent;
import uk.co.pilllogger.events.CreatedPillEvent;
import uk.co.pilllogger.events.DecreaseConsumptionEvent;
import uk.co.pilllogger.events.DeleteConsumptionEvent;
import uk.co.pilllogger.events.DeletePillEvent;
import uk.co.pilllogger.events.DeletedConsumptionEvent;
import uk.co.pilllogger.events.IncreaseConsumptionEvent;
import uk.co.pilllogger.events.LoadedConsumptionsEvent;
import uk.co.pilllogger.events.LoadedPillsEvent;
import uk.co.pilllogger.events.MenuCollapsedEvent;
import uk.co.pilllogger.events.MenuExpandedEvent;
import uk.co.pilllogger.events.PreferencesChangedEvent;
import uk.co.pilllogger.events.RedrawGraphEvent;
import uk.co.pilllogger.events.ShadowClickedEvent;
import uk.co.pilllogger.events.TakeConsumptionAgainEvent;
import uk.co.pilllogger.events.UpdatedPillEvent;
import uk.co.pilllogger.helpers.ColourHelper;
import uk.co.pilllogger.helpers.DateHelper;
import uk.co.pilllogger.helpers.GraphHelper;
import uk.co.pilllogger.helpers.LayoutHelper;
import uk.co.pilllogger.helpers.TrackerHelper;
import uk.co.pilllogger.jobs.DeleteConsumptionJob;
import uk.co.pilllogger.jobs.InsertConsumptionsJob;
import uk.co.pilllogger.jobs.LoadConsumptionsJob;
import uk.co.pilllogger.jobs.LoadPillsJob;
import uk.co.pilllogger.mappers.ConsumptionMapper;
import uk.co.pilllogger.models.Consumption;
import uk.co.pilllogger.models.Pill;
import uk.co.pilllogger.repositories.ConsumptionRepository;
import uk.co.pilllogger.repositories.PillRepository;
import uk.co.pilllogger.state.State;
import uk.co.pilllogger.stats.Statistics;

import static butterknife.ButterKnife.findById;

public class ConsumptionListFragment extends PillLoggerFragmentBase {
    @Inject
    Context _context;
    @Inject Statistics _statistics;
    @Inject JobManager _jobManager;
    @Inject ConsumptionRepository _consumptionRepository;
    @Inject PillRepository _pillRepository;

    public static final String TAG = "ConsumptionListFragment";
    private static final int GRAPH_CHANGE_DELAY = 300;
    RecyclerView _listView;
    StackBarGraph _graph;
    View _mainLayout;
    HashMap<Integer, Pill> _allPills = new HashMap<>();
    Fragment _fragment;
    Activity _activity;
    private List<Pill> _pills = new ArrayList<>();
    private List<Consumption> _consumptions;
    private ConsumptionRecyclerAdapter _adapter;
    private ContentLoadingProgressBar _progress;
    private FloatingActionsMenu _addMenu;
    private FloatingActionButton _add;
    private int _graphHeightDp;
    private TextView _graphDate;
    private ImageView _graphNext;
    private ImageView _graphPrevious;
    private Handler _handler;
    private Runnable _refreshGraph;
    private boolean _graphIsMonth;
    private TextView _noConsumption;
    private View _shadow;
    private boolean _addMenuPopulated = false;
    List<FloatingActionButton> _floatingActionButtons = new ArrayList<>();
    private Animation _fadeOutAnimation;
    private Animation _fadeInAnimation;
    private int _fadeDuration;

    @DebugLog
    public static ConsumptionListFragment newInstance(int num){
        ConsumptionListFragment f = new ConsumptionListFragment();

        // Supply num input as an argument.
        Bundle args = new Bundle();
        args.putInt("num", num);
        f.setArguments(args);

        return f;
    }

    @Override @DebugLog
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        // Inflate the layout for this fragment
        this.setRetainInstance(true);
        View v = inflater.inflate(R.layout.main_fragment, container, false);
        if(getActivity() == null || v == null){
            return null;
        }
        int color = getActivity().getResources().getColor(State.getSingleton().getTheme().getConsumptionListBackgroundResourceId());
        v.setTag(R.id.tag_page_colour, color);
        v.setTag(R.id.tag_tab_icon_position, 0);

        _mainLayout = v;
        _fragment = this;
        _activity = getActivity();

        _graph = findById(v, R.id.consumption_graph);

        setGraphHeight();

        _progress = findById(v, R.id.consumption_progress);
        _progress.show();

        _fadeInAnimation = AnimationUtils.loadAnimation(_context, R.anim.fade_in);
        _fadeOutAnimation = AnimationUtils.loadAnimation(_context, R.anim.fade_out);
        _fadeDuration = _context.getResources().getInteger(R.integer.fade_duration);

        _listView = (RecyclerView) v.findViewById(R.id.main_consumption_list);
        _listView.setHasFixedSize(true);
        _listView.addItemDecoration(new DividerItemDecoration(_activity, DividerItemDecoration.VERTICAL_LIST));

        LinearLayoutManager layoutManager = new LinearLayoutManager(_context);
        layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        _listView.setLayoutManager(layoutManager);
        _listView.setItemAnimator(new DefaultItemAnimator());

        if (_listView.getAdapter() != null) { //Trying this to make the list refresh after adding the new consumption
            _listView.getAdapter().notifyDataSetChanged();
        }

        _noConsumption = (TextView) v.findViewById(R.id.no_consumption_text);

		setUpGraphControls(v);

        _addMenu = (FloatingActionsMenu) v.findViewById(R.id.add_menu);

        _shadow = v.findViewById(R.id.shadowView);
        _addMenu.setOnFloatingActionsMenuUpdateListener(new FloatingActionsMenu.OnFloatingActionsMenuUpdateListener() {
            @Override
            public void onMenuExpanded() {
                _shadow.animate().alpha(1).setDuration(_fadeDuration).start();
                _bus.post(new MenuExpandedEvent());
            }

            @Override
            public void onMenuCollapsed() {
                _shadow.animate().alpha(0).setDuration(_fadeDuration).start();
                _bus.post(new MenuCollapsedEvent());
            }
        });

        //_add = (FloatingActionButton) v.findViewById(R.id.normal_plus);
        /*_add.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(_activity, AddConsumptionActivity.class);
                _activity.startActivity(intent);

                if(_addMenu != null){
                    _addMenu.collapse();
                }
            }
        });*/

        _shadow.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if(_addMenu.isExpanded()){
                    _addMenu.collapse();
                    return true;
                }
                return false;
            }
        });

       // setupAddMenu(_pills);

        return v;
    }

    private void setUpGraphControls(View v) {
        setGraphSpan();
        SharedPreferences graphSpanPref = _context.getSharedPreferences(_context.getString(R.string.pref_key_graph_span), 0);
        String pref = graphSpanPref.getString(_context.getString(R.string.pref_key_graph_span), null);
        _graphDate = findById(v, R.id.graph_date);
        _graphDate.setTypeface(State.getSingleton().getRobotoTypeface());
        setGraphDateText();

        _graphPrevious = findById(v, R.id.graph_date_previous);
        _graphNext = findById(v, R.id.graph_date_next);
        _graphPrevious.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (_consumptions != null) {
                    GraphHelper._graphPage++;
                    reDrawGraph(getGraphFromDate(), getGraphToDate());
                    validateGraphButons(_consumptions);
                }
            }
        });
        _graphNext.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (_consumptions != null) {
                    GraphHelper._graphPage--;
                    reDrawGraph(getGraphFromDate(), getGraphToDate());
                    validateGraphButons(_consumptions);
                }
            }
        });
        _graphNext.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View view) {
                if (_consumptions != null) {
                    GraphHelper._graphPage = 0;
                    reDrawGraph(getGraphFromDate(), getGraphToDate());
                    validateGraphButons(_consumptions);
                }
                return true;
            }
        });
    }

    private DateTime getGraphFromDate() {
        return _graphIsMonth ? getGraphToDate().minusMonths(GraphHelper._graphSpan)
                : getGraphToDate().minusDays(GraphHelper._graphSpan);
    }

    private DateTime getGraphToDate() {
        return _graphIsMonth ? new DateTime().minusMonths(GraphHelper._graphSpan * GraphHelper._graphPage)
                : new DateTime().minusDays(GraphHelper._graphSpan * GraphHelper._graphPage);
    }

    private void reDrawGraph(final DateTime fromDate, final DateTime toDate) {
        setGraphDateText();
        if (_handler != null && _refreshGraph != null) {
            _handler.removeCallbacks(_refreshGraph);
        }
        else {
            _handler = new Handler();
        }
        _refreshGraph = new Runnable() {
            @Override
            public void run() {
                plotGraph(_consumptions, fromDate, toDate, true);
            }
        };
        _handler.postDelayed(_refreshGraph, GRAPH_CHANGE_DELAY);
    }

    private void validateGraphButons(List<Consumption> consumptions) {
        DateTime fromDate = getGraphFromDate();
        DateTime toDate = getGraphToDate();
        if (_graphPrevious == null || _graphNext == null) {
            return; // this has been called before fragment has been fully set up
        }
        if (consumptions == null || consumptions.size() == 0) {
            _graphPrevious.setVisibility(View.GONE);
            _graphNext.setVisibility(View.GONE);
            return;
        }
        int previousVisibility = !(_statistics.getFirstConsumption(consumptions).getDate().compareTo(fromDate.toDate()) >= 0)
                ? View.VISIBLE : View.GONE;
        _graphPrevious.setVisibility(previousVisibility);

        int nextVisibility = !(_statistics.getLastConsumption(consumptions).getDate().compareTo(toDate.toDate()) <= 0)
                ?   View.VISIBLE : View.GONE;
        _graphNext.setVisibility(nextVisibility);
    }

    private void setGraphDateText() {
        DateTime toDate = getGraphToDate();
        DateTime fromDate = getGraphFromDate();
        if (_graphDate != null) {
            if (toDate.plusDays(1).isAfterNow() && GraphHelper._graphSpan == 7) {
                _graphDate.setText("Last 7 days");
            }
            else if (toDate.plusDays(1).isAfterNow() && GraphHelper._graphSpan == 14) {
                _graphDate.setText("Last two weeks");
            }
            else {
                _graphDate.setText(DateHelper.formatDateAndTimeMedium(_activity, fromDate.plusDays(1).toDate()) + " - "
                        + DateHelper.formatDateAndTimeMedium(_activity, toDate.toDate()));
            }
        }
    }

    private void setGraphHeight() {
        String graphKey = _context.getString(R.string.pref_key_graph_height);
        String graphHeight = PreferenceManager.getDefaultSharedPreferences(_context).getString(graphKey, "150");
        _graphHeightDp = 150;

        if(graphHeight.equals(_context.getString(R.string.huge))){
            _graphHeightDp = _context.getResources().getInteger(R.integer.graph_huge);
        }
        if(graphHeight.equals(_context.getString(R.string.large))){
            _graphHeightDp = _context.getResources().getInteger(R.integer.graph_large);
        }
        if(graphHeight.equals(_context.getString(R.string.medium))){
            _graphHeightDp = _context.getResources().getInteger(R.integer.graph_medium);
        }
        if(graphHeight.equals(_context.getString(R.string.small))){
            _graphHeightDp = _context.getResources().getInteger(R.integer.graph_small);
        }
        if(graphHeight.equals(_context.getString(R.string.hidden))){
            _graphHeightDp = _context.getResources().getInteger(R.integer.graph_hidden);
        }

        _graph.getLayoutParams().height = (int) LayoutHelper.dpToPx(_context, _graphHeightDp);
    }

    @Override
    public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState){
        super.onActivityCreated(savedInstanceState);

        getView().setFocusableInTouchMode(true);
        getView().requestFocus();

        getView().setOnKeyListener(new View.OnKeyListener() {
            @Override
            public boolean onKey(View v, int keyCode, KeyEvent event) {
                if (event.getAction() == KeyEvent.ACTION_DOWN) {
                    if (keyCode == KeyEvent.KEYCODE_BACK) {
                        if (_addMenu.isExpanded()) {
                            _addMenu.collapse();
                            return true;
                        }
                    }
                }
                return false;
            }
        });
    }

    @Override
    public void onStart(){
        super.onStart();
    }

    @Override
    public void onPause(){
        super.onPause();

        if(_addMenu != null) {
            _addMenu.collapse();
        }
    }

    @Override
    public void onStop(){
        super.onStop();
    }

    @Override @DebugLog
    public void onDestroyView(){
        super.onDestroyView();

        if(_listView == null || _listView.getAdapter() == null){
            return;
        }

        try {
            _consumptions.clear();
            _consumptions.addAll(_adapter.getConsumptions());
            _bus.unregister(_listView.getAdapter());
        }
        catch(IllegalArgumentException ignored){} // if this throws, we're not registered anyway
    }

    @Override
    public void onDestroy(){
        super.onDestroy();
    }

    @Override
    public void onResume() {
        super.onResume();

        if(_listView != null && _listView.getAdapter() != null) {
            _listView.getAdapter().notifyDataSetChanged();
        }

        if (_consumptions != null) {
            plotGraph(_consumptions);
        }

        if (_pills == null || _pills.size() == 0) {
            _bus.post(new LoadPillsJob());
        }
        setupPills(_pills);
        setupAddMenu(_pills);
    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);

        setupPills(_pills);
    }

    @Subscribe @DebugLog
    public void consumptionsReceived(LoadedConsumptionsEvent event) {
        _consumptions = event.getConsumptions();
        Activity activity = getActivity();

        if(activity == null || _mainLayout == null) // the method won't work without the activity, so let's not crash trying.
            return;

        _consumptions = _consumptionRepository.groupConsumptions(_consumptions);

        if (_consumptions.size() == 0) {
            hideConsumptionList(_noConsumption);
        }
        else {
            if (_listView.getVisibility() == View.GONE) {
                showConsumptionList(_noConsumption);
            }

            if(_listView.getAdapter() == null) {
                Timber.d("Creating new ConsumptionRecyclerAdapter");
                _adapter = new ConsumptionRecyclerAdapter(_consumptions, _context);

                _adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
                    @Override
                    public void onItemRangeChanged(int positionStart, int itemCount) {
                        super.onItemRangeChanged(positionStart, itemCount);

                        plotGraph(_adapter.getConsumptions(), getGraphFromDate(), getGraphToDate(), false);
                        validateGraphButons(_adapter.getConsumptions());
                    }

                    @Override
                    public void onItemRangeInserted(int positionStart, int itemCount) {
                        super.onItemRangeInserted(positionStart, itemCount);

                        if (positionStart == 0) {
                            _listView.scrollToPosition(0);
                        }

                        showConsumptionList(_noConsumption);
                        plotGraph(_adapter.getConsumptions(), getGraphFromDate(), getGraphToDate(), false);
                        validateGraphButons(_adapter.getConsumptions());
                    }

                    @Override
                    public void onItemRangeRemoved(int positionStart, int itemCount) {
                        super.onItemRangeRemoved(positionStart, itemCount);

                        Timber.d("onItemRangeRemoved");
                        plotGraph(_adapter.getConsumptions(), getGraphFromDate(), getGraphToDate(), false);
                        consumptionsReceived(new LoadedConsumptionsEvent(_adapter.getConsumptions()));
                        validateGraphButons(_adapter.getConsumptions());
                    }

                    @Override
                    public void onChanged() {
                        super.onChanged();
                        _consumptions = _adapter.getConsumptions();
                        plotGraph(_consumptions, getGraphFromDate(), getGraphToDate(), false);
                    }
                });

                //This is the code to provide a sectioned list
                List<SimpleSectionedRecyclerViewAdapter.Section> sections = getConsumptionSections();

                //Add your adapter to the sectionAdapter
                SimpleSectionedRecyclerViewAdapter sectionedAdapter = new
                        SimpleSectionedRecyclerViewAdapter(_context, R.layout.section, R.id.section_text, _adapter);
                sectionedAdapter.setSections(sections);

                _bus.register(_adapter);

                if (_listView.getAdapter() != null) {
                    _bus.unregister(_listView.getAdapter());
                }

                _listView.setAdapter(_adapter);
                _listView.setOnTouchListener(new View.OnTouchListener() {
                    @Override
                    public boolean onTouch(View v, MotionEvent event) {
                        View view = v.findViewById(R.id.graph_layout);
                        if (view != null)
                            view.getParent().requestDisallowInterceptTouchEvent(false);
                        return false;
                    }
                });

                plotGraph(_consumptions);
                _progress.hide();
            }
        }
        TrackerHelper.updateUserProfile(activity, _pills.size(), _consumptions, _statistics);

        _statistics.refreshConsumptionCaches(_consumptions);
        if(_adapter != null) {
            validateGraphButons(_adapter.getConsumptions());
        }
    }

    private void showConsumptionList(TextView noConsumption) {
        _listView.setVisibility(View.VISIBLE);
        noConsumption.setVisibility(View.GONE);
    }

    private void hideConsumptionList(TextView noConsumption) {
        noConsumption.setVisibility(View.VISIBLE);
        _listView.setVisibility(View.GONE);
    }

    private void plotGraph(List<Consumption> consumptions) {
        Map<Pill, SparseIntArray> xPoints = ConsumptionMapper.mapByPillAndDate(consumptions, getGraphFromDate(), getGraphToDate());
        plotGraph(consumptions, xPoints, false);
    }

    private void plotGraph(List<Consumption> consumptions, DateTime fromDate, DateTime toDate, boolean refresh) {
        Map<Pill, SparseIntArray> xPoints = ConsumptionMapper.mapByPillAndDate(consumptions, fromDate, toDate);
        plotGraph(consumptions, xPoints, refresh);
    }

    @DebugLog
    private void plotGraph(List<Consumption> consumptions, Map<Pill, SparseIntArray> xPoints, boolean refresh) {
        if (xPoints != null) {
            plotGraph(xPoints, DateHelper.getDaysBetween(getGraphFromDate(), getGraphToDate()), _graph, refresh);
        }
    }

    @Subscribe
    public void consumptionTakenAgain(TakeConsumptionAgainEvent event){
        _listView.scrollToPosition(0);

        _jobManager.addJobInBackground(new InsertConsumptionsJob(event.getConsumptionsToInsert()));
    }

    @Subscribe
    public void consumptionIncreased(IncreaseConsumptionEvent event){
        _jobManager.addJobInBackground(new InsertConsumptionsJob(event.getConsumption()));
    }

    @Subscribe
    public void consumptionDecreased(DecreaseConsumptionEvent event){
        _jobManager.addJobInBackground(new DeleteConsumptionJob(event.getConsumption(), false));
    }

    @Subscribe
    public void consumptionDeleted(DeleteConsumptionEvent event){
        _jobManager.addJobInBackground(new DeleteConsumptionJob(event.getConsumption(), true));
        _jobManager.addJobInBackground(new LoadPillsJob());
    }

    private List<SimpleSectionedRecyclerViewAdapter.Section> getConsumptionSections() {
        List<SimpleSectionedRecyclerViewAdapter.Section> sections =
                new ArrayList<>();

        DateTime now = DateTime.now();
        DateTime startOfToday = now.withTimeAtStartOfDay();
        DateTime startOfTomorrow = startOfToday.plusDays(1);
        DateTime currentConsumptionDate = DateTime.now().plusDays(1).withTimeAtStartOfDay();

        for(int i = 0; i < _consumptions.size(); i++){
            Consumption consumption = _consumptions.get(i);

            DateTime consumptionDate = new DateTime(consumption.getDate());

            if(!consumptionDate.withTimeAtStartOfDay().isBefore(currentConsumptionDate)){
                continue;
            }

            // new earlier date
            currentConsumptionDate = consumptionDate.withTimeAtStartOfDay();

            String text;

            if(consumptionDate.isBefore(startOfTomorrow)
                    && consumptionDate.isAfter(startOfToday)){
                text = "Today";
            }
            else{
                if(consumptionDate.plusDays(1).isBefore(startOfTomorrow)
                        && consumptionDate.plusDays(1).isAfter(startOfToday)) {
                    text = "Yesterday";
                }
                else{
                    text = DateHelper.getPrettyDayOfMonth(consumptionDate);
                }
            }

            sections.add(new SimpleSectionedRecyclerViewAdapter.Section(i, text));
        }
        return sections;
    }

    private int getGraphDays(){
        DateTime aWeekAgo = new DateTime().minusWeeks(1);
        Days totalDays = Days.daysBetween(aWeekAgo.withTimeAtStartOfDay(), new DateTime().withTimeAtStartOfDay());
        return totalDays.getDays();
    }

    @Subscribe
    public void replotGraph(RedrawGraphEvent event){
        replotGraph();
    }

    public void replotGraph(){
        plotGraph(_consumptions, getGraphFromDate(), getGraphToDate(), false);
    }

    public void plotGraph(Map<Pill, SparseIntArray> data, int dayCount, View view) {
        plotGraph(data, dayCount, view, false);
    }

    public void plotGraph(Map<Pill, SparseIntArray> data, int dayCount, View view, boolean refresh) {

        int lineColour = _activity.getResources().getColor(State.getSingleton().getTheme().getStackBarGraphLineColourResourceId());

        if(view instanceof LineGraph)
            GraphHelper.plotLineGraph(data, dayCount, (LineGraph) view);

        if(view instanceof BarGraph)
            GraphHelper.plotBarGraph(data, dayCount, (BarGraph)view);

        if(view instanceof PieGraph)
            GraphHelper.plotPieChart(data, dayCount, (PieGraph)view);

        if(view instanceof StackBarGraph)
            GraphHelper.plotStackBarGraph(data, dayCount, (StackBarGraph)view, lineColour, getGraphToDate(), true, refresh);

        view.setTag(data);
    }

    @Subscribe
    public void pillCreated(CreatedPillEvent event) {
        Pill pill = event.getPill();
        if (_pills != null && pill != null) {
            _pills.add(pill);
            setupAddMenu(_pills, true);
        }
    }

    @Subscribe
    public void pillDelete(UpdatedPillEvent event) {
        if(event.wasDeleted()){
            Pill pill = event.getPill();
            if (_pills != null && pill != null) {
                _pills.remove(pill);
            }
        }
        setupAddMenu(_pills, true);
    }

    @Subscribe
    public void consumptionAdded(AfterCreatedConsumptionEvent event){
        setupAddMenu(_pills, true);
    }

    @Subscribe
    public void consumptionDeleted(AfterDeletedConsumptionEvent event){
        setupAddMenu(_pills, true);
    }

    @Subscribe @DebugLog
    public void pillsLoaded(LoadedPillsEvent event) {
        _pills = event.getPills();
        List<Integer> graphPills = State.getSingleton().getGraphExcludePills();
        if (graphPills == null) {
            graphPills = new ArrayList<>();
        }
        for(Pill p : _pills){
            _allPills.put(p.getId(), p);
        }
        State.getSingleton().setGraphExcludePills(graphPills);

        final List<Pill> pillList = _pills;
        setupPills(pillList);
        setupAddMenu(pillList);
    }

    private void setupAddMenu(List<Pill> pillList){
        setupAddMenu(pillList, false);
    }

    private void setupAddMenu(List<Pill> pillList, boolean clear) {
        if(_addMenu == null){
            return;
        }

        if(clear){
            for(FloatingActionButton button : _floatingActionButtons){
                _addMenu.removeButton(button);
            }
            _floatingActionButtons.clear();
        }

        List<Pill> addMenuPills = createAddMenuPills(pillList);

        Collections.reverse(addMenuPills);
        for(final Pill pill : addMenuPills) {
            int childCount = _addMenu.getChildCount();

            boolean pillAlreadyAdded = false;
            for(int i = 0; i < childCount; i++){
                View childAt = _addMenu.getChildAt(i);

                Object tag = childAt.getTag();

                if(tag != null && tag.equals(pill.getId())){
                    pillAlreadyAdded = true;
                }
            }

            if(pillAlreadyAdded){
                continue;
            }

            FloatingActionButton button = new FloatingActionButton(_context);
            int colour = ColourHelper.removeAlpha(pill.getColour());
            button.setColorNormal(colour);
            button.setColorPressed(ColourHelper.getLighter(colour));
            button.setTitle(pill.getName());
            button.setTag(pill.getId());
            button.setSize(FloatingActionButton.SIZE_MINI);
            if (pill.isFavourite()) {
                if (ColourHelper.isColourLight(pill.getColour())) {
                    button.setIcon(R.drawable.ic_fab_star_dark);
                }
                else {
                    button.setIcon(R.drawable.ic_fab_star_light);
                }

            }
            button.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    _addMenu.collapse();
                    Handler handler = new Handler();
                    Runnable openNewConsumption = new Runnable() {
                        @Override
                        public void run() {
                            Intent intent = new Intent(_context, DialogActivity.class);
                            intent.putExtra("PillId", pill.getId());
                            intent.putExtra("DialogType", DialogActivity.DialogType.NewConsumption.ordinal());
                            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                            _context.startActivity(intent);
                        }
                    };
                    handler.postDelayed(openNewConsumption, 150);
                }
            });
            _floatingActionButtons.add(button);
            _addMenu.addButton(button);
        }

        setUpCreateNewAddMenuButton(pillList);
    }

    private List<Pill> createAddMenuPills(List<Pill> pillList) {
        _pillRepository.sortPillsByLastTaken(pillList);
        List<Pill> addMenuPills = new ArrayList<>();
        int pills = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? 1 : 4;

        List<Pill> favouritePills = new ArrayList<>();
        for (Pill pill : pillList) {
            if(pill.isFavourite()) {
                favouritePills.add(pill);
            }
        }

        _pillRepository.sortPillsByMostTaken(favouritePills);

        for (Pill pill : favouritePills) {
            if (pills == 0) {
                break;
            }
            addMenuPills.add(pill);
            pills--;
        }

        for (int i = 0; i < pills; i++) {
            if(i >= pillList.size()){
                break;
            }
            Pill pill = pillList.get(i);
            if (!addMenuPills.contains(pill)) {
                addMenuPills.add(pill);
            }
            else {
                pills++;
            }
        }

        return addMenuPills;
    }

    private void setUpCreateNewAddMenuButton(List<Pill> pillList) {

        int childCount = _addMenu.getChildCount();
        for(int i = 0; i < childCount; i++){
            View childAt = _addMenu.getChildAt(i);

            Object tag = childAt.getTag();

            if(tag != null && tag.equals(-99)){
                return;
            }
        }

        FloatingActionButton button = new FloatingActionButton(_context);
        button.setColorNormalResId(R.color.white);
        button.setColorPressedResId(R.color.white_pressed);
        button.setSize(FloatingActionButton.SIZE_MINI);
        button.setTag(-99);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(_context, AddConsumptionActivity.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                _context.startActivity(intent);
                _addMenu.collapse();
            }
        });

        if (pillList.size() > 0) {
            button.setTitle(getResources().getString(R.string.add_menu_other));
        }
        else {
            button.setTitle(getResources().getString(R.string.add_menu_new));
        }
        _floatingActionButtons.add(button);
        _addMenu.addButton(button);
    }

    @DebugLog
    private void setupPills(final List<Pill> pillList) {
        Activity activity = getActivity();
        if (activity != null) {
            ListView list = (ListView) activity.findViewById(R.id.graph_drawer);
            if (list != null){ //we need to init the adapter
                GraphPillListAdapter adapter = new GraphPillListAdapter(getActivity(), R.layout.graph_pill_list, _pills);
                list.setAdapter(adapter);
                list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                    @Override
                    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                        Pill pill = pillList.get(position);
                        List<Integer> graphPills = State.getSingleton().getGraphExcludePills();
                        CheckBox checkbox = (CheckBox)view.findViewById(R.id.graph_list_check_box);
                        if (!checkbox.isChecked()) {
                            checkbox.setChecked(true);
                            if (graphPills.contains(pill.getId())) {
                                graphPills.remove((Object) pill.getId());
                            }
                        }
                        else {
                            checkbox.setChecked(false);
                            if (!graphPills.contains(pill.getId())) {
                                graphPills.add(pill.getId());
                            }
                        }
                        replotGraph();
                    }
                });
            }
            if(_consumptions == null || _consumptions.size() == 0) {
                _jobManager.addJobInBackground(new LoadConsumptionsJob(true));
            }
            else{
                if(_listView != null && _listView.getAdapter() == null){
                    consumptionsReceived(new LoadedConsumptionsEvent(_consumptions));
                }
            }
        }
    }

    @Subscribe @DebugLog
    public void consumptionDeleted(DeletedConsumptionEvent event) {
        final Consumption consumption1 = event.getConsumption();
        Runnable runnable = new Runnable(){
            public void run(){
                if (_consumptions != null) {
                    Collections.sort(_consumptions);
                    for (Consumption consumption2 : _consumptions) {
                        if (consumption2.getGroup().equals(consumption1.getGroup()) && consumption2.getPillId() == consumption1.getPillId()) {
                            consumption2.setQuantity(consumption2.getQuantity() - 1);
                        }
                    }
                    consumptionsReceived(new LoadedConsumptionsEvent(_adapter.getConsumptions()));
                }
            }
        };
        executeRunnable(runnable);
    }

    @Subscribe
    public void preferencesChanged(PreferencesChangedEvent event){
        if(_adapter != null){
            _adapter.notifyDataSetChanged();
        }

        if(event.getKey().equals(_context.getString(R.string.pref_key_graph_height))){
            setGraphHeight();
        }
        else if (event.getKey().equals(_context.getString(R.string.pref_key_graph_span))) {
            setGraphSpan();
            plotGraph(_consumptions, getGraphFromDate(), getGraphToDate(), true);
        }
    }

    @Subscribe
    public void activityShadowClicked(ShadowClickedEvent event){
        if(_addMenu != null){
            _addMenu.collapse();
        }
    }

    private void setGraphSpan() {
        String graphSpan = _context.getString(R.string.pref_key_graph_span);
        String preference = PreferenceManager.getDefaultSharedPreferences(_context).getString(graphSpan, null);
        if (preference == null || preference.equals(_context.getString(R.string.one_week))) {
            GraphHelper._graphSpan = 7;
            _graphIsMonth = false;
        }
        else if (preference.equals(_context.getString(R.string.two_weeks))) {
            GraphHelper._graphSpan = 14;
            _graphIsMonth = false;
        }
        else {
            _graphIsMonth = true;
            GraphHelper._graphSpan = 1;
        }
        validateGraphButons(_consumptions);
        setGraphDateText();
    }
}


text:
var path = require('path');
var http = require('http');
var fs   = require('fs');
var server = http.createServer();

// attach handler
server.on('request', function (req,res) {
  var file = path.normalize('.' + req.url);
  console.log(req.url);

  fs.exists(file, function(exists) {
    if (exists) {
      var rs = fs.createReadStream(file);

      rs.on('error', function() {
        res.writeHead(500); // error status
        res.end('Internal Server Error');
      });

      res.writeHead(200); // ok status

      // PIPE the read stream with the RESPONSE stream
      rs.pipe(res);
    }
    else {
      res.writeHead(404); // error status
      res.end('NOT FOUND');
    }
  });

}); // end server on handler

server.listen(4000);


text:
import Phaser from 'phaser'

export default class extends Phaser.Text {
  constructor ({ game, world, text }) {
    super(game, 1500, 800, text)
    this.font = 'Bangers'
    this.align = 'center'
    this.padding.set(10, 16)
    this.fontSize = 40
    this.fill = '#000000'
    this.smoothed = false
    this.anchor.setTo(0.5)

    this.game.arrowKeys = this.game.add.sprite(100, 100, 'mouse')
    this.game.add.existing(this)
  }

  update () {

  }
}


text:
using UnityEngine;
using System.Collections;

using Cubiquity.Impl;

namespace Cubiquity
{
	[ExecuteInEditMode]
	/// Controls some visual aspects of the terrain volume and allows it to be rendered.
	/**
	 * See the base VolumeRenderer class for further details and available properties.
	 */
	public class TerrainVolumeRenderer : VolumeRenderer
	{
		void Awake()
		{
			if(material == null)
			{
				// Triplanar textuing seems like a good default material for the terrain volume.
				material = Instantiate(Resources.Load("Materials/Triplanar", typeof(Material))) as Material;
			}
		}
	}
}