text:
title: Skeletal, Muscular, and Nervous Systems
author: McGraw-Hill Education

subject: Science
category: Common Core Achieve
chapter: 1
section: 1.1
tag: Life Science

cover_image: cca-science.jpg

excerpt: "The skeletal, muscular, and nervous systems work together to help the body move. Learn about the structure and function of each of these body systems."

---
## The Skeletal System

Marathon runners travel more than 26 miles from start to finish. Running that far challenges the body both physically and mentally. Those who finish can take pride in achieving such a difficult goal. Running a marathon requires muscle strength and endurance. It also requires a sturdy skeletal system to support those muscles.

The skeletal system is a framework of bones that provides structure to your body and protects your internal organs. The skeleton also serves as a reservoir for the storage of minerals, produces blood cells, and allows movement of the body. A typical human skeleton is made up of 206 bones.

The skull contains bones that surround and protect the brain, while bones of the spine support the skull and allow movement in the back. The ribs protect important internal organs. Bones in the hand allow for many tasks, and bones in the feet support the body when walking or running.

Each bone is composed of living, growing tissue. If a bone breaks, one type of bone cell breaks down the damaged tissue while another type of bone cell begins to rebuild the bone. Calcium and vitamin D are nutrients that help build strong bones. You may think of bones as hard, solid objects. Although the outside of a bone is hard, the inside is filled with soft tissue called marrow. Bone marrow produces new blood cells.

Two types of bone marrow, red and yellow, run through the center of many long bones, such as those in the legs and arms. Red bone marrow produces red blood cells, which transport oxygen throughout the body. It also produces certain types of white blood cells, which help to fight disease. Yellow bone marrow is made up mostly of fat cells that are a source of stored energy.

![HUMAN SKELETON](){: .materialboxed .responsive-img }

Bones come in different shapes and sizes, and are based on their functions. For example, short, slender bones in your fingers allow your fingers to move and grasp things. Bones are classified as:

  * long bones, found in the legs and arms
  * short bones, found in fingers and toes
  * flat bones, found in the skull and pelvis
  * irregular bones, found in the backbone and ears

### Joints

Joints are places where two or more bones meet. Tough strands of connective tissue called ligaments connect bones at most joints. Bones at joints are covered in flexible cartilage, which is a tough, elastic connective tissue. Cartilage covers bones to prevent them from rubbing against each other.

![TYPES OF JOINTS](){: .materialboxed .responsive-img }

The amount of bone movement at a joint varies. For example, joints in the skull are not movable, while joints in the shoulder allow a wide range of motion. Joints are classified by the type of movement they allow and the shapes of their parts.

  * Ball-and-socket joints, found in the shoulders and hips, allow for movement in almost all directions.
  * Hinge joints, found in elbows and knees, allow for movement in one direction.
  * Gliding joints, found in wrists and ankles, allow limited movement in many directions.
  * Pivot joints, found between vertebrae in the spine, mainly allow rotating movement from side to side.
  * Fixed joints, found in the skull, hold the bones of the skull together and do not allow for any movement.

## The Muscular System

The skeletal and muscular systems are interrelated. The muscular system uses muscles to move the bones of the skeletal system. Muscles are tissues that contract. Contraction occurs when muscle fibers shorten and pull together. Many muscles attach to bones, allowing you to walk, run, throw, dance, or do any other type of activity. Other muscles allow your heart to beat or move food through your body.

### Voluntary Muscles

Skeletal muscles, or the muscles that are used to control bone movement, are all voluntary muscles you can consciously control. These muscles are connected to bones by tendons, which are bands of strong, fibrous connective tissue. Because a muscle can only contract, every joint is controlled by opposing muscles. This allows back-and-forth movement to occur. As shown in the image, you contract your biceps muscle to bend your arm. When your biceps muscle contracts, your triceps muscle relaxes and becomes stretched. You contract your triceps muscle to straighten your arm. When your triceps muscle contracts, your biceps muscle relaxes and becomes stretched.

![ARM MUSCLES](){: .materialboxed .responsive-img }

### Involuntary Muscles

Muscles in the lungs, intestines, bladder, blood vessels, and heart are all involuntary muscles. You have limited control over involuntary muscles. In other words, these muscles function without you consciously controlling them. Some involuntary muscles move materials into, through, or out of the body, such as the smooth muscles in the blood vessels, lungs, or intestines. The involuntary muscle in the heart is called cardiac muscle. Cardiac muscle causes the heart to beat, which pumps blood throughout the body.

## The Nervous System

When you want to move, what causes your muscles to contract? Muscles move in response to electrical and chemical signals that travel through the nervous system. The nervous system includes the brain, spinal cord, and a network of specialized nerve cells called neurons. When you decide to move your arm or leg, your brain sends a nerve impulse down the spinal cord. The impulse reaches the muscles involved, causing muscle contraction and movement.

### Neurons

A neuron consists of three main parts: dendrites that receive messages from other neurons, a cell body that contains the nucleus, and an axon that allows an electrical signal to travel to other neurons and muscles. Axons are surrounded by a myelin sheath that insulates the axon and improves the speed at which impulses are conducted. At the gap between neurons, called a synapse, the electrical message is changed to a chemical message that is picked up by the next nerve cell.

![NEURONS](){: .materialboxed .responsive-img }

### The Spinal Cord

The spinal cord consists of nerve fibers that send impulses to and from the brain to the rest of the body. The spinal cord sends many messages from the brain to allow the body to function. At times, however, the spinal cord functions as a body defense system by immediately acting on an emergency nerve-cell message without involving the brain. For example, when you touch a hot stove, a sensory neuron sends a message to your spinal cord that the stove is hot. The spinal cord immediately sends a message to the motor neurons in your arm and hand that causes you to pull your hand away from the stove. This reflex response is used to prevent injury when it would take too long for the message to travel to the brain, down the spinal cord, and then out to the affected area.

### The Brain

The brain is a complex organ that contains 90 percent of the neurons in the body. The brain controls all actions except reflex responses. Different portions of the brain control different body functions.

There are three main structures at the base of the brain. The cerebellum controls coordination, posture, and balance. The medulla oblongata governs involuntary body functions like breathing and digestion. The pons helps control the rate of breathing and relays signals between the cerebellum and the cerebrum.

The cerebrum is the large structure at the top of the brain. It controls motor coordination and interpretation of sensory information from inside and outside the body. The cerebrum is divided into two halves called hemispheres.

Each hemisphere contains four lobes that perform specific functions:

  * The frontal lobe regulates voluntary movements and is involved with decision making and problem solving.
  * The temporal lobe regulates memory, emotions, hearing, and language.
  * The parietal lobe processes sensory signals from the body.
  * The occipital lobe is involved with sight and visual memory.

![THE HUMAN BRAIN](){: .materialboxed .responsive-img }


text:
import rpt from "read-package-tree";

export default function (pathToRoot, filter = (node, kidName) => kidName) {
    return new Promise((resolve, reject) => {
        rpt(pathToRoot, filter, (err, data) => {
            if (err) {
                reject(err);
            } else {
                resolve(data);
            }
        });
    });
}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="JSHintConfiguration" version="2.1.0" use-config-file="false">
    <option bitwise="true" />
    <option curly="true" />
    <option eqeqeq="true" />
    <option forin="true" />
    <option noarg="true" />
    <option noempty="true" />
    <option nonew="true" />
    <option undef="true" />
    <option strict="true" />
    <option browser="true" />
    <option maxerr="50" />
  </component>
  <component name="JSLintConfiguration">
    <option indent="4" />
    <option maxerr="50" />
  </component>
  <component name="ProjectInspectionProfilesVisibleTreeState">
    <entry key="Project Default">
      <profile-state>
        <expanded-state>
          <State>
            <id />
          </State>
          <State>
            <id>Assignment issuesJavaScript</id>
          </State>
          <State>
            <id>CSS</id>
          </State>
          <State>
            <id>Code style issuesCSS</id>
          </State>
          <State>
            <id>Code style issuesJavaScript</id>
          </State>
          <State>
            <id>CoffeeScript</id>
          </State>
          <State>
            <id>Control flow issuesJavaScript</id>
          </State>
          <State>
            <id>Cucumber</id>
          </State>
          <State>
            <id>Data flow issuesJavaScript</id>
          </State>
          <State>
            <id>Error handlingJavaScript</id>
          </State>
          <State>
            <id>Gems</id>
          </State>
          <State>
            <id>General</id>
          </State>
          <State>
            <id>GeneralCoffeeScript</id>
          </State>
          <State>
            <id>GeneralJavaScript</id>
          </State>
          <State>
            <id>HTML</id>
          </State>
          <State>
            <id>Invalid elementsCSS</id>
          </State>
          <State>
            <id>JavaScript</id>
          </State>
          <State>
            <id>JavaScript function metricsJavaScript</id>
          </State>
          <State>
            <id>JavaScript validity issuesJavaScript</id>
          </State>
          <State>
            <id>LESS</id>
          </State>
          <State>
            <id>Potentially confusing code constructsJavaScript</id>
          </State>
          <State>
            <id>Probable bugsCoffeeScript</id>
          </State>
          <State>
            <id>Probable bugsJavaScript</id>
          </State>
          <State>
            <id>RELAX NG</id>
          </State>
          <State>
            <id>Rails</id>
          </State>
          <State>
            <id>Ruby</id>
          </State>
          <State>
            <id>SASS/SCSS</id>
          </State>
          <State>
            <id>SQL</id>
          </State>
          <State>
            <id>XML</id>
          </State>
        </expanded-state>
        <selected-state>
          <State>
            <id>CoffeeScript</id>
          </State>
        </selected-state>
      </profile-state>
    </entry>
  </component>
  <component name="ProjectRootManager" version="2" project-jdk-name="ruby-1.9.3-p429" project-jdk-type="RUBY_SDK" />
  <component name="masterDetails">
    <states>
      <state key="ScopeChooserConfigurable.UI">
        <settings>
          <splitter-proportions>
            <option name="proportions">
              <list>
                <option value="0.2" />
              </list>
            </option>
          </splitter-proportions>
        </settings>
      </state>
    </states>
  </component>
</project>


text:
static NSString *const kMessage         = @"message";
// 推送标题
static NSString *const kTitle           = @"kTitle";
// 查看详情
static NSString *const kGoSee           = @"go";

// push处理方式
typedef enum {
    ePushDoNothing,                         ///< 接受但不做处理
    ePushSetDefault,                        ///< 设置NSUserDefault
    ePushOpenAppStore,                      ///< 打开推广App信息页
    ePushOpenDetailViewWithAlert,           ///< 打开相应界面,应用在前台,先弹窗
    ePushOpenDetailView,                    ///< 打开相应界面,应用在前台,状态栏显示消息
    ePushExecuteFunction                    ///< 执行特定方法
} PushHandleType;

@interface PushHandleModel : NSObject

@property (nonatomic, assign) PushHandleType handleType;            ///< 推送的类型
@property (nonatomic, strong) NSString *notificationName;           ///< 推送携带的Id,可能是任何Id,如服务Id
@property (nonatomic, strong) NSString *displayVC;                  ///< 推送需要显示的VC
@property (nonatomic, assign) BOOL usePresent;                      ///< 是否使用present的方式弹出
@property (nonatomic, assign) BOOL showInRoot;                      ///<  是否需要在根目录上弹出

@property (nonatomic, strong) NSDictionary *pushData;               ///< 推送数据

@property (nonatomic, strong) UIViewController *topVC;              ///< 当前顶部的VC

