text stringlengths 2 1.04M | meta dict |
|---|---|
/**
* Created by syntaxfish on 14. 11. 1..
*/
module.exports = {
playGoogle: require('./playGoogle.js'),
amazon: require('./amazon.js'),
market360: require('./market360.js'),
tstore: require('./tstore.js')
}; | {
"content_hash": "e184cf4cba190fdbb8419a85ecc34686",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 43,
"avg_line_length": 22.7,
"alnum_prop": 0.6035242290748899,
"repo_name": "haruio/haru-nodejs-monetization",
"id": "73c40bacf18dc895cf5676e0348ec4bd0c6442cc",
"size": "227",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "crawler/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "29110"
}
],
"symlink_target": ""
} |
package org.innovateuk.ifs.application.domain;
import lombok.*;
import org.innovateuk.ifs.application.repository.ApplicationEoiEvidenceStateConverter;
import org.innovateuk.ifs.application.resource.ApplicationEoiEvidenceState;
import org.innovateuk.ifs.user.domain.ProcessRole;
import org.innovateuk.ifs.workflow.domain.Process;
import javax.persistence.*;
@Entity
@Getter
@Setter
@NoArgsConstructor
@Builder
@EqualsAndHashCode(callSuper = true)
public class ApplicationEoiEvidenceProcess extends Process<ProcessRole, ApplicationEoiEvidenceResponse, ApplicationEoiEvidenceState> {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "participant_id", referencedColumnName = "id")
private ProcessRole participant;
@ManyToOne(fetch = FetchType.LAZY, optional = false )
@JoinColumn(name = "target_id", referencedColumnName = "id")
private ApplicationEoiEvidenceResponse target;
@Convert(converter = ApplicationEoiEvidenceStateConverter.class)
@Column(name="activity_state_id")
private ApplicationEoiEvidenceState processState;
public ApplicationEoiEvidenceProcess(ProcessRole participant, ApplicationEoiEvidenceResponse target, ApplicationEoiEvidenceState initialState) {
this.target = target;
this.participant = participant;
this.setProcessState(initialState);
}
}
| {
"content_hash": "98163ae481c998870181339b46fb9b69",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 148,
"avg_line_length": 37.22222222222222,
"alnum_prop": 0.7955223880597015,
"repo_name": "InnovateUKGitHub/innovation-funding-service",
"id": "17d13e51dc4601f7347af065cca5628e2540a148",
"size": "1340",
"binary": false,
"copies": "1",
"ref": "refs/heads/development",
"path": "ifs-data-layer/ifs-data-service/src/main/java/org/innovateuk/ifs/application/domain/ApplicationEoiEvidenceProcess.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "1972"
},
{
"name": "HTML",
"bytes": "6342985"
},
{
"name": "Java",
"bytes": "26591674"
},
{
"name": "JavaScript",
"bytes": "269444"
},
{
"name": "Python",
"bytes": "58983"
},
{
"name": "RobotFramework",
"bytes": "3317394"
},
{
"name": "SCSS",
"bytes": "100274"
},
{
"name": "Shell",
"bytes": "60248"
}
],
"symlink_target": ""
} |
FROM balenalib/amd64-alpine:3.10-run
LABEL io.balena.device-type="up-core-plus"
RUN apk add --update \
less \
nano \
net-tools \
ifupdown \
usbutils \
gnupg \
&& rm -rf /var/cache/apk/*
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo $'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: Intel 64-bit (x86-64) \nOS: Alpine Linux 3.10 \nVariant: run variant \nDefault variable(s): UDEV=off \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo $'#!/bin/bash\nbalena-info\nbusybox ln -sf /bin/busybox /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& ln -f /bin/sh /bin/sh.real \
&& ln -f /bin/sh-shim /bin/sh | {
"content_hash": "001375c77035aaae78f9938c7907b2a3",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 631,
"avg_line_length": 57.22222222222222,
"alnum_prop": 0.6980582524271844,
"repo_name": "nghiant2710/base-images",
"id": "13995cd4c606e34e29b146e80b1a161ab8bacfb0",
"size": "1030",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "balena-base-images/device-base/up-core-plus/alpine/3.10/run/Dockerfile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "144558581"
},
{
"name": "JavaScript",
"bytes": "16316"
},
{
"name": "Shell",
"bytes": "368690"
}
],
"symlink_target": ""
} |
NS_ASSUME_NONNULL_BEGIN
@interface CalendarConfigViewController : UITableViewController
@property (assign, nonatomic) NSInteger theme;
@property (assign, nonatomic) BOOL lunar;
@property (assign, nonatomic) NSUInteger firstWeekday;
@property (assign, nonatomic) FSCalendarScrollDirection scrollDirection;
@property (strong, nonatomic) NSDate *selectedDate;
@end
NS_ASSUME_NONNULL_END
| {
"content_hash": "8c97e53492d3ceb42f4b2a90c84a87b8",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 72,
"avg_line_length": 31.923076923076923,
"alnum_prop": 0.763855421686747,
"repo_name": "rafaelcpalmeida/UFP-iOS",
"id": "5f01b008d59dda95f1537a9cbfa69fa6f8f8349e",
"size": "621",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "UFP/UFP/Carthage/Checkouts/FSCalendar/Example-Objc/CalendarConfigViewController.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "277"
},
{
"name": "Swift",
"bytes": "61679"
}
],
"symlink_target": ""
} |
package pl.mk5.gdx.fireapp.html.firebase;
class FirebaseJS {
private FirebaseJS() {
//
}
static native void initializeFirebase(String initializationScript) /*-{
console.log("GdxFireapp: initialization script...");
eval(initializationScript);
var interval = $wnd.setInterval(function(){
if( $wnd.firebase.apps.length > 0 ) {
console.log("GdxFireapp: app initialized");
@pl.mk5.gdx.fireapp.html.firebase.FirebaseJS::setFirebaseScriptIsLoaded()();
$wnd.clearInterval(interval);
}
}, 100);
}-*/;
static native boolean isFirebaseLoaded() /*-{
return (typeof $wnd.firebase != 'undefined');
}-*/;
static void setFirebaseScriptIsLoaded() {
FirebaseScriptInformant.setIsLoaded(true);
}
}
| {
"content_hash": "b1c724b0970cd5539bdf9cd93841ac32",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 88,
"avg_line_length": 27.666666666666668,
"alnum_prop": 0.6144578313253012,
"repo_name": "mk-5/gdx-fireapp",
"id": "a8a72c69d941b7dcf03f900da1adfa74feebc967",
"size": "1415",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "gdx-fireapp-html/src/pl/mk5/gdx/fireapp/html/firebase/FirebaseJS.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "65551"
},
{
"name": "C++",
"bytes": "59594"
},
{
"name": "CSS",
"bytes": "1069"
},
{
"name": "Groovy",
"bytes": "34033"
},
{
"name": "HTML",
"bytes": "2161"
},
{
"name": "Java",
"bytes": "922541"
},
{
"name": "JavaScript",
"bytes": "24"
},
{
"name": "Objective-C",
"bytes": "789860"
},
{
"name": "Ruby",
"bytes": "634"
},
{
"name": "Shell",
"bytes": "636"
}
],
"symlink_target": ""
} |
sap-preconfigure
================
This role configures a RHEL 7 or RHEL 8 system according to applicable SAP notes so that any SAP software can be installed. Future implementation may reduce the scope of this role, for example if certain installation or configuration steps are done in more specialized roles.
Requirements
------------
To use this role, your system needs to be installed according to:
- RHEL 7: SAP note 2002167, Red Hat Enterprise Linux 7.x: Installation and Upgrade, section "Installing Red Hat Enterprise Linux 7"
- RHEL 8: SAP note 2772999, Red Hat Enterprise Linux 8.x: Installation and Configuration, section "Installing Red Hat Enterprise Linux 8".
Note
----
Do not run this role against an SAP or other production system. The role will enforce a certain configuration on the managed node(s), which might not be intended.
Role Variables
--------------
- set in `defaults/main.yml`:
### Execute only certain steps of SAP notes
If the following variable is set to no, only certain steps of SAP notes will be executed or checked as per setting of variable `sap_preconfigure_<sap_note_number>_<step>`. If this variable is undefined or set to no, all steps of applicable SAP notes will be executed.
```yaml
sap_preconfigure_config_all
```
### Define configuration steps of SAP notes
For defining one or more steps of SAP notes to be executed or checked only, set variable `sap_preconfigure_config_all` to `no` and one or more of the following variables to `yes`:
```yaml
sap_preconfigure_2002167_0[2...6], example: sap_preconfigure_2002167_03
sap_preconfigure_1391070
sap_preconfigure_2772999_[02...10], example: sap_preconfigure_2772999_10
```
### Minimum package check
The following variable will make sure packages are installed at minimum required versions as defined in files `vars/*.yml`. Default is `yes`.
```yaml
sap_preconfigure_min_package_check
```
### Perform a yum update
If the following variable is set to `yes`, the role will run a `yum update` before performing configuration changes. Default is `no`. \
*Note*: The outcome of a `yum update` depends on the managed node's configuration for sticky OS minor version, see the description of the release option in `man subscription-manager`. For SAP HANA installations, setting a certain minor version with `subscscription-manager release --set=X.Y` is a strict requirement.
```yaml
sap_preconfigure_update
```
### How to behave if reboot is required
The following variable will ensure that the role will fail if a reboot is required, if undefined or set to `yes`, which is also the default. Rebooting the managed node can be done in the playbook which is calling this role. By setting the variable to `no`, the role will not fail if a reboot is required.
```yaml
sap_preconfigure_fail_if_reboot_required
```
### Define SELinux state
The following variable allows for defining the desired SELinux state. Default is `disabled`.
```yaml
sap_preconfigure_selinux_state
```
### size of TMPFS in GB:
The following variable contains a formula for setting the size of TMPFS according to SAP note 941735.
```yaml
sap_preconfigure_size_of_tmpfs_gb
```
### Locale
The following variable contains the locale to be check. This check is currently not implemented.
```yaml
sap_preconfigure_locale
```
### Modify /etc/hosts
If you not want the role to check and if necessary modify `/etc/hosts` according to SAP's requirements, set the following variable to `no`. Default is `yes`.
```yaml
sap_preconfigure_modify_etc_hosts
```
### hostname
If the role should not use the hostname as reported by Ansible (=`ansible_hostname`), set the following variable according to your needs:
```yaml
sap_hostname
```
### DNS domain name
If the role should not use the DNS domain name as reported by Ansible (=`ansible_domain`), set the following variable according to your needs:
```yaml
sap_domain
```
### IP address
If the role should not use the primary IP address as reported by Ansible (=`ansible_default_ipv4.address`), set the following variable according to your needs:
```yaml
sap_ip
```
### Linux group name of the database user
The following variable contains the name of the group which is used for the database(s), e.g. dba.
```yaml
sap_preconfigure_db_group_name
```
Dependencies
------------
This role does not depend on any other role.
Example Playbook
----------------
```yaml
---
- hosts: all
roles:
- role: sap-preconfigure
```
Example Usage
-------------
ansible-playbook -l remote_host site.yml
License
-------
GNU General Public License v3.0
Author Information
------------------
Bernd Finger
| {
"content_hash": "fafcda17c98067017279d7f8f5c6116e",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 316,
"avg_line_length": 35.50769230769231,
"alnum_prop": 0.7422010398613518,
"repo_name": "GoogleCloudPlatform/sap-deployment-automation",
"id": "ea7f2e678c734654d52b80916c3c9cda5a8f6366",
"size": "4616",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "third_party/github.com/linux-system-roles/sap-preconfigure/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
/**
* Host class - hosts are those who initialize meetings and view the results
*/
package objectFiles;
public class Host extends User{
private String password;
private String email;
/**
* Constructor
*/
public Host() {
}
public Host(String username, String password, String email) {
super(username);
this.password = password;
this.email = email;
}
/**
* @return the password
*/
public String getPassword() {
return password;
}
/**
* @param password the password to set
*/
public void setPassword(String password) {
this.password = password;
}
/**
* @return the email
*/
public String getEmail() {
return email;
}
/**
* @param email the email to set
*/
public void setEmail(String email) {
this.email = email;
}
/**
* @param curMeeting the curMeeting to set
*/
@Override
public void setCurMeeting(Meeting curMeeting) {
super.setCurMeeting(curMeeting);
curMeeting.setHost(this);
}
/**
* Initialize a new meeting which this will host
* @param numUsers
* @param numRows
* @param numCols
* @return the Meeting object created
*/
public Meeting initializeMeeting(int numUsers,
int numHoursPerDay,
int numDays){
Meeting newM = new Meeting(numHoursPerDay, numDays, numUsers);
newM.setHost(this);
this.setCurMeeting(newM);
return newM;
}
/**
* @return string representation of the object
*/
@Override
public String toString() {
return "Host [" + super.toString() + ", password=" + password
+ ", email=" + email + "]";
}
}
| {
"content_hash": "adfdafff10fd3fca0758d04a139195b2",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 76,
"avg_line_length": 18.4,
"alnum_prop": 0.6528132992327366,
"repo_name": "matthewandrous/Chronos",
"id": "a978a4c1dce7a16e2b825bf39437b48d6991a75f",
"size": "1564",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Project_Chronos/src/objectFiles/Host.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "661"
},
{
"name": "Java",
"bytes": "91544"
}
],
"symlink_target": ""
} |
package com.codeest.geeknews.ui.main.activity;
import android.content.Intent;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.codeest.geeknews.R;
import com.codeest.geeknews.base.BaseActivity;
import com.codeest.geeknews.component.ImageLoader;
import com.codeest.geeknews.model.bean.WelcomeBean;
import com.codeest.geeknews.presenter.WelcomePresenter;
import com.codeest.geeknews.presenter.contract.WelcomeContract;
import butterknife.BindView;
/**
* Created by codeest on 16/8/15.
*/
public class WelcomeActivity extends BaseActivity<WelcomePresenter> implements WelcomeContract.View {
@BindView(R.id.iv_welcome_bg)
ImageView ivWelcomeBg;
@BindView(R.id.tv_welcome_author)
TextView tvWelcomeAuthor;
@Override
protected void initInject() {
getActivityComponent().inject(this);
}
@Override
protected int getLayout() {
return R.layout.activity_welcome;
}
@Override
protected void initEventAndData() {
mPresenter.getWelcomeData();
}
@Override
public void showContent(WelcomeBean welcomeBean) {
ImageLoader.load(this, welcomeBean.getImg(), ivWelcomeBg);
ivWelcomeBg.animate().scaleX(1.12f).scaleY(1.12f).setDuration(2000).setStartDelay(100).start();
tvWelcomeAuthor.setText(welcomeBean.getText());
}
@Override
public void jumpToMain() {
Intent intent = new Intent();
intent.setClass(this,MainActivity.class);
startActivity(intent);
finish();
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
}
@Override
protected void onDestroy() {
Glide.clear(ivWelcomeBg);
super.onDestroy();
}
@Override
public void showError(String msg) {
}
}
| {
"content_hash": "141a5a048c334e75b67db62b4fb3e7f7",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 103,
"avg_line_length": 26.565217391304348,
"alnum_prop": 0.707583196944899,
"repo_name": "weiwenqiang/GitHub",
"id": "a384a8f7e27fe5d17b83bbfefa1d33e17e28ef88",
"size": "1833",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MVP/GeekNews-master/app/src/main/java/com/codeest/geeknews/ui/main/activity/WelcomeActivity.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "87"
},
{
"name": "C",
"bytes": "42062"
},
{
"name": "C++",
"bytes": "12137"
},
{
"name": "CMake",
"bytes": "202"
},
{
"name": "CSS",
"bytes": "75087"
},
{
"name": "Clojure",
"bytes": "12036"
},
{
"name": "FreeMarker",
"bytes": "21704"
},
{
"name": "Groovy",
"bytes": "55083"
},
{
"name": "HTML",
"bytes": "61549"
},
{
"name": "Java",
"bytes": "42222825"
},
{
"name": "JavaScript",
"bytes": "216823"
},
{
"name": "Kotlin",
"bytes": "24319"
},
{
"name": "Makefile",
"bytes": "19490"
},
{
"name": "Perl",
"bytes": "280"
},
{
"name": "Prolog",
"bytes": "1030"
},
{
"name": "Python",
"bytes": "13032"
},
{
"name": "Scala",
"bytes": "310450"
},
{
"name": "Shell",
"bytes": "27802"
}
],
"symlink_target": ""
} |
<?xml version = "1.0" encoding = "UTF-8"?>
<INPUT>
<MEDALS>
<MEDAL Id="1" MEDAL_THRESHOLD="45000" TYPE="Gold"/>
<MEDAL Id="2" MEDAL_THRESHOLD="70000" TYPE="Silver"/>
<MEDAL Id="3" MEDAL_THRESHOLD="95000" TYPE="Bronze"/>
</MEDALS>
<SpeedSettings Min="0" Max="150" Default="18"/>
<PenaltySettings TimeLost="15" SpeedLost="0.1"/>
<PROBLEM_SET>
<PROBLEM_SUBSET>
<TARGET TYPE="String">
<ContentSettings string="8.80"/>
</TARGET>
<QUESTION INDEX="1">
<Content TYPE="String">
<ContentSettings string="640%"/>
</Content>
<Content TYPE="String">
<ContentSettings string="1180%"/>
</Content>
<Answer VALUE="1"/>
</QUESTION>
<QUESTION INDEX="2">
<Content TYPE="String">
<ContentSettings string="1060%"/>
</Content>
<Content TYPE="String">
<ContentSettings string="1100%"/>
</Content>
<Answer VALUE="0"/>
</QUESTION>
<QUESTION INDEX="3">
<Content TYPE="String">
<ContentSettings string="700%"/>
</Content>
<Content TYPE="String">
<ContentSettings string="930%"/>
</Content>
<Answer VALUE="1"/>
</QUESTION>
</PROBLEM_SUBSET>
<PROBLEM_SUBSET>
<TARGET TYPE="String">
<ContentSettings string="5.268"/>
</TARGET>
<QUESTION INDEX="4">
<Content TYPE="String">
<ContentSettings string="370%"/>
</Content>
<Content TYPE="String">
<ContentSettings string="430%"/>
</Content>
<Answer VALUE="2"/>
</QUESTION>
<QUESTION INDEX="5">
<Content TYPE="String">
<ContentSettings string="280%"/>
</Content>
<Content TYPE="String">
<ContentSettings string="630%"/>
</Content>
<Answer VALUE="1"/>
</QUESTION>
<QUESTION INDEX="6">
<Content TYPE="String">
<ContentSettings string="810%"/>
</Content>
<Content TYPE="String">
<ContentSettings string="860%"/>
</Content>
<Answer VALUE="0"/>
</QUESTION>
</PROBLEM_SUBSET>
<PROBLEM_SUBSET>
<TARGET TYPE="String">
<ContentSettings string="10.204"/>
</TARGET>
<QUESTION INDEX="7">
<Content TYPE="String">
<ContentSettings string="610%"/>
</Content>
<Content TYPE="String">
<ContentSettings string="840%"/>
</Content>
<Answer VALUE="2"/>
</QUESTION>
<QUESTION INDEX="8">
<Content TYPE="String">
<ContentSettings string="1110%"/>
</Content>
<Content TYPE="String">
<ContentSettings string="1200%"/>
</Content>
<Answer VALUE="0"/>
</QUESTION>
<QUESTION INDEX="9">
<Content TYPE="String">
<ContentSettings string="1250%"/>
</Content>
<Content TYPE="String">
<ContentSettings string="1390%"/>
</Content>
<Answer VALUE="0"/>
</QUESTION>
</PROBLEM_SUBSET>
<PROBLEM_SUBSET>
<TARGET TYPE="String">
<ContentSettings string="5.143"/>
</TARGET>
<QUESTION INDEX="10">
<Content TYPE="String">
<ContentSettings string="480%"/>
</Content>
<Content TYPE="String">
<ContentSettings string="700%"/>
</Content>
<Answer VALUE="1"/>
</QUESTION>
<QUESTION INDEX="11">
<Content TYPE="String">
<ContentSettings string="220%"/>
</Content>
<Content TYPE="String">
<ContentSettings string="260%"/>
</Content>
<Answer VALUE="2"/>
</QUESTION>
<QUESTION INDEX="12">
<Content TYPE="String">
<ContentSettings string="720%"/>
</Content>
<Content TYPE="String">
<ContentSettings string="890%"/>
</Content>
<Answer VALUE="0"/>
</QUESTION>
</PROBLEM_SUBSET>
<PROBLEM_SUBSET>
<TARGET TYPE="String">
<ContentSettings string="10.408"/>
</TARGET>
<QUESTION INDEX="13">
<Content TYPE="String">
<ContentSettings string="1130%"/>
</Content>
<Content TYPE="String">
<ContentSettings string="1210%"/>
</Content>
<Answer VALUE="0"/>
</QUESTION>
<QUESTION INDEX="14">
<Content TYPE="String">
<ContentSettings string="1090%"/>
</Content>
<Content TYPE="String">
<ContentSettings string="1120%"/>
</Content>
<Answer VALUE="0"/>
</QUESTION>
<QUESTION INDEX="15">
<Content TYPE="String">
<ContentSettings string="590%"/>
</Content>
<Content TYPE="String">
<ContentSettings string="880%"/>
</Content>
<Answer VALUE="2"/>
</QUESTION>
</PROBLEM_SUBSET>
<PROBLEM_SUBSET>
<TARGET TYPE="String">
<ContentSettings string="8.8"/>
</TARGET>
<QUESTION INDEX="16">
<Content TYPE="String">
<ContentSettings string="470%"/>
</Content>
<Content TYPE="String">
<ContentSettings string="670%"/>
</Content>
<Answer VALUE="2"/>
</QUESTION>
<QUESTION INDEX="17">
<Content TYPE="String">
<ContentSettings string="790%"/>
</Content>
<Content TYPE="String">
<ContentSettings string="1150%"/>
</Content>
<Answer VALUE="1"/>
</QUESTION>
<QUESTION INDEX="18">
<Content TYPE="String">
<ContentSettings string="600%"/>
</Content>
<Content TYPE="String">
<ContentSettings string="650%"/>
</Content>
<Answer VALUE="2"/>
</QUESTION>
</PROBLEM_SUBSET>
</PROBLEM_SET>
</INPUT> | {
"content_hash": "46284a4da7c98766f3a36f7bfda1c689",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 57,
"avg_line_length": 25.25980392156863,
"alnum_prop": 0.5901416650494857,
"repo_name": "CarnegieLearning/MathFluency",
"id": "dd3a0787a98f8c9a2dea50fca850ad9adc391b9e",
"size": "5153",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "data/ft1_snow_html5_test/s2w4r2t/s2w4r2_set003.xml",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "1908"
},
{
"name": "HTML",
"bytes": "580536"
},
{
"name": "JavaScript",
"bytes": "24985612"
},
{
"name": "Python",
"bytes": "85638"
},
{
"name": "Shell",
"bytes": "162"
}
],
"symlink_target": ""
} |
require File.dirname(__FILE__) + '/../../../spec_helper'
require 'rexml/document'
describe "REXML::Text.unnormalize" do
it "unescapes a string with the values defined in SETUTITSBUS" do
REXML::Text.unnormalize("< > & " '").should == "< > & \" '"
end
end
| {
"content_hash": "d40f0665c1560aec0905bd4d7bd7271c",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 83,
"avg_line_length": 35.5,
"alnum_prop": 0.6408450704225352,
"repo_name": "ujihisa/rubyspec",
"id": "1aa3d7bf5804ebec042f137fa48ae921e92a3c77",
"size": "284",
"binary": false,
"copies": "14",
"ref": "refs/heads/master",
"path": "library/rexml/text/unnormalize_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "3035027"
}
],
"symlink_target": ""
} |
<?php
namespace Drupal\block_content;
use Drupal\Core\Entity\BundleEntityFormBase;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\language\Entity\ContentLanguageSettings;
/**
* The block content type entity form.
*
* @internal
*/
class BlockContentTypeForm extends BundleEntityFormBase {
/**
* {@inheritdoc}
*/
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
/** @var \Drupal\block_content\BlockContentTypeInterface $block_type */
$block_type = $this->entity;
if ($this->operation == 'add') {
$form['#title'] = $this->t('Add custom block type');
}
else {
$form['#title'] = $this->t('Edit %label custom block type', ['%label' => $block_type->label()]);
}
$form['label'] = [
'#type' => 'textfield',
'#title' => $this->t('Label'),
'#maxlength' => 255,
'#default_value' => $block_type->label(),
'#description' => $this->t("Provide a label for this block type to help identify it in the administration pages."),
'#required' => TRUE,
];
$form['id'] = [
'#type' => 'machine_name',
'#default_value' => $block_type->id(),
'#machine_name' => [
'exists' => '\Drupal\block_content\Entity\BlockContentType::load',
],
'#maxlength' => EntityTypeInterface::BUNDLE_MAX_LENGTH,
];
$form['description'] = [
'#type' => 'textarea',
'#default_value' => $block_type->getDescription(),
'#description' => $this->t('Enter a description for this block type.'),
'#title' => $this->t('Description'),
];
$form['revision'] = [
'#type' => 'checkbox',
'#title' => $this->t('Create new revision'),
'#default_value' => $block_type->shouldCreateNewRevision(),
'#description' => $this->t('Create a new revision by default for this block type.'),
];
if ($this->moduleHandler->moduleExists('language')) {
$form['language'] = [
'#type' => 'details',
'#title' => $this->t('Language settings'),
'#group' => 'additional_settings',
];
$language_configuration = ContentLanguageSettings::loadByEntityTypeBundle('block_content', $block_type->id());
$form['language']['language_configuration'] = [
'#type' => 'language_configuration',
'#entity_information' => [
'entity_type' => 'block_content',
'bundle' => $block_type->id(),
],
'#default_value' => $language_configuration,
];
$form['#submit'][] = 'language_configuration_element_submit';
}
$form['actions'] = ['#type' => 'actions'];
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this->t('Save'),
];
return $this->protectBundleIdElement($form);
}
/**
* {@inheritdoc}
*/
public function save(array $form, FormStateInterface $form_state) {
$block_type = $this->entity;
$status = $block_type->save();
$edit_link = $this->entity->toLink($this->t('Edit'), 'edit-form')->toString();
$logger = $this->logger('block_content');
if ($status == SAVED_UPDATED) {
$this->messenger()->addStatus($this->t('Custom block type %label has been updated.', ['%label' => $block_type->label()]));
$logger->notice('Custom block type %label has been updated.', ['%label' => $block_type->label(), 'link' => $edit_link]);
}
else {
block_content_add_body_field($block_type->id());
$this->messenger()->addStatus($this->t('Custom block type %label has been added.', ['%label' => $block_type->label()]));
$logger->notice('Custom block type %label has been added.', ['%label' => $block_type->label(), 'link' => $edit_link]);
}
$form_state->setRedirectUrl($this->entity->toUrl('collection'));
}
}
| {
"content_hash": "e20b99649573700a8286dc1e0f684015",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 128,
"avg_line_length": 33.48695652173913,
"alnum_prop": 0.5829654635159699,
"repo_name": "electric-eloquence/fepper-drupal",
"id": "80eced316c5289fb3d420b4a8d6a6e7ea82db4fd",
"size": "3851",
"binary": false,
"copies": "10",
"ref": "refs/heads/dev",
"path": "backend/drupal/core/modules/block_content/src/BlockContentTypeForm.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2300765"
},
{
"name": "HTML",
"bytes": "68444"
},
{
"name": "JavaScript",
"bytes": "2453602"
},
{
"name": "Mustache",
"bytes": "40698"
},
{
"name": "PHP",
"bytes": "41684915"
},
{
"name": "PowerShell",
"bytes": "755"
},
{
"name": "Shell",
"bytes": "72896"
},
{
"name": "Stylus",
"bytes": "32803"
},
{
"name": "Twig",
"bytes": "1820730"
},
{
"name": "VBScript",
"bytes": "466"
}
],
"symlink_target": ""
} |
(function() {
var BufferView, FuzzyFinderView, _,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
_ = require('underscore-plus');
FuzzyFinderView = require('./fuzzy-finder-view');
module.exports = BufferView = (function(_super) {
__extends(BufferView, _super);
function BufferView() {
return BufferView.__super__.constructor.apply(this, arguments);
}
BufferView.prototype.toggle = function() {
var _ref;
if (this.hasParent()) {
return this.cancel();
} else {
this.populate();
if (((_ref = this.paths) != null ? _ref.length : void 0) > 0) {
return this.attach();
}
}
};
BufferView.prototype.getEmptyMessage = function(itemCount) {
if (itemCount === 0) {
return 'No open editors';
} else {
return BufferView.__super__.getEmptyMessage.apply(this, arguments);
}
};
BufferView.prototype.populate = function() {
var editors;
editors = atom.workspace.getEditors().filter(function(editor) {
return editor.getPath() != null;
});
editors = _.sortBy(editors, function(editor) {
if (editor === atom.workspaceView.getActivePaneItem()) {
return 0;
} else {
return -(editor.lastOpened || 1);
}
});
this.paths = editors.map(function(editor) {
return editor.getPath();
});
return this.setItems(_.uniq(this.paths));
};
return BufferView;
})(FuzzyFinderView);
}).call(this);
| {
"content_hash": "c720027bfd8366bac4e726107c47d1ff",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 292,
"avg_line_length": 30.677966101694917,
"alnum_prop": 0.5883977900552486,
"repo_name": "dwings/atom-windows",
"id": "80d844e38bc9b0747d1160821e579a531d8fc8e5",
"size": "1810",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "resources/app/node_modules/fuzzy-finder/lib/buffer-view.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "40083"
},
{
"name": "CoffeeScript",
"bytes": "685989"
},
{
"name": "JavaScript",
"bytes": "303972"
},
{
"name": "Shell",
"bytes": "2397"
}
],
"symlink_target": ""
} |
package org.pentaho.di.ui.core.dialog;
import java.util.ArrayList;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.pentaho.di.core.Const;
import org.pentaho.di.core.SourceToTargetMapping;
import org.pentaho.di.i18n.BaseMessages;
import org.pentaho.di.ui.core.PropsUI;
import org.pentaho.di.ui.core.database.dialog.DatabaseDialog;
import org.pentaho.di.ui.core.gui.GUIResource;
import org.pentaho.di.ui.core.gui.WindowProperty;
import org.pentaho.di.ui.trans.step.BaseStepDialog;
/**
* Shows a user 2 lists of strings and allows the linkage of values between values in the 2 lists
*
* @author Matt
* @since 23-03-2006
*/
public class EnterMappingDialog extends Dialog
{
private static Class<?> PKG = DatabaseDialog.class; // for i18n purposes, needed by Translator2!! $NON-NLS-1$
public static final String STRING_ORIGIN_SEPARATOR = " (";
private Label wlSource;
private List wSource;
private FormData fdlSource, fdSource;
private Label wlSourceAuto;
private Button wSourceAuto;
private FormData fdlSourceAuto, fdSourceAuto;
private Label wlSourceHide;
private Button wSourceHide;
private FormData fdlSourceHide, fdSourceHide;
private Label wlTarget;
private List wTarget;
private FormData fdlTarget, fdTarget;
private Label wlTargetAuto;
private Button wTargetAuto;
private FormData fdlTargetAuto, fdTargetAuto;
private Label wlTargetHide;
private Button wTargetHide;
private FormData fdlTargetHide, fdTargetHide;
private Label wlResult;
private List wResult;
private FormData fdlResult, fdResult;
private Button wAdd;
private FormData fdAdd;
private Button wDelete;
private FormData fdDelete;
private Button wOK, wGuess, wCancel;
private Listener lsOK, lsGuess, lsCancel;
private Shell shell;
private String sourceList[];
private String targetList[];
private PropsUI props;
private java.util.List<SourceToTargetMapping> mappings;
/**
* Create a new dialog allowing the user to enter a mapping
*
* @param parent the parent shell
* @param source the source values
* @param target the target values
*/
public EnterMappingDialog(Shell parent, String source[], String target[])
{
this(parent, source, target, new ArrayList<SourceToTargetMapping>());
}
/**
* Create a new dialog allowing the user to enter a mapping
*
* @param parent the parent shell
* @param source the source values
* @param target the target values
* @param mappings the already selected mappings (ArrayList containing <code>SourceToTargetMapping</code>s)
*/
public EnterMappingDialog(Shell parent, String source[], String target[], java.util.List<SourceToTargetMapping> mappings)
{
super(parent, SWT.NONE);
props = PropsUI.getInstance();
this.sourceList = source;
this.targetList = target;
this.mappings = mappings;
}
public java.util.List<SourceToTargetMapping> open()
{
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX | SWT.APPLICATION_MODAL);
props.setLook(shell);
shell.setImage(GUIResource.getInstance().getImageSpoon());
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "EnterMappingDialog.Title"));
shell.setImage(GUIResource.getInstance().getImageTransGraph());
int margin = Const.MARGIN;
int buttonSpace = 90;
// Source table
wlSource = new Label(shell, SWT.NONE);
wlSource.setText(BaseMessages.getString(PKG, "EnterMappingDialog.SourceFields.Label"));
props.setLook(wlSource);
fdlSource = new FormData();
fdlSource.left = new FormAttachment(0, 0);
fdlSource.top = new FormAttachment(0, margin);
wlSource.setLayoutData(fdlSource);
wSource = new List(shell, SWT.SINGLE | SWT.RIGHT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
for (int i = 0; i < sourceList.length; i++)
wSource.add(sourceList[i]);
props.setLook(wSource);
fdSource = new FormData();
fdSource.left = new FormAttachment(0, 0);
fdSource.right = new FormAttachment(25, 0);
fdSource.top = new FormAttachment(wlSource, margin);
fdSource.bottom = new FormAttachment(100, -buttonSpace);
wSource.setLayoutData(fdSource);
// Automatic target selection
wlSourceAuto = new Label(shell, SWT.NONE);
wlSourceAuto.setText(BaseMessages.getString(PKG, "EnterMappingDialog.AutoTargetSelection.Label"));
props.setLook(wlSourceAuto);
fdlSourceAuto = new FormData();
fdlSourceAuto.left = new FormAttachment(0, 0);
fdlSourceAuto.top = new FormAttachment(wSource, margin);
wlSourceAuto.setLayoutData(fdlSourceAuto);
wSourceAuto = new Button(shell, SWT.CHECK);
wSourceAuto.setSelection(true);
props.setLook(wSourceAuto);
fdSourceAuto = new FormData();
fdSourceAuto.left = new FormAttachment(wlSourceAuto, margin * 2);
fdSourceAuto.right = new FormAttachment(25, 0);
fdSourceAuto.top = new FormAttachment(wSource, margin);
wSourceAuto.setLayoutData(fdSourceAuto);
// Hide used source fields?
wlSourceHide = new Label(shell, SWT.NONE);
wlSourceHide.setText(BaseMessages.getString(PKG, "EnterMappingDialog.HideUsedSources"));
props.setLook(wlSourceHide);
fdlSourceHide = new FormData();
fdlSourceHide.left = new FormAttachment(0, 0);
fdlSourceHide.top = new FormAttachment(wSourceAuto, margin);
wlSourceHide.setLayoutData(fdlSourceHide);
wSourceHide = new Button(shell, SWT.CHECK);
wSourceHide.setSelection(true);
props.setLook(wSourceHide);
fdSourceHide = new FormData();
fdSourceHide.left = new FormAttachment(wlSourceHide, margin * 2);
fdSourceHide.right = new FormAttachment(25, 0);
fdSourceHide.top = new FormAttachment(wSourceAuto, margin);
wSourceHide.setLayoutData(fdSourceHide);
wSourceHide.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent e)
{
refreshMappings();
}
}
);
// Target table
wlTarget = new Label(shell, SWT.NONE);
wlTarget.setText(BaseMessages.getString(PKG, "EnterMappingDialog.TargetFields.Label"));
props.setLook(wlTarget);
fdlTarget = new FormData();
fdlTarget.left = new FormAttachment(wSource, margin * 2);
fdlTarget.top = new FormAttachment(0, margin);
wlTarget.setLayoutData(fdlTarget);
wTarget = new List(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
for (int i = 0; i < targetList.length; i++)
wTarget.add(targetList[i]);
props.setLook(wTarget);
fdTarget = new FormData();
fdTarget.left = new FormAttachment(wSource, margin * 2);
fdTarget.right = new FormAttachment(50, 0);
fdTarget.top = new FormAttachment(wlTarget, margin);
fdTarget.bottom = new FormAttachment(100, -buttonSpace);
wTarget.setLayoutData(fdTarget);
// Automatic target selection
wlTargetAuto = new Label(shell, SWT.NONE);
wlTargetAuto.setText(BaseMessages.getString(PKG, "EnterMappingDialog.AutoSourceSelection.Label"));
props.setLook(wlTargetAuto);
fdlTargetAuto = new FormData();
fdlTargetAuto.left = new FormAttachment(wSource, margin * 2);
fdlTargetAuto.top = new FormAttachment(wTarget, margin);
wlTargetAuto.setLayoutData(fdlTargetAuto);
wTargetAuto = new Button(shell, SWT.CHECK);
wTargetAuto.setSelection(false);
props.setLook(wTargetAuto);
fdTargetAuto = new FormData();
fdTargetAuto.left = new FormAttachment(wlTargetAuto, margin * 2);
fdTargetAuto.right = new FormAttachment(50, 0);
fdTargetAuto.top = new FormAttachment(wTarget, margin);
wTargetAuto.setLayoutData(fdTargetAuto);
// Automatic target selection
wlTargetHide = new Label(shell, SWT.NONE);
wlTargetHide.setText(BaseMessages.getString(PKG, "EnterMappingDialog.HideUsedTargets"));
props.setLook(wlTargetHide);
fdlTargetHide = new FormData();
fdlTargetHide.left = new FormAttachment(wSource, margin * 2);
fdlTargetHide.top = new FormAttachment(wTargetAuto, margin);
wlTargetHide.setLayoutData(fdlTargetHide);
wTargetHide = new Button(shell, SWT.CHECK);
wTargetHide.setSelection(true);
props.setLook(wTargetHide);
fdTargetHide = new FormData();
fdTargetHide.left = new FormAttachment(wlTargetHide, margin * 2);
fdTargetHide.right = new FormAttachment(50, 0);
fdTargetHide.top = new FormAttachment(wTargetAuto, margin);
wTargetHide.setLayoutData(fdTargetHide);
wTargetHide.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent e)
{
refreshMappings();
}
}
);
// Add a couple of buttons:
wAdd = new Button(shell, SWT.PUSH);
fdAdd = new FormData();
wAdd.setText(BaseMessages.getString(PKG, "EnterMappingDialog.Button.Add"));
fdAdd.left = new FormAttachment(wTarget, margin * 2);
fdAdd.top = new FormAttachment(wTarget, 0, SWT.CENTER);
wAdd.setLayoutData(fdAdd);
Listener lsAdd = new Listener()
{
public void handleEvent(Event e)
{
add();
}
};
wAdd.addListener(SWT.Selection, lsAdd);
// Delete a couple of buttons:
wDelete = new Button(shell, SWT.PUSH);
fdDelete = new FormData();
wDelete.setText(BaseMessages.getString(PKG, "EnterMappingDialog.Button.Delete"));
fdDelete.left = new FormAttachment(wTarget, margin * 2);
fdDelete.top = new FormAttachment(wAdd, margin * 2);
wDelete.setLayoutData(fdDelete);
Listener lsDelete = new Listener()
{
public void handleEvent(Event e)
{
delete();
}
};
wDelete.addListener(SWT.Selection, lsDelete);
// Result table
wlResult = new Label(shell, SWT.NONE);
wlResult.setText(BaseMessages.getString(PKG, "EnterMappingDialog.ResultMappings.Label"));
props.setLook(wlResult);
fdlResult = new FormData();
fdlResult.left = new FormAttachment(wDelete, margin * 2);
fdlResult.top = new FormAttachment(0, margin);
wlResult.setLayoutData(fdlResult);
wResult = new List(shell, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
for (int i = 0; i < targetList.length; i++)
wResult.add(targetList[i]);
props.setLook(wResult);
fdResult = new FormData();
fdResult.left = new FormAttachment(wDelete, margin * 2);
fdResult.right = new FormAttachment(100, 0);
fdResult.top = new FormAttachment(wlResult, margin);
fdResult.bottom = new FormAttachment(100, -30);
wResult.setLayoutData(fdResult);
// Some buttons
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
lsOK = new Listener()
{
public void handleEvent(Event e)
{
ok();
}
};
wOK.addListener(SWT.Selection, lsOK);
// Some buttons
wGuess = new Button(shell, SWT.PUSH);
wGuess.setText(BaseMessages.getString(PKG, "EnterMappingDialog.Button.Guess"));
lsGuess = new Listener()
{
public void handleEvent(Event e)
{
guess();
}
};
wGuess.addListener(SWT.Selection, lsGuess);
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
lsCancel = new Listener()
{
public void handleEvent(Event e)
{
cancel();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wGuess, wCancel }, margin, null);
wSource.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent e)
{
if (wSourceAuto.getSelection()) findTarget();
}
public void widgetDefaultSelected(SelectionEvent e)
{
add();
}
});
wTarget.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent e)
{
if (wTargetAuto.getSelection()) findSource();
}
public void widgetDefaultSelected(SelectionEvent e)
{
add();
}
});
// Detect [X] or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter()
{
public void shellClosed(ShellEvent e)
{
cancel();
}
});
getData();
BaseStepDialog.setSize(shell);
shell.open();
while (!shell.isDisposed())
{
if (!display.readAndDispatch()) display.sleep();
}
return mappings;
}
private void guess()
{
// Guess the target for all the sources...
for (int i=0;i<sourceList.length;i++)
{
int idx = Const.indexOfString(sourceList[i], wSource.getItems());
if (idx>=0)
{
wSource.select(idx);
if (findTarget())
{
add();
}
}
}
}
private boolean findTarget()
{
// Guess, user selects an entry in the list on the left.
// Find a comparable entry in the target list...
boolean found = false;
int sourceIndex = wSource.getSelectionIndex();
if (sourceIndex<0) return false;
// Skip eventhing after the bracket...
String sourceStr = wSource.getItem(sourceIndex).toUpperCase();
int indexOfBracket = sourceStr.indexOf(EnterMappingDialog.STRING_ORIGIN_SEPARATOR);
String sourceString = sourceStr;
if (indexOfBracket >= 0)
{
sourceString = sourceStr.substring(0, indexOfBracket);
}
int length = sourceString.length();
boolean first = true;
while (!found && (length >= 2 || first))
{
first = false;
for (int i = 0; i < wTarget.getItemCount() && !found; i++)
{
if (wTarget.getItem(i).toUpperCase().indexOf(sourceString.substring(0, length)) >= 0)
{
wTarget.setSelection(i);
found = true;
}
}
length--;
}
return found;
}
private boolean findSource()
{
// Guess, user selects an entry in the list on the right.
// Find a comparable entry in the source list...
boolean found = false;
int targetIndex = wTarget.getSelectionIndex();
// Skip eventhing after the bracket...
String targetString = wTarget.getItem(targetIndex).toUpperCase();
int length = targetString.length();
boolean first = true;
while (!found && (length >= 2 || first))
{
first = false;
for (int i = 0; i < wSource.getItemCount() && !found; i++)
{
if (wSource.getItem(i).toUpperCase().indexOf(targetString.substring(0, length)) >= 0)
{
wSource.setSelection(i);
found = true;
}
}
length--;
}
return found;
}
private void add()
{
if (wSource.getSelectionCount()==1 && wTarget.getSelectionCount()==1)
{
String sourceString = wSource.getSelection()[0];
String targetString = wTarget.getSelection()[0];
int srcIndex = Const.indexOfString(sourceString, sourceList);
int tgtIndex = Const.indexOfString(targetString, targetList);
if (srcIndex >= 0 && tgtIndex >= 0)
{
// New mapping: add it to the list...
SourceToTargetMapping mapping = new SourceToTargetMapping(srcIndex, tgtIndex);
mappings.add(mapping);
refreshMappings();
}
}
}
private void refreshMappings()
{
// Refresh the results...
wResult.removeAll();
for (int i = 0; i < mappings.size(); i++)
{
SourceToTargetMapping mapping = mappings.get(i);
String mappingString = sourceList[mapping.getSourcePosition()] + " --> " + targetList[mapping.getTargetPosition()];
wResult.add(mappingString);
}
wSource.removeAll();
// Refresh the sources
for (int a=0;a<sourceList.length;a++)
{
boolean found = false;
if (wSourceHide.getSelection())
{
for (int b=0;b<mappings.size() && !found;b++)
{
SourceToTargetMapping mapping = mappings.get(b);
if (mapping.getSourcePosition()== Const.indexOfString(sourceList[a], sourceList))
{
found = true;
}
}
}
if (!found)
{
wSource.add(sourceList[a]);
}
}
wTarget.removeAll();
// Refresh the targets
for (int a=0;a<targetList.length;a++)
{
boolean found = false;
if (wTargetHide.getSelection())
{
for (int b=0;b<mappings.size() && !found;b++)
{
SourceToTargetMapping mapping = mappings.get(b);
if (mapping.getTargetPosition()== Const.indexOfString(targetList[a], targetList))
{
found = true;
}
}
}
if (!found)
{
wTarget.add(targetList[a]);
}
}
}
private void delete()
{
String[] result = wResult.getSelection();
for (int i=result.length-1;i>=0;i--)
{
int idx = wResult.indexOf(result[i]);
if (idx>=0 && idx<mappings.size())
{
mappings.remove(idx);
}
}
refreshMappings();
}
public void dispose()
{
props.setScreen(new WindowProperty(shell));
shell.dispose();
}
public void getData()
{
refreshMappings();
}
private void cancel()
{
mappings = null;
dispose();
}
private void ok()
{
dispose();
}
}
| {
"content_hash": "bba9b9384de62181be7a5c762c7d3870",
"timestamp": "",
"source": "github",
"line_count": 622,
"max_line_length": 127,
"avg_line_length": 32.89389067524116,
"alnum_prop": 0.5885630498533725,
"repo_name": "soluvas/pdi-ce",
"id": "1a9406e6a7a1d763411d2d551e877c22cde9cc2d",
"size": "21362",
"binary": false,
"copies": "3",
"ref": "refs/heads/soluvas-4.3.x",
"path": "src-ui/org/pentaho/di/ui/core/dialog/EnterMappingDialog.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "26226707"
},
{
"name": "Shell",
"bytes": "24558"
}
],
"symlink_target": ""
} |
require 'yaml'
module ConfigFiles
class << self
[:schema, :form, :seed].each do |file|
define_method(file) { retreive_from_yaml(file) }
end
private
def retreive_from_yaml(file_name)
YAML.load_file(path(file_name))
end
def path(file_name)
File.expand_path("../../../config/#{file_name}.yml", __FILE__)
end
end
end
| {
"content_hash": "818881c95cea301951f0f47b65f4706b",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 68,
"avg_line_length": 19.31578947368421,
"alnum_prop": 0.5994550408719346,
"repo_name": "static-publisher/static-publisher",
"id": "2ec6b3052ddd1aaae5df7d0452e55b41eedd0a3f",
"size": "367",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "lib/admin/config_files.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "452"
},
{
"name": "HTML",
"bytes": "1262"
},
{
"name": "JavaScript",
"bytes": "164526"
},
{
"name": "Ruby",
"bytes": "15164"
}
],
"symlink_target": ""
} |
package ehc.net;
import java.util.ArrayList;
import org.json.JSONException;
import org.json.JSONObject;
import ehc.net.R;
import gcmService.GCM.TaskRegisterGCM;
import serverConnection.Post;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class CreateUser extends Activity
{
//------------Variables-----------------------
private Button _buttonCancel;
private Button _buttonConfirm;
private EditText _user;
private final String _ip =Post._ip;
//--------------------------------------------
@Override
public void onWindowFocusChanged( boolean hasFocus )
{
// TODO Auto-generated method stub
super.onWindowFocusChanged( hasFocus );
}
@Override
protected void onCreate( Bundle savedInstanceState )
{
super.onCreate( savedInstanceState );
setContentView( R.layout.create_user );
/**
* ------------------------------------
* Linked: variable <- component XML
*-------------------------------------
**/
_buttonCancel = ( Button ) findViewById( R.id.newUserCancel );
_buttonConfirm = ( Button ) findViewById( R.id.newUserConfirm );
// if button is clicked, close the custom dialog
_buttonCancel.setOnClickListener( new View.OnClickListener()
{
@Override
public void onClick( View v )
{
// TODO Auto-generated method stub
onBackPressed();
}
});
// if button is clicked, send the query and close the custom dialog
_buttonConfirm.setOnClickListener( new View.OnClickListener()
{
@Override
public void onClick( View v )
{
int _internalError = 0;
//It checks if exists connection
ConnectivityManager _connMgr = ( ConnectivityManager ) getSystemService( Context.CONNECTIVITY_SERVICE );
NetworkInfo _networkInfo = _connMgr.getActiveNetworkInfo();
if ( _networkInfo == null || !_networkInfo.isConnected() )
{
_internalError=-1;
}
/**
* ------------------------------------
* Linked: variable <- component XML
*-------------------------------------
**/
_user = ( EditText ) findViewById( R.id.newUser );
EditText _email = ( EditText ) findViewById( R.id.newEmail );
EditText _password = ( EditText ) findViewById( R.id.newPassword );
EditText _repeatPassword = ( EditText ) findViewById( R.id.newRepeatPassword );
//Creation the query.
ArrayList<String> _parametros = new ArrayList<String>();
_parametros.add( "command" );
_parametros.add( "createuser2" );
_parametros.add( "username" );
_parametros.add( _user.getText().toString() );
_parametros.add( "password" );
_parametros.add( Post.md5( _password.getText().toString() ) );
_parametros.add( "email" );
_parametros.add( _email.getText().toString() );
_parametros.add( "hint" );
_parametros.add( "" );
//Identify errors.
if( _user.getText().toString().isEmpty() )_internalError=-2;
else if( _email.getText().toString().isEmpty() )_internalError=-3;
else if( !_email.getText().toString().contains( "@" ) )_internalError=-4;
else if( _password.getText().toString().isEmpty() )_internalError=-5;
else if( _password.getText().toString().length() < 2 )_internalError=-6;
else if( _repeatPassword.getText().toString().isEmpty() )_internalError=-7;
else if( !_password.getText().toString().equals( _repeatPassword.getText().toString() ) )_internalError=-8;
errorControl( _parametros, _internalError );
}
});
}
@Override
public boolean onCreateOptionsMenu( Menu menu )
{
// Inflate the menu; this adds items to the action bar if it is present.
//getMenuInflater().inflate(R.menu.log_in, menu);
return true;
}
/**
* Error control for creating user.
* @param dialog
* @param parametros
* @param _internalError
*/
private void errorControl( ArrayList<String> parametros,int internalError )
{
String _message = "";
switch( internalError )
{
case 0:
{
createUserConnection _createUser = new createUserConnection( parametros );
_createUser.execute();
break;
}
case -1:
{
_message = "Not network connection available.";
break;
}
case -2:
{
_message = "User box is empty.";
break;
}
case -3:
{
_message = "E-mail box is empty.";
break;
}
case -4:
{
_message = "Erroneous format in e-mail box.";
break;
}
case -5:
{
_message = "Password box is empty.";
break;
}
case -6:
{
_message = "Password is too sort.";
break;
}
case -7:
{
_message = "Box repeat password is empty.";
break;
}
case -8:
{
_message = "Passwords do not match.";
break;
}
}
if( internalError != 0 )Toast.makeText( getBaseContext(), _message, Toast.LENGTH_SHORT ).show();
}
/**
*
* @author Miguel
*
*/
private class createUserConnection extends AsyncTask<String, String, String>
{
//------------Variables-----------------------
private ArrayList<String> _parametros;
private String _message = "";
private ProgressDialog _pDialog;
//-----------------------------------
public createUserConnection( ArrayList<String> parametros )
{
// TODO Auto-generated constructor stub
this._parametros = parametros;
}
@Override
protected void onPreExecute()
{
super.onPreExecute();
_pDialog = new ProgressDialog( CreateUser.this );
_pDialog.setMessage( "Loading. Please wait..." );
_pDialog.setIndeterminate( false );
_pDialog.setCancelable( false );
_pDialog.show();
}
@Override
protected String doInBackground( String... params )
{
// TODO Auto-generated method stub
//Variable 'Data' saves the query response
JSONObject _data = Post.getServerData( _parametros, _ip );
try
{
JSONObject _json_data = _data.getJSONObject( "error" );
switch( _json_data.getInt( "ERROR" ) )
{
case 0:
{
_message = _json_data.getString( "ENGLISH" );
//GCM registration.
TaskRegisterGCM _task = new TaskRegisterGCM( CreateUser.this );
_task.execute( _user.getText().toString() );
break;
}
default:
{
_message = _json_data.getString( "ENGLISH" );
break;
}
}
} catch ( JSONException e )
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute( String file_url )
{
// dismiss the dialog
_pDialog.dismiss();
Toast.makeText( getBaseContext(), _message, Toast.LENGTH_SHORT ).show();
}
}
}
| {
"content_hash": "b3e3df2a0bbb90f09d17417ee767c784",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 111,
"avg_line_length": 27.725563909774436,
"alnum_prop": 0.5764067796610169,
"repo_name": "EverywhereHouseControl/Android-App",
"id": "9cabfc7bc865e64eced28030269f67ed5be8b2fd",
"size": "7375",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "EverywhereHouseController/src/ehc/net/CreateUser.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groovy",
"bytes": "816"
},
{
"name": "Java",
"bytes": "1495303"
}
],
"symlink_target": ""
} |
<?php
use Database\Tester\Models\Author;
use Database\Tester\Models\Post;
use Database\Tester\Models\Meta;
class MorphOneModelTest extends PluginTestCase
{
public function setUp()
{
parent::setUp();
include_once base_path().'/tests/fixtures/plugins/database/tester/models/Author.php';
include_once base_path().'/tests/fixtures/plugins/database/tester/models/Phone.php';
include_once base_path().'/tests/fixtures/plugins/database/tester/models/Post.php';
include_once base_path().'/tests/fixtures/plugins/database/tester/models/Meta.php';
$this->runPluginRefreshCommand('Database.Tester');
}
public function testSetRelationValue()
{
Model::unguard();
$post = Post::create(['title' => "First post", 'description' => "Yay!!"]);
$author = Author::create(['name' => 'Stevie', 'email' => 'stevie@email.tld']);
$meta1 = Meta::create([
'meta_title' => 'Question',
'meta_description' => 'Industry',
'meta_keywords' => 'major',
'canonical_url' => 'http://google.com/search/jobs',
'redirect_url' => 'http://google.com',
'robot_index' => 'index',
'robot_follow' => 'follow',
]);
$meta2 = Meta::create([
'meta_title' => 'Comment',
'meta_description' => 'Social',
'meta_keywords' => 'startup',
'canonical_url' => 'http://facebook.com/search/users',
'redirect_url' => 'http://facebook.com',
'robot_index' => 'index',
'robot_follow' => 'follow',
]);
$meta3 = Meta::make([
'meta_title' => 'Answer',
'meta_description' => 'Employment',
'meta_keywords' => 'minor',
'canonical_url' => 'http://yahoo.com/search/stats',
'redirect_url' => 'http://yahoo.com',
'robot_index' => 'index',
'robot_follow' => 'follow',
]);
Model::reguard();
// Set by Model object
$post->meta = $meta1;
$post->save();
$this->assertEquals($post->id, $meta1->taggable_id);
$this->assertEquals(get_class($post), $meta1->taggable_type);
$this->assertEquals('Question', $post->meta->meta_title);
// Set by primary key
$metaId = $meta2->id;
$author->meta = $metaId;
$author->save();
$meta2 = Meta::find($metaId);
$this->assertEquals($author->id, $meta2->taggable_id);
$this->assertEquals(get_class($author), $meta2->taggable_type);
$this->assertEquals('Comment', $author->meta->meta_title);
// Nullify
$author->meta = null;
$author->save();
$meta = Meta::find($metaId);
$this->assertNull($meta->taggable_type);
$this->assertNull($meta->taggable_id);
$this->assertNull($meta->taggable);
// Deferred in memory
$author->meta = $meta3;
$this->assertEquals('Answer', $author->meta->meta_title);
$this->assertEquals($author->id, $meta3->taggable_id);
}
public function testGetRelationValue()
{
Model::unguard();
$author = Author::create(['name' => 'Stevie']);
$meta = Meta::create([
'taggable_id' => $author->id,
'taggable_type' => get_class($author),
'meta_title' => 'Question',
'meta_description' => 'Industry',
'meta_keywords' => 'major',
'canonical_url' => 'http://google.com/search/jobs',
'redirect_url' => 'http://google.com',
'robot_index' => 'index',
'robot_follow' => 'follow',
]);
Model::reguard();
$this->assertEquals($meta->id, $author->getRelationValue('meta'));
}
public function testDeferredBinding()
{
$sessionKey = uniqid('session_key', true);
Model::unguard();
$author = Author::create(['name' => 'Stevie']);
$meta = Meta::create([
'meta_title' => 'Comment',
'meta_description' => 'Social',
'meta_keywords' => 'startup',
'canonical_url' => 'http://facebook.com/search/users',
'redirect_url' => 'http://facebook.com',
'robot_index' => 'index',
'robot_follow' => 'follow',
]);
Model::reguard();
$metaId = $meta->id;
// Deferred add
$author->meta()->add($meta, $sessionKey);
$this->assertNull($meta->taggable_id);
$this->assertNull($author->meta);
$this->assertEquals(0, $author->meta()->count());
$this->assertEquals(1, $author->meta()->withDeferred($sessionKey)->count());
// Commit deferred
$author->save(null, $sessionKey);
$meta = Meta::find($metaId);
$this->assertEquals(1, $author->meta()->count());
$this->assertEquals($author->id, $meta->taggable_id);
$this->assertEquals('Comment', $author->meta->meta_title);
// New session
$sessionKey = uniqid('session_key', true);
// Deferred remove
$author->meta()->remove($meta, $sessionKey);
$this->assertEquals(1, $author->meta()->count());
$this->assertEquals(0, $author->meta()->withDeferred($sessionKey)->count());
$this->assertEquals($author->id, $meta->taggable_id);
$this->assertEquals('Comment', $author->meta->meta_title);
// Commit deferred
$author->save(null, $sessionKey);
$meta = Meta::find($metaId);
$this->assertEquals(0, $author->meta()->count());
$this->assertNull($meta->taggable_id);
$this->assertNull($author->meta);
}
}
| {
"content_hash": "aeab64ce657f729ec4b54a104b5558c5",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 93,
"avg_line_length": 36.53846153846154,
"alnum_prop": 0.5396491228070175,
"repo_name": "wintersunsunsun/yamada",
"id": "d8cb43ca3010d18ebfb9b2da72dc5ba1db6405e4",
"size": "5700",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "tests/unit/plugins/database/MorphOneModelTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "74305"
},
{
"name": "HTML",
"bytes": "215216"
},
{
"name": "JavaScript",
"bytes": "160018"
},
{
"name": "PHP",
"bytes": "1043128"
},
{
"name": "Smarty",
"bytes": "8578"
}
],
"symlink_target": ""
} |
//
// Session上传(普通上传).m
// codeLib
//
// Created by ftxbird on 14-6-7.
// Copyright (c) 2014年 ftxbird. All rights reserved.
//
#pragma mark - 简单上传
//
- (void)uploadFile
{
// 1. URL
NSURL *fileURL = [[NSBundle mainBundle] URLForResource:@"head8.png" withExtension:nil];
NSURL *url = [NSURL URLWithString:@"http://localhost/uploads/1.png"];
// 2. Request
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:0 timeoutInterval:2.0f];
// 1> PUT方法
// PUT
// 1) 文件大小无限制
// 2) 可以覆盖文件
// POST
// 1) 通常有限制2M
// 2) 新建文件,不能重名
request.HTTPMethod = @"PUT";
// 2> 安全认证
// admin:123456
// result base64编码
// Basic result
/**
BASE 64是网络传输中最常用的编码格式 - 用来将二进制的数据编码成字符串的编码方式
BASE 64的用法:
1> 能够编码,能够解码
2> 被很多的加密算法作为基础算法
*/
NSString *authStr = @"admin:123456";
NSData *authData = [authStr dataUsingEncoding:NSUTF8StringEncoding];
NSString *base64Str = [authData base64EncodedStringWithOptions:0];
NSString *resultStr = [NSString stringWithFormat:@"Basic %@", base64Str];
[request setValue:resultStr forHTTPHeaderField:@"Authorization"];
// 3. Session,全局单例
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionUploadTask *task = [session uploadTaskWithRequest:request fromFile:fileURL completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
// 回调函数,完成之后调用函数
NSLog(@"%@", response);
}];
// 4. resume
[task resume];
}
| {
"content_hash": "bf7bcb4070db45ba5fe7521f1509cb2d",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 167,
"avg_line_length": 28.814814814814813,
"alnum_prop": 0.6394601542416453,
"repo_name": "lf5827955/IOS-Code-library",
"id": "a20a325d7cd32ce58705c449e3fd867f102e2e6d",
"size": "1796",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "codeLib/codeLib/网络/URLSession上传(普通上传).m",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
/*
* This code was generated by https://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.batch.v1.model;
/**
* Specifies the audit configuration for a service. The configuration determines which permission
* types are logged, and what identities, if any, are exempted from logging. An AuditConfig must
* have one or more AuditLogConfigs. If there are AuditConfigs for both `allServices` and a specific
* service, the union of the two AuditConfigs is used for that service: the log_types specified in
* each AuditConfig are enabled, and the exempted_members in each AuditLogConfig are exempted.
* Example Policy with multiple AuditConfigs: { "audit_configs": [ { "service": "allServices",
* "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ]
* }, { "log_type": "DATA_WRITE" }, { "log_type": "ADMIN_READ" } ] }, { "service":
* "sampleservice.googleapis.com", "audit_log_configs": [ { "log_type": "DATA_READ" }, { "log_type":
* "DATA_WRITE", "exempted_members": [ "user:aliya@example.com" ] } ] } ] } For sampleservice, this
* policy enables DATA_READ, DATA_WRITE and ADMIN_READ logging. It also exempts `jose@example.com`
* from DATA_READ logging, and `aliya@example.com` from DATA_WRITE logging.
*
* <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
* transmitted over HTTP when working with the Batch API. For a detailed explanation see:
* <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
* </p>
*
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public final class AuditConfig extends com.google.api.client.json.GenericJson {
/**
* The configuration for logging of each type of permission.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.util.List<AuditLogConfig> auditLogConfigs;
/**
* Specifies a service that will be enabled for audit logging. For example,
* `storage.googleapis.com`, `cloudsql.googleapis.com`. `allServices` is a special value that
* covers all services.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String service;
/**
* The configuration for logging of each type of permission.
* @return value or {@code null} for none
*/
public java.util.List<AuditLogConfig> getAuditLogConfigs() {
return auditLogConfigs;
}
/**
* The configuration for logging of each type of permission.
* @param auditLogConfigs auditLogConfigs or {@code null} for none
*/
public AuditConfig setAuditLogConfigs(java.util.List<AuditLogConfig> auditLogConfigs) {
this.auditLogConfigs = auditLogConfigs;
return this;
}
/**
* Specifies a service that will be enabled for audit logging. For example,
* `storage.googleapis.com`, `cloudsql.googleapis.com`. `allServices` is a special value that
* covers all services.
* @return value or {@code null} for none
*/
public java.lang.String getService() {
return service;
}
/**
* Specifies a service that will be enabled for audit logging. For example,
* `storage.googleapis.com`, `cloudsql.googleapis.com`. `allServices` is a special value that
* covers all services.
* @param service service or {@code null} for none
*/
public AuditConfig setService(java.lang.String service) {
this.service = service;
return this;
}
@Override
public AuditConfig set(String fieldName, Object value) {
return (AuditConfig) super.set(fieldName, value);
}
@Override
public AuditConfig clone() {
return (AuditConfig) super.clone();
}
}
| {
"content_hash": "68fb8bb8f5e17e5c3b616be929fd8186",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 182,
"avg_line_length": 40.74766355140187,
"alnum_prop": 0.7153669724770643,
"repo_name": "googleapis/google-api-java-client-services",
"id": "275feb4624b5db7e8f6c5aa6ed89c3190349ced0",
"size": "4360",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "clients/google-api-services-batch/v1/2.0.0/com/google/api/services/batch/v1/model/AuditConfig.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package main
import (
"flag"
"fmt"
"net/http"
"github.com/codegangsta/negroni"
"github.com/gorilla/mux"
"github.com/ryanbillingsley/blackmagic"
)
func main() {
mongoUrl := flag.String("mongo", "localhost", "The mongo db address. It can be as simple as `localhost` or involved as `mongodb://myuser:mypass@localhost:40001,otherhost:40001/mydb`")
databaseName := flag.String("db", "blackmagic", "The name of the database you are connecting to. Defaults to blackmagic")
port := flag.Int("p", 8080, "The port that the server will listen on.")
flag.Parse()
database := blackmagic.NewDatabase(*mongoUrl, *databaseName)
server := NewServer(database)
server.Start(*port)
}
type Server interface {
Start() error
}
type server struct {
Database blackmagic.Database
Router *mux.Router
}
func (s *server) Start(port int) {
router := mux.NewRouter().StrictSlash(false)
router.HandleFunc("/", s.homeHandler)
s.Router = router
negroni := negroni.Classic()
negroni.UseHandler(router)
negroni.Run(fmt.Sprintf(":%v", port))
}
func NewServer(db blackmagic.Database) *server {
return &server{Database: db}
}
func (s *server) homeHandler(res http.ResponseWriter, req *http.Request) {
if req.URL.Path != "/" {
http.Error(res, "Not found", 404)
return
}
if req.Method != "GET" {
http.Error(res, "Method not allowed", 405)
return
}
res.Header().Set("Content-Type", "text/html; charset=utf-8")
fmt.Fprintln(res, "Welcome")
}
| {
"content_hash": "1fee9bdf9be81029476b9e69cd45a01f",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 185,
"avg_line_length": 23.095238095238095,
"alnum_prop": 0.7003436426116838,
"repo_name": "ryanbillingsley/blackmagic",
"id": "5ac406bb0b6b2789485a2d1fa3edc438440e1b8e",
"size": "1455",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "cmd/bmserver/main.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "22297"
}
],
"symlink_target": ""
} |
import { Camera } from "./three-core";
export class VRControls {
constructor(camera: Camera, callback?: (param: string) => void);
/**
* Update VR Instance Tracking
*/
update(): void;
zeroSensor(): void;
scale: number;
setVRDisplay(display: VRDisplay): void;
}
| {
"content_hash": "9a0e8d65d347ed8fed9a6080c4bee171",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 68,
"avg_line_length": 18.6875,
"alnum_prop": 0.6120401337792643,
"repo_name": "AgentME/DefinitelyTyped",
"id": "22d997433837eecb47695a925dea7abc4ad37c82",
"size": "299",
"binary": false,
"copies": "20",
"ref": "refs/heads/master",
"path": "types/three/three-vrcontrols.d.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "10652407"
},
{
"name": "Ruby",
"bytes": "40"
},
{
"name": "Shell",
"bytes": "60"
},
{
"name": "TypeScript",
"bytes": "11370242"
}
],
"symlink_target": ""
} |
package com.limagiran.hearthstone.evento;
import com.limagiran.hearthstone.card.control.Card;
import com.limagiran.hearthstone.util.*;
import com.limagiran.hearthstone.heroi.control.JogouCardException;
import com.limagiran.hearthstone.partida.control.Partida;
import com.limagiran.hearthstone.partida.util.EscolherMesa;
/**
*
* @author Vinicius Silva
*/
public class Combo {
private static Partida partida;
private static Card card;
/**
* Verifica se há algum evento para Combo
*
* @param card card que gerou o evento
* @throws com.limagiran.hearthstone.heroi.control.JogouCardException
*/
public static void processar(Card card) throws JogouCardException {
Combo.card = card;
Combo.partida = card.getPartida();
if (partida.isVezHeroi() && Utils.isCombo(Combo.card)) {
switch (card.getId()) {
//Cavalgante Shado-Pan (Combo: Receba +3 de Ataque)
case "AT_028":
at_028();
break;
//Valente da Cidade Baixa (Combo: Cause 1 de dano)
case "AT_030":
at_030();
break;
//Líder Défias (Combo: Evoque um Bandido Défias 2/1)
case "EX1_131":
ex1_131();
break;
//Agente da AVIN (Combo: Cause 2 de dano)
case "EX1_134":
ex1_134();
break;
//Edwin VanCleef (Combo: Receba +2/+2 para cada um dos cards jogados antes neste turno)
case "EX1_613":
ex1_613();
break;
//Sequestrador (Combo: Devolva um lacaio à mão do dono)
case "NEW1_005":
new1_005();
break;
}
}
}
/**
* Gera o evento padrão para causar dano em um personagem
*
* @param dano valor do dano
*/
private static void causarDano(int dano) throws JogouCardException {
long escolhido = EscolherMesa.main(1L,card, "Cause " + dano + " de dano", partida, false);
if (escolhido != EscolherMesa.CANCEL) {
Utils.dano(partida, escolhido, dano);
} else {
throw new JogouCardException("Combo cancelado.");
}
}
/**
* Cavalgante Shado-Pan (Combo: Receba +3 de Ataque)
*/
private static void at_028() {
card.addAtaque(3);
}
/**
* Valente da Cidade Baixa (Combo: Cause 1 de dano)
*/
private static void at_030() throws JogouCardException {
causarDano(1);
}
/**
* Líder Défias (Combo: Evoque um Bandido Défias 2/1)
*/
private static void ex1_131() {
card.getDono().evocar(card.getDono().getPosicaoNaMesa(card.id_long) + 1,
partida.criarCard(Values.BANDIDO_DEFIAS2_1, System.nanoTime()));
}
/**
* Agente da AVIN (Combo: Cause 2 de dano)
*/
private static void ex1_134() throws JogouCardException {
causarDano(2);
}
/**
* Edwin VanCleef (Combo: Receba +2/+2 para cada um dos cards jogados antes
* neste turno)
*/
private static void ex1_613() {
card.addVidaMaxima(card.getDono().getCardsJogadosNaRodada().size() * 2);
card.addAtaque(card.getDono().getCardsJogadosNaRodada().size() * 2);
}
/**
* Sequestrador (Combo: Devolva um lacaio à mão do dono)
*/
private static void new1_005() throws JogouCardException {
if (partida.getMesa().size() > 1) {
long escolhido = EscolherMesa.main(1L, partida.getPartidaView(), card, "Devolva um lacaio à mão do dono",
null, null, card.getDono().getMesa(), card.getOponente().getMesa(), false);
if (escolhido != EscolherMesa.CANCEL) {
partida.voltarPraMaoDoDono(escolhido);
} else {
throw new JogouCardException("Combo cancelado.");
}
}
}
} | {
"content_hash": "6ef084c21b81488e350d0d01768e83d7",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 117,
"avg_line_length": 32.90243902439025,
"alnum_prop": 0.5586854460093896,
"repo_name": "limagiran/hearthstone",
"id": "f63a3de299385da77acd6b3e58b2b3d99743eca7",
"size": "4061",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/limagiran/hearthstone/evento/Combo.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1933767"
}
],
"symlink_target": ""
} |
using Newtonsoft.Json;
namespace musicParser.MetalArchivesAPI
{
public class BandDTO
{
public BandData data { get; set; }
}
public class BandData
{
public string id { get; set; }
public BandDetails details { get; set; }
public string band_name { get; set; }
public string logo { get; set; }
public string photo { get; set; }
public string bio { get; set; }
public Discography[] discography { get; set; }
public Lineup[] current_lineup { get; set; }
}
public class Lineup
{
public string name { get; set; }
public string id { get; set; }
public string instrument { get; set; }
public string years { get; set; }
}
public class Discography
{
public string id { get; set; }
public string title { get; set; }
public string type { get; set; }
public string year { get; set; }
}
public class BandDetails
{
[JsonProperty(PropertyName = "country of origin")]
public string country_of_origin { get; set; }
public string location { get; set; }
public string status { get; set; }
[JsonProperty(PropertyName = "formed in")]
public string formed_in { get; set; }
public string genre { get; set; }
[JsonProperty(PropertyName = "lyrical themes")]
public string lyrical_themes { get; set; }
[JsonProperty(PropertyName = "current label")]
public string current_label { get; set; }
[JsonProperty(PropertyName = "years active")]
public string years_active { get; set; }
}
}
| {
"content_hash": "c9129f0f8a0be00121001eb1dbc65e7b",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 58,
"avg_line_length": 31.2,
"alnum_prop": 0.5623543123543123,
"repo_name": "lorenzonicolas/MusicParser",
"id": "5db9ff09b8d9ff5fb78eb6911eae9af1c986e579",
"size": "1718",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "musicParser/MetalArchivesAPI/DTOs/bandDTO.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "102189"
}
],
"symlink_target": ""
} |
import abc
import logging
from django.db import models
from django.utils import timezone
from framework import sentry
from osf.exceptions import ValidationValueError, ValidationTypeError
from osf.utils.datetime_aware_jsonfield import DateTimeAwareJSONField
from osf.utils.fields import NonNaiveDateTimeField
from osf.utils import akismet, oopspam
from website import settings
logger = logging.getLogger(__name__)
def _get_akismet_client():
"""
AKISMET_APIKEY should be `None` for local testing.
:return:
"""
return akismet.AkismetClient(
apikey=settings.AKISMET_APIKEY,
website=settings.DOMAIN,
verify=bool(settings.AKISMET_APIKEY)
)
def _get_oopspam_client():
"""
OOPSPAM_APIKEY should be `None` for local testing.
:return:
"""
return oopspam.OOPSpamClient()
def _validate_reports(value, *args, **kwargs):
from osf.models import OSFUser
for key, val in value.items():
if not OSFUser.load(key):
raise ValidationValueError('Keys must be user IDs')
if not isinstance(val, dict):
raise ValidationTypeError('Values must be dictionaries')
if ('category' not in val or 'text' not in val or 'date' not in val or 'retracted' not in val):
raise ValidationValueError(
('Values must include `date`, `category`, ',
'`text`, `retracted` keys')
)
class SpamStatus(object):
UNKNOWN = None
FLAGGED = 1
SPAM = 2
HAM = 4
class SpamMixin(models.Model):
"""Mixin to add to objects that can be marked as spam.
"""
class Meta:
abstract = True
# # Node fields that trigger an update to search on save
# SPAM_UPDATE_FIELDS = {
# 'spam_status',
# }
spam_status = models.IntegerField(default=SpamStatus.UNKNOWN, null=True, blank=True, db_index=True)
spam_pro_tip = models.CharField(default=None, null=True, blank=True, max_length=200)
# Data representing the original spam indication
# - author: author name
# - author_email: email of the author
# - content: data flagged
# - headers: request headers
# - Remote-Addr: ip address from request
# - User-Agent: user agent from request
# - Referer: referrer header from request (typo +1, rtd)
spam_data = DateTimeAwareJSONField(default=dict, blank=True)
date_last_reported = NonNaiveDateTimeField(default=None, null=True, blank=True, db_index=True)
# Reports is a dict of reports keyed on reporting user
# Each report is a dictionary including:
# - date: date reported
# - retracted: if a report has been retracted
# - category: What type of spam does the reporter believe this is
# - text: Comment on the comment
reports = DateTimeAwareJSONField(
default=dict, blank=True, validators=[_validate_reports]
)
def flag_spam(self):
# If ham and unedited then tell user that they should read it again
if self.spam_status == SpamStatus.UNKNOWN:
self.spam_status = SpamStatus.FLAGGED
def remove_flag(self, save=False):
if self.spam_status != SpamStatus.FLAGGED:
return
for report in self.reports.values():
if not report.get('retracted', True):
return
self.spam_status = SpamStatus.UNKNOWN
if save:
self.save()
@property
def is_spam(self):
return self.spam_status == SpamStatus.SPAM
@property
def is_spammy(self):
return self.spam_status in [SpamStatus.FLAGGED, SpamStatus.SPAM]
@property
def is_ham(self):
return self.spam_status == SpamStatus.HAM
@property
def is_hammy(self):
return self.is_ham or (
self.spam_status == SpamStatus.UNKNOWN and self.is_assumed_ham
)
@property
def is_assumed_ham(self):
"""If True, will automatically skip spam checks.
Override to set criteria for assumed ham.
"""
return False
def report_abuse(self, user, save=False, **kwargs):
"""Report object is spam or other abuse of OSF
:param user: User submitting report
:param save: Save changes
:param kwargs: Should include category and message
:raises ValueError: if user is reporting self
"""
if user == self.user:
raise ValueError('User cannot report self.')
self.flag_spam()
date = timezone.now()
report = {'date': date, 'retracted': False}
report.update(kwargs)
if 'text' not in report:
report['text'] = None
self.reports[user._id] = report
self.date_last_reported = report['date']
if save:
self.save()
def retract_report(self, user, save=False):
"""Retract last report by user
Only marks the last report as retracted because there could be
history in how the object is edited that requires a user
to flag or retract even if object is marked as HAM.
:param user: User retracting
:param save: Save changes
"""
if user._id in self.reports:
if not self.reports[user._id]['retracted']:
self.reports[user._id]['retracted'] = True
self.remove_flag()
else:
raise ValueError('User has not reported this content')
if save:
self.save()
def confirm_ham(self, save=False, train_akismet=True):
# not all mixins will implement check spam pre-req, only submit ham when it was incorrectly flagged
if (
settings.SPAM_CHECK_ENABLED and
self.spam_data and self.spam_status in [SpamStatus.FLAGGED, SpamStatus.SPAM] and
train_akismet
):
client = _get_akismet_client()
client.submit_ham(
user_ip=self.spam_data['headers']['Remote-Addr'],
user_agent=self.spam_data['headers'].get('User-Agent'),
referrer=self.spam_data['headers'].get('Referer'),
comment_content=self.spam_data['content'],
comment_author=self.spam_data['author'],
comment_author_email=self.spam_data['author_email'],
)
logger.info('confirm_ham update sent')
self.spam_status = SpamStatus.HAM
if save:
self.save()
def confirm_spam(self, save=False, train_akismet=True):
# not all mixins will implement check spam pre-req, only submit spam when it was incorrectly flagged
if (
settings.SPAM_CHECK_ENABLED and
self.spam_data and self.spam_status in [SpamStatus.UNKNOWN, SpamStatus.HAM] and
train_akismet
):
client = _get_akismet_client()
client.submit_spam(
user_ip=self.spam_data['headers']['Remote-Addr'],
user_agent=self.spam_data['headers'].get('User-Agent'),
referrer=self.spam_data['headers'].get('Referer'),
comment_content=self.spam_data['content'],
comment_author=self.spam_data['author'],
comment_author_email=self.spam_data['author_email'],
)
logger.info('confirm_spam update sent')
self.spam_status = SpamStatus.SPAM
if save:
self.save()
@abc.abstractmethod
def check_spam(self, user, saved_fields, request_headers, save=False):
"""Must return is_spam"""
pass
def do_check_spam(self, author, author_email, content, request_headers, update=True):
if self.is_hammy:
return False
if self.is_spammy:
return True
akismet_client = _get_akismet_client()
oopspam_client = _get_oopspam_client()
remote_addr = request_headers['Remote-Addr']
user_agent = request_headers.get('User-Agent')
referer = request_headers.get('Referer')
akismet_is_spam, pro_tip = akismet_client.check_comment(
user_ip=remote_addr,
user_agent=user_agent,
referrer=referer,
comment_content=content,
comment_author=author,
comment_author_email=author_email
)
try:
oopspam_is_spam, oopspam_details = oopspam_client.check_content(
user_ip=remote_addr,
content=content
)
except oopspam.OOPSpamClientError:
sentry.log_exception()
oopspam_is_spam = False
if update:
self.spam_pro_tip = pro_tip
self.spam_data['headers'] = {
'Remote-Addr': remote_addr,
'User-Agent': user_agent,
'Referer': referer,
}
self.spam_data['content'] = content
self.spam_data['author'] = author
self.spam_data['author_email'] = author_email
if akismet_is_spam and oopspam_is_spam:
self.flag_spam()
self.spam_data['who_flagged'] = 'both'
self.spam_data['oopspam_data'] = oopspam_details
elif akismet_is_spam:
self.flag_spam()
self.spam_data['who_flagged'] = 'akismet'
elif oopspam_is_spam:
self.flag_spam()
self.spam_data['who_flagged'] = 'oopspam'
self.spam_data['oopspam_data'] = oopspam_details
return akismet_is_spam or oopspam_is_spam
| {
"content_hash": "d0b20b72246401db2a53ada3600c0110",
"timestamp": "",
"source": "github",
"line_count": 268,
"max_line_length": 108,
"avg_line_length": 35.48134328358209,
"alnum_prop": 0.5985908087075402,
"repo_name": "Johnetordoff/osf.io",
"id": "b650878fbb48cc28a6362eabc232d47daaf5a403",
"size": "9509",
"binary": false,
"copies": "7",
"ref": "refs/heads/develop",
"path": "osf/models/spam.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "93635"
},
{
"name": "Dockerfile",
"bytes": "5876"
},
{
"name": "HTML",
"bytes": "373738"
},
{
"name": "JavaScript",
"bytes": "1596130"
},
{
"name": "Mako",
"bytes": "679193"
},
{
"name": "Python",
"bytes": "11587197"
},
{
"name": "Shell",
"bytes": "2841"
},
{
"name": "VCL",
"bytes": "13885"
}
],
"symlink_target": ""
} |
/******/ (function(modules) { // webpackBootstrap
/******/ // install a JSONP callback for chunk loading
/******/ var parentJsonpFunction = window["webpackJsonp"];
/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, i = 0, resolves = [], result;
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(installedChunks[chunkId])
/******/ resolves.push(installedChunks[chunkId][0]);
/******/ installedChunks[chunkId] = 0;
/******/ }
/******/ for(moduleId in moreModules) {
/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {
/******/ modules[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);
/******/ while(resolves.length)
/******/ resolves.shift()();
/******/ if(executeModules) {
/******/ for(i=0; i < executeModules.length; i++) {
/******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]);
/******/ }
/******/ }
/******/ return result;
/******/ };
/******/ // The module cache
/******/ var installedModules = {};
/******/ // objects to store loaded and loading chunks
/******/ var installedChunks = {
/******/ 2: 0
/******/ };
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // This file contains only the entry chunk.
/******/ // The chunk loading function for additional chunks
/******/ __webpack_require__.e = function requireEnsure(chunkId) {
/******/ if(installedChunks[chunkId] === 0)
/******/ return Promise.resolve();
/******/ // an Promise means "currently loading".
/******/ if(installedChunks[chunkId]) {
/******/ return installedChunks[chunkId][2];
/******/ }
/******/ // start chunk loading
/******/ var head = document.getElementsByTagName('head')[0];
/******/ var script = document.createElement('script');
/******/ script.type = 'text/javascript';
/******/ script.charset = 'utf-8';
/******/ script.async = true;
/******/ script.timeout = 120000;
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.src = __webpack_require__.p + "" + chunkId + ".js";
/******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() {
/******/ // avoid mem leaks in IE.
/******/ script.onerror = script.onload = null;
/******/ clearTimeout(timeout);
/******/ var chunk = installedChunks[chunkId];
/******/ if(chunk !== 0) {
/******/ if(chunk) chunk[1](new Error('Loading chunk ' + chunkId + ' failed.'));
/******/ installedChunks[chunkId] = undefined;
/******/ }
/******/ };
/******/ var promise = new Promise(function(resolve, reject) {
/******/ installedChunks[chunkId] = [resolve, reject];
/******/ });
/******/ installedChunks[chunkId][2] = promise;
/******/ head.appendChild(script);
/******/ return promise;
/******/ };
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "./";
/******/ // on error function for async loading
/******/ __webpack_require__.oe = function(err) { console.error(err); throw err; };
/******/ })
/************************************************************************/
/******/ ([]); | {
"content_hash": "5ab08fb50efb5e0cbdeda5155809b337",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 128,
"avg_line_length": 38.275862068965516,
"alnum_prop": 0.5398198198198199,
"repo_name": "youssefhabri/habri-site",
"id": "2921e168e12ece3d0d7cf083f379cce81d6e4a37",
"size": "5550",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/js/manifest.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "553"
},
{
"name": "HTML",
"bytes": "1038"
},
{
"name": "JavaScript",
"bytes": "882070"
},
{
"name": "PHP",
"bytes": "76320"
},
{
"name": "Vue",
"bytes": "17101"
}
],
"symlink_target": ""
} |
package models
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestUser_IsOwnedBy(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
org := AssertExistsAndLoadBean(t, &User{ID: 3}).(*User)
assert.True(t, org.IsOwnedBy(2))
assert.False(t, org.IsOwnedBy(1))
assert.False(t, org.IsOwnedBy(3))
assert.False(t, org.IsOwnedBy(4))
nonOrg := AssertExistsAndLoadBean(t, &User{ID: 2}).(*User)
assert.False(t, nonOrg.IsOwnedBy(2))
assert.False(t, nonOrg.IsOwnedBy(3))
}
func TestUser_IsOrgMember(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
org := AssertExistsAndLoadBean(t, &User{ID: 3}).(*User)
assert.True(t, org.IsOrgMember(2))
assert.True(t, org.IsOrgMember(4))
assert.False(t, org.IsOrgMember(1))
assert.False(t, org.IsOrgMember(3))
nonOrg := AssertExistsAndLoadBean(t, &User{ID: 2}).(*User)
assert.False(t, nonOrg.IsOrgMember(2))
assert.False(t, nonOrg.IsOrgMember(3))
}
func TestUser_GetTeam(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
org := AssertExistsAndLoadBean(t, &User{ID: 3}).(*User)
team, err := org.GetTeam("team1")
assert.NoError(t, err)
assert.Equal(t, org.ID, team.OrgID)
assert.Equal(t, "team1", team.LowerName)
_, err = org.GetTeam("does not exist")
assert.Equal(t, ErrTeamNotExist, err)
nonOrg := AssertExistsAndLoadBean(t, &User{ID: 2}).(*User)
_, err = nonOrg.GetTeam("team")
assert.Equal(t, ErrTeamNotExist, err)
}
func TestUser_GetOwnerTeam(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
org := AssertExistsAndLoadBean(t, &User{ID: 3}).(*User)
team, err := org.GetOwnerTeam()
assert.NoError(t, err)
assert.Equal(t, org.ID, team.OrgID)
nonOrg := AssertExistsAndLoadBean(t, &User{ID: 2}).(*User)
_, err = nonOrg.GetOwnerTeam()
assert.Equal(t, ErrTeamNotExist, err)
}
func TestUser_GetTeams(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
org := AssertExistsAndLoadBean(t, &User{ID: 3}).(*User)
assert.NoError(t, org.GetTeams())
if assert.Len(t, org.Teams, 2) {
assert.Equal(t, int64(1), org.Teams[0].ID)
assert.Equal(t, int64(2), org.Teams[1].ID)
}
}
func TestUser_GetMembers(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
org := AssertExistsAndLoadBean(t, &User{ID: 3}).(*User)
assert.NoError(t, org.GetMembers())
if assert.Len(t, org.Members, 2) {
assert.Equal(t, int64(2), org.Members[0].ID)
assert.Equal(t, int64(4), org.Members[1].ID)
}
}
func TestUser_AddMember(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
org := AssertExistsAndLoadBean(t, &User{ID: 3}).(*User)
// add a user that is not a member
AssertNotExistsBean(t, &OrgUser{UID: 5, OrgID: 3})
prevNumMembers := org.NumMembers
assert.NoError(t, org.AddMember(5))
AssertExistsAndLoadBean(t, &OrgUser{UID: 5, OrgID: 3})
org = AssertExistsAndLoadBean(t, &User{ID: 3}).(*User)
assert.Equal(t, prevNumMembers+1, org.NumMembers)
// add a user that is already a member
AssertExistsAndLoadBean(t, &OrgUser{UID: 4, OrgID: 3})
prevNumMembers = org.NumMembers
assert.NoError(t, org.AddMember(4))
AssertExistsAndLoadBean(t, &OrgUser{UID: 4, OrgID: 3})
org = AssertExistsAndLoadBean(t, &User{ID: 3}).(*User)
assert.Equal(t, prevNumMembers, org.NumMembers)
CheckConsistencyFor(t, &User{})
}
func TestUser_RemoveMember(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
org := AssertExistsAndLoadBean(t, &User{ID: 3}).(*User)
// remove a user that is a member
AssertExistsAndLoadBean(t, &OrgUser{UID: 4, OrgID: 3})
prevNumMembers := org.NumMembers
assert.NoError(t, org.RemoveMember(4))
AssertNotExistsBean(t, &OrgUser{UID: 4, OrgID: 3})
org = AssertExistsAndLoadBean(t, &User{ID: 3}).(*User)
assert.Equal(t, prevNumMembers-1, org.NumMembers)
// remove a user that is not a member
AssertNotExistsBean(t, &OrgUser{UID: 5, OrgID: 3})
prevNumMembers = org.NumMembers
assert.NoError(t, org.RemoveMember(5))
AssertNotExistsBean(t, &OrgUser{UID: 5, OrgID: 3})
org = AssertExistsAndLoadBean(t, &User{ID: 3}).(*User)
assert.Equal(t, prevNumMembers, org.NumMembers)
CheckConsistencyFor(t, &User{}, &Team{})
}
func TestUser_RemoveOrgRepo(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
org := AssertExistsAndLoadBean(t, &User{ID: 3}).(*User)
repo := AssertExistsAndLoadBean(t, &Repository{OwnerID: org.ID}).(*Repository)
// remove a repo that does belong to org
AssertExistsAndLoadBean(t, &TeamRepo{RepoID: repo.ID, OrgID: org.ID})
assert.NoError(t, org.RemoveOrgRepo(repo.ID))
AssertNotExistsBean(t, &TeamRepo{RepoID: repo.ID, OrgID: org.ID})
AssertExistsAndLoadBean(t, &Repository{ID: repo.ID}) // repo should still exist
// remove a repo that does not belong to org
assert.NoError(t, org.RemoveOrgRepo(repo.ID))
AssertNotExistsBean(t, &TeamRepo{RepoID: repo.ID, OrgID: org.ID})
assert.NoError(t, org.RemoveOrgRepo(NonexistentID))
CheckConsistencyFor(t,
&User{ID: org.ID},
&Team{OrgID: org.ID},
&Repository{ID: repo.ID})
}
func TestCreateOrganization(t *testing.T) {
// successful creation of org
assert.NoError(t, PrepareTestDatabase())
owner := AssertExistsAndLoadBean(t, &User{ID: 2}).(*User)
const newOrgName = "neworg"
org := &User{
Name: newOrgName,
}
AssertNotExistsBean(t, &User{Name: newOrgName, Type: UserTypeOrganization})
assert.NoError(t, CreateOrganization(org, owner))
org = AssertExistsAndLoadBean(t,
&User{Name: newOrgName, Type: UserTypeOrganization}).(*User)
ownerTeam := AssertExistsAndLoadBean(t,
&Team{Name: ownerTeamName, OrgID: org.ID}).(*Team)
AssertExistsAndLoadBean(t, &TeamUser{UID: owner.ID, TeamID: ownerTeam.ID})
CheckConsistencyFor(t, &User{}, &Team{})
}
func TestCreateOrganization2(t *testing.T) {
// unauthorized creation of org
assert.NoError(t, PrepareTestDatabase())
owner := AssertExistsAndLoadBean(t, &User{ID: 5}).(*User)
const newOrgName = "neworg"
org := &User{
Name: newOrgName,
}
AssertNotExistsBean(t, &User{Name: newOrgName, Type: UserTypeOrganization})
err := CreateOrganization(org, owner)
assert.Error(t, err)
assert.True(t, IsErrUserNotAllowedCreateOrg(err))
AssertNotExistsBean(t, &User{Name: newOrgName, Type: UserTypeOrganization})
CheckConsistencyFor(t, &User{}, &Team{})
}
func TestCreateOrganization3(t *testing.T) {
// create org with same name as existent org
assert.NoError(t, PrepareTestDatabase())
owner := AssertExistsAndLoadBean(t, &User{ID: 2}).(*User)
org := &User{Name: "user3"} // should already exist
AssertExistsAndLoadBean(t, &User{Name: org.Name}) // sanity check
err := CreateOrganization(org, owner)
assert.Error(t, err)
assert.True(t, IsErrUserAlreadyExist(err))
CheckConsistencyFor(t, &User{}, &Team{})
}
func TestCreateOrganization4(t *testing.T) {
// create org with unusable name
assert.NoError(t, PrepareTestDatabase())
owner := AssertExistsAndLoadBean(t, &User{ID: 2}).(*User)
err := CreateOrganization(&User{Name: "assets"}, owner)
assert.Error(t, err)
assert.True(t, IsErrNameReserved(err))
CheckConsistencyFor(t, &User{}, &Team{})
}
func TestGetOrgByName(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
org, err := GetOrgByName("user3")
assert.NoError(t, err)
assert.EqualValues(t, 3, org.ID)
assert.Equal(t, "user3", org.Name)
org, err = GetOrgByName("user2") // user2 is an individual
assert.True(t, IsErrOrgNotExist(err))
org, err = GetOrgByName("") // corner case
assert.True(t, IsErrOrgNotExist(err))
}
func TestCountOrganizations(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
expected, err := x.Where("type=?", UserTypeOrganization).Count(&User{})
assert.NoError(t, err)
assert.Equal(t, expected, CountOrganizations())
}
func TestDeleteOrganization(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
org := AssertExistsAndLoadBean(t, &User{ID: 6}).(*User)
assert.NoError(t, DeleteOrganization(org))
AssertNotExistsBean(t, &User{ID: 6})
AssertNotExistsBean(t, &OrgUser{OrgID: 6})
AssertNotExistsBean(t, &Team{OrgID: 6})
org = AssertExistsAndLoadBean(t, &User{ID: 3}).(*User)
err := DeleteOrganization(org)
assert.Error(t, err)
assert.True(t, IsErrUserOwnRepos(err))
nonOrg := AssertExistsAndLoadBean(t, &User{ID: 5}).(*User)
assert.Error(t, DeleteOrganization(nonOrg))
CheckConsistencyFor(t, &User{}, &Team{})
}
func TestIsOrganizationOwner(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
assert.True(t, IsOrganizationOwner(3, 2))
assert.False(t, IsOrganizationOwner(3, 3))
assert.True(t, IsOrganizationOwner(6, 5))
assert.False(t, IsOrganizationOwner(6, 4))
assert.False(t, IsOrganizationOwner(NonexistentID, NonexistentID))
}
func TestIsOrganizationMember(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
assert.True(t, IsOrganizationMember(3, 2))
assert.False(t, IsOrganizationMember(3, 3))
assert.True(t, IsOrganizationMember(3, 4))
assert.True(t, IsOrganizationMember(6, 5))
assert.False(t, IsOrganizationMember(6, 4))
assert.False(t, IsOrganizationMember(NonexistentID, NonexistentID))
}
func TestIsPublicMembership(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
assert.True(t, IsPublicMembership(3, 2))
assert.False(t, IsPublicMembership(3, 3))
assert.False(t, IsPublicMembership(3, 4))
assert.True(t, IsPublicMembership(6, 5))
assert.False(t, IsPublicMembership(6, 4))
assert.False(t, IsPublicMembership(NonexistentID, NonexistentID))
}
func TestGetOrgsByUserID(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
orgs, err := GetOrgsByUserID(4, true)
assert.NoError(t, err)
if assert.Len(t, orgs, 1) {
assert.EqualValues(t, 3, orgs[0].ID)
}
orgs, err = GetOrgsByUserID(4, false)
assert.NoError(t, err)
assert.Len(t, orgs, 0)
}
func TestGetOwnedOrgsByUserID(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
orgs, err := GetOwnedOrgsByUserID(2)
assert.NoError(t, err)
if assert.Len(t, orgs, 1) {
assert.EqualValues(t, 3, orgs[0].ID)
}
orgs, err = GetOwnedOrgsByUserID(4)
assert.NoError(t, err)
assert.Len(t, orgs, 0)
}
func TestGetOwnedOrgsByUserIDDesc(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
orgs, err := GetOwnedOrgsByUserIDDesc(5, "id")
assert.NoError(t, err)
if assert.Len(t, orgs, 2) {
assert.EqualValues(t, 7, orgs[0].ID)
assert.EqualValues(t, 6, orgs[1].ID)
}
orgs, err = GetOwnedOrgsByUserIDDesc(4, "id")
assert.NoError(t, err)
assert.Len(t, orgs, 0)
}
func TestGetOrgUsersByUserID(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
orgUsers, err := GetOrgUsersByUserID(5, true)
assert.NoError(t, err)
if assert.Len(t, orgUsers, 2) {
assert.Equal(t, OrgUser{
ID: orgUsers[0].ID,
OrgID: 6,
UID: 5,
IsOwner: true,
IsPublic: true,
NumTeams: 1}, *orgUsers[0])
assert.Equal(t, OrgUser{
ID: orgUsers[1].ID,
OrgID: 7,
UID: 5,
IsOwner: true,
IsPublic: false,
NumTeams: 1}, *orgUsers[1])
}
publicOrgUsers, err := GetOrgUsersByUserID(5, false)
assert.NoError(t, err)
assert.Len(t, publicOrgUsers, 1)
assert.Equal(t, *orgUsers[0], *publicOrgUsers[0])
orgUsers, err = GetOrgUsersByUserID(1, true)
assert.NoError(t, err)
assert.Len(t, orgUsers, 0)
}
func TestGetOrgUsersByOrgID(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
orgUsers, err := GetOrgUsersByOrgID(3)
assert.NoError(t, err)
if assert.Len(t, orgUsers, 2) {
assert.Equal(t, OrgUser{
ID: orgUsers[0].ID,
OrgID: 3,
UID: 2,
IsOwner: true,
IsPublic: true,
NumTeams: 1}, *orgUsers[0])
assert.Equal(t, OrgUser{
ID: orgUsers[1].ID,
OrgID: 3,
UID: 4,
IsOwner: false,
IsPublic: false,
NumTeams: 0}, *orgUsers[1])
}
orgUsers, err = GetOrgUsersByOrgID(NonexistentID)
assert.NoError(t, err)
assert.Len(t, orgUsers, 0)
}
func TestChangeOrgUserStatus(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
testSuccess := func(orgID, userID int64, public bool) {
assert.NoError(t, ChangeOrgUserStatus(orgID, userID, public))
orgUser := AssertExistsAndLoadBean(t, &OrgUser{OrgID: orgID, UID: userID}).(*OrgUser)
assert.Equal(t, public, orgUser.IsPublic)
}
testSuccess(3, 2, false)
testSuccess(3, 2, false)
testSuccess(3, 4, true)
assert.NoError(t, ChangeOrgUserStatus(NonexistentID, NonexistentID, true))
}
func TestAddOrgUser(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
testSuccess := func(orgID, userID int64) {
org := AssertExistsAndLoadBean(t, &User{ID: orgID}).(*User)
expectedNumMembers := org.NumMembers
if !BeanExists(t, &OrgUser{OrgID: orgID, UID: userID}) {
expectedNumMembers++
}
assert.NoError(t, AddOrgUser(orgID, userID))
AssertExistsAndLoadBean(t, &OrgUser{OrgID: orgID, UID: userID})
org = AssertExistsAndLoadBean(t, &User{ID: orgID}).(*User)
assert.EqualValues(t, expectedNumMembers, org.NumMembers)
}
testSuccess(3, 5)
testSuccess(3, 5)
testSuccess(6, 2)
CheckConsistencyFor(t, &User{}, &Team{})
}
func TestRemoveOrgUser(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
testSuccess := func(orgID, userID int64) {
org := AssertExistsAndLoadBean(t, &User{ID: orgID}).(*User)
expectedNumMembers := org.NumMembers
if BeanExists(t, &OrgUser{OrgID: orgID, UID: userID}) {
expectedNumMembers--
}
assert.NoError(t, RemoveOrgUser(orgID, userID))
AssertNotExistsBean(t, &OrgUser{OrgID: orgID, UID: userID})
org = AssertExistsAndLoadBean(t, &User{ID: orgID}).(*User)
assert.EqualValues(t, expectedNumMembers, org.NumMembers)
}
testSuccess(3, 4)
testSuccess(3, 4)
err := RemoveOrgUser(7, 5)
assert.Error(t, err)
assert.True(t, IsErrLastOrgOwner(err))
AssertExistsAndLoadBean(t, &OrgUser{OrgID: 7, UID: 5})
CheckConsistencyFor(t, &User{}, &Team{})
}
func TestUser_GetUserTeamIDs(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
org := AssertExistsAndLoadBean(t, &User{ID: 3}).(*User)
testSuccess := func(userID int64, expected []int64) {
teamIDs, err := org.GetUserTeamIDs(userID)
assert.NoError(t, err)
assert.Equal(t, expected, teamIDs)
}
testSuccess(2, []int64{1, 2})
testSuccess(4, []int64{2})
testSuccess(NonexistentID, []int64{})
}
func TestAccessibleReposEnv_CountRepos(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
org := AssertExistsAndLoadBean(t, &User{ID: 3}).(*User)
testSuccess := func(userID, expectedCount int64) {
env, err := org.AccessibleReposEnv(userID)
assert.NoError(t, err)
count, err := env.CountRepos()
assert.NoError(t, err)
assert.EqualValues(t, expectedCount, count)
}
testSuccess(2, 2)
testSuccess(4, 1)
}
func TestAccessibleReposEnv_RepoIDs(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
org := AssertExistsAndLoadBean(t, &User{ID: 3}).(*User)
testSuccess := func(userID, page, pageSize int64, expectedRepoIDs []int64) {
env, err := org.AccessibleReposEnv(userID)
assert.NoError(t, err)
repoIDs, err := env.RepoIDs(1, 100)
assert.NoError(t, err)
assert.Equal(t, expectedRepoIDs, repoIDs)
}
testSuccess(2, 1, 100, []int64{3, 5})
testSuccess(4, 0, 100, []int64{3})
}
func TestAccessibleReposEnv_Repos(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
org := AssertExistsAndLoadBean(t, &User{ID: 3}).(*User)
testSuccess := func(userID int64, expectedRepoIDs []int64) {
env, err := org.AccessibleReposEnv(userID)
assert.NoError(t, err)
repos, err := env.Repos(1, 100)
assert.NoError(t, err)
expectedRepos := make([]*Repository, len(expectedRepoIDs))
for i, repoID := range expectedRepoIDs {
expectedRepos[i] = AssertExistsAndLoadBean(t,
&Repository{ID: repoID}).(*Repository)
}
assert.Equal(t, expectedRepos, repos)
}
testSuccess(2, []int64{3, 5})
testSuccess(4, []int64{3})
}
func TestAccessibleReposEnv_MirrorRepos(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
org := AssertExistsAndLoadBean(t, &User{ID: 3}).(*User)
testSuccess := func(userID int64, expectedRepoIDs []int64) {
env, err := org.AccessibleReposEnv(userID)
assert.NoError(t, err)
repos, err := env.MirrorRepos()
assert.NoError(t, err)
expectedRepos := make([]*Repository, len(expectedRepoIDs))
for i, repoID := range expectedRepoIDs {
expectedRepos[i] = AssertExistsAndLoadBean(t,
&Repository{ID: repoID}).(*Repository)
}
assert.Equal(t, expectedRepos, repos)
}
testSuccess(2, []int64{5})
testSuccess(4, []int64{})
}
| {
"content_hash": "7e9c68f472f8024552e7df22c78098ab",
"timestamp": "",
"source": "github",
"line_count": 519,
"max_line_length": 87,
"avg_line_length": 31.283236994219653,
"alnum_prop": 0.7112589307711259,
"repo_name": "cumgun/gitea",
"id": "8f59af0744a813459ca3f127a94e75a42a8561c4",
"size": "16399",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "models/org_test.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "1927201"
},
{
"name": "Makefile",
"bytes": "11859"
},
{
"name": "Roff",
"bytes": "41"
},
{
"name": "Shell",
"bytes": "75565"
}
],
"symlink_target": ""
} |
package net.afnf.blog.web;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import net.afnf.blog.common.MyFunction;
import net.afnf.blog.domain.Entry;
import net.afnf.blog.service.EntryService;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class RssAction {
@Autowired
private EntryService es;
@RequestMapping(value = "/rss.xml")
public String rss(Model model, HttpServletResponse response) {
StringBuilder sb = new StringBuilder();
response.setContentType("application/rss+xml; charset=UTF-8");
response.setCharacterEncoding("UTF-8");
List<Entry> entries = es.getEntriesByTag(null, 1).getEntries();
sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
sb.append("<rss version=\"2.0\"><channel><title>blog.afnf.net</title><link>http://blog.afnf.net/blog</link><language>ja</language>\n");
for (Entry entry : entries) {
sb.append("<item>");
sb.append("<title>");
sb.append(entry.getTitle());
sb.append("</title>");
sb.append("<link>http://blog.afnf.net/blog/");
sb.append(entry.getId());
sb.append("</link>");
sb.append("<author>afnf</author>");
sb.append("<pubDate>");
sb.append(MyFunction.formatPubDate(entry.getPostdate()));
sb.append("</pubDate>");
sb.append("</item>\n");
}
sb.append("</channel></rss>");
try {
ServletOutputStream os = response.getOutputStream();
IOUtils.write(sb.toString(), os, "UTF-8");
os.flush();
IOUtils.closeQuietly(os);
}
catch (IOException e) {
// do nothing
}
return null;
}
}
| {
"content_hash": "24394d8962ab433d638a38f783dc8447",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 143,
"avg_line_length": 32.96923076923077,
"alnum_prop": 0.6014932337844143,
"repo_name": "af-not-found/blog-java1",
"id": "2e86a6315cd7424bef688a5914556025efa12103",
"size": "2143",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/net/afnf/blog/web/RssAction.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "42838"
},
{
"name": "Java",
"bytes": "262893"
},
{
"name": "JavaScript",
"bytes": "110286"
},
{
"name": "Shell",
"bytes": "726"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<title>Homepage</title>
<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<!-- Bootstrap -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- Slick Carousel -->
<script type="text/javascript" src="slick/slick.min.js"></script>
<link rel="stylesheet" type="text/css" href="./slick/slick.css">
<link rel="stylesheet" type="text/css" href="./slick/slick-theme.css">
<!-- Custom -->
<script type="text/javascript" src="Homepage.js"></script>
<script type="text/javascript" src="Search.js"></script>
<link rel="stylesheet" type="text/css" href="Homepage.css">
<!-- Meta -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<!-- Consistent Nav Dropdown -->
<div class="dropdown" style="position: absolute; top: 10%;">
<button id="side_nav" class="btn dropdown-toggle" type="button" data-toggle="dropdown"><span class="glyphicon glyphicon-chevron-right"></span></button>
<ul id="slide_nav_sub" class="dropdown-menu" role="menu">
<li role="presentation"><a href="./Homepage.php"><button class="btn btn-block">Home</button></a></li>
<li role="presentation"><a href="./Help.html"><button class="btn btn-block">Help</button></a></li>
<li role="presentation"><a href="./AdvancedSearch.php"><button class="btn btn-block">Search</button></a></li>
</ul>
</div>
<!-- Title, Link Bar, and Icon + DATE-->
<div class="container" id="head_elements">
<div>
<h3 style="font-size: xx-large;">What to Watch<small style="font-size: small; margin-left: 10px; color: black;">Community driven entertainment suggestions</small></h3>
</div>
<div id="nav_bar_top">
<nav class="navbar navbar-default navbar-fixed">
<div class="container-fluid">
<img class="navbar-brand" src="./Graphics/logo.png">
<ul id="nav_bar_links" class="list-inline navbar-nav" style="margin-left: 10px;">
<li><a href="./Contact.html"><button type="button" class="btn btn-default navbar-btn">Contact</button></a></li>
<li><a href="./Help.html"><button type="button" class="btn btn-default navbar-btn">Help</button></a></li>
<li><a href="./AdvancedSearch.php"><button type="button" class="btn btn-default navbar-btn">Search</button></a></li>
</ul>
<ul class="list-inline navbar-nav navbar-right">
<li><a href="./Login.php"><button type="button" class="btn btn-default navbar-btn"><span class="glyphicon glyphicon-user"></span>Log In</button></a></li>
</ul>
</div>
</nav>
<div style="text-align: center; font-size: large;">
<span style="margin: 1%;" id="t_date"><?php
print date("l, F jS");
print "<br>"; ?>
</span>
<h3 style="text-decoration: underline;">Top 10 Movies Out Now : </h3>
</div>
</div>
</div>
<!-- Carousel -->
<div class="container" id="slide">
<div class="myclass" data-slick='{"slidesToShow": 3, "slidesToScroll": 4, "centerMode": true, "autoplaySpeed": 300}' style="margin: 50px;">
<div><img id="slide1" src="https://images-na.ssl-images-amazon.com/images/M/MV5BMjM2ODA4MTM0M15BMl5BanBnXkFtZTgwNzE5OTYxMDI@._V1_SX300.jpg" style="width:300px;height:400px;"></div>
<div><img id="slide2" src="https://images-na.ssl-images-amazon.com/images/M/MV5BMjI4MzU5NTExNF5BMl5BanBnXkFtZTgwNzY1MTEwMDI@._V1_SX300.jpg" style="width:300px;height:400px;"></div>
<div><img id="slide3" src="https://images-na.ssl-images-amazon.com/images/M/MV5BMjMxOTM1OTI4MV5BMl5BanBnXkFtZTgwODE5OTYxMDI@._V1_SX300.jpg" style="width:300px;height:400px;"></div>
<div><img id="slide4" src="https://images-na.ssl-images-amazon.com/images/M/MV5BMjA0MTkzMDI1MF5BMl5BanBnXkFtZTgwMjQxNDE0MDI@._V1_SX300.jpg" style="width:300px;height:400px;"></div>
<div><img id="slide5" src="https://images-na.ssl-images-amazon.com/images/M/MV5BMTkxNDc3OTcxMV5BMl5BanBnXkFtZTgwODk2NjAzOTE@._V1_SX300.jpg" style="width:300px;height:400px;"></div>
<div><img id="slide6" src="https://images-na.ssl-images-amazon.com/images/M/MV5BMjQ1NjM3MTUxNV5BMl5BanBnXkFtZTgwMDc5MTY5OTE@._V1_SX300.jpg" style="width:300px;height:400px;"></div>
<div><img id="slide7" src="https://images-na.ssl-images-amazon.com/images/M/MV5BMjM2MjE5Mzc4OF5BMl5BanBnXkFtZTgwMjc3NjEyMDI@._V1_SX300.jpg" style="width:300px;height:400px;"></div>
<div><img id="slide8" src="https://images-na.ssl-images-amazon.com/images/M/MV5BOTI4NDkxMTAxM15BMl5BanBnXkFtZTgwMzU1Mzk5OTE@._V1_SX300.jpg" style="width:300px;height:400px;"></div>
<div><img id="slide9" src="https://images-na.ssl-images-amazon.com/images/M/MV5BMjM1MTkwNTQ1Ml5BMl5BanBnXkFtZTgwNTc5ODgxOTE@._V1_SX300.jpg" style="width:300px;height:400px;"></div>
<div><img id="slide10" src="https://images-na.ssl-images-amazon.com/images/M/MV5BMTExMzU0ODcxNDheQTJeQWpwZ15BbWU4MDE1OTI4MzAy._V1_SX300.jpg" style="width:300px;height:400px;"></div>
</div>
</div>
</body>
</html>
| {
"content_hash": "0b9efaf437ed77c93606a7f3b094d4e9",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 184,
"avg_line_length": 62.77777777777778,
"alnum_prop": 0.6922320550639135,
"repo_name": "Etwigg/Examples",
"id": "7da9deb064c6d192207561d71f225f560230713c",
"size": "5085",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Website Project Samples/Homepage.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1246"
},
{
"name": "C",
"bytes": "410509"
},
{
"name": "C++",
"bytes": "134770"
},
{
"name": "CSS",
"bytes": "25064"
},
{
"name": "HTML",
"bytes": "60491"
},
{
"name": "JavaScript",
"bytes": "111492"
},
{
"name": "PHP",
"bytes": "15593"
},
{
"name": "PowerShell",
"bytes": "8175"
},
{
"name": "Python",
"bytes": "6163850"
},
{
"name": "Ruby",
"bytes": "161"
},
{
"name": "Tcl",
"bytes": "1285363"
}
],
"symlink_target": ""
} |
using GraphX;
using QuickGraph;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using GraphX.PCL.Common.Enums;
using GraphX.PCL.Logic.Algorithms.LayoutAlgorithms;
using GraphX.Controls;
/* Some notes about the main objects and types in this example:
*
* GraphAreaExample - our custom layout panel derived from the base GraphArea class with custom data types. Presented as object named: Area.
* GraphExample - our custom data graph derived from BidirectionalGraph class using custom data types.
* GXLogicCoreExample - our custom logic core that contains all logic settings and algorithms
* DataVertex - our custom vertex data type.
* DataEdge - our custom edge data type.
* Zoombox - zoom control object that handles all zooming and interaction stuff. Presented as object named: zoomctrl.
*
* VertexControl - visual vertex object that is responsible for vertex drawing. Can be found in Area.VertexList collection.
* EdgeControl - visual edge object that is responsible for edge drawing. Can be found in Area.EdgesList collection.
*/
namespace SimpleGraph
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window, IDisposable
{
public MainWindow()
{
InitializeComponent();
//Customize Zoombox a bit
//Set minimap (overview) window to be visible by default
ZoomControl.SetViewFinderVisibility(zoomctrl, Visibility.Visible);
//Set Fill zooming strategy so whole graph will be always visible
zoomctrl.ZoomToFill();
//Lets setup GraphArea settings
GraphAreaExample_Setup();
gg_but_randomgraph.Click += gg_but_randomgraph_Click;
gg_but_relayout.Click += gg_but_relayout_Click;
Loaded += MainWindow_Loaded;
}
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
//lets create graph
//Note that you can't create it in class constructor as there will be problems with visuals
gg_but_randomgraph_Click(null, null);
}
void gg_but_relayout_Click(object sender, RoutedEventArgs e)
{
//This method initiates graph relayout process which involves consequnet call to all selected algorithms.
//It behaves like GenerateGraph() method except that it doesn't create any visual object. Only update existing ones
//using current Area.Graph data graph.
Area.RelayoutGraph();
zoomctrl.ZoomToFill();
}
void gg_but_randomgraph_Click(object sender, RoutedEventArgs e)
{
//Lets generate configured graph using pre-created data graph assigned to LogicCore object.
//Optionaly we set first method param to True (True by default) so this method will automatically generate edges
// If you want to increase performance in cases where edges don't need to be drawn at first you can set it to False.
// You can also handle edge generation by calling manually Area.GenerateAllEdges() method.
//Optionaly we set second param to True (True by default) so this method will automaticaly checks and assigns missing unique data ids
//for edges and vertices in _dataGraph.
//Note! Area.Graph property will be replaced by supplied _dataGraph object (if any).
Area.GenerateGraph(true, true);
/*
* After graph generation is finished you can apply some additional settings for newly created visual vertex and edge controls
* (VertexControl and EdgeControl classes).
*
*/
//This method sets the dash style for edges. It is applied to all edges in Area.EdgesList. You can also set dash property for
//each edge individually using EdgeControl.DashStyle property.
//For ex.: Area.EdgesList[0].DashStyle = GraphX.EdgeDashStyle.Dash;
Area.SetEdgesDashStyle(EdgeDashStyle.Dash);
//This method sets edges arrows visibility. It is also applied to all edges in Area.EdgesList. You can also set property for
//each edge individually using property, for ex: Area.EdgesList[0].ShowArrows = true;
Area.ShowAllEdgesArrows(true);
//This method sets edges labels visibility. It is also applied to all edges in Area.EdgesList. You can also set property for
//each edge individually using property, for ex: Area.EdgesList[0].ShowLabel = true;
Area.ShowAllEdgesLabels(true);
zoomctrl.ZoomToFill();
}
private GraphExample GraphExample_Setup()
{
//Lets make new data graph instance
var dataGraph = new GraphExample();
//Now we need to create edges and vertices to fill data graph
//This edges and vertices will represent graph structure and connections
//Lets make some vertices
for (int i = 1; i < 10; i++)
{
//Create new vertex with specified Text. Also we will assign custom unique ID.
//This ID is needed for several features such as serialization and edge routing algorithms.
//If you don't need any custom IDs and you are using automatic Area.GenerateGraph() method then you can skip ID assignment
//because specified method automaticaly assigns missing data ids (this behavior controlled by method param).
var dataVertex = new DataVertex("MyVertex " + i);
//Add vertex to data graph
dataGraph.AddVertex(dataVertex);
}
//Now lets make some edges that will connect our vertices
//get the indexed list of graph vertices we have already added
var vlist = dataGraph.Vertices.ToList();
//Then create two edges optionaly defining Text property to show who are connected
var dataEdge = new DataEdge(vlist[0], vlist[1]) { Text = string.Format("{0} -> {1}", vlist[0], vlist[1]) };
dataGraph.AddEdge(dataEdge);
dataEdge = new DataEdge(vlist[2], vlist[3]) { Text = string.Format("{0} -> {1}", vlist[2], vlist[3]) };
dataGraph.AddEdge(dataEdge);
return dataGraph;
}
private void GraphAreaExample_Setup()
{
//Lets create logic core and filled data graph with edges and vertices
var logicCore = new GXLogicCoreExample() { Graph = GraphExample_Setup() };
//This property sets layout algorithm that will be used to calculate vertices positions
//Different algorithms uses different values and some of them uses edge Weight property.
logicCore.DefaultLayoutAlgorithm = LayoutAlgorithmTypeEnum.KK;
//Now we can set parameters for selected algorithm using AlgorithmFactory property. This property provides methods for
//creating all available algorithms and algo parameters.
logicCore.DefaultLayoutAlgorithmParams = logicCore.AlgorithmFactory.CreateLayoutParameters(LayoutAlgorithmTypeEnum.KK);
//Unfortunately to change algo parameters you need to specify params type which is different for every algorithm.
((KKLayoutParameters)logicCore.DefaultLayoutAlgorithmParams).MaxIterations = 100;
//This property sets vertex overlap removal algorithm.
//Such algorithms help to arrange vertices in the layout so no one overlaps each other.
logicCore.DefaultOverlapRemovalAlgorithm = OverlapRemovalAlgorithmTypeEnum.FSA;
//Default parameters are created automaticaly when new default algorithm is set and previous params were NULL
logicCore.DefaultOverlapRemovalAlgorithmParams.HorizontalGap = 50;
logicCore.DefaultOverlapRemovalAlgorithmParams.VerticalGap = 50;
//This property sets edge routing algorithm that is used to build route paths according to algorithm logic.
//For ex., SimpleER algorithm will try to set edge paths around vertices so no edge will intersect any vertex.
//Bundling algorithm will try to tie different edges that follows same direction to a single channel making complex graphs more appealing.
logicCore.DefaultEdgeRoutingAlgorithm = EdgeRoutingAlgorithmTypeEnum.SimpleER;
//This property sets async algorithms computation so methods like: Area.RelayoutGraph() and Area.GenerateGraph()
//will run async with the UI thread. Completion of the specified methods can be catched by corresponding events:
//Area.RelayoutFinished and Area.GenerateGraphFinished.
logicCore.AsyncAlgorithmCompute = false;
//Finally assign logic core to GraphArea object
Area.LogicCore = logicCore;
}
public void Dispose()
{
//If you plan dynamicaly create and destroy GraphArea it is wise to use Dispose() method
//that ensures that all potential memory-holding objects will be released.
Area.Dispose();
}
}
}
| {
"content_hash": "43cdd6ea3b359e0979ed791f70808dae",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 150,
"avg_line_length": 54.4,
"alnum_prop": 0.6739835640138409,
"repo_name": "aliaspilote/TX52",
"id": "72ee63dc6c137a88479d886598adb8dabf3406cd",
"size": "9250",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Modelisator/packages/GraphX-PCL/Examples/SimpleGraph/MainWindow.xaml.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1709790"
},
{
"name": "HTML",
"bytes": "71948"
},
{
"name": "PowerShell",
"bytes": "133"
},
{
"name": "Visual Basic",
"bytes": "15730"
}
],
"symlink_target": ""
} |
@charset "UTF-8";
/*! normalize.css v3.0.1 | MIT License | git.io/normalize */
html {
font-family: sans-serif;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%; }
body {
margin: 0; }
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
nav,
section,
summary {
display: block; }
audio,
canvas,
progress,
video {
display: inline-block;
vertical-align: baseline; }
audio:not([controls]) {
display: none;
height: 0; }
[hidden],
template {
display: none; }
a {
background: transparent; }
a:active,
a:hover {
outline: 0; }
abbr[title] {
border-bottom: 1px dotted; }
b,
strong {
font-weight: bold; }
dfn {
font-style: italic; }
h1 {
font-size: 2em;
margin: 0.67em 0; }
mark {
background: #ff0;
color: #000; }
small {
font-size: 80%; }
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline; }
sup {
top: -0.5em; }
sub {
bottom: -0.25em; }
img {
border: 0; }
svg:not(:root) {
overflow: hidden; }
figure {
margin: 1em 40px; }
hr {
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 0; }
pre {
overflow: auto; }
code,
kbd,
pre,
samp {
font-family: monospace, monospace;
font-size: 1em; }
button,
input,
optgroup,
select,
textarea {
color: inherit;
font: inherit;
margin: 0; }
button {
overflow: visible; }
button,
select {
text-transform: none; }
button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button;
cursor: pointer; }
button[disabled],
html input[disabled] {
cursor: default; }
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0; }
input {
line-height: normal; }
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box;
padding: 0; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
height: auto; }
input[type="search"] {
-webkit-appearance: textfield;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box; }
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none; }
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em; }
legend {
border: 0;
padding: 0; }
textarea {
overflow: auto; }
optgroup {
font-weight: bold; }
table {
border-collapse: collapse;
border-spacing: 0; }
td,
th {
padding: 0; }
@media print {
* {
text-shadow: none !important;
color: #000 !important;
background: transparent !important;
box-shadow: none !important; }
a,
a:visited {
text-decoration: underline; }
a[href]:after {
content: " (" attr(href) ")"; }
abbr[title]:after {
content: " (" attr(title) ")"; }
a[href^="javascript:"]:after,
a[href^="#"]:after {
content: ""; }
pre,
blockquote {
border: 1px solid #999;
page-break-inside: avoid; }
thead {
display: table-header-group; }
tr,
img {
page-break-inside: avoid; }
img {
max-width: 100% !important; }
p,
h2,
h3 {
orphans: 3;
widows: 3; }
h2,
h3 {
page-break-after: avoid; }
select {
background: #fff !important; }
.navbar {
display: none; }
.table td,
.table th {
background-color: #fff !important; }
.btn > .caret,
.dropup > .btn > .caret {
border-top-color: #000 !important; }
.label {
border: 1px solid #000; }
.table {
border-collapse: collapse !important; }
.table-bordered th,
.table-bordered td {
border: 1px solid #ddd !important; } }
@font-face {
font-family: 'Glyphicons Halflings';
src: url("assets/fonts/bootstrap/glyphicons-halflings-regular.eot");
src: url("assets/fonts/bootstrap/glyphicons-halflings-regular.eot?#iefix") format("embedded-opentype"), url("assets/fonts/bootstrap/glyphicons-halflings-regular.woff") format("woff"), url("assets/fonts/bootstrap/glyphicons-halflings-regular.ttf") format("truetype"), url("assets/fonts/bootstrap/glyphicons-halflings-regular.svg#glyphicons_halflingsregular") format("svg"); }
.glyphicon {
position: relative;
top: 1px;
display: inline-block;
font-family: 'Glyphicons Halflings';
font-style: normal;
font-weight: normal;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; }
.glyphicon-asterisk:before {
content: "\2a"; }
.glyphicon-plus:before {
content: "\2b"; }
.glyphicon-euro:before {
content: "\20ac"; }
.glyphicon-minus:before {
content: "\2212"; }
.glyphicon-cloud:before {
content: "\2601"; }
.glyphicon-envelope:before {
content: "\2709"; }
.glyphicon-pencil:before {
content: "\270f"; }
.glyphicon-glass:before {
content: "\e001"; }
.glyphicon-music:before {
content: "\e002"; }
.glyphicon-search:before {
content: "\e003"; }
.glyphicon-heart:before {
content: "\e005"; }
.glyphicon-star:before {
content: "\e006"; }
.glyphicon-star-empty:before {
content: "\e007"; }
.glyphicon-user:before {
content: "\e008"; }
.glyphicon-film:before {
content: "\e009"; }
.glyphicon-th-large:before {
content: "\e010"; }
.glyphicon-th:before {
content: "\e011"; }
.glyphicon-th-list:before {
content: "\e012"; }
.glyphicon-ok:before {
content: "\e013"; }
.glyphicon-remove:before {
content: "\e014"; }
.glyphicon-zoom-in:before {
content: "\e015"; }
.glyphicon-zoom-out:before {
content: "\e016"; }
.glyphicon-off:before {
content: "\e017"; }
.glyphicon-signal:before {
content: "\e018"; }
.glyphicon-cog:before {
content: "\e019"; }
.glyphicon-trash:before {
content: "\e020"; }
.glyphicon-home:before {
content: "\e021"; }
.glyphicon-file:before {
content: "\e022"; }
.glyphicon-time:before {
content: "\e023"; }
.glyphicon-road:before {
content: "\e024"; }
.glyphicon-download-alt:before {
content: "\e025"; }
.glyphicon-download:before {
content: "\e026"; }
.glyphicon-upload:before {
content: "\e027"; }
.glyphicon-inbox:before {
content: "\e028"; }
.glyphicon-play-circle:before {
content: "\e029"; }
.glyphicon-repeat:before {
content: "\e030"; }
.glyphicon-refresh:before {
content: "\e031"; }
.glyphicon-list-alt:before {
content: "\e032"; }
.glyphicon-lock:before {
content: "\e033"; }
.glyphicon-flag:before {
content: "\e034"; }
.glyphicon-headphones:before {
content: "\e035"; }
.glyphicon-volume-off:before {
content: "\e036"; }
.glyphicon-volume-down:before {
content: "\e037"; }
.glyphicon-volume-up:before {
content: "\e038"; }
.glyphicon-qrcode:before {
content: "\e039"; }
.glyphicon-barcode:before {
content: "\e040"; }
.glyphicon-tag:before {
content: "\e041"; }
.glyphicon-tags:before {
content: "\e042"; }
.glyphicon-book:before {
content: "\e043"; }
.glyphicon-bookmark:before {
content: "\e044"; }
.glyphicon-print:before {
content: "\e045"; }
.glyphicon-camera:before {
content: "\e046"; }
.glyphicon-font:before {
content: "\e047"; }
.glyphicon-bold:before {
content: "\e048"; }
.glyphicon-italic:before {
content: "\e049"; }
.glyphicon-text-height:before {
content: "\e050"; }
.glyphicon-text-width:before {
content: "\e051"; }
.glyphicon-align-left:before {
content: "\e052"; }
.glyphicon-align-center:before {
content: "\e053"; }
.glyphicon-align-right:before {
content: "\e054"; }
.glyphicon-align-justify:before {
content: "\e055"; }
.glyphicon-list:before {
content: "\e056"; }
.glyphicon-indent-left:before {
content: "\e057"; }
.glyphicon-indent-right:before {
content: "\e058"; }
.glyphicon-facetime-video:before {
content: "\e059"; }
.glyphicon-picture:before {
content: "\e060"; }
.glyphicon-map-marker:before {
content: "\e062"; }
.glyphicon-adjust:before {
content: "\e063"; }
.glyphicon-tint:before {
content: "\e064"; }
.glyphicon-edit:before {
content: "\e065"; }
.glyphicon-share:before {
content: "\e066"; }
.glyphicon-check:before {
content: "\e067"; }
.glyphicon-move:before {
content: "\e068"; }
.glyphicon-step-backward:before {
content: "\e069"; }
.glyphicon-fast-backward:before {
content: "\e070"; }
.glyphicon-backward:before {
content: "\e071"; }
.glyphicon-play:before {
content: "\e072"; }
.glyphicon-pause:before {
content: "\e073"; }
.glyphicon-stop:before {
content: "\e074"; }
.glyphicon-forward:before {
content: "\e075"; }
.glyphicon-fast-forward:before {
content: "\e076"; }
.glyphicon-step-forward:before {
content: "\e077"; }
.glyphicon-eject:before {
content: "\e078"; }
.glyphicon-chevron-left:before {
content: "\e079"; }
.glyphicon-chevron-right:before {
content: "\e080"; }
.glyphicon-plus-sign:before {
content: "\e081"; }
.glyphicon-minus-sign:before {
content: "\e082"; }
.glyphicon-remove-sign:before {
content: "\e083"; }
.glyphicon-ok-sign:before {
content: "\e084"; }
.glyphicon-question-sign:before {
content: "\e085"; }
.glyphicon-info-sign:before {
content: "\e086"; }
.glyphicon-screenshot:before {
content: "\e087"; }
.glyphicon-remove-circle:before {
content: "\e088"; }
.glyphicon-ok-circle:before {
content: "\e089"; }
.glyphicon-ban-circle:before {
content: "\e090"; }
.glyphicon-arrow-left:before {
content: "\e091"; }
.glyphicon-arrow-right:before {
content: "\e092"; }
.glyphicon-arrow-up:before {
content: "\e093"; }
.glyphicon-arrow-down:before {
content: "\e094"; }
.glyphicon-share-alt:before {
content: "\e095"; }
.glyphicon-resize-full:before {
content: "\e096"; }
.glyphicon-resize-small:before {
content: "\e097"; }
.glyphicon-exclamation-sign:before {
content: "\e101"; }
.glyphicon-gift:before {
content: "\e102"; }
.glyphicon-leaf:before {
content: "\e103"; }
.glyphicon-fire:before {
content: "\e104"; }
.glyphicon-eye-open:before {
content: "\e105"; }
.glyphicon-eye-close:before {
content: "\e106"; }
.glyphicon-warning-sign:before {
content: "\e107"; }
.glyphicon-plane:before {
content: "\e108"; }
.glyphicon-calendar:before {
content: "\e109"; }
.glyphicon-random:before {
content: "\e110"; }
.glyphicon-comment:before {
content: "\e111"; }
.glyphicon-magnet:before {
content: "\e112"; }
.glyphicon-chevron-up:before {
content: "\e113"; }
.glyphicon-chevron-down:before {
content: "\e114"; }
.glyphicon-retweet:before {
content: "\e115"; }
.glyphicon-shopping-cart:before {
content: "\e116"; }
.glyphicon-folder-close:before {
content: "\e117"; }
.glyphicon-folder-open:before {
content: "\e118"; }
.glyphicon-resize-vertical:before {
content: "\e119"; }
.glyphicon-resize-horizontal:before {
content: "\e120"; }
.glyphicon-hdd:before {
content: "\e121"; }
.glyphicon-bullhorn:before {
content: "\e122"; }
.glyphicon-bell:before {
content: "\e123"; }
.glyphicon-certificate:before {
content: "\e124"; }
.glyphicon-thumbs-up:before {
content: "\e125"; }
.glyphicon-thumbs-down:before {
content: "\e126"; }
.glyphicon-hand-right:before {
content: "\e127"; }
.glyphicon-hand-left:before {
content: "\e128"; }
.glyphicon-hand-up:before {
content: "\e129"; }
.glyphicon-hand-down:before {
content: "\e130"; }
.glyphicon-circle-arrow-right:before {
content: "\e131"; }
.glyphicon-circle-arrow-left:before {
content: "\e132"; }
.glyphicon-circle-arrow-up:before {
content: "\e133"; }
.glyphicon-circle-arrow-down:before {
content: "\e134"; }
.glyphicon-globe:before {
content: "\e135"; }
.glyphicon-wrench:before {
content: "\e136"; }
.glyphicon-tasks:before {
content: "\e137"; }
.glyphicon-filter:before {
content: "\e138"; }
.glyphicon-briefcase:before {
content: "\e139"; }
.glyphicon-fullscreen:before {
content: "\e140"; }
.glyphicon-dashboard:before {
content: "\e141"; }
.glyphicon-paperclip:before {
content: "\e142"; }
.glyphicon-heart-empty:before {
content: "\e143"; }
.glyphicon-link:before {
content: "\e144"; }
.glyphicon-phone:before {
content: "\e145"; }
.glyphicon-pushpin:before {
content: "\e146"; }
.glyphicon-usd:before {
content: "\e148"; }
.glyphicon-gbp:before {
content: "\e149"; }
.glyphicon-sort:before {
content: "\e150"; }
.glyphicon-sort-by-alphabet:before {
content: "\e151"; }
.glyphicon-sort-by-alphabet-alt:before {
content: "\e152"; }
.glyphicon-sort-by-order:before {
content: "\e153"; }
.glyphicon-sort-by-order-alt:before {
content: "\e154"; }
.glyphicon-sort-by-attributes:before {
content: "\e155"; }
.glyphicon-sort-by-attributes-alt:before {
content: "\e156"; }
.glyphicon-unchecked:before {
content: "\e157"; }
.glyphicon-expand:before {
content: "\e158"; }
.glyphicon-collapse-down:before {
content: "\e159"; }
.glyphicon-collapse-up:before {
content: "\e160"; }
.glyphicon-log-in:before {
content: "\e161"; }
.glyphicon-flash:before {
content: "\e162"; }
.glyphicon-log-out:before {
content: "\e163"; }
.glyphicon-new-window:before {
content: "\e164"; }
.glyphicon-record:before {
content: "\e165"; }
.glyphicon-save:before {
content: "\e166"; }
.glyphicon-open:before {
content: "\e167"; }
.glyphicon-saved:before {
content: "\e168"; }
.glyphicon-import:before {
content: "\e169"; }
.glyphicon-export:before {
content: "\e170"; }
.glyphicon-send:before {
content: "\e171"; }
.glyphicon-floppy-disk:before {
content: "\e172"; }
.glyphicon-floppy-saved:before {
content: "\e173"; }
.glyphicon-floppy-remove:before {
content: "\e174"; }
.glyphicon-floppy-save:before {
content: "\e175"; }
.glyphicon-floppy-open:before {
content: "\e176"; }
.glyphicon-credit-card:before {
content: "\e177"; }
.glyphicon-transfer:before {
content: "\e178"; }
.glyphicon-cutlery:before {
content: "\e179"; }
.glyphicon-header:before {
content: "\e180"; }
.glyphicon-compressed:before {
content: "\e181"; }
.glyphicon-earphone:before {
content: "\e182"; }
.glyphicon-phone-alt:before {
content: "\e183"; }
.glyphicon-tower:before {
content: "\e184"; }
.glyphicon-stats:before {
content: "\e185"; }
.glyphicon-sd-video:before {
content: "\e186"; }
.glyphicon-hd-video:before {
content: "\e187"; }
.glyphicon-subtitles:before {
content: "\e188"; }
.glyphicon-sound-stereo:before {
content: "\e189"; }
.glyphicon-sound-dolby:before {
content: "\e190"; }
.glyphicon-sound-5-1:before {
content: "\e191"; }
.glyphicon-sound-6-1:before {
content: "\e192"; }
.glyphicon-sound-7-1:before {
content: "\e193"; }
.glyphicon-copyright-mark:before {
content: "\e194"; }
.glyphicon-registration-mark:before {
content: "\e195"; }
.glyphicon-cloud-download:before {
content: "\e197"; }
.glyphicon-cloud-upload:before {
content: "\e198"; }
.glyphicon-tree-conifer:before {
content: "\e199"; }
.glyphicon-tree-deciduous:before {
content: "\e200"; }
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box; }
*:before,
*:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box; }
html {
font-size: 10px;
-webkit-tap-highlight-color: transparent; }
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.42857;
color: #333333;
background-color: #fff; }
input,
button,
select,
textarea {
font-family: inherit;
font-size: inherit;
line-height: inherit; }
a {
color: #428bca;
text-decoration: none; }
a:hover, a:focus {
color: #2a6496;
text-decoration: underline; }
a:focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px; }
figure {
margin: 0; }
img {
vertical-align: middle; }
.img-responsive {
display: block;
width: 100% \9;
max-width: 100%;
height: auto; }
.img-rounded {
border-radius: 6px; }
.img-thumbnail {
padding: 4px;
line-height: 1.42857;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
-webkit-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
display: inline-block;
width: 100% \9;
max-width: 100%;
height: auto; }
.img-circle {
border-radius: 50%; }
hr {
margin-top: 20px;
margin-bottom: 20px;
border: 0;
border-top: 1px solid #eeeeee; }
.sr-only {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0; }
.sr-only-focusable:active, .sr-only-focusable:focus {
position: static;
width: auto;
height: auto;
margin: 0;
overflow: visible;
clip: auto; }
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
font-family: inherit;
font-weight: 500;
line-height: 1.1;
color: inherit; }
h1 small,
h1 .small, h2 small,
h2 .small, h3 small,
h3 .small, h4 small,
h4 .small, h5 small,
h5 .small, h6 small,
h6 .small,
.h1 small,
.h1 .small, .h2 small,
.h2 .small, .h3 small,
.h3 .small, .h4 small,
.h4 .small, .h5 small,
.h5 .small, .h6 small,
.h6 .small {
font-weight: normal;
line-height: 1;
color: #777777; }
h1, .h1,
h2, .h2,
h3, .h3 {
margin-top: 20px;
margin-bottom: 10px; }
h1 small,
h1 .small, .h1 small,
.h1 .small,
h2 small,
h2 .small, .h2 small,
.h2 .small,
h3 small,
h3 .small, .h3 small,
.h3 .small {
font-size: 65%; }
h4, .h4,
h5, .h5,
h6, .h6 {
margin-top: 10px;
margin-bottom: 10px; }
h4 small,
h4 .small, .h4 small,
.h4 .small,
h5 small,
h5 .small, .h5 small,
.h5 .small,
h6 small,
h6 .small, .h6 small,
.h6 .small {
font-size: 75%; }
h1, .h1 {
font-size: 36px; }
h2, .h2 {
font-size: 30px; }
h3, .h3 {
font-size: 24px; }
h4, .h4 {
font-size: 18px; }
h5, .h5 {
font-size: 14px; }
h6, .h6 {
font-size: 12px; }
p {
margin: 0 0 10px; }
.lead {
margin-bottom: 20px;
font-size: 16px;
font-weight: 300;
line-height: 1.4; }
@media (min-width: 768px) {
.lead {
font-size: 21px; } }
small,
.small {
font-size: 85%; }
cite {
font-style: normal; }
mark,
.mark {
background-color: #fcf8e3;
padding: .2em; }
.text-left {
text-align: left; }
.text-right {
text-align: right; }
.text-center {
text-align: center; }
.text-justify {
text-align: justify; }
.text-nowrap {
white-space: nowrap; }
.text-lowercase {
text-transform: lowercase; }
.text-uppercase {
text-transform: uppercase; }
.text-capitalize {
text-transform: capitalize; }
.text-muted {
color: #777777; }
.text-primary {
color: #428bca; }
a.text-primary:hover {
color: #3071a9; }
.text-success {
color: #3c763d; }
a.text-success:hover {
color: #2b542c; }
.text-info {
color: #31708f; }
a.text-info:hover {
color: #245269; }
.text-warning {
color: #8a6d3b; }
a.text-warning:hover {
color: #66512c; }
.text-danger {
color: #a94442; }
a.text-danger:hover {
color: #843534; }
.bg-primary {
color: #fff; }
.bg-primary {
background-color: #428bca; }
a.bg-primary:hover {
background-color: #3071a9; }
.bg-success {
background-color: #dff0d8; }
a.bg-success:hover {
background-color: #c1e2b3; }
.bg-info {
background-color: #d9edf7; }
a.bg-info:hover {
background-color: #afd9ee; }
.bg-warning {
background-color: #fcf8e3; }
a.bg-warning:hover {
background-color: #f7ecb5; }
.bg-danger {
background-color: #f2dede; }
a.bg-danger:hover {
background-color: #e4b9b9; }
.page-header {
padding-bottom: 9px;
margin: 40px 0 20px;
border-bottom: 1px solid #eeeeee; }
ul,
ol {
margin-top: 0;
margin-bottom: 10px; }
ul ul,
ul ol,
ol ul,
ol ol {
margin-bottom: 0; }
.list-unstyled, .list-inline {
padding-left: 0;
list-style: none; }
.list-inline {
margin-left: -5px; }
.list-inline > li {
display: inline-block;
padding-left: 5px;
padding-right: 5px; }
dl {
margin-top: 0;
margin-bottom: 20px; }
dt,
dd {
line-height: 1.42857; }
dt {
font-weight: bold; }
dd {
margin-left: 0; }
.dl-horizontal dd:before, .dl-horizontal dd:after {
content: " ";
display: table; }
.dl-horizontal dd:after {
clear: both; }
@media (min-width: 768px) {
.dl-horizontal dt {
float: left;
width: 160px;
clear: left;
text-align: right;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap; }
.dl-horizontal dd {
margin-left: 180px; } }
abbr[title],
abbr[data-original-title] {
cursor: help;
border-bottom: 1px dotted #777777; }
.initialism {
font-size: 90%;
text-transform: uppercase; }
blockquote {
padding: 10px 20px;
margin: 0 0 20px;
font-size: 17.5px;
border-left: 5px solid #eeeeee; }
blockquote p:last-child,
blockquote ul:last-child,
blockquote ol:last-child {
margin-bottom: 0; }
blockquote footer,
blockquote small,
blockquote .small {
display: block;
font-size: 80%;
line-height: 1.42857;
color: #777777; }
blockquote footer:before,
blockquote small:before,
blockquote .small:before {
content: '\2014 \00A0'; }
.blockquote-reverse,
blockquote.pull-right {
padding-right: 15px;
padding-left: 0;
border-right: 5px solid #eeeeee;
border-left: 0;
text-align: right; }
.blockquote-reverse footer:before,
.blockquote-reverse small:before,
.blockquote-reverse .small:before,
blockquote.pull-right footer:before,
blockquote.pull-right small:before,
blockquote.pull-right .small:before {
content: ''; }
.blockquote-reverse footer:after,
.blockquote-reverse small:after,
.blockquote-reverse .small:after,
blockquote.pull-right footer:after,
blockquote.pull-right small:after,
blockquote.pull-right .small:after {
content: '\00A0 \2014'; }
blockquote:before,
blockquote:after {
content: ""; }
address {
margin-bottom: 20px;
font-style: normal;
line-height: 1.42857; }
code,
kbd,
pre,
samp {
font-family: Menlo, Monaco, Consolas, "Courier New", monospace; }
code {
padding: 2px 4px;
font-size: 90%;
color: #c7254e;
background-color: #f9f2f4;
border-radius: 4px; }
kbd {
padding: 2px 4px;
font-size: 90%;
color: #fff;
background-color: #333;
border-radius: 3px;
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25); }
kbd kbd {
padding: 0;
font-size: 100%;
box-shadow: none; }
pre {
display: block;
padding: 9.5px;
margin: 0 0 10px;
font-size: 13px;
line-height: 1.42857;
word-break: break-all;
word-wrap: break-word;
color: #333333;
background-color: #f5f5f5;
border: 1px solid #ccc;
border-radius: 4px; }
pre code {
padding: 0;
font-size: inherit;
color: inherit;
white-space: pre-wrap;
background-color: transparent;
border-radius: 0; }
.pre-scrollable {
max-height: 340px;
overflow-y: scroll; }
.container {
margin-right: auto;
margin-left: auto;
padding-left: 15px;
padding-right: 15px; }
.container:before, .container:after {
content: " ";
display: table; }
.container:after {
clear: both; }
@media (min-width: 768px) {
.container {
width: 750px; } }
@media (min-width: 992px) {
.container {
width: 970px; } }
@media (min-width: 1200px) {
.container {
width: 1170px; } }
.container-fluid {
margin-right: auto;
margin-left: auto;
padding-left: 15px;
padding-right: 15px; }
.container-fluid:before, .container-fluid:after {
content: " ";
display: table; }
.container-fluid:after {
clear: both; }
.row {
margin-left: -15px;
margin-right: -15px; }
.row:before, .row:after {
content: " ";
display: table; }
.row:after {
clear: both; }
.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {
position: relative;
min-height: 1px;
padding-left: 15px;
padding-right: 15px; }
.col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 {
float: left; }
.col-xs-1 {
width: 8.33333%; }
.col-xs-2 {
width: 16.66667%; }
.col-xs-3 {
width: 25%; }
.col-xs-4 {
width: 33.33333%; }
.col-xs-5 {
width: 41.66667%; }
.col-xs-6 {
width: 50%; }
.col-xs-7 {
width: 58.33333%; }
.col-xs-8 {
width: 66.66667%; }
.col-xs-9 {
width: 75%; }
.col-xs-10 {
width: 83.33333%; }
.col-xs-11 {
width: 91.66667%; }
.col-xs-12 {
width: 100%; }
.col-xs-pull-0 {
right: auto; }
.col-xs-pull-1 {
right: 8.33333%; }
.col-xs-pull-2 {
right: 16.66667%; }
.col-xs-pull-3 {
right: 25%; }
.col-xs-pull-4 {
right: 33.33333%; }
.col-xs-pull-5 {
right: 41.66667%; }
.col-xs-pull-6 {
right: 50%; }
.col-xs-pull-7 {
right: 58.33333%; }
.col-xs-pull-8 {
right: 66.66667%; }
.col-xs-pull-9 {
right: 75%; }
.col-xs-pull-10 {
right: 83.33333%; }
.col-xs-pull-11 {
right: 91.66667%; }
.col-xs-pull-12 {
right: 100%; }
.col-xs-push-0 {
left: auto; }
.col-xs-push-1 {
left: 8.33333%; }
.col-xs-push-2 {
left: 16.66667%; }
.col-xs-push-3 {
left: 25%; }
.col-xs-push-4 {
left: 33.33333%; }
.col-xs-push-5 {
left: 41.66667%; }
.col-xs-push-6 {
left: 50%; }
.col-xs-push-7 {
left: 58.33333%; }
.col-xs-push-8 {
left: 66.66667%; }
.col-xs-push-9 {
left: 75%; }
.col-xs-push-10 {
left: 83.33333%; }
.col-xs-push-11 {
left: 91.66667%; }
.col-xs-push-12 {
left: 100%; }
.col-xs-offset-0 {
margin-left: 0%; }
.col-xs-offset-1 {
margin-left: 8.33333%; }
.col-xs-offset-2 {
margin-left: 16.66667%; }
.col-xs-offset-3 {
margin-left: 25%; }
.col-xs-offset-4 {
margin-left: 33.33333%; }
.col-xs-offset-5 {
margin-left: 41.66667%; }
.col-xs-offset-6 {
margin-left: 50%; }
.col-xs-offset-7 {
margin-left: 58.33333%; }
.col-xs-offset-8 {
margin-left: 66.66667%; }
.col-xs-offset-9 {
margin-left: 75%; }
.col-xs-offset-10 {
margin-left: 83.33333%; }
.col-xs-offset-11 {
margin-left: 91.66667%; }
.col-xs-offset-12 {
margin-left: 100%; }
@media (min-width: 768px) {
.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
float: left; }
.col-sm-1 {
width: 8.33333%; }
.col-sm-2 {
width: 16.66667%; }
.col-sm-3 {
width: 25%; }
.col-sm-4 {
width: 33.33333%; }
.col-sm-5 {
width: 41.66667%; }
.col-sm-6 {
width: 50%; }
.col-sm-7 {
width: 58.33333%; }
.col-sm-8 {
width: 66.66667%; }
.col-sm-9 {
width: 75%; }
.col-sm-10 {
width: 83.33333%; }
.col-sm-11 {
width: 91.66667%; }
.col-sm-12 {
width: 100%; }
.col-sm-pull-0 {
right: auto; }
.col-sm-pull-1 {
right: 8.33333%; }
.col-sm-pull-2 {
right: 16.66667%; }
.col-sm-pull-3 {
right: 25%; }
.col-sm-pull-4 {
right: 33.33333%; }
.col-sm-pull-5 {
right: 41.66667%; }
.col-sm-pull-6 {
right: 50%; }
.col-sm-pull-7 {
right: 58.33333%; }
.col-sm-pull-8 {
right: 66.66667%; }
.col-sm-pull-9 {
right: 75%; }
.col-sm-pull-10 {
right: 83.33333%; }
.col-sm-pull-11 {
right: 91.66667%; }
.col-sm-pull-12 {
right: 100%; }
.col-sm-push-0 {
left: auto; }
.col-sm-push-1 {
left: 8.33333%; }
.col-sm-push-2 {
left: 16.66667%; }
.col-sm-push-3 {
left: 25%; }
.col-sm-push-4 {
left: 33.33333%; }
.col-sm-push-5 {
left: 41.66667%; }
.col-sm-push-6 {
left: 50%; }
.col-sm-push-7 {
left: 58.33333%; }
.col-sm-push-8 {
left: 66.66667%; }
.col-sm-push-9 {
left: 75%; }
.col-sm-push-10 {
left: 83.33333%; }
.col-sm-push-11 {
left: 91.66667%; }
.col-sm-push-12 {
left: 100%; }
.col-sm-offset-0 {
margin-left: 0%; }
.col-sm-offset-1 {
margin-left: 8.33333%; }
.col-sm-offset-2 {
margin-left: 16.66667%; }
.col-sm-offset-3 {
margin-left: 25%; }
.col-sm-offset-4 {
margin-left: 33.33333%; }
.col-sm-offset-5 {
margin-left: 41.66667%; }
.col-sm-offset-6 {
margin-left: 50%; }
.col-sm-offset-7 {
margin-left: 58.33333%; }
.col-sm-offset-8 {
margin-left: 66.66667%; }
.col-sm-offset-9 {
margin-left: 75%; }
.col-sm-offset-10 {
margin-left: 83.33333%; }
.col-sm-offset-11 {
margin-left: 91.66667%; }
.col-sm-offset-12 {
margin-left: 100%; } }
@media (min-width: 992px) {
.col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 {
float: left; }
.col-md-1 {
width: 8.33333%; }
.col-md-2 {
width: 16.66667%; }
.col-md-3 {
width: 25%; }
.col-md-4 {
width: 33.33333%; }
.col-md-5 {
width: 41.66667%; }
.col-md-6 {
width: 50%; }
.col-md-7 {
width: 58.33333%; }
.col-md-8 {
width: 66.66667%; }
.col-md-9 {
width: 75%; }
.col-md-10 {
width: 83.33333%; }
.col-md-11 {
width: 91.66667%; }
.col-md-12 {
width: 100%; }
.col-md-pull-0 {
right: auto; }
.col-md-pull-1 {
right: 8.33333%; }
.col-md-pull-2 {
right: 16.66667%; }
.col-md-pull-3 {
right: 25%; }
.col-md-pull-4 {
right: 33.33333%; }
.col-md-pull-5 {
right: 41.66667%; }
.col-md-pull-6 {
right: 50%; }
.col-md-pull-7 {
right: 58.33333%; }
.col-md-pull-8 {
right: 66.66667%; }
.col-md-pull-9 {
right: 75%; }
.col-md-pull-10 {
right: 83.33333%; }
.col-md-pull-11 {
right: 91.66667%; }
.col-md-pull-12 {
right: 100%; }
.col-md-push-0 {
left: auto; }
.col-md-push-1 {
left: 8.33333%; }
.col-md-push-2 {
left: 16.66667%; }
.col-md-push-3 {
left: 25%; }
.col-md-push-4 {
left: 33.33333%; }
.col-md-push-5 {
left: 41.66667%; }
.col-md-push-6 {
left: 50%; }
.col-md-push-7 {
left: 58.33333%; }
.col-md-push-8 {
left: 66.66667%; }
.col-md-push-9 {
left: 75%; }
.col-md-push-10 {
left: 83.33333%; }
.col-md-push-11 {
left: 91.66667%; }
.col-md-push-12 {
left: 100%; }
.col-md-offset-0 {
margin-left: 0%; }
.col-md-offset-1 {
margin-left: 8.33333%; }
.col-md-offset-2 {
margin-left: 16.66667%; }
.col-md-offset-3 {
margin-left: 25%; }
.col-md-offset-4 {
margin-left: 33.33333%; }
.col-md-offset-5 {
margin-left: 41.66667%; }
.col-md-offset-6 {
margin-left: 50%; }
.col-md-offset-7 {
margin-left: 58.33333%; }
.col-md-offset-8 {
margin-left: 66.66667%; }
.col-md-offset-9 {
margin-left: 75%; }
.col-md-offset-10 {
margin-left: 83.33333%; }
.col-md-offset-11 {
margin-left: 91.66667%; }
.col-md-offset-12 {
margin-left: 100%; } }
@media (min-width: 1200px) {
.col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 {
float: left; }
.col-lg-1 {
width: 8.33333%; }
.col-lg-2 {
width: 16.66667%; }
.col-lg-3 {
width: 25%; }
.col-lg-4 {
width: 33.33333%; }
.col-lg-5 {
width: 41.66667%; }
.col-lg-6 {
width: 50%; }
.col-lg-7 {
width: 58.33333%; }
.col-lg-8 {
width: 66.66667%; }
.col-lg-9 {
width: 75%; }
.col-lg-10 {
width: 83.33333%; }
.col-lg-11 {
width: 91.66667%; }
.col-lg-12 {
width: 100%; }
.col-lg-pull-0 {
right: auto; }
.col-lg-pull-1 {
right: 8.33333%; }
.col-lg-pull-2 {
right: 16.66667%; }
.col-lg-pull-3 {
right: 25%; }
.col-lg-pull-4 {
right: 33.33333%; }
.col-lg-pull-5 {
right: 41.66667%; }
.col-lg-pull-6 {
right: 50%; }
.col-lg-pull-7 {
right: 58.33333%; }
.col-lg-pull-8 {
right: 66.66667%; }
.col-lg-pull-9 {
right: 75%; }
.col-lg-pull-10 {
right: 83.33333%; }
.col-lg-pull-11 {
right: 91.66667%; }
.col-lg-pull-12 {
right: 100%; }
.col-lg-push-0 {
left: auto; }
.col-lg-push-1 {
left: 8.33333%; }
.col-lg-push-2 {
left: 16.66667%; }
.col-lg-push-3 {
left: 25%; }
.col-lg-push-4 {
left: 33.33333%; }
.col-lg-push-5 {
left: 41.66667%; }
.col-lg-push-6 {
left: 50%; }
.col-lg-push-7 {
left: 58.33333%; }
.col-lg-push-8 {
left: 66.66667%; }
.col-lg-push-9 {
left: 75%; }
.col-lg-push-10 {
left: 83.33333%; }
.col-lg-push-11 {
left: 91.66667%; }
.col-lg-push-12 {
left: 100%; }
.col-lg-offset-0 {
margin-left: 0%; }
.col-lg-offset-1 {
margin-left: 8.33333%; }
.col-lg-offset-2 {
margin-left: 16.66667%; }
.col-lg-offset-3 {
margin-left: 25%; }
.col-lg-offset-4 {
margin-left: 33.33333%; }
.col-lg-offset-5 {
margin-left: 41.66667%; }
.col-lg-offset-6 {
margin-left: 50%; }
.col-lg-offset-7 {
margin-left: 58.33333%; }
.col-lg-offset-8 {
margin-left: 66.66667%; }
.col-lg-offset-9 {
margin-left: 75%; }
.col-lg-offset-10 {
margin-left: 83.33333%; }
.col-lg-offset-11 {
margin-left: 91.66667%; }
.col-lg-offset-12 {
margin-left: 100%; } }
table {
background-color: transparent; }
th {
text-align: left; }
.table {
width: 100%;
max-width: 100%;
margin-bottom: 20px; }
.table > thead > tr > th,
.table > thead > tr > td,
.table > tbody > tr > th,
.table > tbody > tr > td,
.table > tfoot > tr > th,
.table > tfoot > tr > td {
padding: 8px;
line-height: 1.42857;
vertical-align: top;
border-top: 1px solid #ddd; }
.table > thead > tr > th {
vertical-align: bottom;
border-bottom: 2px solid #ddd; }
.table > caption + thead > tr:first-child > th,
.table > caption + thead > tr:first-child > td,
.table > colgroup + thead > tr:first-child > th,
.table > colgroup + thead > tr:first-child > td,
.table > thead:first-child > tr:first-child > th,
.table > thead:first-child > tr:first-child > td {
border-top: 0; }
.table > tbody + tbody {
border-top: 2px solid #ddd; }
.table .table {
background-color: #fff; }
.table-condensed > thead > tr > th,
.table-condensed > thead > tr > td,
.table-condensed > tbody > tr > th,
.table-condensed > tbody > tr > td,
.table-condensed > tfoot > tr > th,
.table-condensed > tfoot > tr > td {
padding: 5px; }
.table-bordered {
border: 1px solid #ddd; }
.table-bordered > thead > tr > th,
.table-bordered > thead > tr > td,
.table-bordered > tbody > tr > th,
.table-bordered > tbody > tr > td,
.table-bordered > tfoot > tr > th,
.table-bordered > tfoot > tr > td {
border: 1px solid #ddd; }
.table-bordered > thead > tr > th,
.table-bordered > thead > tr > td {
border-bottom-width: 2px; }
.table-striped > tbody > tr:nth-child(odd) > td,
.table-striped > tbody > tr:nth-child(odd) > th {
background-color: #f9f9f9; }
.table-hover > tbody > tr:hover > td,
.table-hover > tbody > tr:hover > th {
background-color: #f5f5f5; }
table col[class*="col-"] {
position: static;
float: none;
display: table-column; }
table td[class*="col-"],
table th[class*="col-"] {
position: static;
float: none;
display: table-cell; }
.table > thead > tr > td.active,
.table > thead > tr > th.active, .table > thead > tr.active > td, .table > thead > tr.active > th,
.table > tbody > tr > td.active,
.table > tbody > tr > th.active,
.table > tbody > tr.active > td,
.table > tbody > tr.active > th,
.table > tfoot > tr > td.active,
.table > tfoot > tr > th.active,
.table > tfoot > tr.active > td,
.table > tfoot > tr.active > th {
background-color: #f5f5f5; }
.table-hover > tbody > tr > td.active:hover,
.table-hover > tbody > tr > th.active:hover, .table-hover > tbody > tr.active:hover > td, .table-hover > tbody > tr:hover > .active, .table-hover > tbody > tr.active:hover > th {
background-color: #e8e8e8; }
.table > thead > tr > td.success,
.table > thead > tr > th.success, .table > thead > tr.success > td, .table > thead > tr.success > th,
.table > tbody > tr > td.success,
.table > tbody > tr > th.success,
.table > tbody > tr.success > td,
.table > tbody > tr.success > th,
.table > tfoot > tr > td.success,
.table > tfoot > tr > th.success,
.table > tfoot > tr.success > td,
.table > tfoot > tr.success > th {
background-color: #dff0d8; }
.table-hover > tbody > tr > td.success:hover,
.table-hover > tbody > tr > th.success:hover, .table-hover > tbody > tr.success:hover > td, .table-hover > tbody > tr:hover > .success, .table-hover > tbody > tr.success:hover > th {
background-color: #d0e9c6; }
.table > thead > tr > td.info,
.table > thead > tr > th.info, .table > thead > tr.info > td, .table > thead > tr.info > th,
.table > tbody > tr > td.info,
.table > tbody > tr > th.info,
.table > tbody > tr.info > td,
.table > tbody > tr.info > th,
.table > tfoot > tr > td.info,
.table > tfoot > tr > th.info,
.table > tfoot > tr.info > td,
.table > tfoot > tr.info > th {
background-color: #d9edf7; }
.table-hover > tbody > tr > td.info:hover,
.table-hover > tbody > tr > th.info:hover, .table-hover > tbody > tr.info:hover > td, .table-hover > tbody > tr:hover > .info, .table-hover > tbody > tr.info:hover > th {
background-color: #c4e3f3; }
.table > thead > tr > td.warning,
.table > thead > tr > th.warning, .table > thead > tr.warning > td, .table > thead > tr.warning > th,
.table > tbody > tr > td.warning,
.table > tbody > tr > th.warning,
.table > tbody > tr.warning > td,
.table > tbody > tr.warning > th,
.table > tfoot > tr > td.warning,
.table > tfoot > tr > th.warning,
.table > tfoot > tr.warning > td,
.table > tfoot > tr.warning > th {
background-color: #fcf8e3; }
.table-hover > tbody > tr > td.warning:hover,
.table-hover > tbody > tr > th.warning:hover, .table-hover > tbody > tr.warning:hover > td, .table-hover > tbody > tr:hover > .warning, .table-hover > tbody > tr.warning:hover > th {
background-color: #faf2cc; }
.table > thead > tr > td.danger,
.table > thead > tr > th.danger, .table > thead > tr.danger > td, .table > thead > tr.danger > th,
.table > tbody > tr > td.danger,
.table > tbody > tr > th.danger,
.table > tbody > tr.danger > td,
.table > tbody > tr.danger > th,
.table > tfoot > tr > td.danger,
.table > tfoot > tr > th.danger,
.table > tfoot > tr.danger > td,
.table > tfoot > tr.danger > th {
background-color: #f2dede; }
.table-hover > tbody > tr > td.danger:hover,
.table-hover > tbody > tr > th.danger:hover, .table-hover > tbody > tr.danger:hover > td, .table-hover > tbody > tr:hover > .danger, .table-hover > tbody > tr.danger:hover > th {
background-color: #ebcccc; }
@media screen and (max-width: 767px) {
.table-responsive {
width: 100%;
margin-bottom: 15px;
overflow-y: hidden;
overflow-x: auto;
-ms-overflow-style: -ms-autohiding-scrollbar;
border: 1px solid #ddd;
-webkit-overflow-scrolling: touch; }
.table-responsive > .table {
margin-bottom: 0; }
.table-responsive > .table > thead > tr > th,
.table-responsive > .table > thead > tr > td,
.table-responsive > .table > tbody > tr > th,
.table-responsive > .table > tbody > tr > td,
.table-responsive > .table > tfoot > tr > th,
.table-responsive > .table > tfoot > tr > td {
white-space: nowrap; }
.table-responsive > .table-bordered {
border: 0; }
.table-responsive > .table-bordered > thead > tr > th:first-child,
.table-responsive > .table-bordered > thead > tr > td:first-child,
.table-responsive > .table-bordered > tbody > tr > th:first-child,
.table-responsive > .table-bordered > tbody > tr > td:first-child,
.table-responsive > .table-bordered > tfoot > tr > th:first-child,
.table-responsive > .table-bordered > tfoot > tr > td:first-child {
border-left: 0; }
.table-responsive > .table-bordered > thead > tr > th:last-child,
.table-responsive > .table-bordered > thead > tr > td:last-child,
.table-responsive > .table-bordered > tbody > tr > th:last-child,
.table-responsive > .table-bordered > tbody > tr > td:last-child,
.table-responsive > .table-bordered > tfoot > tr > th:last-child,
.table-responsive > .table-bordered > tfoot > tr > td:last-child {
border-right: 0; }
.table-responsive > .table-bordered > tbody > tr:last-child > th,
.table-responsive > .table-bordered > tbody > tr:last-child > td,
.table-responsive > .table-bordered > tfoot > tr:last-child > th,
.table-responsive > .table-bordered > tfoot > tr:last-child > td {
border-bottom: 0; } }
fieldset {
padding: 0;
margin: 0;
border: 0;
min-width: 0; }
legend {
display: block;
width: 100%;
padding: 0;
margin-bottom: 20px;
font-size: 21px;
line-height: inherit;
color: #333333;
border: 0;
border-bottom: 1px solid #e5e5e5; }
label {
display: inline-block;
max-width: 100%;
margin-bottom: 5px;
font-weight: bold; }
input[type="search"] {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box; }
input[type="radio"],
input[type="checkbox"] {
margin: 4px 0 0;
margin-top: 1px \9;
line-height: normal; }
input[type="file"] {
display: block; }
input[type="range"] {
display: block;
width: 100%; }
select[multiple],
select[size] {
height: auto; }
input[type="file"]:focus,
input[type="radio"]:focus,
input[type="checkbox"]:focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px; }
output {
display: block;
padding-top: 7px;
font-size: 14px;
line-height: 1.42857;
color: #555555; }
.form-control {
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857;
color: #555555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
-o-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; }
.form-control:focus {
border-color: #66afe9;
outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); }
.form-control::-moz-placeholder {
color: #777777;
opacity: 1; }
.form-control:-ms-input-placeholder {
color: #777777; }
.form-control::-webkit-input-placeholder {
color: #777777; }
.form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control {
cursor: not-allowed;
background-color: #eeeeee;
opacity: 1; }
textarea.form-control {
height: auto; }
input[type="search"] {
-webkit-appearance: none; }
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"] {
line-height: 34px;
line-height: 1.42857 \0; }
input[type="date"].input-sm, .form-horizontal .form-group-sm input[type="date"].form-control, .input-group-sm > input[type="date"].form-control,
.input-group-sm > input[type="date"].input-group-addon,
.input-group-sm > .input-group-btn > input[type="date"].btn,
input[type="time"].input-sm,
.form-horizontal .form-group-sm input[type="time"].form-control,
.input-group-sm > input[type="time"].form-control,
.input-group-sm > input[type="time"].input-group-addon,
.input-group-sm > .input-group-btn > input[type="time"].btn,
input[type="datetime-local"].input-sm,
.form-horizontal .form-group-sm input[type="datetime-local"].form-control,
.input-group-sm > input[type="datetime-local"].form-control,
.input-group-sm > input[type="datetime-local"].input-group-addon,
.input-group-sm > .input-group-btn > input[type="datetime-local"].btn,
input[type="month"].input-sm,
.form-horizontal .form-group-sm input[type="month"].form-control,
.input-group-sm > input[type="month"].form-control,
.input-group-sm > input[type="month"].input-group-addon,
.input-group-sm > .input-group-btn > input[type="month"].btn {
line-height: 30px; }
input[type="date"].input-lg, .form-horizontal .form-group-lg input[type="date"].form-control, .input-group-lg > input[type="date"].form-control,
.input-group-lg > input[type="date"].input-group-addon,
.input-group-lg > .input-group-btn > input[type="date"].btn,
input[type="time"].input-lg,
.form-horizontal .form-group-lg input[type="time"].form-control,
.input-group-lg > input[type="time"].form-control,
.input-group-lg > input[type="time"].input-group-addon,
.input-group-lg > .input-group-btn > input[type="time"].btn,
input[type="datetime-local"].input-lg,
.form-horizontal .form-group-lg input[type="datetime-local"].form-control,
.input-group-lg > input[type="datetime-local"].form-control,
.input-group-lg > input[type="datetime-local"].input-group-addon,
.input-group-lg > .input-group-btn > input[type="datetime-local"].btn,
input[type="month"].input-lg,
.form-horizontal .form-group-lg input[type="month"].form-control,
.input-group-lg > input[type="month"].form-control,
.input-group-lg > input[type="month"].input-group-addon,
.input-group-lg > .input-group-btn > input[type="month"].btn {
line-height: 46px; }
.form-group {
margin-bottom: 15px; }
.radio,
.checkbox {
position: relative;
display: block;
min-height: 20px;
margin-top: 10px;
margin-bottom: 10px; }
.radio label,
.checkbox label {
padding-left: 20px;
margin-bottom: 0;
font-weight: normal;
cursor: pointer; }
.radio input[type="radio"],
.radio-inline input[type="radio"],
.checkbox input[type="checkbox"],
.checkbox-inline input[type="checkbox"] {
position: absolute;
margin-left: -20px;
margin-top: 4px \9; }
.radio + .radio,
.checkbox + .checkbox {
margin-top: -5px; }
.radio-inline,
.checkbox-inline {
display: inline-block;
padding-left: 20px;
margin-bottom: 0;
vertical-align: middle;
font-weight: normal;
cursor: pointer; }
.radio-inline + .radio-inline,
.checkbox-inline + .checkbox-inline {
margin-top: 0;
margin-left: 10px; }
input[type="radio"][disabled], input[type="radio"].disabled, fieldset[disabled] input[type="radio"],
input[type="checkbox"][disabled],
input[type="checkbox"].disabled, fieldset[disabled]
input[type="checkbox"] {
cursor: not-allowed; }
.radio-inline.disabled, fieldset[disabled] .radio-inline,
.checkbox-inline.disabled, fieldset[disabled]
.checkbox-inline {
cursor: not-allowed; }
.radio.disabled label, fieldset[disabled] .radio label,
.checkbox.disabled label, fieldset[disabled]
.checkbox label {
cursor: not-allowed; }
.form-control-static {
padding-top: 7px;
padding-bottom: 7px;
margin-bottom: 0; }
.form-control-static.input-lg, .form-horizontal .form-group-lg .form-control-static.form-control, .input-group-lg > .form-control-static.form-control,
.input-group-lg > .form-control-static.input-group-addon,
.input-group-lg > .input-group-btn > .form-control-static.btn, .form-control-static.input-sm, .form-horizontal .form-group-sm .form-control-static.form-control, .input-group-sm > .form-control-static.form-control,
.input-group-sm > .form-control-static.input-group-addon,
.input-group-sm > .input-group-btn > .form-control-static.btn {
padding-left: 0;
padding-right: 0; }
.input-sm, .form-horizontal .form-group-sm .form-control, .input-group-sm > .form-control,
.input-group-sm > .input-group-addon,
.input-group-sm > .input-group-btn > .btn {
height: 30px;
padding: 5px 10px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px; }
select.input-sm, .form-horizontal .form-group-sm select.form-control, .input-group-sm > select.form-control,
.input-group-sm > select.input-group-addon,
.input-group-sm > .input-group-btn > select.btn {
height: 30px;
line-height: 30px; }
textarea.input-sm, .form-horizontal .form-group-sm textarea.form-control, .input-group-sm > textarea.form-control,
.input-group-sm > textarea.input-group-addon,
.input-group-sm > .input-group-btn > textarea.btn,
select[multiple].input-sm,
.form-horizontal .form-group-sm select[multiple].form-control,
.input-group-sm > select[multiple].form-control,
.input-group-sm > select[multiple].input-group-addon,
.input-group-sm > .input-group-btn > select[multiple].btn {
height: auto; }
.input-lg, .form-horizontal .form-group-lg .form-control, .input-group-lg > .form-control,
.input-group-lg > .input-group-addon,
.input-group-lg > .input-group-btn > .btn {
height: 46px;
padding: 10px 16px;
font-size: 18px;
line-height: 1.33;
border-radius: 6px; }
select.input-lg, .form-horizontal .form-group-lg select.form-control, .input-group-lg > select.form-control,
.input-group-lg > select.input-group-addon,
.input-group-lg > .input-group-btn > select.btn {
height: 46px;
line-height: 46px; }
textarea.input-lg, .form-horizontal .form-group-lg textarea.form-control, .input-group-lg > textarea.form-control,
.input-group-lg > textarea.input-group-addon,
.input-group-lg > .input-group-btn > textarea.btn,
select[multiple].input-lg,
.form-horizontal .form-group-lg select[multiple].form-control,
.input-group-lg > select[multiple].form-control,
.input-group-lg > select[multiple].input-group-addon,
.input-group-lg > .input-group-btn > select[multiple].btn {
height: auto; }
.has-feedback {
position: relative; }
.has-feedback .form-control {
padding-right: 42.5px; }
.form-control-feedback {
position: absolute;
top: 25px;
right: 0;
z-index: 2;
display: block;
width: 34px;
height: 34px;
line-height: 34px;
text-align: center; }
.input-lg + .form-control-feedback, .form-horizontal .form-group-lg .form-control + .form-control-feedback, .input-group-lg > .form-control + .form-control-feedback,
.input-group-lg > .input-group-addon + .form-control-feedback,
.input-group-lg > .input-group-btn > .btn + .form-control-feedback {
width: 46px;
height: 46px;
line-height: 46px; }
.input-sm + .form-control-feedback, .form-horizontal .form-group-sm .form-control + .form-control-feedback, .input-group-sm > .form-control + .form-control-feedback,
.input-group-sm > .input-group-addon + .form-control-feedback,
.input-group-sm > .input-group-btn > .btn + .form-control-feedback {
width: 30px;
height: 30px;
line-height: 30px; }
.has-success .help-block,
.has-success .control-label,
.has-success .radio,
.has-success .checkbox,
.has-success .radio-inline,
.has-success .checkbox-inline {
color: #3c763d; }
.has-success .form-control {
border-color: #3c763d;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); }
.has-success .form-control:focus {
border-color: #2b542c;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168; }
.has-success .input-group-addon {
color: #3c763d;
border-color: #3c763d;
background-color: #dff0d8; }
.has-success .form-control-feedback {
color: #3c763d; }
.has-warning .help-block,
.has-warning .control-label,
.has-warning .radio,
.has-warning .checkbox,
.has-warning .radio-inline,
.has-warning .checkbox-inline {
color: #8a6d3b; }
.has-warning .form-control {
border-color: #8a6d3b;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); }
.has-warning .form-control:focus {
border-color: #66512c;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b; }
.has-warning .input-group-addon {
color: #8a6d3b;
border-color: #8a6d3b;
background-color: #fcf8e3; }
.has-warning .form-control-feedback {
color: #8a6d3b; }
.has-error .help-block,
.has-error .control-label,
.has-error .radio,
.has-error .checkbox,
.has-error .radio-inline,
.has-error .checkbox-inline {
color: #a94442; }
.has-error .form-control {
border-color: #a94442;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); }
.has-error .form-control:focus {
border-color: #843534;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483; }
.has-error .input-group-addon {
color: #a94442;
border-color: #a94442;
background-color: #f2dede; }
.has-error .form-control-feedback {
color: #a94442; }
.has-feedback label.sr-only ~ .form-control-feedback {
top: 0; }
.help-block {
display: block;
margin-top: 5px;
margin-bottom: 10px;
color: #737373; }
@media (min-width: 768px) {
.form-inline .form-group, .navbar-form .form-group {
display: inline-block;
margin-bottom: 0;
vertical-align: middle; }
.form-inline .form-control, .navbar-form .form-control {
display: inline-block;
width: auto;
vertical-align: middle; }
.form-inline .input-group, .navbar-form .input-group {
display: inline-table;
vertical-align: middle; }
.form-inline .input-group .input-group-addon, .navbar-form .input-group .input-group-addon,
.form-inline .input-group .input-group-btn,
.navbar-form .input-group .input-group-btn,
.form-inline .input-group .form-control,
.navbar-form .input-group .form-control {
width: auto; }
.form-inline .input-group > .form-control, .navbar-form .input-group > .form-control {
width: 100%; }
.form-inline .control-label, .navbar-form .control-label {
margin-bottom: 0;
vertical-align: middle; }
.form-inline .radio, .navbar-form .radio,
.form-inline .checkbox,
.navbar-form .checkbox {
display: inline-block;
margin-top: 0;
margin-bottom: 0;
vertical-align: middle; }
.form-inline .radio label, .navbar-form .radio label,
.form-inline .checkbox label,
.navbar-form .checkbox label {
padding-left: 0; }
.form-inline .radio input[type="radio"], .navbar-form .radio input[type="radio"],
.form-inline .checkbox input[type="checkbox"],
.navbar-form .checkbox input[type="checkbox"] {
position: relative;
margin-left: 0; }
.form-inline .has-feedback .form-control-feedback, .navbar-form .has-feedback .form-control-feedback {
top: 0; } }
.form-horizontal .radio,
.form-horizontal .checkbox,
.form-horizontal .radio-inline,
.form-horizontal .checkbox-inline {
margin-top: 0;
margin-bottom: 0;
padding-top: 7px; }
.form-horizontal .radio,
.form-horizontal .checkbox {
min-height: 27px; }
.form-horizontal .form-group {
margin-left: -15px;
margin-right: -15px; }
.form-horizontal .form-group:before, .form-horizontal .form-group:after {
content: " ";
display: table; }
.form-horizontal .form-group:after {
clear: both; }
@media (min-width: 768px) {
.form-horizontal .control-label {
text-align: right;
margin-bottom: 0;
padding-top: 7px; } }
.form-horizontal .has-feedback .form-control-feedback {
top: 0;
right: 15px; }
@media (min-width: 768px) {
.form-horizontal .form-group-lg .control-label {
padding-top: 14.3px; } }
@media (min-width: 768px) {
.form-horizontal .form-group-sm .control-label {
padding-top: 6px; } }
.btn {
display: inline-block;
margin-bottom: 0;
font-weight: normal;
text-align: center;
vertical-align: middle;
cursor: pointer;
background-image: none;
border: 1px solid transparent;
white-space: nowrap;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857;
border-radius: 4px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none; }
.btn:focus, .btn:active:focus, .btn.active:focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px; }
.btn:hover, .btn:focus {
color: #333;
text-decoration: none; }
.btn:active, .btn.active {
outline: 0;
background-image: none;
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); }
.btn.disabled, .btn[disabled], fieldset[disabled] .btn {
cursor: not-allowed;
pointer-events: none;
opacity: 0.65;
filter: alpha(opacity=65);
-webkit-box-shadow: none;
box-shadow: none; }
.btn-default {
color: #333;
background-color: #fff;
border-color: #ccc; }
.btn-default:hover, .btn-default:focus, .btn-default:active, .btn-default.active, .open > .btn-default.dropdown-toggle {
color: #333;
background-color: #e6e6e6;
border-color: #adadad; }
.btn-default:active, .btn-default.active, .open > .btn-default.dropdown-toggle {
background-image: none; }
.btn-default.disabled, .btn-default.disabled:hover, .btn-default.disabled:focus, .btn-default.disabled:active, .btn-default.disabled.active, .btn-default[disabled], .btn-default[disabled]:hover, .btn-default[disabled]:focus, .btn-default[disabled]:active, .btn-default[disabled].active, fieldset[disabled] .btn-default, fieldset[disabled] .btn-default:hover, fieldset[disabled] .btn-default:focus, fieldset[disabled] .btn-default:active, fieldset[disabled] .btn-default.active {
background-color: #fff;
border-color: #ccc; }
.btn-default .badge {
color: #fff;
background-color: #333; }
.btn-primary {
color: #fff;
background-color: #428bca;
border-color: #357ebd; }
.btn-primary:hover, .btn-primary:focus, .btn-primary:active, .btn-primary.active, .open > .btn-primary.dropdown-toggle {
color: #fff;
background-color: #3071a9;
border-color: #285e8e; }
.btn-primary:active, .btn-primary.active, .open > .btn-primary.dropdown-toggle {
background-image: none; }
.btn-primary.disabled, .btn-primary.disabled:hover, .btn-primary.disabled:focus, .btn-primary.disabled:active, .btn-primary.disabled.active, .btn-primary[disabled], .btn-primary[disabled]:hover, .btn-primary[disabled]:focus, .btn-primary[disabled]:active, .btn-primary[disabled].active, fieldset[disabled] .btn-primary, fieldset[disabled] .btn-primary:hover, fieldset[disabled] .btn-primary:focus, fieldset[disabled] .btn-primary:active, fieldset[disabled] .btn-primary.active {
background-color: #428bca;
border-color: #357ebd; }
.btn-primary .badge {
color: #428bca;
background-color: #fff; }
.btn-success {
color: #fff;
background-color: #5cb85c;
border-color: #4cae4c; }
.btn-success:hover, .btn-success:focus, .btn-success:active, .btn-success.active, .open > .btn-success.dropdown-toggle {
color: #fff;
background-color: #449d44;
border-color: #398439; }
.btn-success:active, .btn-success.active, .open > .btn-success.dropdown-toggle {
background-image: none; }
.btn-success.disabled, .btn-success.disabled:hover, .btn-success.disabled:focus, .btn-success.disabled:active, .btn-success.disabled.active, .btn-success[disabled], .btn-success[disabled]:hover, .btn-success[disabled]:focus, .btn-success[disabled]:active, .btn-success[disabled].active, fieldset[disabled] .btn-success, fieldset[disabled] .btn-success:hover, fieldset[disabled] .btn-success:focus, fieldset[disabled] .btn-success:active, fieldset[disabled] .btn-success.active {
background-color: #5cb85c;
border-color: #4cae4c; }
.btn-success .badge {
color: #5cb85c;
background-color: #fff; }
.btn-info {
color: #fff;
background-color: #5bc0de;
border-color: #46b8da; }
.btn-info:hover, .btn-info:focus, .btn-info:active, .btn-info.active, .open > .btn-info.dropdown-toggle {
color: #fff;
background-color: #31b0d5;
border-color: #269abc; }
.btn-info:active, .btn-info.active, .open > .btn-info.dropdown-toggle {
background-image: none; }
.btn-info.disabled, .btn-info.disabled:hover, .btn-info.disabled:focus, .btn-info.disabled:active, .btn-info.disabled.active, .btn-info[disabled], .btn-info[disabled]:hover, .btn-info[disabled]:focus, .btn-info[disabled]:active, .btn-info[disabled].active, fieldset[disabled] .btn-info, fieldset[disabled] .btn-info:hover, fieldset[disabled] .btn-info:focus, fieldset[disabled] .btn-info:active, fieldset[disabled] .btn-info.active {
background-color: #5bc0de;
border-color: #46b8da; }
.btn-info .badge {
color: #5bc0de;
background-color: #fff; }
.btn-warning {
color: #fff;
background-color: #f0ad4e;
border-color: #eea236; }
.btn-warning:hover, .btn-warning:focus, .btn-warning:active, .btn-warning.active, .open > .btn-warning.dropdown-toggle {
color: #fff;
background-color: #ec971f;
border-color: #d58512; }
.btn-warning:active, .btn-warning.active, .open > .btn-warning.dropdown-toggle {
background-image: none; }
.btn-warning.disabled, .btn-warning.disabled:hover, .btn-warning.disabled:focus, .btn-warning.disabled:active, .btn-warning.disabled.active, .btn-warning[disabled], .btn-warning[disabled]:hover, .btn-warning[disabled]:focus, .btn-warning[disabled]:active, .btn-warning[disabled].active, fieldset[disabled] .btn-warning, fieldset[disabled] .btn-warning:hover, fieldset[disabled] .btn-warning:focus, fieldset[disabled] .btn-warning:active, fieldset[disabled] .btn-warning.active {
background-color: #f0ad4e;
border-color: #eea236; }
.btn-warning .badge {
color: #f0ad4e;
background-color: #fff; }
.btn-danger {
color: #fff;
background-color: #d9534f;
border-color: #d43f3a; }
.btn-danger:hover, .btn-danger:focus, .btn-danger:active, .btn-danger.active, .open > .btn-danger.dropdown-toggle {
color: #fff;
background-color: #c9302c;
border-color: #ac2925; }
.btn-danger:active, .btn-danger.active, .open > .btn-danger.dropdown-toggle {
background-image: none; }
.btn-danger.disabled, .btn-danger.disabled:hover, .btn-danger.disabled:focus, .btn-danger.disabled:active, .btn-danger.disabled.active, .btn-danger[disabled], .btn-danger[disabled]:hover, .btn-danger[disabled]:focus, .btn-danger[disabled]:active, .btn-danger[disabled].active, fieldset[disabled] .btn-danger, fieldset[disabled] .btn-danger:hover, fieldset[disabled] .btn-danger:focus, fieldset[disabled] .btn-danger:active, fieldset[disabled] .btn-danger.active {
background-color: #d9534f;
border-color: #d43f3a; }
.btn-danger .badge {
color: #d9534f;
background-color: #fff; }
.btn-link {
color: #428bca;
font-weight: normal;
cursor: pointer;
border-radius: 0; }
.btn-link, .btn-link:active, .btn-link[disabled], fieldset[disabled] .btn-link {
background-color: transparent;
-webkit-box-shadow: none;
box-shadow: none; }
.btn-link, .btn-link:hover, .btn-link:focus, .btn-link:active {
border-color: transparent; }
.btn-link:hover, .btn-link:focus {
color: #2a6496;
text-decoration: underline;
background-color: transparent; }
.btn-link[disabled]:hover, .btn-link[disabled]:focus, fieldset[disabled] .btn-link:hover, fieldset[disabled] .btn-link:focus {
color: #777777;
text-decoration: none; }
.btn-lg, .btn-group-lg > .btn {
padding: 10px 16px;
font-size: 18px;
line-height: 1.33;
border-radius: 6px; }
.btn-sm, .btn-group-sm > .btn {
padding: 5px 10px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px; }
.btn-xs, .btn-group-xs > .btn {
padding: 1px 5px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px; }
.btn-block {
display: block;
width: 100%; }
.btn-block + .btn-block {
margin-top: 5px; }
input[type="submit"].btn-block,
input[type="reset"].btn-block,
input[type="button"].btn-block {
width: 100%; }
.fade {
opacity: 0;
-webkit-transition: opacity 0.15s linear;
-o-transition: opacity 0.15s linear;
transition: opacity 0.15s linear; }
.fade.in {
opacity: 1; }
.collapse {
display: none; }
.collapse.in {
display: block; }
tr.collapse.in {
display: table-row; }
tbody.collapse.in {
display: table-row-group; }
.collapsing {
position: relative;
height: 0;
overflow: hidden;
-webkit-transition: height 0.35s ease;
-o-transition: height 0.35s ease;
transition: height 0.35s ease; }
.caret {
display: inline-block;
width: 0;
height: 0;
margin-left: 2px;
vertical-align: middle;
border-top: 4px solid;
border-right: 4px solid transparent;
border-left: 4px solid transparent; }
.dropdown {
position: relative; }
.dropdown-toggle:focus {
outline: 0; }
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
padding: 5px 0;
margin: 2px 0 0;
list-style: none;
font-size: 14px;
text-align: left;
background-color: #fff;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
background-clip: padding-box; }
.dropdown-menu.pull-right {
right: 0;
left: auto; }
.dropdown-menu .divider {
height: 1px;
margin: 9px 0;
overflow: hidden;
background-color: #e5e5e5; }
.dropdown-menu > li > a {
display: block;
padding: 3px 20px;
clear: both;
font-weight: normal;
line-height: 1.42857;
color: #333333;
white-space: nowrap; }
.dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus {
text-decoration: none;
color: #262626;
background-color: #f5f5f5; }
.dropdown-menu > .active > a, .dropdown-menu > .active > a:hover, .dropdown-menu > .active > a:focus {
color: #fff;
text-decoration: none;
outline: 0;
background-color: #428bca; }
.dropdown-menu > .disabled > a, .dropdown-menu > .disabled > a:hover, .dropdown-menu > .disabled > a:focus {
color: #777777; }
.dropdown-menu > .disabled > a:hover, .dropdown-menu > .disabled > a:focus {
text-decoration: none;
background-color: transparent;
background-image: none;
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
cursor: not-allowed; }
.open > .dropdown-menu {
display: block; }
.open > a {
outline: 0; }
.dropdown-menu-right {
left: auto;
right: 0; }
.dropdown-menu-left {
left: 0;
right: auto; }
.dropdown-header {
display: block;
padding: 3px 20px;
font-size: 12px;
line-height: 1.42857;
color: #777777;
white-space: nowrap; }
.dropdown-backdrop {
position: fixed;
left: 0;
right: 0;
bottom: 0;
top: 0;
z-index: 990; }
.pull-right > .dropdown-menu {
right: 0;
left: auto; }
.dropup .caret,
.navbar-fixed-bottom .dropdown .caret {
border-top: 0;
border-bottom: 4px solid;
content: ""; }
.dropup .dropdown-menu,
.navbar-fixed-bottom .dropdown .dropdown-menu {
top: auto;
bottom: 100%;
margin-bottom: 1px; }
@media (min-width: 768px) {
.navbar-right .dropdown-menu {
right: 0;
left: auto; }
.navbar-right .dropdown-menu-left {
left: 0;
right: auto; } }
.btn-group,
.btn-group-vertical {
position: relative;
display: inline-block;
vertical-align: middle; }
.btn-group > .btn,
.btn-group-vertical > .btn {
position: relative;
float: left; }
.btn-group > .btn:hover, .btn-group > .btn:focus, .btn-group > .btn:active, .btn-group > .btn.active,
.btn-group-vertical > .btn:hover,
.btn-group-vertical > .btn:focus,
.btn-group-vertical > .btn:active,
.btn-group-vertical > .btn.active {
z-index: 2; }
.btn-group > .btn:focus,
.btn-group-vertical > .btn:focus {
outline: 0; }
.btn-group .btn + .btn,
.btn-group .btn + .btn-group,
.btn-group .btn-group + .btn,
.btn-group .btn-group + .btn-group {
margin-left: -1px; }
.btn-toolbar {
margin-left: -5px; }
.btn-toolbar:before, .btn-toolbar:after {
content: " ";
display: table; }
.btn-toolbar:after {
clear: both; }
.btn-toolbar .btn-group,
.btn-toolbar .input-group {
float: left; }
.btn-toolbar > .btn,
.btn-toolbar > .btn-group,
.btn-toolbar > .input-group {
margin-left: 5px; }
.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {
border-radius: 0; }
.btn-group > .btn:first-child {
margin-left: 0; }
.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) {
border-bottom-right-radius: 0;
border-top-right-radius: 0; }
.btn-group > .btn:last-child:not(:first-child),
.btn-group > .dropdown-toggle:not(:first-child) {
border-bottom-left-radius: 0;
border-top-left-radius: 0; }
.btn-group > .btn-group {
float: left; }
.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn {
border-radius: 0; }
.btn-group > .btn-group:first-child > .btn:last-child,
.btn-group > .btn-group:first-child > .dropdown-toggle {
border-bottom-right-radius: 0;
border-top-right-radius: 0; }
.btn-group > .btn-group:last-child > .btn:first-child {
border-bottom-left-radius: 0;
border-top-left-radius: 0; }
.btn-group .dropdown-toggle:active,
.btn-group.open .dropdown-toggle {
outline: 0; }
.btn-group > .btn + .dropdown-toggle {
padding-left: 8px;
padding-right: 8px; }
.btn-group > .btn-lg + .dropdown-toggle, .btn-group-lg.btn-group > .btn + .dropdown-toggle {
padding-left: 12px;
padding-right: 12px; }
.btn-group.open .dropdown-toggle {
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); }
.btn-group.open .dropdown-toggle.btn-link {
-webkit-box-shadow: none;
box-shadow: none; }
.btn .caret {
margin-left: 0; }
.btn-lg .caret, .btn-group-lg > .btn .caret {
border-width: 5px 5px 0;
border-bottom-width: 0; }
.dropup .btn-lg .caret, .dropup .btn-group-lg > .btn .caret {
border-width: 0 5px 5px; }
.btn-group-vertical > .btn,
.btn-group-vertical > .btn-group,
.btn-group-vertical > .btn-group > .btn {
display: block;
float: none;
width: 100%;
max-width: 100%; }
.btn-group-vertical > .btn-group:before, .btn-group-vertical > .btn-group:after {
content: " ";
display: table; }
.btn-group-vertical > .btn-group:after {
clear: both; }
.btn-group-vertical > .btn-group > .btn {
float: none; }
.btn-group-vertical > .btn + .btn,
.btn-group-vertical > .btn + .btn-group,
.btn-group-vertical > .btn-group + .btn,
.btn-group-vertical > .btn-group + .btn-group {
margin-top: -1px;
margin-left: 0; }
.btn-group-vertical > .btn:not(:first-child):not(:last-child) {
border-radius: 0; }
.btn-group-vertical > .btn:first-child:not(:last-child) {
border-top-right-radius: 4px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0; }
.btn-group-vertical > .btn:last-child:not(:first-child) {
border-bottom-left-radius: 4px;
border-top-right-radius: 0;
border-top-left-radius: 0; }
.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn {
border-radius: 0; }
.btn-group-vertical > .btn-group:first-child:not(:last-child) > .btn:last-child,
.btn-group-vertical > .btn-group:first-child:not(:last-child) > .dropdown-toggle {
border-bottom-right-radius: 0;
border-bottom-left-radius: 0; }
.btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child {
border-top-right-radius: 0;
border-top-left-radius: 0; }
.btn-group-justified {
display: table;
width: 100%;
table-layout: fixed;
border-collapse: separate; }
.btn-group-justified > .btn,
.btn-group-justified > .btn-group {
float: none;
display: table-cell;
width: 1%; }
.btn-group-justified > .btn-group .btn {
width: 100%; }
.btn-group-justified > .btn-group .dropdown-menu {
left: auto; }
[data-toggle="buttons"] > .btn > input[type="radio"],
[data-toggle="buttons"] > .btn > input[type="checkbox"] {
position: absolute;
z-index: -1;
opacity: 0;
filter: alpha(opacity=0); }
.input-group {
position: relative;
display: table;
border-collapse: separate; }
.input-group[class*="col-"] {
float: none;
padding-left: 0;
padding-right: 0; }
.input-group .form-control {
position: relative;
z-index: 2;
float: left;
width: 100%;
margin-bottom: 0; }
.input-group-addon,
.input-group-btn,
.input-group .form-control {
display: table-cell; }
.input-group-addon:not(:first-child):not(:last-child),
.input-group-btn:not(:first-child):not(:last-child),
.input-group .form-control:not(:first-child):not(:last-child) {
border-radius: 0; }
.input-group-addon,
.input-group-btn {
width: 1%;
white-space: nowrap;
vertical-align: middle; }
.input-group-addon {
padding: 6px 12px;
font-size: 14px;
font-weight: normal;
line-height: 1;
color: #555555;
text-align: center;
background-color: #eeeeee;
border: 1px solid #ccc;
border-radius: 4px; }
.input-group-addon.input-sm, .form-horizontal .form-group-sm .input-group-addon.form-control,
.input-group-sm > .input-group-addon,
.input-group-sm > .input-group-btn > .input-group-addon.btn {
padding: 5px 10px;
font-size: 12px;
border-radius: 3px; }
.input-group-addon.input-lg, .form-horizontal .form-group-lg .input-group-addon.form-control,
.input-group-lg > .input-group-addon,
.input-group-lg > .input-group-btn > .input-group-addon.btn {
padding: 10px 16px;
font-size: 18px;
border-radius: 6px; }
.input-group-addon input[type="radio"],
.input-group-addon input[type="checkbox"] {
margin-top: 0; }
.input-group .form-control:first-child,
.input-group-addon:first-child,
.input-group-btn:first-child > .btn,
.input-group-btn:first-child > .btn-group > .btn,
.input-group-btn:first-child > .dropdown-toggle,
.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle),
.input-group-btn:last-child > .btn-group:not(:last-child) > .btn {
border-bottom-right-radius: 0;
border-top-right-radius: 0; }
.input-group-addon:first-child {
border-right: 0; }
.input-group .form-control:last-child,
.input-group-addon:last-child,
.input-group-btn:last-child > .btn,
.input-group-btn:last-child > .btn-group > .btn,
.input-group-btn:last-child > .dropdown-toggle,
.input-group-btn:first-child > .btn:not(:first-child),
.input-group-btn:first-child > .btn-group:not(:first-child) > .btn {
border-bottom-left-radius: 0;
border-top-left-radius: 0; }
.input-group-addon:last-child {
border-left: 0; }
.input-group-btn {
position: relative;
font-size: 0;
white-space: nowrap; }
.input-group-btn > .btn {
position: relative; }
.input-group-btn > .btn + .btn {
margin-left: -1px; }
.input-group-btn > .btn:hover, .input-group-btn > .btn:focus, .input-group-btn > .btn:active {
z-index: 2; }
.input-group-btn:first-child > .btn,
.input-group-btn:first-child > .btn-group {
margin-right: -1px; }
.input-group-btn:last-child > .btn,
.input-group-btn:last-child > .btn-group {
margin-left: -1px; }
.nav {
margin-bottom: 0;
padding-left: 0;
list-style: none; }
.nav:before, .nav:after {
content: " ";
display: table; }
.nav:after {
clear: both; }
.nav > li {
position: relative;
display: block; }
.nav > li > a {
position: relative;
display: block;
padding: 10px 15px; }
.nav > li > a:hover, .nav > li > a:focus {
text-decoration: none;
background-color: #eeeeee; }
.nav > li.disabled > a {
color: #777777; }
.nav > li.disabled > a:hover, .nav > li.disabled > a:focus {
color: #777777;
text-decoration: none;
background-color: transparent;
cursor: not-allowed; }
.nav .open > a, .nav .open > a:hover, .nav .open > a:focus {
background-color: #eeeeee;
border-color: #428bca; }
.nav .nav-divider {
height: 1px;
margin: 9px 0;
overflow: hidden;
background-color: #e5e5e5; }
.nav > li > a > img {
max-width: none; }
.nav-tabs {
border-bottom: 1px solid #ddd; }
.nav-tabs > li {
float: left;
margin-bottom: -1px; }
.nav-tabs > li > a {
margin-right: 2px;
line-height: 1.42857;
border: 1px solid transparent;
border-radius: 4px 4px 0 0; }
.nav-tabs > li > a:hover {
border-color: #eeeeee #eeeeee #ddd; }
.nav-tabs > li.active > a, .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus {
color: #555555;
background-color: #fff;
border: 1px solid #ddd;
border-bottom-color: transparent;
cursor: default; }
.nav-pills > li {
float: left; }
.nav-pills > li > a {
border-radius: 4px; }
.nav-pills > li + li {
margin-left: 2px; }
.nav-pills > li.active > a, .nav-pills > li.active > a:hover, .nav-pills > li.active > a:focus {
color: #fff;
background-color: #428bca; }
.nav-stacked > li {
float: none; }
.nav-stacked > li + li {
margin-top: 2px;
margin-left: 0; }
.nav-justified, .nav-tabs.nav-justified {
width: 100%; }
.nav-justified > li, .nav-tabs.nav-justified > li {
float: none; }
.nav-justified > li > a, .nav-tabs.nav-justified > li > a {
text-align: center;
margin-bottom: 5px; }
.nav-justified > .dropdown .dropdown-menu {
top: auto;
left: auto; }
@media (min-width: 768px) {
.nav-justified > li, .nav-tabs.nav-justified > li {
display: table-cell;
width: 1%; }
.nav-justified > li > a, .nav-tabs.nav-justified > li > a {
margin-bottom: 0; } }
.nav-tabs-justified, .nav-tabs.nav-justified {
border-bottom: 0; }
.nav-tabs-justified > li > a, .nav-tabs.nav-justified > li > a {
margin-right: 0;
border-radius: 4px; }
.nav-tabs-justified > .active > a, .nav-tabs.nav-justified > .active > a,
.nav-tabs-justified > .active > a:hover,
.nav-tabs.nav-justified > .active > a:hover,
.nav-tabs-justified > .active > a:focus,
.nav-tabs.nav-justified > .active > a:focus {
border: 1px solid #ddd; }
@media (min-width: 768px) {
.nav-tabs-justified > li > a, .nav-tabs.nav-justified > li > a {
border-bottom: 1px solid #ddd;
border-radius: 4px 4px 0 0; }
.nav-tabs-justified > .active > a, .nav-tabs.nav-justified > .active > a,
.nav-tabs-justified > .active > a:hover,
.nav-tabs.nav-justified > .active > a:hover,
.nav-tabs-justified > .active > a:focus,
.nav-tabs.nav-justified > .active > a:focus {
border-bottom-color: #fff; } }
.tab-content > .tab-pane {
display: none; }
.tab-content > .active {
display: block; }
.nav-tabs .dropdown-menu {
margin-top: -1px;
border-top-right-radius: 0;
border-top-left-radius: 0; }
.navbar {
position: relative;
min-height: 50px;
margin-bottom: 20px;
border: 1px solid transparent; }
.navbar:before, .navbar:after {
content: " ";
display: table; }
.navbar:after {
clear: both; }
@media (min-width: 768px) {
.navbar {
border-radius: 4px; } }
.navbar-header:before, .navbar-header:after {
content: " ";
display: table; }
.navbar-header:after {
clear: both; }
@media (min-width: 768px) {
.navbar-header {
float: left; } }
.navbar-collapse {
overflow-x: visible;
padding-right: 15px;
padding-left: 15px;
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
-webkit-overflow-scrolling: touch; }
.navbar-collapse:before, .navbar-collapse:after {
content: " ";
display: table; }
.navbar-collapse:after {
clear: both; }
.navbar-collapse.in {
overflow-y: auto; }
@media (min-width: 768px) {
.navbar-collapse {
width: auto;
border-top: 0;
box-shadow: none; }
.navbar-collapse.collapse {
display: block !important;
height: auto !important;
padding-bottom: 0;
overflow: visible !important; }
.navbar-collapse.in {
overflow-y: visible; }
.navbar-fixed-top .navbar-collapse, .navbar-static-top .navbar-collapse, .navbar-fixed-bottom .navbar-collapse {
padding-left: 0;
padding-right: 0; } }
.navbar-fixed-top .navbar-collapse,
.navbar-fixed-bottom .navbar-collapse {
max-height: 340px; }
@media (max-width: 480px) and (orientation: landscape) {
.navbar-fixed-top .navbar-collapse,
.navbar-fixed-bottom .navbar-collapse {
max-height: 200px; } }
.container > .navbar-header,
.container > .navbar-collapse,
.container-fluid > .navbar-header,
.container-fluid > .navbar-collapse {
margin-right: -15px;
margin-left: -15px; }
@media (min-width: 768px) {
.container > .navbar-header,
.container > .navbar-collapse,
.container-fluid > .navbar-header,
.container-fluid > .navbar-collapse {
margin-right: 0;
margin-left: 0; } }
.navbar-static-top {
z-index: 1000;
border-width: 0 0 1px; }
@media (min-width: 768px) {
.navbar-static-top {
border-radius: 0; } }
.navbar-fixed-top,
.navbar-fixed-bottom {
position: fixed;
right: 0;
left: 0;
z-index: 1030;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0); }
@media (min-width: 768px) {
.navbar-fixed-top,
.navbar-fixed-bottom {
border-radius: 0; } }
.navbar-fixed-top {
top: 0;
border-width: 0 0 1px; }
.navbar-fixed-bottom {
bottom: 0;
margin-bottom: 0;
border-width: 1px 0 0; }
.navbar-brand {
float: left;
padding: 15px 15px;
font-size: 18px;
line-height: 20px;
height: 50px; }
.navbar-brand:hover, .navbar-brand:focus {
text-decoration: none; }
@media (min-width: 768px) {
.navbar > .container .navbar-brand, .navbar > .container-fluid .navbar-brand {
margin-left: -15px; } }
.navbar-toggle {
position: relative;
float: right;
margin-right: 15px;
padding: 9px 10px;
margin-top: 8px;
margin-bottom: 8px;
background-color: transparent;
background-image: none;
border: 1px solid transparent;
border-radius: 4px; }
.navbar-toggle:focus {
outline: 0; }
.navbar-toggle .icon-bar {
display: block;
width: 22px;
height: 2px;
border-radius: 1px; }
.navbar-toggle .icon-bar + .icon-bar {
margin-top: 4px; }
@media (min-width: 768px) {
.navbar-toggle {
display: none; } }
.navbar-nav {
margin: 7.5px -15px; }
.navbar-nav > li > a {
padding-top: 10px;
padding-bottom: 10px;
line-height: 20px; }
@media (max-width: 767px) {
.navbar-nav .open .dropdown-menu {
position: static;
float: none;
width: auto;
margin-top: 0;
background-color: transparent;
border: 0;
box-shadow: none; }
.navbar-nav .open .dropdown-menu > li > a,
.navbar-nav .open .dropdown-menu .dropdown-header {
padding: 5px 15px 5px 25px; }
.navbar-nav .open .dropdown-menu > li > a {
line-height: 20px; }
.navbar-nav .open .dropdown-menu > li > a:hover, .navbar-nav .open .dropdown-menu > li > a:focus {
background-image: none; } }
@media (min-width: 768px) {
.navbar-nav {
float: left;
margin: 0; }
.navbar-nav > li {
float: left; }
.navbar-nav > li > a {
padding-top: 15px;
padding-bottom: 15px; }
.navbar-nav.navbar-right:last-child {
margin-right: -15px; } }
@media (min-width: 768px) {
.navbar-left {
float: left !important; }
.navbar-right {
float: right !important; } }
.navbar-form {
margin-left: -15px;
margin-right: -15px;
padding: 10px 15px;
border-top: 1px solid transparent;
border-bottom: 1px solid transparent;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1);
margin-top: 8px;
margin-bottom: 8px; }
@media (max-width: 767px) {
.navbar-form .form-group {
margin-bottom: 5px; } }
@media (min-width: 768px) {
.navbar-form {
width: auto;
border: 0;
margin-left: 0;
margin-right: 0;
padding-top: 0;
padding-bottom: 0;
-webkit-box-shadow: none;
box-shadow: none; }
.navbar-form.navbar-right:last-child {
margin-right: -15px; } }
.navbar-nav > li > .dropdown-menu {
margin-top: 0;
border-top-right-radius: 0;
border-top-left-radius: 0; }
.navbar-fixed-bottom .navbar-nav > li > .dropdown-menu {
border-bottom-right-radius: 0;
border-bottom-left-radius: 0; }
.navbar-btn {
margin-top: 8px;
margin-bottom: 8px; }
.navbar-btn.btn-sm, .btn-group-sm > .navbar-btn.btn {
margin-top: 10px;
margin-bottom: 10px; }
.navbar-btn.btn-xs, .btn-group-xs > .navbar-btn.btn {
margin-top: 14px;
margin-bottom: 14px; }
.navbar-text {
margin-top: 15px;
margin-bottom: 15px; }
@media (min-width: 768px) {
.navbar-text {
float: left;
margin-left: 15px;
margin-right: 15px; }
.navbar-text.navbar-right:last-child {
margin-right: 0; } }
.navbar-default {
background-color: #f8f8f8;
border-color: #e7e7e7; }
.navbar-default .navbar-brand {
color: #777; }
.navbar-default .navbar-brand:hover, .navbar-default .navbar-brand:focus {
color: #5e5e5e;
background-color: transparent; }
.navbar-default .navbar-text {
color: #777; }
.navbar-default .navbar-nav > li > a {
color: #777; }
.navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus {
color: #333;
background-color: transparent; }
.navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:hover, .navbar-default .navbar-nav > .active > a:focus {
color: #555;
background-color: #e7e7e7; }
.navbar-default .navbar-nav > .disabled > a, .navbar-default .navbar-nav > .disabled > a:hover, .navbar-default .navbar-nav > .disabled > a:focus {
color: #ccc;
background-color: transparent; }
.navbar-default .navbar-toggle {
border-color: #ddd; }
.navbar-default .navbar-toggle:hover, .navbar-default .navbar-toggle:focus {
background-color: #ddd; }
.navbar-default .navbar-toggle .icon-bar {
background-color: #888; }
.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
border-color: #e7e7e7; }
.navbar-default .navbar-nav > .open > a, .navbar-default .navbar-nav > .open > a:hover, .navbar-default .navbar-nav > .open > a:focus {
background-color: #e7e7e7;
color: #555; }
@media (max-width: 767px) {
.navbar-default .navbar-nav .open .dropdown-menu > li > a {
color: #777; }
.navbar-default .navbar-nav .open .dropdown-menu > li > a:hover, .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {
color: #333;
background-color: transparent; }
.navbar-default .navbar-nav .open .dropdown-menu > .active > a, .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover, .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #555;
background-color: #e7e7e7; }
.navbar-default .navbar-nav .open .dropdown-menu > .disabled > a, .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:hover, .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:focus {
color: #ccc;
background-color: transparent; } }
.navbar-default .navbar-link {
color: #777; }
.navbar-default .navbar-link:hover {
color: #333; }
.navbar-default .btn-link {
color: #777; }
.navbar-default .btn-link:hover, .navbar-default .btn-link:focus {
color: #333; }
.navbar-default .btn-link[disabled]:hover, .navbar-default .btn-link[disabled]:focus, fieldset[disabled] .navbar-default .btn-link:hover, fieldset[disabled] .navbar-default .btn-link:focus {
color: #ccc; }
.navbar-inverse {
background-color: #222;
border-color: #090909; }
.navbar-inverse .navbar-brand {
color: #777777; }
.navbar-inverse .navbar-brand:hover, .navbar-inverse .navbar-brand:focus {
color: #fff;
background-color: transparent; }
.navbar-inverse .navbar-text {
color: #777777; }
.navbar-inverse .navbar-nav > li > a {
color: #777777; }
.navbar-inverse .navbar-nav > li > a:hover, .navbar-inverse .navbar-nav > li > a:focus {
color: #fff;
background-color: transparent; }
.navbar-inverse .navbar-nav > .active > a, .navbar-inverse .navbar-nav > .active > a:hover, .navbar-inverse .navbar-nav > .active > a:focus {
color: #fff;
background-color: #090909; }
.navbar-inverse .navbar-nav > .disabled > a, .navbar-inverse .navbar-nav > .disabled > a:hover, .navbar-inverse .navbar-nav > .disabled > a:focus {
color: #444;
background-color: transparent; }
.navbar-inverse .navbar-toggle {
border-color: #333; }
.navbar-inverse .navbar-toggle:hover, .navbar-inverse .navbar-toggle:focus {
background-color: #333; }
.navbar-inverse .navbar-toggle .icon-bar {
background-color: #fff; }
.navbar-inverse .navbar-collapse,
.navbar-inverse .navbar-form {
border-color: #101010; }
.navbar-inverse .navbar-nav > .open > a, .navbar-inverse .navbar-nav > .open > a:hover, .navbar-inverse .navbar-nav > .open > a:focus {
background-color: #090909;
color: #fff; }
@media (max-width: 767px) {
.navbar-inverse .navbar-nav .open .dropdown-menu > .dropdown-header {
border-color: #090909; }
.navbar-inverse .navbar-nav .open .dropdown-menu .divider {
background-color: #090909; }
.navbar-inverse .navbar-nav .open .dropdown-menu > li > a {
color: #777777; }
.navbar-inverse .navbar-nav .open .dropdown-menu > li > a:hover, .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:focus {
color: #fff;
background-color: transparent; }
.navbar-inverse .navbar-nav .open .dropdown-menu > .active > a, .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:hover, .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #fff;
background-color: #090909; }
.navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a, .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:hover, .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:focus {
color: #444;
background-color: transparent; } }
.navbar-inverse .navbar-link {
color: #777777; }
.navbar-inverse .navbar-link:hover {
color: #fff; }
.navbar-inverse .btn-link {
color: #777777; }
.navbar-inverse .btn-link:hover, .navbar-inverse .btn-link:focus {
color: #fff; }
.navbar-inverse .btn-link[disabled]:hover, .navbar-inverse .btn-link[disabled]:focus, fieldset[disabled] .navbar-inverse .btn-link:hover, fieldset[disabled] .navbar-inverse .btn-link:focus {
color: #444; }
.breadcrumb {
padding: 8px 15px;
margin-bottom: 20px;
list-style: none;
background-color: #f5f5f5;
border-radius: 4px; }
.breadcrumb > li {
display: inline-block; }
.breadcrumb > li + li:before {
content: "/ ";
padding: 0 5px;
color: #ccc; }
.breadcrumb > .active {
color: #777777; }
.pagination {
display: inline-block;
padding-left: 0;
margin: 20px 0;
border-radius: 4px; }
.pagination > li {
display: inline; }
.pagination > li > a,
.pagination > li > span {
position: relative;
float: left;
padding: 6px 12px;
line-height: 1.42857;
text-decoration: none;
color: #428bca;
background-color: #fff;
border: 1px solid #ddd;
margin-left: -1px; }
.pagination > li:first-child > a,
.pagination > li:first-child > span {
margin-left: 0;
border-bottom-left-radius: 4px;
border-top-left-radius: 4px; }
.pagination > li:last-child > a,
.pagination > li:last-child > span {
border-bottom-right-radius: 4px;
border-top-right-radius: 4px; }
.pagination > li > a:hover, .pagination > li > a:focus,
.pagination > li > span:hover,
.pagination > li > span:focus {
color: #2a6496;
background-color: #eeeeee;
border-color: #ddd; }
.pagination > .active > a, .pagination > .active > a:hover, .pagination > .active > a:focus,
.pagination > .active > span,
.pagination > .active > span:hover,
.pagination > .active > span:focus {
z-index: 2;
color: #fff;
background-color: #428bca;
border-color: #428bca;
cursor: default; }
.pagination > .disabled > span,
.pagination > .disabled > span:hover,
.pagination > .disabled > span:focus,
.pagination > .disabled > a,
.pagination > .disabled > a:hover,
.pagination > .disabled > a:focus {
color: #777777;
background-color: #fff;
border-color: #ddd;
cursor: not-allowed; }
.pagination-lg > li > a,
.pagination-lg > li > span {
padding: 10px 16px;
font-size: 18px; }
.pagination-lg > li:first-child > a,
.pagination-lg > li:first-child > span {
border-bottom-left-radius: 6px;
border-top-left-radius: 6px; }
.pagination-lg > li:last-child > a,
.pagination-lg > li:last-child > span {
border-bottom-right-radius: 6px;
border-top-right-radius: 6px; }
.pagination-sm > li > a,
.pagination-sm > li > span {
padding: 5px 10px;
font-size: 12px; }
.pagination-sm > li:first-child > a,
.pagination-sm > li:first-child > span {
border-bottom-left-radius: 3px;
border-top-left-radius: 3px; }
.pagination-sm > li:last-child > a,
.pagination-sm > li:last-child > span {
border-bottom-right-radius: 3px;
border-top-right-radius: 3px; }
.pager {
padding-left: 0;
margin: 20px 0;
list-style: none;
text-align: center; }
.pager:before, .pager:after {
content: " ";
display: table; }
.pager:after {
clear: both; }
.pager li {
display: inline; }
.pager li > a,
.pager li > span {
display: inline-block;
padding: 5px 14px;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 15px; }
.pager li > a:hover,
.pager li > a:focus {
text-decoration: none;
background-color: #eeeeee; }
.pager .next > a,
.pager .next > span {
float: right; }
.pager .previous > a,
.pager .previous > span {
float: left; }
.pager .disabled > a,
.pager .disabled > a:hover,
.pager .disabled > a:focus,
.pager .disabled > span {
color: #777777;
background-color: #fff;
cursor: not-allowed; }
.label {
display: inline;
padding: .2em .6em .3em;
font-size: 75%;
font-weight: bold;
line-height: 1;
color: #fff;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25em; }
.label:empty {
display: none; }
.btn .label {
position: relative;
top: -1px; }
a.label:hover, a.label:focus {
color: #fff;
text-decoration: none;
cursor: pointer; }
.label-default {
background-color: #777777; }
.label-default[href]:hover, .label-default[href]:focus {
background-color: #5e5e5e; }
.label-primary {
background-color: #428bca; }
.label-primary[href]:hover, .label-primary[href]:focus {
background-color: #3071a9; }
.label-success {
background-color: #5cb85c; }
.label-success[href]:hover, .label-success[href]:focus {
background-color: #449d44; }
.label-info {
background-color: #5bc0de; }
.label-info[href]:hover, .label-info[href]:focus {
background-color: #31b0d5; }
.label-warning {
background-color: #f0ad4e; }
.label-warning[href]:hover, .label-warning[href]:focus {
background-color: #ec971f; }
.label-danger {
background-color: #d9534f; }
.label-danger[href]:hover, .label-danger[href]:focus {
background-color: #c9302c; }
.badge {
display: inline-block;
min-width: 10px;
padding: 3px 7px;
font-size: 12px;
font-weight: bold;
color: #fff;
line-height: 1;
vertical-align: baseline;
white-space: nowrap;
text-align: center;
background-color: #777777;
border-radius: 10px; }
.badge:empty {
display: none; }
.btn .badge {
position: relative;
top: -1px; }
.btn-xs .badge, .btn-group-xs > .btn .badge {
top: 0;
padding: 1px 5px; }
a.list-group-item.active > .badge, .nav-pills > .active > a > .badge {
color: #428bca;
background-color: #fff; }
.nav-pills > li > a > .badge {
margin-left: 3px; }
a.badge:hover, a.badge:focus {
color: #fff;
text-decoration: none;
cursor: pointer; }
.jumbotron {
padding: 30px;
margin-bottom: 30px;
color: inherit;
background-color: #eeeeee; }
.jumbotron h1,
.jumbotron .h1 {
color: inherit; }
.jumbotron p {
margin-bottom: 15px;
font-size: 21px;
font-weight: 200; }
.jumbotron > hr {
border-top-color: #d5d5d5; }
.container .jumbotron {
border-radius: 6px; }
.jumbotron .container {
max-width: 100%; }
@media screen and (min-width: 768px) {
.jumbotron {
padding-top: 48px;
padding-bottom: 48px; }
.container .jumbotron {
padding-left: 60px;
padding-right: 60px; }
.jumbotron h1,
.jumbotron .h1 {
font-size: 63px; } }
.thumbnail {
display: block;
padding: 4px;
margin-bottom: 20px;
line-height: 1.42857;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
-webkit-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out; }
.thumbnail > img,
.thumbnail a > img {
display: block;
width: 100% \9;
max-width: 100%;
height: auto;
margin-left: auto;
margin-right: auto; }
.thumbnail .caption {
padding: 9px;
color: #333333; }
a.thumbnail:hover,
a.thumbnail:focus,
a.thumbnail.active {
border-color: #428bca; }
.alert {
padding: 15px;
margin-bottom: 20px;
border: 1px solid transparent;
border-radius: 4px; }
.alert h4 {
margin-top: 0;
color: inherit; }
.alert .alert-link {
font-weight: bold; }
.alert > p,
.alert > ul {
margin-bottom: 0; }
.alert > p + p {
margin-top: 5px; }
.alert-dismissable,
.alert-dismissible {
padding-right: 35px; }
.alert-dismissable .close,
.alert-dismissible .close {
position: relative;
top: -2px;
right: -21px;
color: inherit; }
.alert-success {
background-color: #dff0d8;
border-color: #d6e9c6;
color: #3c763d; }
.alert-success hr {
border-top-color: #c9e2b3; }
.alert-success .alert-link {
color: #2b542c; }
.alert-info {
background-color: #d9edf7;
border-color: #bce8f1;
color: #31708f; }
.alert-info hr {
border-top-color: #a6e1ec; }
.alert-info .alert-link {
color: #245269; }
.alert-warning {
background-color: #fcf8e3;
border-color: #faebcc;
color: #8a6d3b; }
.alert-warning hr {
border-top-color: #f7e1b5; }
.alert-warning .alert-link {
color: #66512c; }
.alert-danger {
background-color: #f2dede;
border-color: #ebccd1;
color: #a94442; }
.alert-danger hr {
border-top-color: #e4b9c0; }
.alert-danger .alert-link {
color: #843534; }
@-webkit-keyframes progress-bar-stripes {
from {
background-position: 40px 0; }
to {
background-position: 0 0; } }
@keyframes progress-bar-stripes {
from {
background-position: 40px 0; }
to {
background-position: 0 0; } }
.progress {
overflow: hidden;
height: 20px;
margin-bottom: 20px;
background-color: #f5f5f5;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); }
.progress-bar {
float: left;
width: 0%;
height: 100%;
font-size: 12px;
line-height: 20px;
color: #fff;
text-align: center;
background-color: #428bca;
-webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
-webkit-transition: width 0.6s ease;
-o-transition: width 0.6s ease;
transition: width 0.6s ease; }
.progress-striped .progress-bar,
.progress-bar-striped {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-size: 40px 40px; }
.progress.active .progress-bar,
.progress-bar.active {
-webkit-animation: progress-bar-stripes 2s linear infinite;
-o-animation: progress-bar-stripes 2s linear infinite;
animation: progress-bar-stripes 2s linear infinite; }
.progress-bar[aria-valuenow="1"], .progress-bar[aria-valuenow="2"] {
min-width: 30px; }
.progress-bar[aria-valuenow="0"] {
color: #777777;
min-width: 30px;
background-color: transparent;
background-image: none;
box-shadow: none; }
.progress-bar-success {
background-color: #5cb85c; }
.progress-striped .progress-bar-success {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); }
.progress-bar-info {
background-color: #5bc0de; }
.progress-striped .progress-bar-info {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); }
.progress-bar-warning {
background-color: #f0ad4e; }
.progress-striped .progress-bar-warning {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); }
.progress-bar-danger {
background-color: #d9534f; }
.progress-striped .progress-bar-danger {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); }
.media,
.media-body {
overflow: hidden;
zoom: 1; }
.media,
.media .media {
margin-top: 15px; }
.media:first-child {
margin-top: 0; }
.media-object {
display: block; }
.media-heading {
margin: 0 0 5px; }
.media > .pull-left {
margin-right: 10px; }
.media > .pull-right {
margin-left: 10px; }
.media-list {
padding-left: 0;
list-style: none; }
.list-group {
margin-bottom: 20px;
padding-left: 0; }
.list-group-item {
position: relative;
display: block;
padding: 10px 15px;
margin-bottom: -1px;
background-color: #fff;
border: 1px solid #ddd; }
.list-group-item:first-child {
border-top-right-radius: 4px;
border-top-left-radius: 4px; }
.list-group-item:last-child {
margin-bottom: 0;
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px; }
.list-group-item > .badge {
float: right; }
.list-group-item > .badge + .badge {
margin-right: 5px; }
a.list-group-item {
color: #555; }
a.list-group-item .list-group-item-heading {
color: #333; }
a.list-group-item:hover, a.list-group-item:focus {
text-decoration: none;
color: #555;
background-color: #f5f5f5; }
.list-group-item.disabled, .list-group-item.disabled:hover, .list-group-item.disabled:focus {
background-color: #eeeeee;
color: #777777; }
.list-group-item.disabled .list-group-item-heading, .list-group-item.disabled:hover .list-group-item-heading, .list-group-item.disabled:focus .list-group-item-heading {
color: inherit; }
.list-group-item.disabled .list-group-item-text, .list-group-item.disabled:hover .list-group-item-text, .list-group-item.disabled:focus .list-group-item-text {
color: #777777; }
.list-group-item.active, .list-group-item.active:hover, .list-group-item.active:focus {
z-index: 2;
color: #fff;
background-color: #428bca;
border-color: #428bca; }
.list-group-item.active .list-group-item-heading,
.list-group-item.active .list-group-item-heading > small,
.list-group-item.active .list-group-item-heading > .small, .list-group-item.active:hover .list-group-item-heading,
.list-group-item.active:hover .list-group-item-heading > small,
.list-group-item.active:hover .list-group-item-heading > .small, .list-group-item.active:focus .list-group-item-heading,
.list-group-item.active:focus .list-group-item-heading > small,
.list-group-item.active:focus .list-group-item-heading > .small {
color: inherit; }
.list-group-item.active .list-group-item-text, .list-group-item.active:hover .list-group-item-text, .list-group-item.active:focus .list-group-item-text {
color: #e1edf7; }
.list-group-item-success {
color: #3c763d;
background-color: #dff0d8; }
a.list-group-item-success {
color: #3c763d; }
a.list-group-item-success .list-group-item-heading {
color: inherit; }
a.list-group-item-success:hover, a.list-group-item-success:focus {
color: #3c763d;
background-color: #d0e9c6; }
a.list-group-item-success.active, a.list-group-item-success.active:hover, a.list-group-item-success.active:focus {
color: #fff;
background-color: #3c763d;
border-color: #3c763d; }
.list-group-item-info {
color: #31708f;
background-color: #d9edf7; }
a.list-group-item-info {
color: #31708f; }
a.list-group-item-info .list-group-item-heading {
color: inherit; }
a.list-group-item-info:hover, a.list-group-item-info:focus {
color: #31708f;
background-color: #c4e3f3; }
a.list-group-item-info.active, a.list-group-item-info.active:hover, a.list-group-item-info.active:focus {
color: #fff;
background-color: #31708f;
border-color: #31708f; }
.list-group-item-warning {
color: #8a6d3b;
background-color: #fcf8e3; }
a.list-group-item-warning {
color: #8a6d3b; }
a.list-group-item-warning .list-group-item-heading {
color: inherit; }
a.list-group-item-warning:hover, a.list-group-item-warning:focus {
color: #8a6d3b;
background-color: #faf2cc; }
a.list-group-item-warning.active, a.list-group-item-warning.active:hover, a.list-group-item-warning.active:focus {
color: #fff;
background-color: #8a6d3b;
border-color: #8a6d3b; }
.list-group-item-danger {
color: #a94442;
background-color: #f2dede; }
a.list-group-item-danger {
color: #a94442; }
a.list-group-item-danger .list-group-item-heading {
color: inherit; }
a.list-group-item-danger:hover, a.list-group-item-danger:focus {
color: #a94442;
background-color: #ebcccc; }
a.list-group-item-danger.active, a.list-group-item-danger.active:hover, a.list-group-item-danger.active:focus {
color: #fff;
background-color: #a94442;
border-color: #a94442; }
.list-group-item-heading {
margin-top: 0;
margin-bottom: 5px; }
.list-group-item-text {
margin-bottom: 0;
line-height: 1.3; }
.panel {
margin-bottom: 20px;
background-color: #fff;
border: 1px solid transparent;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05); }
.panel-body {
padding: 15px; }
.panel-body:before, .panel-body:after {
content: " ";
display: table; }
.panel-body:after {
clear: both; }
.panel-heading {
padding: 10px 15px;
border-bottom: 1px solid transparent;
border-top-right-radius: 3px;
border-top-left-radius: 3px; }
.panel-heading > .dropdown .dropdown-toggle {
color: inherit; }
.panel-title {
margin-top: 0;
margin-bottom: 0;
font-size: 16px;
color: inherit; }
.panel-title > a {
color: inherit; }
.panel-footer {
padding: 10px 15px;
background-color: #f5f5f5;
border-top: 1px solid #ddd;
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px; }
.panel > .list-group {
margin-bottom: 0; }
.panel > .list-group .list-group-item {
border-width: 1px 0;
border-radius: 0; }
.panel > .list-group:first-child .list-group-item:first-child {
border-top: 0;
border-top-right-radius: 3px;
border-top-left-radius: 3px; }
.panel > .list-group:last-child .list-group-item:last-child {
border-bottom: 0;
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px; }
.panel-heading + .list-group .list-group-item:first-child {
border-top-width: 0; }
.list-group + .panel-footer {
border-top-width: 0; }
.panel > .table,
.panel > .table-responsive > .table,
.panel > .panel-collapse > .table {
margin-bottom: 0; }
.panel > .table:first-child,
.panel > .table-responsive:first-child > .table:first-child {
border-top-right-radius: 3px;
border-top-left-radius: 3px; }
.panel > .table:first-child > thead:first-child > tr:first-child td:first-child,
.panel > .table:first-child > thead:first-child > tr:first-child th:first-child,
.panel > .table:first-child > tbody:first-child > tr:first-child td:first-child,
.panel > .table:first-child > tbody:first-child > tr:first-child th:first-child,
.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:first-child,
.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:first-child,
.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:first-child,
.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:first-child {
border-top-left-radius: 3px; }
.panel > .table:first-child > thead:first-child > tr:first-child td:last-child,
.panel > .table:first-child > thead:first-child > tr:first-child th:last-child,
.panel > .table:first-child > tbody:first-child > tr:first-child td:last-child,
.panel > .table:first-child > tbody:first-child > tr:first-child th:last-child,
.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:last-child,
.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:last-child,
.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:last-child,
.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child {
border-top-right-radius: 3px; }
.panel > .table:last-child,
.panel > .table-responsive:last-child > .table:last-child {
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px; }
.panel > .table:last-child > tbody:last-child > tr:last-child td:first-child,
.panel > .table:last-child > tbody:last-child > tr:last-child th:first-child,
.panel > .table:last-child > tfoot:last-child > tr:last-child td:first-child,
.panel > .table:last-child > tfoot:last-child > tr:last-child th:first-child,
.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:first-child,
.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:first-child,
.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:first-child,
.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:first-child {
border-bottom-left-radius: 3px; }
.panel > .table:last-child > tbody:last-child > tr:last-child td:last-child,
.panel > .table:last-child > tbody:last-child > tr:last-child th:last-child,
.panel > .table:last-child > tfoot:last-child > tr:last-child td:last-child,
.panel > .table:last-child > tfoot:last-child > tr:last-child th:last-child,
.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:last-child,
.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:last-child,
.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:last-child,
.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child {
border-bottom-right-radius: 3px; }
.panel > .panel-body + .table,
.panel > .panel-body + .table-responsive {
border-top: 1px solid #ddd; }
.panel > .table > tbody:first-child > tr:first-child th,
.panel > .table > tbody:first-child > tr:first-child td {
border-top: 0; }
.panel > .table-bordered,
.panel > .table-responsive > .table-bordered {
border: 0; }
.panel > .table-bordered > thead > tr > th:first-child,
.panel > .table-bordered > thead > tr > td:first-child,
.panel > .table-bordered > tbody > tr > th:first-child,
.panel > .table-bordered > tbody > tr > td:first-child,
.panel > .table-bordered > tfoot > tr > th:first-child,
.panel > .table-bordered > tfoot > tr > td:first-child,
.panel > .table-responsive > .table-bordered > thead > tr > th:first-child,
.panel > .table-responsive > .table-bordered > thead > tr > td:first-child,
.panel > .table-responsive > .table-bordered > tbody > tr > th:first-child,
.panel > .table-responsive > .table-bordered > tbody > tr > td:first-child,
.panel > .table-responsive > .table-bordered > tfoot > tr > th:first-child,
.panel > .table-responsive > .table-bordered > tfoot > tr > td:first-child {
border-left: 0; }
.panel > .table-bordered > thead > tr > th:last-child,
.panel > .table-bordered > thead > tr > td:last-child,
.panel > .table-bordered > tbody > tr > th:last-child,
.panel > .table-bordered > tbody > tr > td:last-child,
.panel > .table-bordered > tfoot > tr > th:last-child,
.panel > .table-bordered > tfoot > tr > td:last-child,
.panel > .table-responsive > .table-bordered > thead > tr > th:last-child,
.panel > .table-responsive > .table-bordered > thead > tr > td:last-child,
.panel > .table-responsive > .table-bordered > tbody > tr > th:last-child,
.panel > .table-responsive > .table-bordered > tbody > tr > td:last-child,
.panel > .table-responsive > .table-bordered > tfoot > tr > th:last-child,
.panel > .table-responsive > .table-bordered > tfoot > tr > td:last-child {
border-right: 0; }
.panel > .table-bordered > thead > tr:first-child > td,
.panel > .table-bordered > thead > tr:first-child > th,
.panel > .table-bordered > tbody > tr:first-child > td,
.panel > .table-bordered > tbody > tr:first-child > th,
.panel > .table-responsive > .table-bordered > thead > tr:first-child > td,
.panel > .table-responsive > .table-bordered > thead > tr:first-child > th,
.panel > .table-responsive > .table-bordered > tbody > tr:first-child > td,
.panel > .table-responsive > .table-bordered > tbody > tr:first-child > th {
border-bottom: 0; }
.panel > .table-bordered > tbody > tr:last-child > td,
.panel > .table-bordered > tbody > tr:last-child > th,
.panel > .table-bordered > tfoot > tr:last-child > td,
.panel > .table-bordered > tfoot > tr:last-child > th,
.panel > .table-responsive > .table-bordered > tbody > tr:last-child > td,
.panel > .table-responsive > .table-bordered > tbody > tr:last-child > th,
.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > td,
.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > th {
border-bottom: 0; }
.panel > .table-responsive {
border: 0;
margin-bottom: 0; }
.panel-group {
margin-bottom: 20px; }
.panel-group .panel {
margin-bottom: 0;
border-radius: 4px; }
.panel-group .panel + .panel {
margin-top: 5px; }
.panel-group .panel-heading {
border-bottom: 0; }
.panel-group .panel-heading + .panel-collapse > .panel-body {
border-top: 1px solid #ddd; }
.panel-group .panel-footer {
border-top: 0; }
.panel-group .panel-footer + .panel-collapse .panel-body {
border-bottom: 1px solid #ddd; }
.panel-default {
border-color: #ddd; }
.panel-default > .panel-heading {
color: #333333;
background-color: #f5f5f5;
border-color: #ddd; }
.panel-default > .panel-heading + .panel-collapse > .panel-body {
border-top-color: #ddd; }
.panel-default > .panel-heading .badge {
color: #f5f5f5;
background-color: #333333; }
.panel-default > .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #ddd; }
.panel-primary {
border-color: #428bca; }
.panel-primary > .panel-heading {
color: #fff;
background-color: #428bca;
border-color: #428bca; }
.panel-primary > .panel-heading + .panel-collapse > .panel-body {
border-top-color: #428bca; }
.panel-primary > .panel-heading .badge {
color: #428bca;
background-color: #fff; }
.panel-primary > .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #428bca; }
.panel-success {
border-color: #d6e9c6; }
.panel-success > .panel-heading {
color: #3c763d;
background-color: #dff0d8;
border-color: #d6e9c6; }
.panel-success > .panel-heading + .panel-collapse > .panel-body {
border-top-color: #d6e9c6; }
.panel-success > .panel-heading .badge {
color: #dff0d8;
background-color: #3c763d; }
.panel-success > .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #d6e9c6; }
.panel-info {
border-color: #bce8f1; }
.panel-info > .panel-heading {
color: #31708f;
background-color: #d9edf7;
border-color: #bce8f1; }
.panel-info > .panel-heading + .panel-collapse > .panel-body {
border-top-color: #bce8f1; }
.panel-info > .panel-heading .badge {
color: #d9edf7;
background-color: #31708f; }
.panel-info > .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #bce8f1; }
.panel-warning {
border-color: #faebcc; }
.panel-warning > .panel-heading {
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #faebcc; }
.panel-warning > .panel-heading + .panel-collapse > .panel-body {
border-top-color: #faebcc; }
.panel-warning > .panel-heading .badge {
color: #fcf8e3;
background-color: #8a6d3b; }
.panel-warning > .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #faebcc; }
.panel-danger {
border-color: #ebccd1; }
.panel-danger > .panel-heading {
color: #a94442;
background-color: #f2dede;
border-color: #ebccd1; }
.panel-danger > .panel-heading + .panel-collapse > .panel-body {
border-top-color: #ebccd1; }
.panel-danger > .panel-heading .badge {
color: #f2dede;
background-color: #a94442; }
.panel-danger > .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #ebccd1; }
.embed-responsive {
position: relative;
display: block;
height: 0;
padding: 0;
overflow: hidden; }
.embed-responsive .embed-responsive-item,
.embed-responsive iframe,
.embed-responsive embed,
.embed-responsive object {
position: absolute;
top: 0;
left: 0;
bottom: 0;
height: 100%;
width: 100%;
border: 0; }
.embed-responsive.embed-responsive-16by9 {
padding-bottom: 56.25%; }
.embed-responsive.embed-responsive-4by3 {
padding-bottom: 75%; }
.well {
min-height: 20px;
padding: 19px;
margin-bottom: 20px;
background-color: #f5f5f5;
border: 1px solid #e3e3e3;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); }
.well blockquote {
border-color: #ddd;
border-color: rgba(0, 0, 0, 0.15); }
.well-lg {
padding: 24px;
border-radius: 6px; }
.well-sm {
padding: 9px;
border-radius: 3px; }
.close {
float: right;
font-size: 21px;
font-weight: bold;
line-height: 1;
color: #000;
text-shadow: 0 1px 0 #fff;
opacity: 0.2;
filter: alpha(opacity=20); }
.close:hover, .close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
opacity: 0.5;
filter: alpha(opacity=50); }
button.close {
padding: 0;
cursor: pointer;
background: transparent;
border: 0;
-webkit-appearance: none; }
.modal-open {
overflow: hidden; }
.modal {
display: none;
overflow: hidden;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1050;
-webkit-overflow-scrolling: touch;
outline: 0; }
.modal.fade .modal-dialog {
-webkit-transform: translate3d(0, -25%, 0);
transform: translate3d(0, -25%, 0);
-webkit-transition: -webkit-transform 0.3s ease-out;
-moz-transition: -moz-transform 0.3s ease-out;
-o-transition: -o-transform 0.3s ease-out;
transition: transform 0.3s ease-out; }
.modal.in .modal-dialog {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0); }
.modal-open .modal {
overflow-x: hidden;
overflow-y: auto; }
.modal-dialog {
position: relative;
width: auto;
margin: 10px; }
.modal-content {
position: relative;
background-color: #fff;
border: 1px solid #999;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 6px;
-webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
background-clip: padding-box;
outline: 0; }
.modal-backdrop {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1040;
background-color: #000; }
.modal-backdrop.fade {
opacity: 0;
filter: alpha(opacity=0); }
.modal-backdrop.in {
opacity: 0.5;
filter: alpha(opacity=50); }
.modal-header {
padding: 15px;
border-bottom: 1px solid #e5e5e5;
min-height: 16.42857px; }
.modal-header .close {
margin-top: -2px; }
.modal-title {
margin: 0;
line-height: 1.42857; }
.modal-body {
position: relative;
padding: 15px; }
.modal-footer {
padding: 15px;
text-align: right;
border-top: 1px solid #e5e5e5; }
.modal-footer:before, .modal-footer:after {
content: " ";
display: table; }
.modal-footer:after {
clear: both; }
.modal-footer .btn + .btn {
margin-left: 5px;
margin-bottom: 0; }
.modal-footer .btn-group .btn + .btn {
margin-left: -1px; }
.modal-footer .btn-block + .btn-block {
margin-left: 0; }
.modal-scrollbar-measure {
position: absolute;
top: -9999px;
width: 50px;
height: 50px;
overflow: scroll; }
@media (min-width: 768px) {
.modal-dialog {
width: 600px;
margin: 30px auto; }
.modal-content {
-webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); }
.modal-sm {
width: 300px; } }
@media (min-width: 992px) {
.modal-lg {
width: 900px; } }
.tooltip {
position: absolute;
z-index: 1070;
display: block;
visibility: visible;
font-size: 12px;
line-height: 1.4;
opacity: 0;
filter: alpha(opacity=0); }
.tooltip.in {
opacity: 0.9;
filter: alpha(opacity=90); }
.tooltip.top {
margin-top: -3px;
padding: 5px 0; }
.tooltip.right {
margin-left: 3px;
padding: 0 5px; }
.tooltip.bottom {
margin-top: 3px;
padding: 5px 0; }
.tooltip.left {
margin-left: -3px;
padding: 0 5px; }
.tooltip-inner {
max-width: 200px;
padding: 3px 8px;
color: #fff;
text-align: center;
text-decoration: none;
background-color: #000;
border-radius: 4px; }
.tooltip-arrow {
position: absolute;
width: 0;
height: 0;
border-color: transparent;
border-style: solid; }
.tooltip.top .tooltip-arrow {
bottom: 0;
left: 50%;
margin-left: -5px;
border-width: 5px 5px 0;
border-top-color: #000; }
.tooltip.top-left .tooltip-arrow {
bottom: 0;
left: 5px;
border-width: 5px 5px 0;
border-top-color: #000; }
.tooltip.top-right .tooltip-arrow {
bottom: 0;
right: 5px;
border-width: 5px 5px 0;
border-top-color: #000; }
.tooltip.right .tooltip-arrow {
top: 50%;
left: 0;
margin-top: -5px;
border-width: 5px 5px 5px 0;
border-right-color: #000; }
.tooltip.left .tooltip-arrow {
top: 50%;
right: 0;
margin-top: -5px;
border-width: 5px 0 5px 5px;
border-left-color: #000; }
.tooltip.bottom .tooltip-arrow {
top: 0;
left: 50%;
margin-left: -5px;
border-width: 0 5px 5px;
border-bottom-color: #000; }
.tooltip.bottom-left .tooltip-arrow {
top: 0;
left: 5px;
border-width: 0 5px 5px;
border-bottom-color: #000; }
.tooltip.bottom-right .tooltip-arrow {
top: 0;
right: 5px;
border-width: 0 5px 5px;
border-bottom-color: #000; }
.popover {
position: absolute;
top: 0;
left: 0;
z-index: 1060;
display: none;
max-width: 276px;
padding: 1px;
text-align: left;
background-color: #fff;
background-clip: padding-box;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 6px;
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
white-space: normal; }
.popover.top {
margin-top: -10px; }
.popover.right {
margin-left: 10px; }
.popover.bottom {
margin-top: 10px; }
.popover.left {
margin-left: -10px; }
.popover-title {
margin: 0;
padding: 8px 14px;
font-size: 14px;
font-weight: normal;
line-height: 18px;
background-color: #f7f7f7;
border-bottom: 1px solid #ebebeb;
border-radius: 5px 5px 0 0; }
.popover-content {
padding: 9px 14px; }
.popover > .arrow, .popover > .arrow:after {
position: absolute;
display: block;
width: 0;
height: 0;
border-color: transparent;
border-style: solid; }
.popover > .arrow {
border-width: 11px; }
.popover > .arrow:after {
border-width: 10px;
content: ""; }
.popover.top > .arrow {
left: 50%;
margin-left: -11px;
border-bottom-width: 0;
border-top-color: #999999;
border-top-color: rgba(0, 0, 0, 0.25);
bottom: -11px; }
.popover.top > .arrow:after {
content: " ";
bottom: 1px;
margin-left: -10px;
border-bottom-width: 0;
border-top-color: #fff; }
.popover.right > .arrow {
top: 50%;
left: -11px;
margin-top: -11px;
border-left-width: 0;
border-right-color: #999999;
border-right-color: rgba(0, 0, 0, 0.25); }
.popover.right > .arrow:after {
content: " ";
left: 1px;
bottom: -10px;
border-left-width: 0;
border-right-color: #fff; }
.popover.bottom > .arrow {
left: 50%;
margin-left: -11px;
border-top-width: 0;
border-bottom-color: #999999;
border-bottom-color: rgba(0, 0, 0, 0.25);
top: -11px; }
.popover.bottom > .arrow:after {
content: " ";
top: 1px;
margin-left: -10px;
border-top-width: 0;
border-bottom-color: #fff; }
.popover.left > .arrow {
top: 50%;
right: -11px;
margin-top: -11px;
border-right-width: 0;
border-left-color: #999999;
border-left-color: rgba(0, 0, 0, 0.25); }
.popover.left > .arrow:after {
content: " ";
right: 1px;
border-right-width: 0;
border-left-color: #fff;
bottom: -10px; }
.carousel {
position: relative; }
.carousel-inner {
position: relative;
overflow: hidden;
width: 100%; }
.carousel-inner > .item {
display: none;
position: relative;
-webkit-transition: 0.6s ease-in-out left;
-o-transition: 0.6s ease-in-out left;
transition: 0.6s ease-in-out left; }
.carousel-inner > .item > img,
.carousel-inner > .item > a > img {
display: block;
width: 100% \9;
max-width: 100%;
height: auto;
line-height: 1; }
.carousel-inner > .active,
.carousel-inner > .next,
.carousel-inner > .prev {
display: block; }
.carousel-inner > .active {
left: 0; }
.carousel-inner > .next,
.carousel-inner > .prev {
position: absolute;
top: 0;
width: 100%; }
.carousel-inner > .next {
left: 100%; }
.carousel-inner > .prev {
left: -100%; }
.carousel-inner > .next.left,
.carousel-inner > .prev.right {
left: 0; }
.carousel-inner > .active.left {
left: -100%; }
.carousel-inner > .active.right {
left: 100%; }
.carousel-control {
position: absolute;
top: 0;
left: 0;
bottom: 0;
width: 15%;
opacity: 0.5;
filter: alpha(opacity=50);
font-size: 20px;
color: #fff;
text-align: center;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.carousel-control.left {
background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%);
background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%);
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1); }
.carousel-control.right {
left: auto;
right: 0;
background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%);
background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%);
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1); }
.carousel-control:hover, .carousel-control:focus {
outline: 0;
color: #fff;
text-decoration: none;
opacity: 0.9;
filter: alpha(opacity=90); }
.carousel-control .icon-prev,
.carousel-control .icon-next,
.carousel-control .glyphicon-chevron-left,
.carousel-control .glyphicon-chevron-right {
position: absolute;
top: 50%;
z-index: 5;
display: inline-block; }
.carousel-control .icon-prev,
.carousel-control .glyphicon-chevron-left {
left: 50%;
margin-left: -10px; }
.carousel-control .icon-next,
.carousel-control .glyphicon-chevron-right {
right: 50%;
margin-right: -10px; }
.carousel-control .icon-prev,
.carousel-control .icon-next {
width: 20px;
height: 20px;
margin-top: -10px;
font-family: serif; }
.carousel-control .icon-prev:before {
content: '\2039'; }
.carousel-control .icon-next:before {
content: '\203a'; }
.carousel-indicators {
position: absolute;
bottom: 10px;
left: 50%;
z-index: 15;
width: 60%;
margin-left: -30%;
padding-left: 0;
list-style: none;
text-align: center; }
.carousel-indicators li {
display: inline-block;
width: 10px;
height: 10px;
margin: 1px;
text-indent: -999px;
border: 1px solid #fff;
border-radius: 10px;
cursor: pointer;
background-color: #000 \9;
background-color: transparent; }
.carousel-indicators .active {
margin: 0;
width: 12px;
height: 12px;
background-color: #fff; }
.carousel-caption {
position: absolute;
left: 15%;
right: 15%;
bottom: 20px;
z-index: 10;
padding-top: 20px;
padding-bottom: 20px;
color: #fff;
text-align: center;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.carousel-caption .btn {
text-shadow: none; }
@media screen and (min-width: 768px) {
.carousel-control .glyphicon-chevron-left,
.carousel-control .glyphicon-chevron-right,
.carousel-control .icon-prev,
.carousel-control .icon-next {
width: 30px;
height: 30px;
margin-top: -15px;
font-size: 30px; }
.carousel-control .glyphicon-chevron-left,
.carousel-control .icon-prev {
margin-left: -15px; }
.carousel-control .glyphicon-chevron-right,
.carousel-control .icon-next {
margin-right: -15px; }
.carousel-caption {
left: 20%;
right: 20%;
padding-bottom: 30px; }
.carousel-indicators {
bottom: 20px; } }
.clearfix:before, .clearfix:after {
content: " ";
display: table; }
.clearfix:after {
clear: both; }
.center-block {
display: block;
margin-left: auto;
margin-right: auto; }
.pull-right {
float: right !important; }
.pull-left {
float: left !important; }
.hide {
display: none !important; }
.show {
display: block !important; }
.invisible {
visibility: hidden; }
.text-hide {
font: 0/0 a;
color: transparent;
text-shadow: none;
background-color: transparent;
border: 0; }
.hidden {
display: none !important;
visibility: hidden !important; }
.affix {
position: fixed;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0); }
@-ms-viewport {
width: device-width; }
.visible-xs, .visible-sm, .visible-md, .visible-lg {
display: none !important; }
.visible-xs-block,
.visible-xs-inline,
.visible-xs-inline-block,
.visible-sm-block,
.visible-sm-inline,
.visible-sm-inline-block,
.visible-md-block,
.visible-md-inline,
.visible-md-inline-block,
.visible-lg-block,
.visible-lg-inline,
.visible-lg-inline-block {
display: none !important; }
@media (max-width: 767px) {
.visible-xs {
display: block !important; }
table.visible-xs {
display: table; }
tr.visible-xs {
display: table-row !important; }
th.visible-xs,
td.visible-xs {
display: table-cell !important; } }
@media (max-width: 767px) {
.visible-xs-block {
display: block !important; } }
@media (max-width: 767px) {
.visible-xs-inline {
display: inline !important; } }
@media (max-width: 767px) {
.visible-xs-inline-block {
display: inline-block !important; } }
@media (min-width: 768px) and (max-width: 991px) {
.visible-sm {
display: block !important; }
table.visible-sm {
display: table; }
tr.visible-sm {
display: table-row !important; }
th.visible-sm,
td.visible-sm {
display: table-cell !important; } }
@media (min-width: 768px) and (max-width: 991px) {
.visible-sm-block {
display: block !important; } }
@media (min-width: 768px) and (max-width: 991px) {
.visible-sm-inline {
display: inline !important; } }
@media (min-width: 768px) and (max-width: 991px) {
.visible-sm-inline-block {
display: inline-block !important; } }
@media (min-width: 992px) and (max-width: 1199px) {
.visible-md {
display: block !important; }
table.visible-md {
display: table; }
tr.visible-md {
display: table-row !important; }
th.visible-md,
td.visible-md {
display: table-cell !important; } }
@media (min-width: 992px) and (max-width: 1199px) {
.visible-md-block {
display: block !important; } }
@media (min-width: 992px) and (max-width: 1199px) {
.visible-md-inline {
display: inline !important; } }
@media (min-width: 992px) and (max-width: 1199px) {
.visible-md-inline-block {
display: inline-block !important; } }
@media (min-width: 1200px) {
.visible-lg {
display: block !important; }
table.visible-lg {
display: table; }
tr.visible-lg {
display: table-row !important; }
th.visible-lg,
td.visible-lg {
display: table-cell !important; } }
@media (min-width: 1200px) {
.visible-lg-block {
display: block !important; } }
@media (min-width: 1200px) {
.visible-lg-inline {
display: inline !important; } }
@media (min-width: 1200px) {
.visible-lg-inline-block {
display: inline-block !important; } }
@media (max-width: 767px) {
.hidden-xs {
display: none !important; } }
@media (min-width: 768px) and (max-width: 991px) {
.hidden-sm {
display: none !important; } }
@media (min-width: 992px) and (max-width: 1199px) {
.hidden-md {
display: none !important; } }
@media (min-width: 1200px) {
.hidden-lg {
display: none !important; } }
.visible-print {
display: none !important; }
@media print {
.visible-print {
display: block !important; }
table.visible-print {
display: table; }
tr.visible-print {
display: table-row !important; }
th.visible-print,
td.visible-print {
display: table-cell !important; } }
.visible-print-block {
display: none !important; }
@media print {
.visible-print-block {
display: block !important; } }
.visible-print-inline {
display: none !important; }
@media print {
.visible-print-inline {
display: inline !important; } }
.visible-print-inline-block {
display: none !important; }
@media print {
.visible-print-inline-block {
display: inline-block !important; } }
@media print {
.hidden-print {
display: none !important; } }
.interval {
background-color: black;
position: relative; }
.interval h1 {
margin: 0;
background-color: #222;
font-weight: 500;
font-size: 25px;
padding: 10px 0;
color: #dddddd; }
.interval .timer {
text-align: center;
font-size: 200px;
color: white; }
.interval .pause {
width: 50px;
height: 50px;
background-color: #333;
position: absolute;
bottom: 20px;
right: 20px;
border-radius: 50%; }
.interval .pause .icon-pause {
margin: 15px auto;
height: 20px;
width: 14px;
border-left: 4px solid white;
border-right: 4px solid white; }
.session-list {
padding: 40px 0; }
.session-list ul {
list-style: none;
margin: 0;
padding: 0; }
.session-list li {
margin: 20px auto 0;
position: relative;
max-width: 600px;
height: 70px; }
.session-list .time, .session-list .activity {
width: 45%;
position: absolute;
height: 50px;
transform: translateY(15px); }
.session-list .time {
color: #666;
vertical-align: middle;
display: inline-block;
text-align: right;
font-size: 16px;
line-height: 12px;
padding-right: 20px;
left: 0; }
.session-list .icon-clock {
background-color: orangered;
width: 50px;
height: 50px;
display: inline-block;
border-radius: 50%;
position: absolute;
left: 50%;
margin-left: -25px; }
.session-list .icon-clock:before {
content: ' ';
display: block;
width: 1px;
height: 30px;
position: absolute;
top: -35px;
left: 50%;
background-color: #ccc; }
.session-list .activity {
vertical-align: middle;
display: block;
font-weight: 700;
padding-left: 20px;
right: 0;
text-align: left; }
.session-list small {
font-size: 11px;
color: #333; }
.back {
position: absolute;
top: 15px;
left: 10px;
z-index: 2; }
.sessions-list ul {
list-style: none;
margin: 0;
padding: 0; }
.sessions-list ul li {
clear: both;
margin: 20px auto 0;
position: relative;
max-width: 300px; }
.sessions-list .duration {
width: 100px;
height: 100px;
background-color: #000;
color: #fff;
float: left;
font-size: 30px;
position: relative;
margin-bottom: 20px;
border-radius: 5px; }
.sessions-list .duration h2 {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
margin: 0; }
.sessions-list .duration h2 span {
display: block;
font-size: 15px; }
.sessions-list .wrapper {
float: left;
text-align: left;
position: relative;
min-height: 100px;
margin-left: 20px; }
.sessions-list .wrapper .inner-wrapper {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%); }
body {
text-align: center;
color: #222;
font-family: "Helvetic Neue", Helvetica, Arial; }
* {
box-sizing: border-box; }
.welcome {
width: 300px;
height: 510px;
position: absolute;
left: 50%;
top: 50%;
margin-left: -150px;
margin-top: -255px; }
a, a:visited {
text-decoration: none; }
/*# sourceMappingURL=app.css.map */
| {
"content_hash": "1c262c8f8fdbf8199e91f0c1ed1652dd",
"timestamp": "",
"source": "github",
"line_count": 5439,
"max_line_length": 540,
"avg_line_length": 25.871116013973158,
"alnum_prop": 0.635996674081286,
"repo_name": "jeffboulay/interval-trainer",
"id": "3bfc2d30aebdc3f2deb78d5738f51cc782f81540",
"size": "140714",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/styles/app.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "148060"
},
{
"name": "HTML",
"bytes": "2437"
},
{
"name": "JavaScript",
"bytes": "35037"
}
],
"symlink_target": ""
} |
from __future__ import absolute_import
import six
from time import time
from sentry.exceptions import InvalidConfiguration
from sentry.ratelimits.base import RateLimiter
from sentry.utils.hashlib import md5_text
from sentry.utils.redis import get_cluster_from_options
class RedisRateLimiter(RateLimiter):
window = 60
def __init__(self, **options):
self.cluster, options = get_cluster_from_options('SENTRY_RATELIMITER_OPTIONS', options)
def validate(self):
try:
with self.cluster.all() as client:
client.ping()
except Exception as e:
raise InvalidConfiguration(six.text_type(e))
def is_limited(self, key, limit, project=None, window=None):
if window is None:
window = self.window
key_hex = md5_text(key).hexdigest()
bucket = int(time() / window)
if project:
key = 'rl:%s:%s:%s' % (key_hex, project.id, bucket)
else:
key = 'rl:%s:%s' % (key_hex, bucket)
with self.cluster.map() as client:
result = client.incr(key)
client.expire(key, window)
return result.value > limit
| {
"content_hash": "9b4e11ee48e82deb03b0a9abbee9f821",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 95,
"avg_line_length": 28,
"alnum_prop": 0.6215986394557823,
"repo_name": "JackDanger/sentry",
"id": "e7aaeea90eec21e56476ac45b90befd1de7c5dc5",
"size": "1176",
"binary": false,
"copies": "10",
"ref": "refs/heads/master",
"path": "src/sentry/ratelimits/redis.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "583430"
},
{
"name": "HTML",
"bytes": "319622"
},
{
"name": "JavaScript",
"bytes": "624672"
},
{
"name": "Makefile",
"bytes": "2660"
},
{
"name": "Python",
"bytes": "6279717"
}
],
"symlink_target": ""
} |
"""Constants for Owlet component."""
SENSOR_OXYGEN_LEVEL = "oxygen_level"
SENSOR_HEART_RATE = "heart_rate"
SENSOR_BASE_STATION = "base_station_on"
SENSOR_MOVEMENT = "movement"
| {
"content_hash": "be807533f3c309c0d18281824c54e7ef",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 39,
"avg_line_length": 29.5,
"alnum_prop": 0.7344632768361582,
"repo_name": "Cinntax/home-assistant",
"id": "f145100dbc41bd43aa9a140f178ee61c8e75f09a",
"size": "177",
"binary": false,
"copies": "5",
"ref": "refs/heads/dev",
"path": "homeassistant/components/owlet/const.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "17374056"
},
{
"name": "Shell",
"bytes": "6792"
}
],
"symlink_target": ""
} |
find_path( GEOS_INCLUDE_DIR geos/geom/Geometry.h
PATHS
/usr/include
/usr/local/include
/usr/local/ossim/include )
# Find GEOS library:
find_library( GEOS_LIB NAMES geos
PATHS
/usr/lib64
/usr/lib
/usr/local/lib
/usr/local/ossim/lib )
# Find GEOS C library:
find_library( GEOS_C_LIB NAMES geos_c
PATHS
/usr/lib64
/usr/lib
/usr/local/lib
/usr/local/ossim/lib )
# Set the GEOS_LIBRARY:
if( GEOS_LIB AND GEOS_C_LIB )
set( GEOS_LIBRARY ${GEOS_LIB} ${GEOS_C_LIB} CACHE STRING INTERNAL )
endif(GEOS_LIB AND GEOS_C_LIB )
#---
# This function sets GEOS_FOUND if variables are valid.
#---
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args( GEOS DEFAULT_MSG
GEOS_LIBRARY
GEOS_INCLUDE_DIR )
if( GEOS_FOUND )
if( NOT GEOS_FIND_QUIETLY )
message( STATUS "Found GEOS..." )
endif( NOT GEOS_FIND_QUIETLY )
else( GEOS_FOUND )
if( NOT GEOS_FIND_QUIETLY )
message( WARNING "Could not find GEOS" )
endif( NOT GEOS_FIND_QUIETLY )
endif( GEOS_FOUND )
if( NOT GEOS_FIND_QUIETLY )
message( STATUS "GEOS_INCLUDE_DIR=${GEOS_INCLUDE_DIR}" )
message( STATUS "GEOS_LIBRARY=${GEOS_LIBRARY}" )
endif( NOT GEOS_FIND_QUIETLY )
| {
"content_hash": "e391459ed03d073051f84233998d5fe1",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 70,
"avg_line_length": 25.306122448979593,
"alnum_prop": 0.660483870967742,
"repo_name": "malasiot/ws",
"id": "0ee16259bf5a624b2cf2b2c4b8d92d69cb1047f7",
"size": "2147",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "CMake/FindGEOS.cmake",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "75746"
},
{
"name": "C++",
"bytes": "559098"
},
{
"name": "CMake",
"bytes": "48232"
},
{
"name": "CSS",
"bytes": "15725"
},
{
"name": "HTML",
"bytes": "62777"
},
{
"name": "JavaScript",
"bytes": "44051"
},
{
"name": "Lex",
"bytes": "5411"
},
{
"name": "Smarty",
"bytes": "7732"
},
{
"name": "Yacc",
"bytes": "20765"
}
],
"symlink_target": ""
} |
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.Encoder;
/**
* @author Rohan Doshi
*
* This class utilizes shaft encoders to allow the robot to go an exact distance during the autonomous period.
*/
public class DriveEncoder {
private Encoder driveEncoder; // initialize field
private int A;
private int B;
private int index;
private double traveledDistance;
private double WHEEL_DISTANCE_PER_PULSE = 0.036553894167;
//private double WINCH_DISTANCE_PER_PULSE = 0.003974;//0.037847//03595465
//Wheel circumfrence = 23.56 inches
/**
* create a new object and set equal to driveEncoder field
* @param aChannel unused
* @param bChannel unused
* @param indexChannel unused
* @param passed driveEncoder field
* determine what parameters are needed
*/
public DriveEncoder (int aChannel, int bChannel, boolean reverseDirection) { //determine parameters needed
driveEncoder = new Encoder(aChannel,bChannel, reverseDirection);
}
/**
* starts the encoder
*/
public void start() {
driveEncoder.start();
}
/**
* stops encoder
*/
public void stop() {
driveEncoder.stop();
}
/**
* resets the encoder
*/
public void reset() {
driveEncoder.reset();
// get()... set()...
}
public double getCount () {
return driveEncoder.get();
}
/**
* gets the last direction the encoder value changed
* @return true or false
*/
public boolean getDirectionForward () {
return driveEncoder.getDirection();
}
/**
* Finds distance traveled
* @return double distance traveled in inches
*
*/
public double getDistance () {
driveEncoder.setDistancePerPulse(WHEEL_DISTANCE_PER_PULSE); // Need to figure out DISTANCE_PER_PULSE
return Math.abs(driveEncoder.getDistance());
}
public double getDistanceFeet () {
return getDistance()/12;
}
public double getDistanceMeters () {
return getDistanceFeet() * 0.3048;
}
}
| {
"content_hash": "11cb3b8920381c95d7f66c1dd6c57418",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 114,
"avg_line_length": 23.74468085106383,
"alnum_prop": 0.6025985663082437,
"repo_name": "TechnoTitans/TitanWare2013",
"id": "1608627655706b0dafcb31bacd4a658099b20403",
"size": "2232",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/edu/wpi/first/wpilibj/templates/DriveEncoder.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "11139"
},
{
"name": "Java",
"bytes": "115727"
}
],
"symlink_target": ""
} |
class TaMembership < Membership
validate :must_be_a_ta
after_create { Repository.get_class.update_permissions }
after_destroy { Repository.get_class.update_permissions }
def must_be_a_ta
if user && !user.is_a?(Ta)
errors.add('base', 'User must be a ta')
false
end
end
def self.from_csv(assignment, csv_data, remove_existing)
if remove_existing
Repository.get_class.update_permissions_after do
TaMembership.joins(:grouping)
.where(groupings: { assessment_id: assignment.id })
.delete_all
end
end
new_ta_memberships = []
groupings = Hash[
assignment.groupings.joins(:group).pluck('groups.group_name', :id)
]
graders = Hash[Ta.pluck(:user_name, :id)]
result = MarkusCsv.parse(csv_data.read) do |row|
raise CsvInvalidLineError if row.empty?
raise CsvInvalidLineError if groupings[row[0]].nil?
row.drop(1).each do |grader_name|
unless graders[grader_name].nil?
new_ta_memberships << TaMembership.new(
grouping_id: groupings[row[0]],
user_id: graders[grader_name]
)
end
end
end
Repository.get_class.update_permissions_after do
TaMembership.import new_ta_memberships, validate: false, on_duplicate_key_ignore: true
end
# Recompute criteria associations
if assignment.assign_graders_to_criteria
Grouping.update_criteria_coverage_counts(
assignment,
new_ta_memberships.map { |x| x[:grouping_id] }
)
end
result
end
end
| {
"content_hash": "6c16f933b6fe99b500fddf717e6aae05",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 92,
"avg_line_length": 29.37037037037037,
"alnum_prop": 0.6368221941992434,
"repo_name": "benjaminvialle/Markus",
"id": "cbb244e1b2adaa047c656f9fbcc538ff72dea0bd",
"size": "1586",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/models/ta_membership.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1222"
},
{
"name": "CSS",
"bytes": "82626"
},
{
"name": "HTML",
"bytes": "279440"
},
{
"name": "Haskell",
"bytes": "3679"
},
{
"name": "Java",
"bytes": "16402"
},
{
"name": "JavaScript",
"bytes": "417036"
},
{
"name": "Python",
"bytes": "148372"
},
{
"name": "Racket",
"bytes": "5729"
},
{
"name": "Ruby",
"bytes": "1811403"
},
{
"name": "Shell",
"bytes": "11471"
}
],
"symlink_target": ""
} |
import sys
import wmi
import ctypes
import time
#For Development
DEBUG = True
FAIL_SILENTLY = False
#For Code
ONE_TIME_ALERT_ONLY = True
ShouldStartCharging = True
ShouldStopCharging = True
connect_charger = """Battery Level < 40%
Charging State : Disconnected
*** CONNECT CHARGER ***"""
disconnect_charger = """Battery Level > 80%
Charging State : Connected
*** DISCONNECT CHARGER ***"""
def Mbox(title, text, style):
ctypes.windll.user32.MessageBoxA(0, text, title, style)
def get_batstats():
#c = wmi.WMI()
t = wmi.WMI(moniker = "//./root/wmi")
batts = t.ExecQuery('Select * from BatteryFullChargedCapacity')
for i, b in enumerate(batts):
full_charge = b.FullChargedCapacity * 1.0
batts = t.ExecQuery('Select * from BatteryStatus where Voltage > 0')
for i, b in enumerate(batts):
return (full_charge, b.RemainingCapacity, b.Charging)
def do_batlogic():
global ShouldStartCharging, ShouldStopCharging
charge_capacity, charge_current, charge_status = get_batstats()
charge_percentage = charge_current / charge_capacity * 100
if DEBUG:
print str(charge_percentage), str(charge_status)
IS_CHARGING = charge_status
IS_DISCHARGING = not IS_CHARGING
if IS_DISCHARGING:
#Reset Stop Charging Alter Toggle
ShouldStopCharging = True
if DEBUG:
print "Should Stop Charging == True"
elif IS_CHARGING:
#Reset Start Charging Alert Toggle
ShouldStartCharging = True
if DEBUG:
print "Should Start Charging == True"
#Special case when the laptop stops charging at 100%
if charge_percentage == 100 and ShouldStopCharging:
Mbox('Battery Level Alert', disconnect_charger, 0)
if ONE_TIME_ALERT_ONLY:
ShouldStopCharging = False
else:
pass
if DEBUG:
print "100% Charge"
elif charge_percentage > 80 and IS_CHARGING and ShouldStopCharging:
Mbox('Battery Level Alert', disconnect_charger, 0)
if ONE_TIME_ALERT_ONLY:
ShouldStopCharging = False
else:
pass
if DEBUG:
print "> 80 Charge"
elif charge_percentage < 40 and IS_DISCHARGING and ShouldStartCharging:
Mbox('Battery Level Alert', connect_charger, 0)
if ONE_TIME_ALERT_ONLY:
ShouldStartCharging = False
else:
pass
if DEBUG:
print "< 40% Charge"
while True:
time.sleep(5)
if FAIL_SILENTLY:
try:
if DEBUG:
print "Cycling..."
do_batlogic()
except:
if DEBUG:
print "Error... Stopping Cycles"
break
else:
if DEBUG:
print "Cycling..."
do_batlogic()
sys.exit()
| {
"content_hash": "2c28a6257d0678e6271dd916dc8303ef",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 75,
"avg_line_length": 26.70754716981132,
"alnum_prop": 0.6114447191805016,
"repo_name": "nitred/batterylevelalert",
"id": "44d10fc344a1e59c4ab43be50eed0eb2d500251b",
"size": "2831",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "batlvl.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "2831"
}
],
"symlink_target": ""
} |
package com.utilis.game;
import com.utilis.Utilis;
public class Execute {
public static String version = "v. 1.2";
public static void main(String[] args) {
System.out.println("UtiliGame " + version + ",");
System.out.println("using Utilis " + Utilis.version + ".");
}
}
| {
"content_hash": "49496e1b30041bf9e2849d0e90ec2439",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 61,
"avg_line_length": 18.1875,
"alnum_prop": 0.6494845360824743,
"repo_name": "Cin316/UtiliGame",
"id": "2e06df0c2a423a89d5c5ac51eeebac2261417353",
"size": "291",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/utilis/game/Execute.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "67922"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="0; url=/docs/deployment-architecture/ztaa">
<link rel="canonical" href="/docs/deployment-architecture/ztaa" />
</head>
<script>
window.location.href = '/docs/deployment-architecture/ztaa' + window.location.search + window.location.hash;
</script>
</html> | {
"content_hash": "51162701fad50d51ee87624ee96a9100",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 112,
"avg_line_length": 33.36363636363637,
"alnum_prop": 0.6839237057220708,
"repo_name": "qrkourier/qrkourier.github.io",
"id": "fa06f227fabb09d57ca677b8624c5114a833b661",
"size": "367",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "docs/docs/deployment-architecture/ztaa.html/index.html",
"mode": "33188",
"license": "bsd-2-clause",
"language": [],
"symlink_target": ""
} |
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Security.Principal;
using OpenRiaServices.DomainServices;
using OpenRiaServices.DomainServices.Server;
namespace OpenRiaServices.DomainServices.Server.ApplicationServices
{
/// <summary>
/// <see cref="CodeProcessor"/> implementation that sets the base class of both the
/// context and entity types generated by a provider implementing
/// <see cref="IAuthentication{T}"/>.
/// </summary>
internal sealed class AuthenticationCodeProcessor : CodeProcessor
{
#region Constants
private const string AuthenticationDomainContextBaseName =
"OpenRiaServices.DomainServices.Client.ApplicationServices.AuthenticationDomainContextBase";
#endregion
#region Constructors
/// <summary>
/// Initializes an instance of the AuthenticationCodeProcessor class.
/// </summary>
/// <param name="codeDomProvider">The <see cref="CodeDomProvider"/> used during <see cref="DomainService"/> code generation.</param>
public AuthenticationCodeProcessor(CodeDomProvider codeDomProvider)
: base(codeDomProvider)
{
}
#endregion
#region Methods
/// <summary>
/// See <see cref="CodeProcessor.ProcessGeneratedCode"/>.
/// </summary>
/// <param name="domainServiceDescription">The domainServiceDescription</param>
/// <param name="codeCompileUnit">The codeCompileUnit</param>
/// <param name="typeMapping">The typeMapping</param>
public override void ProcessGeneratedCode(DomainServiceDescription domainServiceDescription, CodeCompileUnit codeCompileUnit, IDictionary<Type, CodeTypeDeclaration> typeMapping)
{
// Make sure the provider extends IAuthentication<T>
Type genericDomainServiceType;
AuthenticationCodeProcessor.CheckIAuthentication(domainServiceDescription, out genericDomainServiceType);
Type userEntityType = genericDomainServiceType.GetGenericArguments()[0];
AuthenticationCodeProcessor.CheckIUser(userEntityType);
// Implement IPrincipal and IIdentity in the user type
CodeTypeDeclaration entityTypeDeclaration;
typeMapping.TryGetValue(userEntityType, out entityTypeDeclaration);
if (entityTypeDeclaration != null)
{
CodeTypeReference identityInterfaceTypeReference =
new CodeTypeReference(typeof(IIdentity)) { Options = CodeTypeReferenceOptions.GlobalReference };
CodeTypeReference principalInterfaceTypeReference =
new CodeTypeReference(typeof(IPrincipal)) { Options = CodeTypeReferenceOptions.GlobalReference };
entityTypeDeclaration.BaseTypes.Add(identityInterfaceTypeReference);
entityTypeDeclaration.BaseTypes.Add(principalInterfaceTypeReference);
////
//// private string IIdentitiy.AuthenticationType
////
CodeMemberProperty authenticationTypeProperty = new CodeMemberProperty()
{
Attributes = MemberAttributes.Private | MemberAttributes.Final,
HasGet = true,
Name = "AuthenticationType",
Type = new CodeTypeReference(typeof(string))
};
// get { return string.Empty; }
authenticationTypeProperty.GetStatements.Add(new CodeMethodReturnStatement(
new CodePropertyReferenceExpression(
new CodeTypeReferenceExpression(typeof(string)),
"Empty")));
authenticationTypeProperty.PrivateImplementationType = identityInterfaceTypeReference;
entityTypeDeclaration.Members.Add(authenticationTypeProperty);
////
//// public bool IsAuthenticated
////
CodeMemberProperty isAuthenticatedProperty = new CodeMemberProperty()
{
Attributes = MemberAttributes.Public | MemberAttributes.Final,
HasGet = true,
Name = "IsAuthenticated",
Type = new CodeTypeReference(typeof(bool))
};
// get { return (true != string.IsNullOrEmpty(this.Name)); }
isAuthenticatedProperty.GetStatements.Add(
new CodeMethodReturnStatement(
new CodeBinaryOperatorExpression(
new CodePrimitiveExpression(true),
CodeBinaryOperatorType.IdentityInequality,
new CodeMethodInvokeExpression(
new CodeTypeReferenceExpression(typeof(string)),
"IsNullOrEmpty",
new CodePropertyReferenceExpression(
new CodeThisReferenceExpression(),
"Name")))));
isAuthenticatedProperty.Comments.AddRange(
AuthenticationCodeProcessor.GetDocComments(Resources.ApplicationServices_CommentIsAuth));
isAuthenticatedProperty.ImplementationTypes.Add(identityInterfaceTypeReference);
entityTypeDeclaration.Members.Add(isAuthenticatedProperty);
////
//// private string IIdentity.Name
////
// VB Codegen requires us to implement a ReadOnly version of Name as well
CodeMemberProperty namePropertyExp = new CodeMemberProperty()
{
Attributes = MemberAttributes.Private | MemberAttributes.Final,
HasGet = true,
Name = "Name",
Type = new CodeTypeReference(typeof(string))
};
// get { return this.Name; }
namePropertyExp.GetStatements.Add(
new CodeMethodReturnStatement(
new CodePropertyReferenceExpression(
new CodeThisReferenceExpression(),
"Name")));
namePropertyExp.PrivateImplementationType = identityInterfaceTypeReference;
entityTypeDeclaration.Members.Add(namePropertyExp);
////
//// private IIdentity IPrincipal.Identity
////
CodeMemberProperty identityProperty = new CodeMemberProperty()
{
Attributes = MemberAttributes.Private | MemberAttributes.Final,
HasGet = true,
Name = "Identity",
Type = identityInterfaceTypeReference,
};
// get { return this; }
identityProperty.GetStatements.Add(
new CodeMethodReturnStatement(
new CodeThisReferenceExpression()));
identityProperty.PrivateImplementationType = principalInterfaceTypeReference;
entityTypeDeclaration.Members.Add(identityProperty);
////
//// public bool IsInRole(string role)
////
CodeMemberMethod isInRoleMethod = new CodeMemberMethod()
{
Attributes = MemberAttributes.Public | MemberAttributes.Final,
Name = "IsInRole",
ReturnType = new CodeTypeReference(typeof(bool))
};
isInRoleMethod.Parameters.Add(
new CodeParameterDeclarationExpression(
new CodeTypeReference(typeof(string)),
"role"));
// if (this.Roles == null)
// {
// return false;
// }
// return this.Roles.Contains(role);
CodeConditionStatement ifRolesNullStatement = new CodeConditionStatement();
ifRolesNullStatement.Condition = new CodeBinaryOperatorExpression(
new CodePropertyReferenceExpression(
new CodeThisReferenceExpression(),
"Roles"),
CodeBinaryOperatorType.IdentityEquality,
new CodePrimitiveExpression(null));
ifRolesNullStatement.TrueStatements.Add(
new CodeMethodReturnStatement(new CodePrimitiveExpression(false)));
isInRoleMethod.Statements.Add(ifRolesNullStatement);
isInRoleMethod.Statements.Add(
new CodeMethodReturnStatement(
new CodeMethodInvokeExpression(
new CodeTypeReferenceExpression(
new CodeTypeReference(typeof(Enumerable))
{
Options = CodeTypeReferenceOptions.GlobalReference
}),
"Contains",
new CodePropertyReferenceExpression(new CodeThisReferenceExpression(), "Roles"),
new CodeVariableReferenceExpression("role"))));
isInRoleMethod.Comments.AddRange(
AuthenticationCodeProcessor.GetDocComments(Resources.ApplicationServices_CommentIsInRole));
isInRoleMethod.ImplementationTypes.Add(principalInterfaceTypeReference);
entityTypeDeclaration.Members.Add(isInRoleMethod);
// Changes to Name need to raise change notification for IsAuthenticated. To accomplish this,
// we'll insert a change event at the end of the "if (this._name != value)" block.
//
// >> this.RaisePropertyChanged("IsAuthenticated");
CodeMemberProperty nameProperty = entityTypeDeclaration.Members.OfType<CodeMemberProperty>().Where(c => c.Name == "Name").First();
nameProperty.SetStatements.OfType<CodeConditionStatement>().First().TrueStatements.Add(
new CodeExpressionStatement(
new CodeMethodInvokeExpression(
new CodeThisReferenceExpression(),
"RaisePropertyChanged",
new CodePrimitiveExpression("IsAuthenticated"))));
// Name should be set to string.Empty by default
CodeMemberField nameField = entityTypeDeclaration.Members.OfType<CodeMemberField>().Where(c => c.Name == "_name").Single();
nameField.InitExpression =
new CodePropertyReferenceExpression(
new CodeTypeReferenceExpression(typeof(string)),
"Empty");
}
// Set context base type
CodeTypeDeclaration providerTypeDeclaration;
typeMapping.TryGetValue(domainServiceDescription.DomainServiceType, out providerTypeDeclaration);
if (providerTypeDeclaration != null)
{
providerTypeDeclaration.BaseTypes.Clear();
providerTypeDeclaration.BaseTypes.Add(
new CodeTypeReference(AuthenticationCodeProcessor.AuthenticationDomainContextBaseName)
{
Options = CodeTypeReferenceOptions.GlobalReference
});
}
}
/// <summary>
/// Takes a multi-line comment defined in a resource file and correctly formats it as a doc comment
/// for use in code-dom.
/// </summary>
/// <param name="resourceComment">The comment to format as a doc comment. This cannot be null.</param>
/// <returns>A collection of comment statements that matches the input resource</returns>
internal static CodeCommentStatementCollection GetDocComments(string resourceComment)
{
if (resourceComment == null)
{
throw new ArgumentNullException("resourceComment");
}
CodeCommentStatementCollection commentCollection = new CodeCommentStatementCollection();
foreach (string comment in resourceComment.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
{
commentCollection.Add(new CodeCommentStatement(comment, true));
}
return commentCollection;
}
/// <summary>
/// Validates that the authentication service implements the <see cref="IAuthentication{T}"/> interface
/// naturally for use in codegen.
/// </summary>
/// <remarks>
/// This check ensures no part of the interface was implemented explicitly.
/// </remarks>
/// <param name="authenticationServiceDescription">The domain service description for the type that implemented
/// the <see cref="IAuthentication{T}"/> interface.
/// </param>
/// <param name="genericIAuthenticationType">The generic version of <see cref="IAuthentication{T}"/> implemented
/// by the service type of the <paramref name="authenticationServiceDescription"/>.
/// </param>
/// <exception cref="InvalidOperationException"> is thrown if the <see cref="IAuthentication{T}"/> interface
/// is not correctly implemented.
/// </exception>
private static void CheckIAuthentication(DomainServiceDescription authenticationServiceDescription, out Type genericIAuthenticationType)
{
bool implementsLogin = false;
bool implementsLogout = false;
bool implementsGetUser = false;
bool implementsUpdateUser = false;
if (!typeof(IAuthentication<>).DefinitionIsAssignableFrom(authenticationServiceDescription.DomainServiceType, out genericIAuthenticationType))
{
throw new InvalidOperationException(Resources.ApplicationServices_MustBeIAuth);
}
Type userType = genericIAuthenticationType.GetGenericArguments()[0];
foreach (DomainOperationEntry doe in authenticationServiceDescription.DomainOperationEntries)
{
switch (doe.Name)
{
case "Login":
implementsLogin = AuthenticationCodeProcessor.CheckIAuthenticationLogin(doe, userType);
break;
case "Logout":
implementsLogout = AuthenticationCodeProcessor.CheckIAuthenticationLogout(doe, userType);
break;
case "GetUser":
implementsGetUser = AuthenticationCodeProcessor.CheckIAuthenticationGetUser(doe, userType);
break;
case "UpdateUser":
implementsUpdateUser = AuthenticationCodeProcessor.CheckIAuthenticationUpdateUser(doe, userType);
break;
default:
break;
}
}
if (!implementsLogin || !implementsLogout || !implementsGetUser || !implementsUpdateUser)
{
throw new InvalidOperationException(string.Format(
CultureInfo.InstalledUICulture,
Resources.ApplicationServices_MustBeIAuthImpl,
authenticationServiceDescription.DomainServiceType.Name));
}
}
/// <summary>
/// Validates that the operation entry represents <see cref="IAuthentication{T}.Login"/> for use in codegen.
/// </summary>
/// <param name="doe">The entry to validate</param>
/// <param name="userType">The user type. <c>T</c> in <see cref="IAuthentication{T}"/>.</param>
/// <returns>Whether the operation entry represents Login</returns>
private static bool CheckIAuthenticationLogin(DomainOperationEntry doe, Type userType)
{
bool implementsLogin = true;
// [Query]
// public T Login(string userName, string password, bool isPersistent, string customData)
if (doe.Operation != DomainOperation.Query)
{
implementsLogin = false;
}
if (doe.ReturnType != userType)
{
implementsLogin = false;
}
if ((doe.Parameters.Count() != 4) ||
(doe.Parameters[0].ParameterType != typeof(string)) ||
(doe.Parameters[1].ParameterType != typeof(string)) ||
(doe.Parameters[2].ParameterType != typeof(bool)) ||
(doe.Parameters[3].ParameterType != typeof(string)))
{
implementsLogin = false;
}
return implementsLogin;
}
/// <summary>
/// Validates that the operation entry represents <see cref="IAuthentication{T}.Logout"/> for use in codegen.
/// </summary>
/// <param name="doe">The entry to validate</param>
/// <param name="userType">The user type. <c>T</c> in <see cref="IAuthentication{T}"/>.</param>
/// <returns>Whether the operation entry represents Logout</returns>
private static bool CheckIAuthenticationLogout(DomainOperationEntry doe, Type userType)
{
bool implementsLogout = true;
// [Query]
// public T Logout()
if (doe.Operation != DomainOperation.Query)
{
implementsLogout = false;
}
if (doe.ReturnType != userType)
{
implementsLogout = false;
}
if (doe.Parameters.Any())
{
implementsLogout = false;
}
return implementsLogout;
}
/// <summary>
/// Validates that the operation entry represents <see cref="IAuthentication{T}.GetUser"/> for use in codegen.
/// </summary>
/// <param name="doe">The entry to validate</param>
/// <param name="userType">The user type. <c>T</c> in <see cref="IAuthentication{T}"/>.</param>
/// <returns>Whether the operation entry represents GetUser</returns>
private static bool CheckIAuthenticationGetUser(DomainOperationEntry doe, Type userType)
{
bool implementsGetUser = true;
// [Query]
// public T GetUser()
if (doe.Operation != DomainOperation.Query)
{
implementsGetUser = false;
}
if (doe.ReturnType != userType)
{
implementsGetUser = false;
}
if (doe.Parameters.Any())
{
implementsGetUser = false;
}
return implementsGetUser;
}
/// <summary>
/// Validates that the operation entry represents <see cref="IAuthentication{T}.UpdateUser"/> for use in codegen.
/// </summary>
/// <param name="doe">The entry to validate</param>
/// <param name="userType">The user type. <c>T</c> in <see cref="IAuthentication{T}"/>.</param>
/// <returns>Whether the operation entry represents UpdateUser</returns>
private static bool CheckIAuthenticationUpdateUser(DomainOperationEntry doe, Type userType)
{
bool implementsUpdateUser = true;
// [Update]
// public void UpdateUser(T user)
if (doe.Operation != DomainOperation.Update)
{
implementsUpdateUser = false;
}
if (doe.ReturnType != typeof(void))
{
implementsUpdateUser = false;
}
if ((doe.Parameters.Count() != 1) ||
(doe.Parameters[0].ParameterType != userType))
{
implementsUpdateUser = false;
}
return implementsUpdateUser;
}
/// <summary>
/// Validates that the user type implements the <see cref="IUser"/> interface naturally for use
/// in codegen.
/// </summary>
/// <remarks>
/// This check ensures no part of the interface was implemented explicitly and the <c>Name</c>
/// property was marked as a <c>[Key]</c>.
/// </remarks>
/// <param name="user">The type that implemented the <see cref="IUser"/> interface.</param>
/// <exception cref="InvalidOperationException"> is thrown if the <see cref="IUser"/> interface
/// is not correctly implemented.
/// </exception>
private static void CheckIUser(Type user)
{
bool implementsName = false;
bool implementsRoles = false;
System.Diagnostics.Debug.Assert(typeof(IUser).IsAssignableFrom(user),
"user should always be of type IUser.");
foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(user))
{
switch (property.Name)
{
case "Name":
{
// [Key]
// public string Name { get; set; }
if (typeof(string) != property.PropertyType)
{
break;
}
if (!SerializationUtility.IsSerializableDataMember(property))
{
throw new InvalidOperationException(string.Format(
CultureInfo.InstalledUICulture,
Resources.ApplicationServices_MustBeSerializable,
property.Name, user.Name));
}
if (property.Attributes[typeof(KeyAttribute)] == null)
{
throw new InvalidOperationException(string.Format(
CultureInfo.InstalledUICulture,
Resources.ApplicationServices_NameMustBeAKey,
user.Name));
}
PropertyInfo namePropertyInfo = user.GetProperty("Name");
if ((namePropertyInfo != null) && (namePropertyInfo.GetSetMethod() == null))
{
break;
}
implementsName = true;
break;
}
case "Roles":
{
// public IEnumerable<string> Roles { get; set; }
if (!typeof(IEnumerable<string>).IsAssignableFrom(property.PropertyType))
{
break;
}
if (!SerializationUtility.IsSerializableDataMember(property))
{
throw new InvalidOperationException(string.Format(
CultureInfo.InstalledUICulture,
Resources.ApplicationServices_MustBeSerializable,
property.Name, user.Name));
}
PropertyInfo rolesPropertyInfo = user.GetProperty("Roles");
if ((rolesPropertyInfo != null) && (rolesPropertyInfo.GetSetMethod() == null))
{
break;
}
implementsRoles = true;
break;
}
default:
break;
}
}
if (!implementsName || !implementsRoles)
{
throw new InvalidOperationException(string.Format(
CultureInfo.InstalledUICulture,
Resources.ApplicationServices_MustBeIUser,
user.Name));
}
}
#endregion
}
}
| {
"content_hash": "23b9ee4c9bcf72df28011569e4f72bb1",
"timestamp": "",
"source": "github",
"line_count": 536,
"max_line_length": 185,
"avg_line_length": 46.11380597014925,
"alnum_prop": 0.5503499615649149,
"repo_name": "STAH/OpenRiaServices",
"id": "780de33a4a3a2f2bf745ad12e9c9669dcb6bc53e",
"size": "24719",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "OpenRiaServices.DomainServices.Server/Framework/ApplicationServices/AuthenticationCodeProcessor.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "814"
},
{
"name": "C#",
"bytes": "19336143"
},
{
"name": "CSS",
"bytes": "5674"
},
{
"name": "HTML",
"bytes": "12455"
},
{
"name": "PowerShell",
"bytes": "1793"
},
{
"name": "Visual Basic",
"bytes": "4874395"
}
],
"symlink_target": ""
} |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MatrixClass")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MatrixClass")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a1963f55-70ad-4053-8cb8-0edcb78b178b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {
"content_hash": "9a2bc494bd9f7fe45bd9ca050dd376a2",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 84,
"avg_line_length": 38.75,
"alnum_prop": 0.7448028673835125,
"repo_name": "RuzmanovDev/Telerik-Academy-Season-2016-2017",
"id": "7614c821e045d3093017c3b98db7d01b05913801",
"size": "1398",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Modul-I/02.C#PartTwo/Homework/Matrices/MatrixClass/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "156062"
},
{
"name": "C#",
"bytes": "6854317"
},
{
"name": "CSS",
"bytes": "151173"
},
{
"name": "CoffeeScript",
"bytes": "3700"
},
{
"name": "HTML",
"bytes": "3848453"
},
{
"name": "JavaScript",
"bytes": "2098645"
},
{
"name": "PowerShell",
"bytes": "287"
},
{
"name": "SQLPL",
"bytes": "4671"
},
{
"name": "XSLT",
"bytes": "3306"
}
],
"symlink_target": ""
} |
package org.beansugar.oauth.services.signature;
/**
* Signs a base string, returning the OAuth signature
*
* @author Pablo Fernandez
*/
public interface SignatureService {
/**
* Returns the signature
*
* @param baseString url-encoded string to sign
* @param apiSecret api secret for your app
* @param tokenSecret token secret (empty string for the request token step)
* @return signature
*/
String getSignature(String baseString, String apiSecret, String tokenSecret);
/**
* Returns the signature method/algorithm
*
* @return signature method/algorithm
*/
String getSignatureMethod();
}
| {
"content_hash": "671d78ac52e721329699d0f15badb573",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 78,
"avg_line_length": 24.88,
"alnum_prop": 0.7266881028938906,
"repo_name": "archmagece-backyard/bs-scribe-java",
"id": "adf44c9d7f4e7afa0634be14a79281b0186da7c3",
"size": "622",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/main/java/org/beansugar/oauth/services/signature/SignatureService.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "166900"
},
{
"name": "Shell",
"bytes": "98"
}
],
"symlink_target": ""
} |
<?php
namespace MwBundle\Report;
use AppBundle\Report\AbstractReport;
use AppBundle\Report\Grid;
use MwBundle\Entity\Klant;
use MwBundle\Service\KlantDao;
class Resultaten extends AbstractReport
{
protected $title = 'Resultaten';
protected $xPath = 'type';
protected $yPath = 'locatienaam';
protected $nPath = 'aantal';
protected $columns = [
'Klanten'=>'aantal',
'Verslagen'=>'aantalVerslagen'
];
protected $yDescription = 'Locatienaam';
protected $tables = [];
/**
* @var Locatie
*/
private $locatie;
public function __construct(KlantDao $dao)
{
$this->dao = $dao;
}
public function setFilter(array $filter)
{
if (array_key_exists('startdatum', $filter)) {
$this->startDate = $filter['startdatum'];
}
if (array_key_exists('einddatum', $filter)) {
$this->endDate = $filter['einddatum'];
}
return $this;
}
protected function init()
{
$query = $this->dao->countUniqueKlantenVoorLocaties(
$this->startDate,
$this->endDate
);
// $sql = $this->getFullSQL($query);
$this->result = $query->getResult();
}
protected function build()
{
$table = new Grid($this->result, $this->columns,$this->yPath);
$table
->setStartDate($this->startDate)
->setEndDate($this->endDate)
->setYSort(false)
->setYTotals(true)
;
$this->reports[] = [
'title' => 'Economisch daklozen',
'xDescription' => $this->xDescription,
'yDescription' => $this->yDescription,
'data' => $table->render(),
];
}
}
| {
"content_hash": "c85bb93c3788a82854a2a69f116260ce",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 70,
"avg_line_length": 21.313253012048193,
"alnum_prop": 0.5432447710570945,
"repo_name": "deregenboog/ecd",
"id": "ba7e685872a199854eb397d211f41f164d95f0fe",
"size": "1769",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/MwBundle/Report/Resultaten.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "39384"
},
{
"name": "Dockerfile",
"bytes": "1506"
},
{
"name": "JavaScript",
"bytes": "199321"
},
{
"name": "PHP",
"bytes": "4527452"
},
{
"name": "SCSS",
"bytes": "34"
},
{
"name": "Shell",
"bytes": "7702"
},
{
"name": "Twig",
"bytes": "1454381"
}
],
"symlink_target": ""
} |
cask "xampp7" do
version "7.4.29-1"
sha256 "c21aa7631a6ed075a1aae991c11188238cf7c9bca6e19c2cd4fe41884651686b"
url "https://downloadsapachefriends.global.ssl.fastly.net/xampp-files/#{version.split("-").first}/xampp-osx-#{version}-installer.dmg",
verified: "downloadsapachefriends.global.ssl.fastly.net/xampp-files/"
name "XAMPP"
desc "Apache distribution containing MySQL, PHP 7, and Perl"
homepage "https://www.apachefriends.org/index.html"
livecheck do
url "https://www.apachefriends.org/download.html"
regex(%r{href=.*?/xampp[._-]osx[._-]v?(7(?:\.\d+)*-\d+)[._-]installer\.dmg}i)
end
conflicts_with cask: "xampp"
installer script: {
executable: "xampp-osx-#{version}-installer.app/Contents/MacOS/osx-x86_64",
args: ["--mode", "unattended"],
sudo: true,
}
uninstall quit: "com.bitnami.manager",
script: {
executable: "/Applications/XAMPP/uninstall.app/Contents/MacOS/osx-x86_64",
args: ["--mode", "unattended"],
sudo: true,
},
delete: "/Applications/XAMPP/"
end
| {
"content_hash": "cf6c0d690d9d21cc30d6eea84fd4cf5f",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 136,
"avg_line_length": 36.193548387096776,
"alnum_prop": 0.6319073083778967,
"repo_name": "mahori/homebrew-cask-versions",
"id": "dab13c77565524666ad22f33819f283313e98323",
"size": "1122",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Casks/xampp7.rb",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Ruby",
"bytes": "277510"
}
],
"symlink_target": ""
} |
<?php
/*----------------------------------------------------------------------------*/
namespace Apps\Wiki\Views;
class Main extends \Libs\View {
public function resolveConstants() {
$actors = \Libs\Session::current()->actors();
$actors->{'format'} = 'Actors\Format';
$actors->{'children'} = 'Actors\Children';
$actors->{'location'} = 'Actors\Location';
}
public function isIndex() {
return true;
}
public function execute() {
parent::execute();
$session = \Libs\Session::current();
$document = $this->document();
$root = $document->documentElement;
// Append settings:
$settings = $document->createElement('settings');
$session->app()->settings()->appendXML($settings);
$root->appendChild($settings);
}
}
/*----------------------------------------------------------------------------*/
?> | {
"content_hash": "8fd472913a93fef82c4c4148ea4055e1",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 80,
"avg_line_length": 25.5,
"alnum_prop": 0.5017301038062284,
"repo_name": "brendo/wiki",
"id": "214d3551437a771a8101cc800d6b8fdae81590dc",
"size": "867",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "wiki/views/main.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "4485"
},
{
"name": "PHP",
"bytes": "29013"
}
],
"symlink_target": ""
} |
define({
"instruction": "Stvorite sadržaj koji se prikazuje u ovom widgetu.",
"defaultContent": "Ovdje dodajte tekst, poveznice i male grafičke elemente.",
"productVersion": "Verzija proizvoda: ",
"kernelVersion": "Verzija jezgre sustava: "
}); | {
"content_hash": "1dd8e1517b511d9f2b68e39410c4a364",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 79,
"avg_line_length": 42,
"alnum_prop": 0.7261904761904762,
"repo_name": "tmcgee/cmv-wab-widgets",
"id": "7d73f5d9ba2337621996b44f3af5c72c80cd41a0",
"size": "254",
"binary": false,
"copies": "17",
"ref": "refs/heads/master",
"path": "wab/2.15/widgets/About/setting/nls/hr/strings.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1198579"
},
{
"name": "HTML",
"bytes": "946685"
},
{
"name": "JavaScript",
"bytes": "22190423"
},
{
"name": "Pascal",
"bytes": "4207"
},
{
"name": "TypeScript",
"bytes": "102918"
}
],
"symlink_target": ""
} |
package org.rythmengine.spring.web;
import org.osgl.util.E;
import org.osgl.web.util.UserAgent;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.Arrays;
import java.util.List;
/**
* Created by IntelliJ IDEA.
* User: luog
* Date: 27/01/12
* Time: 10:23 AM
* To change this template use File | Settings | File Templates.
*/
class ImplicitVariables {
static class Var {
String name;
String type;
boolean underscoreImplicitVariableName = false;
Var(String name, String type, boolean underscoreImplicitVariableName) {
this.name = name;
this.type = type;
this.underscoreImplicitVariableName = underscoreImplicitVariableName;
}
String name() {
return underscoreImplicitVariableName ? "_" + name : name;
}
protected Object evaluate() {
throw E.unsupport();
// Map<String, Object> renderArgs = RythmView.renderArgs.get();
// if (null == renderArgs) return null;
// return renderArgs.get(name());
}
}
List<Var> vars;
ImplicitVariables(boolean underscoreImplicitVariableName) {
Var[] vars = {
new Var("request", HttpServletRequest.class.getName(), underscoreImplicitVariableName),
new Var("response", HttpServletResponse.class.getName(), underscoreImplicitVariableName),
new Var("httpSession", HttpSession.class.getName(), underscoreImplicitVariableName),
new Var("session", Session.class.getName(), underscoreImplicitVariableName),
new Var("userAgent", UserAgent.class.getName(), underscoreImplicitVariableName),
new Var("flash", Flash.class.getName(), underscoreImplicitVariableName),
new Var("csrf", Csrf.class.getName(), underscoreImplicitVariableName),
new Var("__request", HttpServletRequest.class.getName(), false),
};
this.vars = Arrays.asList(vars);
}
}
| {
"content_hash": "ae9e29318c3224969d250cb6021501e4",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 105,
"avg_line_length": 35.083333333333336,
"alnum_prop": 0.6479809976247031,
"repo_name": "greenlaw110/spring-rythm",
"id": "733f8bef82feacf48dc7b710bccc3934f3cb3a08",
"size": "2105",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/org/rythmengine/spring/web/ImplicitVariables.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2206"
},
{
"name": "Java",
"bytes": "141971"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_72) on Wed Nov 05 20:55:09 EST 2014 -->
<title>MerkleTree (apache-cassandra API)</title>
<meta name="date" content="2014-11-05">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="MerkleTree (apache-cassandra API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/MerkleTree.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/apache/cassandra/utils/MergeIterator.Reducer.html" title="class in org.apache.cassandra.utils"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../org/apache/cassandra/utils/MerkleTree.MerkleTreeSerializer.html" title="class in org.apache.cassandra.utils"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/cassandra/utils/MerkleTree.html" target="_top">Frames</a></li>
<li><a href="MerkleTree.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li><a href="#nested_class_summary">Nested</a> | </li>
<li><a href="#field_summary">Field</a> | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field_detail">Field</a> | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.cassandra.utils</div>
<h2 title="Class MerkleTree" class="title">Class MerkleTree</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.apache.cassandra.utils.MerkleTree</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd>java.io.Serializable</dd>
</dl>
<hr>
<br>
<pre>public class <span class="strong">MerkleTree</span>
extends java.lang.Object
implements java.io.Serializable</pre>
<div class="block">A MerkleTree implemented as a binary tree.
A MerkleTree is a full binary tree that represents a perfect binary tree of
depth 'hashdepth'. In a perfect binary tree, each leaf contains a
sequentially hashed range, and each inner node contains the binary hash of
its two children. In the MerkleTree, many ranges will not be split to the
full depth of the perfect binary tree: the leaves of this tree are Leaf objects,
which contain the computed values of the nodes that would be below them if
the tree were perfect.
The hash values of the inner nodes of the MerkleTree are calculated lazily based
on their children when the hash of a range is requested with hash(range).
Inputs passed to TreeRange.validate should be calculated using a very secure hash,
because all hashing internal to the tree is accomplished using XOR.
If two MerkleTrees have the same hashdepth, they represent a perfect tree
of the same depth, and can always be compared, regardless of size or splits.</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../serialized-form.html#org.apache.cassandra.utils.MerkleTree">Serialized Form</a></dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested_class_summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation">
<caption><span>Nested Classes</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class </code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.MerkleTreeSerializer.html" title="class in org.apache.cassandra.utils">MerkleTree.MerkleTreeSerializer</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class </code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.RowHash.html" title="class in org.apache.cassandra.utils">MerkleTree.RowHash</a></strong></code>
<div class="block">Hash value representing a row, to be used to pass hashes to the MerkleTree.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class </code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.TreeDifference.html" title="class in org.apache.cassandra.utils">MerkleTree.TreeDifference</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class </code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.TreeRange.html" title="class in org.apache.cassandra.utils">MerkleTree.TreeRange</a></strong></code>
<div class="block">The public interface to a range in the tree.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class </code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.TreeRangeIterator.html" title="class in org.apache.cassandra.utils">MerkleTree.TreeRangeIterator</a></strong></code>
<div class="block">Returns the leaf (range) of a given tree in increasing order.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.html#CONSISTENT">CONSISTENT</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../org/apache/cassandra/dht/Range.html" title="class in org.apache.cassandra.dht">Range</a><<a href="../../../../org/apache/cassandra/dht/Token.html" title="class in org.apache.cassandra.dht">Token</a>></code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.html#fullRange">fullRange</a></strong></code>
<div class="block">The top level range that this MerkleTree covers.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.html#FULLY_INCONSISTENT">FULLY_INCONSISTENT</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>byte</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.html#hashdepth">hashdepth</a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.html#PARTIALLY_INCONSISTENT">PARTIALLY_INCONSISTENT</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static byte</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.html#RECOMMENDED_DEPTH">RECOMMENDED_DEPTH</a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../org/apache/cassandra/utils/MerkleTree.MerkleTreeSerializer.html" title="class in org.apache.cassandra.utils">MerkleTree.MerkleTreeSerializer</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.html#serializer">serializer</a></strong></code> </td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.html#MerkleTree(org.apache.cassandra.dht.IPartitioner,%20org.apache.cassandra.dht.Range,%20byte,%20long)">MerkleTree</a></strong>(<a href="../../../../org/apache/cassandra/dht/IPartitioner.html" title="interface in org.apache.cassandra.dht">IPartitioner</a> partitioner,
<a href="../../../../org/apache/cassandra/dht/Range.html" title="class in org.apache.cassandra.dht">Range</a><<a href="../../../../org/apache/cassandra/dht/Token.html" title="class in org.apache.cassandra.dht">Token</a>> range,
byte hashdepth,
long maxsize)</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.util.List<<a href="../../../../org/apache/cassandra/utils/MerkleTree.TreeRange.html" title="class in org.apache.cassandra.utils">MerkleTree.TreeRange</a>></code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.html#difference(org.apache.cassandra.utils.MerkleTree,%20org.apache.cassandra.utils.MerkleTree)">difference</a></strong>(<a href="../../../../org/apache/cassandra/utils/MerkleTree.html" title="class in org.apache.cassandra.utils">MerkleTree</a> ltree,
<a href="../../../../org/apache/cassandra/utils/MerkleTree.html" title="class in org.apache.cassandra.utils">MerkleTree</a> rtree)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../org/apache/cassandra/utils/MerkleTree.TreeRange.html" title="class in org.apache.cassandra.utils">MerkleTree.TreeRange</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.html#get(org.apache.cassandra.dht.Token)">get</a></strong>(<a href="../../../../org/apache/cassandra/dht/Token.html" title="class in org.apache.cassandra.dht">Token</a> t)</code>
<div class="block">For testing purposes.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>byte[]</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.html#hash(org.apache.cassandra.dht.Range)">hash</a></strong>(<a href="../../../../org/apache/cassandra/dht/Range.html" title="class in org.apache.cassandra.dht">Range</a><<a href="../../../../org/apache/cassandra/dht/Token.html" title="class in org.apache.cassandra.dht">Token</a>> range)</code>
<div class="block">Hash the given range in the tree.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../org/apache/cassandra/utils/EstimatedHistogram.html" title="class in org.apache.cassandra.utils">EstimatedHistogram</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.html#histogramOfRowCountPerLeaf()">histogramOfRowCountPerLeaf</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../org/apache/cassandra/utils/EstimatedHistogram.html" title="class in org.apache.cassandra.utils">EstimatedHistogram</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.html#histogramOfRowSizePerLeaf()">histogramOfRowSizePerLeaf</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.html#init()">init</a></strong>()</code>
<div class="block">Initializes this tree by splitting it until hashdepth is reached,
or until an additional level of splits would violate maxsize.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.html#invalidate(org.apache.cassandra.dht.Token)">invalidate</a></strong>(<a href="../../../../org/apache/cassandra/dht/Token.html" title="class in org.apache.cassandra.dht">Token</a> t)</code>
<div class="block">Invalidates the ranges containing the given token.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../org/apache/cassandra/utils/MerkleTree.TreeRangeIterator.html" title="class in org.apache.cassandra.utils">MerkleTree.TreeRangeIterator</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.html#invalids()">invalids</a></strong>()</code>
<div class="block">Returns a lazy iterator of invalid TreeRanges that need to be filled
in order to make the given Range valid.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.html#maxsize()">maxsize</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.html#maxsize(long)">maxsize</a></strong>(long maxsize)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../org/apache/cassandra/dht/IPartitioner.html" title="interface in org.apache.cassandra.dht">IPartitioner</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.html#partitioner()">partitioner</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.html#size()">size</a></strong>()</code>
<div class="block">The number of distinct ranges contained in this tree.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.html#split(org.apache.cassandra.dht.Token)">split</a></strong>(<a href="../../../../org/apache/cassandra/dht/Token.html" title="class in org.apache.cassandra.dht">Token</a> t)</code>
<div class="block">Splits the range containing the given token, if no tree limits would be
violated.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/utils/MerkleTree.html#toString()">toString</a></strong>()</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="serializer">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>serializer</h4>
<pre>public static final <a href="../../../../org/apache/cassandra/utils/MerkleTree.MerkleTreeSerializer.html" title="class in org.apache.cassandra.utils">MerkleTree.MerkleTreeSerializer</a> serializer</pre>
</li>
</ul>
<a name="RECOMMENDED_DEPTH">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>RECOMMENDED_DEPTH</h4>
<pre>public static final byte RECOMMENDED_DEPTH</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../constant-values.html#org.apache.cassandra.utils.MerkleTree.RECOMMENDED_DEPTH">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="CONSISTENT">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>CONSISTENT</h4>
<pre>public static final int CONSISTENT</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../constant-values.html#org.apache.cassandra.utils.MerkleTree.CONSISTENT">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="FULLY_INCONSISTENT">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>FULLY_INCONSISTENT</h4>
<pre>public static final int FULLY_INCONSISTENT</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../constant-values.html#org.apache.cassandra.utils.MerkleTree.FULLY_INCONSISTENT">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="PARTIALLY_INCONSISTENT">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PARTIALLY_INCONSISTENT</h4>
<pre>public static final int PARTIALLY_INCONSISTENT</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../constant-values.html#org.apache.cassandra.utils.MerkleTree.PARTIALLY_INCONSISTENT">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="hashdepth">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hashdepth</h4>
<pre>public final byte hashdepth</pre>
</li>
</ul>
<a name="fullRange">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>fullRange</h4>
<pre>public final <a href="../../../../org/apache/cassandra/dht/Range.html" title="class in org.apache.cassandra.dht">Range</a><<a href="../../../../org/apache/cassandra/dht/Token.html" title="class in org.apache.cassandra.dht">Token</a>> fullRange</pre>
<div class="block">The top level range that this MerkleTree covers.</div>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="MerkleTree(org.apache.cassandra.dht.IPartitioner, org.apache.cassandra.dht.Range, byte, long)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>MerkleTree</h4>
<pre>public MerkleTree(<a href="../../../../org/apache/cassandra/dht/IPartitioner.html" title="interface in org.apache.cassandra.dht">IPartitioner</a> partitioner,
<a href="../../../../org/apache/cassandra/dht/Range.html" title="class in org.apache.cassandra.dht">Range</a><<a href="../../../../org/apache/cassandra/dht/Token.html" title="class in org.apache.cassandra.dht">Token</a>> range,
byte hashdepth,
long maxsize)</pre>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>partitioner</code> - The partitioner in use.</dd><dd><code>range</code> - the range this tree covers</dd><dd><code>hashdepth</code> - The maximum depth of the tree. 100/(2^depth) is the %
of the key space covered by each subrange of a fully populated tree.</dd><dd><code>maxsize</code> - The maximum number of subranges in the tree.</dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="init()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>init</h4>
<pre>public void init()</pre>
<div class="block">Initializes this tree by splitting it until hashdepth is reached,
or until an additional level of splits would violate maxsize.
NB: Replaces all nodes in the tree.</div>
</li>
</ul>
<a name="partitioner()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>partitioner</h4>
<pre>public <a href="../../../../org/apache/cassandra/dht/IPartitioner.html" title="interface in org.apache.cassandra.dht">IPartitioner</a> partitioner()</pre>
</li>
</ul>
<a name="size()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>size</h4>
<pre>public long size()</pre>
<div class="block">The number of distinct ranges contained in this tree. This is a reasonable
measure of the memory usage of the tree (assuming 'this.order' is significant).</div>
</li>
</ul>
<a name="maxsize()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>maxsize</h4>
<pre>public long maxsize()</pre>
</li>
</ul>
<a name="maxsize(long)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>maxsize</h4>
<pre>public void maxsize(long maxsize)</pre>
</li>
</ul>
<a name="difference(org.apache.cassandra.utils.MerkleTree, org.apache.cassandra.utils.MerkleTree)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>difference</h4>
<pre>public static java.util.List<<a href="../../../../org/apache/cassandra/utils/MerkleTree.TreeRange.html" title="class in org.apache.cassandra.utils">MerkleTree.TreeRange</a>> difference(<a href="../../../../org/apache/cassandra/utils/MerkleTree.html" title="class in org.apache.cassandra.utils">MerkleTree</a> ltree,
<a href="../../../../org/apache/cassandra/utils/MerkleTree.html" title="class in org.apache.cassandra.utils">MerkleTree</a> rtree)</pre>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>ltree</code> - First tree.</dd><dd><code>rtree</code> - Second tree.</dd>
<dt><span class="strong">Returns:</span></dt><dd>A list of the largest contiguous ranges where the given trees disagree.</dd></dl>
</li>
</ul>
<a name="get(org.apache.cassandra.dht.Token)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>get</h4>
<pre>public <a href="../../../../org/apache/cassandra/utils/MerkleTree.TreeRange.html" title="class in org.apache.cassandra.utils">MerkleTree.TreeRange</a> get(<a href="../../../../org/apache/cassandra/dht/Token.html" title="class in org.apache.cassandra.dht">Token</a> t)</pre>
<div class="block">For testing purposes.
Gets the smallest range containing the token.</div>
</li>
</ul>
<a name="invalidate(org.apache.cassandra.dht.Token)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>invalidate</h4>
<pre>public void invalidate(<a href="../../../../org/apache/cassandra/dht/Token.html" title="class in org.apache.cassandra.dht">Token</a> t)</pre>
<div class="block">Invalidates the ranges containing the given token.
Useful for testing.</div>
</li>
</ul>
<a name="hash(org.apache.cassandra.dht.Range)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hash</h4>
<pre>public byte[] hash(<a href="../../../../org/apache/cassandra/dht/Range.html" title="class in org.apache.cassandra.dht">Range</a><<a href="../../../../org/apache/cassandra/dht/Token.html" title="class in org.apache.cassandra.dht">Token</a>> range)</pre>
<div class="block">Hash the given range in the tree. The range must have been generated
with recursive applications of partitioner.midpoint().
NB: Currently does not support wrapping ranges that do not end with
partitioner.getMinimumToken().</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>Null if any subrange of the range is invalid, or if the exact
range cannot be calculated using this tree.</dd></dl>
</li>
</ul>
<a name="split(org.apache.cassandra.dht.Token)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>split</h4>
<pre>public boolean split(<a href="../../../../org/apache/cassandra/dht/Token.html" title="class in org.apache.cassandra.dht">Token</a> t)</pre>
<div class="block">Splits the range containing the given token, if no tree limits would be
violated. If the range would be split to a depth below hashdepth, or if
the tree already contains maxsize subranges, this operation will fail.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>True if the range was successfully split.</dd></dl>
</li>
</ul>
<a name="invalids()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>invalids</h4>
<pre>public <a href="../../../../org/apache/cassandra/utils/MerkleTree.TreeRangeIterator.html" title="class in org.apache.cassandra.utils">MerkleTree.TreeRangeIterator</a> invalids()</pre>
<div class="block">Returns a lazy iterator of invalid TreeRanges that need to be filled
in order to make the given Range valid.</div>
</li>
</ul>
<a name="histogramOfRowSizePerLeaf()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>histogramOfRowSizePerLeaf</h4>
<pre>public <a href="../../../../org/apache/cassandra/utils/EstimatedHistogram.html" title="class in org.apache.cassandra.utils">EstimatedHistogram</a> histogramOfRowSizePerLeaf()</pre>
</li>
</ul>
<a name="histogramOfRowCountPerLeaf()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>histogramOfRowCountPerLeaf</h4>
<pre>public <a href="../../../../org/apache/cassandra/utils/EstimatedHistogram.html" title="class in org.apache.cassandra.utils">EstimatedHistogram</a> histogramOfRowCountPerLeaf()</pre>
</li>
</ul>
<a name="toString()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>toString</h4>
<pre>public java.lang.String toString()</pre>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>toString</code> in class <code>java.lang.Object</code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/MerkleTree.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/apache/cassandra/utils/MergeIterator.Reducer.html" title="class in org.apache.cassandra.utils"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../org/apache/cassandra/utils/MerkleTree.MerkleTreeSerializer.html" title="class in org.apache.cassandra.utils"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/cassandra/utils/MerkleTree.html" target="_top">Frames</a></li>
<li><a href="MerkleTree.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li><a href="#nested_class_summary">Nested</a> | </li>
<li><a href="#field_summary">Field</a> | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field_detail">Field</a> | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2014 The Apache Software Foundation</small></p>
</body>
</html>
| {
"content_hash": "ab5f96ca25dcc09f69fc2e1bc377d8e6",
"timestamp": "",
"source": "github",
"line_count": 668,
"max_line_length": 399,
"avg_line_length": 45.4685628742515,
"alnum_prop": 0.6728344253119547,
"repo_name": "vangav/vos_backend",
"id": "509d048d158af3a1116759769cef2b8170869ff3",
"size": "30373",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "apache-cassandra-2.1.2/javadoc/org/apache/cassandra/utils/MerkleTree.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "31912"
},
{
"name": "CSS",
"bytes": "68697"
},
{
"name": "CoffeeScript",
"bytes": "28149"
},
{
"name": "HTML",
"bytes": "140969"
},
{
"name": "Java",
"bytes": "2403319"
},
{
"name": "JavaScript",
"bytes": "1130298"
},
{
"name": "PowerShell",
"bytes": "37758"
},
{
"name": "Python",
"bytes": "312883"
},
{
"name": "Scala",
"bytes": "1906531"
},
{
"name": "Shell",
"bytes": "58628"
},
{
"name": "TSQL",
"bytes": "208586"
},
{
"name": "Thrift",
"bytes": "40240"
}
],
"symlink_target": ""
} |
package com.nobullet.graph;
import java.util.Optional;
/**
* Free form interface to calculate a position between self and other position.
*/
public interface VertexPosition {
/**
* Distance to other position.
*
* @param position Other position.
* @return Distance as an {@link Optional} of double.
*/
default Optional<Double> distanceTo(VertexPosition position) {
return Optional.empty();
}
/**
* Builds two dimensional position.
*
* @param x X coordinate.
* @param y Y coordinate.
* @return Two dimensional position.
*/
public static VertexPosition new2D(double x, double y) {
return new TwoDimensionalPosition(x, y);
}
/**
* Builds Earth geometric position.
*
* @param lon Longitude.
* @param lat Latitude.
* @return Earth geometric position.
*/
public static VertexPosition newEarthGeographic(double lon, double lat) {
return new EarthGeographicPosition(lon, lat);
}
}
/**
* Two dimensional position.
*/
class TwoDimensionalPosition implements VertexPosition, Cloneable {
final double x;
final double y;
public TwoDimensionalPosition(double x, double y) {
this.x = x;
this.y = y;
}
public TwoDimensionalPosition(TwoDimensionalPosition source) {
this(source.x, source.y);
}
/**
* Calculates distance between two positions.
*
* @param position Other position.
* @return Distance between two positions.
*/
@Override
public Optional<Double> distanceTo(VertexPosition position) {
if (getClass() != position.getClass()) {
return Optional.empty();
}
TwoDimensionalPosition other = (TwoDimensionalPosition) position;
double dx = this.x - other.x;
double dy = this.y - other.y;
return Optional.of(Math.sqrt(dx * dx + dy * dy));
}
@Override
public int hashCode() {
int hash = 7;
hash = 97 * hash + (int) (Double.doubleToLongBits(this.x) ^ (Double.doubleToLongBits(this.x) >>> 32));
hash = 97 * hash + (int) (Double.doubleToLongBits(this.y) ^ (Double.doubleToLongBits(this.y) >>> 32));
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null || getClass() != obj.getClass()) {
return false;
}
final TwoDimensionalPosition other = (TwoDimensionalPosition) obj;
if (Double.doubleToLongBits(this.x) != Double.doubleToLongBits(other.x)) {
return false;
}
if (Double.doubleToLongBits(this.y) != Double.doubleToLongBits(other.y)) {
return false;
}
return true;
}
/**
* Clones the position. Uses copy constructor.
*
* @return Copy of the object.
* @throws CloneNotSupportedException
*/
@Override
public Object clone() throws CloneNotSupportedException {
return new TwoDimensionalPosition(this);
}
}
/**
* Earth geographic position.
*/
class EarthGeographicPosition implements VertexPosition {
static final double RADIUS = 6371.0d;
final double lon;
final double lat;
public EarthGeographicPosition(double lon, double lat) {
this.lon = lon;
this.lat = lat;
}
public EarthGeographicPosition(EarthGeographicPosition source) {
this(source.lon, source.lat);
}
/**
* Calculates distance between two positions in Kilometers.
*
* @param position Other position.
* @return Distance between two positions in Kilometers.
*/
@Override
public Optional<Double> distanceTo(VertexPosition position) {
if (getClass() != position.getClass()) {
return Optional.empty();
}
EarthGeographicPosition other = (EarthGeographicPosition) position;
double sinDlat = Math.sin(Math.toRadians(this.lat - other.lat) / 2);
double sinDlon = Math.sin(Math.toRadians(this.lon - other.lon) / 2);
double a = sinDlat * sinDlat
+ Math.cos(Math.toRadians(other.lat)) * Math.cos(Math.toRadians(this.lat)) * sinDlon * sinDlon;
double angle = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
return Optional.of(angle * RADIUS);
}
@Override
public int hashCode() {
int hash = 7;
hash = 11 * hash + (int) (Double.doubleToLongBits(this.lon) ^ (Double.doubleToLongBits(this.lon) >>> 32));
hash = 11 * hash + (int) (Double.doubleToLongBits(this.lat) ^ (Double.doubleToLongBits(this.lat) >>> 32));
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null || getClass() != obj.getClass()) {
return false;
}
final EarthGeographicPosition other = (EarthGeographicPosition) obj;
if (Double.doubleToLongBits(this.lon) != Double.doubleToLongBits(other.lon)) {
return false;
}
return Double.doubleToLongBits(this.lat) == Double.doubleToLongBits(other.lat);
}
/**
* Clones the position. Uses copy constructor.
*
* @return Copy of the object.
* @throws CloneNotSupportedException
*/
@Override
public Object clone() throws CloneNotSupportedException {
return new EarthGeographicPosition(this);
}
}
| {
"content_hash": "daf47b009903a545f82963909042fab9",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 114,
"avg_line_length": 29.733333333333334,
"alnum_prop": 0.6195814648729447,
"repo_name": "nobullet/library",
"id": "094cd1b4c49c9f60f4fb404f19add092e56a9c2a",
"size": "5352",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/nobullet/graph/VertexPosition.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "486062"
}
],
"symlink_target": ""
} |
export const API_ENDPOINT: string = 'https://qc-inpections.herokuapp.com/api';
| {
"content_hash": "1dcc2ec902774c79227a5400064a00f8",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 78,
"avg_line_length": 79,
"alnum_prop": 0.759493670886076,
"repo_name": "luispalacios270/frontend-cleanApp",
"id": "952f1ed64baead97d4f484e149b6213a8e59f7ba",
"size": "232",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/global.ts",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "11517"
},
{
"name": "HTML",
"bytes": "31653"
},
{
"name": "JavaScript",
"bytes": "2956"
},
{
"name": "TypeScript",
"bytes": "103630"
}
],
"symlink_target": ""
} |
import { NavController, LoadingController, AlertController } from 'ionic-angular';
import { Component } from '@angular/core';
import { FormBuilder, Validators } from '@angular/forms';
import { AuthData } from '../../providers/auth-data';
import { EmailValidator } from '../../app/validators/email';
import { TabsPage } from '../tabs/tabs';
@Component({
selector: 'page-signup',
templateUrl: 'signup.html'
})
export class SignupPage {
public signupForm;
loading: any;
constructor(public nav: NavController, public authData: AuthData, public formBuilder: FormBuilder,
public loadingCtrl: LoadingController, public alertCtrl: AlertController)
{
this.signupForm = formBuilder.group({
email: ['', Validators.compose([Validators.required, EmailValidator.isValid])],
password: ['', Validators.compose([Validators.minLength(6), Validators.required])]
});
}
signupUser() {
if (!this.signupForm.valid) {
console.log(this.signupForm.value);
} else {
this.authData.signupUser(this.signupForm.value.email, this.signupForm.value.password)
.then( () => {
this.loading.dismiss().then( () => {
this.nav.setRoot(TabsPage);
});
}, (error) => {
this.loading.dismiss().then( () => {
this.alertCtrl.create({
message: error.message,
buttons: [{
text: 'Ok',
role: 'cancel'
}]
});
});
});
this.loading = this.loadingCtrl.create();
this.loading.present();
}
}
}
| {
"content_hash": "b23906068c7abcc76e01622c3c7cb8f4",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 101,
"avg_line_length": 30.647058823529413,
"alnum_prop": 0.6154830454254638,
"repo_name": "civicreactor/CivicMobileApp",
"id": "36b53b669d9dfe23aad2f97426a80dfc63679457",
"size": "1563",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/pages/signup/signup.ts",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "17908"
},
{
"name": "C",
"bytes": "1663"
},
{
"name": "C#",
"bytes": "39190"
},
{
"name": "C++",
"bytes": "217655"
},
{
"name": "CSS",
"bytes": "862244"
},
{
"name": "HTML",
"bytes": "34196"
},
{
"name": "Java",
"bytes": "438344"
},
{
"name": "JavaScript",
"bytes": "5528928"
},
{
"name": "Objective-C",
"bytes": "509921"
},
{
"name": "QML",
"bytes": "2765"
},
{
"name": "Shell",
"bytes": "2062"
},
{
"name": "TypeScript",
"bytes": "48355"
}
],
"symlink_target": ""
} |
package com.intellij.util.containers.hash;
import com.intellij.util.DeprecatedMethodException;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import java.util.AbstractSet;
import java.util.Iterator;
import java.util.Set;
/**
* @deprecated Use {@link java.util.HashSet}
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2020.2")
public class HashSet<E> extends AbstractSet<E> implements Set<E> {
private Entry<E>[] table;
private int capacity;
private int size;
private final float loadFactor;
public HashSet() {
this(0);
}
public HashSet(int capacity) {
this(capacity, HashUtil.DEFAULT_LOAD_FACTOR);
}
public HashSet(int capacity, float loadFactor) {
this.loadFactor = loadFactor;
clear(capacity);
DeprecatedMethodException.report("Use java.util.HashSet instead");
}
@Override
public boolean contains(Object key) {
final Entry<E>[] table = this.table;
final int hash = HashUtil.hash(key);
final int index = hash % table.length;
for (Entry<E> e = table[index]; e != null; e = e.hashNext) {
final E entryKey;
if (e.keyHash == hash && ((entryKey = e.key) == key || entryKey.equals(key))) {
return true;
}
}
return false;
}
@Override
public boolean add(E key) {
final Entry<E>[] table = this.table;
final int hash = HashUtil.hash(key);
final int index = hash % table.length;
for (Entry<E> e = table[index]; e != null; e = e.hashNext) {
final E entryKey;
if (e.keyHash == hash && ((entryKey = e.key) == key || entryKey.equals(key))) {
return false;
}
}
final Entry<E> e = new Entry<>(key);
e.hashNext = table[index];
table[index] = e;
size++;
if (size > capacity) {
rehash((int)(capacity * HashUtil.CAPACITY_MULTIPLE));
}
return true;
}
@Override
public boolean remove(Object key) {
final Entry<E>[] table = this.table;
final int hash = HashUtil.hash(key);
final int index = hash % table.length;
Entry<E> e = table[index];
if (e == null) return false;
E entryKey;
if (e.keyHash == hash && ((entryKey = e.key) == key || entryKey.equals(key))) {
table[index] = e.hashNext;
}
else {
for (; ; ) {
final Entry<E> last = e;
e = e.hashNext;
if (e == null) return false;
if (e.keyHash == hash && ((entryKey = e.key) == key || entryKey.equals(key))) {
last.hashNext = e.hashNext;
break;
}
}
}
size--;
return true;
}
@NotNull
@Override
public Iterator<E> iterator() {
return new HashSetIterator<E>() {
@Override
public E next() {
return nextEntry().key;
}
};
}
@Override
public int size() {
return size;
}
@Override
public boolean isEmpty() {
return size() == 0;
}
private void init(int capacity) {
table = new Entry[HashUtil.adjustTableSize((int)(capacity / loadFactor))];
this.capacity = capacity;
}
private void clear(int capacity) {
if (capacity < HashUtil.MIN_CAPACITY) {
capacity = HashUtil.MIN_CAPACITY;
}
init(capacity);
size = 0;
}
private void rehash(int capacity) {
final Iterator<Entry<E>> entries = new HashSetIterator<Entry<E>>() {
@Override
public Entry<E> next() {
return nextEntry();
}
};
init(capacity);
final Entry<E>[] table = this.table;
final int tableLen = table.length;
while (entries.hasNext()) {
final Entry<E> e = entries.next();
final int hash = e.keyHash % tableLen;
e.hashNext = table[hash];
table[hash] = e;
}
}
private static class Entry<E> {
private final E key;
private final int keyHash;
private Entry<E> hashNext;
Entry(final E key) {
this.key = key;
keyHash = HashUtil.hash(key);
}
}
private abstract class HashSetIterator<T> implements Iterator<T> {
private final Entry<E>[] table = HashSet.this.table;
private int index = 0;
private Entry<E> e = null;
private Entry<E> last;
HashSetIterator() {
initNextEntry();
}
@Override
public boolean hasNext() {
return e != null;
}
@Override
public void remove() {
if (last == null) {
throw new IllegalStateException();
}
HashSet.this.remove(last.key);
last = null;
}
protected Entry<E> nextEntry() {
final Entry<E> result = last = e;
initNextEntry();
return result;
}
private void initNextEntry() {
Entry<E> result = e;
if (result != null) {
result = result.hashNext;
}
final Entry<E>[] table = this.table;
while (result == null && index < table.length) {
result = table[index++];
}
e = result;
}
}
}
| {
"content_hash": "8b505674050f98e0ab681f698b6ab486",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 87,
"avg_line_length": 23.935960591133004,
"alnum_prop": 0.5933319613089113,
"repo_name": "siosio/intellij-community",
"id": "82fb0b0ad09e77037171e99d6c42e6d228c27efd",
"size": "5459",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "platform/util/src/com/intellij/util/containers/hash/HashSet.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
#include "config.h"
#include "LevelDBDatabase.h"
#if ENABLE(LEVELDB)
#include "LevelDBComparator.h"
#include "LevelDBIterator.h"
#include "LevelDBSlice.h"
#include <leveldb/comparator.h>
#include <leveldb/db.h>
#include <leveldb/slice.h>
#include <string>
#include <wtf/PassOwnPtr.h>
#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
static leveldb::Slice makeSlice(const Vector<char>& value)
{
return leveldb::Slice(value.data(), value.size());
}
static leveldb::Slice makeSlice(const LevelDBSlice& s)
{
return leveldb::Slice(s.begin(), s.end() - s.begin());
}
static LevelDBSlice makeLevelDBSlice(const leveldb::Slice& s)
{
return LevelDBSlice(s.data(), s.data() + s.size());
}
static Vector<char> makeVector(const std::string& s)
{
Vector<char> res;
res.append(s.c_str(), s.length());
return res;
}
namespace {
class ComparatorAdapter : public leveldb::Comparator {
public:
ComparatorAdapter(const LevelDBComparator* comparator)
: m_comparator(comparator)
{
}
virtual int Compare(const leveldb::Slice& a, const leveldb::Slice& b) const
{
return m_comparator->compare(makeLevelDBSlice(a), makeLevelDBSlice(b));
}
virtual const char* Name() const { return m_comparator->name(); }
// FIXME: Support the methods below in the future.
virtual void FindShortestSeparator(std::string* start, const leveldb::Slice& limit) const { }
virtual void FindShortSuccessor(std::string* key) const { }
private:
const LevelDBComparator* m_comparator;
};
}
LevelDBDatabase::LevelDBDatabase()
: m_db(0)
{
}
LevelDBDatabase::~LevelDBDatabase()
{
}
LevelDBDatabase* LevelDBDatabase::open(const String& fileName, const LevelDBComparator* comparator)
{
OwnPtr<ComparatorAdapter> comparatorAdapter(new ComparatorAdapter(comparator));
LevelDBDatabase* result = new LevelDBDatabase();
leveldb::Options options;
options.comparator = comparatorAdapter.get();
options.create_if_missing = true;
leveldb::DB* db;
leveldb::Status s = leveldb::DB::Open(options, fileName.utf8().data(), &db);
if (!s.ok()) {
delete result;
return 0;
}
result->m_db = WTF::adoptPtr(db);
result->m_comparatorAdapter = comparatorAdapter.release();
return result;
}
bool LevelDBDatabase::put(const LevelDBSlice& key, const Vector<char>& value)
{
leveldb::WriteOptions writeOptions;
writeOptions.sync = false;
return m_db->Put(writeOptions, makeSlice(key), makeSlice(value)).ok();
}
bool LevelDBDatabase::remove(const LevelDBSlice& key)
{
leveldb::WriteOptions writeOptions;
writeOptions.sync = false;
return m_db->Delete(writeOptions, makeSlice(key)).ok();
}
bool LevelDBDatabase::get(const LevelDBSlice& key, Vector<char>& value)
{
std::string result;
if (!m_db->Get(leveldb::ReadOptions(), makeSlice(key), &result).ok())
return false;
value = makeVector(result);
return true;
}
LevelDBIterator* LevelDBDatabase::newIterator()
{
leveldb::Iterator* i = m_db->NewIterator(leveldb::ReadOptions());
if (!i) // FIXME: Double check if we actually need to check this.
return 0;
return new LevelDBIterator(i);
}
} // namespace WebCore
#endif // ENABLE(LEVELDB)
| {
"content_hash": "5e9408888a3a33c6acdf1cd5142c4690",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 99,
"avg_line_length": 24.139705882352942,
"alnum_prop": 0.6926591532135242,
"repo_name": "mogoweb/webkit_for_android5.1",
"id": "45876312acfbdd510e95906ae15e2f70b5aba4a2",
"size": "4631",
"binary": false,
"copies": "15",
"ref": "refs/heads/master",
"path": "webkit/Source/WebCore/platform/leveldb/LevelDBDatabase.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AppleScript",
"bytes": "6772"
},
{
"name": "Assembly",
"bytes": "26025"
},
{
"name": "Awk",
"bytes": "2800"
},
{
"name": "Batchfile",
"bytes": "57337"
},
{
"name": "C",
"bytes": "7713030"
},
{
"name": "C++",
"bytes": "153178707"
},
{
"name": "CMake",
"bytes": "192330"
},
{
"name": "CSS",
"bytes": "483041"
},
{
"name": "Common Lisp",
"bytes": "9920"
},
{
"name": "DIGITAL Command Language",
"bytes": "5243"
},
{
"name": "DTrace",
"bytes": "1931"
},
{
"name": "Go",
"bytes": "3744"
},
{
"name": "HTML",
"bytes": "14998422"
},
{
"name": "Java",
"bytes": "1522083"
},
{
"name": "JavaScript",
"bytes": "18008829"
},
{
"name": "Lex",
"bytes": "42554"
},
{
"name": "Lua",
"bytes": "13768"
},
{
"name": "M4",
"bytes": "49839"
},
{
"name": "Makefile",
"bytes": "476166"
},
{
"name": "Module Management System",
"bytes": "9756"
},
{
"name": "Objective-C",
"bytes": "2798053"
},
{
"name": "Objective-C++",
"bytes": "7846322"
},
{
"name": "PHP",
"bytes": "66595"
},
{
"name": "Perl",
"bytes": "1130475"
},
{
"name": "Perl 6",
"bytes": "445215"
},
{
"name": "Python",
"bytes": "5503045"
},
{
"name": "QML",
"bytes": "3331"
},
{
"name": "QMake",
"bytes": "294800"
},
{
"name": "R",
"bytes": "290"
},
{
"name": "Roff",
"bytes": "273562"
},
{
"name": "Ruby",
"bytes": "81928"
},
{
"name": "Scheme",
"bytes": "10604"
},
{
"name": "Shell",
"bytes": "488223"
},
{
"name": "Yacc",
"bytes": "153801"
},
{
"name": "xBase",
"bytes": "328"
}
],
"symlink_target": ""
} |
package androidx.test.ui.app.provider;
import static com.google.common.base.Preconditions.checkNotNull;
import android.Manifest.permission;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.os.ParcelFileDescriptor;
import android.util.Log;
import android.webkit.MimeTypeMap;
import androidx.annotation.NonNull;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
/**
* A ContentProvider to provide read/write access to files in a hosted directory.
*/
public class SimpleFileContentProvider extends ContentProvider {
private static final String TAG = "SimpleFileCP";
private final File hostedDirectory;
SimpleFileContentProvider(File hostedDirectory) {
try {
this.hostedDirectory = checkNotNull(hostedDirectory).getCanonicalFile();
} catch (IOException ioe) {
Log.e(TAG, "Error getting canonical form of hosted directory " + hostedDirectory);
throw new RuntimeException(ioe);
}
}
@Override
public boolean onCreate() {
if (!hostedDirectory.exists() && !hostedDirectory.mkdirs()) {
Log.e(TAG, String.format("Fail to create hosted directory %s", hostedDirectory));
return false;
}
if (!hostedDirectory.isDirectory()) {
Log.e(TAG, String.format("Hosted directory %s is not a directory", hostedDirectory));
return false;
}
if (!hostedDirectory.canWrite()) {
Log.e(TAG, String.format("Hosted directory %s is not writable", hostedDirectory));
return false;
}
return true;
}
@Override
public String getType(@NonNull Uri uri) {
checkNotNull(uri);
String extension = MimeTypeMap.getFileExtensionFromUrl(uri.toString());
MimeTypeMap map = MimeTypeMap.getSingleton();
return map.getMimeTypeFromExtension(extension);
}
@Override
public ParcelFileDescriptor openFile(@NonNull Uri uri, @NonNull String mode)
throws FileNotFoundException {
checkNotNull(uri);
checkNotNull(mode);
String lowerMode = mode.toLowerCase();
boolean withWriteAccess = lowerMode.contains("w") || lowerMode.contains("t");
if (withWriteAccess) {
// Requires caller has WRITE_EXTERNAL_STORAGE permission for "w" or "t"
String requiredPermission = permission.WRITE_EXTERNAL_STORAGE;
if (checkNotNull(getContext()).checkCallingPermission(requiredPermission)
== PackageManager.PERMISSION_DENIED) {
throw new SecurityException(
String.format("Caller does not have permission %s to call openFile with mode %s!",
requiredPermission, mode));
}
}
File requestedFile = getFileFromUri(uri);
// ParcelFileDescriptor.open won't create parent directory when necessary
File parentDir = requestedFile.getParentFile();
if (withWriteAccess && !parentDir.exists() && !parentDir.mkdirs()) {
throw new FileNotFoundException(
String.format("error happened creating parent dir for file %s", requestedFile));
}
return ParcelFileDescriptor.open(requestedFile, parseMode(mode));
}
@Override
public Uri insert(@NonNull Uri uri, ContentValues contentValues) {
throw new UnsupportedOperationException();
}
@Override
public Cursor query(@NonNull Uri uri, String[] strings, String s, String[] strings1, String s1) {
throw new UnsupportedOperationException();
}
@Override
public int update(@NonNull Uri uri, ContentValues contentValues, String s, String[] strings) {
throw new UnsupportedOperationException();
}
@Override
public int delete(@NonNull Uri uri, String s, String[] strings) {
throw new UnsupportedOperationException();
}
private File getFileFromUri(Uri uri) throws FileNotFoundException {
File requestedFile = null;
try {
requestedFile = new File(hostedDirectory, uri.getPath()).getCanonicalFile();
} catch (IOException ioe) {
throw new FileNotFoundException(
String.format("Error getting file from uri %s, exception: %s", uri, ioe.getMessage()));
}
File checkFile = requestedFile.getAbsoluteFile();
while (null != checkFile) {
if (checkFile.equals(hostedDirectory)) {
return requestedFile;
}
checkFile = checkFile.getParentFile();
}
throw new SecurityException(
String.format("Uri %s refers to a file not managed by this provider", uri));
}
private static int parseMode(String mode) {
if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
return ParcelFileDescriptor.parseMode(mode);
} else {
final int modeBits;
if ("r".equals(mode)) {
modeBits = ParcelFileDescriptor.MODE_READ_ONLY;
} else if ("w".equals(mode) || "wt".equals(mode)) {
modeBits = ParcelFileDescriptor.MODE_WRITE_ONLY
| ParcelFileDescriptor.MODE_CREATE
| ParcelFileDescriptor.MODE_TRUNCATE;
} else if ("wa".equals(mode)) {
modeBits = ParcelFileDescriptor.MODE_WRITE_ONLY
| ParcelFileDescriptor.MODE_CREATE
| ParcelFileDescriptor.MODE_APPEND;
} else if ("rw".equals(mode)) {
modeBits = ParcelFileDescriptor.MODE_READ_WRITE
| ParcelFileDescriptor.MODE_CREATE;
} else if ("rwt".equals(mode)) {
modeBits = ParcelFileDescriptor.MODE_READ_WRITE
| ParcelFileDescriptor.MODE_CREATE
| ParcelFileDescriptor.MODE_TRUNCATE;
} else {
throw new IllegalArgumentException("Bad mode '" + mode + "'");
}
return modeBits;
}
}
}
| {
"content_hash": "f6686548d35b64a95e960ef82efa9068",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 99,
"avg_line_length": 35.129629629629626,
"alnum_prop": 0.6965383939553681,
"repo_name": "android/android-test",
"id": "bb57c53b966a70f015abdd8250f7e3b0b437b821",
"size": "6310",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "testapps/ui_testapp/java/androidx/test/ui/app/provider/SimpleFileContentProvider.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AIDL",
"bytes": "10175"
},
{
"name": "Dockerfile",
"bytes": "837"
},
{
"name": "HTML",
"bytes": "29993"
},
{
"name": "Java",
"bytes": "4893629"
},
{
"name": "Kotlin",
"bytes": "176390"
},
{
"name": "Python",
"bytes": "308427"
},
{
"name": "Shell",
"bytes": "3950"
},
{
"name": "Starlark",
"bytes": "354299"
}
],
"symlink_target": ""
} |
/*
* INET An implementation of the TCP/IP protocol suite for the LINUX
* operating system. INET is implemented using the BSD Socket
* interface as the means of communication with the user level.
*
* This file implements the various access functions for the
* PROC file system. It is mainly used for debugging and
* statistics.
*
* Authors: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
* Gerald J. Heim, <heim@peanuts.informatik.uni-tuebingen.de>
* Fred Baumgarten, <dc6iq@insu1.etec.uni-karlsruhe.de>
* Erik Schoenfelder, <schoenfr@ibr.cs.tu-bs.de>
*
* Fixes:
* Alan Cox : UDP sockets show the rxqueue/txqueue
* using hint flag for the netinfo.
* Pauline Middelink : identd support
* Alan Cox : Make /proc safer.
* Erik Schoenfelder : /proc/net/snmp
* Alan Cox : Handle dead sockets properly.
* Gerhard Koerting : Show both timers
* Alan Cox : Allow inode to be NULL (kernel socket)
* Andi Kleen : Add support for open_requests and
* split functions for more readibility.
* Andi Kleen : Add support for /proc/net/netstat
* Arnaldo C. Melo : Convert to seq_file
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <linux/types.h>
#include <net/net_namespace.h>
#include <net/icmp.h>
#include <net/protocol.h>
#include <net/tcp.h>
#include <net/udp.h>
#include <net/udplite.h>
#include <linux/bottom_half.h>
#include <linux/inetdevice.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/export.h>
#include <net/sock.h>
#include <net/raw.h>
/*
* Report socket allocation statistics [mea@utu.fi]
*/
static int sockstat_seq_show(struct seq_file *seq, void *v)
{
struct net *net = seq->private;
unsigned int frag_mem;
int orphans, sockets;
local_bh_disable();
orphans = percpu_counter_sum_positive(&tcp_orphan_count);
sockets = proto_sockets_allocated_sum_positive(&tcp_prot);
local_bh_enable();
socket_seq_show(seq);
seq_printf(seq, "TCP: inuse %d orphan %d tw %d alloc %d mem %ld\n",
sock_prot_inuse_get(net, &tcp_prot), orphans,
atomic_read(&tcp_death_row.tw_count), sockets,
proto_memory_allocated(&tcp_prot));
seq_printf(seq, "UDP: inuse %d mem %ld\n",
sock_prot_inuse_get(net, &udp_prot),
proto_memory_allocated(&udp_prot));
seq_printf(seq, "UDPLITE: inuse %d\n",
sock_prot_inuse_get(net, &udplite_prot));
seq_printf(seq, "RAW: inuse %d\n",
sock_prot_inuse_get(net, &raw_prot));
frag_mem = ip_frag_mem(net);
seq_printf(seq, "FRAG: inuse %u memory %u\n", !!frag_mem, frag_mem);
return 0;
}
static int sockstat_seq_open(struct inode *inode, struct file *file)
{
return single_open_net(inode, file, sockstat_seq_show);
}
static const struct file_operations sockstat_seq_fops = {
.owner = THIS_MODULE,
.open = sockstat_seq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release_net,
};
/* snmp items */
static const struct snmp_mib snmp4_ipstats_list[] = {
SNMP_MIB_ITEM("InReceives", IPSTATS_MIB_INPKTS),
SNMP_MIB_ITEM("InHdrErrors", IPSTATS_MIB_INHDRERRORS),
SNMP_MIB_ITEM("InAddrErrors", IPSTATS_MIB_INADDRERRORS),
SNMP_MIB_ITEM("ForwDatagrams", IPSTATS_MIB_OUTFORWDATAGRAMS),
SNMP_MIB_ITEM("InUnknownProtos", IPSTATS_MIB_INUNKNOWNPROTOS),
SNMP_MIB_ITEM("InDiscards", IPSTATS_MIB_INDISCARDS),
SNMP_MIB_ITEM("InDelivers", IPSTATS_MIB_INDELIVERS),
SNMP_MIB_ITEM("OutRequests", IPSTATS_MIB_OUTPKTS),
SNMP_MIB_ITEM("OutDiscards", IPSTATS_MIB_OUTDISCARDS),
SNMP_MIB_ITEM("OutNoRoutes", IPSTATS_MIB_OUTNOROUTES),
SNMP_MIB_ITEM("ReasmTimeout", IPSTATS_MIB_REASMTIMEOUT),
SNMP_MIB_ITEM("ReasmReqds", IPSTATS_MIB_REASMREQDS),
SNMP_MIB_ITEM("ReasmOKs", IPSTATS_MIB_REASMOKS),
SNMP_MIB_ITEM("ReasmFails", IPSTATS_MIB_REASMFAILS),
SNMP_MIB_ITEM("FragOKs", IPSTATS_MIB_FRAGOKS),
SNMP_MIB_ITEM("FragFails", IPSTATS_MIB_FRAGFAILS),
SNMP_MIB_ITEM("FragCreates", IPSTATS_MIB_FRAGCREATES),
SNMP_MIB_SENTINEL
};
/* Following items are displayed in /proc/net/netstat */
static const struct snmp_mib snmp4_ipextstats_list[] = {
SNMP_MIB_ITEM("InNoRoutes", IPSTATS_MIB_INNOROUTES),
SNMP_MIB_ITEM("InTruncatedPkts", IPSTATS_MIB_INTRUNCATEDPKTS),
SNMP_MIB_ITEM("InMcastPkts", IPSTATS_MIB_INMCASTPKTS),
SNMP_MIB_ITEM("OutMcastPkts", IPSTATS_MIB_OUTMCASTPKTS),
SNMP_MIB_ITEM("InBcastPkts", IPSTATS_MIB_INBCASTPKTS),
SNMP_MIB_ITEM("OutBcastPkts", IPSTATS_MIB_OUTBCASTPKTS),
SNMP_MIB_ITEM("InOctets", IPSTATS_MIB_INOCTETS),
SNMP_MIB_ITEM("OutOctets", IPSTATS_MIB_OUTOCTETS),
SNMP_MIB_ITEM("InMcastOctets", IPSTATS_MIB_INMCASTOCTETS),
SNMP_MIB_ITEM("OutMcastOctets", IPSTATS_MIB_OUTMCASTOCTETS),
SNMP_MIB_ITEM("InBcastOctets", IPSTATS_MIB_INBCASTOCTETS),
SNMP_MIB_ITEM("OutBcastOctets", IPSTATS_MIB_OUTBCASTOCTETS),
/* Non RFC4293 fields */
SNMP_MIB_ITEM("InCsumErrors", IPSTATS_MIB_CSUMERRORS),
SNMP_MIB_ITEM("InNoECTPkts", IPSTATS_MIB_NOECTPKTS),
SNMP_MIB_ITEM("InECT1Pkts", IPSTATS_MIB_ECT1PKTS),
SNMP_MIB_ITEM("InECT0Pkts", IPSTATS_MIB_ECT0PKTS),
SNMP_MIB_ITEM("InCEPkts", IPSTATS_MIB_CEPKTS),
SNMP_MIB_SENTINEL
};
static const struct {
const char *name;
int index;
} icmpmibmap[] = {
{ "DestUnreachs", ICMP_DEST_UNREACH },
{ "TimeExcds", ICMP_TIME_EXCEEDED },
{ "ParmProbs", ICMP_PARAMETERPROB },
{ "SrcQuenchs", ICMP_SOURCE_QUENCH },
{ "Redirects", ICMP_REDIRECT },
{ "Echos", ICMP_ECHO },
{ "EchoReps", ICMP_ECHOREPLY },
{ "Timestamps", ICMP_TIMESTAMP },
{ "TimestampReps", ICMP_TIMESTAMPREPLY },
{ "AddrMasks", ICMP_ADDRESS },
{ "AddrMaskReps", ICMP_ADDRESSREPLY },
{ NULL, 0 }
};
static const struct snmp_mib snmp4_tcp_list[] = {
SNMP_MIB_ITEM("RtoAlgorithm", TCP_MIB_RTOALGORITHM),
SNMP_MIB_ITEM("RtoMin", TCP_MIB_RTOMIN),
SNMP_MIB_ITEM("RtoMax", TCP_MIB_RTOMAX),
SNMP_MIB_ITEM("MaxConn", TCP_MIB_MAXCONN),
SNMP_MIB_ITEM("ActiveOpens", TCP_MIB_ACTIVEOPENS),
SNMP_MIB_ITEM("PassiveOpens", TCP_MIB_PASSIVEOPENS),
SNMP_MIB_ITEM("AttemptFails", TCP_MIB_ATTEMPTFAILS),
SNMP_MIB_ITEM("EstabResets", TCP_MIB_ESTABRESETS),
SNMP_MIB_ITEM("CurrEstab", TCP_MIB_CURRESTAB),
SNMP_MIB_ITEM("InSegs", TCP_MIB_INSEGS),
SNMP_MIB_ITEM("OutSegs", TCP_MIB_OUTSEGS),
SNMP_MIB_ITEM("RetransSegs", TCP_MIB_RETRANSSEGS),
SNMP_MIB_ITEM("InErrs", TCP_MIB_INERRS),
SNMP_MIB_ITEM("OutRsts", TCP_MIB_OUTRSTS),
SNMP_MIB_ITEM("InCsumErrors", TCP_MIB_CSUMERRORS),
SNMP_MIB_SENTINEL
};
static const struct snmp_mib snmp4_udp_list[] = {
SNMP_MIB_ITEM("InDatagrams", UDP_MIB_INDATAGRAMS),
SNMP_MIB_ITEM("NoPorts", UDP_MIB_NOPORTS),
SNMP_MIB_ITEM("InErrors", UDP_MIB_INERRORS),
SNMP_MIB_ITEM("OutDatagrams", UDP_MIB_OUTDATAGRAMS),
SNMP_MIB_ITEM("RcvbufErrors", UDP_MIB_RCVBUFERRORS),
SNMP_MIB_ITEM("SndbufErrors", UDP_MIB_SNDBUFERRORS),
SNMP_MIB_ITEM("InCsumErrors", UDP_MIB_CSUMERRORS),
SNMP_MIB_ITEM("IgnoredMulti", UDP_MIB_IGNOREDMULTI),
SNMP_MIB_SENTINEL
};
static const struct snmp_mib snmp4_net_list[] = {
SNMP_MIB_ITEM("SyncookiesSent", LINUX_MIB_SYNCOOKIESSENT),
SNMP_MIB_ITEM("SyncookiesRecv", LINUX_MIB_SYNCOOKIESRECV),
SNMP_MIB_ITEM("SyncookiesFailed", LINUX_MIB_SYNCOOKIESFAILED),
SNMP_MIB_ITEM("EmbryonicRsts", LINUX_MIB_EMBRYONICRSTS),
SNMP_MIB_ITEM("PruneCalled", LINUX_MIB_PRUNECALLED),
SNMP_MIB_ITEM("RcvPruned", LINUX_MIB_RCVPRUNED),
SNMP_MIB_ITEM("OfoPruned", LINUX_MIB_OFOPRUNED),
SNMP_MIB_ITEM("OutOfWindowIcmps", LINUX_MIB_OUTOFWINDOWICMPS),
SNMP_MIB_ITEM("LockDroppedIcmps", LINUX_MIB_LOCKDROPPEDICMPS),
SNMP_MIB_ITEM("ArpFilter", LINUX_MIB_ARPFILTER),
SNMP_MIB_ITEM("TW", LINUX_MIB_TIMEWAITED),
SNMP_MIB_ITEM("TWRecycled", LINUX_MIB_TIMEWAITRECYCLED),
SNMP_MIB_ITEM("TWKilled", LINUX_MIB_TIMEWAITKILLED),
SNMP_MIB_ITEM("PAWSPassive", LINUX_MIB_PAWSPASSIVEREJECTED),
SNMP_MIB_ITEM("PAWSActive", LINUX_MIB_PAWSACTIVEREJECTED),
SNMP_MIB_ITEM("PAWSEstab", LINUX_MIB_PAWSESTABREJECTED),
SNMP_MIB_ITEM("DelayedACKs", LINUX_MIB_DELAYEDACKS),
SNMP_MIB_ITEM("DelayedACKLocked", LINUX_MIB_DELAYEDACKLOCKED),
SNMP_MIB_ITEM("DelayedACKLost", LINUX_MIB_DELAYEDACKLOST),
SNMP_MIB_ITEM("ListenOverflows", LINUX_MIB_LISTENOVERFLOWS),
SNMP_MIB_ITEM("ListenDrops", LINUX_MIB_LISTENDROPS),
SNMP_MIB_ITEM("TCPPrequeued", LINUX_MIB_TCPPREQUEUED),
SNMP_MIB_ITEM("TCPDirectCopyFromBacklog", LINUX_MIB_TCPDIRECTCOPYFROMBACKLOG),
SNMP_MIB_ITEM("TCPDirectCopyFromPrequeue", LINUX_MIB_TCPDIRECTCOPYFROMPREQUEUE),
SNMP_MIB_ITEM("TCPPrequeueDropped", LINUX_MIB_TCPPREQUEUEDROPPED),
SNMP_MIB_ITEM("TCPHPHits", LINUX_MIB_TCPHPHITS),
SNMP_MIB_ITEM("TCPHPHitsToUser", LINUX_MIB_TCPHPHITSTOUSER),
SNMP_MIB_ITEM("TCPPureAcks", LINUX_MIB_TCPPUREACKS),
SNMP_MIB_ITEM("TCPHPAcks", LINUX_MIB_TCPHPACKS),
SNMP_MIB_ITEM("TCPRenoRecovery", LINUX_MIB_TCPRENORECOVERY),
SNMP_MIB_ITEM("TCPSackRecovery", LINUX_MIB_TCPSACKRECOVERY),
SNMP_MIB_ITEM("TCPSACKReneging", LINUX_MIB_TCPSACKRENEGING),
SNMP_MIB_ITEM("TCPFACKReorder", LINUX_MIB_TCPFACKREORDER),
SNMP_MIB_ITEM("TCPSACKReorder", LINUX_MIB_TCPSACKREORDER),
SNMP_MIB_ITEM("TCPRenoReorder", LINUX_MIB_TCPRENOREORDER),
SNMP_MIB_ITEM("TCPTSReorder", LINUX_MIB_TCPTSREORDER),
SNMP_MIB_ITEM("TCPFullUndo", LINUX_MIB_TCPFULLUNDO),
SNMP_MIB_ITEM("TCPPartialUndo", LINUX_MIB_TCPPARTIALUNDO),
SNMP_MIB_ITEM("TCPDSACKUndo", LINUX_MIB_TCPDSACKUNDO),
SNMP_MIB_ITEM("TCPLossUndo", LINUX_MIB_TCPLOSSUNDO),
SNMP_MIB_ITEM("TCPLostRetransmit", LINUX_MIB_TCPLOSTRETRANSMIT),
SNMP_MIB_ITEM("TCPRenoFailures", LINUX_MIB_TCPRENOFAILURES),
SNMP_MIB_ITEM("TCPSackFailures", LINUX_MIB_TCPSACKFAILURES),
SNMP_MIB_ITEM("TCPLossFailures", LINUX_MIB_TCPLOSSFAILURES),
SNMP_MIB_ITEM("TCPFastRetrans", LINUX_MIB_TCPFASTRETRANS),
SNMP_MIB_ITEM("TCPForwardRetrans", LINUX_MIB_TCPFORWARDRETRANS),
SNMP_MIB_ITEM("TCPSlowStartRetrans", LINUX_MIB_TCPSLOWSTARTRETRANS),
SNMP_MIB_ITEM("TCPTimeouts", LINUX_MIB_TCPTIMEOUTS),
SNMP_MIB_ITEM("TCPLossProbes", LINUX_MIB_TCPLOSSPROBES),
SNMP_MIB_ITEM("TCPLossProbeRecovery", LINUX_MIB_TCPLOSSPROBERECOVERY),
SNMP_MIB_ITEM("TCPRenoRecoveryFail", LINUX_MIB_TCPRENORECOVERYFAIL),
SNMP_MIB_ITEM("TCPSackRecoveryFail", LINUX_MIB_TCPSACKRECOVERYFAIL),
SNMP_MIB_ITEM("TCPSchedulerFailed", LINUX_MIB_TCPSCHEDULERFAILED),
SNMP_MIB_ITEM("TCPRcvCollapsed", LINUX_MIB_TCPRCVCOLLAPSED),
SNMP_MIB_ITEM("TCPDSACKOldSent", LINUX_MIB_TCPDSACKOLDSENT),
SNMP_MIB_ITEM("TCPDSACKOfoSent", LINUX_MIB_TCPDSACKOFOSENT),
SNMP_MIB_ITEM("TCPDSACKRecv", LINUX_MIB_TCPDSACKRECV),
SNMP_MIB_ITEM("TCPDSACKOfoRecv", LINUX_MIB_TCPDSACKOFORECV),
SNMP_MIB_ITEM("TCPAbortOnData", LINUX_MIB_TCPABORTONDATA),
SNMP_MIB_ITEM("TCPAbortOnClose", LINUX_MIB_TCPABORTONCLOSE),
SNMP_MIB_ITEM("TCPAbortOnMemory", LINUX_MIB_TCPABORTONMEMORY),
SNMP_MIB_ITEM("TCPAbortOnTimeout", LINUX_MIB_TCPABORTONTIMEOUT),
SNMP_MIB_ITEM("TCPAbortOnLinger", LINUX_MIB_TCPABORTONLINGER),
SNMP_MIB_ITEM("TCPAbortFailed", LINUX_MIB_TCPABORTFAILED),
SNMP_MIB_ITEM("TCPMemoryPressures", LINUX_MIB_TCPMEMORYPRESSURES),
SNMP_MIB_ITEM("TCPSACKDiscard", LINUX_MIB_TCPSACKDISCARD),
SNMP_MIB_ITEM("TCPDSACKIgnoredOld", LINUX_MIB_TCPDSACKIGNOREDOLD),
SNMP_MIB_ITEM("TCPDSACKIgnoredNoUndo", LINUX_MIB_TCPDSACKIGNOREDNOUNDO),
SNMP_MIB_ITEM("TCPSpuriousRTOs", LINUX_MIB_TCPSPURIOUSRTOS),
SNMP_MIB_ITEM("TCPMD5NotFound", LINUX_MIB_TCPMD5NOTFOUND),
SNMP_MIB_ITEM("TCPMD5Unexpected", LINUX_MIB_TCPMD5UNEXPECTED),
SNMP_MIB_ITEM("TCPSackShifted", LINUX_MIB_SACKSHIFTED),
SNMP_MIB_ITEM("TCPSackMerged", LINUX_MIB_SACKMERGED),
SNMP_MIB_ITEM("TCPSackShiftFallback", LINUX_MIB_SACKSHIFTFALLBACK),
SNMP_MIB_ITEM("TCPBacklogDrop", LINUX_MIB_TCPBACKLOGDROP),
SNMP_MIB_ITEM("TCPMinTTLDrop", LINUX_MIB_TCPMINTTLDROP),
SNMP_MIB_ITEM("TCPDeferAcceptDrop", LINUX_MIB_TCPDEFERACCEPTDROP),
SNMP_MIB_ITEM("IPReversePathFilter", LINUX_MIB_IPRPFILTER),
SNMP_MIB_ITEM("TCPTimeWaitOverflow", LINUX_MIB_TCPTIMEWAITOVERFLOW),
SNMP_MIB_ITEM("TCPReqQFullDoCookies", LINUX_MIB_TCPREQQFULLDOCOOKIES),
SNMP_MIB_ITEM("TCPReqQFullDrop", LINUX_MIB_TCPREQQFULLDROP),
SNMP_MIB_ITEM("TCPRetransFail", LINUX_MIB_TCPRETRANSFAIL),
SNMP_MIB_ITEM("TCPRcvCoalesce", LINUX_MIB_TCPRCVCOALESCE),
SNMP_MIB_ITEM("TCPOFOQueue", LINUX_MIB_TCPOFOQUEUE),
SNMP_MIB_ITEM("TCPOFODrop", LINUX_MIB_TCPOFODROP),
SNMP_MIB_ITEM("TCPOFOMerge", LINUX_MIB_TCPOFOMERGE),
SNMP_MIB_ITEM("TCPChallengeACK", LINUX_MIB_TCPCHALLENGEACK),
SNMP_MIB_ITEM("TCPSYNChallenge", LINUX_MIB_TCPSYNCHALLENGE),
SNMP_MIB_ITEM("TCPFastOpenActive", LINUX_MIB_TCPFASTOPENACTIVE),
SNMP_MIB_ITEM("TCPFastOpenActiveFail", LINUX_MIB_TCPFASTOPENACTIVEFAIL),
SNMP_MIB_ITEM("TCPFastOpenPassive", LINUX_MIB_TCPFASTOPENPASSIVE),
SNMP_MIB_ITEM("TCPFastOpenPassiveFail", LINUX_MIB_TCPFASTOPENPASSIVEFAIL),
SNMP_MIB_ITEM("TCPFastOpenListenOverflow", LINUX_MIB_TCPFASTOPENLISTENOVERFLOW),
SNMP_MIB_ITEM("TCPFastOpenCookieReqd", LINUX_MIB_TCPFASTOPENCOOKIEREQD),
SNMP_MIB_ITEM("TCPSpuriousRtxHostQueues", LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES),
SNMP_MIB_ITEM("BusyPollRxPackets", LINUX_MIB_BUSYPOLLRXPACKETS),
SNMP_MIB_ITEM("TCPAutoCorking", LINUX_MIB_TCPAUTOCORKING),
SNMP_MIB_ITEM("TCPFromZeroWindowAdv", LINUX_MIB_TCPFROMZEROWINDOWADV),
SNMP_MIB_ITEM("TCPToZeroWindowAdv", LINUX_MIB_TCPTOZEROWINDOWADV),
SNMP_MIB_ITEM("TCPWantZeroWindowAdv", LINUX_MIB_TCPWANTZEROWINDOWADV),
SNMP_MIB_ITEM("TCPSynRetrans", LINUX_MIB_TCPSYNRETRANS),
SNMP_MIB_ITEM("TCPOrigDataSent", LINUX_MIB_TCPORIGDATASENT),
SNMP_MIB_ITEM("TCPHystartTrainDetect", LINUX_MIB_TCPHYSTARTTRAINDETECT),
SNMP_MIB_ITEM("TCPHystartTrainCwnd", LINUX_MIB_TCPHYSTARTTRAINCWND),
SNMP_MIB_ITEM("TCPHystartDelayDetect", LINUX_MIB_TCPHYSTARTDELAYDETECT),
SNMP_MIB_ITEM("TCPHystartDelayCwnd", LINUX_MIB_TCPHYSTARTDELAYCWND),
SNMP_MIB_ITEM("TCPACKSkippedSynRecv", LINUX_MIB_TCPACKSKIPPEDSYNRECV),
SNMP_MIB_ITEM("TCPACKSkippedPAWS", LINUX_MIB_TCPACKSKIPPEDPAWS),
SNMP_MIB_ITEM("TCPACKSkippedSeq", LINUX_MIB_TCPACKSKIPPEDSEQ),
SNMP_MIB_ITEM("TCPACKSkippedFinWait2", LINUX_MIB_TCPACKSKIPPEDFINWAIT2),
SNMP_MIB_ITEM("TCPACKSkippedTimeWait", LINUX_MIB_TCPACKSKIPPEDTIMEWAIT),
SNMP_MIB_ITEM("TCPACKSkippedChallenge", LINUX_MIB_TCPACKSKIPPEDCHALLENGE),
SNMP_MIB_ITEM("TCPWinProbe", LINUX_MIB_TCPWINPROBE),
SNMP_MIB_ITEM("TCPKeepAlive", LINUX_MIB_TCPKEEPALIVE),
SNMP_MIB_ITEM("TCPMTUPFail", LINUX_MIB_TCPMTUPFAIL),
SNMP_MIB_ITEM("TCPMTUPSuccess", LINUX_MIB_TCPMTUPSUCCESS),
SNMP_MIB_SENTINEL
};
static void icmpmsg_put_line(struct seq_file *seq, unsigned long *vals,
unsigned short *type, int count)
{
int j;
if (count) {
seq_puts(seq, "\nIcmpMsg:");
for (j = 0; j < count; ++j)
seq_printf(seq, " %sType%u",
type[j] & 0x100 ? "Out" : "In",
type[j] & 0xff);
seq_puts(seq, "\nIcmpMsg:");
for (j = 0; j < count; ++j)
seq_printf(seq, " %lu", vals[j]);
}
}
static void icmpmsg_put(struct seq_file *seq)
{
#define PERLINE 16
int i, count;
unsigned short type[PERLINE];
unsigned long vals[PERLINE], val;
struct net *net = seq->private;
count = 0;
for (i = 0; i < ICMPMSG_MIB_MAX; i++) {
val = atomic_long_read(&net->mib.icmpmsg_statistics->mibs[i]);
if (val) {
type[count] = i;
vals[count++] = val;
}
if (count == PERLINE) {
icmpmsg_put_line(seq, vals, type, count);
count = 0;
}
}
icmpmsg_put_line(seq, vals, type, count);
#undef PERLINE
}
static void icmp_put(struct seq_file *seq)
{
int i;
struct net *net = seq->private;
atomic_long_t *ptr = net->mib.icmpmsg_statistics->mibs;
seq_puts(seq, "\nIcmp: InMsgs InErrors InCsumErrors");
for (i = 0; icmpmibmap[i].name != NULL; i++)
seq_printf(seq, " In%s", icmpmibmap[i].name);
seq_puts(seq, " OutMsgs OutErrors");
for (i = 0; icmpmibmap[i].name != NULL; i++)
seq_printf(seq, " Out%s", icmpmibmap[i].name);
seq_printf(seq, "\nIcmp: %lu %lu %lu",
snmp_fold_field(net->mib.icmp_statistics, ICMP_MIB_INMSGS),
snmp_fold_field(net->mib.icmp_statistics, ICMP_MIB_INERRORS),
snmp_fold_field(net->mib.icmp_statistics, ICMP_MIB_CSUMERRORS));
for (i = 0; icmpmibmap[i].name != NULL; i++)
seq_printf(seq, " %lu",
atomic_long_read(ptr + icmpmibmap[i].index));
seq_printf(seq, " %lu %lu",
snmp_fold_field(net->mib.icmp_statistics, ICMP_MIB_OUTMSGS),
snmp_fold_field(net->mib.icmp_statistics, ICMP_MIB_OUTERRORS));
for (i = 0; icmpmibmap[i].name != NULL; i++)
seq_printf(seq, " %lu",
atomic_long_read(ptr + (icmpmibmap[i].index | 0x100)));
}
/*
* Called from the PROCfs module. This outputs /proc/net/snmp.
*/
static int snmp_seq_show(struct seq_file *seq, void *v)
{
int i;
struct net *net = seq->private;
seq_puts(seq, "Ip: Forwarding DefaultTTL");
for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
seq_printf(seq, " %s", snmp4_ipstats_list[i].name);
seq_printf(seq, "\nIp: %d %d",
IPV4_DEVCONF_ALL(net, FORWARDING) ? 1 : 2,
sysctl_ip_default_ttl);
BUILD_BUG_ON(offsetof(struct ipstats_mib, mibs) != 0);
for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
seq_printf(seq, " %llu",
snmp_fold_field64(net->mib.ip_statistics,
snmp4_ipstats_list[i].entry,
offsetof(struct ipstats_mib, syncp)));
icmp_put(seq); /* RFC 2011 compatibility */
icmpmsg_put(seq);
seq_puts(seq, "\nTcp:");
for (i = 0; snmp4_tcp_list[i].name != NULL; i++)
seq_printf(seq, " %s", snmp4_tcp_list[i].name);
seq_puts(seq, "\nTcp:");
for (i = 0; snmp4_tcp_list[i].name != NULL; i++) {
/* MaxConn field is signed, RFC 2012 */
if (snmp4_tcp_list[i].entry == TCP_MIB_MAXCONN)
seq_printf(seq, " %ld",
snmp_fold_field(net->mib.tcp_statistics,
snmp4_tcp_list[i].entry));
else
seq_printf(seq, " %lu",
snmp_fold_field(net->mib.tcp_statistics,
snmp4_tcp_list[i].entry));
}
seq_puts(seq, "\nUdp:");
for (i = 0; snmp4_udp_list[i].name != NULL; i++)
seq_printf(seq, " %s", snmp4_udp_list[i].name);
seq_puts(seq, "\nUdp:");
for (i = 0; snmp4_udp_list[i].name != NULL; i++)
seq_printf(seq, " %lu",
snmp_fold_field(net->mib.udp_statistics,
snmp4_udp_list[i].entry));
/* the UDP and UDP-Lite MIBs are the same */
seq_puts(seq, "\nUdpLite:");
for (i = 0; snmp4_udp_list[i].name != NULL; i++)
seq_printf(seq, " %s", snmp4_udp_list[i].name);
seq_puts(seq, "\nUdpLite:");
for (i = 0; snmp4_udp_list[i].name != NULL; i++)
seq_printf(seq, " %lu",
snmp_fold_field(net->mib.udplite_statistics,
snmp4_udp_list[i].entry));
seq_putc(seq, '\n');
return 0;
}
static int snmp_seq_open(struct inode *inode, struct file *file)
{
return single_open_net(inode, file, snmp_seq_show);
}
static const struct file_operations snmp_seq_fops = {
.owner = THIS_MODULE,
.open = snmp_seq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release_net,
};
/*
* Output /proc/net/netstat
*/
static int netstat_seq_show(struct seq_file *seq, void *v)
{
int i;
struct net *net = seq->private;
seq_puts(seq, "TcpExt:");
for (i = 0; snmp4_net_list[i].name != NULL; i++)
seq_printf(seq, " %s", snmp4_net_list[i].name);
seq_puts(seq, "\nTcpExt:");
for (i = 0; snmp4_net_list[i].name != NULL; i++)
seq_printf(seq, " %lu",
snmp_fold_field(net->mib.net_statistics,
snmp4_net_list[i].entry));
seq_puts(seq, "\nIpExt:");
for (i = 0; snmp4_ipextstats_list[i].name != NULL; i++)
seq_printf(seq, " %s", snmp4_ipextstats_list[i].name);
seq_puts(seq, "\nIpExt:");
for (i = 0; snmp4_ipextstats_list[i].name != NULL; i++)
seq_printf(seq, " %llu",
snmp_fold_field64(net->mib.ip_statistics,
snmp4_ipextstats_list[i].entry,
offsetof(struct ipstats_mib, syncp)));
seq_putc(seq, '\n');
return 0;
}
static int netstat_seq_open(struct inode *inode, struct file *file)
{
return single_open_net(inode, file, netstat_seq_show);
}
static const struct file_operations netstat_seq_fops = {
.owner = THIS_MODULE,
.open = netstat_seq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release_net,
};
static __net_init int ip_proc_init_net(struct net *net)
{
if (!proc_create("sockstat", S_IRUGO, net->proc_net,
&sockstat_seq_fops))
goto out_sockstat;
if (!proc_create("netstat", S_IRUGO, net->proc_net, &netstat_seq_fops))
goto out_netstat;
if (!proc_create("snmp", S_IRUGO, net->proc_net, &snmp_seq_fops))
goto out_snmp;
return 0;
out_snmp:
remove_proc_entry("netstat", net->proc_net);
out_netstat:
remove_proc_entry("sockstat", net->proc_net);
out_sockstat:
return -ENOMEM;
}
static __net_exit void ip_proc_exit_net(struct net *net)
{
remove_proc_entry("snmp", net->proc_net);
remove_proc_entry("netstat", net->proc_net);
remove_proc_entry("sockstat", net->proc_net);
}
static __net_initdata struct pernet_operations ip_proc_ops = {
.init = ip_proc_init_net,
.exit = ip_proc_exit_net,
};
int __init ip_misc_proc_init(void)
{
return register_pernet_subsys(&ip_proc_ops);
}
| {
"content_hash": "7e3b1fbce14a3a772c3bb985be7acfba",
"timestamp": "",
"source": "github",
"line_count": 544,
"max_line_length": 81,
"avg_line_length": 38.13970588235294,
"alnum_prop": 0.7155870445344129,
"repo_name": "publicloudapp/csrutil",
"id": "3abd9d7a3adf323bd688b1ab6dabda1248c67be1",
"size": "20748",
"binary": false,
"copies": "401",
"ref": "refs/heads/master",
"path": "linux-4.3/net/ipv4/proc.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "3984"
},
{
"name": "Awk",
"bytes": "29136"
},
{
"name": "C",
"bytes": "532969471"
},
{
"name": "C++",
"bytes": "3352303"
},
{
"name": "Clojure",
"bytes": "1489"
},
{
"name": "Cucumber",
"bytes": "4701"
},
{
"name": "Groff",
"bytes": "46775"
},
{
"name": "Lex",
"bytes": "55199"
},
{
"name": "Makefile",
"bytes": "1576284"
},
{
"name": "Objective-C",
"bytes": "521540"
},
{
"name": "Perl",
"bytes": "715196"
},
{
"name": "Perl6",
"bytes": "3783"
},
{
"name": "Python",
"bytes": "273092"
},
{
"name": "Shell",
"bytes": "343618"
},
{
"name": "SourcePawn",
"bytes": "4687"
},
{
"name": "UnrealScript",
"bytes": "12797"
},
{
"name": "XS",
"bytes": "1239"
},
{
"name": "Yacc",
"bytes": "114559"
}
],
"symlink_target": ""
} |
from django.http import HttpResponse
from django.shortcuts import render_to_response
from ac_example.forms import ExampleForm
def example(request):
valid = False
if request.GET:
form = ExampleForm(request.GET)
if form.is_valid():
valid = True
else:
form = ExampleForm()
return render_to_response("autocomplete.html", {'form':form,'valid':valid})
| {
"content_hash": "03cbd94bf25e55e24dc12f527161c7b1",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 79,
"avg_line_length": 26.733333333333334,
"alnum_prop": 0.6708229426433915,
"repo_name": "henriquebastos/django-autocomplete",
"id": "a7e9e20eaeb3744c0c3f60c4213a24319cd3362a",
"size": "401",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ac_example/views.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "9182"
}
],
"symlink_target": ""
} |
DROP VIEW v_Subj5Course CASCADE;
CREATE OR REPLACE VIEW v_Subj5Course AS
SELECT innerRel.x1 AS att1
FROM (
SELECT ca_0.individual AS x1
FROM concept_assertion ca_0
WHERE ca_0.concept=92
) as innerRel
| {
"content_hash": "b57602c41fdc5f166880061d9a4d3d6b",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 40,
"avg_line_length": 25.25,
"alnum_prop": 0.7871287128712872,
"repo_name": "ghxiao/clipper",
"id": "28b63b1a1e340a75a7b3c8cccd3a2de6dce6d212",
"size": "202",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clipper-cli/src/test/scripts/v_Subj5Course.sql",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "GAP",
"bytes": "20926"
},
{
"name": "Java",
"bytes": "874330"
},
{
"name": "Prolog",
"bytes": "108"
},
{
"name": "Python",
"bytes": "718"
},
{
"name": "Shell",
"bytes": "4802"
},
{
"name": "Web Ontology Language",
"bytes": "81806419"
}
],
"symlink_target": ""
} |
package com.mglezh.earthquakes.providers;
import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.provider.BaseColumns;
public class EarthQuakeProvider extends ContentProvider {
public static final Uri CONTENT_URI = Uri.parse("content://com.mglezh.earthquakes.provider/earthquakes");
private static final int ALLROWS = 1;
private static final int SINGLE_ROW = 2;
private static final UriMatcher uriMatcher;
private EarthQuakeOpenHelper earthQuakeOpenHelper;
static {
uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
uriMatcher.addURI("com.mglezh.earthquakes.provider", "earthquakes", ALLROWS);
uriMatcher.addURI("com.mglezh.earthquakes.provider", "earthquakes/#", SINGLE_ROW);
}
public static class Columns implements BaseColumns{
public static final String id_KEY = "_id";
public static final String place_KEY = "place";
public static final String magnitude_KEY = "magnitude";
public static final String lat_KEY = "lat";
public static final String long_KEY = "long";
public static final String url_KEY = "url";
public static final String time_KEY = "time";
}
public EarthQuakeProvider() {
}
@Override
public String getType(Uri uri) {
// Return a string that identifies the MIME type
// for a Content Provider URI
switch (uriMatcher.match(uri)) {
case ALLROWS:
return "vnd.android.cursor.dir/vnd.mglezh.provider.earthquakes";
case SINGLE_ROW:
return "vnd.android.cursor.item/vnd.mglezh.provider.earthquakes";
default:
throw new IllegalArgumentException("Unsupported URI: " + uri);
}
}
@Override
public boolean onCreate() {
// TODO: Implement this to initialize your content provider on startup.
earthQuakeOpenHelper = new EarthQuakeOpenHelper(getContext(),
EarthQuakeOpenHelper.DATABASE_NAME,null,EarthQuakeOpenHelper.DATABASE_VERSION);
return true;
}
@Override
public Uri insert(Uri uri, ContentValues values) {
SQLiteDatabase db = earthQuakeOpenHelper.getWritableDatabase();
/*
switch (uriMatcher.match(uri)) {
case :
String table
}*/
long id = db.insert(EarthQuakeOpenHelper.DATABASE_TABLE, null, values);
if (id> -1) {
// Construct and return the URI of the newly inserted row.
Uri insertedId = ContentUris.withAppendedId(CONTENT_URI, id);
// Notify any observers of the change in the data set.
getContext().getContentResolver().notifyChange(insertedId, null);
return insertedId;
}
else
return null;
}
@Override
public Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
SQLiteDatabase db;
try {
db = earthQuakeOpenHelper.getWritableDatabase();
} catch (SQLiteException ex) {
db = earthQuakeOpenHelper.getReadableDatabase();
}
SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
switch (uriMatcher.match(uri)) {
case SINGLE_ROW :
String rowID = uri.getPathSegments().get(1);
queryBuilder.appendWhere(Columns.id_KEY + "=");
selectionArgs = new String[] {rowID};
default: break;
}
queryBuilder.setTables(EarthQuakeOpenHelper.DATABASE_TABLE);
Cursor cursor = queryBuilder.query(db,projection,selection,
selectionArgs,null, null,sortOrder);
return cursor;
}
private static class EarthQuakeOpenHelper extends SQLiteOpenHelper {
private static final String DATABASE_NAME = "earthQuakes.db";
private static final String DATABASE_TABLE = "EARTHQUAKES";
private static final int DATABASE_VERSION = 1;
// SQL Statement to create a new database.
private static final String DATABASE_CREATE =
"CREATE TABLE " +
DATABASE_TABLE +
"(" +
Columns.id_KEY + " TEXT PRIMARY KEY, " +
Columns.place_KEY + " TEXT, magnitude REAL, " +
Columns.lat_KEY + " REAL, " +
Columns.long_KEY + " REAL, " +
Columns.url_KEY + " TEXT, " +
Columns.time_KEY + " INTEGER)";
private EarthQuakeOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
super(context, name, factory, version);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(DATABASE_CREATE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// Simplest case is to drop the old table and create a new one.
db.execSQL("DROP TABLE IF EXISTS" + DATABASE_TABLE);
// Create a new one.
onCreate(db);
}
}
@Override
public int update(Uri uri, ContentValues values, String selection,
String[] selectionArgs) {
// TODO: Implement this to handle requests to update one or more rows.
throw new UnsupportedOperationException("Not yet implemented");
}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
// Implement this to handle requests to delete one or more rows.
throw new UnsupportedOperationException("Not yet implemented");
}
}
| {
"content_hash": "d604d882d3e80d4047c836d7fe345fc6",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 119,
"avg_line_length": 37.36969696969697,
"alnum_prop": 0.6255270840090821,
"repo_name": "mglezh/Android",
"id": "ceba0371c20a6c02f6e10d6cc84fc328d068a6c2",
"size": "6166",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "EarthQuakes_Cprovider/app/src/main/java/com/mglezh/earthquakes/providers/EarthQuakeProvider.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "146522"
}
],
"symlink_target": ""
} |
<?php
$installer = $this;
/* @var $installer Mage_Catalog_Model_Entity_Setup */
$installer->run("
ALTER TABLE {$this->getTable('catalogsearch_query')} ADD `updated_at` DATETIME NOT NULL;
");
| {
"content_hash": "9520448b7747b835ee464421360dc443",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 92,
"avg_line_length": 22,
"alnum_prop": 0.6767676767676768,
"repo_name": "tbanov/magento-test-env",
"id": "09811df6732f826273d05244c51ee8b215d2e533",
"size": "1143",
"binary": false,
"copies": "14",
"ref": "refs/heads/master",
"path": "homeforyou/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.3-0.7.4.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ActionScript",
"bytes": "19946"
},
{
"name": "ApacheConf",
"bytes": "6736"
},
{
"name": "Batchfile",
"bytes": "1036"
},
{
"name": "CSS",
"bytes": "2523606"
},
{
"name": "HTML",
"bytes": "5713733"
},
{
"name": "JavaScript",
"bytes": "1259552"
},
{
"name": "PHP",
"bytes": "44393998"
},
{
"name": "PowerShell",
"bytes": "1028"
},
{
"name": "Ruby",
"bytes": "288"
},
{
"name": "Shell",
"bytes": "2036"
},
{
"name": "XSLT",
"bytes": "2135"
}
],
"symlink_target": ""
} |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace RoRAssist.WinApp.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.1.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
| {
"content_hash": "2c02837dd8221285f4a80e096f7d01bd",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 151,
"avg_line_length": 41.19230769230769,
"alnum_prop": 0.5826330532212886,
"repo_name": "Ebisu77/RoRAssist",
"id": "f7575bf1da21cc706953169620d8a6f49e10a7fc",
"size": "1073",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "RoRAssist/Properties/Settings.Designer.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "43703"
}
],
"symlink_target": ""
} |
#pragma once
/**
* Coroutine
* @author xiao
*/
#include <stack>
#include <cstdint>
#include <ucontext.h>
#include "commondefs.h"
namespace ECor
{
struct CoroutineInfo
{
long used;
char* stack;
ucontext_t context;
};
class CoroutineManager
{
const size_t size;
const size_t stackSize;
size_t curNCoroutine;
size_t lastNCoroutine;
long clk;
CoroutineInfo* cInfos;
std::stack<size_t> freeCoroutineNumber;
static void onCoroutineExit(CoroutineManager* manager);
public:
CoroutineManager(size_t _size, size_t _stackSize);
~CoroutineManager();
void yield();
void yield(size_t target);
bool doWork(EPollServer* eServer, CoroutineCallback cCallback, ProcessCallback func, ConnectionInfo* info, uint32_t initCtlEvent);
long getTimeUsed();
static const size_t OUTPOOL = (size_t) -1;
};
}
| {
"content_hash": "cc06f8d55c9b6edbe7dc952966cb0d09",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 134,
"avg_line_length": 17.6734693877551,
"alnum_prop": 0.687066974595843,
"repo_name": "xhy940801/ECor",
"id": "78973dc0f03bf442df104dfe437dd10a0dde19cd",
"size": "866",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "include/CoroutineManager.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "22860"
},
{
"name": "Makefile",
"bytes": "2468"
}
],
"symlink_target": ""
} |
package org.apache.naming.core;
import javax.naming.directory.Attributes;
/**
* Represents a binding in a NamingContext. All jtc contexts should
* use this class to represent entries.
*
* @author Remy Maucherat
* @author Costin Manolache
*/
public class NamingEntry {
// -------------------------------------------------------------- Constants
public static final int ENTRY = 0;
public static final int LINK_REF = 1;
public static final int REFERENCE = 2;
public static final int CONTEXT = 10;
// ----------------------------------------------------------- Constructors
public NamingEntry(String name, Object value, Attributes atts, int type) {
this.name = name;
this.value = value;
this.type = type;
this.attributes=atts;
}
// ----------------------------------------------------- Instance Variables
/**
* The type instance variable is used to avoid unsing RTTI when doing
* lookups.
*/
public int type;
public String name;
public Object value;
public Attributes attributes;
// cached values
private boolean hasIntValue=false;
private boolean hasBoolValue=false;
private boolean hasLongValue=false;
private int intValue;
private boolean boolValue;
private long longValue;
// --------------------------------------------------------- Object Methods
public void recycle() {
}
public boolean equals(Object obj) {
if ((obj != null) && (obj instanceof NamingEntry)) {
return name.equals(((NamingEntry) obj).name);
} else {
return false;
}
}
public int hashCode() {
return name.hashCode();
}
}
| {
"content_hash": "67c6742eb54d4b1272bc8721de2c5bd5",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 79,
"avg_line_length": 22.371794871794872,
"alnum_prop": 0.5432664756446991,
"repo_name": "xianfengxiong/how-tomcat-work",
"id": "ec159cd319f76174f27d6fb12fe3de9c700c674c",
"size": "4471",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "book/tomcat-5.0.18-src/jakarta-tomcat-connectors/naming/src/org/apache/naming/core/NamingEntry.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "2238"
},
{
"name": "Batchfile",
"bytes": "52224"
},
{
"name": "C",
"bytes": "2117688"
},
{
"name": "C++",
"bytes": "11625"
},
{
"name": "CSS",
"bytes": "4762"
},
{
"name": "HTML",
"bytes": "232549"
},
{
"name": "Java",
"bytes": "25321993"
},
{
"name": "M4",
"bytes": "61731"
},
{
"name": "Makefile",
"bytes": "17625"
},
{
"name": "NSIS",
"bytes": "25933"
},
{
"name": "Perl",
"bytes": "98093"
},
{
"name": "Perl 6",
"bytes": "2908"
},
{
"name": "Shell",
"bytes": "49871"
},
{
"name": "Visual Basic",
"bytes": "9998"
},
{
"name": "XSLT",
"bytes": "27566"
}
],
"symlink_target": ""
} |
FN="ragene11sttranscriptcluster.db_8.7.0.tar.gz"
URLS=(
"https://bioconductor.org/packages/3.8/data/annotation/src/contrib/ragene11sttranscriptcluster.db_8.7.0.tar.gz"
"https://bioarchive.galaxyproject.org/ragene11sttranscriptcluster.db_8.7.0.tar.gz"
"https://depot.galaxyproject.org/software/bioconductor-ragene11sttranscriptcluster.db/bioconductor-ragene11sttranscriptcluster.db_8.7.0_src_all.tar.gz"
)
MD5="81a645c32105ffb4bfb45eb8bcf13855"
# Use a staging area in the conda dir rather than temp dirs, both to avoid
# permission issues as well as to have things downloaded in a predictable
# manner.
STAGING=$PREFIX/share/$PKG_NAME-$PKG_VERSION-$PKG_BUILDNUM
mkdir -p $STAGING
TARBALL=$STAGING/$FN
SUCCESS=0
for URL in ${URLS[@]}; do
wget -O- -q $URL > $TARBALL
[[ $? == 0 ]] || continue
# Platform-specific md5sum checks.
if [[ $(uname -s) == "Linux" ]]; then
if md5sum -c <<<"$MD5 $TARBALL"; then
SUCCESS=1
break
fi
else if [[ $(uname -s) == "Darwin" ]]; then
if [[ $(md5 $TARBALL | cut -f4 -d " ") == "$MD5" ]]; then
SUCCESS=1
break
fi
fi
fi
done
if [[ $SUCCESS != 1 ]]; then
echo "ERROR: post-link.sh was unable to download any of the following URLs with the md5sum $MD5:"
printf '%s\n' "${URLS[@]}"
exit 1
fi
# Install and clean up
R CMD INSTALL --library=$PREFIX/lib/R/library $TARBALL
rm $TARBALL
rmdir $STAGING
| {
"content_hash": "8cf07ffa41c826ffbbb07b863c5dc162",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 153,
"avg_line_length": 30.933333333333334,
"alnum_prop": 0.6846264367816092,
"repo_name": "joachimwolff/bioconda-recipes",
"id": "afcd3d90b18f2ab350e132cb6136508cd8e99041",
"size": "1404",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "recipes/bioconductor-ragene11sttranscriptcluster.db/post-link.sh",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "237"
},
{
"name": "C",
"bytes": "154"
},
{
"name": "CMake",
"bytes": "13967"
},
{
"name": "Java",
"bytes": "286"
},
{
"name": "M4",
"bytes": "726"
},
{
"name": "Perl",
"bytes": "99685"
},
{
"name": "Perl 6",
"bytes": "23942"
},
{
"name": "Prolog",
"bytes": "1044"
},
{
"name": "Python",
"bytes": "387808"
},
{
"name": "Roff",
"bytes": "996"
},
{
"name": "Shell",
"bytes": "3678803"
}
],
"symlink_target": ""
} |
package com.commerce4j.model.dto;
/**
* Item Type Data Transfer Object.
* @author carlos.quijano
* @version $Revision$ $Date$
*/
public class TypeDTO extends AbstractBaseDTO {
private Integer typeId;
private String typeName;
private String typeDesc;
/**
* Constructor, Creates a new type instance of {@link TypeDTO}.
*/
public TypeDTO() {
super();
}
/**
* Constructor, Creates a new type instance of {@link TypeDTO}.
*
* @param typeId
* @param typeName
* @param typeDesc
*/
public TypeDTO(Integer typeId, String typeName, String typeDesc) {
super();
this.typeId = typeId;
this.typeName = typeName;
this.typeDesc = typeDesc;
}
/**
* JavaBean Getter, Gets the typeId current value.
* @return The typeId current value.
*/
public Integer getTypeId() {
return typeId;
}
/**
* JavaBean Setter, Sets value to typeId.
* @param typeId The value of typeId to set.
*/
public void setTypeId(Integer typeId) {
this.typeId = typeId;
}
/**
* JavaBean Getter, Gets the typeName current value.
* @return The typeName current value.
*/
public String getTypeName() {
return typeName;
}
/**
* JavaBean Setter, Sets value to typeName.
* @param typeName The value of typeName to set.
*/
public void setTypeName(String typeName) {
this.typeName = typeName;
}
/**
* JavaBean Getter, Gets the typeDesc current value.
* @return The typeDesc current value.
*/
public String getTypeDesc() {
return typeDesc;
}
/**
* JavaBean Setter, Sets value to typeDesc.
* @param typeDesc The value of typeDesc to set.
*/
public void setTypeDesc(String typeDesc) {
this.typeDesc = typeDesc;
}
}
| {
"content_hash": "6bdb32d49eb8827ce062742548433819",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 67,
"avg_line_length": 20.35632183908046,
"alnum_prop": 0.6386222473178995,
"repo_name": "asiam9/commerce4j",
"id": "2ded618239959ce2d295cfaf050ed05e147ca0dc",
"size": "2386",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/com.commerce4j/commerce4j-model/src/main/java/com/commerce4j/model/dto/TypeDTO.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "7833"
},
{
"name": "Java",
"bytes": "248708"
},
{
"name": "JavaScript",
"bytes": "32169"
},
{
"name": "XSLT",
"bytes": "975"
}
],
"symlink_target": ""
} |
server = YAML.load_file('fhir_server.yml')
def test_practitioner(server, resource)
RSpec.describe '#put' do
begin
result = fhir_put(server, resource)
rescue => e
puts e.inspect
end
it {expect(result.code).to eq 200}
end
RSpec.describe '#get' do
result = fhir_get(server, resource)
it {expect(result.code).to eq 200}
# need to remove the metadata and other keys from the server version
json = JSON.parse(result)
json.delete('meta')
json.delete('lastUpdated')
fhir_resource_compare(server, resource, json)
end
end
Dir.glob("**/Practitioner/*") do |f|
resource = JSON.parse(File.read(f))
puts "Testing resource: #{f}"
test_practitioner(server, resource)
end | {
"content_hash": "6ba42a7e697b00e55df925a2964c6091",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 76,
"avg_line_length": 21.783783783783782,
"alnum_prop": 0.6042183622828784,
"repo_name": "ImagingInformatics/hackathon-dataset",
"id": "cbfe0712d27738394955d04b4e381464a795ce85",
"size": "827",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/practitioner_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2506"
},
{
"name": "Ruby",
"bytes": "24005"
}
],
"symlink_target": ""
} |
module MakerJs.models {
export class ConnectTheDots implements IModel {
public paths: IPathMap = {};
constructor(isClosed: boolean, points: IPoint[]) {
var connect = (a: number, b: number) => {
this.paths["ShapeLine" + i] = new paths.Line(points[a], points[b]);
}
for (var i = 1; i < points.length; i++) {
connect(i - 1, i);
}
if (isClosed && points.length > 2) {
connect(points.length - 1, 0);
}
}
}
}
| {
"content_hash": "c5b2b45bc0669e46353c71ceadcccbd9",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 83,
"avg_line_length": 25.5,
"alnum_prop": 0.46702317290552586,
"repo_name": "bartuspan/maker.js",
"id": "d15c1f2926be7110e61341c1c5a2d8288b0779be",
"size": "561",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/models/ConnectTheDots.ts",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1718"
},
{
"name": "HTML",
"bytes": "6289"
},
{
"name": "JavaScript",
"bytes": "402988"
},
{
"name": "TypeScript",
"bytes": "130126"
}
],
"symlink_target": ""
} |
namespace miniini_private
{
///Specifies various parts of a line line in ini file during loading.
enum LineToken
{
///Name - this is where we are until we reach '=' or '[' character.
LT_NAME,
///Value - this is where we are after we reach '=' character.
LT_VAL,
///Header - this is where we are when we are between '[' and ']' characters.
LT_HEADER
};
}
/// @endcond
#endif
| {
"content_hash": "9e465d7915d028bcce8b167dcb4271c2",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 80,
"avg_line_length": 22.27777777777778,
"alnum_prop": 0.6408977556109726,
"repo_name": "XadillaX/node-simple-ini",
"id": "96f2e0e3129bdcf6720dbeef764e02cce223e98c",
"size": "636",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/miniini-0.9/miniini/include/linetoken.h",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "12645"
},
{
"name": "C++",
"bytes": "145924"
},
{
"name": "CSS",
"bytes": "23451"
},
{
"name": "JavaScript",
"bytes": "21142"
},
{
"name": "Perl",
"bytes": "6043"
},
{
"name": "Python",
"bytes": "71989"
},
{
"name": "Shell",
"bytes": "4148"
}
],
"symlink_target": ""
} |
using System;
using System.Windows;
using System.Windows.Controls.Primitives;
using TUM.CMS.ExtendedVplControl.Ports;
using TUM.CMS.VplControl.Core;
namespace TUM.CMS.VplControl.VCCL.Ports.Input
{
public class TrueFalsePort : ExtendedPort
{
private readonly ToggleButton toggleButton;
public TrueFalsePort(string name, PortTypes portType, Type type, Core.VplControl hostCanvas)
: base(name, portType, type, hostCanvas)
{
toggleButton = new ToggleButton
{
Width = 80,
Margin = new Thickness(5)
};
toggleButton.Checked += toggleButton_Checked;
toggleButton.Unchecked += toggleButton_Unchecked;
toggleButton.IsChecked = true;
AddPopupContent(toggleButton);
}
void toggleButton_Unchecked(object sender, RoutedEventArgs e)
{
toggleButton.Content = "False";
Data = toggleButton.IsChecked;
}
void toggleButton_Checked(object sender, RoutedEventArgs e)
{
toggleButton.Content = "True";
Data = toggleButton.IsChecked;
}
}
}
| {
"content_hash": "5f1f334e6369be22496c5843fee1589a",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 100,
"avg_line_length": 28.357142857142858,
"alnum_prop": 0.6146095717884131,
"repo_name": "corneliuspreidel/TUM.CMS.VPLControl",
"id": "1b6d213ae0e026caa568229e300159e4ebaaa644",
"size": "1193",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "TUM.CMS.VplControl.VCCL/Ports/Input/TrueFalsePort.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "849947"
},
{
"name": "HTML",
"bytes": "51639"
}
],
"symlink_target": ""
} |
#import "UIColor+DGSCustomColor.h"
/*! Function for creating UIColor instances using their hex
*
* Acceptable formats:
* 0xAAAAAA
* 0XAAAAAA
* AAAAAA
* #AAAAAA
* (A – hexidecimal digit)
**/
static UIColor *colorWithHexString(NSString *hexString);
@implementation UIColor (DGSCustomColor)
+ (UIColor *)dgs_sharkColor
{
static UIColor *color = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
color = colorWithHexString(@"#3c3c3c");
});
return color;
}
+ (UIColor *)dgs_outerSpaceColor
{
static UIColor *color = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
color = colorWithHexString(@"#474747");
});
return color;
}
+ (UIColor *)dgs_osloGrayColor
{
static UIColor *color = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
color = colorWithHexString(@"#8F9090");
});
return color;
}
+ (UIColor *)dgs_tiaraColor
{
static UIColor *color = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
color = colorWithHexString(@"#CCD4D8");
});
return color;
}
+ (UIColor *)dgs_mysticColor
{
static UIColor *color = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
color = colorWithHexString(@"#F3F3F3");
});
return color;
}
+ (UIColor *)dgs_webOrangeColor
{
static UIColor *color = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
color = colorWithHexString(@"#F8A700");
});
return color;
}
+ (UIColor *)dgs_deepCeruleanColor
{
static UIColor *color = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
color = colorWithHexString(@"#007BAB");
});
return color;
}
+ (UIColor *)dgs_antiFlashWhiteColor
{
static UIColor *color = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
color = colorWithHexString(@"#F1F5F6");
});
return color;
}
+ (UIColor *)dgs_powderBlueColor
{
static UIColor *color = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
color = colorWithHexString(@"#B1D4E3");
});
return color;
}
+ (UIColor *)dgs_keyLimePieColor
{
static UIColor *color = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
color = colorWithHexString(@"#AFCC26");
});
return color;
}
+ (UIColor *)dgs_flamePeaColor
{
static UIColor *color = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
color = colorWithHexString(@"#E05F45");
});
return color;
}
+ (UIColor *)dgs_apricotWhiteColor
{
static UIColor *color = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
color = colorWithHexString(@"#F7F2E0");
});
return color;
}
+ (UIColor *)dgs_gunsmokeColor
{
static UIColor *color = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
color = colorWithHexString(@"#7C7E7D");
});
return color;
}
+ (UIColor *)dgs_colorWithString:(NSString *)string
{
return colorWithHexString(string);
}
@end
// MARK: - Auxiliary
static UIColor *colorWithHex(NSUInteger hex)
{
return [UIColor colorWithRed:((CGFloat)((hex & 0xFF0000) >> 16)) / 255.f\
green:((CGFloat)((hex & 0xFF00) >> 8)) / 255.f\
blue:((CGFloat)((hex & 0xFF) )) / 255.f\
alpha:1.f];
}
static NSUInteger hexForHexString(NSString *hexString)
{
BOOL unexpectedHexStringLength = (hexString.length < 6) || (hexString.length > 8);
if (unexpectedHexStringLength)
{
return 0xffffff;
}
NSScanner *scanner = [NSScanner scannerWithString:hexString];
BOOL isFormatWithSharp = (hexString.length == 7) && ([[hexString substringToIndex:1] isEqualToString:@"#"]);
if (isFormatWithSharp)
{
[scanner setScanLocation:1];
}
unsigned hex = 0;
if (![scanner scanHexInt:&hex]) {
return 0xffffff;
}
return hex;
}
static UIColor *colorWithHexString(NSString *hexString)
{
return colorWithHex(hexForHexString(hexString));
}
| {
"content_hash": "f4980b9e22a050f1239af3f35c1696ef",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 109,
"avg_line_length": 20.853403141361255,
"alnum_prop": 0.6673361787597288,
"repo_name": "teanet/Taksa",
"id": "a366fd3c9c44c7c75d9142d57614415965a14ade",
"size": "3985",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Taksa/UIColor+DGSCustomColor.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "130"
},
{
"name": "Objective-C",
"bytes": "169463"
},
{
"name": "Ruby",
"bytes": "409"
}
],
"symlink_target": ""
} |
class CreateTipoReclamos < ActiveRecord::Migration
def change
create_table :tipo_reclamos do |t|
t.string :nombre
t.timestamps null: false
end
end
end
| {
"content_hash": "e7b9e8d4607e5cec1e9cdefe3d7003e2",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 50,
"avg_line_length": 19.555555555555557,
"alnum_prop": 0.6875,
"repo_name": "martinnicolas/ca",
"id": "c20f0b0b4fc587a6a13e0ddf4a70e66699e10f3c",
"size": "176",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "db/migrate/20160614230537_create_tipo_reclamos.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CoffeeScript",
"bytes": "1266"
},
{
"name": "HTML",
"bytes": "59595"
},
{
"name": "JavaScript",
"bytes": "4779"
},
{
"name": "Ruby",
"bytes": "83273"
},
{
"name": "SCSS",
"bytes": "10350"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html ng-app="app">
<head>
<title>Map swipe example</title>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width" />
<meta name="mobile-web-app-capable" content="yes" />
</head>
<body ng-controller="MainController as ctrl">
<ngeo-mapswipe map="::ctrl.map" layer="::ctrl.openSeaMapLayer"></ngeo-mapswipe>
<gmf-map id="map" gmf-map-map="::ctrl.map"></gmf-map>
<p id="desc">
This example shows how to use the
<code><a href="../apidoc/ngeo.map.swipe.html" title="Read our documentation">ngeo-Mapswipe</a></code>
component to insert an input type range and swipe a map.
</p>
<script type="text/javascript" src="dist/vendor.js"></script>
</body>
</html>
| {
"content_hash": "afdcf635f383c21d3d559556eaf77f95",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 107,
"avg_line_length": 41.31578947368421,
"alnum_prop": 0.6471337579617834,
"repo_name": "camptocamp/ngeo",
"id": "d2c2ad41fc5687af2b9e333564356cb5219a0e96",
"size": "785",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/mapswipe.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "48614"
},
{
"name": "EJS",
"bytes": "64142"
},
{
"name": "HTML",
"bytes": "162303"
},
{
"name": "JavaScript",
"bytes": "3209592"
},
{
"name": "Makefile",
"bytes": "18330"
},
{
"name": "Python",
"bytes": "14107"
},
{
"name": "SCSS",
"bytes": "146691"
},
{
"name": "Shell",
"bytes": "5031"
},
{
"name": "TypeScript",
"bytes": "381597"
}
],
"symlink_target": ""
} |
package com.opensoc.alerts.server;
import static java.util.concurrent.TimeUnit.SECONDS;
import java.util.Properties;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
public class AlertsProcessingServer {
private static final Logger logger = LoggerFactory.getLogger( AlertsProcessingServer.class );
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
@Inject
private AlertsSearcher searcher;
@Inject
private AlertsCacheReaper reaper;
@Inject
private Properties configProps;
public void startProcessing() {
logger.debug( "startProcessing() invoked" );
int initialDelayTime = Integer.parseInt( configProps.getProperty( "searchInitialDelayTime", "30" ) );
int searchIntervalTime = Integer.parseInt( configProps.getProperty( "searchIntervalTime", "30" ) );
reaper.setSearcher(searcher);
final ScheduledFuture<?> alertsSearcherHandle =
scheduler.scheduleAtFixedRate( searcher, initialDelayTime, searchIntervalTime, SECONDS );
scheduler.scheduleAtFixedRate(reaper, 120, 380, SECONDS);
}
} | {
"content_hash": "6e68093416b9bb43a7a90020c0303a07",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 103,
"avg_line_length": 29.325581395348838,
"alnum_prop": 0.7858842188739096,
"repo_name": "caidongyun/opensoc-streaming",
"id": "cec50b92765b5040e6e8489177d67dd8008ac8d7",
"size": "1261",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "OpenSOC-DataServices/src/main/java/com/opensoc/alerts/server/AlertsProcessingServer.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "872742"
},
{
"name": "Python",
"bytes": "8130"
}
],
"symlink_target": ""
} |
package fakecookies
import (
"context"
"encoding/json"
"fmt"
"html/template"
"io"
"net/http"
"net/url"
"sync"
"golang.org/x/oauth2"
"go.chromium.org/luci/auth/identity"
"go.chromium.org/luci/common/errors"
"go.chromium.org/luci/common/logging"
"go.chromium.org/luci/common/retry/transient"
"go.chromium.org/luci/server/auth"
"go.chromium.org/luci/server/encryptedcookies/internal"
"go.chromium.org/luci/server/router"
)
// AuthMethod is an auth.Method implementation that uses fake cookies.
type AuthMethod struct {
m sync.Mutex
serverUser *auth.User // see serverUserInfo
serverUserInit bool // true if already initialized (can still be nil)
}
var _ interface {
auth.Method
auth.UsersAPI
auth.HasHandlers
} = (*AuthMethod)(nil)
const (
loginURL = "/auth/fake/login"
logoutURL = "/auth/fake/logout"
defaultPictureURL = "/auth/fake/profile.svg"
cookieName = "FAKE_LUCI_DEV_AUTH_COOKIE"
)
// InstallHandlers installs HTTP handlers used in the login protocol.
//
// Implements auth.HasHandlers.
func (m *AuthMethod) InstallHandlers(r *router.Router, base router.MiddlewareChain) {
r.GET(loginURL, base, m.loginHandlerGET)
r.POST(loginURL, base, m.loginHandlerPOST)
r.GET(logoutURL, base, m.logoutHandler)
r.GET(defaultPictureURL, base, m.pictureHandler)
}
// Authenticate authenticates the request.
//
// Implements auth.Method.
func (m *AuthMethod) Authenticate(ctx context.Context, r *http.Request) (*auth.User, auth.Session, error) {
cookie, _ := r.Cookie(cookieName)
if cookie == nil {
return nil, nil, nil // the method is not applicable, skip it
}
email, err := decodeFakeCookie(cookie.Value)
if err != nil {
logging.Warningf(ctx, "Skipping %s: %s", cookieName, err)
return nil, nil, nil
}
ident, err := identity.MakeIdentity("user:" + email)
if err != nil {
logging.Warningf(ctx, "Skipping %s: %s", cookieName, err)
return nil, nil, nil
}
user := &auth.User{
Identity: ident,
Email: email,
Name: "Some User",
Picture: defaultPictureURL,
}
// If the local developer logs in using their email, we can actually produce
// real auth tokens (since the server runs under this account too). We can
// also try to extract the real profile information. Not a big deal if it is
// not available. It is not essential, just adds more "realism" when it is
// present.
if email == serverEmail(ctx) {
switch serverUser, err := m.serverUserInfo(ctx); {
case err != nil:
return nil, nil, errors.Annotate(err, "transient error getting server's user info").Tag(transient.Tag).Err()
case serverUser != nil:
user = serverUser
}
return user, serverSelfSession{}, nil
}
// If the fake session user is not matching server's email, use a fake profile
// and install an erroring session that asks the caller to log in as
// the developer. We can't generate real tokens for fake users.
return user, erroringSession{
err: fmt.Errorf(
"session-bound auth tokens are available only when logging in "+
"with the account used by the local dev server itself: %s", email,
),
}, nil
}
// LoginURL returns a URL that, when visited, prompts the user to sign in,
// then redirects the user to the URL specified by dest.
//
// Implements auth.UsersAPI.
func (m *AuthMethod) LoginURL(ctx context.Context, dest string) (string, error) {
return internal.MakeRedirectURL(loginURL, dest)
}
// LogoutURL returns a URL that, when visited, signs the user out,
// then redirects the user to the URL specified by dest.
//
// Implements auth.UsersAPI.
func (m *AuthMethod) LogoutURL(ctx context.Context, dest string) (string, error) {
return internal.MakeRedirectURL(logoutURL, dest)
}
////////////////////////////////////////////////////////////////////////////////
var loginPageTmpl = template.Must(template.New("login").Parse(`<!DOCTYPE html>
<html lang="en">
<head>
<title>Dev Mode Fake Login</title>
<style>
body {
font-family: "Roboto", sans-serif;
}
.container {
width: 440px;
padding-top: 50px;
margin: auto;
}
.form {
position: relative;
max-width: 440px;
padding: 45px;
margin: 0 auto 100px;
background: #ffffff;
text-align: center;
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24);
}
.form input {
width: 100%;
padding: 15px;
margin: 0 0 15px;
background: #f2f2f2;
outline: 0;
border: 0;
box-sizing: border-box;
font-size: 14px;
}
.form button {
width: 100%;
padding: 15px;
outline: 0;
border: 0;
background: #404040;
color: #ffffff;
font-size: 14px;
cursor: pointer;
}
.form button:hover, .form button:active, .form button:focus {
background: #212121;
}
</style>
</head>
<body>
<div class="container">
<div class="form">
<form method="POST">
<input type="text" placeholder="EMAIL" name="email" value="{{.Email}}"/>
<button>LOGIN</button>
</form>
</div>
</div>
</body>
</html>`))
const profilePictureSVG = `<svg xmlns="http://www.w3.org/2000/svg" height="96px" width="96px" viewBox="0 0 24 24" fill="#455A64">
<path d="M0 0h24v24H0V0z" fill="none"/>
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm6.36 14.83c-1.43-1.74-4.9-2.33-6.36-2.33s-4.93.59-6.36 2.33C4.62 15.49 4 13.82 4 12c0-4.41 3.59-8 8-8s8 3.59 8 8c0 1.82-.62 3.49-1.64 4.83zM12 6c-1.94 0-3.5 1.56-3.5 3.5S10.06 13 12 13s3.5-1.56 3.5-3.5S13.94 6 12 6z"/>
</svg>`
// encodeFakeCookie prepares a cookie value that contains the given email.
func encodeFakeCookie(email string) string {
return (url.Values{"email": {email}}).Encode()
}
// decodeFakeCookies is reverse of encodeFakeCookie.
func decodeFakeCookie(val string) (email string, err error) {
v, err := url.ParseQuery(val)
if err != nil {
return "", err
}
return v.Get("email"), nil
}
// serverEmail returns the email the server runs as or "".
//
// In most cases the local dev server runs under the developer account.
func serverEmail(ctx context.Context) string {
if s := auth.GetSigner(ctx); s != nil {
if info, _ := s.ServiceInfo(ctx); info != nil {
return info.ServiceAccountName
}
}
return ""
}
// handler adapts `cb(...)` to match router.Handler.
func handler(ctx *router.Context, cb func(ctx context.Context, r *http.Request, rw http.ResponseWriter) error) {
if err := cb(ctx.Context, ctx.Request, ctx.Writer); err != nil {
http.Error(ctx.Writer, err.Error(), http.StatusInternalServerError)
}
}
// loginHandlerGET initiates the login flow.
func (m *AuthMethod) loginHandlerGET(ctx *router.Context) {
handler(ctx, func(ctx context.Context, r *http.Request, rw http.ResponseWriter) error {
if _, err := internal.NormalizeURL(r.URL.Query().Get("r")); err != nil {
return errors.Annotate(err, "bad redirect URI").Err()
}
email := serverEmail(ctx)
if email == "" {
email = "someone@example.com"
}
return loginPageTmpl.Execute(rw, map[string]string{"Email": email})
})
}
// loginHandlerPOST completes the login flow.
func (m *AuthMethod) loginHandlerPOST(ctx *router.Context) {
handler(ctx, func(ctx context.Context, r *http.Request, rw http.ResponseWriter) error {
dest, err := internal.NormalizeURL(r.URL.Query().Get("r"))
if err != nil {
return errors.Annotate(err, "bad redirect URI").Err()
}
email := r.FormValue("email")
if _, err := identity.MakeIdentity("user:" + email); err != nil {
return errors.Annotate(err, "bad email").Err()
}
http.SetCookie(rw, &http.Cookie{
Name: cookieName,
Value: encodeFakeCookie(email),
Path: "/",
HttpOnly: true,
Secure: false,
MaxAge: 60 * 60 * 24 * 14, // 2 weeks
})
http.Redirect(rw, r, dest, http.StatusFound)
return nil
})
}
// logoutHandler closes the session.
func (m *AuthMethod) logoutHandler(ctx *router.Context) {
handler(ctx, func(ctx context.Context, r *http.Request, rw http.ResponseWriter) error {
dest, err := internal.NormalizeURL(r.URL.Query().Get("r"))
if err != nil {
return errors.Annotate(err, "bad redirect URI").Err()
}
internal.RemoveCookie(rw, r, cookieName)
http.Redirect(rw, r, dest, http.StatusFound)
return nil
})
}
// pictureHandler returns hardcoded SVG user profile picture.
func (m *AuthMethod) pictureHandler(ctx *router.Context) {
ctx.Writer.Header().Set("Content-Type", "image/svg+xml")
ctx.Writer.Header().Set("Cache-Control", "public, max-age=86400")
ctx.Writer.Write([]byte(profilePictureSVG))
}
// serverUserInfo grabs *auth.User info based on server's own credentials.
//
// We use Google ID provider's /userinfo endpoint and access tokens. Note that
// we can't extract the profile information from the ID token since it may not
// be there anymore (if the token was refreshed already).
//
// Returns (nil, nil) if the user info is not available for some reason (e.g.
// when running the server under a service account). All errors should be
// considered transient.
func (m *AuthMethod) serverUserInfo(ctx context.Context) (*auth.User, error) {
m.m.Lock()
defer m.m.Unlock()
if m.serverUserInit {
return m.serverUser, nil
}
// See the comment in serverSelfSession.AccessToken regarding scopes.
tr, err := auth.GetRPCTransport(ctx, auth.AsSelf, auth.WithScopes(auth.CloudOAuthScopes...))
if err != nil {
return nil, err
}
req, _ := http.NewRequest("GET", "https://openidconnect.googleapis.com/v1/userinfo", nil)
resp, err := (&http.Client{Transport: tr}).Do(req.WithContext(ctx))
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}
if resp.StatusCode >= 500 {
return nil, errors.Reason("HTTP %d: %q", resp.StatusCode, body).Err()
}
if resp.StatusCode != 200 {
logging.Warningf(ctx, "When fetching server's own user info: HTTP %d, body %q", resp.StatusCode, body)
m.serverUserInit = true // we are done, no user info available
return nil, nil
}
var claims struct {
Email string `json:"email"`
Name string `json:"name"`
Picture string `json:"picture"`
}
if err := json.Unmarshal(body, &claims); err != nil {
return nil, errors.Annotate(err, "failed to deserialize userinfo endpoint response").Err()
}
m.serverUserInit = true
m.serverUser = &auth.User{
Identity: identity.Identity("user:" + claims.Email),
Email: claims.Email,
Name: claims.Name,
Picture: claims.Picture,
}
return m.serverUser, nil
}
////////////////////////////////////////////////////////////////////////////////
// serverSelfSession implements auth.Session by using server's own credentials.
//
// This is useful only when the session user matches the account the server
// is running as. This can happen only locally in the dev mode.
type serverSelfSession struct{}
func (serverSelfSession) AccessToken(ctx context.Context) (*oauth2.Token, error) {
// Strictly speaking we need only userinfo.email scope, but its refresh token
// might not be present locally. But a token with CloudOAuthScopes (which
// includes the userinfo.email scope) is guaranteed to be present, since
// the server checks for it when it starts.
ts, err := auth.GetTokenSource(
ctx,
auth.AsSelf,
auth.WithScopes(auth.CloudOAuthScopes...),
)
if err != nil {
return nil, err
}
return ts.Token()
}
func (serverSelfSession) IDToken(ctx context.Context) (*oauth2.Token, error) {
// In a real scenario ID token audience always matches the OAuth client ID
// used during the login. We use some similarly looking fake. Note that this
// fake is ignored when running locally using a token established with
// `luci-auth login` (there's no way to substitute audiences of such local
// tokens).
ts, err := auth.GetTokenSource(
ctx,
auth.AsSelf,
auth.WithIDTokenAudience("fake-client-id.apps.example.com"),
)
if err != nil {
return nil, err
}
return ts.Token()
}
// erroringSession returns the given error from all methods.
type erroringSession struct {
err error
}
func (s erroringSession) AccessToken(ctx context.Context) (*oauth2.Token, error) {
return nil, s.err
}
func (s erroringSession) IDToken(ctx context.Context) (*oauth2.Token, error) {
return nil, s.err
}
| {
"content_hash": "22d75ad28c1b485f4046875d093aebc8",
"timestamp": "",
"source": "github",
"line_count": 396,
"max_line_length": 294,
"avg_line_length": 30.434343434343436,
"alnum_prop": 0.6893461666113508,
"repo_name": "luci/luci-go",
"id": "8d50cf63b1619abd9befd3e48103f19abfcb9dbe",
"size": "12870",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "server/encryptedcookies/internal/fakecookies/fakecookies.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "25460"
},
{
"name": "Go",
"bytes": "10674259"
},
{
"name": "HTML",
"bytes": "658081"
},
{
"name": "JavaScript",
"bytes": "18433"
},
{
"name": "Makefile",
"bytes": "2862"
},
{
"name": "Python",
"bytes": "49205"
},
{
"name": "Shell",
"bytes": "20986"
},
{
"name": "TypeScript",
"bytes": "110221"
}
],
"symlink_target": ""
} |
import React from 'react';
import { connect } from 'react-redux';
const CommentList = (props) => {
const list = props.comments.map(comment => <li key={comment}>{comment}</li>);
return (
<ul className="comment-list">{list}</ul>
);
};
function mapStateToProps(state) {
return { comments: state.comments };
}
export default connect(mapStateToProps)(CommentList);
| {
"content_hash": "9c685b77b03b1190e090bf4d21d87c3e",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 79,
"avg_line_length": 23.5,
"alnum_prop": 0.6808510638297872,
"repo_name": "ctrl-alt-p/born-to-sell",
"id": "1032c897ad2d6b158f313680e6188588f2cb55a5",
"size": "376",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/components/comment_list.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "363"
},
{
"name": "JavaScript",
"bytes": "17840"
}
],
"symlink_target": ""
} |
var send = function(path) {
var mime,
file = new File(path);
if(!file.isExists()) {
response.sendError(404, 'Request resource not found');
return;
}
mime = require('/modules/mime.js');
response.addHeader('Content-Type', mime.getType(path));
file.open('r');
print(file.getStream());
file.close();
}; | {
"content_hash": "a8eb18008a02585c4fdb636ec2c55e22",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 62,
"avg_line_length": 27.23076923076923,
"alnum_prop": 0.5847457627118644,
"repo_name": "ayshsandu/carbon-store-my",
"id": "9913f7cf08e2810a4ac90247bcaaf13d17e6475f",
"size": "354",
"binary": false,
"copies": "10",
"ref": "refs/heads/master",
"path": "apps/store/modules/file.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "450614"
},
{
"name": "Java",
"bytes": "296432"
},
{
"name": "JavaScript",
"bytes": "5124943"
},
{
"name": "PHP",
"bytes": "779"
}
],
"symlink_target": ""
} |
var hashchange = (function () {
var exports = {};
var expected_hash;
var changing_hash = false;
// Some browsers zealously URI-decode the contents of
// window.location.hash. So we hide our URI-encoding
// by replacing % with . (like MediaWiki).
exports.encodeHashComponent = function (str) {
return encodeURIComponent(str)
.replace(/\./g, '%2E')
.replace(/%/g, '.');
};
function decodeHashComponent(str) {
return decodeURIComponent(str.replace(/\./g, '%'));
}
function set_hash(hash) {
var location = window.location;
if (history.pushState) {
if (hash === '' || hash.charAt(0) !== '#') {
hash = '#' + hash;
}
// IE returns pathname as undefined and missing the leading /
var pathname = location.pathname;
if (pathname === undefined) {
pathname = '/';
} else if (pathname === '' || pathname.charAt(0) !== '/') {
pathname = '/' + pathname;
}
// Build a full URL to not have same origin problems
var url = location.protocol + '//' + location.host + pathname + hash;
history.pushState(null, null, url);
} else {
location.hash = hash;
}
}
exports.changehash = function (newhash) {
if (changing_hash) {
return;
}
$(document).trigger($.Event('zuliphashchange.zulip'));
set_hash(newhash);
favicon.reset();
};
// Encodes an operator list into the
// corresponding hash: the # component
// of the narrow URL
exports.operators_to_hash = function (operators) {
var hash = '#';
if (operators !== undefined) {
hash = '#narrow';
_.each(operators, function (elem) {
// Support legacy tuples.
var operator = elem.operator;
var operand = elem.operand;
var sign = elem.negated ? '-' : '';
hash += '/' + sign + hashchange.encodeHashComponent(operator)
+ '/' + hashchange.encodeHashComponent(operand);
});
}
return hash;
};
exports.save_narrow = function (operators) {
if (changing_hash) {
return;
}
var new_hash = exports.operators_to_hash(operators);
exports.changehash(new_hash);
};
function parse_narrow(hash) {
var i, operators = [];
for (i=1; i<hash.length; i+=2) {
// We don't construct URLs with an odd number of components,
// but the user might write one.
try {
var operator = decodeHashComponent(hash[i]);
var operand = decodeHashComponent(hash[i+1] || '');
var negated = false;
if (operator[0] === '-') {
negated = true;
operator = operator.slice(1);
}
operators.push({negated: negated, operator: operator, operand: operand});
} catch (err) {
return undefined;
}
}
return operators;
}
function activate_home_tab() {
ui.change_tab_to("#home");
narrow.deactivate();
floating_recipient_bar.update();
}
// Returns true if this function performed a narrow
function do_hashchange(from_reload) {
// If window.location.hash changed because our app explicitly
// changed it, then we don't need to do anything.
// (This function only neds to jump into action if it changed
// because e.g. the back button was pressed by the user)
//
// The second case is for handling the fact that some browsers
// automatically convert '#' to '' when you change the hash to '#'.
if (window.location.hash === expected_hash ||
(expected_hash !== undefined &&
window.location.hash.replace(/^#/, '') === '' &&
expected_hash.replace(/^#/, '') === '')) {
return false;
}
$(document).trigger($.Event('zuliphashchange.zulip'));
// NB: In Firefox, window.location.hash is URI-decoded.
// Even if the URL bar says #%41%42%43%44, the value here will
// be #ABCD.
var hash = window.location.hash.split("/");
switch (hash[0]) {
case "#narrow":
ui.change_tab_to("#home");
var operators = parse_narrow(hash);
if (operators === undefined) {
// If the narrow URL didn't parse, clear
// window.location.hash and send them to the home tab
set_hash('');
activate_home_tab();
return false;
}
var narrow_opts = {
select_first_unread: true,
change_hash: false, // already set
trigger: 'hash change'
};
if (from_reload !== undefined && page_params.initial_narrow_pointer !== undefined) {
narrow_opts.from_reload = true;
narrow_opts.first_unread_from_server = true;
}
narrow.activate(operators, narrow_opts);
floating_recipient_bar.update();
return true;
case "":
case "#":
activate_home_tab();
break;
case "#subscriptions":
ui.change_tab_to("#subscriptions");
break;
case "#administration":
ui.change_tab_to("#administration");
break;
case "#settings":
ui.change_tab_to("#settings");
break;
}
return false;
}
// -- -- -- -- -- -- READ THIS BEFORE TOUCHING ANYTHING BELOW -- -- -- -- -- -- //
// HOW THE HASH CHANGE MECHANISM WORKS:
// When going from a normal view (eg. `narrow/is/private`) to a settings panel
// (eg. `settings/your-bots`) it should trigger the `should_ignore` function and
// return `true` for the current state -- we want to ignore hash changes from
// within the settings page, as they will be handled by the settings page itself.
//
// There is then an `exit_settings` function that allows the hash to change exactly
// once without triggering any events. This allows the hash to reset back from
// a settings page to the previous view available before the settings page
// (eg. narrow/is/private). This saves the state, scroll position, and makes the
// hash change functionally inert.
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -- //
var ignore = {
flag: false,
prev: null
};
function get_main_hash(hash) {
return hash.replace(/^#/, "").split(/\//)[0];
}
function should_ignore (hash) {
// an array of hashes to ignore (eg. ["subscriptions", "settings", "administration"]).
var ignore_list = [];
var main_hash = get_main_hash(hash);
return (ignore_list.indexOf(main_hash) > -1);
}
function hashchanged(from_reload, e) {
var old_hash;
if (e) {
old_hash = "#" + e.oldURL.split(/#/).slice(1).join("");
ignore.last = old_hash;
}
var base = get_main_hash(window.location.hash);
if (should_ignore(window.location.hash)) {
if (!should_ignore(old_hash || "#")) {
ignore.prev = old_hash;
}
} else if (!should_ignore(window.location.hash) && !ignore.flag) {
changing_hash = true;
var ret = do_hashchange(from_reload);
changing_hash = false;
return ret;
// once we unignore the hash, we have to set the hash back to what it was
// originally (eg. '#narrow/stream/Denmark' instead of '#settings'). We
// therefore ignore the hash change once more while we change it back for
// no iterruptions.
} else if (ignore.flag) {
ignore.flag = false;
}
}
exports.initialize = function () {
// jQuery doesn't have a hashchange event, so we manually wrap
// our event handler
window.onhashchange = blueslip.wrap_function(function (e) {
hashchanged(false, e);
});
hashchanged(true);
};
exports.exit_settings = function (callback) {
if (should_ignore(window.location.hash)) {
ignore.flag = true;
window.location.hash = ignore.prev || "#";
if (typeof callback === "function") {
callback();
}
}
};
return exports;
}());
if (typeof module !== 'undefined') {
module.exports = hashchange;
}
| {
"content_hash": "1fa6c9c3b4fca00203010e960ff81666",
"timestamp": "",
"source": "github",
"line_count": 254,
"max_line_length": 92,
"avg_line_length": 31.338582677165356,
"alnum_prop": 0.5806532663316583,
"repo_name": "vikas-parashar/zulip",
"id": "adb11e18d697783385fa268c55355a901d9e011a",
"size": "7960",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "static/js/hashchange.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "241321"
},
{
"name": "Groovy",
"bytes": "5516"
},
{
"name": "HTML",
"bytes": "459360"
},
{
"name": "JavaScript",
"bytes": "1466602"
},
{
"name": "Nginx",
"bytes": "1280"
},
{
"name": "Pascal",
"bytes": "1113"
},
{
"name": "Perl",
"bytes": "401825"
},
{
"name": "Puppet",
"bytes": "82241"
},
{
"name": "Python",
"bytes": "2930542"
},
{
"name": "Ruby",
"bytes": "249748"
},
{
"name": "Shell",
"bytes": "35313"
}
],
"symlink_target": ""
} |
package org.zstack.test.network;
import junit.framework.Assert;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.zstack.core.componentloader.ComponentLoader;
import org.zstack.core.db.DatabaseFacade;
import org.zstack.header.network.l2.L2NetworkInventory;
import org.zstack.header.network.l3.L3NetworkInventory;
import org.zstack.header.network.l3.L3NetworkState;
import org.zstack.header.network.l3.L3NetworkStateEvent;
import org.zstack.header.network.l3.L3NetworkVO;
import org.zstack.header.zone.ZoneInventory;
import org.zstack.test.Api;
import org.zstack.test.ApiSenderException;
import org.zstack.test.BeanConstructor;
import org.zstack.test.DBUtil;
import org.zstack.utils.Utils;
import org.zstack.utils.logging.CLogger;
public class TestChangeL3BasicNetworkState {
CLogger logger = Utils.getLogger(TestChangeL3BasicNetworkState.class);
Api api;
ComponentLoader loader;
DatabaseFacade dbf;
@Before
public void setUp() throws Exception {
DBUtil.reDeployDB();
BeanConstructor con = new BeanConstructor();
/* This loads spring application context */
loader = con.addXml("PortalForUnitTest.xml").addXml("ZoneManager.xml").addXml("NetworkManager.xml").addXml("AccountManager.xml").build();
dbf = loader.getComponent(DatabaseFacade.class);
api = new Api();
api.startServer();
}
@After
public void tearDown() throws Exception {
api.stopServer();
}
@Test
public void test() throws ApiSenderException {
ZoneInventory zone = api.createZones(1).get(0);
L2NetworkInventory linv = api.createNoVlanL2Network(zone.getUuid(), "eth0");
L3NetworkInventory l3inv = api.createL3BasicNetwork(linv.getUuid());
L3NetworkVO vo = dbf.findByUuid(l3inv.getUuid(), L3NetworkVO.class);
Assert.assertNotNull(vo);
Assert.assertEquals(L3NetworkState.Enabled.toString(), l3inv.getState());
l3inv = api.changeL3NetworkState(l3inv.getUuid(), L3NetworkStateEvent.disable);
Assert.assertEquals(L3NetworkState.Disabled.toString(), l3inv.getState());
l3inv = api.changeL3NetworkState(l3inv.getUuid(), L3NetworkStateEvent.enable);
Assert.assertEquals(L3NetworkState.Enabled.toString(), l3inv.getState());
}
}
| {
"content_hash": "94d62145b40e46299ca2ebb604ba9fa6",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 145,
"avg_line_length": 40.87931034482759,
"alnum_prop": 0.720371151412906,
"repo_name": "icanfly/zstack",
"id": "362cf5d3743234b856fcbf0b6831d9b7e2870b93",
"size": "2371",
"binary": false,
"copies": "10",
"ref": "refs/heads/master",
"path": "test/src/test/java/org/zstack/test/network/TestChangeL3BasicNetworkState.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AspectJ",
"bytes": "49286"
},
{
"name": "Batchfile",
"bytes": "1132"
},
{
"name": "Groovy",
"bytes": "16816"
},
{
"name": "Java",
"bytes": "10063550"
},
{
"name": "Shell",
"bytes": "148422"
}
],
"symlink_target": ""
} |
/*
* Copyright, 1999-2012, salesforce.com All Rights Reserved Company Confidential
*/
package org.auraframework.service;
import java.math.BigDecimal;
import java.text.ParseException;
import java.time.format.DateTimeParseException;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import com.ibm.icu.util.Currency;
/**
* <p>
* Service for handling locale-specific data.
* </p>
* <p>
* Instances of all AuraServices should be retrieved from {@link AuraService}
* </p>
*/
public interface LocalizationService extends AuraService {
// Format Date (e.g. 1/1/2012)
/**
* Format a given Date for localized display using the default Locale,
* TimeZone, and format.
*
* @param date the Date to format
*
* @return a formatted Date String similar to "Jan 1, 2012 3:00pm PST"
*/
String formatDate(Date date);
/**
* Format a given Date for localized display using the given format style.
* Valid dateStyle values are from java.text.DateFormat, and include:
* DateFormat.SHORT, DateFormat.MEDIUM, DateFormat.LONG, and
* DateFormat.DEFAULT
*
* @param date the Date to format
* @param dateStyle the style to use.
*
* @return a formatted Date String
*/
String formatDate(Date date, int dateStyle);
/**
* Format a given Date for localized display using the given Locale.
*
* @param date the Date to format
* @param locale the Locale to use
*
* @return a formatted Date String
*/
String formatDate(Date date, Locale locale);
/**
* Format a given Date for localized display using the given Locale and
* TimeZone.
*
* @param date the Date to format
* @param locale the Locale to use
* @param timeZone the TimeZone to use
*
* @return a formatted Date String
*/
String formatDate(Date date, Locale locale, TimeZone timeZone);
/**
* Format a given Date for localized display using the given Locale,
* TimeZone, and format style.
*
* @param date the Date to format
* @param locale the Locale to use
* @param timeZone the TimeZone to use
* @param dateStyle the style from DateFormat to use (SHORT, MEDIUM, LONG,
* or DEFAULT)
*
* @return a formatted Date String
*/
String formatDate(Date date, Locale locale, TimeZone timeZone, int dateStyle);
/**
* Format a given Calendar object for display as a localized String.
*
* @param cal the Calendar to use for Date and TimeZone
*
* @return a formatted Date String
*/
String formatDate(Calendar cal);
/**
* Format a given Calendar object for display as a localized String using
* the given format style.
*
* @param cal the Calendar to use for Date and TimeZone
* @param dateStyle the style from DateFormat to use (SHORT, MEDIUM, LONG,
* or DEFAULT)
*
* @return a formatted Date String
*/
String formatDate(Calendar cal, int dateStyle);
// Format Time (e.g. 3:00pm)
/**
* Format a given Date object as a localized time String.
*
* @param time the time to format
* @return a formatted String of the local time
*/
String formatTime(Date time);
/**
* Format a given Date object as a localized time String using the format
* style specified (from java.text.DateFormat).
*
* @param time the time to format
* @param timeStyle the format style to use
* @return a formatted String of the local time
*/
String formatTime(Date time, int timeStyle);
/**
* Format a given Date object as a time String for the given Locale.
*
* @param time the time to format
* @param locale the Locale to use
* @return a formatted String of the local time
*/
String formatTime(Date time, Locale locale);
/**
* Format a given Date object as a time String for the given Locale using
* the given TimeZone.
*
* @param time the time for format
* @param locale the Locale to use
* @param timeZone the TimeZone to use for ofsetting the displayed time
* @return a formatted String of the local time
*/
String formatTime(Date time, Locale locale, TimeZone timeZone);
/**
* Format a given Date object as a time String for the given Locale using
* the given TimeZone in the given format style (from java.text.DateFormat).
*
* @param time the time for format
* @param locale the Locale to use
* @param timeZone the TimeZone to use for offsetting the displayed time
* @param timeStyle the format style to use
* @return a formatted String of the local time
*/
String formatTime(Date time, Locale locale, TimeZone timeZone, int timeStyle);
/**
* Format a given Calendar for display as a localized time String, using the
* TimeZone on the Calendar.
*
* @param cal the Calendar to format
* @return a formatted String of the local time
*/
String formatTime(Calendar cal);
/**
* Format a given Calendar for display as a localized time String in the
* given format style, using the TimeZone on the Calendar.
*
* @param cal the Calendar to format
* @param timeStyle the format style to use
* @return a formatted String of the local time
*/
String formatTime(Calendar cal, int timeStyle);
// Format Date-Time (e.g. 1/1/2012 3:00pm)
/**
* Format a given Date object as a localized time and date String.
*
* @param dateTime the Date object to format
* @return a formatted String of the local time and date
*/
String formatDateTime(Date dateTime);
/**
* Format a given Date object as a localized time String using the format
* style specified (from java.text.DateFormat).
*
* @param dateTime the Date object to format
* @param dateStyle the format style to use for the date portion
* @param timeStyle the format style to use for the time portion
* @return a formatted String of the local time and date
*/
String formatDateTime(Date dateTime, int dateStyle, int timeStyle);
/**
* Format a given Date object as a time and date String for the given
* Locale.
*
* @param dateTime the Date object to format
* @param locale the Locale to use
* @return a formatted String of the local time and date
*/
String formatDateTime(Date dateTime, Locale locale);
/**
* Format a given Date object as a time and date String for the given Locale
* using the given TimeZone.
*
* @param dateTime the Date object to format
* @param locale the Locale to use
* @param timeZone the TimeZone to use for ofsetting the displayed time
* @return a formatted String of the local time and date
*/
String formatDateTime(Date dateTime, Locale locale, TimeZone timeZone);
/**
* Format a given Date object as a time and date String for the given Locale
* using the given TimeZone in the given format style (from
* java.text.DateFormat).
*
* @param dateTime the Date object to format
* @param locale the Locale to use
* @param timeZone the TimeZone to use for offsetting the displayed time
* @param dateStyle the format style to use for the date
* @param timeStyle the format style to use for the time
* @return a formatted String of the local time and date
*/
String formatDateTime(Date dateTime, Locale locale, TimeZone timeZone, int dateStyle, int timeStyle);
/**
* Format a given Date for localized display using the given Locale,
* TimeZone, and format style.
*
* @param date the Date to format
* @param locale the Locale to use
* @param timeZone the TimeZone to use
* @param format SimpleDateFormat pattern
*
* @return a formatted Date String
*/
String formatDateTime(Date date, Locale locale, TimeZone timeZone, String format);
/**
* Format a given Calendar for display as a localized time and date String,
* using the TimeZone on the Calendar.
*
* @param cal the Calendar to format
* @return a formatted String of the local time and date
*/
String formatDateTime(Calendar cal);
/**
* Format a given Calendar for display as a localized time and date String
* in the given format style, using the TimeZone on the Calendar.
*
* @param cal the Calendar to format
* @param timeStyle the format style to use
* @return a formatted String of the local time and date
*/
String formatDateTime(Calendar cal, int dateStyle, int timeStyle);
// Format Number (e.g. 12,345.67)
/**
* Format the given number for display using the appropriate format for the
* locale.
*
* @param number the number to format
* @return a String representation of the number
*/
String formatNumber(int number);
/**
* Format the given number for display using the appropriate format for the
* locale.
*
* @param number the number to format
* @return a String representation of the number
*/
String formatNumber(long number);
/**
* Format the given number for display using the appropriate format for the
* locale.
*
* @param number the number to format
* @return a String representation of the number
*/
String formatNumber(double number);
/**
* Format the given number for display using the appropriate format for the
* locale.
*
* @param number the number to format
* @return a String representation of the number
*/
String formatNumber(Integer number);
/**
* Format the given number for display using the appropriate format for the
* locale.
*
* @param number the number to format
* @return a String representation of the number
*/
String formatNumber(Long number);
/**
* Format the given number for display using the appropriate format for the
* locale.
*
* @param number the number to format
* @return a String representation of the number
*/
String formatNumber(Double number);
/**
* Format the given number for display using the appropriate format for the
* locale. The caller can specify the minimum and maximum number of digits
* after the decimal separator.
*
* @param number the number to format
* @param minFractionDigits the minimum number of digits after the decimal
* separator
* @param maxFractionDigits the maximum number of digits after the decimal
* separator. If the input number has more precision than this
* allows, the value will be rounded
* @return a String representation of the number
*/
String formatNumber(Double number, int minFractionDigits, int maxFractionDigits);
/**
* Format a BigDecimal for localized display.
*
* @param number the number to format
* @return a String representation of the number
*/
String formatNumber(BigDecimal number);
/**
* Format the given number for display using the appropriate format for the
* locale. The caller can specify the minimum and maximum number of digits
* after the decimal separator.
*
* @param number the number to format
* @param minFractionDigits the minimum number of digits after the decimal
* separator
* @param maxFractionDigits the maximum number of digits after the decimal
* separator. If the input number has more precision than this
* allows, the value will be rounded
* @return a String representation of the number
*/
String formatNumber(BigDecimal number, int minFractionDigits, int maxFractionDigits);
/**
* Format the given number for display using the appropriate format for the
* given Locale.
*
* @param number the number to format
* @param locale the Locale to use to specify formatting
* @return a String representation of the number
*/
String formatNumber(int number, Locale locale);
/**
* Format the given number for display using the appropriate format for the
* given Locale.
*
* @param number the number to format
* @param locale the Locale to use to specify formatting
* @return a String representation of the number
*/
String formatNumber(long number, Locale locale);
/**
* Format the given number for display using the appropriate format for the
* given Locale.
*
* @param number the number to format
* @param locale the Locale to use to specify formatting
* @return a String representation of the number
*/
String formatNumber(double number, Locale locale);
/**
* Format the given number for display using the appropriate format for the
* given Locale.
*
* @param number the number to format
* @param locale the Locale to use to specify formatting
* @return a String representation of the number
*/
String formatNumber(Integer number, Locale locale);
/**
* Format the given number for display using the appropriate format for the
* given Locale.
*
* @param number the number to format
* @param locale the Locale to use to specify formatting
* @return a String representation of the number
*/
String formatNumber(Long number, Locale locale);
/**
* Format the given number for display using the appropriate format for the
* given Locale.
*
* @param number the number to format
* @param locale the Locale to use to specify formatting
* @return a String representation of the number
*/
String formatNumber(Double number, Locale locale);
/**
* Format the given number for display using the appropriate format for the
* given Locale. The caller can specify the minimum and maximum number of
* digits after the decimal separator.
*
* @param number the number to format
* @param minFractionDigits the minimum number of digits after the decimal
* separator
* @param maxFractionDigits the maximum number of digits after the decimal
* separator. If the input number has more precision than this
* allows, the value will be rounded
* @return a String representation of the number
*/
String formatNumber(Double number, Locale locale, int minFractionDigits, int maxFractionDigits);
/**
* Format the given number for display using the appropriate format for the
* given Locale.
*
* @param number the number to format
* @param locale the Locale to use to specify formatting
* @return a String representation of the number
*/
String formatNumber(BigDecimal number, Locale locale);
/**
* Format the given number for display using the appropriate format for the
* given Locale. The caller can specify the minimum and maximum number of
* digits after the decimal separator.
*
* @param number the number to format
* @param minFractionDigits the minimum number of digits after the decimal
* separator
* @param maxFractionDigits the maximum number of digits after the decimal
* separator. If the input number has more precision than this
* allows, the value will be rounded
* @return a String representation of the number
*/
String formatNumber(BigDecimal number, Locale locale, int minFractionDigits, int maxFractionDigits);
// Format Percent (e.g. 75.5%)
/**
* Format the given number as a localized percentage. Generally this will
* move the decimal point over two places from the given value and add a
* localized percentage character. For example in the en_US Locale the input
* of 0.25 would be returned as "25%".
*
* @param percent the number to format as a percentage String
* @return a formatted percentage String
*/
String formatPercent(double percent);
/**
* Format the given number as a localized percentage. Generally this will
* move the decimal point over two places from the given value and add a
* localized percentage character. For example in the en_US Locale the input
* of {0.25, 2, 4} would be returned as "25.00%".
*
* @param percent the number to format as a percentage String
* @param minFractionDigits the minimum number of digits after the decimal
* separator of the String
* @param maxFractionDigits the maximum number of digits after the decimal
* separator. of the String
* @return a formatted percentage String
*/
String formatPercent(double percent, int minFractionDigits, int maxFractionDigits);
/**
* Format the given number as a localized percentage. Generally this will
* move the decimal point over two places from the given value and add a
* localized percentage character. For example for the en_US Locale the
* input of 0.25 would be returned as "25%".
*
* @param percent the number to format as a percentage String
* @param locale the Locale to use for formatting
* @return a formatted percentage String
*/
String formatPercent(double percent, Locale locale);
/**
* Format the given number as a localized percentage. Generally this will
* move the decimal point over two places from the given value and add a
* localized percentage character. For example in the en_US Locale the input
* of {0.25, 2, 4} would be returned as "25.00%".
*
* @param percent the number to format as a percentage String
* @param locale the Locale to use for formatting
* @param minFractionDigits the minimum number of digits after the decimal
* separator of the String
* @param maxFractionDigits the maximum number of digits after the decimal
* separator. of the String
* @return a formatted percentage String
*/
String formatPercent(double percent, Locale locale, int minFractionDigits, int maxFractionDigits);
// Format Currency (e.g. $12,345.67)
/**
* Format the given number as a currency amount. This will generally assign
* a currency symbol and apply a decimal precision commonly associated with
* the local currency.
*
* For more precise control of the output or to add your own currency
* indicator, simply format as a number instead of a currency amount. This
* could be useful to apply a "USD" suffix instead of a "$" prefix for
* example, or to have no symbol at all if that symbol is rendered
* separately in a label outside of a field.
*
* @param value the number to format
* @return a formatted currency String
*/
String formatCurrency(double value);
/**
* Format the given number as a currency amount. This will generally assign
* a currency symbol and apply a decimal precision commonly associated with
* the local currency.
*
* For more precise control of the output or to add your own currency
* indicator, simply format as a number instead of a currency amount. This
* could be useful to apply a "USD" suffix instead of a "$" prefix for
* example, or to have no symbol at all if that symbol is rendered
* separately in a label outside of a field.
*
* @param value the number to format
* @param minFractionDigits the minimum number of digits to display after
* the decimal separator in the String
* @param maxFractionDigits the maximum number of digits to display after
* the decimal separator in the String. If the input number has
* more precision than this allows, the value will be rounded
* @return a formatted currency String
*/
String formatCurrency(double value, int minFractionDigits, int maxFractionDigits);
/**
* Format the given number as a currency amount. This will generally assign
* a currency symbol and apply a decimal precision commonly associated with
* the Locale's currency.
*
* For more precise control of the output or to add your own currency
* indicator, simply format as a number instead of a currency amount. This
* could be useful to apply a "USD" suffix instead of a "$" prefix for
* example, or to have no symbol at all if that symbol is rendered
* separately in a label outside of a field.
*
* @param value the number to format
* @return a formatted currency String
*/
String formatCurrency(double value, Locale locale);
/**
* Format the given number as a currency amount. This will generally assign
* a currency symbol and apply a decimal precision commonly associated with
* the Locale's currency.
*
* For more precise control of the output or to add your own currency
* indicator, simply format as a number instead of a currency amount. This
* could be useful to apply a "USD" suffix instead of a "$" prefix for
* example, or to have no symbol at all if that symbol is rendered
* separately in a label outside of a field.
*
* @param value the number to format
* @param minFractionDigits the minimum number of digits to display after
* the decimal separator in the String
* @param maxFractionDigits the maximum number of digits to display after
* the decimal separator in the String. If the input number has
* more precision than this allows, the value will be rounded
* @return a formatted currency String
*/
String formatCurrency(double value, Locale locale, int minFractionDigits, int maxFractionDigits);
/**
* Format the given number as a currency amount. This will generally assign
* a currency symbol and apply a decimal precision commonly associated with
* the Locale's currency.
*
* For more precise control of the output or to add your own currency
* indicator, simply format as a number instead of a currency amount. This
* could be useful to apply a "USD" suffix instead of a "$" prefix for
* example, or to have no symbol at all if that symbol is rendered
* separately in a label outside of a field.
*
* @param value the number to format
* @param minFractionDigits the minimum number of digits to display after
* the decimal separator in the String
* @param maxFractionDigits the maximum number of digits to display after
* the decimal separator in the String. If the input number has
* more precision than this allows, the value will be rounded
* @param currency the currency to use with the format
* @return a formatted currency String
*/
String formatCurrency(double value, Locale locale, int minFractionDigits, int maxFractionDigits,
Currency currency);
/**
* Format the given BigDecimal as a currency amount. This will generally
* assign a currency symbol and apply a decimal precision commonly
* associated with the local currency.
*
* For more precise control of the output or to add your own currency
* indicator, simply format as a number instead of a currency amount. This
* could be useful to apply a "USD" suffix instead of a "$" prefix for
* example, or to have no symbol at all if that symbol is rendered
* separately in a label outside of a field.
*
* @param value the number to format
* @return a formatted currency String
*/
String formatCurrency(BigDecimal value);
/**
* Format the given BigDecimal as a currency amount. This will generally
* assign a currency symbol and apply a decimal precision commonly
* associated with the local currency.
*
* For more precise control of the output or to add your own currency
* indicator, simply format as a number instead of a currency amount. This
* could be useful to apply a "USD" suffix instead of a "$" prefix for
* example, or to have no symbol at all if that symbol is rendered
* separately in a label outside of a field.
*
* @param value the number to format
* @param minFractionDigits the minimum number of digits to display after
* the decimal separator in the String
* @param maxFractionDigits the maximum number of digits to display after
* the decimal separator in the String. If the input number has
* more precision than this allows, the value will be rounded
* @return a formatted currency String
*/
String formatCurrency(BigDecimal value, int minFractionDigits, int maxFractionDigits);
/**
* Format the given BigDecimal as a currency amount. This will generally
* assign a currency symbol and apply a decimal precision commonly
* associated with the Locale's currency.
*
* For more precise control of the output or to add your own currency
* indicator, simply format as a number instead of a currency amount. This
* could be useful to apply a "USD" suffix instead of a "$" prefix for
* example, or to have no symbol at all if that symbol is rendered
* separately in a label outside of a field.
*
* @param value the number to format
* @return a formatted currency String
*/
String formatCurrency(BigDecimal value, Locale locale);
/**
* Format the given BigDecimal as a currency amount. This will generally
* assign a currency symbol and apply a decimal precision commonly
* associated with the Locale's currency.
*
* For more precise control of the output or to add your own currency
* indicator, simply format as a number instead of a currency amount. This
* could be useful to apply a "USD" suffix instead of a "$" prefix for
* example, or to have no symbol at all if that symbol is rendered
* separately in a label outside of a field.
*
* @param value the number to format
* @param minFractionDigits the minimum number of digits to display after
* the decimal separator in the String
* @param maxFractionDigits the maximum number of digits to display after
* the decimal separator in the String. If the input number has
* more precision than this allows, the value will be rounded
* @return a formatted currency String
*/
String formatCurrency(BigDecimal value, Locale locale, int minFractionDigits, int maxFractionDigits);
/**
* Format the given BigDecimal as a currency amount. This will generally
* assign a currency symbol and apply a decimal precision commonly
* associated with the Locale's currency.
*
* For more precise control of the output or to add your own currency
* indicator, simply format as a number instead of a currency amount. This
* could be useful to apply a "USD" suffix instead of a "$" prefix for
* example, or to have no symbol at all if that symbol is rendered
* separately in a label outside of a field.
*
* @param value the number to format
* @param minFractionDigits the minimum number of digits to display after
* the decimal separator in the String
* @param maxFractionDigits the maximum number of digits to display after
* the decimal separator in the String. If the input number has
* more precision than this allows, the value will be rounded
* @param currency the currency to use with the format
* @return a formatted currency String
*/
String formatCurrency(BigDecimal value, Locale locale, int minFractionDigits, int maxFractionDigits,
Currency currency);
// Parse Date String to Date object with no specific time
/**
* Attempt to parse the given String to a Date object where the date is all
* that is interesting. The time of day will typically be 00:00:00 or
* undefined.
*
* @param date the date String
* @return the determined Date equivalent
* @throws DateTimeParseException if a problem occurs parsing the String
*/
Date parseDate(String date) throws DateTimeParseException;
/**
* Attempt to parse the given String to a Date object, assuming the String
* will match the given style. The date is all that is interesting. The time
* of day will typically be 00:00:00 or undefined.
*
* @param date the date String
* @param dateStyle the format style to use when parsing
* @return the determined Date equivalent
* @throws DateTimeParseException if a problem occurs parsing the String
*/
Date parseDate(String date, int dateStyle) throws DateTimeParseException;
/**
* Attempt to parse the given String to a Date object from the given Locale.
* The date is all that is interesting. The time of day will typically be
* 00:00:00 or undefined.
*
* @param date the date String
* @param locale the Locale to use when parsing
* @return the determined Date equivalent
* @throws DateTimeParseException if a problem occurs parsing the String
*/
Date parseDate(String date, Locale locale) throws DateTimeParseException;
/**
* Attempt to parse the given String to a Date object from the given Locale,
* using the given TimeZone. The date is all that is interesting. The time
* of day will typically be 00:00:00 or undefined.
*
* @param date the date String
* @param locale the Locale to use when parsing
* @param timeZone the TimeZone to use when parsing
* @return the determined Date equivalent
* @throws DateTimeParseException if a problem occurs parsing the String
*/
Date parseDate(String date, Locale locale, TimeZone timeZone) throws DateTimeParseException;
/**
* Attempt to parse the given String to a Date object from the given Locale,
* using the given TimeZone, assuming the String will match the given format
* style. The date is all that is interesting. The time of day will
* typically be 00:00:00 or undefined.
*
* @param date the date String
* @param locale the Locale to use when parsing
* @param timeZone the TimeZone to use when parsing
* @param dateStyle the format style to use when parsing
* @return the determined Date equivalent
* @throws DateTimeParseException if a problem occurs parsing the String
*/
Date parseDate(String date, Locale locale, TimeZone timeZone, int dateStyle) throws DateTimeParseException;
/**
* Attempt to parse the given String to a Calendar object from the given
* Locale, using the given TimeZone, assuming the String will match the
* given format style. The date is all that is interesting. The time of day
* will typically be 00:00:00 or undefined.
*
* @param date the date String
* @param locale the Locale to use when parsing
* @param timeZone the TimeZone to use when parsing
* @param dateStyle the format style to use when parsing
* @return the determined Calendar equivalent
* @throws DateTimeParseException if a problem occurs parsing the String
*/
Calendar parseDateToCalendar(String date, Locale locale, TimeZone timeZone, int dateStyle)
throws DateTimeParseException;
// Parse Time String to Date object of the given Time
/**
* Attempt to parse the given String to a Date object where the time of day
* is all that is interesting. The day, month, and year will be undefined or
* the fist day of the epoch calendar.
*
* @param time the time String
* @return the determined Date equivalent for the time
* @throws DateTimeParseException if a problem occurs parsing the String
*/
Date parseTime(String time) throws DateTimeParseException;
/**
* Attempt to parse the given String to a Date object where the time of day
* is all that is interesting. The day, month, and year will be undefined or
* the fist day of the epoch calendar.
*
* @param time the time String
* @param timeStyle the format style of the time String (from
* java.text.DateFormat)
* @return the determined Date equivalent for the time
* @throws DateTimeParseException if a problem occurs parsing the String
*/
Date parseTime(String time, int timeStyle) throws DateTimeParseException;
/**
* Attempt to parse the given String to a Date object where the time of day
* is all that is interesting. The day, month, and year will be undefined or
* the fist day of the epoch calendar.
*
* @param time the time String
* @param locale the Locale to use when parsing
* @return the determined Date equivalent for the time
* @throws DateTimeParseException if a problem occurs parsing the String
*/
Date parseTime(String time, Locale locale) throws DateTimeParseException;
/**
* Attempt to parse the given String to a Date object where the time of day
* is all that is interesting. The day, month, and year will be undefined or
* the fist day of the epoch calendar. The given TimeZone will be used to
* calibrate the given String to UTC/GMT time on the returned Date object.
*
* For example given a user in the en_US Locale and Pacific Standard Time
* (PST) TimeZone a given String of "8:00pm PST" would be returned as a Date
* object of either 12:00pm or 1:00pm UTC/GMT depending on the current
* Daylight Savings offset for PST/PDT.
*
* @param time the time String
* @param locale the Locale to use when parsing
* @param timeZone the timeZone to use to adjust the offset on the returned
* Date
* @return the determined Date equivalent for the time
* @throws DateTimeParseException if a problem occurs parsing the String
*/
Date parseTime(String time, Locale locale, TimeZone timeZone) throws DateTimeParseException;
/**
* Attempt to parse the given String to a Date object where the time of day
* is all that is interesting. The day, month, and year will be undefined or
* the fist day of the epoch calendar. The given TimeZone will be used to
* calibrate the given String to UTC/GMT time on the returned Date object.
*
* For example given a user in the en_US Locale and Pacific Standard Time
* (PST) TimeZone a given String of "8:00pm PST" would be returned as a Date
* object of either 12:00pm or 1:00pm UTC/GMT depending on the current
* Daylight Savings offset for PST/PDT.
*
* @param time the time String
* @param locale the Locale to use when parsing
* @param timeZone the timeZone to use to adjust the offset on the returned
* Date
* @param timeStyle the format style of the time String (from
* java.text.DateFormat)
* @return the determined Date equivalent for the time
* @throws DateTimeParseException if a problem occurs parsing the String
*/
Date parseTime(String time, Locale locale, TimeZone timeZone, int timeStyle) throws DateTimeParseException;
/**
* Attempt to parse the given String to a Calendar object where the time of
* day is all that is interesting. The day, month, and year will be
* undefined or the fist day of the epoch calendar. The given TimeZone will
* be used to calibrate the given String to UTC/GMT time on the returned
* Calendar object.
*
* For example given a user in the en_US Locale and Pacific Standard Time
* (PST) TimeZone a given String of "8:00pm PST" would be returned as a Date
* object of either 12:00pm or 1:00pm UTC/GMT depending on the current
* Daylight Savings offset for PST/PDT.
*
* The TimeZone will also be set on the returned Calendar instance.
*
* @param time the time String
* @param locale the Locale to use when parsing
* @param timeZone the timeZone to use to adjust the offset on the returned
* Calendar
* @param timeStyle the format style of the time String
* @return the determined Calendar equivalent for the time
* @throws DateTimeParseException if a problem occurs parsing the String
*/
Calendar parseTimeToCalendar(String time, Locale locale, TimeZone timeZone, int timeStyle)
throws DateTimeParseException;
// Parse Date Time String to Date Object with the given time
/**
* Attempt to parse the given String to a Date object where the time of day
* and date are both interesting. A default TimeZone will be used to
* calibrate the given String to UTC/GMT time on the returned Date object.
*
* @param dateTime the time and date String
* @return the determined Date equivalent
* @throws DateTimeParseException if a problem occurs parsing the String
*/
Date parseDateTime(String dateTime) throws DateTimeParseException;
/**
* Attempt to parse the given String to a Date object where the time of day
* and date are both interesting. A default TimeZone will be used to
* calibrate the given String to UTC/GMT time on the returned Date object.
*
* @param dateTime the time and date String
* @param dateStyle the format style of the date portion of the String
* @param timeStyle the format style of the time portion of the String
* @return the determined Date equivalent
* @throws DateTimeParseException if a problem occurs parsing the String
*/
Date parseDateTime(String dateTime, int dateStyle, int timeStyle) throws DateTimeParseException;
/**
* Attempt to parse the given String to a Date object where the time of day
* and date are both interesting. A default TimeZone will be used to
* calibrate the given String to UTC/GMT time on the returned Date object.
*
* @param dateTime the time and date String
* @param locale the Locale to use when parsing
* @return the determined Date equivalent
* @throws DateTimeParseException if a problem occurs parsing the String
*/
Date parseDateTime(String dateTime, Locale locale) throws DateTimeParseException;
/**
* Attempt to parse the given String to a Date object where the time of day
* and date are both interesting. The given TimeZone will be used to
* calibrate the given String to UTC/GMT time on the returned Date object.
*
* @param dateTime the time and date String
* @param locale the Locale to use when parsing
* @param timeZone the timeZone to use to adjust the offset on the returned
* Calendar
* @return the determined Date equivalent
* @throws DateTimeParseException if a problem occurs parsing the String
*/
Date parseDateTime(String dateTime, Locale locale, TimeZone timeZone) throws DateTimeParseException;
/**
* Attempt to parse the given String to a Date object where the time of day
* and date are both interesting. The given TimeZone will be used to
* calibrate the given String to UTC/GMT time on the returned Date object.
*
* @param dateTime the time and date String
* @param locale the Locale to use when parsing
* @param timeZone the timeZone to use to adjust the offset on the returned
* Calendar
* @param dateStyle the format style of the date portion of the String
* @param timeStyle the format style of the time portion of the String
* @return the determined Date equivalent
* @throws DateTimeParseException if a problem occurs parsing the String
*/
Date parseDateTime(String dateTime, Locale locale, TimeZone timeZone, int dateStyle, int timeStyle)
throws DateTimeParseException;
/**
* Attempt to parse the given String to a Date object where the time of day
* and date are both interesting. The given TimeZone will be used to
* calibrate the given String to UTC/GMT time on the returned Date object.
*
* @param dateTime the time and date String
* @param locale the Locale to use when parsing
* @param timeZone the timeZone to use to adjust the offset on the returned
* Calendar
* @param format SimpleDateFormat pattern
* @return the determined Date equivalent
* @throws DateTimeParseException if a problem occurs parsing the String
*/
Date parseDateTime(String dateTime, Locale locale, TimeZone timeZone, String format) throws DateTimeParseException;
/**
* Attempt to parse the given String to a Calendar object where the time of
* day and date are both interesting. The given TimeZone will be used to
* calibrate the given String to UTC/GMT time on the returned Calendar
* object.
*
* The TimeZone will also be set on the returned Calendar instance.
*
* @param dateTime the time and date String
* @param locale the Locale to use when parsing
* @param timeZone the timeZone to use to adjust the offset on the returned
* Calendar
* @param dateStyle the format style of the date portion of the String
* @param timeStyle the format style of the time portion of the String
* @return the determined Calendar equivalent
* @throws DateTimeParseException if a problem occurs parsing the String
*/
Calendar parseDateTimeToCalendar(String dateTime, Locale locale, TimeZone timeZone, int dateStyle,
int timeStyle) throws DateTimeParseException;
// Parse a number String to a numeric amount
/**
* Attempts to convert a given String to an int value . If the number cannot
* be deciphered from the String a ParseException is thrown.
*
* @param number the localized number String to attempt to parse
* @return the numeric equivalent
* @throws ParseException if a problem is encountered
*/
int parseInt(String number) throws ParseException;
/**
* Attempts to convert a given String to a long value . If the number cannot
* be deciphered from the String a ParseException is thrown.
*
* @param number the localized number String to attempt to parse
* @return the numeric equivalent
* @throws ParseException if a problem is encountered
*/
long parseLong(String number) throws ParseException;
/**
* Attempts to convert a given String to float value . If the number cannot
* be deciphered from the String a ParseException is thrown.
*
* @param number the localized number String to attempt to parse
* @return the numeric equivalent
* @throws ParseException if a problem is encountered
*/
float parseFloat(String number) throws ParseException;
/**
* Attempts to convert a given String to a double value . If the number
* cannot be deciphered from the String a ParseException is thrown.
*
* @param number the localized number String to attempt to parse
* @return the numeric equivalent
* @throws ParseException if a problem is encountered
*/
double parseDouble(String number) throws ParseException;
/**
* Attempts to convert a given String to an int value . If the number cannot
* be deciphered from the String using the given Locale a ParseException is
* thrown.
*
* @param number the localized number String to attempt to parse
* @param locale the Locale to use
* @return the numeric equivalent
* @throws ParseException if a problem is encountered
*/
int parseInt(String number, Locale locale) throws ParseException;
/**
* Attempts to convert a given String toa long value . If the number cannot
* be deciphered from the String using the given Locale a ParseException is
* thrown.
*
* @param number the localized number String to attempt to parse
* @param locale the Locale to use
* @return the numeric equivalent
* @throws ParseException if a problem is encountered
*/
long parseLong(String number, Locale locale) throws ParseException;
/**
* Attempts to convert a given String to a float value . If the number
* cannot be deciphered from the String using the given Locale a
* ParseException is thrown.
*
* @param number the localized number String to attempt to parse
* @param locale the Locale to use
* @return the numeric equivalent
* @throws ParseException if a problem is encountered
*/
float parseFloat(String number, Locale locale) throws ParseException;
/**
* Attempts to convert a given String to a double value . If the number
* cannot be deciphered from the String using the given Locale a
* ParseException is thrown.
*
* @param number the localized number String to attempt to parse
* @param locale the Locale to use
* @return the numeric equivalent
* @throws ParseException if a problem is encountered
*/
double parseDouble(String number, Locale locale) throws ParseException;
// Parse a BigDecimal String to a BigDecimal amount
/**
* Returns a BigDecimal number from the given localized number String.
*
* @param number the number String to parse
* @return a BigDecimal
* @throws ParseException if number cannot be parsed
*/
BigDecimal parseBigDecimal(String number) throws ParseException;
/**
* Returns a BigDecimal number from the given localized number String and
* Locale object.
*
* @param number the number String to parse
* @return a BigDecimal
* @throws ParseException if number cannot be parsed
*/
BigDecimal parseBigDecimal(String number, Locale locale) throws ParseException;
/**
* Returns a BigDecimal number from the given localized number String,
* Locale object and parseStrict flag.
*
* @param number the number String to parse
* @param locale the Locale object
* @param strict the flag to indicate if we should parse strictly
* @return a BigDecimal
* @throws ParseException if number cannot be parsed
*/
BigDecimal parseBigDecimal(String number, Locale locale, boolean strict) throws ParseException;
// Parse a Percent String to a double amount ("75.5%" = 0.755)
/**
* Returns a number from the given localized percentage String. This will be
* the mathematical equivalent, not the language equivalent.
*
* For example "75%" in en_US is returned as 0.75 not as 75.
*
* @param percent the percent String to parse
* @return a number representation of the percentage String
* @throws ParseException if the percentage cannot be parsed
*/
double parsePercent(String percent) throws ParseException;
/**
* Returns a number from the given localized percentage String based on the
* given Locale's percent format. This will be the mathematical equivalent,
* not the language equivalent.
*
* For example "75%" in en_US is returned as 0.75 not as 75.
*
* @param percent the percent String to parse
* @return a number representation of the percentage String
* @throws ParseException if the percentage cannot be parsed
*/
double parsePercent(String percent, Locale locale) throws ParseException;
// Parse a Currency String to a BigDecimal amount
/**
* Returns a BigDecimal number from the given localized currency String.
*
* @param currency the currency String to parse
* @return a BigDecimal
* @throws ParseException if currency cannot be parsed
*/
BigDecimal parseCurrency(String currency) throws ParseException;
/**
* Returns a BigDecimal number from the given localized currency String and
* Locale object.
*
* @param currency the currency String to parse
* @return a BigDecimal
* @throws ParseException if currency cannot be parsed
*/
BigDecimal parseCurrency(String currency, Locale locale) throws ParseException;
/**
* Format a Number for localized display.
*
* @param number the number to format
* @return a String representation of the number
*/
String formatNumber(Number number);
/**
* Format a Number for localized display.
*
* @param number the number to format
* @return a String representation of the number
*/
String formatNumber(Number number, Locale locale);
/**
* Format a Number for localized display.
*
* @param number the number to format
* @return a String representation of the number
*/
String formatNumber(Number number, Locale locale, int minFractionDigits, int maxFractionDigits);
// Format patterns
String getDateFormatPattern();
String getDateTimeFormatPattern();
String getTimeFormatPattern();
String getNumberFormatPattern();
String getDecimalSeparator();
String getGroupingSeparator();
String getZeroDigit();
String getPercentFormatPattern();
String getCurrencyFormatPattern();
String getCurrencyCode();
String getCurrencySymbol();
}
| {
"content_hash": "98b771e1db7b36e16033bc1358ebbde8",
"timestamp": "",
"source": "github",
"line_count": 1209,
"max_line_length": 119,
"avg_line_length": 41.09842845326716,
"alnum_prop": 0.6822572854612784,
"repo_name": "madmax983/aura",
"id": "fd44df634ed6b87c24b7d75d5a0244c6ebcaf3f4",
"size": "50299",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "aura/src/main/java/org/auraframework/service/LocalizationService.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "782982"
},
{
"name": "GAP",
"bytes": "10087"
},
{
"name": "HTML",
"bytes": "3296233"
},
{
"name": "Java",
"bytes": "9575906"
},
{
"name": "JavaScript",
"bytes": "26838648"
},
{
"name": "PHP",
"bytes": "3345441"
},
{
"name": "Python",
"bytes": "9744"
},
{
"name": "Shell",
"bytes": "20356"
},
{
"name": "XSLT",
"bytes": "1579"
}
],
"symlink_target": ""
} |
/* jshint node: true */
'use strict';
module.exports = {
name: 'ember-lazy-image',
included: function emberLazyImageIncluded(app) {
this._super.included(app);
app.import('vendor/lazy-image/lazy-image.css');
}
};
| {
"content_hash": "f7d389d3133dbe4b151def85e20384de",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 51,
"avg_line_length": 19.083333333333332,
"alnum_prop": 0.6593886462882096,
"repo_name": "RuslanZavacky/ember-lazy-image",
"id": "f33a643588f1e771fc36f776bfcd97fc404261d2",
"size": "229",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "1574"
},
{
"name": "Handlebars",
"bytes": "3178"
},
{
"name": "JavaScript",
"bytes": "13935"
}
],
"symlink_target": ""
} |
"""
Installs and configures nova
"""
import os
import uuid
import logging
import platform
import socket
from packstack.installer import basedefs, processors, utils, validators
from packstack.installer.exceptions import ScriptRuntimeError
from packstack.modules.shortcuts import get_mq
from packstack.modules.ospluginutils import (NovaConfig, getManifestTemplate,
appendManifestFile, manifestfiles)
#------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "OS-Nova"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
def initConfig(controller):
if platform.linux_distribution()[0] == "Fedora":
primary_netif = "em1"
secondary_netif = "em2"
else:
primary_netif = "eth0"
secondary_netif = "eth1"
nova_params = {
"NOVA": [
{"CMD_OPTION": "nova-db-passwd",
"USAGE": "The password to use for the Nova to access DB",
"PROMPT": "Enter the password for the Nova DB access",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_NOVA_DB_PW",
"USE_DEFAULT": True,
"NEED_CONFIRM": True,
"CONDITION": False},
{"CMD_OPTION": "nova-ks-passwd",
"USAGE": ("The password to use for the Nova to authenticate "
"with Keystone"),
"PROMPT": "Enter the password for the Nova Keystone access",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_NOVA_KS_PW",
"USE_DEFAULT": True,
"NEED_CONFIRM": True,
"CONDITION": False},
{"CMD_OPTION": "novasched-cpu-allocation-ratio",
"USAGE": ("The overcommitment ratio for virtual to physical CPUs."
" Set to 1.0 to disable CPU overcommitment"),
"PROMPT": "Enter the CPU overcommitment ratio. Set to 1.0 to "
"disable CPU overcommitment",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_float],
"DEFAULT_VALUE": 16.0,
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_SCHED_CPU_ALLOC_RATIO",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "novasched-ram-allocation-ratio",
"USAGE": ("The overcommitment ratio for virtual to physical RAM. "
"Set to 1.0 to disable RAM overcommitment"),
"PROMPT": ("Enter the RAM overcommitment ratio. Set to 1.0 to "
"disable RAM overcommitment"),
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_float],
"DEFAULT_VALUE": 1.5,
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_SCHED_RAM_ALLOC_RATIO",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "novacompute-migrate-protocol",
"USAGE": ("Protocol used for instance migration. Allowed values "
"are tcp and ssh. Note that by defaul nova user is "
"created with /sbin/nologin shell so that ssh protocol "
"won't be working. To make ssh protocol work you have "
"to fix nova user on compute hosts manually."),
"PROMPT": ("Enter protocol which will be used for instance "
"migration"),
"OPTION_LIST": ['tcp', 'ssh'],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": 'tcp',
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_COMPUTE_MIGRATE_PROTOCOL",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
],
"NOVA_NETWORK": [
{"CMD_OPTION": "novacompute-privif",
"USAGE": ("Private interface for Flat DHCP on the Nova compute "
"servers"),
"PROMPT": ("Enter the Private interface for Flat DHCP on the Nova"
" compute servers"),
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": secondary_netif,
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_COMPUTE_PRIVIF",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "novanetwork-manager",
"USAGE": "Nova network manager",
"PROMPT": "Enter the Nova network manager",
"OPTION_LIST": [r'^nova\.network\.manager\.\w+Manager$'],
"VALIDATORS": [validators.validate_regexp],
"DEFAULT_VALUE": "nova.network.manager.FlatDHCPManager",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_NETWORK_MANAGER",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "novanetwork-pubif",
"USAGE": "Public interface on the Nova network server",
"PROMPT": "Enter the Public interface on the Nova network server",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": primary_netif,
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_NETWORK_PUBIF",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "novanetwork-privif",
"USAGE": ("Private interface for network manager on the Nova "
"network server"),
"PROMPT": ("Enter the Private interface for network manager on "
"the Nova network server"),
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": secondary_netif,
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_NETWORK_PRIVIF",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "novanetwork-fixed-range",
"USAGE": "IP Range for network manager",
"PROMPT": "Enter the IP Range for network manager",
"OPTION_LIST": ["^[\:\.\da-fA-f]+(\/\d+){0,1}$"],
"PROCESSORS": [processors.process_cidr],
"VALIDATORS": [validators.validate_regexp],
"DEFAULT_VALUE": "192.168.32.0/22",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_NETWORK_FIXEDRANGE",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "novanetwork-floating-range",
"USAGE": "IP Range for Floating IP's",
"PROMPT": "Enter the IP Range for Floating IP's",
"OPTION_LIST": ["^[\:\.\da-fA-f]+(\/\d+){0,1}$"],
"PROCESSORS": [processors.process_cidr],
"VALIDATORS": [validators.validate_regexp],
"DEFAULT_VALUE": "10.3.4.0/22",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_NETWORK_FLOATRANGE",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "novanetwork-default-floating-pool",
"USAGE": ("Name of the default floating pool to which the "
"specified floating ranges are added to"),
"PROMPT": "What should the default floating pool be called?",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": "nova",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_NOVA_NETWORK_DEFAULTFLOATINGPOOL",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "novanetwork-auto-assign-floating-ip",
"USAGE": "Automatically assign a floating IP to new instances",
"PROMPT": ("Should new instances automatically have a floating "
"IP assigned?"),
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "n",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_NOVA_NETWORK_AUTOASSIGNFLOATINGIP",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
],
"NOVA_NETWORK_VLAN": [
{"CMD_OPTION": "novanetwork-vlan-start",
"USAGE": "First VLAN for private networks",
"PROMPT": "Enter first VLAN for private networks",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": 100,
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_NETWORK_VLAN_START",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "novanetwork-num-networks",
"USAGE": "Number of networks to support",
"PROMPT": "How many networks should be supported",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": 1,
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_NETWORK_NUMBER",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "novanetwork-network-size",
"USAGE": "Number of addresses in each private subnet",
"PROMPT": "How many addresses should be in each private subnet",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": 255,
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_NETWORK_SIZE",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
],
}
def use_nova_network(config):
return (config['CONFIG_NOVA_INSTALL'] == 'y' and
config['CONFIG_NEUTRON_INSTALL'] != 'y')
def use_nova_network_vlan(config):
manager = 'nova.network.manager.VlanManager'
return (config['CONFIG_NOVA_INSTALL'] == 'y' and
config['CONFIG_NEUTRON_INSTALL'] != 'y' and
config['CONFIG_NOVA_NETWORK_MANAGER'] == manager)
nova_groups = [
{"GROUP_NAME": "NOVA",
"DESCRIPTION": "Nova Options",
"PRE_CONDITION": "CONFIG_NOVA_INSTALL",
"PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
{"GROUP_NAME": "NOVA_NETWORK",
"DESCRIPTION": "Nova Network Options",
"PRE_CONDITION": use_nova_network,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
{"GROUP_NAME": "NOVA_NETWORK_VLAN",
"DESCRIPTION": "Nova Network VLAN Options",
"PRE_CONDITION": use_nova_network_vlan,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
]
for group in nova_groups:
params = nova_params[group["GROUP_NAME"]]
controller.addGroup(group, params)
def initSequences(controller):
if controller.CONF['CONFIG_NOVA_INSTALL'] != 'y':
return
if controller.CONF['CONFIG_NEUTRON_INSTALL'] == 'y':
network_title = ('Adding Openstack Network-related '
'Nova manifest entries')
network_function = create_neutron_manifest
else:
network_title = 'Adding Nova Network manifest entries'
network_function = create_network_manifest
novaapisteps = [
{'title': 'Adding Nova API manifest entries',
'functions': [create_api_manifest]},
{'title': 'Adding Nova Keystone manifest entries',
'functions': [create_keystone_manifest]},
{'title': 'Adding Nova Cert manifest entries',
'functions': [create_cert_manifest]},
{'title': 'Adding Nova Conductor manifest entries',
'functions': [create_conductor_manifest]},
{'title': 'Creating ssh keys for Nova migration',
'functions': [create_ssh_keys]},
{'title': 'Gathering ssh host keys for Nova migration',
'functions': [gather_host_keys]},
{'title': 'Adding Nova Compute manifest entries',
'functions': [create_compute_manifest]},
{'title': 'Adding Nova Scheduler manifest entries',
'functions': [create_sched_manifest]},
{'title': 'Adding Nova VNC Proxy manifest entries',
'functions': [create_vncproxy_manifest]},
{'title': network_title,
'functions': [network_function]},
{'title': 'Adding Nova Common manifest entries',
'functions': [create_common_manifest]},
{'title': 'Adding Ceph manifest entries',
'functions': [create_ceph_manifest]},
]
controller.addSequence("Installing OpenStack Nova API", [], [],
novaapisteps)
#------------------------- helper functions -------------------------
def check_ifcfg(host, device):
"""
Raises ScriptRuntimeError if given host does not have give device.
"""
server = utils.ScriptRunner(host)
cmd = "ip addr show dev %s || ( echo Device %s does not exist && exit 1 )"
server.append(cmd % (device, device))
server.execute()
def bring_up_ifcfg(host, device):
"""
Brings given device up if it's down. Raises ScriptRuntimeError in case
of failure.
"""
server = utils.ScriptRunner(host)
server.append('ip link show up | grep "%s"' % device)
try:
server.execute()
except ScriptRuntimeError:
server.clear()
cmd = 'ip link set dev %s up'
server.append(cmd % device)
try:
server.execute()
except ScriptRuntimeError:
msg = ('Failed to bring up network interface %s on host %s.'
' Interface should be up so Openstack can work'
' properly.' % (device, host))
raise ScriptRuntimeError(msg)
#-------------------------- step functions --------------------------
def create_ssh_keys(config, messages):
migration_key = os.path.join(basedefs.VAR_DIR, 'nova_migration_key')
# Generate key
local = utils.ScriptRunner()
local.append('ssh-keygen -t rsa -b 2048 -f "%s" -N ""' % migration_key)
local.execute()
with open(migration_key) as fp:
secret = fp.read().strip()
with open('%s.pub' % migration_key) as fp:
public = fp.read().strip()
config['NOVA_MIGRATION_KEY_TYPE'] = 'ssh-rsa'
config['NOVA_MIGRATION_KEY_PUBLIC'] = public.split()[1]
config['NOVA_MIGRATION_KEY_SECRET'] = secret
def gather_host_keys(config, messages):
global compute_hosts
for host in compute_hosts:
local = utils.ScriptRunner()
local.append('ssh-keyscan %s' % host)
retcode, hostkey = local.execute()
config['HOST_KEYS_%s' % host] = hostkey
def create_api_manifest(config, messages):
# Since this step is running first, let's create necesary variables here
# and make them global
global compute_hosts, network_hosts
com_var = config.get("CONFIG_COMPUTE_HOSTS", "")
compute_hosts = set([i.strip() for i in com_var.split(",") if i.strip()])
net_var = config.get("CONFIG_NETWORK_HOSTS", "")
network_hosts = set([i.strip() for i in net_var.split(",") if i.strip()])
# This is a hack around us needing to generate the neutron metadata
# password, but the nova puppet plugin uses the existence of that
# password to determine whether or not to configure neutron metadata
# proxy support. So the nova_api.pp template needs unquoted 'undef'
# to disable metadata support if neutron is not being installed.
if config['CONFIG_NEUTRON_INSTALL'] != 'y':
config['CONFIG_NEUTRON_METADATA_PW_UNQUOTED'] = 'undef'
else:
config['CONFIG_NEUTRON_METADATA_PW_UNQUOTED'] = \
"'%s'" % config['CONFIG_NEUTRON_METADATA_PW']
manifestfile = "%s_api_nova.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("nova_api.pp")
config['FIREWALL_SERVICE_NAME'] = "nova api"
config['FIREWALL_PORTS'] = "['8773', '8774', '8775']"
config['FIREWALL_CHAIN'] = "INPUT"
config['FIREWALL_PROTOCOL'] = 'tcp'
config['FIREWALL_ALLOWED'] = "'ALL'"
config['FIREWALL_SERVICE_ID'] = "nova_api"
manifestdata += getManifestTemplate("firewall.pp")
appendManifestFile(manifestfile, manifestdata, 'novaapi')
def create_keystone_manifest(config, messages):
manifestfile = "%s_keystone.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("keystone_nova.pp")
appendManifestFile(manifestfile, manifestdata)
def create_cert_manifest(config, messages):
manifestfile = "%s_nova.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("nova_cert.pp")
appendManifestFile(manifestfile, manifestdata)
def create_conductor_manifest(config, messages):
manifestfile = "%s_nova.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("nova_conductor.pp")
appendManifestFile(manifestfile, manifestdata)
def create_compute_manifest(config, messages):
global compute_hosts, network_hosts
migrate_protocol = config['CONFIG_NOVA_COMPUTE_MIGRATE_PROTOCOL']
if migrate_protocol == 'ssh':
config['CONFIG_NOVA_COMPUTE_MIGRATE_URL'] = (
'qemu+ssh://nova@%s/system?no_verify=1&'
'keyfile=/etc/nova/ssh/nova_migration_key'
)
else:
config['CONFIG_NOVA_COMPUTE_MIGRATE_URL'] = (
'qemu+tcp://nova@%s/system'
)
ssh_hostkeys = ''
for host in compute_hosts:
try:
hostname, aliases, addrs = socket.gethostbyaddr(host)
except socket.herror:
hostname, aliases, addrs = (host, [], [])
for hostkey in config['HOST_KEYS_%s' % host].split('\n'):
hostkey = hostkey.strip()
if not hostkey:
continue
_, host_key_type, host_key_data = hostkey.split()
config['SSH_HOST_NAME'] = hostname
config['SSH_HOST_ALIASES'] = ','.join(
'"%s"' % addr for addr in aliases + addrs
)
config['SSH_HOST_KEY'] = host_key_data
config['SSH_HOST_KEY_TYPE'] = host_key_type
ssh_hostkeys += getManifestTemplate("sshkey.pp")
for host in compute_hosts:
config["CONFIG_NOVA_COMPUTE_HOST"] = host
manifestdata = getManifestTemplate("nova_compute.pp")
if migrate_protocol == 'ssh' or migrate_protocol == 'tcp':
for c_host in compute_hosts:
config['FIREWALL_SERVICE_NAME'] = "nova qemu migration"
config['FIREWALL_PORTS'] = ['16509']
config['FIREWALL_PORTS'].append('49152-49215')
config['FIREWALL_CHAIN'] = "INPUT"
config['FIREWALL_PROTOCOL'] = 'tcp'
config['FIREWALL_ALLOWED'] = "'%s'" % c_host
config['FIREWALL_SERVICE_ID'] = ("nova_qemu_migration_%s_%s"
% (host, c_host))
manifestdata += getManifestTemplate("firewall.pp")
if config['CONFIG_VMWARE_BACKEND'] == 'y':
manifestdata += getManifestTemplate("nova_compute_vmware.pp")
else:
manifestdata += getManifestTemplate("nova_compute_libvirt.pp")
if (config['CONFIG_VMWARE_BACKEND'] != 'y' and
config['CONFIG_CINDER_INSTALL'] == 'y' and
config['CONFIG_CINDER_BACKEND'] == 'gluster'):
manifestdata += getManifestTemplate("nova_gluster.pp")
if (config['CONFIG_VMWARE_BACKEND'] != 'y' and
config['CONFIG_CINDER_INSTALL'] == 'y' and
config['CONFIG_CINDER_BACKEND'] == 'nfs'):
manifestdata += getManifestTemplate("nova_nfs.pp")
manifestfile = "%s_nova.pp" % host
nova_config_options = NovaConfig()
if config['CONFIG_NEUTRON_INSTALL'] != 'y':
if host not in network_hosts:
nova_config_options.addOption(
"DEFAULT/flat_interface",
config['CONFIG_NOVA_COMPUTE_PRIVIF']
)
check_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF'])
try:
bring_up_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF'])
except ScriptRuntimeError as ex:
# just warn user to do it by himself
messages.append(str(ex))
if config['CONFIG_CEILOMETER_INSTALL'] == 'y':
mq_template = get_mq(config, "nova_ceilometer")
manifestdata += getManifestTemplate(mq_template)
manifestdata += getManifestTemplate("nova_ceilometer.pp")
config['FIREWALL_PORTS'] = ['5900-5999']
if migrate_protocol == 'tcp':
config['FIREWALL_PORTS'].append('16509')
config['FIREWALL_ALLOWED'] = "'%s'" % config['CONFIG_CONTROLLER_HOST']
config['FIREWALL_SERVICE_NAME'] = "nova compute"
config['FIREWALL_SERVICE_ID'] = "nova_compute"
config['FIREWALL_CHAIN'] = "INPUT"
config['FIREWALL_PROTOCOL'] = 'tcp'
manifestdata += getManifestTemplate("firewall.pp")
manifestdata += "\n" + nova_config_options.getManifestEntry()
manifestdata += "\n" + ssh_hostkeys
appendManifestFile(manifestfile, manifestdata)
def create_network_manifest(config, messages):
global compute_hosts, network_hosts
if config['CONFIG_NEUTRON_INSTALL'] == "y":
return
# set default values for VlanManager in case this values are not in config
for key, value in [('CONFIG_NOVA_NETWORK_VLAN_START', 100),
('CONFIG_NOVA_NETWORK_SIZE', 255),
('CONFIG_NOVA_NETWORK_NUMBER', 1)]:
config[key] = config.get(key, value)
api_host = config['CONFIG_CONTROLLER_HOST']
multihost = len(network_hosts) > 1
config['CONFIG_NOVA_NETWORK_MULTIHOST'] = multihost and 'true' or 'false'
for host in network_hosts:
for i in ('CONFIG_NOVA_NETWORK_PRIVIF', 'CONFIG_NOVA_NETWORK_PUBIF'):
check_ifcfg(host, config[i])
try:
bring_up_ifcfg(host, config[i])
except ScriptRuntimeError as ex:
# just warn user to do it by himself
messages.append(str(ex))
key = 'CONFIG_NOVA_NETWORK_AUTOASSIGNFLOATINGIP'
config[key] = config[key] == "y"
# We need to explicitly set the network size
routing_prefix = config['CONFIG_NOVA_NETWORK_FIXEDRANGE'].split('/')[1]
net_size = 2 ** (32 - int(routing_prefix))
config['CONFIG_NOVA_NETWORK_FIXEDSIZE'] = str(net_size)
manifestfile = "%s_nova.pp" % host
manifestdata = getManifestTemplate("nova_network.pp")
# Restart libvirt if we deploy nova network on compute
if host in compute_hosts:
manifestdata += getManifestTemplate("nova_network_libvirt.pp")
# in multihost mode each compute host runs nova-api-metadata
if multihost and host != api_host and host in compute_hosts:
manifestdata += getManifestTemplate("nova_metadata.pp")
appendManifestFile(manifestfile, manifestdata)
def create_sched_manifest(config, messages):
manifestfile = "%s_nova.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("nova_sched.pp")
appendManifestFile(manifestfile, manifestdata)
def create_vncproxy_manifest(config, messages):
manifestfile = "%s_nova.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("nova_vncproxy.pp")
appendManifestFile(manifestfile, manifestdata)
def create_common_manifest(config, messages):
global compute_hosts, network_hosts
network_type = (config['CONFIG_NEUTRON_INSTALL'] == "y" and
'neutron' or 'nova')
network_multi = len(network_hosts) > 1
dbacces_hosts = set([config.get('CONFIG_CONTROLLER_HOST')])
dbacces_hosts |= network_hosts
for manifestfile, marker in manifestfiles.getFiles():
if manifestfile.endswith("_nova.pp"):
host, manifest = manifestfile.split('_', 1)
host = host.strip()
if host in compute_hosts and host not in dbacces_hosts:
# we should omit password in case we are installing only
# nova-compute to the host
perms = "nova"
else:
perms = "nova:%(CONFIG_NOVA_DB_PW)s"
sqlconn = "mysql://%s@%%(CONFIG_MARIADB_HOST)s/nova" % perms
config['CONFIG_NOVA_SQL_CONN'] = sqlconn % config
# for nova-network in multihost mode each compute host is metadata
# host otherwise we use api host
if (network_type == 'nova' and network_multi and
host in compute_hosts):
metadata = host
else:
metadata = config['CONFIG_CONTROLLER_HOST']
config['CONFIG_NOVA_METADATA_HOST'] = metadata
data = getManifestTemplate(get_mq(config, "nova_common"))
data += getManifestTemplate("nova_common.pp")
appendManifestFile(os.path.split(manifestfile)[1], data)
def create_neutron_manifest(config, messages):
if config['CONFIG_NEUTRON_INSTALL'] != "y":
return
virt_driver = 'nova.virt.libvirt.vif.LibvirtGenericVIFDriver'
config['CONFIG_NOVA_LIBVIRT_VIF_DRIVER'] = virt_driver
for manifestfile, marker in manifestfiles.getFiles():
if manifestfile.endswith("_nova.pp"):
data = getManifestTemplate("nova_neutron.pp")
appendManifestFile(os.path.split(manifestfile)[1], data)
def create_ceph_manifest(config, messages):
global compute_hosts
if (config['CONFIG_VMWARE_BACKEND'] != 'y' and
config['CONFIG_CINDER_INSTALL'] == 'y' and
config['CONFIG_CINDER_BACKEND'] == 'ceph'):
manifestdata = getManifestTemplate("nova_ceph.pp")
manifestfile = "%s_nova.pp" % config['CONFIG_CONTROLLER_HOST']
appendManifestFile(manifestfile, manifestdata)
for host in compute_hosts:
manifestdata = getManifestTemplate("nova_ceph_compute.pp")
manifestfile = "%s_nova_ceph.pp" % host
appendManifestFile(manifestfile, manifestdata)
| {
"content_hash": "1fc020145fa12fe0a2fc4e96840c0614",
"timestamp": "",
"source": "github",
"line_count": 674,
"max_line_length": 79,
"avg_line_length": 41.253709198813056,
"alnum_prop": 0.5701852184858839,
"repo_name": "yuw726/openstack-packstack",
"id": "04ad0c16a3af3da74f36625fa240877513886068",
"size": "27830",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "packstack/plugins/nova_300.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "187904"
},
{
"name": "Diff",
"bytes": "21134"
},
{
"name": "HTML",
"bytes": "164"
},
{
"name": "Pascal",
"bytes": "923"
},
{
"name": "Puppet",
"bytes": "102034"
},
{
"name": "Python",
"bytes": "393275"
},
{
"name": "Ruby",
"bytes": "16469"
},
{
"name": "Shell",
"bytes": "3016"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>coinductive-examples: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.5.3 / coinductive-examples - 8.9.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
coinductive-examples
<small>
8.9.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-10-31 04:59:10 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-10-31 04:59:10 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.5.3 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.03.0 The OCaml compiler (virtual package)
ocaml-base-compiler 4.03.0 Official 4.03.0 release
ocaml-config 1 OCaml Switch Configuration
# opam file:
opam-version: "2.0"
maintainer: "Hugo.Herbelin@inria.fr"
homepage: "https://github.com/coq-contribs/coinductive-examples"
license: "LGPL 2.1"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/CoinductiveExamples"]
depends: [
"ocaml"
"coq" {>= "8.9" & < "8.10~"}
]
tags: [
"keyword: co-inductive types"
"keyword: co-induction"
"category: Miscellaneous/Coq Use Examples"
]
authors: [
"Eduardo Giménez"
]
bug-reports: "https://github.com/coq-contribs/coinductive-examples/issues"
dev-repo: "git+https://github.com/coq-contribs/coinductive-examples.git"
synopsis: "Some simple examples about co-inductive types and co-induction"
description: """
This directory containts some simple examples about
the use of co-inductive types in Coq. Directory ARITH
is about non-standard arithmetic. Directory STREAMS
contains examples about schemes, including an application
of the translation method presented in Eduardo Giménez's
article ``Codifying guarded definitions with recursive
schemes'' (LNCS no. 996)."""
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/coinductive-examples/archive/v8.9.0.tar.gz"
checksum: "md5=269f69fc8ce0f350a68752eea0faff0c"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-coinductive-examples.8.9.0 coq.8.5.3</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.5.3).
The following dependencies couldn't be met:
- coq-coinductive-examples -> coq >= 8.9 -> ocaml >= 4.05.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-coinductive-examples.8.9.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "81133701c685dfe0f3189f833f4c5291",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 159,
"avg_line_length": 41.45762711864407,
"alnum_prop": 0.5581902425729082,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "dfb9382013911638af1ebaf19db5fa7950c1dab6",
"size": "7365",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.03.0-2.0.5/released/8.5.3/coinductive-examples/8.9.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
require("requirish")._(module);
var BinaryStream = require("lib/misc/binaryStream").BinaryStream;
var should = require("should");
var parseEndpointUrl = require("lib/nodeopcua").parseEndpointUrl;
var HelloMessage = require("_generated_/_auto_generated_HelloMessage").HelloMessage;
var packTcpMessage = require("lib/nodeopcua").packTcpMessage;
var decodeMessage = require("lib/nodeopcua").decodeMessage;
describe("testing message encoding and decoding", function () {
it("should encode and decode HelloMessage ", function () {
var helloMessage1 = new HelloMessage();
//xx console.log(Object.getPrototypeOf(helloMessage1),opcua.HelloMessage);
var message = packTcpMessage('HEL', helloMessage1);
var stream = new BinaryStream(message);
var helloMessage2 = decodeMessage(stream, HelloMessage);
//xx console.log(helloMessage2);
helloMessage1.should.eql(helloMessage2);
helloMessage1.protocolVersion.should.eql(helloMessage2.protocolVersion);
helloMessage1.receiveBufferSize.should.eql(helloMessage2.receiveBufferSize);
helloMessage1.sendBufferSize.should.eql(helloMessage2.sendBufferSize);
helloMessage1.maxMessageSize.should.eql(helloMessage2.maxMessageSize);
helloMessage1.endpointUrl.should.eql(helloMessage2.endpointUrl);
});
});
describe("testing parseEndpointUrl", function () {
it(" should parse a endpoint ", function () {
var ep = parseEndpointUrl("opc.tcp://abcd1234:51210/UA/SampleServer");
ep.protocol.should.equal("opc.tcp");
ep.hostname.should.equal("abcd1234");
ep.port.should.equal(51210);
ep.address.should.equal("/UA/SampleServer");
});
it(" should parse this endpoint as well", function () {
var ep = parseEndpointUrl("opc.tcp://ABCD12354:51210/UA/SampleServer");
ep.protocol.should.equal("opc.tcp");
ep.hostname.should.equal("ABCD12354");
ep.port.should.equal(51210);
ep.address.should.equal("/UA/SampleServer");
});
it(" should parse this endpoint as well", function () {
var ep = parseEndpointUrl("opc.tcp://portable-Precision-M4500:4841");
ep.protocol.should.equal("opc.tcp");
ep.hostname.should.equal("portable-Precision-M4500");
ep.port.should.equal(4841);
ep.address.should.equal("");
});
});
| {
"content_hash": "6950af208095c75014e56ddd1b1d4b71",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 84,
"avg_line_length": 33.166666666666664,
"alnum_prop": 0.6876046901172529,
"repo_name": "rodp82/node-opcua",
"id": "1dc0134619909b5e300ae74a3ff5e1b745d6720f",
"size": "2388",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "test/test_nodeopcua.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "704"
},
{
"name": "JavaScript",
"bytes": "3321691"
},
{
"name": "Makefile",
"bytes": "1507"
}
],
"symlink_target": ""
} |
package org.apache.druid.indexing.common.task;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import org.apache.druid.common.utils.IdUtils;
import org.apache.druid.indexer.TaskStatus;
import org.apache.druid.indexing.common.TaskLock;
import org.apache.druid.indexing.common.actions.LockListAction;
import org.apache.druid.indexing.common.actions.TaskActionClient;
import org.apache.druid.query.Query;
import org.apache.druid.query.QueryRunner;
import org.joda.time.Interval;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public abstract class AbstractTask implements Task
{
@JsonIgnore
private final String id;
@JsonIgnore
private final String groupId;
@JsonIgnore
private final TaskResource taskResource;
@JsonIgnore
private final String dataSource;
private final Map<String, Object> context;
protected AbstractTask(String id, String dataSource, Map<String, Object> context)
{
this(id, null, null, dataSource, context);
}
protected AbstractTask(
String id,
@Nullable String groupId,
@Nullable TaskResource taskResource,
String dataSource,
@Nullable Map<String, Object> context
)
{
this.id = Preconditions.checkNotNull(id, "id");
this.groupId = groupId == null ? id : groupId;
this.taskResource = taskResource == null ? new TaskResource(id, 1) : taskResource;
this.dataSource = Preconditions.checkNotNull(dataSource, "dataSource");
// Copy the given context into a new mutable map because the Druid indexing service can add some internal contexts.
this.context = context == null ? new HashMap<>() : new HashMap<>(context);
}
public static String getOrMakeId(@Nullable String id, final String typeName, String dataSource)
{
return getOrMakeId(id, typeName, dataSource, null);
}
static String getOrMakeId(@Nullable String id, final String typeName, String dataSource, @Nullable Interval interval)
{
if (id != null) {
return id;
}
return IdUtils.newTaskId(typeName, dataSource, interval);
}
@JsonProperty
@Override
public String getId()
{
return id;
}
@JsonProperty
@Override
public String getGroupId()
{
return groupId;
}
@JsonProperty("resource")
@Override
public TaskResource getTaskResource()
{
return taskResource;
}
@Override
public String getNodeType()
{
return null;
}
@JsonProperty
@Override
public String getDataSource()
{
return dataSource;
}
@Override
public <T> QueryRunner<T> getQueryRunner(Query<T> query)
{
return null;
}
@Override
public boolean supportsQueries()
{
return false;
}
@Override
public String getClasspathPrefix()
{
return null;
}
@Override
public boolean canRestore()
{
return false;
}
@Override
public String toString()
{
return "AbstractTask{" +
"id='" + id + '\'' +
", groupId='" + groupId + '\'' +
", taskResource=" + taskResource +
", dataSource='" + dataSource + '\'' +
", context=" + context +
'}';
}
public TaskStatus success()
{
return TaskStatus.success(getId());
}
@Override
public boolean equals(Object o)
{
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
AbstractTask that = (AbstractTask) o;
if (!id.equals(that.id)) {
return false;
}
if (!groupId.equals(that.groupId)) {
return false;
}
if (!dataSource.equals(that.dataSource)) {
return false;
}
return context.equals(that.context);
}
@Override
public int hashCode()
{
return Objects.hashCode(id, groupId, dataSource, context);
}
public static List<TaskLock> getTaskLocks(TaskActionClient client) throws IOException
{
return client.submit(new LockListAction());
}
@Override
@JsonProperty
public Map<String, Object> getContext()
{
return context;
}
/**
* Whether maximum memory usage should be considered in estimation for indexing tasks.
*/
protected boolean isUseMaxMemoryEstimates()
{
return getContextValue(
Tasks.USE_MAX_MEMORY_ESTIMATES,
Tasks.DEFAULT_USE_MAX_MEMORY_ESTIMATES
);
}
}
| {
"content_hash": "589c4bd6d9ae25b97c55fdb2d941c4b1",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 119,
"avg_line_length": 21.86341463414634,
"alnum_prop": 0.677376171352075,
"repo_name": "nishantmonu51/druid",
"id": "23adeb6ff81a79d0230fe627eb30dac31ef08a63",
"size": "5289",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "indexing-service/src/main/java/org/apache/druid/indexing/common/task/AbstractTask.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "5547"
},
{
"name": "CSS",
"bytes": "3878"
},
{
"name": "Dockerfile",
"bytes": "8937"
},
{
"name": "FreeMarker",
"bytes": "5193"
},
{
"name": "HTML",
"bytes": "2536"
},
{
"name": "Java",
"bytes": "37882426"
},
{
"name": "JavaScript",
"bytes": "61017"
},
{
"name": "Makefile",
"bytes": "659"
},
{
"name": "PostScript",
"bytes": "5"
},
{
"name": "Python",
"bytes": "72969"
},
{
"name": "R",
"bytes": "17002"
},
{
"name": "Roff",
"bytes": "3617"
},
{
"name": "SCSS",
"bytes": "117054"
},
{
"name": "Shell",
"bytes": "87161"
},
{
"name": "Smarty",
"bytes": "3517"
},
{
"name": "Stylus",
"bytes": "7682"
},
{
"name": "TeX",
"bytes": "399468"
},
{
"name": "Thrift",
"bytes": "1003"
},
{
"name": "TypeScript",
"bytes": "1308608"
}
],
"symlink_target": ""
} |
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/identity/accesscontextmanager/v1/service_perimeter.proto
namespace Google\Identity\AccessContextManager\V1;
if (false) {
/**
* This class is deprecated. Use Google\Identity\AccessContextManager\V1\ServicePerimeterConfig\EgressFrom instead.
* @deprecated
*/
class ServicePerimeterConfig_EgressFrom {}
}
class_exists(ServicePerimeterConfig\EgressFrom::class);
@trigger_error('Google\Identity\AccessContextManager\V1\ServicePerimeterConfig_EgressFrom is deprecated and will be removed in a future release. Use Google\Identity\AccessContextManager\V1\ServicePerimeterConfig\EgressFrom instead', E_USER_DEPRECATED);
| {
"content_hash": "924aa4cc5bfdbe4d091f868ed3d77d54",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 252,
"avg_line_length": 44.9375,
"alnum_prop": 0.7983310152990264,
"repo_name": "googleapis/google-cloud-php",
"id": "04185f474aeec5ed57b5bbfbdb70d3adb159a5dd",
"size": "719",
"binary": false,
"copies": "3",
"ref": "refs/heads/main",
"path": "AccessContextManager/src/V1/ServicePerimeterConfig_EgressFrom.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "3333"
},
{
"name": "PHP",
"bytes": "47981731"
},
{
"name": "Python",
"bytes": "413107"
},
{
"name": "Shell",
"bytes": "8171"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title></title>
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!-- <script src="http://cdn.cssobfuscator.com/style/iq2xjn7duj9ujpgbahl2j449q08gjsj8"></script> -->
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
<!-- your app's js -->
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
</head>
<!-- All views are loaded into the <ion-nav-view> element below -->
<body ng-app="starter">
<ion-nav-view></ion-nav-view>
</body>
</html>
| {
"content_hash": "3d81178b722f352be1b7837846b68f4f",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 107,
"avg_line_length": 32.3125,
"alnum_prop": 0.6344294003868471,
"repo_name": "magnusmel/ramisdance",
"id": "4ca19a23095548c0419870746b2dd34acb7c50e7",
"size": "1034",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "index.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "11293"
},
{
"name": "C",
"bytes": "1276"
},
{
"name": "C#",
"bytes": "235810"
},
{
"name": "C++",
"bytes": "479235"
},
{
"name": "CSS",
"bytes": "1671530"
},
{
"name": "HTML",
"bytes": "296191"
},
{
"name": "Java",
"bytes": "1154979"
},
{
"name": "JavaScript",
"bytes": "10302447"
},
{
"name": "Objective-C",
"bytes": "849470"
},
{
"name": "QML",
"bytes": "13351"
},
{
"name": "Shell",
"bytes": "1232"
}
],
"symlink_target": ""
} |
package version
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestVersionSetter(t *testing.T) {
assert := assert.New(t)
SetVersion("first")
assert.Equal("first", Version)
SetVersion("second")
assert.Equal("first", Version)
}
func TestCommitSetter(t *testing.T) {
assert := assert.New(t)
SetCommit("first")
assert.Equal("first", Commit)
SetCommit("second")
assert.Equal("first", Commit)
}
func TestBranchSetter(t *testing.T) {
assert := assert.New(t)
SetBranch("first")
assert.Equal("first", Branch)
SetBranch("second")
assert.Equal("first", Branch)
}
| {
"content_hash": "1753b61a01b3122761a8420a481e0f18",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 38,
"avg_line_length": 16.10810810810811,
"alnum_prop": 0.697986577181208,
"repo_name": "dgarlitt/urban-gopher",
"id": "c6443030c6ba4a8e0270c3c4bc730fb0d762a9c5",
"size": "596",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "version/version_test.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "15077"
},
{
"name": "Shell",
"bytes": "2602"
}
],
"symlink_target": ""
} |
var fw = require('knockout/build/output/knockout-latest');
var _ = require('footwork-lodash');
var ajax = require('../misc/ajax');
var util = require('../misc/util');
var privateDataSymbol = util.getSymbol('footwork');
var isNode = util.isNode;
var isEvent = util.isEvent;
/**
* Performs an equality comparison between two objects while ensuring atleast one or more keys/values match and that all keys/values from object A also exist in B
* Note: object 'a' can provide a regex value for a property and have it searched matching on the regex value
* @param {object} a Object to compare (which can contain regex values for properties)
* @param {object} b Object to compare
* @param {function} isEqual evauluator to use (optional)
* @return boolean Result of equality comparison
*/
function regExpIsEqual (a, b, isEq) {
isEq = isEq || regExpIsEqual;
if (_.isObject(a) && _.isObject(b)) {
return _.every(_.reduce(a, function (comparison, paramValue, paramName) {
var isCongruent = false;
var bParamValue = b[paramName];
if (bParamValue) {
if (_.isRegExp(paramValue)) {
isCongruent = !_.isNull(bParamValue.match(paramValue));
} else {
isCongruent = isEq(paramValue, bParamValue);
}
}
comparison.push(isCongruent);
return comparison;
}, []));
} else {
return a === b;
}
}
function collectionSync () {
return fw.sync.apply(this, arguments);
}
/**
* Convert the collection to its plain object form for toJSON support.
*
* @returns {array} The collection of data
*/
function toJSON () {
return this();
}
/**
* Get list of items that match modelData
*
* @param {object} modelData object to compare against
* @param {function} comparator callback function used to compare the values
* @returns {any} the found results (if any)
*/
function where (modelData, comparator) {
return _.reduce(this(), function findModel (foundModels, model) {
if (regExpIsEqual(modelData, model, comparator)) {
foundModels.push(model);
}
return foundModels;
}, []);
}
function fetchCollection (options) {
var collection = this;
var configParams = collection[privateDataSymbol].configParams;
options = _.extend({ parse: true }, isNode(options) || fw.isCollection(options) || isEvent(options) ? {} : options);
var requestInfo = {
requestRunning: collection.isReading,
requestLull: configParams.requestLull,
entity: collection,
createRequest: function () {
var xhr = collection.sync('read', collection, options);
ajax.handleJsonResponse(xhr)
.then(function handleResponseData (data) {
var parsedData = configParams.parse(data);
_.isArray(parsedData) && collection(parsedData);
});
return xhr;
}
};
return ajax.makeOrGetRequest('fetch', requestInfo);
}
module.exports = {
sync: collectionSync,
toJSON: toJSON,
fetch: fetchCollection,
where: where
};
| {
"content_hash": "10a9f5368a9cca29378e54965f9fe36a",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 162,
"avg_line_length": 29.396039603960396,
"alnum_prop": 0.6722802290333446,
"repo_name": "jonbnewman/footwork",
"id": "15969b8fab67939d3a1487c0e225a4eaa6586454",
"size": "2969",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "source/collection/collection-methods.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "10653"
},
{
"name": "HTML",
"bytes": "18136"
},
{
"name": "JavaScript",
"bytes": "1911211"
}
],
"symlink_target": ""
} |
/**
* @class
*/
CKEDITOR.dom.nodeList = function( nativeList )
{
this.$ = nativeList;
};
CKEDITOR.dom.nodeList.prototype =
{
count : function()
{
return this.$.length;
},
getItem : function( index )
{
var $node = this.$[ index ];
return $node ? new CKEDITOR.dom.node( $node ) : null;
}
};
| {
"content_hash": "35cebb066c518a1397f765cb9330a3b7",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 55,
"avg_line_length": 13.434782608695652,
"alnum_prop": 0.598705501618123,
"repo_name": "lushantingyue/Yii_1.1.x-demo-NewsCMS",
"id": "5262ba3a0a9b37e09bfd59b6aaf52280e58a2499",
"size": "455",
"binary": false,
"copies": "28",
"ref": "refs/heads/master",
"path": "protected/extensions/editor/source/ckeditor/_source/core/dom/nodelist.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "46242"
},
{
"name": "Batchfile",
"bytes": "641"
},
{
"name": "CSS",
"bytes": "220109"
},
{
"name": "HTML",
"bytes": "104960"
},
{
"name": "JavaScript",
"bytes": "3003465"
},
{
"name": "PHP",
"bytes": "417642"
},
{
"name": "Shell",
"bytes": "248"
}
],
"symlink_target": ""
} |
//---------------------------------*-C++-*-----------------------------------//
//---------------------------------------------------------------------------//
#ifndef MC_geometry_Bounding_Box_hh
#define MC_geometry_Bounding_Box_hh
#include <iosfwd>
#include "Utils/utils/Definitions.hh"
#include "Utils/utils/Vector_Lite.hh"
namespace profugus
{
//===========================================================================//
/*!
* \class Bounding_Box
* \brief Axis-aligned bounding box
*/
/*!
* \example core/test/tstBounding_Box.cc
*
* Test of Bounding_Box.
*/
//===========================================================================//
class Bounding_Box
{
private:
// >>> DATA
typedef def::Space_Vector Space_Vector;
Space_Vector d_lower;
Space_Vector d_upper;
public:
// Construct a bbox from space vectors
Bounding_Box(Space_Vector lo, Space_Vector hi);
// Construct a bbox.
Bounding_Box(double lox, double hix, double loy,
double hiy, double loz, double hiz);
// >>> ACCESSORS
//! Lower bbox coordinate
Space_Vector lower() const { return d_lower; }
//! Upper bbox coordinate
Space_Vector upper() const { return d_upper; }
// Test whether a point is inside or on a bounding box.
inline bool is_point_inside(const Space_Vector& p) const;
// Test the intersection with another bounding box.
inline bool intersects(const Bounding_Box& other) const;
// Return whether we enclose bounding box B
inline bool encloses(const Bounding_Box& other) const;
// Calculate the center of the bounding box
Space_Vector calc_center() const;
// Return the union of this bounding box and another
Bounding_Box calc_union(const Bounding_Box& other) const;
};
//---------------------------------------------------------------------------//
// FUNCTIONS
//---------------------------------------------------------------------------//
// Print to a stream
std::ostream& operator<<(std::ostream&, const Bounding_Box&);
//---------------------------------------------------------------------------//
} // end namespace profugus
//---------------------------------------------------------------------------//
// INLINE DEFINITIONS
//---------------------------------------------------------------------------//
#include "Bounding_Box.i.hh"
//---------------------------------------------------------------------------//
#endif // MC_geometry_Bounding_Box_hh
//---------------------------------------------------------------------------//
// end of geometry/Bounding_Box.hh
//---------------------------------------------------------------------------//
| {
"content_hash": "d8cf9dd57831bfb8cef3cefe706c6d8d",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 79,
"avg_line_length": 30.123595505617978,
"alnum_prop": 0.4378963073480045,
"repo_name": "ORNL-CEES/Profugus",
"id": "089979d9e35f0d3ec76f7b5ba90e41d74ece4b38",
"size": "2911",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packages/MC/geometry/Bounding_Box.hh",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "72175"
},
{
"name": "C++",
"bytes": "4949401"
},
{
"name": "CMake",
"bytes": "95533"
},
{
"name": "Cuda",
"bytes": "48916"
},
{
"name": "Fortran",
"bytes": "1667"
},
{
"name": "Python",
"bytes": "11371"
},
{
"name": "Shell",
"bytes": "29128"
}
],
"symlink_target": ""
} |
"""Public forms."""
from urllib.parse import urljoin, urlparse
from flask import redirect, request, url_for
from flask_wtf import FlaskForm
from wtforms import HiddenField, PasswordField, StringField
from wtforms.validators import DataRequired
from personal_website.user.models import User
def is_safe_url(target):
"""Test for safe url."""
ref_url = urlparse(request.host_url)
test_url = urlparse(urljoin(request.host_url, target))
return test_url.scheme in ('http', 'https') and ref_url.netloc == test_url.netloc
def get_redirect_target():
"""Redirect function."""
for target in request.args.get('next'), request.referrer:
if not target:
continue
if is_safe_url(target):
return target
class RedirectForm(FlaskForm):
"""Form with safe redirect method."""
next = HiddenField()
def __init__(self, *args, **kwargs):
"""Initialize RedirectForm."""
FlaskForm.__init__(self, *args, **kwargs)
if not self.next.data:
self.next.data = get_redirect_target() or ''
def redirect(self, endpoint='user.members', **values):
"""Safe redirect method."""
if is_safe_url(self.next.data):
return redirect(self.next.data)
target = get_redirect_target()
return redirect(target or url_for(endpoint, **values))
class LoginForm(RedirectForm):
"""Login form."""
username = StringField('Username', validators=[DataRequired()])
password = PasswordField('Password', validators=[DataRequired()])
def __init__(self, *args, **kwargs):
"""Create instance."""
super().__init__(*args, **kwargs)
self.user = None
def validate(self):
"""Validate the form."""
initial_validation = super().validate()
if not initial_validation:
return False
self.user = User.query.filter_by(username=self.username.data).first()
if not self.user:
self.username.errors.append('Unknown username')
return False
if not self.user.check_password(self.password.data):
self.password.errors.append('Invalid password')
return False
if not self.user.active:
self.username.errors.append('User not activated')
return False
return True
| {
"content_hash": "5b2397d3719700cb8b77bc6314b6334c",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 85,
"avg_line_length": 30.350649350649352,
"alnum_prop": 0.6281557552417629,
"repo_name": "arewellborn/Personal-Website",
"id": "55ed90217c93f48bd30723d03934ad019b9a925a",
"size": "2361",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "personal_website/public/forms.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "4414"
},
{
"name": "HTML",
"bytes": "12401"
},
{
"name": "JavaScript",
"bytes": "181413"
},
{
"name": "Python",
"bytes": "37533"
}
],
"symlink_target": ""
} |
<dashboard>
<div class="dasboard-toolbar" ui-view="toolbar"></div>
<div ui-view="widgets"></div>
</dashboard>
| {
"content_hash": "226277cad85324a7e0145f91650f4822",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 58,
"avg_line_length": 29.5,
"alnum_prop": 0.6440677966101694,
"repo_name": "apicatus/frontend",
"id": "7252a8a456744753fbe9ff01ae3988fb911b07ec",
"size": "118",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app/dashboard/dashboard.tpl.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "101081"
},
{
"name": "JavaScript",
"bytes": "449109"
}
],
"symlink_target": ""
} |
package com.xruby.runtime.builtin;
import com.xruby.runtime.lang.RubyAPI;
import com.xruby.runtime.lang.RubyBlock;
import com.xruby.runtime.lang.RubyConstant;
import com.xruby.runtime.lang.RubyException;
import com.xruby.runtime.lang.RubyID;
import com.xruby.runtime.lang.RubyRuntime;
import com.xruby.runtime.lang.RubyValue;
import com.xruby.runtime.lang.annotation.RubyLevelClass;
import com.xruby.runtime.lang.annotation.RubyLevelMethod;
@RubyLevelClass(name="Numeric")
public abstract class RubyNumeric extends RubyValue {
@RubyLevelMethod(name="+@")
public RubyNumeric uplus() {
return this;
}
@RubyLevelMethod(name="-@")
public RubyValue uminus() {
RubyArray array = ObjectFactory.FIXNUM0.doDoerce(this, true);
return RubyAPI.callOneArgMethod(array.get(0), array.get(1), null, RubyID.subID);
}
@RubyLevelMethod(name="step")
public final RubyValue step(RubyValue v, RubyBlock block) {
return doStep(v, ObjectFactory.FIXNUM1, block);
}
@RubyLevelMethod(name="step")
public final RubyValue step(RubyValue toArg, RubyValue stepArg, RubyBlock block) {
if (ObjectFactory.FIXNUM0.equals(stepArg)) {
throw new RubyException(RubyRuntime.ArgumentErrorClass, "step can't be 0");
}
return doStep(toArg, stepArg, block);
}
protected RubyValue doStep(RubyValue toArg, RubyValue stepArg, RubyBlock block) {
throw new RubyException("not implemented!");
}
@RubyLevelMethod(name="coerce")
public RubyArray coerce(RubyValue v) {
if (this.getRubyClass() == v.getRubyClass()) {
return new RubyArray(v, this);
}
return new RubyArray(v.toRubyFloat(), this.toRubyFloat());
}
protected final RubyValue coerceBin(RubyID id, RubyValue v) {
RubyArray array = doDoerce(v, true);
return RubyAPI.callOneArgMethod(array.get(0), array.get(1), null, id);
}
protected final RubyValue coerceRelop(RubyID id, RubyValue v) {
RubyArray array = this.doDoerce(v, false);
if (array != null) {
RubyValue result = RubyAPI.callOneArgMethod(array.get(0), array.get(1), null, id);
if (result != RubyConstant.QNIL) {
return result;
}
}
throw new RubyException(RubyRuntime.ArgumentErrorClass,
"comparison of " + this.getRubyClass().getName() + " with " + v.getRubyClass().getName() + " failed");
}
protected final RubyValue coerceCmp(RubyID id, RubyValue v) {
RubyArray array = doDoerce(v, false);
if (array != null) {
return RubyAPI.callOneArgMethod(array.get(0), array.get(1), null, id);
}
return RubyConstant.QNIL;
}
protected final RubyArray doDoerce(RubyValue v, boolean err) {
RubyValue result;
try {
result = coerceBody(v);
} catch (RubyException e) {
if (err) {
throw new RubyException(RubyRuntime.TypeErrorClass,
v.getRubyClass().getName() + " can't be coerced into " + this.getRubyClass().getName() + ":" + e);
}
return null;
}
if (!(result instanceof RubyArray) || ((RubyArray) result).size() != 2) {
throw new RubyException(RubyRuntime.TypeErrorClass, "coerce must return [x, y]");
}
return (RubyArray) result;
}
private RubyValue coerceBody(RubyValue v) {
return RubyAPI.callOneArgMethod(v, this, null, RubyID.coerceID);
}
protected void zeroDiv() {
throw new RubyException(RubyRuntime.ZeroDivErrorClass, "divided by 0");
}
}
| {
"content_hash": "f477eef59b94517c572d0ed2abb82175",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 110,
"avg_line_length": 31.212962962962962,
"alnum_prop": 0.698605754968852,
"repo_name": "louisatome/rhodes",
"id": "b8a5ca47417787f641c7ac34cf9df0c4f5546b3c",
"size": "3456",
"binary": false,
"copies": "10",
"ref": "refs/heads/master",
"path": "platform/shared/xruby/src/com/xruby/runtime/builtin/RubyNumeric.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "6153"
},
{
"name": "Batchfile",
"bytes": "24082"
},
{
"name": "C",
"bytes": "45309487"
},
{
"name": "C#",
"bytes": "5010573"
},
{
"name": "C++",
"bytes": "11891137"
},
{
"name": "CSS",
"bytes": "694515"
},
{
"name": "GAP",
"bytes": "76344"
},
{
"name": "Groff",
"bytes": "328967"
},
{
"name": "HTML",
"bytes": "1653457"
},
{
"name": "Java",
"bytes": "3424617"
},
{
"name": "JavaScript",
"bytes": "1369711"
},
{
"name": "Makefile",
"bytes": "316913"
},
{
"name": "NSIS",
"bytes": "85322"
},
{
"name": "Objective-C",
"bytes": "2247814"
},
{
"name": "Objective-C++",
"bytes": "342178"
},
{
"name": "PAWN",
"bytes": "3579"
},
{
"name": "Perl",
"bytes": "1657"
},
{
"name": "QMake",
"bytes": "51754"
},
{
"name": "Ruby",
"bytes": "14876580"
},
{
"name": "Shell",
"bytes": "7885"
},
{
"name": "Yacc",
"bytes": "232442"
}
],
"symlink_target": ""
} |
//=============================================================================================================
#ifndef FILE_UTILS_H
#define FILE_UTILS_H
//=============================================================================================================
// INCLUDES
//=============================================================================================================
#include "utils_global.h"
#include <string>
//=============================================================================================================
// QT INCLUDES
//=============================================================================================================
#ifdef QT_CORE_LIB
#include <QString>
#endif
//=============================================================================================================
// DEFINE NAMESPACE UTILSLIB
//=============================================================================================================
namespace UTILSLIB
{
//=============================================================================================================
/**
* Class contianing static functions for common file operations.
*/
class UTILSSHARED_EXPORT File
{
public:
File() = delete;
//=========================================================================================================
/**
* Returns whether file at given input parameter exists
*
* @param[in] filePath file to be checked
*
* @return Returns whther file exists.
*/
static bool exists(const char* filePath);
//=========================================================================================================
/**
* Returns whether file at given input parameter exists
*
* @param[in] filePath file to be checked
*
* @return Returns whther file exists.
*/
static bool exists(const std::string& filePath);
//=========================================================================================================
/**
* Copies file based on input parameters.
* Does nothing if source file does not exists or if destination file already exists.
*
* @param[in] sourcePath
* @param[in] destPath
*
* @return Returns true if copy was performed successfully, false otherwise.
*/
static bool copy(const char* sourcePath, const char* destPath);
//=========================================================================================================
/**
* Copies file based on input parameters.
* Does nothing if source file does not exists or if destination file already exists.
*
* @param[in] sourcePath
* @param[in] destPath
*
* @return Returns true if copy was performed successfully, false otherwise.
*/
static bool copy(const std::string& sourcePath, const std::string& destPath);
//=========================================================================================================
/**
* Attempts to rename file based on input parameters.
* Does nothing if source file does not exists or if destination file already exists.
*
* @param[in] sourcePath
* @param[in] destPath
*
* @return Whether file was renamed successfully, false otherwise.
*/
static bool rename(const char* sourcePath, const char* destPath);
//=========================================================================================================
/**
* Attempts to rename file based on input parameters.
* Does nothing if source file does not exists or if destination file already exists.
*
* @param[in] sourcePath
* @param[in] destPath
*
* @return Whether file was renamed successfully, false otherwise.
*/
static bool rename(const std::string& sourcePath, const std::string& destPath);
//=========================================================================================================
/**
* Attempts to remove file at given input param.
* Does nothing if file already does not exists.
*
* @param[in] filePath File path to file to be deleted.
*
* @return Returns whether file was removed, false otherwise.
*/
static bool remove(const char* filePath);
//=========================================================================================================
/**
* Attempts to remove file at given input param.
* Does nothing if file already does not exists.
*
* @param[in] filePath File path to file to be deleted.
*
* @return Returns whether file was removed, false otherwise.
*/
static bool remove(const std::string& filePath);
//=========================================================================================================
/**
* Attempts to create a file at filePath.
* Does nothing if file already exists.
*
* @param[in] filePath File path of new file to be created.
*
* @return Returns whether file was created, false otherwise.
*/
static bool create(const char* filePath);
//=========================================================================================================
/**
* Attempts to create a file at filePath.
* Does nothing if file already exists.
*
* @param[in] filePath File path of new file to be created.
*
* @return Returns whether file was created, false otherwise.
*/
static bool create(const std::string& filePath);
#ifdef QT_CORE_LIB // QString oveloads
//=========================================================================================================
/**
* Returns whether file at given input parameter exists
*
* @param[in] filePath file to be checked
*
* @return Returns whther file exists.
*/
static bool exists(const QString& filePath);
//=========================================================================================================
/**
* Copies file based on input parameters.
* Does nothing if source file does not exists or if destination file already exists.
*
* @param[in] sourcePath
* @param[in] destPath
*
* @return Returns true if copy was performed successfully, false otherwise.
*/
static bool copy(const QString& sourcePath, const QString& destPath);
//=========================================================================================================
/**
* Attempts to rename file based on input parameters.
* Does nothing if source file does not exists or if destination file already exists.
*
* @param[in] sourcePath
* @param[in] destPath
*
* @return Whether file was renamed successfully, false otherwise.
*/
static bool rename(const QString& sourcePath, const QString& destPath);
//=========================================================================================================
/**
* Attempts to remove file at given input param.
* Does nothing if file already does not exists.
*
* @param[in] filePath File path to file to be deleted.
*
* @return Returns whether file was removed, false otherwise.
*/
static bool remove(const QString& filePath);
//=========================================================================================================
/**
* Attempts to create a file at filePath.
* Does nothing if file already exists.
*
* @param[in] filePath File path of new file to be created.
*
* @return Returns whether file was created, false otherwise.
*/
static bool create(const QString& filePath);
#endif
};
}//namepace
#endif // FILE_UTILS_H
| {
"content_hash": "8090f63cb9096189d9d400bc7fb6df3e",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 111,
"avg_line_length": 37.34761904761905,
"alnum_prop": 0.43146755068213694,
"repo_name": "chdinh/mne-cpp",
"id": "d4f01dc9d070e40b8eaa81fd7a193982cf4bec65",
"size": "9610",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "libraries/utils/file.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "16999"
},
{
"name": "C",
"bytes": "83705"
},
{
"name": "C++",
"bytes": "10808604"
},
{
"name": "GLSL",
"bytes": "31865"
},
{
"name": "HTML",
"bytes": "165"
},
{
"name": "JavaScript",
"bytes": "3885"
},
{
"name": "Python",
"bytes": "4073"
},
{
"name": "QMake",
"bytes": "430905"
},
{
"name": "Qt Script",
"bytes": "8560"
},
{
"name": "Shell",
"bytes": "5452"
}
],
"symlink_target": ""
} |
step "Install MRI Puppet Agents."
hosts.each do |host|
puppet_version = test_config[:puppet_version]
if puppet_version
install_package host, 'puppet'
else
puppet_version = test_config[:puppet_version]
variant, _, _, _ = host['platform'].to_array
case variant
when /^(debian|ubuntu)$/
puppet_version += "-1puppetlabs1"
install_package host, "puppet=#{puppet_version} puppet-common=#{puppet_version}"
when /^(redhat|el|centos)$/
install_package host, 'puppet', puppet_version
end
end
end
step "Run puppet as puppet user to prevent permissions errors later."
puppet_apply_as_puppet_user
if (test_config[:puppetserver_install_mode] == :upgrade)
step "Upgrade Puppet Server."
upgrade_package(master, "puppetserver")
else
step "Install Puppet Server."
make_env = {
"prefix" => "/usr",
"confdir" => "/etc/",
"rundir" => "/var/run/puppetserver",
"initdir" => "/etc/init.d",
}
install_puppet_server master, make_env
end
| {
"content_hash": "5ca3c824b1d5f59e9e148b60e34599cf",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 88,
"avg_line_length": 26.923076923076923,
"alnum_prop": 0.6314285714285715,
"repo_name": "jpinsonault/puppetserver",
"id": "97d6e384d9e49cd8ae02924d3c03b98bd4008324",
"size": "1050",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "acceptance/suites/pre_suite/foss/70_install_puppet.rb",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Clojure",
"bytes": "316624"
},
{
"name": "Java",
"bytes": "7009"
},
{
"name": "Ruby",
"bytes": "52013"
},
{
"name": "Shell",
"bytes": "629"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using IdentityManager.Extensions;
using IdentityManager;
namespace OpenIDConnect.IdentityManager
{
public class InMemoryIdentityManagerService : IIdentityManagerService
{
ICollection<InMemoryUser> users;
ICollection<InMemoryRole> roles;
public InMemoryIdentityManagerService(ICollection<InMemoryUser> users, ICollection<InMemoryRole> roles)
{
this.users = users;
this.roles = roles;
}
IdentityManagerMetadata metadata;
IdentityManagerMetadata GetMetadata()
{
if (metadata == null)
{
var createprops = new List<PropertyMetadata>()
{
PropertyMetadata.FromProperty<InMemoryUser>(x => x.Username, type:Constants.ClaimTypes.Username, required:true),
};
var updateprops = new List<PropertyMetadata>();
updateprops.AddRange(new PropertyMetadata[]{
PropertyMetadata.FromProperty<InMemoryUser>(x => x.Username, type:Constants.ClaimTypes.Username, required:true),
PropertyMetadata.FromPropertyName<InMemoryUser>("Password", type:Constants.ClaimTypes.Password, required:true),
PropertyMetadata.FromFunctions<InMemoryUser, string>(Constants.ClaimTypes.Name, this.GetName, this.SetName, name:"Name", required:true),
});
updateprops.AddRange(PropertyMetadata.FromType<InMemoryUser>());
updateprops.AddRange(new PropertyMetadata[]{
PropertyMetadata.FromPropertyName<InMemoryUser>("Mobile"),
PropertyMetadata.FromPropertyName<InMemoryUser>("Email", dataType:PropertyDataType.Email),
new PropertyMetadata {
Name = "Is Administrator",
Type = "role.admin",
DataType = PropertyDataType.Boolean,
Required = true,
},
new PropertyMetadata {
Name = "Gravatar Url",
Type = "gravatar",
DataType = PropertyDataType.Url,
}
});
var roleCreateProps = new List<PropertyMetadata>();
roleCreateProps.Add(PropertyMetadata.FromProperty<InMemoryRole>(x => x.Name));
var roleUpdateProps = new List<PropertyMetadata>();
roleUpdateProps.Add(PropertyMetadata.FromProperty<InMemoryRole>(x => x.Description, type: "description"));
metadata = new IdentityManagerMetadata()
{
UserMetadata = new UserMetadata
{
SupportsCreate = true,
SupportsDelete = true,
SupportsClaims = true,
CreateProperties = createprops,
UpdateProperties = updateprops
},
RoleMetadata = new RoleMetadata
{
RoleClaimType = Constants.ClaimTypes.Role,
SupportsCreate = true,
SupportsDelete = true,
CreateProperties = roleCreateProps,
UpdateProperties = roleUpdateProps
}
};
}
return metadata;
}
#region Users
private string GetName(InMemoryUser user)
{
return user.Claims.GetValue(Constants.ClaimTypes.Name);
}
private IdentityManagerResult SetName(InMemoryUser user, string value)
{
user.Claims.SetValue(Constants.ClaimTypes.Name, value);
return IdentityManagerResult.Success;
}
public System.Threading.Tasks.Task<IdentityManagerMetadata> GetMetadataAsync()
{
return Task.FromResult(GetMetadata());
}
public System.Threading.Tasks.Task<IdentityManagerResult<CreateResult>> CreateUserAsync(IEnumerable<PropertyValue> properties)
{
var errors = ValidateUserProperties(properties);
if (errors.Any())
{
return Task.FromResult(new IdentityManagerResult<CreateResult>(errors.ToArray()));
}
var user = new InMemoryUser();
var createPropsMeta = GetMetadata().UserMetadata.GetCreateProperties();
foreach (var prop in properties)
{
var result = SetUserProperty(createPropsMeta, user, prop.Type, prop.Value);
if (!result.IsSuccess)
{
return Task.FromResult(new IdentityManagerResult<CreateResult>(result.Errors.ToArray()));
}
}
users.Add(user);
return Task.FromResult(new IdentityManagerResult<CreateResult>(new CreateResult() { Subject = user.Subject }));
}
public System.Threading.Tasks.Task<IdentityManagerResult> DeleteUserAsync(string subject)
{
var user = users.SingleOrDefault(x => x.Subject == subject);
if (user != null)
{
users.Remove(user);
}
return Task.FromResult(IdentityManagerResult.Success);
}
public System.Threading.Tasks.Task<IdentityManagerResult<QueryResult<UserSummary>>> QueryUsersAsync(string filter, int start, int count)
{
var query =
from u in users
select u;
if (!String.IsNullOrWhiteSpace(filter))
{
filter = filter.ToLower();
query =
from u in query
let names = (from c in u.Claims where c.Type == Constants.ClaimTypes.Name select c.Value.ToLower())
where
u.Username.ToLower().Contains(filter) ||
names.Contains(filter)
select u;
}
var items =
from u in query.Distinct()
select new UserSummary
{
Subject = u.Subject,
Username = u.Username,
Name = u.Claims.Where(x => x.Type == Constants.ClaimTypes.Name).Select(x => x.Value).FirstOrDefault(),
};
var total = items.Count();
var result = items.Skip(start).Take(count);
return Task.FromResult(new IdentityManagerResult<QueryResult<UserSummary>>(new QueryResult<UserSummary>
{
Filter = filter,
Start = start,
Count = result.Count(),
Items = result,
Total = total,
}));
}
public System.Threading.Tasks.Task<IdentityManagerResult<UserDetail>> GetUserAsync(string subject)
{
var user = users.SingleOrDefault(x => x.Subject == subject);
if (user == null)
{
return Task.FromResult(new IdentityManagerResult<UserDetail>((UserDetail)null));
}
var props = new List<PropertyValue>();
foreach (var prop in GetMetadata().UserMetadata.UpdateProperties)
{
props.Add(new PropertyValue
{
Type = prop.Type,
Value = GetUserProperty(prop, user)
});
}
var claims = user.Claims.Select(x => new ClaimValue { Type = x.Type, Value = x.Value });
return Task.FromResult(new IdentityManagerResult<UserDetail>(new UserDetail
{
Subject = user.Subject,
Username = user.Username,
Name = user.Claims.GetValue(Constants.ClaimTypes.Name),
Properties = props,
Claims = claims
}));
}
public System.Threading.Tasks.Task<IdentityManagerResult> SetUserPropertyAsync(string subject, string type, string value)
{
var user = users.SingleOrDefault(x => x.Subject == subject);
if (user == null)
{
return Task.FromResult(new IdentityManagerResult("No user found"));
}
var errors = ValidateUserProperty(type, value);
if (errors.Any())
{
return Task.FromResult(new IdentityManagerResult(errors.ToArray()));
}
var result = SetUserProperty(GetMetadata().UserMetadata.UpdateProperties, user, type, value);
return Task.FromResult(result);
}
public System.Threading.Tasks.Task<IdentityManagerResult> AddUserClaimAsync(string subject, string type, string value)
{
var user = users.SingleOrDefault(x => x.Subject == subject);
if (user == null)
{
return Task.FromResult(new IdentityManagerResult("No user found"));
}
user.Claims.AddClaim(type, value);
return Task.FromResult(IdentityManagerResult.Success);
}
public System.Threading.Tasks.Task<IdentityManagerResult> RemoveUserClaimAsync(string subject, string type, string value)
{
var user = users.SingleOrDefault(x => x.Subject == subject);
if (user == null)
{
return Task.FromResult(new IdentityManagerResult("No user found"));
}
user.Claims.RemoveClaims(type, value);
return Task.FromResult(IdentityManagerResult.Success);
}
private string GetUserProperty(PropertyMetadata property, InMemoryUser user)
{
string value;
if (property.TryGet(user, out value))
{
return value;
}
switch (property.Type)
{
case "role.admin":
return user.Claims.HasValue(Constants.ClaimTypes.Role, "admin").ToString().ToLower();
case "gravatar":
return user.Claims.GetValue("gravatar");
}
throw new Exception("Invalid property type " + property.Type);
}
private IdentityManagerResult SetUserProperty(IEnumerable<PropertyMetadata> propsMeta, InMemoryUser user, string type, string value)
{
IdentityManagerResult result;
if (propsMeta.TrySet(user, type, value, out result))
{
return result;
}
switch (type)
{
case "role.admin":
{
var val = Boolean.Parse(value);
if (val)
{
user.Claims.AddClaim(Constants.ClaimTypes.Role, "admin");
}
else
{
user.Claims.RemoveClaim(Constants.ClaimTypes.Role, "admin");
}
}
break;
case "gravatar":
{
user.Claims.SetValue("gravatar", value);
}
break;
default:
throw new InvalidOperationException("Invalid Property Type : " + type);
}
return IdentityManagerResult.Success;
}
IEnumerable<string> ValidateUserProperties(IEnumerable<PropertyValue> properties)
{
return properties.Select(x => ValidateUserProperty(x.Type, x.Value)).Aggregate((x, y) => x.Concat(y));
}
private IEnumerable<string> ValidateUserProperty(string type, string value)
{
switch (type)
{
case Constants.ClaimTypes.Username:
{
if (this.users.Any(x => x.Username == value))
{
return new string[] { "That Username is already in use" };
}
}
break;
case Constants.ClaimTypes.Password:
{
if (value.Length < 3)
{
return new string[] { "Password must have at least 3 characters" };
}
}
break;
}
return Enumerable.Empty<string>();
}
#endregion
#region Roles
public Task<IdentityManagerResult<CreateResult>> CreateRoleAsync(IEnumerable<PropertyValue> properties)
{
var errors = ValidateRoleProperties(properties);
if (errors.Any())
{
return Task.FromResult(new IdentityManagerResult<CreateResult>(errors.ToArray()));
}
var role = new InMemoryRole();
var createPropsMeta = GetMetadata().RoleMetadata.GetCreateProperties();
foreach (var prop in properties)
{
var result = SetRoleProperty(createPropsMeta, role, prop.Type, prop.Value);
if (!result.IsSuccess)
{
return Task.FromResult(new IdentityManagerResult<CreateResult>(result.Errors.ToArray()));
}
}
if (roles.Any(x => x.Name.Equals(role.Name, StringComparison.OrdinalIgnoreCase)))
{
return Task.FromResult(new IdentityManagerResult<CreateResult>("Role name already in use."));
}
roles.Add(role);
return Task.FromResult(new IdentityManagerResult<CreateResult>(new CreateResult() { Subject = role.ID }));
}
public Task<IdentityManagerResult> DeleteRoleAsync(string subject)
{
var role = roles.SingleOrDefault(x => x.ID == subject);
if (role != null)
{
roles.Remove(role);
}
return Task.FromResult(IdentityManagerResult.Success);
}
public Task<IdentityManagerResult<QueryResult<RoleSummary>>> QueryRolesAsync(string filter, int start, int count)
{
var query =
from r in roles
select r;
if (!String.IsNullOrWhiteSpace(filter))
{
filter = filter.ToLower();
query =
from r in query
where
r.Name.ToLower().Contains(filter) ||
(r.Description != null && r.Description.ToLower().Contains(filter))
select r;
}
var items =
from r in query.Distinct()
select new RoleSummary
{
Subject = r.ID,
Name = r.Name,
Description = r.Description
};
var total = items.Count();
var result = items;
if (start >= 0 && count >= 0)
{
result = items.Skip(start).Take(count);
count = result.Count();
}
else
{
start = 0;
count = total;
}
return Task.FromResult(new IdentityManagerResult<QueryResult<RoleSummary>>(new QueryResult<RoleSummary>
{
Filter = filter,
Start = start,
Count = count,
Items = result,
Total = total,
}));
}
public Task<IdentityManagerResult<RoleDetail>> GetRoleAsync(string subject)
{
var role = this.roles.SingleOrDefault(x => x.ID == subject);
if (role == null)
{
return Task.FromResult(new IdentityManagerResult<RoleDetail>((RoleDetail)null));
}
var props = new List<PropertyValue>();
foreach (var prop in GetMetadata().RoleMetadata.UpdateProperties)
{
props.Add(new PropertyValue
{
Type = prop.Type,
Value = GetRoleProperty(prop, role)
});
}
var detail = new RoleDetail
{
Subject = role.ID,
Name = role.Name,
Description = role.Description,
Properties = props
};
return Task.FromResult(new IdentityManagerResult<RoleDetail>(detail));
}
public Task<IdentityManagerResult> SetRolePropertyAsync(string subject, string type, string value)
{
var role = roles.SingleOrDefault(x => x.ID == subject);
if (role == null)
{
return Task.FromResult(new IdentityManagerResult("No role found"));
}
var errors = ValidateRoleProperty(type, value);
if (errors.Any())
{
return Task.FromResult(new IdentityManagerResult(errors.ToArray()));
}
var result = SetRoleProperty(GetMetadata().RoleMetadata.UpdateProperties, role, type, value);
return Task.FromResult(result);
}
private string GetRoleProperty(PropertyMetadata property, InMemoryRole role)
{
string value;
if (property.TryGet(role, out value))
{
return value;
}
throw new Exception("Invalid property type " + property.Type);
}
private IdentityManagerResult SetRoleProperty(IEnumerable<PropertyMetadata> propsMeta, InMemoryRole role, string type, string value)
{
IdentityManagerResult result;
if (propsMeta.TrySet(role, type, value, out result))
{
return result;
}
throw new InvalidOperationException("Invalid Property Type : " + type);
}
IEnumerable<string> ValidateRoleProperties(IEnumerable<PropertyValue> properties)
{
return properties.Select(x => ValidateRoleProperty(x.Type, x.Value)).Aggregate((x, y) => x.Concat(y));
}
private IEnumerable<string> ValidateRoleProperty(string type, string value)
{
return Enumerable.Empty<string>();
}
#endregion
}
} | {
"content_hash": "00d491c432e64d73b6a0519ccbdfa7e8",
"timestamp": "",
"source": "github",
"line_count": 506,
"max_line_length": 156,
"avg_line_length": 36.741106719367586,
"alnum_prop": 0.5207896293905653,
"repo_name": "mtinning/openidconnect",
"id": "f3b18a880f5d4efa59867dc510cefc831d84c039",
"size": "19201",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "OpenIDConnect.IdentityManager/InMemoryService/InMemoryIdentityManagerService.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "564631"
},
{
"name": "CSS",
"bytes": "7241"
},
{
"name": "HTML",
"bytes": "90886"
},
{
"name": "JavaScript",
"bytes": "93542"
}
],
"symlink_target": ""
} |
#ifndef BOOST_RANDOM_CONST_MOD_HPP
#define BOOST_RANDOM_CONST_MOD_HPP
#include <cassert>
#include <boost/static_assert.hpp>
#include <boost/cstdint.hpp>
#include <boost/integer_traits.hpp>
namespace boost {
namespace random {
/*
* Some random number generators require modular arithmetic. Put
* everything we need here.
* IntType must be an integral type.
*/
namespace detail {
template<bool is_signed>
struct do_add
{ };
template<>
struct do_add<true>
{
template<class IntType>
static IntType add(IntType m, IntType x, IntType c)
{
x += (c-m);
if(x < 0)
x += m;
return x;
}
};
template<>
struct do_add<false>
{
template<class IntType>
static IntType add(IntType, IntType, IntType)
{
// difficult
assert(!"const_mod::add with c too large");
return 0;
}
};
} // namespace detail
#if !(defined(__BORLANDC__) && (__BORLANDC__ == 0x560))
template<class IntType, IntType m>
class const_mod
{
public:
static IntType add(IntType x, IntType c)
{
if(c == 0)
return x;
else if(c <= traits::const_max - m) // i.e. m+c < max
return add_small(x, c);
else
return detail::do_add<traits::is_signed>::add(m, x, c);
}
static IntType mult(IntType a, IntType x)
{
if(a == 1)
return x;
else if(m <= traits::const_max/a) // i.e. a*m <= max
return mult_small(a, x);
else if(traits::is_signed && (m%a < m/a))
return mult_schrage(a, x);
else {
// difficult
assert(!"const_mod::mult with a too large");
return 0;
}
}
static IntType mult_add(IntType a, IntType x, IntType c)
{
if(m <= (traits::const_max-c)/a) // i.e. a*m+c <= max
return (a*x+c) % m;
else
return add(mult(a, x), c);
}
static IntType invert(IntType x)
{ return x == 0 ? 0 : invert_euclidian(x); }
private:
typedef integer_traits<IntType> traits;
const_mod(); // don't instantiate
static IntType add_small(IntType x, IntType c)
{
x += c;
if(x >= m)
x -= m;
return x;
}
static IntType mult_small(IntType a, IntType x)
{
return a*x % m;
}
static IntType mult_schrage(IntType a, IntType value)
{
const IntType q = m / a;
const IntType r = m % a;
assert(r < q); // check that overflow cannot happen
value = a*(value%q) - r*(value/q);
while(value <= 0)
value += m;
return value;
}
// invert c in the finite field (mod m) (m must be prime)
static IntType invert_euclidian(IntType c)
{
// we are interested in the gcd factor for c, because this is our inverse
BOOST_STATIC_ASSERT(m > 0);
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
BOOST_STATIC_ASSERT(boost::integer_traits<IntType>::is_signed);
#endif
assert(c > 0);
IntType l1 = 0;
IntType l2 = 1;
IntType n = c;
IntType p = m;
for(;;) {
IntType q = p / n;
l1 -= q * l2; // this requires a signed IntType!
p -= q * n;
if(p == 0)
return (l2 < 1 ? l2 + m : l2);
IntType q2 = n / p;
l2 -= q2 * l1;
n -= q2 * p;
if(n == 0)
return (l1 < 1 ? l1 + m : l1);
}
}
};
// The modulus is exactly the word size: rely on machine overflow handling.
// Due to a GCC bug, we cannot partially specialize in the presence of
// template value parameters.
template<>
class const_mod<unsigned int, 0>
{
typedef unsigned int IntType;
public:
static IntType add(IntType x, IntType c) { return x+c; }
static IntType mult(IntType a, IntType x) { return a*x; }
static IntType mult_add(IntType a, IntType x, IntType c) { return a*x+c; }
// m is not prime, thus invert is not useful
private: // don't instantiate
const_mod();
};
template<>
class const_mod<unsigned long, 0>
{
typedef unsigned long IntType;
public:
static IntType add(IntType x, IntType c) { return x+c; }
static IntType mult(IntType a, IntType x) { return a*x; }
static IntType mult_add(IntType a, IntType x, IntType c) { return a*x+c; }
// m is not prime, thus invert is not useful
private: // don't instantiate
const_mod();
};
// the modulus is some power of 2: rely partly on machine overflow handling
// we only specialize for rand48 at the moment
#ifndef BOOST_NO_INT64_T
template<>
class const_mod<uint64_t, uint64_t(1) << 48>
{
typedef uint64_t IntType;
public:
static IntType add(IntType x, IntType c) { return c == 0 ? x : mod(x+c); }
static IntType mult(IntType a, IntType x) { return mod(a*x); }
static IntType mult_add(IntType a, IntType x, IntType c)
{ return mod(a*x+c); }
static IntType mod(IntType x) { return x &= ((uint64_t(1) << 48)-1); }
// m is not prime, thus invert is not useful
private: // don't instantiate
const_mod();
};
#endif /* !BOOST_NO_INT64_T */
#else
//
// for some reason Borland C++ Builder 6 has problems with
// the full specialisations of const_mod, define a generic version
// instead, the compiler will optimise away the const-if statements:
//
template<class IntType, IntType m>
class const_mod
{
public:
static IntType add(IntType x, IntType c)
{
if(0 == m)
{
return x+c;
}
else
{
if(c == 0)
return x;
else if(c <= traits::const_max - m) // i.e. m+c < max
return add_small(x, c);
else
return detail::do_add<traits::is_signed>::add(m, x, c);
}
}
static IntType mult(IntType a, IntType x)
{
if(x == 0)
{
return a*x;
}
else
{
if(a == 1)
return x;
else if(m <= traits::const_max/a) // i.e. a*m <= max
return mult_small(a, x);
else if(traits::is_signed && (m%a < m/a))
return mult_schrage(a, x);
else {
// difficult
assert(!"const_mod::mult with a too large");
return 0;
}
}
}
static IntType mult_add(IntType a, IntType x, IntType c)
{
if(m == 0)
{
return a*x+c;
}
else
{
if(m <= (traits::const_max-c)/a) // i.e. a*m+c <= max
return (a*x+c) % m;
else
return add(mult(a, x), c);
}
}
static IntType invert(IntType x)
{ return x == 0 ? 0 : invert_euclidian(x); }
private:
typedef integer_traits<IntType> traits;
const_mod(); // don't instantiate
static IntType add_small(IntType x, IntType c)
{
x += c;
if(x >= m)
x -= m;
return x;
}
static IntType mult_small(IntType a, IntType x)
{
return a*x % m;
}
static IntType mult_schrage(IntType a, IntType value)
{
const IntType q = m / a;
const IntType r = m % a;
assert(r < q); // check that overflow cannot happen
value = a*(value%q) - r*(value/q);
while(value <= 0)
value += m;
return value;
}
// invert c in the finite field (mod m) (m must be prime)
static IntType invert_euclidian(IntType c)
{
// we are interested in the gcd factor for c, because this is our inverse
BOOST_STATIC_ASSERT(m > 0);
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
BOOST_STATIC_ASSERT(boost::integer_traits<IntType>::is_signed);
#endif
assert(c > 0);
IntType l1 = 0;
IntType l2 = 1;
IntType n = c;
IntType p = m;
for(;;) {
IntType q = p / n;
l1 -= q * l2; // this requires a signed IntType!
p -= q * n;
if(p == 0)
return (l2 < 1 ? l2 + m : l2);
IntType q2 = n / p;
l2 -= q2 * l1;
n -= q2 * p;
if(n == 0)
return (l1 < 1 ? l1 + m : l1);
}
}
};
#endif
} // namespace random
} // namespace boost
#endif // BOOST_RANDOM_CONST_MOD_HPP
| {
"content_hash": "b14f57da1ee816ee523fc8b7f3536141",
"timestamp": "",
"source": "github",
"line_count": 338,
"max_line_length": 77,
"avg_line_length": 22.83431952662722,
"alnum_prop": 0.5722985229334024,
"repo_name": "Ezeer/VegaStrike_win32FR",
"id": "39819aef066ba8e5baacd544ebe96adbeec07f3f",
"size": "8463",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vegastrike/boost/1_28/boost/random/detail/const_mod.hpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "4197693"
},
{
"name": "C++",
"bytes": "99169723"
},
{
"name": "Objective-C",
"bytes": "135840"
},
{
"name": "Perl",
"bytes": "21684"
},
{
"name": "Python",
"bytes": "186872"
},
{
"name": "Shell",
"bytes": "114240"
},
{
"name": "Standard ML",
"bytes": "2678"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="fr">
<head>
<!-- Generated by javadoc (version 1.7.0_51) on Sat May 17 15:31:38 CEST 2014 -->
<title>WebContext (Luchess 1.0.0 API)</title>
<meta name="date" content="2014-05-17">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="WebContext (Luchess 1.0.0 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../io/elegie/luchess/web/framework/payload/Result.html" title="class in io.elegie.luchess.web.framework.payload"><span class="strong">Prev Class</span></a></li>
<li>Next Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?io/elegie/luchess/web/framework/payload/WebContext.html" target="_top">Frames</a></li>
<li><a href="WebContext.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">io.elegie.luchess.web.framework.payload</div>
<h2 title="Class WebContext" class="title">Class WebContext</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>io.elegie.luchess.web.framework.payload.WebContext</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="strong">WebContext</span>
extends java.lang.Object</pre>
<div class="block">An single object holding references to the web container objects, such as the
request and the response. This object has been introduced in order to keep
the APIs simple.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../../io/elegie/luchess/web/framework/payload/WebContext.html#WebContext(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)">WebContext</a></strong>(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>javax.servlet.http.HttpServletRequest</code></td>
<td class="colLast"><code><strong><a href="../../../../../../io/elegie/luchess/web/framework/payload/WebContext.html#getRequest()">getRequest</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>javax.servlet.http.HttpServletResponse</code></td>
<td class="colLast"><code><strong><a href="../../../../../../io/elegie/luchess/web/framework/payload/WebContext.html#getResponse()">getResponse</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../../io/elegie/luchess/web/framework/payload/WebContext.html#toString()">toString</a></strong>()</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="WebContext(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>WebContext</h4>
<pre>public WebContext(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getRequest()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getRequest</h4>
<pre>public javax.servlet.http.HttpServletRequest getRequest()</pre>
</li>
</ul>
<a name="getResponse()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getResponse</h4>
<pre>public javax.servlet.http.HttpServletResponse getResponse()</pre>
</li>
</ul>
<a name="toString()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>toString</h4>
<pre>public java.lang.String toString()</pre>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>toString</code> in class <code>java.lang.Object</code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../io/elegie/luchess/web/framework/payload/Result.html" title="class in io.elegie.luchess.web.framework.payload"><span class="strong">Prev Class</span></a></li>
<li>Next Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?io/elegie/luchess/web/framework/payload/WebContext.html" target="_top">Frames</a></li>
<li><a href="WebContext.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"content_hash": "c954731e6985f723f2e630790aa4f1bb",
"timestamp": "",
"source": "github",
"line_count": 289,
"max_line_length": 278,
"avg_line_length": 33.65051903114187,
"alnum_prop": 0.6350642673521851,
"repo_name": "Elegie/luchess",
"id": "9367b4442dc2de22795910a54f26a625bcb18e8b",
"size": "9725",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/javadoc/io/elegie/luchess/web/framework/payload/WebContext.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "18217"
},
{
"name": "Groovy",
"bytes": "7829"
},
{
"name": "Java",
"bytes": "714250"
},
{
"name": "JavaScript",
"bytes": "35471"
}
],
"symlink_target": ""
} |
<html>
<head>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="image_demo.css" />
<script type="text/javascript" src="b64.js"></script>
</head>
<body>
<image-demo>
</image-demo>
$SCRIPTS$
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/css/materialize.min.css">
<!-- Compiled and minified JavaScript -->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/js/materialize.min.js"></script>
</body>
</html>
| {
"content_hash": "bd8d9aadaeac5810c9c1d2881eb41be5",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 116,
"avg_line_length": 38.21052631578947,
"alnum_prop": 0.6460055096418733,
"repo_name": "zolfer/angular",
"id": "1fd3521646b95d1b6e7c5ef6f421e4cb8d54623d",
"size": "726",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "modules/playground/src/web_workers/images/single_thread.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "65556"
},
{
"name": "Dart",
"bytes": "590484"
},
{
"name": "HTML",
"bytes": "69016"
},
{
"name": "JavaScript",
"bytes": "79448"
},
{
"name": "Protocol Buffer",
"bytes": "4611"
},
{
"name": "Python",
"bytes": "3535"
},
{
"name": "Shell",
"bytes": "21190"
},
{
"name": "TypeScript",
"bytes": "3111876"
}
],
"symlink_target": ""
} |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Threading;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis
{
/// <summary>
/// Input nodes are the 'root' nodes in the graph, and get their values from the inputs of the driver state table
/// </summary>
/// <typeparam name="T">The type of the input</typeparam>
internal sealed class InputNode<T> : IIncrementalGeneratorNode<T>
{
private readonly Func<DriverStateTable.Builder, ImmutableArray<T>> _getInput;
private readonly Action<IIncrementalGeneratorOutputNode> _registerOutput;
private readonly IEqualityComparer<T> _inputComparer;
private readonly IEqualityComparer<T> _comparer;
private readonly string? _name;
public InputNode(Func<DriverStateTable.Builder, ImmutableArray<T>> getInput, IEqualityComparer<T>? inputComparer = null)
: this(getInput, registerOutput: null, inputComparer: inputComparer, comparer: null)
{
}
private InputNode(Func<DriverStateTable.Builder, ImmutableArray<T>> getInput, Action<IIncrementalGeneratorOutputNode>? registerOutput, IEqualityComparer<T>? inputComparer = null, IEqualityComparer<T>? comparer = null, string? name = null)
{
_getInput = getInput;
_comparer = comparer ?? EqualityComparer<T>.Default;
_inputComparer = inputComparer ?? EqualityComparer<T>.Default;
_registerOutput = registerOutput ?? (o => throw ExceptionUtilities.Unreachable);
_name = name;
}
public NodeStateTable<T> UpdateStateTable(DriverStateTable.Builder graphState, NodeStateTable<T> previousTable, CancellationToken cancellationToken)
{
var stopwatch = SharedStopwatch.StartNew();
var inputItems = _getInput(graphState);
TimeSpan elapsedTime = stopwatch.Elapsed;
// create a mutable hashset of the new items we can check against
HashSet<T> itemsSet = new HashSet<T>(_inputComparer);
foreach (var item in inputItems)
{
var added = itemsSet.Add(item);
Debug.Assert(added);
}
var builder = graphState.CreateTableBuilder(previousTable, _name);
// We always have no inputs steps into an InputNode, but we track the difference between "no inputs" (empty collection) and "no step information" (default value)
var noInputStepsStepInfo = builder.TrackIncrementalSteps ? ImmutableArray<(IncrementalGeneratorRunStep, int)>.Empty : default;
// for each item in the previous table, check if its still in the new items
int itemIndex = 0;
foreach (var (oldItem, _, _, _) in previousTable)
{
if (itemsSet.Remove(oldItem))
{
// we're iterating the table, so know that it has entries
var usedCache = builder.TryUseCachedEntries(elapsedTime, noInputStepsStepInfo);
Debug.Assert(usedCache);
}
else if (inputItems.Length == previousTable.Count)
{
// When the number of items matches the previous iteration, we use a heuristic to mark the input as modified
// This allows us to correctly 'replace' items even when they aren't actually the same. In the case that the
// item really isn't modified, but a new item, we still function correctly as we mostly treat them the same,
// but will perform an extra comparison that is omitted in the pure 'added' case.
var modified = builder.TryModifyEntry(inputItems[itemIndex], _comparer, elapsedTime, noInputStepsStepInfo, EntryState.Modified);
Debug.Assert(modified);
itemsSet.Remove(inputItems[itemIndex]);
}
else
{
var removed = builder.TryRemoveEntries(elapsedTime, noInputStepsStepInfo);
Debug.Assert(removed);
}
itemIndex++;
}
// any remaining new items are added
foreach (var newItem in itemsSet)
{
builder.AddEntry(newItem, EntryState.Added, elapsedTime, noInputStepsStepInfo, EntryState.Added);
}
return builder.ToImmutableAndFree();
}
public IIncrementalGeneratorNode<T> WithComparer(IEqualityComparer<T> comparer) => new InputNode<T>(_getInput, _registerOutput, _inputComparer, comparer, _name);
public IIncrementalGeneratorNode<T> WithTrackingName(string name) => new InputNode<T>(_getInput, _registerOutput, _inputComparer, _comparer, name);
public InputNode<T> WithRegisterOutput(Action<IIncrementalGeneratorOutputNode> registerOutput) => new InputNode<T>(_getInput, registerOutput, _inputComparer, _comparer, _name);
public void RegisterOutput(IIncrementalGeneratorOutputNode output) => _registerOutput(output);
}
}
| {
"content_hash": "56822b2592dee381d7620e81ff340b5c",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 246,
"avg_line_length": 51.31428571428572,
"alnum_prop": 0.6505196733481812,
"repo_name": "sharwell/roslyn",
"id": "96af759a55bb002e5458dc45d9789ccc5ba67887",
"size": "5390",
"binary": false,
"copies": "4",
"ref": "refs/heads/main",
"path": "src/Compilers/Core/Portable/SourceGeneration/Nodes/InputNode.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "1C Enterprise",
"bytes": "257760"
},
{
"name": "Batchfile",
"bytes": "8025"
},
{
"name": "C#",
"bytes": "141191940"
},
{
"name": "C++",
"bytes": "5602"
},
{
"name": "CMake",
"bytes": "9153"
},
{
"name": "Dockerfile",
"bytes": "2450"
},
{
"name": "F#",
"bytes": "549"
},
{
"name": "PowerShell",
"bytes": "243533"
},
{
"name": "Shell",
"bytes": "94467"
},
{
"name": "Visual Basic .NET",
"bytes": "71837994"
}
],
"symlink_target": ""
} |
<?php
/**
* Add server
*
* @author Alireza Josheghani <josheghani.dev@gmail.com>
* @since 29 Sep 2018
*/
namespace Josh\Console\Commands;
use Josh\Console\ConsoleStyle as Style;
use Josh\Console\Models\Server;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class ServerAddCommand extends ServerCommand
{
/**
* configure command
*
* @return void
*/
public function configure()
{
$this->setName('server:add')
->setDescription('Add server');
$this->addOption('name', 'e', InputOption::VALUE_REQUIRED, 'Server name');
$this->addOption('ip', 'i', InputOption::VALUE_REQUIRED, 'Server ip address');
}
/**
* execute command
*
* @param InputInterface $input
* @param OutputInterface $output
*/
protected function execute(InputInterface $input , OutputInterface $output)
{
$command = new Style($input, $output);
$servers = $this->model->all();
$ip = $input->getOption('ip');
$name = $input->getOption('name');
if (empty($name) || empty($ip)){
$command->error("Server name and ip address is required. use [server:add --ip=***.***.*** --name=example]");
} else {
/** @var Server $server */
foreach ($servers as $server){
if ( $server->getAttribute("name") == $name ) {
$command->error("Server {$name} already exists.");
exit;
}
if ( $server->getAttribute("ip") == $ip ) {
$command->error("Server IP {$ip} already exists.");
exit;
}
}
$id = ( $servers->count() == 0 ? 1 : array_reverse($servers->toArray())[0]->id + 1 );
$this->model->create(compact("id", "ip", "name"));
$command->info("Server {$name} added successfully.");
}
exit;
}
}
| {
"content_hash": "874ba0522aad1965cd1dd63ba1c5bf84",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 120,
"avg_line_length": 27.13157894736842,
"alnum_prop": 0.5431619786614937,
"repo_name": "iamalirezaj/console",
"id": "0bbd920fbdef0bf34b72946868f81045cd3f4192",
"size": "2062",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/Commands/ServerAddCommand.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "16260"
}
],
"symlink_target": ""
} |
PACKAGE_NAME=portable
#PACKAGE_VERSION is configurable can be passed as an argument.
PACKAGE_VERSION=${1:-v2.9.1}
PACKAGE_URL=https://github.com/libressl-portable/portable
yum install -y yum-utils git diffutils patch libtool automake autoconf make cmake
OS_NAME=$(cat /etc/os-release | grep ^PRETTY_NAME | cut -d= -f2)
#Check if package exists
if [ -d "$PACKAGE_NAME" ] ; then
rm -rf $PACKAGE_NAME
echo "$PACKAGE_NAME | $PACKAGE_VERSION | $OS_NAME | GitHub | Removed existing package if any"
fi
if ! git clone $PACKAGE_URL $PACKAGE_NAME; then
echo "------------------$PACKAGE_NAME:clone_fails---------------------------------------"
echo "$PACKAGE_URL $PACKAGE_NAME"
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Clone_Fails"
exit 0
fi
cd $PACKAGE_NAME
git checkout $PACKAGE_VERSION
./autogen.sh
mkdir build
cd build
cmake ..
if ! make ; then
echo "------------------$PACKAGE_NAME:install_fails-------------------------------------"
echo "$PACKAGE_URL $PACKAGE_NAME"
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Install_Fails"
exit 1
fi
if ! make test ; then
echo "------------------$PACKAGE_NAME:install_success_but_test_fails---------------------"
echo "$PACKAGE_URL $PACKAGE_NAME"
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Install_success_but_test_Fails"
exit 1
else
echo "------------------$PACKAGE_NAME:install_&_test_both_success-------------------------"
echo "$PACKAGE_URL $PACKAGE_NAME"
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub | Pass | Both_Install_and_Test_Success"
exit 0
fi
| {
"content_hash": "93f69623a7844b6dcfb7a43d397c3bb0",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 121,
"avg_line_length": 35.734693877551024,
"alnum_prop": 0.5996573386636208,
"repo_name": "ppc64le/build-scripts",
"id": "c7e48a84a85aa2f9595cf182742c13c054a653e3",
"size": "2631",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "l/libtls-standalone/libtls-standalone_ubi.8.5.sh",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1464"
},
{
"name": "C",
"bytes": "14922"
},
{
"name": "Dockerfile",
"bytes": "731231"
},
{
"name": "Groovy",
"bytes": "984"
},
{
"name": "Makefile",
"bytes": "7280"
},
{
"name": "OpenEdge ABL",
"bytes": "37872"
},
{
"name": "Python",
"bytes": "37596"
},
{
"name": "Roff",
"bytes": "7458"
},
{
"name": "Shell",
"bytes": "13688799"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<search:options xmlns:search="http://marklogic.com/appservices/search">
<search:constraint name="Collection">
<search:collection/>
</search:constraint>
<search:constraint name="entity-type">
<search:value>
<search:element ns="http://marklogic.com/entity-services" name="title"/>
</search:value>
</search:constraint>
<search:constraint name="id">
<search:value>
<search:element ns="" name="id"/>
</search:value>
</search:constraint>
<search:constraint name="title">
<search:range type="xs:string" facet="true" collation="http://marklogic.com/collation/codepoint">
<search:path-index>//*:instance/Manager/title</search:path-index>
</search:range>
</search:constraint>
<!--
The name of this constraint is a duplicate in the generated XML. It is within a comment so that the XML may be valid, but you may need to edit for your use case.
<search:constraint name="id" xmlns:search="http://marklogic.com/appservices/search">
<search:value>
<search:element ns="" name="id"/>
</search:value>
</search:constraint>
-->
<search:constraint name="name">
<search:range type="xs:string" facet="true" collation="http://marklogic.com/collation/codepoint">
<search:path-index>//*:instance/Employee/name</search:path-index>
</search:range>
</search:constraint>
<search:constraint name="salary">
<search:range type="xs:decimal" facet="true">
<search:element ns="" name="salary"/>
</search:range>
</search:constraint>
<search:values name="Manager">
<search:range type="xs:string" facet="true" collation="http://marklogic.com/collation/codepoint">
<search:path-index>//*:instance/Manager/title</search:path-index>
</search:range>
</search:values>
<search:tuples name="Employee">
<search:range type="xs:string" facet="true" collation="http://marklogic.com/collation/codepoint">
<search:path-index>//*:instance/Employee/name</search:path-index>
</search:range>
<search:range type="xs:decimal" facet="true">
<search:element ns="" name="salary"/>
</search:range>
</search:tuples>
<!--Uncomment to return no results for a blank search, rather than the default of all results
<search:term xmlns:search="http://marklogic.com/appservices/search">
<search:empty apply="no-results"/>
</search:term>
-->
<search:values name="uris">
<search:uri/>
</search:values>
<!--Change to 'filtered' to exclude false-positives in certain searches-->
<search:search-option>unfiltered</search:search-option>
<!--Modify document extraction to change results returned-->
<search:extract-document-data selected="include">
<search:extract-path>//*:instance/(Manager|Employee)</search:extract-path>
</search:extract-document-data>
<!--Change or remove this additional-query to broaden search beyond entity instance documents-->
<!--To return facets, change this option to 'true' and edit constraints-->
<search:return-facets>true</search:return-facets>
<!--To return snippets, comment out or remove this option-->
<search:transform-results apply="empty-snippet"/>
</search:options>
| {
"content_hash": "b050472b38064a3ea3d6c46e90234f5f",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 161,
"avg_line_length": 44.563380281690144,
"alnum_prop": 0.6994310998735778,
"repo_name": "marklogic/data-hub-in-a-box",
"id": "deef4a66f3d3d1b4a195bf922ff20d508f660db5",
"size": "3164",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "marklogic-data-hub/src/test/resources/entity-manager-test/options2.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "32065"
},
{
"name": "CSS",
"bytes": "5498"
},
{
"name": "HTML",
"bytes": "16957"
},
{
"name": "Java",
"bytes": "282973"
},
{
"name": "JavaScript",
"bytes": "287203"
},
{
"name": "Shell",
"bytes": "37751"
},
{
"name": "XQuery",
"bytes": "54951"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.