@property (nonatomic, strong) NSString *handlerClass;               ///< 处理该推送的类
@property (nonatomic, strong) NSString *action;                     ///< 处理该推送的方法

- (id)initWithDictionary:(NSDictionary *)aDic;

@end


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<template type="basic" name="StdycpH1C13alphaALL" author="Agilent" investigator=""
        time_created="20120109T161942" tabname="BioSolidsPack" menu1="Calibration Studies" menu2="" apptype="solidseq1d"
        application="BioSolids" scans="StdycpH1C13alphaALL" seqfil="StdycpH1C13alphaALL">
  <protocol title="StdycpH1C13alphaALL" type="protocol">
    <action  type="LIB" status="Ready" lock="off" title="StdycpH1C13alphaALL" exp="StdycpH1C13alphaALL"
        time="21:00" macro="StdycpH1C13alphaALL" data="" />
  </protocol>
</template>


text:
#pragma once
#include <aws/ssm/SSM_EXPORTS.h>
#include <aws/ssm/SSMRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace SSM
{
namespace Model
{

  /**
   *
The request body of the GetServiceSetting API operation.

See
   * Also:
   AWS
   * API Reference

   */
  class AWS_SSM_API GetServiceSettingRequest : public SSMRequest
  {
  public:
    GetServiceSettingRequest();

    // Service request name is the Operation name which will send this request out,
    // each operation should has unique request name, so that we can get operation's name from this request.
    // Note: this is not true for response, multiple operations may have the same response name,
    // so we can not get operation's name from response.
    inline virtual const char* GetServiceRequestName() const override { return "GetServiceSetting"; }

    Aws::String SerializePayload() const override;

    Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;

    /**
     *
The ID of the service setting to get. The setting ID can be one of the
     * following.

     * /ssm/automation/customer-script-log-destination

     * /ssm/automation/customer-script-log-group-name

     * /ssm/documents/console/public-sharing-permission

     *
 /ssm/parameter-store/default-parameter-tier

     * /ssm/parameter-store/high-throughput-enabled

     * /ssm/managed-instance/activation-tier

     */
    inline const Aws::String& GetSettingId() const{ return m_settingId; }

    /**
     *
The ID of the service setting to get. The setting ID can be one of the
     * following.

     * /ssm/automation/customer-script-log-destination

     * /ssm/automation/customer-script-log-group-name

     * /ssm/documents/console/public-sharing-permission

     *
 /ssm/parameter-store/default-parameter-tier

     * /ssm/parameter-store/high-throughput-enabled

     * /ssm/managed-instance/activation-tier

     */
    inline bool SettingIdHasBeenSet() const { return m_settingIdHasBeenSet; }

    /**
     *
The ID of the service setting to get. The setting ID can be one of the
     * following.

     * /ssm/automation/customer-script-log-destination

     * /ssm/automation/customer-script-log-group-name

     * /ssm/documents/console/public-sharing-permission

     *
 /ssm/parameter-store/default-parameter-tier

     * /ssm/parameter-store/high-throughput-enabled

     * /ssm/managed-instance/activation-tier

     */
    inline void SetSettingId(const Aws::String& value) { m_settingIdHasBeenSet = true; m_settingId = value; }

    /**
     *
The ID of the service setting to get. The setting ID can be one of the
     * following.

     * /ssm/automation/customer-script-log-destination

     * /ssm/automation/customer-script-log-group-name

     * /ssm/documents/console/public-sharing-permission

     *
 /ssm/parameter-store/default-parameter-tier

     * /ssm/parameter-store/high-throughput-enabled

     * /ssm/managed-instance/activation-tier

     */
    inline void SetSettingId(Aws::String&& value) { m_settingIdHasBeenSet = true; m_settingId = std::move(value); }

    /**
     *
The ID of the service setting to get. The setting ID can be one of the
     * following.

     * /ssm/automation/customer-script-log-destination

     * /ssm/automation/customer-script-log-group-name

     * /ssm/documents/console/public-sharing-permission

     *
 /ssm/parameter-store/default-parameter-tier

     * /ssm/parameter-store/high-throughput-enabled

     * /ssm/managed-instance/activation-tier

     */
    inline void SetSettingId(const char* value) { m_settingIdHasBeenSet = true; m_settingId.assign(value); }

    /**
     *
The ID of the service setting to get. The setting ID can be one of the
     * following.

     * /ssm/automation/customer-script-log-destination

     * /ssm/automation/customer-script-log-group-name

     * /ssm/documents/console/public-sharing-permission

     *
 /ssm/parameter-store/default-parameter-tier

     * /ssm/parameter-store/high-throughput-enabled

     * /ssm/managed-instance/activation-tier

     */
    inline GetServiceSettingRequest& WithSettingId(const Aws::String& value) { SetSettingId(value); return *this;}

    /**
     *
The ID of the service setting to get. The setting ID can be one of the
     * following.

     * /ssm/automation/customer-script-log-destination

     * /ssm/automation/customer-script-log-group-name

     * /ssm/documents/console/public-sharing-permission

     *
 /ssm/parameter-store/default-parameter-tier

     * /ssm/parameter-store/high-throughput-enabled

     * /ssm/managed-instance/activation-tier

     */
    inline GetServiceSettingRequest& WithSettingId(Aws::String&& value) { SetSettingId(std::move(value)); return *this;}

    /**
     *
The ID of the service setting to get. The setting ID can be one of the
     * following.

     * /ssm/automation/customer-script-log-destination

     * /ssm/automation/customer-script-log-group-name

     * /ssm/documents/console/public-sharing-permission

     *
 /ssm/parameter-store/default-parameter-tier

     * /ssm/parameter-store/high-throughput-enabled

     * /ssm/managed-instance/activation-tier

     */
    inline GetServiceSettingRequest& WithSettingId(const char* value) { SetSettingId(value); return *this;}

  private:

    Aws::String m_settingId;
    bool m_settingIdHasBeenSet;
  };

} // namespace Model
} // namespace SSM
} // namespace Aws


text:
const int vul_reg_exp_nsubexp = 10;

//: Pattern matching with regular expressions.
//  A regular expression allows a programmer to specify complex
//  patterns that can be searched for and matched against the
//  character string of a string object. In its simplest form, a
//  regular expression is a sequence of characters used to search for
//  exact character matches. However, many times the exact sequence to
//  be found is not known, or only a match at the beginning or end of
//  a string is desired. This regular expression class implements
//  regular expression pattern matching as is found and implemented in
//  many UNIX commands and utilities.
//
//  Example: The perl code
// \code
//     $filename =~ m"([a-z]+)\.cc";
//     print $1;
// \endcode
//  is written as follows in C++
// \code
//     vul_reg_exp re("([a-z]+)\\.cc");
//     re.find(filename);
//     vcl_cout << re.match(1);
// \endcode
//
//  The regular expression class provides a convenient mechanism for
//  specifying and manipulating regular expressions. The regular
//  expression object allows specification of such patterns by using
//  the following regular expression metacharacters:
//
// -  ^        Matches at beginning of a line
// -  $        Matches at end of a line
// - .         Matches any single character
// - [ ]       Matches any character(s) inside the brackets
// - [^ ]      Matches any character(s) not inside the brackets
// - [ - ]     Matches any character in range on either side of a dash
// -  *        Matches preceding pattern zero or more times
// -  +        Matches preceding pattern one or more times
// -  ?        Matches preceding pattern at most once
// - ()        Saves a matched expression and uses it in a later match
//
//  Note that more than one of these metacharacters can be used in a
//  single regular expression in order to create complex search
//  patterns. For example, the pattern [^ab1-9] says to match any
//  character sequence that does not begin with the characters "a",
//  "b", or the characters "1" through "9".
//
class vul_reg_exp
{
  //: anchor point of start position for n-th matching regular expression
  const char* startp[vul_reg_exp_nsubexp];
  //: anchor point of end position for n-th matching regular expression
  const char* endp[vul_reg_exp_nsubexp];
  //: Internal use only
  char  regstart;
  //: Internal use only
  char  reganch;
  //: Internal use only
  const char* regmust;
  //: Internal use only
  int   regmlen;
  char* program;
  int   progsize;
  const char* searchstring;
 public:
  //: Creates an empty regular expression.
  inline vul_reg_exp() : program(0) { clear_bufs(); }
  //: Creates a regular expression from string s, and compiles s.
  inline vul_reg_exp(char const* s) : program(0) { clear_bufs(); compile(s); }
  //: Copy constructor
  vul_reg_exp(vul_reg_exp const&);
  //: Frees space allocated for regular expression.
  inline ~vul_reg_exp() { delete[] this->program; }
  //: Compiles char* --> regexp
  void compile(char const*);
  //: true if regexp in char* arg
  bool find(char const*);
  //: true if regexp in char* arg
  bool find(vcl_string const&);
  //: Returns the start index of the last item found.
  inline vcl_ptrdiff_t start() const { return this->startp[0] - searchstring; }
  //: Returns the end index of the last item found.
  inline vcl_ptrdiff_t end()   const { return this->endp[0] - searchstring; }
  //: Equality operator
  bool operator==(vul_reg_exp const&) const;
  //: Inequality operator
  inline bool operator!=(vul_reg_exp const& r) const { return !operator==(r); }
  //: Same regexp and state?
  bool deep_equal(vul_reg_exp const&) const;
  //: Returns true if a valid RE is compiled and ready for pattern matching.
  inline bool is_valid() const { return this->program != 0; }
  //: Invalidates regular expression.
  inline void set_invalid() { delete[] this->program; this->program = 0; clear_bufs(); }

  //: Return start index of nth submatch.
  // start(0) is the start of the full match.
  inline vcl_ptrdiff_t start(long n) const { return this->startp[n] - searchstring; }
  //: Return end index of nth submatch.
  // end(0) is the end of the full match.
  inline vcl_ptrdiff_t end(long n)   const { return this->endp[n] - searchstring; }
  //: Return nth submatch as a string.
  vcl_string match(int n) const {
    return this->endp[n] == this->startp[n] ? vcl_string("") :
           vcl_string(this->startp[n], this->endp[n] - this->startp[n]);
  }
  //: Return an expression that will match precisely c
  // The returned string is owned by the function, and
  // will be overwritten in subsequent calls.
  static const char * protect(char c);

 private:
  //: private function to clear startp[] and endp[]
  void clear_bufs() { for (int n=0; n<vul_reg_exp_nsubexp; ++n) startp[n]=endp[n]=0; }
};

#endif // vul_reg_exph


text:
<?php
class Kwf_Component_Cache_Box_IcRoot_Component extends Kwf_Component_NoCategoriesRoot
{
    public static function getSettings()
    {
        $ret = parent::getSettings();

        $ret['generators']['ic'] = array(
            'component' => 'Kwf_Component_Cache_Box_IcRoot_InheritContent_Component',
            'class' => 'Kwf_Component_Generator_Box_Static',
            'inherit' => true
        );

        $ret['generators']['page']['model'] = new Kwf_Model_FnF(array('data'=>array(
            array('id'=>1, 'pos'=>1, 'visible'=>true, 'name'=>'1', 'filename' => '1', 'custom_filename'=>false,
                'parent_id'=>'root', 'component'=>'empty', 'is_home'=>false, 'hide'=>false, 'parent_subroot_id' => 'root',
            ),
            array('id'=>2, 'pos'=>1, 'visible'=>true, 'name'=>'2', 'filename' => '2', 'custom_filename'=>false,
                'parent_id'=>1, 'component'=>'empty', 'is_home'=>false, 'hide'=>false, 'parent_subroot_id' => 'root'
            )

        )));
        $ret['generators']['page']['component'] = array(
            'empty' => 'Kwc_Basic_Empty_Component',
        );
        return $ret;
    }
}


text:
class ArticleCategoriesController < ApplicationController
  def show
    @article_category = ArticleCategory.where(id: params[:id]).first

    if @article_category.nil?
      # No flash because homepages are page cached
      return redirect_to(home_path)
    end

    top_level_article_category_id = @article_category.parent_id
    top_level_article_category_id = params[:id] if top_level_article_category_id == 0

    @article_categories = ArticleCategory.where(parent_id: top_level_article_category_id).order(:position)
  end
end


text:
package com.github.ipaas.ideploy.plugin.ui.popup;

import org.apache.tools.ant.util.StringUtils;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.RowData;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

import com.github.ipaas.ideploy.plugin.bean.PathInfo;
import com.github.ipaas.ideploy.plugin.bean.ProjectInfo;
import com.github.ipaas.ideploy.plugin.bean.UserInfo;
import com.github.ipaas.ideploy.plugin.core.Comparetor;
import com.github.ipaas.ideploy.plugin.core.UploadFileJob;
import com.github.ipaas.ideploy.plugin.ui.preference.CrsPreferencePage;
import com.github.ipaas.ideploy.plugin.util.ConfigUtil;
import com.github.ipaas.ideploy.plugin.util.ConsoleHandler;

public class CompareDialog extends Dialog {
	private ProjectInfo projectInfo;// 项目信息
	private Text outputPathText;// 代码保存路径
	private Text sourcePathText;// 源代码路径
	private Button generateBtn;// 执行按钮
	private Combo projecCombo;// 项目名下拉列表
	private String sourceLocation;
	private boolean loadProFlag = false;
	private String UPLOAD_TMP_FILE_PATH = "/tmp/zip";
	private boolean uploadBtnSelected = false;
	private Button outputBtn;

	public CompareDialog(Shell parentShell, String sourceLocation) {
		super(parentShell);
		this.sourceLocation = sourceLocation;

	}

	@Override
	protected Control createDialogArea(Composite parent) {
		ConsoleHandler.cleanConsole();

		ModifyListener pathInfoListener = new ModifyListener() {
			@Override
			public void modifyText(ModifyEvent arg0) {
				boolean sourceFlag = false;
				boolean proFlag = false;

				if (sourcePathText.getText() != null && !sourcePathText.getText().equals("")) {
					sourceFlag = true;
					sourcePathText.setToolTipText(null);
				} else {
					sourcePathText.setToolTipText("此文件目录不存在!");
				}
				if (projecCombo.getText() != null && !projecCombo.getText().equals("")
						&& !projecCombo.getText().equals("请选择服务组")) {
					proFlag = true;
					sourcePathText.setToolTipText(null);
				} else {
					projecCombo.setToolTipText("请选择服务组");
				}
				if (generateBtn != null) {
					generateBtn.setEnabled(sourceFlag && proFlag);
				}
			}
		};

		getShell().setText("CRS代码发布工具");
		getShell().setMinimumSize(550, 225);
		getShell().setDragDetect(true);
		Composite container = (Composite) super.createDialogArea(parent);

		RowLayout layout = new RowLayout();

		layout.marginTop = 30;
		layout.spacing = 20;// 组件之间间隔
		container.setLayout(layout);

		// 常用的布局
		final RowData lableLayout = new RowData(100, 20);
		final RowData pathLayout = new RowData(230, 20);

		this.addHideCompent(container, 20, null);

		Label srcPathLabel = new Label(container, SWT.NONE);
		srcPathLabel.setLayoutData(lableLayout);
		srcPathLabel.setText("Source directory:");
		sourcePathText = new Text(container, SWT.BORDER);// 保存路径
		sourcePathText.setLayoutData(pathLayout);
		sourcePathText.addModifyListener(pathInfoListener);

		Button srcBtn = new Button(container, SWT.NONE);
		srcBtn.setText("browse");
		srcBtn.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				DirectoryDialog dlg = new DirectoryDialog(getParentShell(), SWT.NONE);
				String srcPath = dlg.open();
				sourcePathText.setText(srcPath);
			}
		});

		this.addHideCompent(container, 20, null);

		this.addHideCompent(container, 20, null);

		Label serverGroupLabel = new Label(container, SWT.NONE);
		serverGroupLabel.setLayoutData(lableLayout);
		serverGroupLabel.setText("Server Group:");
		// 项目下拉列表
		projecCombo = new Combo(container, SWT.NONE);
		projecCombo.setLayoutData(new RowData(220, 20));
		projecCombo.addModifyListener(pathInfoListener);
		projecCombo.addMouseListener(new MouseListener() {
			@Override
			public void mouseUp(MouseEvent arg0) {
			}

			@Override
			public void mouseDown(MouseEvent arg0) {
				// System.out.println(projectInfo.getProjectList());
				if (!loadProFlag && projectInfo != null) {
					for (String name : projectInfo.getProjectList()) {
						projecCombo.add(name);
					}
				}
				loadProFlag = true;
			}

			@Override
			public void mouseDoubleClick(MouseEvent arg0) {
			}
		});
		Job job = new Job("get group...") {// 异步获取服务组
			@Override
			protected IStatus run(IProgressMonitor arg0) {
				try {
					projectInfo = ConfigUtil.getProjectInfo();
				} catch (Exception e) {
					// projecCombo.setToolTipText(e.getMessage());
					ConsoleHandler.error(e.getMessage());
				}
				return Status.OK_STATUS;
			}
		};
		job.schedule();

		this.addHideCompent(container, 100, null);
		this.addHideCompent(container, 20, null);
		final Button uploadRadio = new Button(container, SWT.RADIO);
		uploadRadio.setText("Upload");
		this.addHideCompent(container, 100, null);

		final Button exportRadio = new Button(container, SWT.RADIO);
		exportRadio.setText("Export");

		this.addHideCompent(container, 200, null);

		this.addHideCompent(container, 20, null);
		Label savePathLable = new Label(container, SWT.NONE);
		savePathLable.setLayoutData(lableLayout);
		savePathLable.setText("Output directory:");
		outputPathText = new Text(container, SWT.BORDER);// 输出路径
		outputPathText.setLayoutData(pathLayout);
		outputPathText.addModifyListener(pathInfoListener);
		outputBtn = new Button(container, SWT.NONE);
		outputBtn.setText("browse");
		outputBtn.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				DirectoryDialog dlg = new DirectoryDialog(getParentShell(), SWT.NONE);
				String savePath = dlg.open();
				outputPathText.setText(savePath);
			}
		});

		this.addHideCompent(container, 550, 10);
		outputPathText.setText(ConfigUtil.getSavePath());
		sourcePathText.setText(this.sourceLocation);
		PathInfo preInfo = ConfigUtil.getPathInfo(this.sourceLocation);
		// if (preInfo != null && preInfo.getGroupId() != null) {
		// projecCombo.setText(preInfo.getGroupId());
		// } else {
		projecCombo.setText("请选择服务组");
		// }

		uploadRadio.addSelectionListener(new SelectionListener() {

			@Override
			public void widgetSelected(SelectionEvent arg0) {
				uploadBtnSelected = uploadRadio.getSelection();
				this.renderView(uploadBtnSelected);
			}

			@Override
			public void widgetDefaultSelected(SelectionEvent arg0) {
				uploadBtnSelected = uploadRadio.getSelection();
				this.renderView(uploadBtnSelected);
			}

			private void renderView(boolean isSelected) {
				if (isSelected) {
					getShell().setSize(550, 225);
				} else {
					getShell().setSize(550, 280);
				}
				outputPathText.setEnabled(!isSelected);
				outputBtn.setEnabled(!isSelected);
			}
		});
		return container;
	}

	@Override
	protected void createButtonsForButtonBar(Composite parent) {
		generateBtn = createButton(parent, IDialogConstants.OK_ID, "OK", true);
		createButton(parent, IDialogConstants.CANCEL_ID, "Cancel", false);
		if (projecCombo.getText() == null || projecCombo.getText().equals("请选择服务组") || projecCombo.getText().equals("")) {
			generateBtn.setEnabled(false);
		}
	}

	private Label addHideCompent(Composite container, Integer width, Integer height) {
		if (width == null)
			width = 60;
		if (height == null)
			height = 20;
		RowData rowData = new RowData(width, height);
		Label lable = new Label(container, SWT.NONE);
		lable.setLayoutData(rowData);
		return lable;
	}

	@Override
	protected Point getInitialSize() {
		return new Point(450, 225);
	}

	@Override
	protected void cancelPressed() {
		this.close();
	}

	@Override
	protected void okPressed() {
		String sourcePath = sourcePathText.getText();
		if (sourcePath.endsWith("/")) {
			sourcePath = StringUtils.removeSuffix(sourcePathText.getText(), "/");
		}
		if (uploadBtnSelected) {// 上传代码
			final PathInfo pathInfo = new PathInfo();
			pathInfo.setSavePath(UPLOAD_TMP_FILE_PATH);
			pathInfo.setSrcPath(sourcePath);
			pathInfo.setTargetPath(sourcePath);
			pathInfo.setGroupId(projecCombo.getText());
			ConfigUtil.savePathInfo(pathInfo.getSrcPath(), pathInfo);
			ConfigUtil.saveOutputPath(outputPathText.getText());
			this.close();
			ConsoleHandler.info("开始代码上传....");
			Job job = new UploadFileJob("crs uploading file ...", pathInfo, projectInfo, null);
			job.schedule();
		} else {// 生成代码包
			final PathInfo pathInfo = new PathInfo();
			pathInfo.setSavePath(outputPathText.getText());
			pathInfo.setSrcPath(sourcePath);
			pathInfo.setTargetPath(sourcePath);
			pathInfo.setGroupId(projecCombo.getText());
			ConfigUtil.savePathInfo(pathInfo.getSrcPath(), pathInfo);
			ConfigUtil.saveOutputPath(outputPathText.getText());
			this.close();
			super.okPressed();
			Job job = new Job("crs comparing...") {
				@Override
				protected IStatus run(IProgressMonitor arg0) {
					UserInfo userInfo = CrsPreferencePage.getUserInfo();
					Comparetor.doAtion(pathInfo, userInfo);
					return Status.OK_STATUS;
				}
			};
			job.schedule();
		}

	}
}


text:
User Profile

                            Welcome to your user profile of your account. Here you can view and edit your registered details..

                                        <?php
                                          //    CHceking if there is a success variable passed from the previous page. That means that it was sent after user details update
                                          if (isset($_GET["status"])) {
                                            if ($_GET["status"] == "success") {
                                                echo '

                                                            ×

                                                            Thanks. Your details were updated Successfully!

';
                                            } else if ($_GET["status"]== "fail") {
                                                echo '

                                                            ×

                                                            Sorry. Your update was Unsuccessfully!. Please retry or contact admin.

';
                                            }
                                          }
                                        ?>

Personal Info

                                        <form class="form-horizontal" role="form" method="post" action="user-profile-update.php">

                                            First name:

                                              <input name="first_name" class="form-control" type="text" value="<?php echo $arr_Details['firstname']; ?>">

                                            Last name:

                                              <input name="last_name" class="form-control" type="text" value="<?php echo $arr_Details["lastname"]; ?>">

                                            Phone:

                                              <input name="phone" class="form-control" type="text" value="<?php echo $arr_Details["phone"]; ?>">

                                            Email:

                                              <input name="email" class="form-control" type="text" value="<?php echo $arr_Details["email"]; ?>">

                                            Date of Account Creation:

                                              <input name="created" class="form-control" type="text" value="<?php echo $arr_Details["created"]; ?>" disabled>

                                            Username:

                                              <input name="username" class="form-control" type="text" value="<?php echo $arr_Details["username"]; ?>" disabled>

                                            Password:

                                              <input id="password" name="password" class="form-control" type="password">

                                            Confirm password:

                                              <input id="confirm_password" name="confirm_password" class="form-control" type="password">

                                              <input type="submit" class="btn btn-primary" value="Save Changes">

                                              <input type="reset" class="btn btn-default" value="Cancel">

                                        </form>


text:
using System;
namespace QuotesInStrings
{
    class Program
    {
        static void Main()
        {
            string a = @"The ""use"" of quotations causes difficulties.";
            string l = "The \"use\" of quotations causes difficulties.";

            Console.WriteLine(a + "     " + l);

        }
    }
}


text:
<!doctype html>

    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Pushing, Publishing, and Viewing a Database — Google Earth Enterprise 5.3.7 documentation</title>
    <link rel="stylesheet" href="../../static/bizstyle.css" type="text/css" />
    <link rel="stylesheet" href="../../static/pygments.css" type="text/css" />

    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="Configuring Display Rules for Point Data" href="displayRulesPoint.html" />
    <link rel="prev" title="Defining and Building Databases" href="buildDatabase.html" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0">

Navigation

          index

          next |

          previous |

Google Earth Enterprise 5.3.7 documentation »

Fusion Tutorial »

Previous topic

Defining and Building Databases

Next topic

Configuring Display Rules for Point Data

Quick search

    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

Pushing, Publishing, and Viewing a Database¶

Pushing a database is the process of making a Google Earth
Enterprise Fusion database available on a Google Earth Enterprise
Server so that it can then be published for viewing with Google
Earth EC.

The push operation copies all the necessary files associated
with a given 2D/3D Fusion database version to Google Earth
Enterprise Server and registers the database. Pushing is performed
from Fusion.

The publish operation makes a previously pushed database
available for serving at a specified publish point. Publishing is
performed on Google Earth Enterprise Server.

Note

This lesson assumes that Google Earth Enterprise
Fusion, the Google Earth Enterprise Server, and Google Earth EC
are all installed on your local workstation. If any of these
applications are installed elsewhere on your network, adjust
the instructions in this lesson accordingly.

Note

This lesson describes the steps for pushing a 3D
Fusion database. The same workflow is used to push a 2D
Mercator database, but note that snippet profiles do not apply
and that the published map can be viewed in a web browser, not
Google Earth EC. See Creating a Map Database for more information.

Push Your Database

Publish Your Database

View Your Database

Push Your Database to Google Earth Enterprise Server

After you define and build your database, you "push" your database
to Google Earth Enterprise Server. Pushed databases appear on the
Databases page of the Google Earth Enterprise Server Admin
console, from which you can then publish them.

To push a database:

Select Asset Manager from the Tools menu. The Asset Manager
appears.

Navigate to the SFHighways database you built in Defining and Building Databases.

Right-click the name of the database, and select Push from
the context menu.

The Push Database dialog appears. The default server
association is the only option on the Server Associations
drop-down list. The most recent version of the selected
database is the default selection on the Version drop-down
list.

Click the Push button. Google Earth Enterprise Fusion pushes the
database to Google Earth Enterprise Server, and displays a
success message when it is done.

Note

If you get an error message, contact your Google
Earth Enterprise Server administrator for help, or check the
documentation on Before you Configure Google Earth Enterprise Fusion for more
information.

Publish Your Database in Google Earth Enterprise
Server

After you push your database to Google Earth Enterprise Server,
you can publish it for viewing with Google Earth EC.

To publish a database:

Access the Google Earth Enterprise Server Admin console in a
browser window by going to myserver.mydomainname.com/admin,
replacing myserver and mydomainname with your server and
domain.

Sign in with the default credentials or the username and
password assigned to you:

Default username: geapacheuser

Default password:geeadmin

Note

If you do not know your username and password,
contact your Google Earth Enterprise Server System
Administrator.

Click Databases to display the list of databases pushed to
the Server.

SFHighways-v001 is listed. The Description, Type, Date, and
Size of the database are also noted.

Check the box next to SFHighways-v001. The Publish button
on the Databases page appears.

Click Publish. The Publish dialog appears.

Change the default Publish point from SFHighways-v001 to
BayAreaHighways.

Note

You can publish a database to multiple publish
points, useful when you want to apply different search
tabs, snippet profiles, and virtual host settings for
different viewing needs.

Note

When publishing a database, the publish point you
specify is case-insensitive. Upper and lower case are not
differentiated. Make sure each publish point path name you
specify is unique.

To learn more about the options available in the Publish
dialog, see

Default database

Search Tabs

Snippet profiles

WMS

Click the Publish  button. The Databases page updates to indicate the
published status of your database.

View Your Database

After you publish your database, you can view it in Google Earth
EC. Google Earth EC can be downloaded from
here.

To view your database:

Launch Google Earth EC.

The Login dialog appears.

Specify the Publish point by entering or selecting the URL or
IP address of your server and database in the Server field. For
this tutorial, the Publish point is
myserver.mydomainname.com/BayAreaHighways, where myserver
and mydomainname are specific to your server. An example URL
would be http://myhostname/BayAreaHighways.

Click the Sign In button.

Double-click CAHighways to zoom in to your road data.

This concludes the basic lessons in this tutorial. If you want to
continue with the advanced lessons,
you can work through them in any order you like. Alternatively,
you can start working with real data now and come back and work
through the advanced lessons as you need them.

Navigation

          index

          next |

          previous |

Google Earth Enterprise 5.3.7 documentation »

Fusion Tutorial »

        © Copyright 2020, Open GEE Contributors.
      Created using Sphinx 1.7.5.


text:
close all; clear all; clc;
%%
rng(222);               % Control random number generation to ensure the
                        % noise can be reproduced exactly.
noiseA = randn(1, 5);
%%
% rng(223);
noiseB = randn(1, 5);
%%
disp(noiseA - noiseB);


text:
package com.google.rolecall.repos;

import java.util.Optional;

import com.google.rolecall.models.PerformanceSection;
import com.google.rolecall.models.Section;

import org.springframework.data.repository.CrudRepository;

public interface PerformanceSectionRepository extends CrudRepository<PerformanceSection, Integer> {

  public Optional<PerformanceSection> findFirstBySection(Section section);
}


text:
<?php
// .-----------------------------------------------------------------------------------
// | WE TRY THE BEST WAY
// |-----------------------------------------------------------------------------------
// | Author: 贝贝 <hebiduhebi@163.com>
// | Copyright (c) 2013-2015, http://www.gooraye.net. All Rights Reserved.
// |-----------------------------------------------------------------------------------
namespace Admin\Controller;

class AdminAppController extends AdminController{

	public function index(){
		$map = null;

		$page = array('curpage'=>I('get.p'),C('LIST_ROWS'));

		$result = apiCall("AdminApp/query", array($map,$page));
		if($result['status']){
			$this->assign("list",$result['info']['list']);
			$this->assign("show",$result['info']['show']);
			$this->display();
		}
	}

}


text:
package org.apache.geronimo.connector;

import org.apache.geronimo.connector.work.GeronimoWorkManager;

import javax.resource.ResourceException;
import javax.resource.spi.ActivationSpec;
import javax.resource.spi.BootstrapContext;
import javax.resource.spi.ResourceAdapter;
import javax.resource.spi.ResourceAdapterAssociation;
import javax.resource.spi.ResourceAdapterInternalException;
import javax.resource.spi.endpoint.MessageEndpointFactory;
import javax.transaction.xa.XAResource;

/**
 * Dynamic GBean wrapper around a ResourceAdapter object, exposing the config-properties as
 * GBean attributes.
 *
 * @version $Rev$ $Date$
 */
public class ResourceAdapterWrapper implements ResourceAdapter {

    private final String resourceAdapterClass;

    private final BootstrapContext bootstrapContext;

    protected final ResourceAdapter resourceAdapter;

    /**
     *  default constructor for enhancement proxy endpoint
     */
    public ResourceAdapterWrapper() {
        this.resourceAdapterClass = null;
        this.bootstrapContext = null;
        this.resourceAdapter = null;
    }

    public ResourceAdapterWrapper(final String resourceAdapterClass,
                                  final GeronimoWorkManager workManager,
                                  ClassLoader cl) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
        this.resourceAdapterClass = resourceAdapterClass;
        this.bootstrapContext = new BootstrapContextImpl(workManager);
        Class clazz = cl.loadClass(resourceAdapterClass);
        resourceAdapter = (ResourceAdapter) clazz.newInstance();
    }

    public ResourceAdapterWrapper(ResourceAdapter resourceAdapter, final GeronimoWorkManager workManager) {
        this.resourceAdapterClass = resourceAdapter.getClass().getName();
        this.bootstrapContext = new BootstrapContextImpl(workManager);
        this.resourceAdapter = resourceAdapter;
    }

    public String getResourceAdapterClass() {
        return resourceAdapterClass;
    }

    public void registerResourceAdapterAssociation(final ResourceAdapterAssociation resourceAdapterAssociation) throws ResourceException {
        resourceAdapterAssociation.setResourceAdapter(resourceAdapter);
    }

    public void start(BootstrapContext ctx) throws ResourceAdapterInternalException {
        throw new IllegalStateException("Don't call this");
    }

    public void stop() {
        throw new IllegalStateException("Don't call this");
    }

    //endpoint handling
    public void endpointActivation(final MessageEndpointFactory messageEndpointFactory, final ActivationSpec activationSpec) throws ResourceException {
        resourceAdapter.endpointActivation(messageEndpointFactory, activationSpec);
    }

    public void endpointDeactivation(final MessageEndpointFactory messageEndpointFactory, final ActivationSpec activationSpec) {
        resourceAdapter.endpointDeactivation(messageEndpointFactory, activationSpec);
    }

    public XAResource[] getXAResources(ActivationSpec[] specs) throws ResourceException {
        return resourceAdapter.getXAResources(specs);
    }

    public void doStart() throws Exception {
        resourceAdapter.start(bootstrapContext);
    }

    public void doStop() {
        resourceAdapter.stop();
    }

    public void doFail() {
        resourceAdapter.stop();
    }

}


text:
/**
 *
 */
package dao.impl;

import junit.framework.Assert;
import main.Config;

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

import pojo.domain.Area;
import pojo.domain.DriverIdentifier;
import pojo.domain.Equipment;
import pojo.domain.Home;
import pojo.domain.Room;
import dao.DAO;
import dao.factory.DAOFactory;
import dao.impl.serialization.EquipmentSerializationDAO;
import dao.impl.serialization.HomeSerializationDAO;
import dao.source.SerializationSource;

/**
 * Réalisée le 29 sept. 2012 Test unitaire de la DAO pour l'objet Home
 *
 * @author Florent
 */
public class EquipmentSerializationDaoTest {

	private DAO<Equipment> daoEquipment = null;
	private Home home = null;

	@Before
	public void initConfigForTest() {
		System.out.println(" ----- Config initialization for next test -----");
		Config.getProps().setProperty("source.serialization.file", "dbTest.serial");
		daoEquipment = DAOFactory.getFactory().getEquipmentDAO();
		((SerializationSource) daoEquipment.getDaoSrc()).initializeSource();

		Home obj = new Home(1, "Maison principale");
		Area area_niv0 = new Area("Niv0", obj);
		new Room("LacuisinecestSmith", area_niv0);
		home = obj;
		DAO<Home> daoHome = DAOFactory.getFactory().getHomeDAO();
		((HomeSerializationDAO) daoHome).getDaoSrc().initializeSource();
		daoHome.create(home);
	}

	@Test
	public void testDaoInit() {
		Assert.assertTrue(daoEquipment.getDaoSrc().isInitialized());

		EquipmentSerializationDAO daoCast = (EquipmentSerializationDAO) daoEquipment;
		Assert.assertTrue(daoCast.getDaoSrc().getData() != null);
		Assert.assertTrue(daoCast.findAll().size() == 0);
	}

	@Test
	public void testCreateEquipment() {
		String propert = "id=LAMPE1";
		Equipment light1 = null;
		try {
			DriverIdentifier drivId = new DriverIdentifier("uc.equipment.SimulatedLightDriver", "LightDriver.jar");
			light1 = new Equipment(home.getAreas().get(0).getRooms().get(0), "lampe1", drivId, propert);
			Assert.assertTrue(daoEquipment.create(light1));
		} catch (Exception e) {
			e.printStackTrace();
			Assert.fail();
		}
		EquipmentSerializationDAO daoCast = (EquipmentSerializationDAO) daoEquipment;
		Assert.assertTrue(daoCast.findAll().size() == 1);
		Assert.assertTrue(daoCast.findAll().contains(light1));
	}
}


text:
/* $Id: USBProxyServiceOs2.cpp $ */
/** @file
 * VirtualBox USB Proxy Service, OS/2 Specialization.
 */

/*
 * Copyright (C) 2005-2012 Oracle Corporation
 *
 * This file is part of VirtualBox Open Source Edition (OSE), as
 * available from http://www.virtualbox.org. This file is free software;
 * you can redistribute it and/or modify it under the terms of the GNU
 * General Public License (GPL) as published by the Free Software
 * Foundation, in version 2 as it comes in the "COPYING" file of the
 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 */

/*******************************************************************************
*   Header Files                                                               *
*******************************************************************************/
#define INCL_BASE
#define INCL_ERRORS
#include "USBProxyService.h"
#include "Logging.h"

#include <VBox/usb.h>
#include <VBox/err.h>

#include <iprt/string.h>
#include <iprt/alloc.h>
#include <iprt/assert.h>
#include <iprt/file.h>
#include <iprt/err.h>

/**
 * Initialize data members.
 */
USBProxyServiceOs2::USBProxyServiceOs2(Host *aHost)
    : USBProxyService(aHost), mhev(NULLHANDLE), mhmod(NULLHANDLE),
    mpfnUsbRegisterChangeNotification(NULL), mpfnUsbDeregisterNotification(NULL),
    mpfnUsbQueryNumberDevices(NULL), mpfnUsbQueryDeviceReport(NULL)
{
    LogFlowThisFunc(("aHost=%p\n", aHost));

    /*
     * Try initialize the usbcalls stuff.
     */
    int rc = DosCreateEventSem(NULL, &mhev, 0, FALSE);
    rc = RTErrConvertFromOS2(rc);
    if (RT_SUCCESS(rc))
    {
        rc = DosLoadModule(NULL, 0, (PCSZ)"usbcalls", &mhmod);
        rc = RTErrConvertFromOS2(rc);
        if (RT_SUCCESS(rc))
        {
            if (    (rc = DosQueryProcAddr(mhmod, 0, (PCSZ)"UsbQueryNumberDevices",         (PPFN)&mpfnUsbQueryNumberDevices))          == NO_ERROR
                &&  (rc = DosQueryProcAddr(mhmod, 0, (PCSZ)"UsbQueryDeviceReport",          (PPFN)&mpfnUsbQueryDeviceReport))           == NO_ERROR
                &&  (rc = DosQueryProcAddr(mhmod, 0, (PCSZ)"UsbRegisterChangeNotification", (PPFN)&mpfnUsbRegisterChangeNotification))  == NO_ERROR
                &&  (rc = DosQueryProcAddr(mhmod, 0, (PCSZ)"UsbDeregisterNotification",     (PPFN)&mpfnUsbDeregisterNotification))      == NO_ERROR
               )
            {
                rc = mpfnUsbRegisterChangeNotification(&mNotifyId, mhev, mhev);
                if (!rc)
                {
                    /*
                     * Start the poller thread.
                     */
                    rc = start();
                    if (RT_SUCCESS(rc))
                    {
                        LogFlowThisFunc(("returns successfully - mNotifyId=%d\n", mNotifyId));
                        mLastError = VINF_SUCCESS;
                        return;
                    }
                }

                LogRel(("USBProxyServiceOs2: failed to register change notification, rc=%d\n", rc));
            }
            else
                LogRel(("USBProxyServiceOs2: failed to load usbcalls\n"));

            DosFreeModule(mhmod);
        }
        else
            LogRel(("USBProxyServiceOs2: failed to load usbcalls, rc=%d\n", rc));
        mhmod = NULLHANDLE;
    }
    else
        mhev = NULLHANDLE;

    mLastError = rc;
    LogFlowThisFunc(("returns failure!!! (rc=%Rrc)\n", rc));
}

/**
 * Stop all service threads and free the device chain.
 */
USBProxyServiceOs2::~USBProxyServiceOs2()
{
    LogFlowThisFunc(("\n"));

    /*
     * Stop the service.
     */
    if (isActive())
        stop();

    /*
     * Free resources.
     */
    if (mhmod)
    {
        if (mpfnUsbDeregisterNotification)
            mpfnUsbDeregisterNotification(mNotifyId);

        mpfnUsbRegisterChangeNotification = NULL;
        mpfnUsbDeregisterNotification = NULL;
        mpfnUsbQueryNumberDevices = NULL;
        mpfnUsbQueryDeviceReport = NULL;

        DosFreeModule(mhmod);
        mhmod = NULLHANDLE;
    }
}

int USBProxyServiceOs2::captureDevice(HostUSBDevice *aDevice)
{
    AssertReturn(aDevice, VERR_GENERAL_FAILURE);
    AssertReturn(!aDevice->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE);

    AutoReadLock devLock(aDevice COMMA_LOCKVAL_SRC_POS);
    LogFlowThisFunc(("aDevice=%s\n", aDevice->getName().c_str()));

    /*
     * Don't think we need to do anything when the device is held... fake it.
     */
    Assert(aDevice->isStatePending());
    devLock.release();
    interruptWait();

    return VINF_SUCCESS;
}

int USBProxyServiceOs2::releaseDevice(HostUSBDevice *aDevice)
{
    AssertReturn(aDevice, VERR_GENERAL_FAILURE);
    AssertReturn(!aDevice->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE);

    AutoReadLock devLock(aDevice COMMA_LOCKVAL_SRC_POS);
    LogFlowThisFunc(("aDevice=%s\n", aDevice->getName().c_str()));

    /*
     * We're not really holding it atm., just fake it.
     */
    Assert(aDevice->isStatePending());
    devLock.release();
    interruptWait();

    return VINF_SUCCESS;
}

bool USBProxyServiceOs2::updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters,
                                           SessionMachine **aIgnoreMachine)
{
    AssertReturn(aDevice, false);
    AssertReturn(!aDevice->isWriteLockOnCurrentThread(), false);
    return updateDeviceStateFake(aDevice, aUSBDevice, aRunFilters, aIgnoreMachine);
}

int USBProxyServiceOs2::wait(RTMSINTERVAL aMillies)
{
    int rc = DosWaitEventSem(mhev, aMillies);
    return RTErrConvertFromOS2(rc);
}

int USBProxyServiceOs2::interruptWait(void)
{
    int rc = DosPostEventSem(mhev);
    return rc == NO_ERROR || rc == ERROR_ALREADY_POSTED
         ? VINF_SUCCESS
         : RTErrConvertFromOS2(rc);
}

#include <stdio.h>

PUSBDEVICE USBProxyServiceOs2::getDevices(void)
{
    /*
     * Count the devices.
     */
    ULONG cDevices = 0;
    int rc = mpfnUsbQueryNumberDevices((PULONG)&cDevices); /* Thanks to com/xpcom, PULONG and ULONG * aren't the same. */
    if (rc)
        return NULL;

    /*
     * Retrieve information about each device.
     */
    PUSBDEVICE pFirst = NULL;
    PUSBDEVICE *ppNext = &pFirst;
    for (ULONG i = 0; i < cDevices; i++)
    {
        /*
         * Query the device and config descriptors.
         */
        uint8_t abBuf[1024];
        ULONG cb = sizeof(abBuf);
        rc = mpfnUsbQueryDeviceReport(i + 1, (PULONG)&cb, &abBuf[0]); /* see above (PULONG) */
        if (rc)
            continue;
        PUSBDEVICEDESC pDevDesc = (PUSBDEVICEDESC)&abBuf[0];
        if (    cb < sizeof(*pDevDesc)
            ||  pDevDesc->bDescriptorType != USB_DT_DEVICE
            ||  pDevDesc->bLength < sizeof(*pDevDesc)
            ||  pDevDesc->bLength > sizeof(*pDevDesc) * 2)
            continue;
        PUSBCONFIGDESC pCfgDesc = (PUSBCONFIGDESC)&abBuf[pDevDesc->bLength];
        if (    pCfgDesc->bDescriptorType != USB_DT_CONFIG
            ||  pCfgDesc->bLength >= sizeof(*pCfgDesc))
            pCfgDesc = NULL;

        /*
         * Skip it if it's some kind of hub.
         */
        if (pDevDesc->bDeviceClass == USB_HUB_CLASSCODE)
            continue;

        /*
         * Allocate a new device node and initialize it with the basic stuff.
         */
        PUSBDEVICE pCur = (PUSBDEVICE)RTMemAlloc(sizeof(*pCur));
        pCur->bcdUSB = pDevDesc->bcdUSB;
        pCur->bDeviceClass = pDevDesc->bDeviceClass;
        pCur->bDeviceSubClass = pDevDesc->bDeviceSubClass;
        pCur->bDeviceProtocol = pDevDesc->bDeviceProtocol;
        pCur->idVendor = pDevDesc->idVendor;
        pCur->idProduct = pDevDesc->idProduct;
        pCur->bcdDevice = pDevDesc->bcdDevice;
        pCur->pszManufacturer = RTStrDup("");
        pCur->pszProduct = RTStrDup("");
        pCur->pszSerialNumber = NULL;
        pCur->u64SerialHash = 0;
        //pCur->bNumConfigurations = pDevDesc->bNumConfigurations;
        pCur->bNumConfigurations = 0;
        pCur->paConfigurations = NULL;
        pCur->enmState = USBDEVICESTATE_USED_BY_HOST_CAPTURABLE;
        pCur->enmSpeed = USBDEVICESPEED_UNKNOWN;
        pCur->pszAddress = NULL;
        RTStrAPrintf((char **)&pCur->pszAddress, "p=0x%04RX16;v=0x%04RX16;r=0x%04RX16;e=0x%08RX32",
                     pDevDesc->idProduct, pDevDesc->idVendor, pDevDesc->bcdDevice, i);

        pCur->bBus = 0;
        pCur->bLevel = 0;
        pCur->bDevNum = 0;
        pCur->bDevNumParent = 0;
        pCur->bPort = 0;
        pCur->bNumDevices = 0;
        pCur->bMaxChildren = 0;

        /* link it */
        pCur->pNext = NULL;
        pCur->pPrev = *ppNext;
        *ppNext = pCur;
        ppNext = &pCur->pNext;
    }

    return pFirst;
}


text:
define(function (require, exports, module) {
    "use strict";

    var Tutorial     = require("lib/Tutorial");
    var _launcherInstance;

    function Launcher(options) {
        var _browser = options.browser;
        var _server = options.server;
        // Whether or not we're overriding the preview with a tutorial
        var _tutorialOverride;

        Object.defineProperty(this, "browser", {
            configurable: false,
            get: function () {
                return _browser;
            }
        });

        Object.defineProperty(this, "server", {
            configurable: false,
            get: function () {
                return _server;
            }
        });

        Object.defineProperty(this, "tutorialOverride", {
            configurable: false,
            get: function() {
                return _tutorialOverride;
            },
            set: function(val) {
                _tutorialOverride = val;
            }
        });

        _launcherInstance = this;
    }

    function _launch(url, callback) {
        var server = _launcherInstance.server;
        var browser = _launcherInstance.browser;

        callback = callback || function(){};

        server.serveLiveDocForUrl(url, function(err, urlOrHTML) {
            if(err) {
                console.error("[Launcher Error]", err);
                return callback();
            }
            browser.update(urlOrHTML);
            callback();
        });
    }

    Launcher.prototype.launch = function(url, callback) {
        if(!Tutorial.getOverride()) {
            return _launch(url, callback);
        }

        // Hijack the preview loading if we're meant to be showing the tutorial.
        Tutorial.exists(function(tutorialExists) {
            if(!tutorialExists) {
                console.error("[Launcher Error] expected tutorial.html to exist");
                // Reset the tutorial override, and fallback to normal loading. so we show something
                Tutorial.setOverride(false);
            } else {
                // Swap out the tutorial url and reload if necessary. We try hard
                // not to reload unless we have to, so the tutorial doesn't flicker.
                if(Tutorial.shouldReload()) {
                    _launch(Tutorial.getPath(), callback);
                }
            }
        });
    };

    Launcher.getCurrentInstance = function() {
        return _launcherInstance;
    };

    // Define public API
    module.exports = Launcher;
});


text:
package org.locationtech.geowave.core.store.query.filter.expression;

import java.util.Arrays;
import java.util.List;
import java.util.Set;
import org.locationtech.geowave.core.index.persist.Persistable;
import org.locationtech.geowave.core.index.persist.PersistenceUtils;
import org.locationtech.geowave.core.store.AdapterToIndexMapping;
import org.locationtech.geowave.core.store.api.DataTypeAdapter;
import org.locationtech.geowave.core.store.api.Index;

/**
 * An abstract filter that is composed of two or more other filters.
 */
public abstract class MultiFilterOperator implements Filter {

  private Filter[] children;

  public MultiFilterOperator(final Filter... children) {
    this.children = children;
  }

  public Filter[] getChildren() {
    return children;
  }

  @Override
  public void addReferencedFields(final Set<String> fields) {
    Arrays.stream(getChildren()).forEach(f -> f.addReferencedFields(fields));
  }

  @Override
  public void prepare(
      final DataTypeAdapter<?> adapter,
      final AdapterToIndexMapping indexMapping,
      final Index index) {
    Arrays.stream(children).forEach(f -> f.prepare(adapter, indexMapping, index));
  }

  @Override
  public byte[] toBinary() {
    return PersistenceUtils.toBinary(children);
  }

  @Override
  public void fromBinary(final byte[] bytes) {
    final List<Persistable> childrenList = PersistenceUtils.fromBinaryAsList(bytes);
    children = childrenList.toArray(new Filter[childrenList.size()]);
  }

}


text:
.class public final Lcom/android/internal/telephony/cdma/CdmaCall;
.super Lcom/android/internal/telephony/Call;
.source "CdmaCall.java"

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/android/internal/telephony/cdma/CdmaCall$1;
    }
.end annotation

# instance fields
.field connections:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lcom/android/internal/telephony/Connection;",
            ">;"
        }
    .end annotation
.end field

.field owner:Lcom/android/internal/telephony/cdma/CdmaCallTracker;

.field state:Lcom/android/internal/telephony/Call$State;

# direct methods
.method constructor <init>(Lcom/android/internal/telephony/cdma/CdmaCallTracker;)V
    .locals 1
    .parameter "owner"

    .prologue
    .line 57
    invoke-direct {p0}, Lcom/android/internal/telephony/Call;-><init>()V

    .line 35
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->connections:Ljava/util/ArrayList;

    .line 36
    sget-object v0, Lcom/android/internal/telephony/Call$State;->IDLE:Lcom/android/internal/telephony/Call$State;

    iput-object v0, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->state:Lcom/android/internal/telephony/Call$State;

    .line 58
    iput-object p1, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->owner:Lcom/android/internal/telephony/cdma/CdmaCallTracker;

    .line 59
    return-void
.end method

.method static stateFromDCState(Lcom/android/internal/telephony/DriverCall$State;)Lcom/android/internal/telephony/Call$State;
    .locals 3
    .parameter "dcState"

    .prologue
    .line 43
    sget-object v0, Lcom/android/internal/telephony/cdma/CdmaCall$1;->$SwitchMap$com$android$internal$telephony$DriverCall$State:[I

    invoke-virtual {p0}, Lcom/android/internal/telephony/DriverCall$State;->ordinal()I

    move-result v1

    aget v0, v0, v1

    packed-switch v0, :pswitch_data_0

    .line 50
    new-instance v0, Ljava/lang/RuntimeException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "illegal call state:"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 44
    :pswitch_0
    sget-object v0, Lcom/android/internal/telephony/Call$State;->ACTIVE:Lcom/android/internal/telephony/Call$State;

    .line 49
    :goto_0
    return-object v0

    .line 45
    :pswitch_1
    sget-object v0, Lcom/android/internal/telephony/Call$State;->HOLDING:Lcom/android/internal/telephony/Call$State;

    goto :goto_0

    .line 46
    :pswitch_2
    sget-object v0, Lcom/android/internal/telephony/Call$State;->DIALING:Lcom/android/internal/telephony/Call$State;

    goto :goto_0

    .line 47
    :pswitch_3
    sget-object v0, Lcom/android/internal/telephony/Call$State;->ALERTING:Lcom/android/internal/telephony/Call$State;

    goto :goto_0

    .line 48
    :pswitch_4
    sget-object v0, Lcom/android/internal/telephony/Call$State;->INCOMING:Lcom/android/internal/telephony/Call$State;

    goto :goto_0

    .line 49
    :pswitch_5
    sget-object v0, Lcom/android/internal/telephony/Call$State;->WAITING:Lcom/android/internal/telephony/Call$State;

    goto :goto_0

    .line 43
    :pswitch_data_0
    .packed-switch 0x1
        :pswitch_0
        :pswitch_1
        :pswitch_2
        :pswitch_3
        :pswitch_4
        :pswitch_5
    .end packed-switch
.end method

# virtual methods
.method attach(Lcom/android/internal/telephony/Connection;Lcom/android/internal/telephony/DriverCall;)V
    .locals 1
    .parameter "conn"
    .parameter "dc"

    .prologue
    .line 110
    iget-object v0, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->connections:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 112
    iget-object v0, p2, Lcom/android/internal/telephony/DriverCall;->state:Lcom/android/internal/telephony/DriverCall$State;

    invoke-static {v0}, Lcom/android/internal/telephony/cdma/CdmaCall;->stateFromDCState(Lcom/android/internal/telephony/DriverCall$State;)Lcom/android/internal/telephony/Call$State;

    move-result-object v0

    iput-object v0, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->state:Lcom/android/internal/telephony/Call$State;

    .line 113
    return-void
.end method

.method attachFake(Lcom/android/internal/telephony/Connection;Lcom/android/internal/telephony/Call$State;)V
    .locals 1
    .parameter "conn"
    .parameter "state"

    .prologue
    .line 117
    iget-object v0, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->connections:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 119
    iput-object p2, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->state:Lcom/android/internal/telephony/Call$State;

    .line 120
    return-void
.end method

.method clearDisconnected()V
    .locals 4

    .prologue
    .line 203
    iget-object v2, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->connections:Ljava/util/ArrayList;

    invoke-virtual {v2}, Ljava/util/ArrayList;->size()I

    move-result v2

    add-int/lit8 v1, v2, -0x1

    .local v1, i:I
    :goto_0
    if-ltz v1, :cond_1

    .line 204
    iget-object v2, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->connections:Ljava/util/ArrayList;

    invoke-virtual {v2, v1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/android/internal/telephony/cdma/CdmaConnection;

    .line 206
    .local v0, cn:Lcom/android/internal/telephony/cdma/CdmaConnection;
    invoke-virtual {v0}, Lcom/android/internal/telephony/cdma/CdmaConnection;->getState()Lcom/android/internal/telephony/Call$State;

    move-result-object v2

    sget-object v3, Lcom/android/internal/telephony/Call$State;->DISCONNECTED:Lcom/android/internal/telephony/Call$State;

    if-ne v2, v3, :cond_0

    .line 207
    iget-object v2, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->connections:Ljava/util/ArrayList;

    invoke-virtual {v2, v1}, Ljava/util/ArrayList;->remove(I)Ljava/lang/Object;

    .line 203
    :cond_0
    add-int/lit8 v1, v1, -0x1

    goto :goto_0

    .line 211
    .end local v0           #cn:Lcom/android/internal/telephony/cdma/CdmaConnection;
    :cond_1
    iget-object v2, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->connections:Ljava/util/ArrayList;

    invoke-virtual {v2}, Ljava/util/ArrayList;->size()I

    move-result v2

    if-nez v2, :cond_2

    .line 212
    sget-object v2, Lcom/android/internal/telephony/Call$State;->IDLE:Lcom/android/internal/telephony/Call$State;

    iput-object v2, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->state:Lcom/android/internal/telephony/Call$State;

    .line 214
    :cond_2
    return-void
.end method

.method connectionDisconnected(Lcom/android/internal/telephony/cdma/CdmaConnection;)V
    .locals 5
    .parameter "conn"

    .prologue
    .line 127
    iget-object v3, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->state:Lcom/android/internal/telephony/Call$State;

    sget-object v4, Lcom/android/internal/telephony/Call$State;->DISCONNECTED:Lcom/android/internal/telephony/Call$State;

    if-eq v3, v4, :cond_1

    .line 130
    const/4 v0, 0x1

    .line 132
    .local v0, hasOnlyDisconnectedConnections:Z
    const/4 v1, 0x0

    .local v1, i:I
    iget-object v3, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->connections:Ljava/util/ArrayList;

    invoke-virtual {v3}, Ljava/util/ArrayList;->size()I

    move-result v2

    .local v2, s:I
    :goto_0
    if-ge v1, v2, :cond_0

    .line 133
    iget-object v3, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->connections:Ljava/util/ArrayList;

    invoke-virtual {v3, v1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Lcom/android/internal/telephony/Connection;

    invoke-virtual {v3}, Lcom/android/internal/telephony/Connection;->getState()Lcom/android/internal/telephony/Call$State;

    move-result-object v3

    sget-object v4, Lcom/android/internal/telephony/Call$State;->DISCONNECTED:Lcom/android/internal/telephony/Call$State;

    if-eq v3, v4, :cond_2

    .line 136
    const/4 v0, 0x0

    .line 141
    :cond_0
    if-eqz v0, :cond_1

    .line 142
    sget-object v3, Lcom/android/internal/telephony/Call$State;->DISCONNECTED:Lcom/android/internal/telephony/Call$State;

    iput-object v3, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->state:Lcom/android/internal/telephony/Call$State;

    .line 145
    .end local v0           #hasOnlyDisconnectedConnections:Z
    .end local v1           #i:I
    .end local v2           #s:I
    :cond_1
    return-void

    .line 132
    .restart local v0       #hasOnlyDisconnectedConnections:Z
    .restart local v1       #i:I
    .restart local v2       #s:I
    :cond_2
    add-int/lit8 v1, v1, 0x1

    goto :goto_0
.end method

.method detach(Lcom/android/internal/telephony/cdma/CdmaConnection;)V
    .locals 1
    .parameter "conn"

    .prologue
    .line 150
    iget-object v0, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->connections:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->remove(Ljava/lang/Object;)Z

    .line 152
    iget-object v0, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->connections:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->size()I

    move-result v0

    if-nez v0, :cond_0

    .line 153
    sget-object v0, Lcom/android/internal/telephony/Call$State;->IDLE:Lcom/android/internal/telephony/Call$State;

    iput-object v0, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->state:Lcom/android/internal/telephony/Call$State;

    .line 155
    :cond_0
    return-void
.end method

.method public dispose()V
    .locals 0

    .prologue
    .line 62
    return-void
.end method

.method public fallbackHangupVTCall()V
    .locals 0
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/android/internal/telephony/CallStateException;
        }
    .end annotation

    .prologue
    .line 98
    return-void
.end method

.method public getConnections()Ljava/util/List;
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List",
            "<",
            "Lcom/android/internal/telephony/Connection;",
            ">;"
        }
    .end annotation

    .prologue
    .line 68
    iget-object v0, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->connections:Ljava/util/ArrayList;

    return-object v0
.end method

.method public getPhone()Lcom/android/internal/telephony/Phone;
    .locals 1

    .prologue
    .line 78
    iget-object v0, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->owner:Lcom/android/internal/telephony/cdma/CdmaCallTracker;

    iget-object v0, v0, Lcom/android/internal/telephony/cdma/CdmaCallTracker;->phone:Lcom/android/internal/telephony/cdma/CDMAPhone;

    return-object v0
.end method

.method public getState()Lcom/android/internal/telephony/Call$State;
    .locals 1

    .prologue
    .line 73
    iget-object v0, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->state:Lcom/android/internal/telephony/Call$State;

    return-object v0
.end method

.method public hangup()V
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/android/internal/telephony/CallStateException;
        }
    .end annotation

    .prologue
    .line 91
    iget-object v0, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->owner:Lcom/android/internal/telephony/cdma/CdmaCallTracker;

    invoke-virtual {v0, p0}, Lcom/android/internal/telephony/cdma/CdmaCallTracker;->hangup(Lcom/android/internal/telephony/cdma/CdmaCall;)V

    .line 92
    return-void
.end method

.method isFull()Z
    .locals 2

    .prologue
    const/4 v0, 0x1

    .line 178
    iget-object v1, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->connections:Ljava/util/ArrayList;

    invoke-virtual {v1}, Ljava/util/ArrayList;->size()I

    move-result v1

    if-ne v1, v0, :cond_0

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public isMultiparty()Z
    .locals 2

    .prologue
    const/4 v0, 0x1

    .line 82
    iget-object v1, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->connections:Ljava/util/ArrayList;

    invoke-virtual {v1}, Ljava/util/ArrayList;->size()I

    move-result v1

    if-le v1, v0, :cond_0

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public isVideoCall()Z
    .locals 1

    .prologue
    .line 218
    const/4 v0, 0x0

    return v0
.end method

.method onHangupLocal()V
    .locals 4

    .prologue
    .line 191
    const/4 v1, 0x0

    .local v1, i:I
    iget-object v3, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->connections:Ljava/util/ArrayList;

    invoke-virtual {v3}, Ljava/util/ArrayList;->size()I

    move-result v2

    .local v2, s:I
    :goto_0
    if-ge v1, v2, :cond_0

    .line 192
    iget-object v3, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->connections:Ljava/util/ArrayList;

    invoke-virtual {v3, v1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/android/internal/telephony/cdma/CdmaConnection;

    .line 194
    .local v0, cn:Lcom/android/internal/telephony/cdma/CdmaConnection;
    invoke-virtual {v0}, Lcom/android/internal/telephony/cdma/CdmaConnection;->onHangupLocal()V

    .line 191
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    .line 196
    .end local v0           #cn:Lcom/android/internal/telephony/cdma/CdmaConnection;
    :cond_0
    sget-object v3, Lcom/android/internal/telephony/Call$State;->DISCONNECTING:Lcom/android/internal/telephony/Call$State;

    iput-object v3, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->state:Lcom/android/internal/telephony/Call$State;

    .line 197
    return-void
.end method

.method public toString()Ljava/lang/String;
    .locals 1

    .prologue
    .line 103
    iget-object v0, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->state:Lcom/android/internal/telephony/Call$State;

    invoke-virtual {v0}, Lcom/android/internal/telephony/Call$State;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method update(Lcom/android/internal/telephony/cdma/CdmaConnection;Lcom/android/internal/telephony/DriverCall;)Z
    .locals 3
    .parameter "conn"
    .parameter "dc"

    .prologue
    .line 160
    const/4 v0, 0x0

    .line 162
    .local v0, changed:Z
    iget-object v2, p2, Lcom/android/internal/telephony/DriverCall;->state:Lcom/android/internal/telephony/DriverCall$State;

    invoke-static {v2}, Lcom/android/internal/telephony/cdma/CdmaCall;->stateFromDCState(Lcom/android/internal/telephony/DriverCall$State;)Lcom/android/internal/telephony/Call$State;

    move-result-object v1

    .line 164
    .local v1, newState:Lcom/android/internal/telephony/Call$State;
    iget-object v2, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->state:Lcom/android/internal/telephony/Call$State;

    if-eq v1, v2, :cond_0

    .line 165
    iput-object v1, p0, Lcom/android/internal/telephony/cdma/CdmaCall;->state:Lcom/android/internal/telephony/Call$State;

    .line 166
    const/4 v0, 0x1

    .line 169
    :cond_0
    return v0
.end method


text:
package org.robolectric.res;

import java.util.regex.Pattern;
import javax.annotation.Nonnull;

public class AttributeResource {
  public static final String ANDROID_NS = "http://schemas.android.com/apk/res/android";
  public static final String ANDROID_RES_NS_PREFIX = "http://schemas.android.com/apk/res/";
  public static final String RES_AUTO_NS_URI = "http://schemas.android.com/apk/res-auto";

  public static final String NULL_VALUE = "@null";
  public static final String EMPTY_VALUE = "@empty";
  public static final Pattern IS_RESOURCE_REFERENCE = Pattern.compile("^\\s*@");

  public final @Nonnull ResName resName;
  public final @Nonnull String value;
  public final @Nonnull String trimmedValue;
  public final @Nonnull String contextPackageName;
  private final Integer referenceResId;

  public AttributeResource(@Nonnull ResName resName, @Nonnull String value, @Nonnull String contextPackageName) {
    this(resName, value, contextPackageName, null);
  }

  public AttributeResource(@Nonnull ResName resName, @Nonnull String value, @Nonnull String contextPackageName, Integer referenceResId) {
    this.referenceResId = referenceResId;
    if (!resName.type.equals("attr")) throw new IllegalStateException("\"" + resName.getFullyQualifiedName() + "\" unexpected");

    this.resName = resName;
    this.value = value;
    this.trimmedValue = value.trim();
    this.contextPackageName = contextPackageName;
  }

  public boolean isResourceReference() {
    return isResourceReference(trimmedValue);
  }

  public @Nonnull ResName getResourceReference() {
    if (!isResourceReference()) throw new RuntimeException("not a resource reference: " + this);
    return ResName.qualifyResName(deref(trimmedValue).replace("+", ""), contextPackageName, "style");
  }

  public boolean isStyleReference() {
    return isStyleReference(trimmedValue);
  }

  public ResName getStyleReference() {
    if (!isStyleReference()) throw new RuntimeException("not a style reference: " + this);
    return ResName.qualifyResName(value.substring(1), contextPackageName, "attr");
  }

  public boolean isNull() {
    return NULL_VALUE.equals(trimmedValue);
  }

  public boolean isEmpty() {
    return EMPTY_VALUE.equals(trimmedValue);
  }

  @Override
  public String toString() {
    return "Attribute{" +
        "name='" + resName + '\'' +
        ", value='" + value + '\'' +
        ", contextPackageName='" + contextPackageName + '\'' +
        '}';
  }

  public static boolean isResourceReference(String value) {
    return IS_RESOURCE_REFERENCE.matcher(value).find() && !isNull(value);
  }

  public static @Nonnull ResName getResourceReference(String value, String defPackage, String defType) {
    if (!isResourceReference(value)) throw new IllegalArgumentException("not a resource reference: " + value);
    return ResName.qualifyResName(deref(value).replace("+", ""), defPackage, defType);
  }

  private static @Nonnull String deref(@Nonnull String value) {
    return value.substring(value.indexOf('@') + 1);
  }

  public static boolean isStyleReference(String value) {
    return value.startsWith("?");
  }

  public static ResName getStyleReference(String value, String defPackage, String defType) {
    if (!isStyleReference(value)) throw new IllegalArgumentException("not a style reference: " + value);
    return ResName.qualifyResName(value.substring(1), defPackage, defType);
  }

  public static boolean isNull(String value) {
    return NULL_VALUE.equals(value);
  }

  public static boolean isEmpty(String value) {
    return EMPTY_VALUE.equals(value);
  }

  public Integer getReferenceResId() {
    return referenceResId;
  }
}


text:
package hydrograph.ui.graph.job;
/**
 * Provides constants to build gradle command
 *
 * @author Bitwise
 *
 */
public class GradleCommandConstants {

	public static final String GCMD_SCP_JAR="gradle scpJarFiles ";
	public static final String GCMD_SCP_PARM_FILE="gradle scpParameterFile ";
	public static final String GCMD_SCP_JOB_XML="gradle scpJobXML ";
	public static final String GCMD_SCP_DEBUG_JOB_XML="gradle scpDebugJobXML ";
	public static final String GCMD_EXECUTE_REMOTE_JOB="gradle executeRemoteJob ";
	public static final String GCMD_EXECUTE_LOCAL_JOB="gradle executeLocalJob ";
	public static final String GCMD_EXECUTE_DEBUG_LOCAL_JOB="gradle executeDebugLocal ";
	public static final String GCMD_EXECUTE_DEBUG_REMOTE_JOB="gradle executeDebugRemoteJob ";
	public static final String GCMD_KILL_REMOTE_JOB="gradle killRemoteJob ";
	public static final String GCMD_CREATE_DIRECTORIES="gradle createDirectories ";
	public static final String GCMD_SCP_EXTERNAL_FILES="gradle scpExternalFiles ";
	public static final String GCMD_SCP_SUBJOB_FILES="gradle scpSubJobFiles ";

	public static final String GPARAM_USERNAME=" -Pusername=";
	public static final String GPARAM_PASSWORD=" -Ppassword=";
	public static final String GPARAM_PASSKEY=" -Pkeyfile=";
	public static final String GPARAM_USE_PASSWORD=" -Pusepassword=";
	public static final String GPARAM_HOST=" -Phost=";
	public static final String GPARAM_JOB_XML=" -PjobXML=";
	public static final String GPARAM_PARAM_FILE=" -PparameterFile=";
	public static final String GPARAM_LOCAL_JOB=" -Plocaljob=true";
	public static final String GPARAM_REMOTE_PROCESSID = " -Pjobprocessid=";
	public static final String GPARAM_JOB_DEBUG_XML=" -PdebugJobXML=";
	public static final String GPARAM_JOB_BASE_PATH=" -PbasePath=";
	public static final String GPARAM_UNIQUE_JOB_ID=" -PjobId=";
	public static final String GPARAM_MOVE_PARAM_FILE=" -PmoveParameterFile=";
	public static final String GPARAM_RESOUCES_FILES=" -PmoveResourceFile=";
	public static final String GPARAM_MOVE_EXTERNAL_FILES=" -PmoveExternalFiles=";
	public static final String GPARAM_MOVE_SUBJOB_FILES=" -PmoveSubJobFiles=";
	public static final String GPARAM_MOVE_JAR=" -PmoveJar=";
	public static final String GPARAM_MOVE_FILES=" -PexternalFiles=";
	public static final String GPARAM_MOVE_SUBJOB=" -PsubJobFiles=";

	public static final String GPARAM_IS_EXECUTION_TRACKING_ON=" -PisExecutionTracking=";
	public static final String GPARAM_EXECUTION_TRACKING_PORT=" -PexecutionTrackingPort=";

	public static final String REMOTE_FIXED_DIRECTORY_PARAM="param";
	public static final String REMOTE_FIXED_DIRECTORY_LIB="lib";

	public static final String GCMD_SCP_USER_FUNCTIONS_PROPERTY_FILE="gradle scpUserFunctionsPropertyFile ";
	public static final String GCMD_SCP_LIB_FOLDER_JAR_FILES="gradle scpLibFolderJarFiles ";
	public static final String REMOTE_FIXED_DIRECTORY_RESOURCES="resources";
	public static final String GPARAM_USER_DEFINED_FUNCTIONS_PATH=" -Pudfpath=";
	public static final String GPARAM_CONSOLE_LOGGING_LEVEL=" -Ploglevel=";
}


text:
import csv
from keras.models import Sequential
from keras.layers import Flatten, Dense, Convolution2D, Cropping2D, Lambda, Dropout
import numpy as np
import cv2
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
import sklearn
from keras.layers.pooling import MaxPooling2D

def append_data(col, images, measurement, steering_measurements):
    current_path = image_path + '/' + col.strip()

    image = cv2.imread(current_path)
    image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
    images.append(np.asarray(image))
    steering_measurements.append(measurement)

    # random flipping
    flip_prob = np.random.random()
    if flip_prob > 0.5:
        image_flipped = np.fliplr(image)
        images.append(np.asarray(image_flipped))
        measurement_flipped = measurement * (-1)
        steering_measurements.append(measurement)

def images_and_measurements(sample):
    images = []
    steering_measurements = []
    for line in sample[0:]:
        measurement = float(line[3])
        ## random data
        camera = np.random.choice(['center', 'left', 'right'])
        if camera == 'center':
            col_center = line[0]
            append_data(col_center, images, measurement, steering_measurements)
        elif camera == 'left':
            col_left = line[1]
            append_data(col_left, images, measurement + 0.25, steering_measurements)
        else:
            col_right = line[2]
            append_data(col_right, images, measurement - 0.25, steering_measurements)
    return images, steering_measurements

def generator(samples, batch_size = 32):
    num_samples = len(samples)
    while 1:
        sklearn.utils.shuffle(samples)
        for offset in range(0, num_samples, batch_size):
            batch_samples = samples[offset:offset + batch_size]
            images = []
            measurements = []
            for image, measurement in batch_samples:
                images.append(image)
                measurements.append(measurement)
            # trim image to only see section with road
            x_train = np.array(images)
            y_train = np.array(measurements)
            yield sklearn.utils.shuffle(x_train, y_train)

if __name__ == '__main__':

	'''Read data'''
	image_path = '../../../data'
	# row in log path is IMG/<name>
	driving_log_path = '../../../data/driving_log.csv'

	rows = []
	with open(driving_log_path) as csvfile:
	    reader = csv.reader(csvfile)
	    for row in reader:
	        rows.append(row)

	X_total, y_total = images_and_measurements(rows[1:])

	model = Sequential()
	#The cameras in the simulator capture 160 pixel by 320 pixel images., after cropping, it is 66x200
	model.add(Cropping2D(cropping = ((74,20), (60,60)),input_shape=(160, 320, 3)))

	model.add(Lambda(lambda x: x / 255.0 - 0.5, input_shape=(66, 200, 3)))
	model.add(Convolution2D(24, 5, 5, subsample=(2,2), activation='relu'))
	model.add(Dropout(.5))
	model.add(Convolution2D(36, 5, 5, subsample=(2,2), activation='relu'))
	model.add(Dropout(.5))
	model.add(Convolution2D(48, 5, 5, subsample=(2,2), activation='relu'))
	model.add(Dropout(.5))
	model.add(Convolution2D(64, 3, 3, activation='relu'))
	model.add(Convolution2D(64, 3, 3, activation='relu'))
	model.add(Flatten())
	model.add(Dense(100))
	model.add(Dense(50))
	model.add(Dense(10))
	model.add(Dense(1))
	'''Training: using MSE for regression'''
	model.compile(loss='mse', optimizer='adam')

	print('Training model')
	samples = list(zip(X_total, y_total))
	train_samples, validation_samples = train_test_split(samples, test_size = 0.2)
	train_generator = generator(train_samples, batch_size = 32)
	validation_generator = generator(validation_samples, batch_size = 32)

	history_object = model.fit_generator(train_generator,
	                                    samples_per_epoch = len(train_samples),
	                                    validation_data = validation_generator,
	                                    nb_val_samples = len(validation_samples),
	                                    nb_epoch = 5,
	                                    verbose = 1)
	print('Endding training, starting to save model')
	model.save('../model.h5')


text:
package org.kaazing.k3po.maven.plugin.internal;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.kaazing.k3po.driver.internal.RobotServer;

/**
 * Abstract base class for Robot goals
 */
public abstract class AbstractMojo extends org.apache.maven.plugin.AbstractMojo {

    private static final ThreadLocal<RobotServer> ROBOT_SERVER = new ThreadLocal<>();

    @Parameter(defaultValue = "${project}", readonly = true)
    protected MavenProject project;

    @Parameter(defaultValue = "false", property = "skipTests")
    private boolean skipTests;

    @Parameter(defaultValue = "false", property = "skipITs")
    private boolean skipITs;

    @Override
    public final void execute() throws MojoExecutionException, MojoFailureException {

        if (skipTests || skipITs) {
            getLog().info("Tests are skipped");
            return;
        }

        executeImpl();
    }

    protected abstract void executeImpl() throws MojoExecutionException, MojoFailureException;

    protected void setServer(RobotServer server) {
        if (server == null) {
            ROBOT_SERVER.remove();
        }
        else {
            ROBOT_SERVER.set(server);
        }
    }

    protected RobotServer getServer() {
        return ROBOT_SERVER.get();
    }

}


text:
namespace RiakClient.Commands
{
    using System;

    /// <summary>
    /// Base class for all Riak command builders.
    /// </summary>
    /// <typeparam name="TBuilder">The type of the builder. Allows chaining.</typeparam>
    /// <typeparam name="TCommand">The type of the command.</typeparam>
    /// <typeparam name="TOptions">The type of the options for this command.</typeparam>
    public abstract class CommandBuilder<TBuilder, TCommand, TOptions>
        where TBuilder : CommandBuilder<TBuilder, TCommand, TOptions>
        where TOptions : CommandOptions
    {
        protected Timeout timeout;

        public CommandBuilder()
        {
        }

        public CommandBuilder(CommandBuilder<TBuilder, TCommand, TOptions> source)
        {
            this.timeout = source.timeout;
        }

        public TOptions Options
        {
            get;
            protected set;
        }

        public abstract TCommand Build();

        public TBuilder WithTimeout(Timeout timeout)
        {
            this.timeout = timeout;
            return (TBuilder)this;
        }

        public TBuilder WithTimeout(TimeSpan timeout)
        {
            this.timeout = new Timeout(timeout);
            return (TBuilder)this;
        }

        protected abstract TOptions BuildOptions();
    }
}


text:
package org.conqat.engine.commons.findings;

import java.util.IdentityHashMap;

import junit.framework.TestCase;
import org.conqat.lib.commons.clone.DeepCloneException;
import org.conqat.lib.commons.collections.IIdProvider;
import org.conqat.lib.commons.collections.IdComparator;
import org.conqat.lib.commons.test.DeepCloneTestUtils;
import org.conqat.engine.commons.findings.location.QualifiedNameLocation;
import org.conqat.engine.commons.node.IConQATNode;
import org.conqat.engine.commons.node.ListNode;
import org.conqat.engine.commons.node.NodeUtils;
import org.conqat.engine.commons.testutils.NodeTestUtils.ConQATNodeIdProvider;

/**
 * Test case for deep cloning of nodes when using findings.
 *
 * @author $Author: hummelb $
 * @version $Rev: 43290 $
 * @ConQAT.Rating GREEN Hash: B97A5BA0064241B04DFA025912E3BA5B
 */
public class FindingDeepCloneTest extends TestCase {

	/** The key used to store findings lists. */
	private static final String KEY = "findings";

	/** Tests deep cloning. */
	public void testDeepCloning() throws DeepCloneException {

		ListNode root = new ListNode("a");
		ListNode n1 = new ListNode("b");
		ListNode n2 = new ListNode("c");
		ListNode n3 = new ListNode("d");
		ListNode n4 = new ListNode("e");
		ListNode n5 = new ListNode("f");
		root.addChild(n1);
		root.addChild(n2);
		n2.addChild(n3);
		n2.addChild(n4);
		n2.addChild(n5);

		FindingReport report = NodeUtils.getFindingReport(root);
		Finding f1 = report
				.getOrCreateCategory("cat1")
				.createFindingGroup("g1")
				.createFinding(
						new QualifiedNameLocation("ql", "location", "path"));
		Finding f2 = report
				.getOrCreateCategory("cat2")
				.createFindingGroup("g2")
				.createFinding(
						new QualifiedNameLocation("ql", "location", "path"));

		NodeUtils.getOrCreateFindingsList(n3, KEY).add(f1);
		NodeUtils.getOrCreateFindingsList(n5, KEY).add(f2);

		ListNode clone = root.deepClone();

		DeepCloneTestUtils.testDeepCloning(root, clone,
				new ConQATNodeIdProvider(), "org.conqat");

		// we have to manually check actual findings as keys are not visible to
		// DeepCloneTestUtils.
		IdentityHashMap<Object, Object> cloneMap = DeepCloneTestUtils
				.buildCloneMap(root, clone, new IdComparator<String, Object>(
						new ConQATNodeIdProvider()), "org.conqat");

		ListNode n3clone = (ListNode) cloneMap.get(n3);
		ListNode n5clone = (ListNode) cloneMap.get(n5);

		FindingsList fl3 = NodeUtils.getFindingsList(n3clone, KEY);
		FindingsList fl5 = NodeUtils.getFindingsList(n5clone, KEY);

		assertNotNull(fl3);
		assertNotNull(fl5);

		assertEquals(1, fl3.size());
		assertEquals(1, fl5.size());

		IdentityHashMap<Object, Object> reportMap = DeepCloneTestUtils
				.buildCloneMap(report, NodeUtils.getFindingReport(clone),
						new IdComparator<String, Object>(
								new IIdProvider<String, Object>() {
									@Override
									public String obtainId(Object object) {
										if (object instanceof IConQATNode) {
											return ((IConQATNode) object)
													.getId();
										}
										return Integer.toString(object
												.hashCode());
									}
								}), "org.conqat");

		assertNotSame(f1, reportMap.get(f1));
		assertNotSame(f2, reportMap.get(f2));

		assertSame(reportMap.get(f1), fl3.get(0));
		assertSame(reportMap.get(f2), fl5.get(0));
	}
}