Dataset Preview
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code: DatasetGenerationError
Exception: ArrowInvalid
Message: JSON parse error: Missing a closing quotation mark in string. in row 905
Traceback: Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 145, in _generate_tables
dataset = json.load(f)
File "/usr/local/lib/python3.9/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.9/json/decoder.py", line 340, in decode
raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 1238)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1995, in _prepare_split_single
for _, table in generator:
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 148, in _generate_tables
raise e
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 122, in _generate_tables
pa_table = paj.read_json(
File "pyarrow/_json.pyx", line 308, in pyarrow._json.read_json
File "pyarrow/error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 91, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: JSON parse error: Missing a closing quotation mark in string. in row 905
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1529, in compute_config_parquet_and_info_response
parquet_operations = convert_to_parquet(builder)
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1154, in convert_to_parquet
builder.download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1027, in download_and_prepare
self._download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1122, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1882, in _prepare_split
for job_id, done, content in self._prepare_split_single(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2038, in _prepare_split_single
raise DatasetGenerationError("An error occurred while generating the dataset") from e
datasets.exceptions.DatasetGenerationError: An error occurred while generating the datasetNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
text
string | meta
dict |
|---|---|
<?php
namespace PH7\Framework\Error\CException;
defined('PH7') or exit('Restricted access');
use RuntimeException;
class PH7RuntimeException extends RuntimeException
{
use Escape {
strip as private;
}
/**
* @param string $sMsg
* @param int $iCode
*/
public function __construct($sMsg, $iCode = 0)
{
parent::__construct($sMsg, $iCode);
$this->strip($sMsg);
}
}
|
{
"content_hash": "de6f0090e612a15343ac4f6aa876b28b",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 50,
"avg_line_length": 17.16,
"alnum_prop": 0.6013986013986014,
"repo_name": "pH7Software/pH7-Social-Dating-CMS",
"id": "2113f91d836e8a755ed9f098855eb9b70527ad25",
"size": "834",
"binary": false,
"copies": "1",
"ref": "refs/heads/18.x",
"path": "_protected/framework/Error/CException/PH7RuntimeException.class.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "96066"
},
{
"name": "Dockerfile",
"bytes": "1985"
},
{
"name": "HTML",
"bytes": "3113"
},
{
"name": "JavaScript",
"bytes": "130824"
},
{
"name": "PHP",
"bytes": "2971480"
},
{
"name": "Shell",
"bytes": "16945"
},
{
"name": "Smarty",
"bytes": "449197"
}
]
}
|
package com.gizwits.framework.activity.account;
import android.app.ProgressDialog;
import android.graphics.Paint;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.gizwits.airpurifier.R;
import com.gizwits.framework.activity.BaseActivity;
import com.gizwits.framework.activity.device.DeviceListActivity;
import com.xpg.common.system.IntentUtils;
import com.xpg.common.useful.NetworkUtils;
import com.xpg.common.useful.StringUtils;
import com.xpg.ui.utils.ToastUtils;
// TODO: Auto-generated Javadoc
/**
* ClassName: Class LoginActivity. <br/>
* 用户登陆,该类用于账号登陆<br/>
*
* @author Lien
*/
public class LoginActivity extends BaseActivity implements OnClickListener {
/**
* The et name.
*/
private EditText etName;
/**
* The et psw.
*/
private EditText etPsw;
/**
* The tv forgot.
*/
private TextView tvForgot;
/**
* The btn login.
*/
private Button btnLogin;
/**
* The btn register.
*/
private Button btnRegister;
/**
* The dialog.
*/
private ProgressDialog dialog;
/**
* ClassName: Enum handler_key. <br/>
* <br/>
* date: 2014-11-26 17:51:10 <br/>
*
* @author Lien
*/
private enum handler_key {
/** 登陆成功. */
LOGIN_SUCCESS,
/** 登陆失败. */
LOGIN_FAIL,
/** 登录超时. */
LOGIN_TIMEOUT,
}
/**
* The handler.
*/
Handler handler = new Handler() {
public void handleMessage(Message msg) {
super.handleMessage(msg);
handler_key key = handler_key.values()[msg.what];
switch (key) {
// 登陆成功
case LOGIN_SUCCESS:
handler.removeMessages(handler_key.LOGIN_TIMEOUT.ordinal());
Toast.makeText(LoginActivity.this, "登录成功", Toast.LENGTH_SHORT)
.show();
dialog.cancel();
IntentUtils.getInstance().startActivity(LoginActivity.this,
DeviceListActivity.class);
finish();
break;
// 登陆失败
case LOGIN_FAIL:
handler.removeMessages(handler_key.LOGIN_TIMEOUT.ordinal());
Toast.makeText(LoginActivity.this, msg.obj + "",
Toast.LENGTH_SHORT).show();
dialog.cancel();
break;
// 登录超时
case LOGIN_TIMEOUT:
handler.removeMessages(handler_key.LOGIN_TIMEOUT.ordinal());
Toast.makeText(LoginActivity.this, "登陆超时", Toast.LENGTH_SHORT)
.show();
dialog.cancel();
break;
}
}
};
/*
* @see
* com.gizwits.aircondition.activity.BaseActivity#onCreate(android.os.Bundle
* )
*/
/* (non-Javadoc)
* @see com.gizwits.framework.activity.BaseActivity#onCreate(android.os.Bundle)
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
initViews();
initEvents();
}
/**
* 初始化交互监听器.
*/
private void initEvents() {
tvForgot.setOnClickListener(this);
btnLogin.setOnClickListener(this);
btnRegister.setOnClickListener(this);
}
/**
* 初始化空间.
*/
private void initViews() {
etName = (EditText) findViewById(R.id.etName);
etPsw = (EditText) findViewById(R.id.etPsw);
tvForgot = (TextView) findViewById(R.id.tvForgot);
btnLogin = (Button) findViewById(R.id.btnLogin);
btnRegister = (Button) findViewById(R.id.btnRegister);
tvForgot.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG); // 下划线
dialog = new ProgressDialog(this);
dialog.setMessage("登录中,请稍候...");
if (setmanager.getUserName() != null) {
etName.setText(setmanager.getUserName());
}
}
/*
* @see android.view.View.OnClickListener#onClick(android.view.View)
*/
/* (non-Javadoc)
* @see android.view.View.OnClickListener#onClick(android.view.View)
*/
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.tvForgot:
// 打开忘记密码Activity
IntentUtils.getInstance().startActivity(this,
ForgetPswActivity.class);
break;
case R.id.btnLogin:
if (!NetworkUtils.isNetworkConnected(this)) {
ToastUtils.showShort(this, "网络未连接");return;
}
// 登陆
if (StringUtils.isEmpty(etName.getText().toString())) {
Toast.makeText(this, "请输入用户名", Toast.LENGTH_SHORT).show();
return;
}
if (StringUtils.isEmpty(etPsw.getText().toString())) {
Toast.makeText(this, "请输入密码", Toast.LENGTH_SHORT).show();
return;
}
dialog.show();
final String psw = etPsw.getText().toString().trim();
final String name = etName.getText().toString().trim();
// 调用登陆方法
mCenter.cLogin(name, psw);
// 15秒后登陆超时
handler.sendEmptyMessageDelayed(
handler_key.LOGIN_TIMEOUT.ordinal(), 15000);
break;
case R.id.btnRegister:
if (NetworkUtils.isNetworkConnected(this)) {
// 打开注册Activity
IntentUtils.getInstance().startActivity(this,
RegisterActivity.class);
}
break;
}
}
/*
* @see com.gizwits.framework.activity.BaseActivity#didUserLogin(int,
* java.lang.String, java.lang.String, java.lang.String)
*/
/* (non-Javadoc)
* @see com.gizwits.framework.activity.BaseActivity#didUserLogin(int, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
protected void didUserLogin(int error, String errorMessage, String uid,
String token) {
if (!uid.isEmpty() && !token.isEmpty()) {// 登陆成功
setmanager.setUserName(etName.getText().toString().trim());
setmanager.setPassword(etPsw.getText().toString().trim());
setmanager.setUid(uid);
setmanager.setToken(token);
handler.sendEmptyMessage(handler_key.LOGIN_SUCCESS.ordinal());
} else {// 登陆失败
Message msg = new Message();
msg.what = handler_key.LOGIN_FAIL.ordinal();
msg.obj = errorMessage;
handler.sendMessage(msg);
}
}
/* (non-Javadoc)
* @see android.app.Activity#onBackPressed()
*/
@Override
public void onBackPressed() {
exit();
}
}
|
{
"content_hash": "62cf0aa5153f71c20a7eb1c9f93de8f0",
"timestamp": "",
"source": "github",
"line_count": 247,
"max_line_length": 124,
"avg_line_length": 23.526315789473685,
"alnum_prop": 0.6857683703321287,
"repo_name": "gizwits/Gizwits-AirPurifier_Android",
"id": "9111f6c9fd1d7d9ead0eaa9ace5909b1646ddc9c",
"size": "7309",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/gizwits/framework/activity/account/LoginActivity.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "493287"
}
]
}
|
package vprExplorer.utilities;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import vprExplorer.Settings;
public class PasswordDialog extends CommonDialog implements PropertyChangeListener {
private static final long serialVersionUID = 1L;
private Settings settings;
private JPasswordField pwdfield = new JPasswordField();
private char[] password = {};
private JOptionPane optionPane;
public PasswordDialog(Settings sets) {
super("Enter Password");
settings = sets;
Object[] array = new Object[] { pwdfield };
Object[] options = new Object[] { "OK", "Cancel" };
optionPane = new JOptionPane(array, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null);
optionPane.addPropertyChangeListener(this);
optionPane.setOptions(options);
optionPane.setInitialValue(options[0]);
setContentPane(optionPane);
showDialog();
}
@Override
public void propertyChange(PropertyChangeEvent arg0) {
if (arg0.getPropertyName()=="value") {
String value = optionPane.getValue().toString();
if (value == "OK") {
password = pwdfield.getPassword();
if (password.length==0) {
optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE);
return;
}
settings.setPassword(password);
}
else {
settings.setPassword(new char[]{});
}
dispose();
}
}
}
|
{
"content_hash": "5baf32a8bd7ec4c8cf565a46b73981d8",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 101,
"avg_line_length": 27.22222222222222,
"alnum_prop": 0.7034013605442176,
"repo_name": "thompsct/VPRKB",
"id": "fa111167a0cfd47ee69abb5d77be42b74e839a4f",
"size": "1470",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/vprExplorer/utilities/PasswordDialog.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AMPL",
"bytes": "14288"
},
{
"name": "CSS",
"bytes": "2377"
},
{
"name": "Elixir",
"bytes": "3526"
},
{
"name": "HTML",
"bytes": "19076"
},
{
"name": "Java",
"bytes": "278678"
},
{
"name": "Web Ontology Language",
"bytes": "1227343"
}
]
}
|
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null
|
{
"content_hash": "f0ec2ba0f7f957ff67ae84167d9d23ce",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "055148d57dd068741b65800f5c8bcb1635ece148",
"size": "195",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Malpighiales/Phyllanthaceae/Phyllanthus/Phyllanthus salicifolius/ Syn. Phyllanthus salicifolius genuinus/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": []
}
|
Building UPM {#building}
============
UPM uses cmake in order to make compilation relatively painless. Cmake runs
build out of tree so the recommended way is to clone from git and make a build/
directory. Failure to do an out-of-source build may cause issues when
rebuilding later on.
This project depends on libmraa, so that needs to be installed first. Use the
following environment variables to configure the paths:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:.../mraa/build/lib/pkgconfig
CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:.../mraa/build/include
LIBRARY_PATH=$LIBRARY_PATH:.../mraa/build/lib
UPM will attempt to build all directories inside src/ and they must contain
individual CMakeLists.txt files.
~~~~~~~~~~~~~{.sh}
mkdir build
cd build
cmake ..
make
~~~~~~~~~~~~~
Our cmake configure has a number of options, *cmake-gui* or *ccmake* can show
you all the options. The interesting ones are detailed below:
Changing install path from /usr/local to /usr
~~~~~~~~~~~~~
-DCMAKE_INSTALL_PREFIX:PATH=/usr
~~~~~~~~~~~~~
Building debug build:
~~~~~~~~~~~~~
-DCMAKE_BUILD_TYPE=DEBUG
~~~~~~~~~~~~~
Using clang instead of gcc:
~~~~~~~~~~~~~
-DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++
~~~~~~~~~~~~~
Cross-compiling on a different system:
~~~~~~~~~~~~~
-DCMAKE_CXX_FLAGS:STRING=-m32 -march=i586
-DCMAKE_C_FLAGS:STRING=-m32 -march=i586
~~~~~~~~~~~~~
Building with an older version of swig (swig 2.0+) requires the disabling of javascript:
~~~~~~~~~~~~~
-DBUILDSWIGNODE=OFF
~~~~~~~~~~~~~
Disabling python module building
~~~~~~~~~~~~~
-DBUILDSWIGPYTHON=OFF
~~~~~~~~~~~~~
Setting the python library to use:
~~~~~~~~~~~~~
-DPYTHON_LIBRARY:FILEPATH=/usr/lib/libpython2.7.so.1.0
~~~~~~~~~~~~~
Building doxygen doc
~~~~~~~~~~~~~
-BUILDDOC=ON
~~~~~~~~~~~~~
If you intend to turn on all the options and build everything at once (C++,
Node, Python and Documentation) you will have to edit the src/doxy2swig.py file
and change the line endings from Windows style to Linux format. This has to be
repeated every time to sync with the master branch since our Github repository
stores files using CR LF line breaks.
You can also generate the include and lib directories containing all the sensor
headers and library files respectively with *make install*. Further, you may
choose to generate these only for a specific sensor you modified, and this can
be achieved by building from the individual makefile of the sensor. Assuming
you're in the build directory, to make the lcd module you would:
~~~~~~~~~~~~~
cd src/lcd
make install
~~~~~~~~~~~~~
Often developers are only interested in building one module or even just the
python/node module to do some quick testing using scripting. In order to do
this you need to use the target name for the python or node module you want to
rebuild. For example the lcd module target name is i2clcd. Therefore the python
module target name will be prefixed by _pyupm_. Just do the following to build
only that module. Modules not using the UPM cmake macros may have different
naming.
~~~~~~~~~~~~~
make _pyupm_i2clcd
~~~~~~~~~~~~~
Sometimes you want to build a small C++ example against an installed library.
This is fairly easy if installed system-wide. Just link against the correct
library (in this case libupm-i2clcd) and then add /usr/include/upm to the
loader path:
~~~~~~~~~~~~
g++ test.cxx -lupm-i2clcd -I/usr/include/upm
~~~~~~~~~~~~
You can also use pkg-config to return the information to you, which is
considered the correct way if including UPM in a build system like cmake or
autotools on linux.
~~~~~~~~~~~
pkg-config --cflags --libs upm-i2clcd
~~~~~~~~~~~
|
{
"content_hash": "8d61652a76f1de9299aecc845cc7557b",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 88,
"avg_line_length": 34.22429906542056,
"alnum_prop": 0.7031676679410158,
"repo_name": "izard/upm",
"id": "2724b5d8558fef07520dd3dafecc9fde1efe5cee",
"size": "3662",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/building.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "124666"
},
{
"name": "C++",
"bytes": "906667"
},
{
"name": "CMake",
"bytes": "42459"
},
{
"name": "Python",
"bytes": "15324"
}
]
}
|
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@mipmap/ptr_bear1"
android:duration="100" />
<item
android:drawable="@mipmap/ptr_bear2"
android:duration="100" />
<item
android:drawable="@mipmap/ptr_bear3"
android:duration="100" />
<item
android:drawable="@mipmap/ptr_bear4"
android:duration="100" />
<item
android:drawable="@mipmap/ptr_bear5"
android:duration="100" />
<item
android:drawable="@mipmap/ptr_bear6"
android:duration="100" />
<item
android:drawable="@mipmap/ptr_bear7"
android:duration="100" />
</animation-list>
|
{
"content_hash": "79b27c0c9514404ce0dc396f963e462e",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 75,
"avg_line_length": 31.458333333333332,
"alnum_prop": 0.6,
"repo_name": "oversky524/AndroidUi",
"id": "2b0511f2fd63d99b7369e95f3fe58e58b7a61153",
"size": "755",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/res/drawable/animation_pull_down_baidu.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "501401"
},
{
"name": "Kotlin",
"bytes": "6675"
}
]
}
|
Flux combined with RactiveJS using Fluxxor and browserify
|
{
"content_hash": "8b6e4531965b90ef41eb3140989b705d",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 57,
"avg_line_length": 58,
"alnum_prop": 0.8620689655172413,
"repo_name": "linde12/flux-ractive",
"id": "01cbcdade92afeeecee84d81e796f87b23e2cc69",
"size": "73",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "442"
},
{
"name": "HTML",
"bytes": "886"
},
{
"name": "JavaScript",
"bytes": "2183647"
}
]
}
|
"""
from: https://adventofcode.com/2019/day/9
--- Day 9: Sensor Boost ---
You've just said goodbye to the rebooted rover and left Mars when you receive a faint distress
signal coming from the asteroid belt. It must be the Ceres monitoring station!
In order to lock on to the signal, you'll need to boost your sensors. The Elves send up the latest
BOOST program - Basic Operation Of System Test.
While BOOST (your puzzle input) is capable of boosting your sensors, for tenuous safety reasons, it
refuses to do so until the computer it runs on passes some checks to demonstrate it is a complete
Intcode computer.
Your existing Intcode computer is missing one key feature: it needs support for parameters in
relative mode.
Parameters in mode 2, relative mode, behave very similarly to parameters in position mode: the
parameter is interpreted as a position. Like position mode, parameters in relative mode can be read
from or written to.
The important difference is that relative mode parameters don't count from address 0. Instead, they
count from a value called the relative base. The relative base starts at 0.
The address a relative mode parameter refers to is itself plus the current relative base. When the
relative base is 0, relative mode parameters and position mode parameters with the same value refer
to the same address.
For example, given a relative base of 50, a relative mode parameter of -7 refers to memory address
50 + -7 = 43.
The relative base is modified with the relative base offset instruction:
Opcode 9 adjusts the relative base by the value of its only parameter. The relative base increases
(or decreases, if the value is negative) by the value of the parameter.
For example, if the relative base is 2000, then after the instruction 109,19, the relative base
would be 2019. If the next instruction were 204,-34, then the value at address 1985 would be output.
Your Intcode computer will also need a few other capabilities:
The computer's available memory should be much larger than the initial program. Memory beyond the
initial program starts with the value 0 and can be read or written like any other memory. (It is
invalid to try to access memory at a negative address, though.)
The computer should have support for large numbers. Some instructions near the beginning of the
BOOST program will verify this capability.
Here are some example programs that use these features:
109,1,204,-1,1001,100,1,100,1008,100,16,101,1006,101,0,99 takes no input and produces a copy of
itself as output.
1102,34915192,34915192,7,4,7,99,0 should output a 16-digit number.
104,1125899906842624,99 should output the large number in the middle.
The BOOST program will ask for a single input; run it in test mode by providing it the value 1. It
will perform a series of checks on each opcode, output any opcodes (and the associated parameter
modes) that seem to be functioning incorrectly, and finally output a BOOST keycode.
Once your Intcode computer is fully functional, the BOOST program should report no malfunctioning
opcodes when run in test mode; it should only output a single value, the BOOST keycode. What BOOST
keycode does it produce?
--- Part Two ---
You now have a complete Intcode computer.
Finally, you can lock on to the Ceres distress signal! You just need to boost your sensors using the
BOOST program.
The program runs in sensor boost mode by providing the input instruction the value 2. Once run, it
will boost the sensors automatically, but it might take a few seconds to complete the operation on
slower hardware. In sensor boost mode, the program will output a single value: the coordinates of
the distress signal.
Run the BOOST program in sensor boost mode. What are the coordinates of the distress signal?
"""
import os
from collections import defaultdict
def list_digits(number):
"""Takes up to a 6 digit int and returns a list of each digit in order"""
factor = 100000
digits = list()
while factor > 1:
digits.append(number // factor)
number = number % factor
factor //= 10
digits.append(number)
return digits
def get_param_value(mode, memory, ptr, relative_base):
"""Returns the value of the parameter at memory[ptr] based on the mode"""
# position mode
if mode == 0:
return memory[memory[ptr]]
# immediate mode
elif mode == 1:
return memory[ptr]
# relative mode
elif mode == 2:
return memory[memory[ptr] + relative_base]
else:
raise Exception
def get_write_param_value(mode, memory, ptr, relative_base):
"""Returns the value of the paramter at memory[ptr] based on the mode, for a writing paramter"""
# position mode
if mode == 0:
return memory[ptr]
# immediate mode
elif mode == 1:
# immediate mode is not supported
raise Exception
elif mode == 2:
return memory[ptr] + relative_base
else:
raise Exception
def run_intcode(memory, input_list, instr_ptr=0, input_ptr=0, previous_output=None):
"""Run an Intcode program from memory"""
output = previous_output
relative_base = 0
while instr_ptr < len(memory):
instruction = memory[instr_ptr]
digits = list_digits(instruction)
# extract opcode
opcode_pair = digits[len(digits)-2:]
opcode = opcode_pair[0]*10 + opcode_pair[1]
# extract parameter modes
param_modes = digits[:len(digits)-2]
param_modes.reverse()
# HALT
if opcode == 99:
return
# ADD - num1, num2, store
if opcode == 1:
# process num1
num1 = get_param_value(param_modes[0], memory, instr_ptr + 1, relative_base)
# process num2
num2 = get_param_value(param_modes[1], memory, instr_ptr + 2, relative_base)
# process store
store = get_write_param_value(param_modes[2], memory, instr_ptr + 3, relative_base)
memory[store] = num1 + num2
instr_ptr = instr_ptr + 4
# MULTIPLY - num1, num2, store
elif opcode == 2:
# process num1
num1 = get_param_value(param_modes[0], memory, instr_ptr + 1, relative_base)
# process num2
num2 = get_param_value(param_modes[1], memory, instr_ptr + 2, relative_base)
# process store
store = get_write_param_value(param_modes[2], memory, instr_ptr + 3, relative_base)
memory[store] = num1 * num2
instr_ptr = instr_ptr + 4
# INPUT - position
elif opcode == 3:
position = get_write_param_value(param_modes[0], memory, instr_ptr + 1, relative_base)
memory[position] = input_list[input_ptr]
input_ptr = input_ptr + 1
instr_ptr = instr_ptr + 2
# OUTPUT - position
elif opcode == 4:
output = get_param_value(param_modes[0], memory, instr_ptr + 1, relative_base)
instr_ptr = instr_ptr + 2
print(output)
# JUMP-IF-TRUE - test, new_ptr
elif opcode == 5:
# process test
test = get_param_value(param_modes[0], memory, instr_ptr + 1, relative_base)
# process new_ptr
new_ptr = get_param_value(param_modes[1], memory, instr_ptr + 2, relative_base)
if test != 0:
instr_ptr = new_ptr
else:
instr_ptr = instr_ptr + 3
# JUMP-IF-FALSE - test, new_ptr
elif opcode == 6:
# process test
test = get_param_value(param_modes[0], memory, instr_ptr + 1, relative_base)
# process new_ptr
new_ptr = get_param_value(param_modes[1], memory, instr_ptr + 2, relative_base)
if test == 0:
instr_ptr = new_ptr
else:
instr_ptr = instr_ptr + 3
# LESS THAN - num1, num2, store
elif opcode == 7:
# process num1
num1 = get_param_value(param_modes[0], memory, instr_ptr + 1, relative_base)
# process num2
num2 = get_param_value(param_modes[1], memory, instr_ptr + 2, relative_base)
# process store
store = get_write_param_value(param_modes[2], memory, instr_ptr + 3, relative_base)
if num1 < num2:
memory[store] = 1
else:
memory[store] = 0
instr_ptr = instr_ptr + 4
# EQUALS - num1, num2, store
elif opcode == 8:
# process num1
num1 = get_param_value(param_modes[0], memory, instr_ptr + 1, relative_base)
# process num2
num2 = get_param_value(param_modes[1], memory, instr_ptr + 2, relative_base)
# process store
store = get_write_param_value(param_modes[2], memory, instr_ptr + 3, relative_base)
if num1 == num2:
memory[store] = 1
else:
memory[store] = 0
instr_ptr = instr_ptr + 4
# RELATIVE BASE OFFSET - offset
elif opcode == 9:
offset = get_param_value(param_modes[0], memory, instr_ptr + 1, relative_base)
relative_base += offset
instr_ptr = instr_ptr + 2
# unknown opcode
else:
raise Exception
raise Exception
def main():
"""Solve the problem!"""
script_dir = os.path.dirname(__file__)
file_path = os.path.join(script_dir, './input.txt')
with open(file_path) as input_file:
init_memory = list(map(int, input_file.read().split(',')))
# in order to support a memory larger than the program,
# copy program to a defaultdict with default value of 0
memory = defaultdict(lambda: 0)
for i in range(0, len(init_memory)):
memory[i] = init_memory[i]
# part 1, input is 1
# part 2, input is 2
input_list = [2]
run_intcode(memory, input_list)
if __name__ == "__main__":
main()
|
{
"content_hash": "b6b9463f928eed82413e48ce68f78908",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 100,
"avg_line_length": 37.13754646840149,
"alnum_prop": 0.642942942942943,
"repo_name": "kmcginn/advent-of-code",
"id": "55986f8439491822e39b5f6771a9da5eedebb3a6",
"size": "10001",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "2019/day09/intcode_sensor.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "189615"
}
]
}
|
<!DOCTYPE html>
<html ng-app="oppia" itemscope itemtype="http://schema.org/Organization">
<head>
@load('base-components/header.template.html', {"title": "Contributor Dashboard - Oppia"})
<style>
.headroom--unpinned {
transform: translateY(0);
}
</style>
</head>
<body>
<oppia-root>
<div ng-controller="Base">
<oppia-base-content>
<navbar-breadcrumb>
</navbar-breadcrumb>
<nav-options>
</nav-options>
<content>
<contributor-dashboard-page></contributor-dashboard-page>
</content>
<page-footer></page-footer>
</oppia-base-content>
</div>
</oppia-root>
@load('pages/footer_js_libs.html')
<script src="/third_party/static/MathJax-2.7.5/MathJax.js?config=default"></script>
</body>
</html>
|
{
"content_hash": "7fca029924266448079ffb276f043bd3",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 93,
"avg_line_length": 27.516129032258064,
"alnum_prop": 0.5779601406799532,
"repo_name": "oppia/oppia",
"id": "07df064ef12a75fbb817f0cda23ef2b2e0f89b66",
"size": "853",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "core/templates/pages/contributor-dashboard-page/contributor-dashboard-page.mainpage.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "476480"
},
{
"name": "HTML",
"bytes": "2092923"
},
{
"name": "JavaScript",
"bytes": "1247116"
},
{
"name": "PEG.js",
"bytes": "71377"
},
{
"name": "Python",
"bytes": "17628953"
},
{
"name": "Shell",
"bytes": "2240"
},
{
"name": "TypeScript",
"bytes": "15541372"
}
]
}
|
namespace openscreen {
TraceLoggingPlatform::~TraceLoggingPlatform() = default;
} // namespace openscreen
|
{
"content_hash": "e09e5fa7e161b1f522177b879ea333a6",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 56,
"avg_line_length": 21.8,
"alnum_prop": 0.7798165137614679,
"repo_name": "endlessm/chromium-browser",
"id": "35be2bf329b8a0a91a95d0eec6ac901920088a47",
"size": "325",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "third_party/openscreen/src/platform/api/trace_logging_platform.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": []
}
|
@interface UIButton (RemoveHighlight)
@property (assign, nonatomic) BOOL removeHighlight;
@end
|
{
"content_hash": "f94a16754d698211e25947533d84bb5f",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 51,
"avg_line_length": 19.4,
"alnum_prop": 0.7938144329896907,
"repo_name": "WLChopSticks/weiboCopys",
"id": "14dd6dec1f0f2d54c1297d011b6dfa8340d83737",
"size": "263",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "weibo/weibo/Classes/Main/Category/UIButton+RemoveHighlight.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "10471"
},
{
"name": "C++",
"bytes": "54683"
},
{
"name": "Objective-C",
"bytes": "1504668"
},
{
"name": "Objective-C++",
"bytes": "83484"
}
]
}
|
<?php
function downloadFile($filename) {
if (!file_exists($filename)) {
header('HTTP/1.0 404 Not Found');
//die('File doesn\'t exist');
die(1);
}
$from=0;
$cr=NULL;
$to=filesize($filename) - 1;
if (isset($_SERVER['HTTP_RANGE'])) {
list($a, $range) = explode("=",$_SERVER['HTTP_RANGE'],2);
list($range) = explode(",",$range,2);
list($from, $range_end) = explode("-", $range);
$from=intval($from);
if($range_end) {
$to=intval($range_end);
}
header('HTTP/1.1 206 Partial Content');
header('Content-Range: bytes ' . $from . '-' . $to.'/'.filesize($filename));
} else {
header('HTTP/1.1 200 Ok');
}
$size= $to - $from + 1;
header('Accept-Ranges: bytes');
header('Content-Length: ' . $size);
header('Connection: close');
header('Content-Type: application/octet-stream');
header('Last-Modified: ' . gmdate('r', filemtime($filename)));
$f=fopen($filename, 'r');
header('Content-Disposition: attachment; filename="' . basename($filename) . '";');
if ($from) fseek($f, $from, SEEK_SET);
$downloaded=0;
while(!feof($f) and !connection_status() and ($downloaded<$size)) {
$part = min(512000, $size-$downloaded);
echo fread($f, $part);
$downloaded+=$part;
flush();
}
fclose($f);
}
function url_exists($url) {
$hdrs = @get_headers($url);
return is_array($hdrs) ? preg_match('/^HTTP\\/\\d+\\.\\d+\\s+2\\d\\d\\s+.*$/',$hdrs[0]) : false;
}
function dwFile($filename,$query,$type) {
if($_SERVER['SERVER_NAME'] == 'download.osmand.net') {
header('HTTP/1.1 302 Found');
$var = rand(0, 99);
$simple = false;
if($type == "wiki" or $type == "" or $type == "road" or $type == "wikivoyage") {
$simple = true;
}
$helpServers = array("dl4.osmand.net");
$helpServersUS = array("dl4.osmand.net");
$mainServers = array("dl6.osmand.net", "dl5.osmand.net");
$mainServersLoad = 50;
$mainServersUSLoad = 50;
$helpServersCount = count($helpServers);
$helpServersUSCount = count($helpServersUS);
$mainServersCount = count($mainServers);
$record = @geoip_record_by_name($_SERVER['REMOTE_ADDR']);
if($type == "osmc" or $type == "aosmc" or $type == "fonts" or $type == "inapp") {
downloadFile($filename);
} else if($record and $record['country_code'] == 'US' and
$helpServersUSCount > 0 and $simple and $var < (100 - $mainServersUSLoad)) {
$url = $helpServersUS[$var % $helpServersUSCount];
header('Location: http://'.$url.'/download.php?'.$query);
} else if($helpServersCount > 0 and $simple and $var < (100 - $mainServersLoad)) {
$url = $helpServers[$var % $helpServersCount];
header('Location: http://'.$url.'/download.php?'.$query);
} else if($mainServersCount > 0) {
$url = $mainServers[$var % $mainServersCount];
header('Location: http://'.$url.'/download.php?'.$query);
} else {
downloadFile($filename);
}
} else {
downloadFile($filename);
}
}
function endsWith($haystack, $needle)
{
$length = strlen($needle);
if ($length == 0) {
return true;
}
return (substr($haystack, -$length) === $needle);
}
function loadIndexesFromDir($output, $outputIndexes, $dir, $elementName, $ftype){
$local_file = basename($_SERVER['PHP_SELF']) == basename(__FILE__);
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
$zip = new ZipArchive();
while (($file = readdir($dh)) !== false) {
$type= $ftype;
$filename = $dir . $file ; //"./test112.zip";
//print("processing file:" . $filename . "\n");
$indexName=$file;
$size = number_format((filesize($filename) / (1024.0*1024.0)), 1, '.', '');
$targetSize =$size;
$containerSize = filesize($filename);
$contentSize = filesize($filename);
if (strpos($file,'.voice') !== false) {
$type="voice";
} else if (strpos($file,'.gitignore') !== false) {
continue;
}
if(endsWith($file, ".sqlitedb")) {
$date= date('d.m.Y',filemtime($filename));
$timestamp = filemtime($filename);
$description = str_replace("_", " ", substr($file, 0, -9));
} else if(endsWith($file, ".sqlite")) {
$date= date('d.m.Y',filemtime($filename));
$timestamp = filemtime($filename);
$description = str_replace("_", " ", substr($file, 0, -7));
} else {
if ($zip->open($filename,ZIPARCHIVE::CHECKCONS)!==TRUE) {
// echo exit("cannot open <$filename>\n");
// print($filename . " cannot open as zip\n");
continue;
}
$description = $zip->getCommentIndex(0);
$stat = $zip->statIndex( 0 , ZIPARCHIVE::FL_UNCHANGED);
$targetSize = number_format($stat['size'] / (1024.0*1024.0), 1, '.', '');
$contentSize = $stat['size'];
$timestamp = $stat['mtime'];
$date= date('d.m.Y',$stat['mtime']);
$zip->close();
}
if($local_file) {
echo 'Local : '.$indexName.' '.$date.' '.$size.'<br>';
}
$out = $output->createElement( $elementName);
$outputIndexes->appendChild($out);
$out -> setAttribute("type", $type);
$out -> setAttribute("containerSize", $containerSize);
$out -> setAttribute("contentSize", $contentSize);
$out -> setAttribute("timestamp", $timestamp * 1000);
$out -> setAttribute("date", $date);
$out -> setAttribute("size", $size);
$out -> setAttribute("targetsize", $targetSize);
$out -> setAttribute("name", $indexName);
$out -> setAttribute("description", $description);
}
closedir($dh);
}
} else {
print($dir . " not a directory!\n");
}
}
?>
|
{
"content_hash": "daa93ed2d39aba4fae3d6209b10fc332",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 101,
"avg_line_length": 32.30635838150289,
"alnum_prop": 0.5729110753265343,
"repo_name": "Zahnstocher/osmandapp.github.io",
"id": "990820eca3135d7160540d024ae1c2783d9ec08b",
"size": "5589",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "website/download_utils.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "125321"
},
{
"name": "HTML",
"bytes": "644529"
},
{
"name": "JavaScript",
"bytes": "20446"
},
{
"name": "PHP",
"bytes": "318613"
}
]
}
|
import numpy as np
from hmmlearn import hmm
class HmmModel(object):
def __init__(self, nhs):
self.tag2idx = {}
self.idx2tag = {}
self.model = None
self.n_state = -1
self.n_hidden_state = nhs
return
def load_samples(self, datapath, update=False):
samples = []
# reset if required
if update:
self.n_state = 0
self.tag2idx, self.idx2tag = {}, {}
# load text data from file
with open(datapath, 'r') as fr:
lines = fr.readlines()
# extract samples and samples length
for line in lines:
tags = line.split()
if update:
# update current model's tag set
sample = []
for tag in tags:
if tag not in self.tag2idx:
self.tag2idx[tag] = self.n_state
self.idx2tag[self.n_state] = tag
self.n_state += 1
sample.append(tag)
else:
# only add tags that exist in current model's tag set
sample = [ tag for tag in tags if tag in self.tag2idx]
# add this sample into samples set
samples.append(sample)
return samples
def samples2array(self, samples):
samples_array,samples_length = [],[]
# flatten rows of samples to a single column vector
# used by the training function
for sample in samples:
length = 0
for tag in sample:
if tag not in self.tag2idx: continue
samples_array.append([self.tag2idx[tag]])
length += 1
if length: samples_length.append(length)
# return empty array if none of the tags exist in current model's tag set
return samples_array,samples_length
def train(self, datapath, n_epoch):
self.model = hmm.MultinomialHMM(n_components=self.n_hidden_state)
print '| loading training data...'
samples = self.load_samples(datapath, True)
samples_array,samples_length = self.samples2array(samples)
print '| start training'
for i in xrange(n_epoch):
print '| | training epoch %d...' % (i + 1)
self.model.fit(samples_array, samples_length)
print '| finished training'
return
def test(self, sample):
sa,l = self.samples2array(sample)
# if none of the tags in the sample exist in current model's tag set
# return minus infinite to indicate very low possibility
if not sa: return -float('inf')
sa = np.array(sa)
prob,_ = self.model.decode(sa,l)
return prob
if __name__ == '__main__':
pass
|
{
"content_hash": "e75d4958549fc4d96dddb21d9b99317d",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 77,
"avg_line_length": 30.049382716049383,
"alnum_prop": 0.6228430566967954,
"repo_name": "raybrshen/robot_sds",
"id": "9b4bfbe903a30b7ace9db21b29f7925cdb2c8211",
"size": "2489",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "SLU/hmm_model.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "2428"
},
{
"name": "CSS",
"bytes": "28424"
},
{
"name": "HTML",
"bytes": "6713"
},
{
"name": "JavaScript",
"bytes": "16666"
},
{
"name": "Python",
"bytes": "14699"
},
{
"name": "Shell",
"bytes": "5010"
}
]
}
|
package com.example.lukas.androidbluetooth;
import android.app.Activity;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.app.Fragment;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
/**
* Fragment used for managing interactions for and presentation of a navigation drawer.
* See the <a href="https://developer.android.com/design/patterns/navigation-drawer.html#Interaction">
* design guidelines</a> for a complete explanation of the behaviors implemented here.
*/
public class NavigationDrawerFragment extends Fragment {
/**
* Remember the position of the selected item.
*/
private static final String STATE_SELECTED_POSITION = "selected_navigation_drawer_position";
/**
* Per the design guidelines, you should show the drawer on launch until the user manually
* expands it. This shared preference tracks this.
*/
private static final String PREF_USER_LEARNED_DRAWER = "navigation_drawer_learned";
/**
* A pointer to the current callbacks instance (the Activity).
*/
private NavigationDrawerCallbacks mCallbacks;
/**
* Helper component that ties the action bar to the navigation drawer.
*/
private ActionBarDrawerToggle mDrawerToggle;
private DrawerLayout mDrawerLayout;
private ListView mDrawerListView;
private View mFragmentContainerView;
private int mCurrentSelectedPosition = 0;
private boolean mFromSavedInstanceState;
private boolean mUserLearnedDrawer;
public NavigationDrawerFragment() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Read in the flag indicating whether or not the user has demonstrated awareness of the
// drawer. See PREF_USER_LEARNED_DRAWER for details.
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false);
if (savedInstanceState != null) {
mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION);
mFromSavedInstanceState = true;
}
// Select either the default item (0) or the last selected item.
selectItem(mCurrentSelectedPosition);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Indicate that this fragment would like to influence the set of actions in the action bar.
setHasOptionsMenu(true);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mDrawerListView = (ListView) inflater.inflate(
R.layout.fragment_navigation_drawer, container, false);
mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
selectItem(position);
}
});
mDrawerListView.setAdapter(new ArrayAdapter<String>(
getActionBar().getThemedContext(),
android.R.layout.simple_list_item_activated_1,
android.R.id.text1,
new String[]{
getString(R.string.title_section1),
getString(R.string.title_section2),
getString(R.string.title_section3),
getString(R.string.title_section4),
}));
mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);
return mDrawerListView;
}
public boolean isDrawerOpen() {
return mDrawerLayout != null && mDrawerLayout.isDrawerOpen(mFragmentContainerView);
}
/**
* Users of this fragment must call this method to set up the navigation drawer interactions.
*
* @param fragmentId The android:id of this fragment in its activity's layout.
* @param drawerLayout The DrawerLayout containing this fragment's UI.
*/
public void setUp(int fragmentId, DrawerLayout drawerLayout) {
mFragmentContainerView = getActivity().findViewById(fragmentId);
mDrawerLayout = drawerLayout;
// set a custom shadow that overlays the main content when the drawer opens
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
// set up the drawer's list view with items and click listener
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
// ActionBarDrawerToggle ties together the the proper interactions
// between the navigation drawer and the action bar app icon.
mDrawerToggle = new ActionBarDrawerToggle(
getActivity(), /* host Activity */
mDrawerLayout, /* DrawerLayout object */
R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
R.string.navigation_drawer_open, /* "open drawer" description for accessibility */
R.string.navigation_drawer_close /* "close drawer" description for accessibility */
) {
@Override
public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView);
if (!isAdded()) {
return;
}
getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu()
}
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
if (!isAdded()) {
return;
}
if (!mUserLearnedDrawer) {
// The user manually opened the drawer; store this flag to prevent auto-showing
// the navigation drawer automatically in the future.
mUserLearnedDrawer = true;
SharedPreferences sp = PreferenceManager
.getDefaultSharedPreferences(getActivity());
sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).apply();
}
getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu()
}
};
// If the user hasn't 'learned' about the drawer, open it to introduce them to the drawer,
// per the navigation drawer design guidelines.
if (!mUserLearnedDrawer && !mFromSavedInstanceState) {
mDrawerLayout.openDrawer(mFragmentContainerView);
}
// Defer code dependent on restoration of previous instance state.
mDrawerLayout.post(new Runnable() {
@Override
public void run() {
mDrawerToggle.syncState();
}
});
mDrawerLayout.setDrawerListener(mDrawerToggle);
}
public void selectItem(int position) {
mCurrentSelectedPosition = position;
if (mDrawerListView != null) {
mDrawerListView.setItemChecked(position, true);
}
if (mDrawerLayout != null) {
mDrawerLayout.closeDrawer(mFragmentContainerView);
}
if (mCallbacks != null) {
mCallbacks.onNavigationDrawerItemSelected(position);
}
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
mCallbacks = (NavigationDrawerCallbacks) activity;
} catch (ClassCastException e) {
throw new ClassCastException("Activity must implement NavigationDrawerCallbacks.");
}
}
@Override
public void onDetach() {
super.onDetach();
mCallbacks = null;
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
// Forward the new configuration the drawer toggle component.
mDrawerToggle.onConfigurationChanged(newConfig);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
// If the drawer is open, show the global app actions in the action bar. See also
// showGlobalContextActionBar, which controls the top-left area of the action bar.
if (mDrawerLayout != null && isDrawerOpen()) {
inflater.inflate(R.menu.global, menu);
showGlobalContextActionBar();
}
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* Per the navigation drawer design guidelines, updates the action bar to show the global app
* 'context', rather than just what's in the current screen.
*/
private void showGlobalContextActionBar() {
ActionBar actionBar = getActionBar();
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
actionBar.setTitle(R.string.app_name);
}
private ActionBar getActionBar() {
return ((ActionBarActivity) getActivity()).getSupportActionBar();
}
/**
* Callbacks interface that all activities using this fragment must implement.
*/
public static interface NavigationDrawerCallbacks {
/**
* Called when an item in the navigation drawer is selected.
*/
void onNavigationDrawerItemSelected(int position);
}
}
|
{
"content_hash": "386a19994d282913008b1cb94dd42fb0",
"timestamp": "",
"source": "github",
"line_count": 278,
"max_line_length": 102,
"avg_line_length": 38.10791366906475,
"alnum_prop": 0.6548989994336417,
"repo_name": "sakulstra/bluegraph",
"id": "64667e19f635b6337bfe8ad73d27f2b5657fd86f",
"size": "10594",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/com/example/lukas/androidbluetooth/NavigationDrawerFragment.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "51466"
}
]
}
|
export default function getDisplayName(Component: Function | string): string {
if (typeof Component === 'string') {
return Component;
}
if (!Component) {
// Should never actually reach here, Function cannot be falsy.
return 'undefined';
}
return Component.displayName || Component.name || 'Component';
}
|
{
"content_hash": "f29935ed44dcc728f6d7908c8dc166c0",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 78,
"avg_line_length": 32.6,
"alnum_prop": 0.6901840490797546,
"repo_name": "blainekasten/enzyme-matchers",
"id": "4af8e660356bf8e102ad23d78515fc4a1c04cb6f",
"size": "336",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packages/enzyme-matchers/src/utils/displayName.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "96638"
}
]
}
|
class MenuPanel < Shoes::Widget
@@boxes = []
# Handling width against internal stack until widget widths are fixed
# https://github.com/shoes/shoes4/issues/641
def width
@stack.width
end
def width=(value)
@stack.width = value
end
def initialize(color, args)
@@boxes << self
@stack = stack(args) do
background color
para link("Box #{@@boxes.length}", fg: white, fill: nil, click: "/"),
margin: 18, align: "center", size: 20
hover { expand }
end
end
def expand
if self.width < 170
a = animate 30 do
@@boxes.each do |b|
b.width -= 5 if b != self and b.width > 140
end
self.width += 5
a.stop if self.width >= 170
end
end
end
end
Shoes.app width: 600, height: 130 do
style(Shoes::Link, underline: nil)
# hover styling currently a no-op https://github.com/shoes/shoes4/issues/638
style(Shoes::LinkHover, fill: nil, underline: nil)
menu_panel green, width: 170, height: 120, margin: 4
menu_panel blue, width: 140, height: 120, margin: 4
menu_panel red, width: 140, height: 120, margin: 4
menu_panel purple, width: 140, height: 120, margin: 4
end
|
{
"content_hash": "532c76c9231dd8035385cce12c4f7e5a",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 78,
"avg_line_length": 25.4468085106383,
"alnum_prop": 0.6187290969899666,
"repo_name": "wasnotrice/shoes-atom",
"id": "702ae611bf04846521f2277184341d76b15ced4f",
"size": "1196",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "samples/simple-menu.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "459"
},
{
"name": "JavaScript",
"bytes": "1523"
},
{
"name": "Ruby",
"bytes": "237118"
}
]
}
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library PUBLIC "-//NetBeans//DTD Library Declaration 1.0//EN" "http://www.netbeans.org/dtds/library-declaration-1_0.dtd">
<library version='1.0' encoding='UTF-8'>
<name>jme3-android-native</name>
<type>j2se</type>
<localizing-bundle>com.jme3.gde.project.baselibs.Bundle</localizing-bundle>
<volume>
<type>classpath</type>
<resource>jar:nbinst://com.jme3.gde.project.baselibs/libs/jme3-android-native-3.1.0-SNAPSHOT.jar!/</resource>
</volume>
<volume>
<type>src</type>
<resource>jar:nbinst://com.jme3.gde.project.baselibs/libs/jme3-android-native-3.1.0-SNAPSHOT-sources.jar!/</resource>
</volume>
<volume>
<type>javadoc</type>
<resource>jar:nbinst://com.jme3.gde.project.baselibs/libs/jme3-android-native-3.1.0-SNAPSHOT-javadoc.jar!/</resource>
</volume>
</library>
|
{
"content_hash": "e5efb3a037d2b4b7b3a835eadb4dd92d",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 131,
"avg_line_length": 45,
"alnum_prop": 0.7076023391812866,
"repo_name": "d235j/jmonkeyengine",
"id": "81b421624272a18ad936cced5975520e6ec16095",
"size": "855",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "sdk/jme3-project-baselibs/src/com/jme3/gde/project/baselibs/jme3-android-native.xml",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "36480"
},
{
"name": "C++",
"bytes": "336392"
},
{
"name": "GLSL",
"bytes": "215501"
},
{
"name": "HTML",
"bytes": "1599217"
},
{
"name": "Java",
"bytes": "15652902"
},
{
"name": "Makefile",
"bytes": "6895"
},
{
"name": "Python",
"bytes": "307608"
},
{
"name": "Shell",
"bytes": "1442"
}
]
}
|
<?xml version="1.0" encoding="UTF-8"?>
<orm:entity-mappings
xmlns:orm="http://www.eclipse.org/eclipselink/xsds/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<orm:persistence-unit-metadata>
<orm:xml-mapping-metadata-complete>true
</orm:xml-mapping-metadata-complete>
<orm:exclude-default-mappings>true</orm:exclude-default-mappings>
<orm:persistence-unit-defaults>
<orm:access>VIRTUAL</orm:access>
<orm:access-methods get-method="get" set-method="set" />
</orm:persistence-unit-defaults>
</orm:persistence-unit-metadata>
<orm:package>com.flexdms.flexims.dynamic.model.generated</orm:package>
<orm:table-generator name="TypedQueryseq" table="seqs"
pk-column-name="name" value-column-name="seq" pk-column-value="TypedQuery"
initial-value="10000" allocation-size="50" />
<orm:entity name="TypedQuery" class="TypedQuery"
parent-class="com.flexdms.flexims.jpa.eclipselink.FleximsDynamicEntityImpl"
access="VIRTUAL">
<orm:description>Query for a type</orm:description>
<orm:inheritance />
<orm:discriminator-value>TypedQuery</orm:discriminator-value>
<orm:discriminator-column discriminator-type="String"
length="40" />
<orm:property name="abstract" value="true"/>
<orm:property name="system" value="True" />
<orm:property name="showInAdd" value="false" />
<orm:property name="showInAllReport" value="false" />
<orm:attributes>
<orm:id name="id" attribute-type="Long">
<orm:column />
<orm:generated-value strategy="TABLE" generator="TypedQueryseq" />
<orm:access-methods get-method="get" set-method="set" />
</orm:id>
<orm:version name="fxversion" mutable="true"
attribute-type="java.sql.Timestamp">
<orm:column />
<orm:access-methods get-method="get" set-method="set" />
</orm:version>
<orm:basic name="Name" optional="false" attribute-type="java.lang.String">
<orm:column unique="true" nullable="false" length="254" />
<orm:property name="typeidx" value="0" />
<orm:property name="viewable" value="true" />
<orm:property name="editable" value="true" />
<orm:property name="summaryprop" value="true" />
<orm:access-methods get-method="get" set-method="set" />
</orm:basic>
<orm:basic name="Description" optional="true"
attribute-type="java.lang.String">
<orm:column unique="false" nullable="true" length="254" />
<orm:property name="typeidx" value="0" />
<orm:property name="viewable" value="true" />
<orm:property name="editable" value="true" />
<orm:access-methods get-method="get" set-method="set" />
</orm:basic>
<orm:basic name="TargetedType" optional="false"
attribute-type="java.lang.String">
<orm:column unique="false" nullable="false" length="254" />
<orm:property name="typeidx" value="0" />
<orm:property name="viewable" value="true" />
<orm:property name="editable" value="true" />
<orm:property name="displaytext" value="Query For" />
<orm:access-methods get-method="get" set-method="set" />
</orm:basic>
<orm:one-to-many name="Reports" target-entity="FxReport" mapped-by="Query" attribute-type="java.util.List">
<orm:property name="displaytext" value="Reports Associated with is query" />
</orm:one-to-many>
</orm:attributes>
</orm:entity>
<orm:entity name="JPQL" class="JPQL" parent-class="TypedQuery"
access="VIRTUAL">
<orm:description>Java Persistence Query</orm:description>
<orm:discriminator-value>JPQL</orm:discriminator-value>
<orm:property name="entity" value="true" />
<orm:property name="system" value="True" />
<orm:property name="showInAdd" value="false" />
<orm:property name="showInAllReport" value="false" />
<orm:attributes>
<orm:basic name="JPQLText" optional="true" attribute-type="java.lang.String">
<orm:column unique="false" nullable="true" length="4096" />
<orm:property name="typeidx" value="1" />
<orm:property name="viewable" value="true" />
<orm:property name="editable" value="true" />
<orm:property name="autogenerate" value="true" />
<orm:access-methods get-method="get" set-method="set" />
</orm:basic>
</orm:attributes>
</orm:entity>
<orm:entity name="DefaultTypedQuery" class="DefaultTypedQuery"
parent-class="TypedQuery" access="VIRTUAL">
<orm:discriminator-value>DefaultTypedQuery</orm:discriminator-value>
<orm:property name="entity" value="true" />
<orm:property name="system" value="True" />
<orm:property name="showInAdd" value="false" />
<orm:property name="showInAllReport" value="false" />
<orm:attributes>
<orm:element-collection name="Conditions"
target-class="PropertyCondition" attribute-type="java.util.List">
<orm:column unique="false" nullable="true" length="254" />
<orm:collection-table>
<orm:join-column />
</orm:collection-table>
<orm:cascade-on-delete>false</orm:cascade-on-delete>
<orm:property name="typeidx" value="-1" />
<orm:property name="viewable" value="true" />
<orm:property name="editable" value="true" />
<orm:access-methods get-method="get" set-method="set" />
</orm:element-collection>
<!-- <orm:one-to-many name="Tracedby" target-entity="PropertyCondition" mapped-by="TraceDown" attribute-type="java.util.List"> -->
<!-- <orm:property name="displaytext" value="Traced Down by" /> -->
<!-- </orm:one-to-many> -->
</orm:attributes>
</orm:entity>
<orm:embeddable class="PropertyCondition"
parent-class="com.flexdms.flexims.jpa.eclipselink.FleximsDynamicEntityImpl"
access="VIRTUAL">
<orm:description>A query condition on one property</orm:description>
<orm:property name="system" value="True" />
<orm:attributes>
<orm:basic name="Property" optional="false" attribute-type="java.lang.String">
<orm:column unique="false" nullable="false" length="254" />
<orm:property name="typeidx" value="0" />
<orm:property name="viewable" value="true" />
<orm:property name="editable" value="true" />
<orm:property name="summaryprop" value="true" />
<orm:property name="displaytext" value="Property" />
<orm:property name="maxlen" value="254" />
<orm:access-methods get-method="get" set-method="set" />
</orm:basic>
<orm:basic name="Operator" optional="false" attribute-type="java.lang.String">
<orm:column unique="false" nullable="false" length="20" />
<orm:property name="typeidx" value="0" />
<orm:property name="viewable" value="true" />
<orm:property name="editable" value="true" />
<orm:property name="summaryprop" value="true" />
<orm:access-methods get-method="get" set-method="set" />
</orm:basic>
<orm:basic name="RelativeStartDate" optional="true"
attribute-type="java.lang.Integer">
<orm:column unique="false" nullable="true" length="254" />
<orm:property name="typeidx" value="3" />
<orm:property name="viewable" value="true" />
<orm:property name="editable" value="false" />
<orm:property name="displaytext" value="Relative to query execution time"/>
<orm:access-methods get-method="get" set-method="set" />
</orm:basic>
<orm:basic name="RelativeStartUnit" optional="true"
attribute-type="java.lang.String">
<orm:column unique="false" nullable="true" length="10" />
<orm:property name="typeidx" value="0" />
<orm:property name="viewable" value="true" />
<orm:property name="editable" value="false" />
<orm:access-methods get-method="get" set-method="set" />
</orm:basic>
<orm:basic name="FirstValue" optional="true"
attribute-type="java.lang.String">
<orm:column unique="false" nullable="true" length="254" />
<orm:property name="typeidx" value="0" />
<orm:property name="viewable" value="true" />
<orm:property name="editable" value="true" />
<orm:property name="displaytext" value="Value"/>
<orm:property name="tooltip" value="Multiple value separated by ,"/>
<orm:access-methods get-method="get" set-method="set" />
</orm:basic>
<orm:basic name="RelativeEndDate" optional="true"
attribute-type="java.lang.Integer">
<orm:column unique="false" nullable="true" length="254" />
<orm:property name="typeidx" value="3" />
<orm:property name="viewable" value="true" />
<orm:property name="editable" value="false" />
<orm:property name="displaytext" value="Relative to query execution time for between"/>
<orm:access-methods get-method="get" set-method="set" />
</orm:basic>
<orm:basic name="RelativeEndUnit" optional="true"
attribute-type="java.lang.String">
<orm:column unique="false" nullable="true" length="10" />
<orm:property name="typeidx" value="0" />
<orm:property name="viewable" value="true" />
<orm:property name="editable" value="false" />
<orm:access-methods get-method="get" set-method="set" />
</orm:basic>
<orm:basic name="SecondValue" optional="true"
attribute-type="java.lang.String">
<orm:column unique="false" nullable="true" length="254" />
<orm:property name="typeidx" value="0" />
<orm:property name="viewable" value="true" />
<orm:property name="editable" value="true" />
<orm:property name="displaytext" value="second value for between"/>
<orm:access-methods get-method="get" set-method="set" />
</orm:basic>
<orm:basic name="Description" optional="true"
attribute-type="java.lang.String">
<orm:column unique="false" nullable="true" length="254" />
<orm:property name="typeidx" value="0" />
<orm:property name="viewable" value="true" />
<orm:property name="editable" value="true" />
<orm:property name="displaytext" value="Description for this restriction"/>
<orm:access-methods get-method="get" set-method="set" />
</orm:basic>
<orm:basic name="IgnoreCase" optional="true"
attribute-type="boolean">
<orm:column unique="false" nullable="true" length="254" />
<orm:property name="typeidx" value="9" />
<orm:property name="viewable" value="true" />
<orm:property name="editable" value="true" />
<orm:property name="displaytext" value="Case insensitive when comparing characters"/>
<orm:access-methods get-method="get" set-method="set" />
</orm:basic>
<orm:many-to-one name="TraceDown" target-entity="DefaultTypedQuery" optional="true">
<orm:property name="displaytext" value="Apply drill down query to related entity"/>
</orm:many-to-one>
<orm:basic name="WholeTime" optional="true" attribute-type="boolean">
<orm:column unique="false" nullable="true" length="254" />
<orm:property name="typeidx" value="9" />
<orm:property name="viewable" value="true" />
<orm:property name="editable" value="false" />
<orm:property name="defaultvalue" value="true" />
<orm:property name="displaytext" value="ignore fractional when using relative time"/>
<orm:access-methods get-method="get" set-method="set" />
</orm:basic>
<orm:basic name="CollectionMode" optional="true"
attribute-type="java.lang.String">
<orm:column unique="false" nullable="true" length="10" />
<orm:property name="typeidx" value="0" />
<orm:property name="viewable" value="true" />
<orm:property name="editable" value="true" />
<orm:property name="displaytext" value="How to apply condition to elements in collection"/>
<orm:property name="allowedvalues.0.value" value="some"/>
<orm:property name="allowedvalues.0.display" value=""/>
<orm:property name="allowedvalues.1.value" value="all"/>
<orm:property name="allowedvalues.1.display" value=""/>
<orm:property name="allowedvalues.2.value" value="none"/>
<orm:property name="allowedvalues.2.display" value=""/>
<orm:property name="defaultvalue" value="all" />
<orm:access-methods get-method="get" set-method="set" />
</orm:basic>
</orm:attributes>
</orm:embeddable>
</orm:entity-mappings>
|
{
"content_hash": "2a9611413194028a4280dfc685bc2b77",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 133,
"avg_line_length": 47.810483870967744,
"alnum_prop": 0.6763093531247364,
"repo_name": "jasonzhang2022/flexims",
"id": "bc265c687b52cd06f004ad67b8194be18b16cbca",
"size": "11857",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "report/src/main/resources/META-INF/query_model_orm.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "4694"
},
{
"name": "HTML",
"bytes": "124441"
},
{
"name": "Java",
"bytes": "960480"
},
{
"name": "JavaScript",
"bytes": "1249540"
},
{
"name": "Shell",
"bytes": "621"
}
]
}
|
import datetime
from django.db import models
from django.db.models import permalink
from django.core.mail import send_mass_mail
from django.template import loader, Context
from django.conf import settings
from django.contrib.sites.models import Site
ATTENDING_CHOICES = (
('yes', 'Yes'),
('no', 'No'),
('maybe', 'Maybe'),
('no_rsvp', 'Hasn\'t RSVPed yet')
)
class Event(models.Model):
title = models.CharField(max_length=255)
slug = models.SlugField()
description = models.TextField()
date_of_event = models.DateTimeField()
verification_code = models.CharField(max_length=32, blank=True, default='', help_text='Present for future extension/guest verification.')
email_subject = models.CharField(max_length=255, help_text='The subject line for the e-mail sent out to guests.')
email_message = models.TextField(help_text='The body of the e-mail sent out to guests.')
hosted_by = models.CharField(max_length=255, help_text='The name of the person/organization hosting the event.', blank=True, default='')
street_address = models.CharField(max_length=255, help_text='The street address where the event is being held.', blank=True, default='')
city = models.CharField(max_length=64, help_text='The city where the event is being held.', blank=True, default='')
state = models.CharField(max_length=64, help_text='The state where the event is being held.', blank=True, default='')
zip_code = models.CharField(max_length=10, help_text='The zip code where the event is being held.', blank=True, default='')
telephone = models.CharField(max_length=20, blank=True, default='')
created = models.DateTimeField(default=datetime.datetime.now)
updated = models.DateTimeField(blank=True, null=True)
def __unicode__(self):
return self.title
def save(self, *args, **kwargs):
self.updated = datetime.datetime.now()
super(Event, self).save(*args, **kwargs)
def get_absolute_url(self):
return ('rsvp_event_view', [self.slug])
get_absolute_url = permalink(get_absolute_url)
def guests_attending(self):
return self.guests.filter(attending_status='yes')
def guests_not_attending(self):
return self.guests.filter(attending_status='no')
def guests_may_attend(self):
return self.guests.filter(attending_status='maybe')
def guests_no_rsvp(self):
return self.guests.filter(attending_status='no_rsvp')
def send_guest_emails(self):
"""
Sends an invite e-mail to all guest who have not RSVPed.
Requires settings RSVP_FROM_EMAIL in your settings file. Returns a
count of the number of guests e-mailed.
"""
mass_mail_data = []
from_email = getattr(settings, 'RSVP_FROM_EMAIL', '')
for guest in self.guests_no_rsvp():
t = loader.get_template('rsvp/event_email.txt')
c = Context({
'event': self,
'site': Site.objects.get_current(),
})
message = t.render(c)
mass_mail_data.append([self.email_subject, message, from_email, [guest.email]])
send_mass_mail(mass_mail_data, fail_silently=True)
return self.guests_no_rsvp().count()
class Guest(models.Model):
event = models.ForeignKey(Event, related_name='guests')
email = models.EmailField()
name = models.CharField(max_length=128, blank=True, default='')
attending_status = models.CharField(max_length=32, choices=ATTENDING_CHOICES, default='no_rsvp')
number_of_guests = models.SmallIntegerField(default=0)
comment = models.CharField(max_length=255, blank=True, default='')
created = models.DateTimeField(default=datetime.datetime.now)
updated = models.DateTimeField(blank=True, null=True)
def __unicode__(self):
return u"%s - %s - %s" % (self.event.title, self.email, self.attending_status)
class Meta:
unique_together = ('event', 'email')
def save(self, *args, **kwargs):
self.updated = datetime.datetime.now()
super(Guest, self).save(*args, **kwargs)
|
{
"content_hash": "6a0943e5a40155736065caa7a420d1e6",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 141,
"avg_line_length": 42.121212121212125,
"alnum_prop": 0.6573141486810552,
"repo_name": "toastdriven/django-rsvp",
"id": "398dadb513e5d1b49768fdf1eed7acc02da99d58",
"size": "4170",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "rsvp/models.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "12712"
}
]
}
|
package cryodex.modules.destiny;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import cryodex.CryodexController.Modules;
import cryodex.Player;
import cryodex.modules.ExportController;
import cryodex.modules.Match;
import cryodex.modules.RoundPanel;
import cryodex.modules.Tournament;
import cryodex.modules.TournamentComparator;
import cryodex.modules.destiny.export.DestinyExportController;
import cryodex.modules.destiny.gui.DestinyRankingTable;
import cryodex.modules.destiny.gui.DestinyRoundPanel;
import cryodex.widget.wizard.WizardOptions;
import cryodex.xml.XMLObject;
import cryodex.xml.XMLUtils.Element;
public class DestinyTournament extends Tournament implements XMLObject {
private DestinyExportController exportController;
public DestinyTournament(Element tournamentElement) {
super();
setupTournamentGUI(new DestinyRankingTable(this));
loadXML(tournamentElement);
}
public DestinyTournament(WizardOptions wizardOptions) {
super(wizardOptions);
setupTournamentGUI(new DestinyRankingTable(this));
}
@Override
public void massDropPlayers(int minScore, int maxCount) {
List<Player> playerList = new ArrayList<Player>();
playerList.addAll(getPlayers());
Collections.sort(playerList, new DestinyComparator(this, DestinyComparator.rankingCompare));
int count = 0;
for (Player p : playerList) {
DestinyPlayer xp = getModulePlayer(p);
if (xp.getScore(this) < minScore || count >= maxCount) {
getPlayers().remove(p);
} else {
count++;
}
}
triggerDeepChange();
}
@Override
public Icon getIcon() {
URL imgURL = DestinyTournament.class.getResource("d.png");
if (imgURL == null) {
System.out.println("Failed to retrieve Destiny Icon");
}
ImageIcon icon = new ImageIcon(imgURL);
return icon;
}
@Override
public String getModuleName() {
return Modules.DESTINY.getName();
}
@Override
public RoundPanel getRoundPanel(List<Match> matches) {
return new DestinyRoundPanel(this, matches);
}
public DestinyPlayer getModulePlayer(Player p){
return (DestinyPlayer) p.getModuleInfoByModule(getModule());
}
@Override
public TournamentComparator<Player> getRankingComparator() {
return new DestinyComparator(this, DestinyComparator.rankingCompare);
}
@Override
public TournamentComparator<Player> getRankingNoHeadToHeadComparator() {
return new DestinyComparator(this, DestinyComparator.rankingCompare);
}
@Override
public TournamentComparator<Player> getPairingComparator() {
return new DestinyComparator(this, DestinyComparator.pairingCompare);
}
@Override
public int getPointsDefault() {
return 100;
}
@Override
public ExportController getExportController() {
if(exportController == null){
exportController = new DestinyExportController();
}
return exportController;
}
@Override
public boolean isMatchComplete(Match m) {
boolean isComplete = false;
if (m.isBye()) {
isComplete = true;
} else if (m.getWinner(1) != null) {
isComplete = true;
}
return isComplete;
}
@Override
public boolean isValidResult(Match m) {
return isMatchComplete(m);
}
}
|
{
"content_hash": "feace4f41458c56c7007343a497c3cef",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 100,
"avg_line_length": 26.40909090909091,
"alnum_prop": 0.7048192771084337,
"repo_name": "Killerardvark/CryodexSource",
"id": "7eb2590deec8897cee180decf368e4acc1b21b0e",
"size": "3486",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/cryodex/modules/destiny/DestinyTournament.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "5675"
},
{
"name": "HTML",
"bytes": "6565"
},
{
"name": "Java",
"bytes": "794162"
}
]
}
|
Quickstart App with @covalent packages
## Setup
* Ensure you have Node 4.4+ and NPM 3+ installed.
* Install Angular CLI `npm i -g @angular/cli@latest`
* Install Typescript 2.0 `npm i -g typescript`
* Install TSLint `npm install -g tslint`
* Install Protractor for e2e testing `npm install -g protractor`
* Install Node packages `npm i`
* Update Webdriver `webdriver-manager update` and `./node_modules/.bin/webdriver-manager update`
* Run local build `ng serve`
* To deploy gh-pages:
* Set the origin with `https://{username:password@}github.com/{owner}/{repo}`
* then `ngh --no-silent`
|
{
"content_hash": "647aa44f6dc86294a9385d333d7b687a",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 96,
"avg_line_length": 36.875,
"alnum_prop": 0.7288135593220338,
"repo_name": "MarcoCaballero/tfg-blog-testmanagement",
"id": "795d5ee0bba5e25c26c39f3c6b03ff1e897513a7",
"size": "613",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "20187"
},
{
"name": "HTML",
"bytes": "32119"
},
{
"name": "JavaScript",
"bytes": "2390"
},
{
"name": "Shell",
"bytes": "768"
},
{
"name": "TypeScript",
"bytes": "38587"
}
]
}
|
#pragma once
#include <aws/dms/DatabaseMigrationService_EXPORTS.h>
#include <aws/dms/DatabaseMigrationServiceRequest.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/dms/model/Filter.h>
#include <utility>
namespace Aws
{
namespace DatabaseMigrationService
{
namespace Model
{
/**
* <p/><p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/DescribeEndpointTypesMessage">AWS
* API Reference</a></p>
*/
class AWS_DATABASEMIGRATIONSERVICE_API DescribeEndpointTypesRequest : public DatabaseMigrationServiceRequest
{
public:
DescribeEndpointTypesRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "DescribeEndpointTypes"; }
Aws::String SerializePayload() const override;
Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;
/**
* <p>Filters applied to the describe action.</p> <p>Valid filter names:
* engine-name | endpoint-type</p>
*/
inline const Aws::Vector<Filter>& GetFilters() const{ return m_filters; }
/**
* <p>Filters applied to the describe action.</p> <p>Valid filter names:
* engine-name | endpoint-type</p>
*/
inline void SetFilters(const Aws::Vector<Filter>& value) { m_filtersHasBeenSet = true; m_filters = value; }
/**
* <p>Filters applied to the describe action.</p> <p>Valid filter names:
* engine-name | endpoint-type</p>
*/
inline void SetFilters(Aws::Vector<Filter>&& value) { m_filtersHasBeenSet = true; m_filters = std::move(value); }
/**
* <p>Filters applied to the describe action.</p> <p>Valid filter names:
* engine-name | endpoint-type</p>
*/
inline DescribeEndpointTypesRequest& WithFilters(const Aws::Vector<Filter>& value) { SetFilters(value); return *this;}
/**
* <p>Filters applied to the describe action.</p> <p>Valid filter names:
* engine-name | endpoint-type</p>
*/
inline DescribeEndpointTypesRequest& WithFilters(Aws::Vector<Filter>&& value) { SetFilters(std::move(value)); return *this;}
/**
* <p>Filters applied to the describe action.</p> <p>Valid filter names:
* engine-name | endpoint-type</p>
*/
inline DescribeEndpointTypesRequest& AddFilters(const Filter& value) { m_filtersHasBeenSet = true; m_filters.push_back(value); return *this; }
/**
* <p>Filters applied to the describe action.</p> <p>Valid filter names:
* engine-name | endpoint-type</p>
*/
inline DescribeEndpointTypesRequest& AddFilters(Filter&& value) { m_filtersHasBeenSet = true; m_filters.push_back(std::move(value)); return *this; }
/**
* <p> The maximum number of records to include in the response. If more records
* exist than the specified <code>MaxRecords</code> value, a pagination token
* called a marker is included in the response so that the remaining results can be
* retrieved. </p> <p>Default: 100</p> <p>Constraints: Minimum 20, maximum 100.</p>
*/
inline int GetMaxRecords() const{ return m_maxRecords; }
/**
* <p> The maximum number of records to include in the response. If more records
* exist than the specified <code>MaxRecords</code> value, a pagination token
* called a marker is included in the response so that the remaining results can be
* retrieved. </p> <p>Default: 100</p> <p>Constraints: Minimum 20, maximum 100.</p>
*/
inline void SetMaxRecords(int value) { m_maxRecordsHasBeenSet = true; m_maxRecords = value; }
/**
* <p> The maximum number of records to include in the response. If more records
* exist than the specified <code>MaxRecords</code> value, a pagination token
* called a marker is included in the response so that the remaining results can be
* retrieved. </p> <p>Default: 100</p> <p>Constraints: Minimum 20, maximum 100.</p>
*/
inline DescribeEndpointTypesRequest& WithMaxRecords(int value) { SetMaxRecords(value); return *this;}
/**
* <p> An optional pagination token provided by a previous request. If this
* parameter is specified, the response includes only records beyond the marker, up
* to the value specified by <code>MaxRecords</code>. </p>
*/
inline const Aws::String& GetMarker() const{ return m_marker; }
/**
* <p> An optional pagination token provided by a previous request. If this
* parameter is specified, the response includes only records beyond the marker, up
* to the value specified by <code>MaxRecords</code>. </p>
*/
inline void SetMarker(const Aws::String& value) { m_markerHasBeenSet = true; m_marker = value; }
/**
* <p> An optional pagination token provided by a previous request. If this
* parameter is specified, the response includes only records beyond the marker, up
* to the value specified by <code>MaxRecords</code>. </p>
*/
inline void SetMarker(Aws::String&& value) { m_markerHasBeenSet = true; m_marker = std::move(value); }
/**
* <p> An optional pagination token provided by a previous request. If this
* parameter is specified, the response includes only records beyond the marker, up
* to the value specified by <code>MaxRecords</code>. </p>
*/
inline void SetMarker(const char* value) { m_markerHasBeenSet = true; m_marker.assign(value); }
/**
* <p> An optional pagination token provided by a previous request. If this
* parameter is specified, the response includes only records beyond the marker, up
* to the value specified by <code>MaxRecords</code>. </p>
*/
inline DescribeEndpointTypesRequest& WithMarker(const Aws::String& value) { SetMarker(value); return *this;}
/**
* <p> An optional pagination token provided by a previous request. If this
* parameter is specified, the response includes only records beyond the marker, up
* to the value specified by <code>MaxRecords</code>. </p>
*/
inline DescribeEndpointTypesRequest& WithMarker(Aws::String&& value) { SetMarker(std::move(value)); return *this;}
/**
* <p> An optional pagination token provided by a previous request. If this
* parameter is specified, the response includes only records beyond the marker, up
* to the value specified by <code>MaxRecords</code>. </p>
*/
inline DescribeEndpointTypesRequest& WithMarker(const char* value) { SetMarker(value); return *this;}
private:
Aws::Vector<Filter> m_filters;
bool m_filtersHasBeenSet;
int m_maxRecords;
bool m_maxRecordsHasBeenSet;
Aws::String m_marker;
bool m_markerHasBeenSet;
};
} // namespace Model
} // namespace DatabaseMigrationService
} // namespace Aws
|
{
"content_hash": "9b335ccdd3e95abed22c487a11f62564",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 152,
"avg_line_length": 41.99411764705882,
"alnum_prop": 0.6867908670682168,
"repo_name": "JoyIfBam5/aws-sdk-cpp",
"id": "2b1b14cf0297651292b40ea8b6380be89c13e6ac",
"size": "7712",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "aws-cpp-sdk-dms/include/aws/dms/model/DescribeEndpointTypesRequest.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "11868"
},
{
"name": "C++",
"bytes": "167818064"
},
{
"name": "CMake",
"bytes": "591577"
},
{
"name": "HTML",
"bytes": "4471"
},
{
"name": "Java",
"bytes": "271801"
},
{
"name": "Python",
"bytes": "85650"
},
{
"name": "Shell",
"bytes": "5277"
}
]
}
|
using namespace json_spirit;
using namespace std;
void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out, bool fIncludeHex);
double GetDifficulty(const CBlockIndex* blockindex)
{
// Floating point number that is a multiple of the minimum difficulty,
// minimum difficulty = 1.0.
if (blockindex == NULL)
{
if (chainActive.Tip() == NULL)
return 1.0;
else
blockindex = chainActive.Tip();
}
int nShift = (blockindex->nBits >> 24) & 0xff;
double dDiff =
(double)0x0000ffff / (double)(blockindex->nBits & 0x00ffffff);
while (nShift < 29)
{
dDiff *= 256.0;
nShift++;
}
while (nShift > 29)
{
dDiff /= 256.0;
nShift--;
}
return dDiff;
}
Object blockToJSON(const CBlock& block, const CBlockIndex* blockindex)
{
Object result;
result.push_back(Pair("hash", block.GetHash().GetHex()));
CMerkleTx txGen(block.vtx[0]);
txGen.SetMerkleBranch(&block);
result.push_back(Pair("confirmations", (int)txGen.GetDepthInMainChain()));
result.push_back(Pair("size", (int)::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION)));
result.push_back(Pair("height", blockindex->nHeight));
result.push_back(Pair("version", block.nVersion));
result.push_back(Pair("merkleroot", block.hashMerkleRoot.GetHex()));
Array txs;
BOOST_FOREACH(const CTransaction&tx, block.vtx)
txs.push_back(tx.GetHash().GetHex());
result.push_back(Pair("tx", txs));
result.push_back(Pair("time", block.GetBlockTime()));
result.push_back(Pair("nonce", (uint64_t)block.nNonce));
result.push_back(Pair("bits", HexBits(block.nBits)));
result.push_back(Pair("difficulty", GetDifficulty(blockindex)));
result.push_back(Pair("chainwork", blockindex->nChainWork.GetHex()));
if (blockindex->pprev)
result.push_back(Pair("previousblockhash", blockindex->pprev->GetBlockHash().GetHex()));
CBlockIndex *pnext = chainActive.Next(blockindex);
if (pnext)
result.push_back(Pair("nextblockhash", pnext->GetBlockHash().GetHex()));
return result;
}
Value getblockcount(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"getblockcount\n"
"\nReturns the number of blocks in the longest block chain.\n"
"\nResult:\n"
"n (numeric) The current block count\n"
"\nExamples:\n"
+ HelpExampleCli("getblockcount", "")
+ HelpExampleRpc("getblockcount", "")
);
return chainActive.Height();
}
Value getbestblockhash(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"getbestblockhash\n"
"\nReturns the hash of the best (tip) block in the longest block chain.\n"
"\nResult\n"
"\"hex\" (string) the block hash hex encoded\n"
"\nExamples\n"
+ HelpExampleCli("getbestblockhash", "")
+ HelpExampleRpc("getbestblockhash", "")
);
return chainActive.Tip()->GetBlockHash().GetHex();
}
Value getdifficulty(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"getdifficulty\n"
"\nReturns the proof-of-work difficulty as a multiple of the minimum difficulty.\n"
"\nResult:\n"
"n.nnn (numeric) the proof-of-work difficulty as a multiple of the minimum difficulty.\n"
"\nExamples:\n"
+ HelpExampleCli("getdifficulty", "")
+ HelpExampleRpc("getdifficulty", "")
);
return GetDifficulty();
}
Value getrawmempool(const Array& params, bool fHelp)
{
if (fHelp || params.size() > 1)
throw runtime_error(
"getrawmempool ( verbose )\n"
"\nReturns all transaction ids in memory pool as a json array of string transaction ids.\n"
"\nArguments:\n"
"1. verbose (boolean, optional, default=false) true for a json object, false for array of transaction ids\n"
"\nResult: (for verbose = false):\n"
"[ (json array of string)\n"
" \"transactionid\" (string) The transaction id\n"
" ,...\n"
"]\n"
"\nResult: (for verbose = true):\n"
"{ (json object)\n"
" \"transactionid\" : { (json object)\n"
" \"size\" : n, (numeric) transaction size in bytes\n"
" \"fee\" : n, (numeric) transaction fee in zapcards\n"
" \"time\" : n, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT\n"
" \"height\" : n, (numeric) block height when transaction entered pool\n"
" \"startingpriority\" : n, (numeric) priority when transaction entered pool\n"
" \"currentpriority\" : n, (numeric) transaction priority now\n"
" \"depends\" : [ (array) unconfirmed transactions used as inputs for this transaction\n"
" \"transactionid\", (string) parent transaction id\n"
" ... ]\n"
" }, ...\n"
"]\n"
"\nExamples\n"
+ HelpExampleCli("getrawmempool", "true")
+ HelpExampleRpc("getrawmempool", "true")
);
bool fVerbose = false;
if (params.size() > 0)
fVerbose = params[0].get_bool();
if (fVerbose)
{
LOCK(mempool.cs);
Object o;
BOOST_FOREACH(const PAIRTYPE(uint256, CTxMemPoolEntry)& entry, mempool.mapTx)
{
const uint256& hash = entry.first;
const CTxMemPoolEntry& e = entry.second;
Object info;
info.push_back(Pair("size", (int)e.GetTxSize()));
info.push_back(Pair("fee", ValueFromAmount(e.GetFee())));
info.push_back(Pair("time", e.GetTime()));
info.push_back(Pair("height", (int)e.GetHeight()));
info.push_back(Pair("startingpriority", e.GetPriority(e.GetHeight())));
info.push_back(Pair("currentpriority", e.GetPriority(chainActive.Height())));
const CTransaction& tx = e.GetTx();
set<string> setDepends;
BOOST_FOREACH(const CTxIn& txin, tx.vin)
{
if (mempool.exists(txin.prevout.hash))
setDepends.insert(txin.prevout.hash.ToString());
}
Array depends(setDepends.begin(), setDepends.end());
info.push_back(Pair("depends", depends));
o.push_back(Pair(hash.ToString(), info));
}
return o;
}
else
{
vector<uint256> vtxid;
mempool.queryHashes(vtxid);
Array a;
BOOST_FOREACH(const uint256& hash, vtxid)
a.push_back(hash.ToString());
return a;
}
}
Value getblockhash(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
"getblockhash index\n"
"\nReturns hash of block in best-block-chain at index provided.\n"
"\nArguments:\n"
"1. index (numeric, required) The block index\n"
"\nResult:\n"
"\"hash\" (string) The block hash\n"
"\nExamples:\n"
+ HelpExampleCli("getblockhash", "1000")
+ HelpExampleRpc("getblockhash", "1000")
);
int nHeight = params[0].get_int();
if (nHeight < 0 || nHeight > chainActive.Height())
throw runtime_error("Block number out of range.");
CBlockIndex* pblockindex = chainActive[nHeight];
return pblockindex->GetBlockHash().GetHex();
}
Value getblock(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
"getblock \"hash\" ( verbose )\n"
"\nIf verbose is false, returns a string that is serialized, hex-encoded data for block 'hash'.\n"
"If verbose is true, returns an Object with information about block <hash>.\n"
"\nArguments:\n"
"1. \"hash\" (string, required) The block hash\n"
"2. verbose (boolean, optional, default=true) true for a json object, false for the hex encoded data\n"
"\nResult (for verbose = true):\n"
"{\n"
" \"hash\" : \"hash\", (string) the block hash (same as provided)\n"
" \"confirmations\" : n, (numeric) The number of confirmations\n"
" \"size\" : n, (numeric) The block size\n"
" \"height\" : n, (numeric) The block height or index\n"
" \"version\" : n, (numeric) The block version\n"
" \"merkleroot\" : \"xxxx\", (string) The merkle root\n"
" \"tx\" : [ (array of string) The transaction ids\n"
" \"transactionid\" (string) The transaction id\n"
" ,...\n"
" ],\n"
" \"time\" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n"
" \"nonce\" : n, (numeric) The nonce\n"
" \"bits\" : \"1d00ffff\", (string) The bits\n"
" \"difficulty\" : x.xxx, (numeric) The difficulty\n"
" \"previousblockhash\" : \"hash\", (string) The hash of the previous block\n"
" \"nextblockhash\" : \"hash\" (string) The hash of the next block\n"
"}\n"
"\nResult (for verbose=false):\n"
"\"data\" (string) A string that is serialized, hex-encoded data for block 'hash'.\n"
"\nExamples:\n"
+ HelpExampleCli("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"")
+ HelpExampleRpc("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"")
);
std::string strHash = params[0].get_str();
uint256 hash(strHash);
bool fVerbose = true;
if (params.size() > 1)
fVerbose = params[1].get_bool();
if (mapBlockIndex.count(hash) == 0)
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found");
CBlock block;
CBlockIndex* pblockindex = mapBlockIndex[hash];
if(!ReadBlockFromDisk(block, pblockindex))
throw JSONRPCError(RPC_INTERNAL_ERROR, "Can't read block from disk");
if (!fVerbose)
{
CDataStream ssBlock(SER_NETWORK, PROTOCOL_VERSION);
ssBlock << block;
std::string strHex = HexStr(ssBlock.begin(), ssBlock.end());
return strHex;
}
return blockToJSON(block, pblockindex);
}
Value gettxoutsetinfo(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"gettxoutsetinfo\n"
"\nReturns statistics about the unspent transaction output set.\n"
"Note this call may take some time.\n"
"\nResult:\n"
"{\n"
" \"height\":n, (numeric) The current block height (index)\n"
" \"bestblock\": \"hex\", (string) the best block hash hex\n"
" \"transactions\": n, (numeric) The number of transactions\n"
" \"txouts\": n, (numeric) The number of output transactions\n"
" \"bytes_serialized\": n, (numeric) The serialized size\n"
" \"hash_serialized\": \"hash\", (string) The serialized hash\n"
" \"total_amount\": x.xxx (numeric) The total amount\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("gettxoutsetinfo", "")
+ HelpExampleRpc("gettxoutsetinfo", "")
);
Object ret;
CCoinsStats stats;
if (pcoinsTip->GetStats(stats)) {
ret.push_back(Pair("height", (int64_t)stats.nHeight));
ret.push_back(Pair("bestblock", stats.hashBlock.GetHex()));
ret.push_back(Pair("transactions", (int64_t)stats.nTransactions));
ret.push_back(Pair("txouts", (int64_t)stats.nTransactionOutputs));
ret.push_back(Pair("bytes_serialized", (int64_t)stats.nSerializedSize));
ret.push_back(Pair("hash_serialized", stats.hashSerialized.GetHex()));
ret.push_back(Pair("total_amount", ValueFromAmount(stats.nTotalAmount)));
}
return ret;
}
Value gettxout(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 2 || params.size() > 3)
throw runtime_error(
"gettxout \"txid\" n ( includemempool )\n"
"\nReturns details about an unspent transaction output.\n"
"\nArguments:\n"
"1. \"txid\" (string, required) The transaction id\n"
"2. n (numeric, required) vout value\n"
"3. includemempool (boolean, optional) Whether to included the mem pool\n"
"\nResult:\n"
"{\n"
" \"bestblock\" : \"hash\", (string) the block hash\n"
" \"confirmations\" : n, (numeric) The number of confirmations\n"
" \"value\" : x.xxx, (numeric) The transaction value in btc\n"
" \"scriptPubKey\" : { (json object)\n"
" \"asm\" : \"code\", (string) \n"
" \"hex\" : \"hex\", (string) \n"
" \"reqSigs\" : n, (numeric) Number of required signatures\n"
" \"type\" : \"pubkeyhash\", (string) The type, eg pubkeyhash\n"
" \"addresses\" : [ (array of string) array of zapcard addresses\n"
" \"zapcardaddress\" (string) zapcard address\n"
" ,...\n"
" ]\n"
" },\n"
" \"version\" : n, (numeric) The version\n"
" \"coinbase\" : true|false (boolean) Coinbase or not\n"
"}\n"
"\nExamples:\n"
"\nGet unspent transactions\n"
+ HelpExampleCli("listunspent", "") +
"\nView the details\n"
+ HelpExampleCli("gettxout", "\"txid\" 1") +
"\nAs a json rpc call\n"
+ HelpExampleRpc("gettxout", "\"txid\", 1")
);
Object ret;
std::string strHash = params[0].get_str();
uint256 hash(strHash);
int n = params[1].get_int();
bool fMempool = true;
if (params.size() > 2)
fMempool = params[2].get_bool();
CCoins coins;
if (fMempool) {
LOCK(mempool.cs);
CCoinsViewMemPool view(*pcoinsTip, mempool);
if (!view.GetCoins(hash, coins))
return Value::null;
mempool.pruneSpent(hash, coins); // TODO: this should be done by the CCoinsViewMemPool
} else {
if (!pcoinsTip->GetCoins(hash, coins))
return Value::null;
}
if (n<0 || (unsigned int)n>=coins.vout.size() || coins.vout[n].IsNull())
return Value::null;
std::map<uint256, CBlockIndex*>::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
CBlockIndex *pindex = it->second;
ret.push_back(Pair("bestblock", pindex->GetBlockHash().GetHex()));
if ((unsigned int)coins.nHeight == MEMPOOL_HEIGHT)
ret.push_back(Pair("confirmations", 0));
else
ret.push_back(Pair("confirmations", pindex->nHeight - coins.nHeight + 1));
ret.push_back(Pair("value", ValueFromAmount(coins.vout[n].nValue)));
Object o;
ScriptPubKeyToJSON(coins.vout[n].scriptPubKey, o, true);
ret.push_back(Pair("scriptPubKey", o));
ret.push_back(Pair("version", coins.nVersion));
ret.push_back(Pair("coinbase", coins.fCoinBase));
return ret;
}
Value verifychain(const Array& params, bool fHelp)
{
if (fHelp || params.size() > 2)
throw runtime_error(
"verifychain ( checklevel numblocks )\n"
"\nVerifies blockchain database.\n"
"\nArguments:\n"
"1. checklevel (numeric, optional, 0-4, default=3) How thorough the block verification is.\n"
"2. numblocks (numeric, optional, default=288, 0=all) The number of blocks to check.\n"
"\nResult:\n"
"true|false (boolean) Verified or not\n"
"\nExamples:\n"
+ HelpExampleCli("verifychain", "")
+ HelpExampleRpc("verifychain", "")
);
int nCheckLevel = GetArg("-checklevel", 3);
int nCheckDepth = GetArg("-checkblocks", 288);
if (params.size() > 0)
nCheckLevel = params[0].get_int();
if (params.size() > 1)
nCheckDepth = params[1].get_int();
return VerifyDB(nCheckLevel, nCheckDepth);
}
Value getblockchaininfo(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"getblockchaininfo\n"
"Returns an object containing various state info regarding block chain processing.\n"
"\nResult:\n"
"{\n"
" \"chain\": \"xxxx\", (string) current chain (main, testnet3, regtest)\n"
" \"blocks\": xxxxxx, (numeric) the current number of blocks processed in the server\n"
" \"bestblockhash\": \"...\", (string) the hash of the currently best block\n"
" \"difficulty\": xxxxxx, (numeric) the current difficulty\n"
" \"verificationprogress\": xxxx, (numeric) estimate of verification progress [0..1]\n"
" \"chainwork\": \"xxxx\" (string) total amount of work in active chain, in hexadecimal\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("getblockchaininfo", "")
+ HelpExampleRpc("getblockchaininfo", "")
);
proxyType proxy;
GetProxy(NET_IPV4, proxy);
Object obj;
std::string chain = Params().DataDir();
if(chain.empty())
chain = "main";
obj.push_back(Pair("chain", chain));
obj.push_back(Pair("blocks", (int)chainActive.Height()));
obj.push_back(Pair("bestblockhash", chainActive.Tip()->GetBlockHash().GetHex()));
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
obj.push_back(Pair("verificationprogress", Checkpoints::GuessVerificationProgress(chainActive.Tip())));
obj.push_back(Pair("chainwork", chainActive.Tip()->nChainWork.GetHex()));
return obj;
}
|
{
"content_hash": "c6de85df202c18bafe00c8dd59310fbe",
"timestamp": "",
"source": "github",
"line_count": 455,
"max_line_length": 130,
"avg_line_length": 40.573626373626375,
"alnum_prop": 0.5590163046422187,
"repo_name": "zapcard/zapcard",
"id": "393a8f803f88b8801054f281d8f929186913c2ab",
"size": "18837",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/rpcblockchain.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "49504"
},
{
"name": "C++",
"bytes": "3059183"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "HTML",
"bytes": "50620"
},
{
"name": "M4",
"bytes": "113757"
},
{
"name": "Makefile",
"bytes": "32206"
},
{
"name": "Objective-C",
"bytes": "1052"
},
{
"name": "Objective-C++",
"bytes": "6330"
},
{
"name": "Protocol Buffer",
"bytes": "2308"
},
{
"name": "Python",
"bytes": "116386"
},
{
"name": "QMake",
"bytes": "2019"
},
{
"name": "Roff",
"bytes": "18140"
},
{
"name": "Shell",
"bytes": "51953"
}
]
}
|
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(
realpath(__DIR__.'/../')
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
Illuminate\Foundation\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
Illuminate\Foundation\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
Illuminate\Foundation\Exceptions\Handler::class
);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;
|
{
"content_hash": "f2a06c45d0751539b3690f1f61190a98",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 75,
"avg_line_length": 30.10909090909091,
"alnum_prop": 0.5368357487922706,
"repo_name": "clarkwinkelmann/bugnplay-parser",
"id": "1a7a27ae6021099e8a161eb4ce3639c5405c8735",
"size": "1656",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "bootstrap/app.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "45453"
}
]
}
|
using namespace glm;
#define MAX_SPOT_LIGHTS 8
namespace Beans
{
class Transform;
class SpotLight : public Component, protected Utilities::AutoLister<SpotLight>
{
public:
REFLECT_CLASS;
SpotLight(GameObject* object);
float power;
vec3 color;
float inner_cutoff;
float outer_cutoff;
static void SendLightsToShader(Shader* shader);
private:
Transform* transform_;
};
}
|
{
"content_hash": "9346f8ef9f774288e054dd5028c8d4b4",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 80,
"avg_line_length": 16.03846153846154,
"alnum_prop": 0.6954436450839329,
"repo_name": "jacobmcleman/MagicBeans",
"id": "d31c968a83343fcf432f12a00ac2fe0094853383",
"size": "534",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Engine/MagicBeansEngine/MagicBeans/SpotLight.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "9460042"
},
{
"name": "C++",
"bytes": "2502937"
},
{
"name": "CMake",
"bytes": "20462"
},
{
"name": "GLSL",
"bytes": "2239"
},
{
"name": "Metal",
"bytes": "3849"
},
{
"name": "Objective-C",
"bytes": "559361"
},
{
"name": "Perl",
"bytes": "20074"
},
{
"name": "Python",
"bytes": "2095"
},
{
"name": "Shell",
"bytes": "702"
}
]
}
|
package org.entrementes.quiron.annotation;
public @interface ApiDependency {
public String id();
public String host() default "";
public int port() default 80;
public String context() default "";
public String path() default "";
public String methodType() default "GET";
}
|
{
"content_hash": "a90baa4ab8dec065d3f72721162bd13d",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 42,
"avg_line_length": 16.27777777777778,
"alnum_prop": 0.6996587030716723,
"repo_name": "Entrementes/quiron",
"id": "54306b986bf90b9882aa636f91284c8744fac823",
"size": "293",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "quiron-api/src/main/java/org/entrementes/quiron/annotation/ApiDependency.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2448"
},
{
"name": "Java",
"bytes": "84084"
},
{
"name": "JavaScript",
"bytes": "496"
}
]
}
|
<?php
namespace Sun\Security;
use Sun\Support\Str;
use Sun\Contracts\Http\Request;
use Sun\Contracts\Session\Session;
use Sun\Contracts\Security\Csrf as CsrfContract;
class Csrf implements CsrfContract
{
/**
* To get http request data
*
* @var \Sun\Contracts\Http\Request
*/
protected $request;
/**
* To store session data
*
* @var \Sun\Contracts\Session\Session
*/
protected $session;
/**
* Create a new csrf instance
*
* @param \Sun\Contracts\Http\Request $request
* @param \Sun\Contracts\Session\Session $session
*/
public function __construct(Request $request, Session $session)
{
$this->request = $request;
$this->session = $session;
}
/**
* To generate token
*
* @return string
*/
public function token()
{
if(!$this->session->has('token')) {
$this->session->create('token', Str::random(40));
}
return $this->session->get('token');
}
/**
* To check token
*
* @return bool
*/
public function check()
{
if($this->session->get('token') === $this->request->input('token') || $this->session->get('token') === $this->request->header('X-CSRF-TOKEN')) {
return true;
}
return false;
}
}
|
{
"content_hash": "a7e7fd504255ac87ff29f789b79eb80a",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 152,
"avg_line_length": 21.753846153846155,
"alnum_prop": 0.5289957567185289,
"repo_name": "IftekherSunny/Planet-Framework",
"id": "5d97d598a97b913820adecdeade703c0830c5403",
"size": "1414",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Sun/Security/Csrf.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "189759"
}
]
}
|
namespace ConsoleTests
{
using System;
using System.Drawing;
using ObscureWare.Console;
using ObscureWare.Console.Operations;
internal static class Program
{
private static void Main(string[] args)
{
ConsoleController controller = new ConsoleController();
//helper.ReplaceConsoleColor(ConsoleColor.DarkCyan, Color.Salmon);
controller.ReplaceConsoleColors(
new Tuple<ConsoleColor, Color>(ConsoleColor.DarkCyan, Color.Chocolate),
new Tuple<ConsoleColor, Color>(ConsoleColor.Blue, Color.DodgerBlue),
new Tuple<ConsoleColor, Color>(ConsoleColor.Yellow, Color.Gold),
new Tuple<ConsoleColor, Color>(ConsoleColor.DarkBlue, Color.MidnightBlue));
IConsole console = new SystemConsole(controller, isFullScreen: false);
ConsoleOperations ops = new ConsoleOperations(console);
TestCommands test = new TestCommands(console);
console.ReadLine();
}
}
}
|
{
"content_hash": "f26c0fd6f5c81610bdbb71cb07ac4192",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 91,
"avg_line_length": 37.214285714285715,
"alnum_prop": 0.6554702495201535,
"repo_name": "ObscureWare/Console.Commands",
"id": "9f585bcdbb0d8c279d7339517d5dfbf59368c345",
"size": "1044",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Console.Tests/Program.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "203889"
}
]
}
|
package com.raulh82vlc.CheckoutShoppingList.ui.activities;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.ActionBar;
import com.raulh82vlc.CheckoutShoppingList.CheckoutShoppingListApp;
import com.raulh82vlc.CheckoutShoppingList.R;
import com.raulh82vlc.CheckoutShoppingList.di.components.DaggerProductsListComponent;
import com.raulh82vlc.CheckoutShoppingList.di.components.ProductsListComponent;
import com.raulh82vlc.CheckoutShoppingList.di.modules.ActivityModule;
/**
* <p>Comics List Activity</p>
*
* @author Raul Hernandez Lopez
*/
public class ProductsListActivity extends BaseActivity {
private ProductsListComponent productsListComponent;
public ProductsListComponent component() {
if (productsListComponent == null) {
productsListComponent = DaggerProductsListComponent.builder()
.applicationComponent(((CheckoutShoppingListApp) getApplication()).component())
.activityModule(new ActivityModule(this))
.build();
}
return productsListComponent;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
component().inject(this);
setToolbarInitialisation();
setInitialTitle();
}
@Override
protected void setInitialTitle() {
toolbar.setTitle(getString(R.string.main_screen));
}
@Override
protected void setToolbarInitialisation() {
setSupportActionBar(toolbar);
final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setHomeButtonEnabled(false);
actionBar.setDisplayHomeAsUpEnabled(false);
}
}
@Override
protected int getLayoutId() {
return R.layout.activity_products_list;
}
@Override
protected ProductsListActivity getActivity() {
return this;
}
}
|
{
"content_hash": "cca0043b9c49666ea5707e60f3838c36",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 99,
"avg_line_length": 29.65671641791045,
"alnum_prop": 0.704579768495219,
"repo_name": "raulh82vlc/ShoppingList",
"id": "e1de9f05da8772156585a44d54910e43daed38bc",
"size": "2602",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "android/src/main/java/com/raulh82vlc/CheckoutShoppingList/ui/activities/ProductsListActivity.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "122333"
}
]
}
|
package com.juntosalimos.client.application.challenge.widget.ideas.ideawidget;
import com.gwtplatform.mvp.client.gin.AbstractPresenterModule;
public class IdeaWidgetModule extends AbstractPresenterModule {
@Override
protected void configure() {
bindPresenterWidget(IdeaWidgetPresenter.class,
IdeaWidgetPresenter.MyView.class, IdeaWidgetView.class);
}
}
|
{
"content_hash": "48715ee62cae54e234d730c4489b403b",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 78,
"avg_line_length": 33.09090909090909,
"alnum_prop": 0.8324175824175825,
"repo_name": "manubotija/junsal",
"id": "267fc58450fa063c622f8382748cbb076ada5cb4",
"size": "364",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/juntosalimos/client/application/challenge/widget/ideas/ideawidget/IdeaWidgetModule.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "124447"
},
{
"name": "Java",
"bytes": "175658"
}
]
}
|
package ui
import (
"github.com/gdamore/tcell"
"github.com/gdamore/tcell/views"
)
type HelpPanel struct {
text *views.TextArea
Panel
}
func (h *HelpPanel) HandleEvent(ev tcell.Event) bool {
switch ev := ev.(type) {
case *tcell.EventKey:
switch ev.Key() {
case tcell.KeyEsc:
h.App().ShowMain()
return true
case tcell.KeyRune:
switch ev.Rune() {
case 'Q', 'q':
h.app.ShowMain()
return true
}
}
}
return h.Panel.HandleEvent(ev)
}
func (h *HelpPanel) Draw() {
h.SetKeys([]string{"[ESC] Main"})
h.SetTitle("Help")
h.Panel.Draw()
}
func (h *HelpPanel) Init(app *App) {
h.Panel.Init(app)
// No, we don't have context-sensitive help.
h.text = views.NewTextArea()
h.text.SetLines([]string{
"Supported keys (not all keys available in all contexts)",
"",
" <ESC> : return to main screen",
" <CTRL-C> : quit",
" <CTRL-L> : refresh the screeen",
" <H> : show this help",
" <UP>, <DOWN> : navigation",
" <PGUP>, <PGDN>",
" <HOME>, <END>",
" <E> : enable selected service",
" <D> : disable selected service",
" <I> : view detailed information for service",
" <R> : restart selected service",
" <C> : clear faults on selected service",
" <L> : view log for selected service",
"",
"This program is distributed under the Apache 2.0 License",
"Copyright 2016 The Govisor Authors",
})
h.SetContent(h.text)
}
func NewHelpPanel(app *App) *HelpPanel {
h := &HelpPanel{}
h.Init(app)
return h
}
|
{
"content_hash": "ae4d1ba17fe12ca0db3d1c4bf4cb16e2",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 61,
"avg_line_length": 21.944444444444443,
"alnum_prop": 0.5835443037974684,
"repo_name": "gdamore/govisor",
"id": "3162d92c947c39b79e947aecc3af31e0359d452c",
"size": "2171",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "govisor/ui/hpanel.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "124929"
},
{
"name": "Shell",
"bytes": "1109"
}
]
}
|
// 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
namespace DotNetNuke.Tests.Core.Entities.Modules.Settings
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Web.Caching;
using DotNetNuke.ComponentModel;
using DotNetNuke.Entities.Controllers;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Portals;
using DotNetNuke.Services.Cache;
using DotNetNuke.Tests.Utilities.Mocks;
using Moq;
using NUnit.Framework;
public abstract class BaseSettingsTests
{
public static readonly object[] SettingsCases =
{
new object[] { "AbcdeF#2@kfdfdfds", 9, 1.45, false, new DateTime(2015, 11, 30, 13, 45, 16), TimeSpan.Zero, TestingEnum.Value1, default(ComplexType), },
new object[] { "Bsskk41233[]#%&", -5, -13456.456, true, DateTime.Today.AddDays(-1), new TimeSpan(1, 5, 6, 7), TestingEnum.Value2, new ComplexType(8, -10), },
};
protected const string SettingNamePrefix = "UnitTestSetting_";
protected const int ModuleId = 1234;
protected const int TabModuleId = 653;
protected const int TabId = 344597;
protected const int PortalId = 246;
protected MockRepository MockRepository;
protected Hashtable MockCacheCollection;
protected Mock<CachingProvider> MockCache;
protected Mock<IHostController> MockHostController;
protected Mock<IModuleController> MockModuleController;
protected Mock<IPortalController> MockPortalController;
public enum TestingEnum
{
Value1 = 0,
Value2 = 1,
}
protected static ModuleInfo GetModuleInfo => new ModuleInfo { ModuleID = ModuleId, TabModuleID = TabModuleId, TabID = TabId, PortalID = PortalId, };
[OneTimeSetUp]
public virtual void TestFixtureSetUp()
{
this.MockRepository = new MockRepository(MockBehavior.Default);
this.MockHostController = this.MockRepository.Create<IHostController>();
}
[SetUp]
public virtual void SetUp()
{
// Mock Repository and component factory
this.MockRepository = new MockRepository(MockBehavior.Default);
ComponentFactory.Container = new SimpleContainer();
// Setup Mock
this.MockCache = MockComponentProvider.CreateNew<CachingProvider>();
HostController.RegisterInstance(this.MockHostController.Object);
this.MockPortalController = this.MockRepository.Create<IPortalController>();
PortalController.SetTestableInstance(this.MockPortalController.Object);
this.MockModuleController = this.MockRepository.Create<IModuleController>();
ModuleController.SetTestableInstance(this.MockModuleController.Object);
// Setup mock cache
this.MockCacheCollection = new Hashtable();
this.MockHostController.Setup(hc => hc.GetString("PerformanceSetting")).Returns("3");
this.MockCache.Setup(c => c.Insert(It.IsAny<string>(), It.IsAny<object>())).Callback((string cacheKey, object itemToCache) => this.MockCacheCollection[cacheKey] = itemToCache);
this.MockCache.Setup(c => c.Insert(It.IsAny<string>(), It.IsAny<object>(), It.IsAny<DNNCacheDependency>(), It.IsAny<DateTime>(), It.IsAny<TimeSpan>(), It.IsAny<CacheItemPriority>(), It.IsAny<CacheItemRemovedCallback>()))
.Callback((string cacheKey, object itemToCache, DNNCacheDependency dcd, DateTime dt, TimeSpan ts, CacheItemPriority cip, CacheItemRemovedCallback circ) => this.MockCacheCollection[cacheKey] = itemToCache);
this.MockCache.Setup(c => c.GetItem(It.IsAny<string>())).Returns((string cacheKey) => this.MockCacheCollection[cacheKey]);
}
[TearDown]
public virtual void TearDown()
{
MockComponentProvider.ResetContainer();
PortalController.ClearInstance();
ModuleController.ClearInstance();
}
protected static string CacheKey(ModuleInfo moduleInfo) => $"SettingsModule{moduleInfo.TabModuleID}";
protected static string ModuleSettingsCacheKey(ModuleInfo moduleInfo) => $"ModuleSettings{moduleInfo.TabID}";
protected static string TabModuleSettingsCacheKey(ModuleInfo moduleInfo) => $"TabModuleSettings{moduleInfo.TabID}";
protected void MockPortalSettings(ModuleInfo moduleInfo, Dictionary<string, string> portalSettings)
{
this.MockPortalController.Setup(pc => pc.GetPortalSettings(moduleInfo.PortalID)).Returns(portalSettings);
}
protected void MockTabModuleSettings(ModuleInfo moduleInfo, Hashtable tabModuleSettings)
{
this.MockCache.Setup(c => c.GetItem("DNN_" + TabModuleSettingsCacheKey(moduleInfo)))
.Returns(new Dictionary<int, Hashtable> { { moduleInfo.TabModuleID, tabModuleSettings } });
}
protected void MockModuleSettings(ModuleInfo moduleInfo, Hashtable moduleSettings)
{
this.MockCache.Setup(c => c.GetItem("DNN_" + ModuleSettingsCacheKey(moduleInfo)))
.Returns(new Dictionary<int, Hashtable> { { moduleInfo.ModuleID, moduleSettings } });
}
}
}
|
{
"content_hash": "9ad1a723424b4ebe0e8310cc8992ee19",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 232,
"avg_line_length": 47.95614035087719,
"alnum_prop": 0.6811779769526248,
"repo_name": "valadas/Dnn.Platform",
"id": "57d7d9b16b8de91abc75e84cf1e6adee673af5c7",
"size": "5469",
"binary": false,
"copies": "2",
"ref": "refs/heads/develop",
"path": "DNN Platform/Tests/DotNetNuke.Tests.Core/Entities/Modules/Settings/BaseSettingsTests.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP.NET",
"bytes": "522038"
},
{
"name": "Batchfile",
"bytes": "289"
},
{
"name": "C#",
"bytes": "21868942"
},
{
"name": "CSS",
"bytes": "920009"
},
{
"name": "HTML",
"bytes": "543211"
},
{
"name": "JavaScript",
"bytes": "8406477"
},
{
"name": "Less",
"bytes": "566334"
},
{
"name": "PowerShell",
"bytes": "5984"
},
{
"name": "SCSS",
"bytes": "12527"
},
{
"name": "Shell",
"bytes": "1429"
},
{
"name": "TSQL",
"bytes": "128041"
},
{
"name": "TypeScript",
"bytes": "135977"
},
{
"name": "Visual Basic .NET",
"bytes": "114706"
},
{
"name": "XSLT",
"bytes": "11388"
}
]
}
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>rate (RobotsDotText::RobotsFile)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
<pre><span class="ruby-comment cmt"># File lib/robots_dot_text.rb, line 81</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rate</span>(<span class="ruby-identifier">rate</span>)
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"rate #{rate.inspect} is invalid, this should be a fraction. eg.: 1/864"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rate</span> <span class="ruby-operator">!~</span> <span class="ruby-regexp re">/^\d{1,2}\/\d+(s|m|h)?$/</span>
<span class="ruby-ivar">@rules</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"Request-rate: #{rate}\n"</span>
<span class="ruby-keyword kw">end</span></pre>
</body>
</html>
|
{
"content_hash": "f346148b6a31082bc1d51ff51f372282",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 393,
"avg_line_length": 67.3157894736842,
"alnum_prop": 0.6661454261141517,
"repo_name": "albertobraschi/robots_dot_text",
"id": "985d39ad9ce7cc871de5ca7567ef7deb847d87e0",
"size": "1279",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/classes/RobotsDotText/RobotsFile.src/M000015.html",
"mode": "33188",
"license": "mit",
"language": []
}
|
package com.sgu.infowksporga.jfx.app.action.view;
import com.sgu.core.framework.i18n.I18nHelper;
import com.sgu.infowksporga.jfx.action.AppBaseAction;
import javafx.event.ActionEvent;
import javafx.scene.control.Control;
import lombok.extern.slf4j.Slf4j;
/**
* Description : AViewAddAction class<br>
*/
@Slf4j
public class AAddViewAction extends AppBaseAction<ActionEvent> {
/**
* The Constructor.
*
* @param control the control
* @param bundleConfigKey the bundle config key
* @param i18nHelper the i18n helper
*/
public AAddViewAction(final Control control, final String bundleConfigKey, final I18nHelper i18nHelper) {
super(control, bundleConfigKey, i18nHelper);
}
/**
* Adds the view.
* Use for dev testing
*
* @param model the model
*/
/*
* protected void addDefaultView2(final ADockableViewModel model) {
* try {
* final String xmlStructure = UtilIO.readFile(
* "G:\\Projects\\400-InfoWkspOrga\\10-Application\\Application\\InfoWkspOrga-APP\\src\\main\\java\\com\\sgu\\infowksporga\\jfx\\main\\action\\view\\workspace.xml"
* );
* final GDockPane dockPaneFromXml = UtilDockFX.deSerializeDockFxStructure(xmlStructure);
* GUISessionProxy.getApplication().getApplicationScreen().getView().getPnlWorkspace().setCenter(dockPaneFromXml);
* GUISessionProxy.getApplication().getApplicationScreen().getView().setDockPane(dockPaneFromXml);
* } catch (final Exception e) {
* throw new TechnicalException(e);
* }
* }
*/
}
|
{
"content_hash": "f88bb64c81bee46b4fe4878accefffb4",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 165,
"avg_line_length": 30.816326530612244,
"alnum_prop": 0.7271523178807947,
"repo_name": "sguisse/InfoWkspOrga",
"id": "86573a146d54487568dc4390d76920e7bfd8fb47",
"size": "1510",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "10-Application/Application/InfoWkspOrga-APP/src/main/java/com/sgu/infowksporga/jfx/app/action/view/AAddViewAction.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "7922"
},
{
"name": "CSS",
"bytes": "662690"
},
{
"name": "HTML",
"bytes": "7519695"
},
{
"name": "Java",
"bytes": "1253821"
},
{
"name": "JavaScript",
"bytes": "3371382"
},
{
"name": "PHP",
"bytes": "28126"
},
{
"name": "Shell",
"bytes": "1469"
}
]
}
|
body {
background: yellow;
}
|
{
"content_hash": "1a34f0c5f032588675910aaa424189f9",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 27,
"avg_line_length": 12.333333333333334,
"alnum_prop": 0.5405405405405406,
"repo_name": "leonlee/wp1",
"id": "976253582daa80758be6cdf236acbd998c65e182",
"size": "37",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/style.css",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "37"
},
{
"name": "HTML",
"bytes": "254"
},
{
"name": "JavaScript",
"bytes": "2551"
}
]
}
|
<body>
Classes for groovy extension.
</body>
|
{
"content_hash": "31c656a0a7df333b707ef63764bb442b",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 29,
"avg_line_length": 14.666666666666666,
"alnum_prop": 0.75,
"repo_name": "lukecampbell/webtest",
"id": "a90e822c146874a0484cb89433a22d7699159d19",
"size": "44",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/canoo/webtest/extension/groovy/package.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "811"
},
{
"name": "CSS",
"bytes": "1451"
},
{
"name": "Groovy",
"bytes": "31898"
},
{
"name": "HTML",
"bytes": "52281"
},
{
"name": "Java",
"bytes": "1547908"
},
{
"name": "JavaScript",
"bytes": "59098"
},
{
"name": "Shell",
"bytes": "1864"
},
{
"name": "XSLT",
"bytes": "60093"
}
]
}
|
Straightforward date parsing and formatting for Javascript. I mean, it was
written for Coffeescript, and it's called CoffeeDate, but that's just for
the sake of cleverness.
Anyhow, if you ever wanted to simplify the process of working with dates in
Javascript, this library is for you. Inspired by python datetime's formatting,
with slight differences.
Quick Start
============
Instantiate using the constructor, or with the class method `parse`. The
constructor takes year, month, day, hour, minute, seconds, microsecond in
that order, all optional. The defaults are 1970, 1, 1, 0, 0, 0, 0::
d = new CoffeeDate(2012, 5, 6)
d.year // 2012
d.month // 5
d.day // 6
Parsing and formatting are done a lot like the Python datetime library does it.
Difference is, that's about all that this library does::
d = CoffeeDate.parse("2010-01-01 13:12:05", "%Y-%m-%d %H:%M:%S")
d.hour // 13
d.minute // 12
d.second // 0
datestr = d.format("%b %d, %Y %i:%M %p") // "Jan 1, 2010 1:12 pm"
Limitations
==============
* No localization support, at the moment.
* **No time zone information is stored, computed, or cared about**. This is a formatting library.
* All years are assumed A.D./C.E.
* 2-digit years pivot at 1970. (e.g. 71 -> 1971, 70 -> 2070)
If you have any problems with these, fork away!
Formatting and Parsing
========================
Construct your format string using these substitutions. Many are more
permissive parsing than formatting; for example, "%M" accepts zero-padded or
not. Hours have special format strings for zero-padded or not output.
== ========================================================
%a Weekday abbreviation (e.g. Mon)
%A Weekday name (e.g. Monday)
%b Month abbreviation (e.g. Jun)
%c Year, two digits, 2000-2099. Format with leading zero.
%B Month name (e.g. June)
%d Day of month, numeric (1-31). Format with no leading zero.
%D Day of month, numeric (01-31). Format with leading zero.
%f Microsecond. Format with leading zeros
%h Hour, 24-hour time. Format with no leading zero
%H Hour, 24-hour time. Format with leading zero
%i Hour, 12-hour time. Format with no leading zero
%I Hour, 12-hour time. Format with leading zero
%m Month, numeric (1-12). Zero-padded
%M Minutes. Format with leading zero
%p AM or PM. /[ap]\.?m?\.?/i
%S Seconds. Format with leading zero
%y Year, two digits, 1970-2069. Format with leading zero.
%Y Year, four digits. Format with leading zero.
== ========================================================
Extending the parsers
===========================
You can easily add your own parsers to CoffeeDate, using `CoffeeDate.set_parser`.
It accepts two arguments:
1. A format to trigger on (e.g. `"%y"`)
2. A specification, which is a list of `[re, f]`, `re` being the regex to match and `f` being the function to apply.
`f` should take two arguments. The first argument is the matched string, and the second one is the CoffeeDate object
we're applying the match to.
Here's an example::
// We currently pivot on 1970
d = CoffeeDate.parse('10', '%y');
d.year == 2010
d = CoffeeDate.parse('90', '%y');
d.year == 1990
// Format 2-digit years from 1900-1999 instead of 1970-2069
CoffeeDate.set_parser('%y', [/[0-9]{1,2}/, function(s, d){ d.year = parseInt(s) + 1900; }])
CoffeeDate.parse('10', '%y')
d.year == 1910
d = CoffeeDate.parse('90', '%y');
d.year == 1990
Changing the base century and pivot for 2-digit years is by far the most common use for this,
so CoffeeDate also has a helper method called `year_parser` to help::
// Same as above
CoffeeDate.set_parser("%y", CoffeeDate.year_parser(1900, 0))
// 1650-1749
CoffeeDate.set_parser("%y", CoffeeDate.year_parser(1600, 50))
License
========
Released under the MIT License
|copy| 2012, Adam Bard, except the Jasmine code.
.. |copy| unicode:: 0xA9 .. Copyright sign
|
{
"content_hash": "8a3cb0c0943197a5d5e046c5ba58d1cd",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 116,
"avg_line_length": 34.75892857142857,
"alnum_prop": 0.662471101977909,
"repo_name": "adambard/coffeedate",
"id": "a3b9d61dc6858120191a50186a85441cb4130ad3",
"size": "3893",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.rst",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CoffeeScript",
"bytes": "6220"
},
{
"name": "JavaScript",
"bytes": "97439"
}
]
}
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="lang:clipboard.copy" content="Copy to clipboard">
<meta name="lang:clipboard.copied" content="Copied to clipboard">
<meta name="lang:search.language" content="en">
<meta name="lang:search.pipeline.stopwords" content="True">
<meta name="lang:search.pipeline.trimmer" content="True">
<meta name="lang:search.result.none" content="No matching documents">
<meta name="lang:search.result.one" content="1 matching document">
<meta name="lang:search.result.other" content="# matching documents">
<meta name="lang:search.tokenizer" content="[\s\-]+">
<link href="https://fonts.gstatic.com/" rel="preconnect" crossorigin>
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700|Roboto:300,400,400i,700&display=fallback" rel="stylesheet">
<style>
body,
input {
font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif
}
code,
kbd,
pre {
font-family: "Roboto Mono", "Courier New", Courier, monospace
}
</style>
<link rel="stylesheet" href="../_static/stylesheets/application.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-palette.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-fixes.css"/>
<link rel="stylesheet" href="../_static/fonts/material-icons.css"/>
<meta name="theme-color" content="#3f51b5">
<script src="../_static/javascripts/modernizr.js"></script>
<title>statsmodels.multivariate.multivariate_ols._MultivariateOLS.endog_names — statsmodels</title>
<link rel="icon" type="image/png" sizes="32x32" href="../_static/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="../_static/icons/favicon-16x16.png">
<link rel="manifest" href="../_static/icons/site.webmanifest">
<link rel="mask-icon" href="../_static/icons/safari-pinned-tab.svg" color="#919191">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-config" content="../_static/icons/browserconfig.xml">
<link rel="stylesheet" href="../_static/stylesheets/examples.css">
<link rel="stylesheet" href="../_static/stylesheets/deprecation.css">
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/material.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
<script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "processEscapes": true, "ignoreClass": "document", "processClass": "math|output_area"}})</script>
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="statsmodels.multivariate.multivariate_ols._MultivariateOLS.exog_names" href="statsmodels.multivariate.multivariate_ols._MultivariateOLS.exog_names.html" />
<link rel="prev" title="statsmodels.multivariate.multivariate_ols._MultivariateOLS.predict" href="statsmodels.multivariate.multivariate_ols._MultivariateOLS.predict.html" />
</head>
<body dir=ltr
data-md-color-primary=indigo data-md-color-accent=blue>
<svg class="md-svg">
<defs data-children-count="0">
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="__github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg>
</defs>
</svg>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search">
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
<a href="#generated/statsmodels.multivariate.multivariate_ols._MultivariateOLS.endog_names" tabindex="1" class="md-skip"> Skip to content </a>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid">
<div class="md-flex navheader">
<div class="md-flex__cell md-flex__cell--shrink">
<a href="../index.html" title="statsmodels"
class="md-header-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" height="26"
alt="statsmodels logo">
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
<span class="md-header-nav__topic">statsmodels v0.12.2</span>
<span class="md-header-nav__topic"> statsmodels.multivariate.multivariate_ols._MultivariateOLS.endog_names </span>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" action="../search.html" method="GET" name="search">
<input type="text" class="md-search__input" name="q" placeholder="Search"
autocapitalize="off" autocomplete="off" spellcheck="false"
data-md-component="query" data-md-state="active">
<label class="md-icon md-search__icon" for="__search"></label>
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">

</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="result">
<div class="md-search-result__meta">
Type to start searching
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
</div>
<script src="../_static/javascripts/version_dropdown.js"></script>
<script>
var json_loc = "../_static/versions.json",
target_loc = "../../",
text = "Versions";
$( document ).ready( add_version_dropdown(json_loc, target_loc, text));
</script>
</div>
</nav>
</header>
<div class="md-container">
<nav class="md-tabs" data-md-component="tabs">
<div class="md-tabs__inner md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item"><a href="../user-guide.html" class="md-tabs__link">User Guide</a></li>
<li class="md-tabs__item"><a href="../multivariate.html" class="md-tabs__link">Multivariate Statistics <code class="xref py py-mod docutils literal notranslate"><span class="pre">multivariate</span></code></a></li>
<li class="md-tabs__item"><a href="statsmodels.multivariate.multivariate_ols._MultivariateOLS.html" class="md-tabs__link">statsmodels.multivariate.multivariate_ols._MultivariateOLS</a></li>
</ul>
</div>
</nav>
<main class="md-main">
<div class="md-main__inner md-grid" data-md-component="container">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="__drawer">
<a href="../index.html" title="statsmodels" class="md-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" alt=" logo" width="48" height="48">
</a>
<a href="../index.html"
title="statsmodels">statsmodels v0.12.2</a>
</label>
<div class="md-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../install.html" class="md-nav__link">Installing statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../gettingstarted.html" class="md-nav__link">Getting started</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html" class="md-nav__link">User Guide</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../user-guide.html#background" class="md-nav__link">Background</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#regression-and-linear-models" class="md-nav__link">Regression and Linear Models</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#time-series-analysis" class="md-nav__link">Time Series Analysis</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#other-models" class="md-nav__link">Other Models</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../duration.html" class="md-nav__link">Methods for Survival and Duration Analysis</a>
</li>
<li class="md-nav__item">
<a href="../nonparametric.html" class="md-nav__link">Nonparametric Methods <code class="xref py py-mod docutils literal notranslate"><span class="pre">nonparametric</span></code></a>
</li>
<li class="md-nav__item">
<a href="../gmm.html" class="md-nav__link">Generalized Method of Moments <code class="xref py py-mod docutils literal notranslate"><span class="pre">gmm</span></code></a>
</li>
<li class="md-nav__item">
<a href="../miscmodels.html" class="md-nav__link">Other Models <code class="xref py py-mod docutils literal notranslate"><span class="pre">miscmodels</span></code></a>
</li>
<li class="md-nav__item">
<a href="../multivariate.html" class="md-nav__link">Multivariate Statistics <code class="xref py py-mod docutils literal notranslate"><span class="pre">multivariate</span></code></a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#statistics-and-tools" class="md-nav__link">Statistics and Tools</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#data-sets" class="md-nav__link">Data Sets</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#sandbox" class="md-nav__link">Sandbox</a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../examples/index.html" class="md-nav__link">Examples</a>
</li>
<li class="md-nav__item">
<a href="../api.html" class="md-nav__link">API Reference</a>
</li>
<li class="md-nav__item">
<a href="../about.html" class="md-nav__link">About statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../dev/index.html" class="md-nav__link">Developer Page</a>
</li>
<li class="md-nav__item">
<a href="../release/index.html" class="md-nav__link">Release Notes</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary">
<ul class="md-nav__list" data-md-scrollfix="">
<li class="md-nav__item"><a class="md-nav__extra_link" href="../_sources/generated/statsmodels.multivariate.multivariate_ols._MultivariateOLS.endog_names.rst.txt">Show Source</a> </li>
<li id="searchbox" class="md-nav__item"></li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset" role="main">
<h1 id="generated-statsmodels-multivariate-multivariate-ols-multivariateols-endog-names--page-root">statsmodels.multivariate.multivariate_ols._MultivariateOLS.endog_names<a class="headerlink" href="#generated-statsmodels-multivariate-multivariate-ols-multivariateols-endog-names--page-root" title="Permalink to this headline">¶</a></h1>
<dl class="py method">
<dt id="statsmodels.multivariate.multivariate_ols._MultivariateOLS.endog_names">
<em class="property">property </em><code class="sig-prename descclassname">_MultivariateOLS.</code><code class="sig-name descname">endog_names</code><a class="headerlink" href="#statsmodels.multivariate.multivariate_ols._MultivariateOLS.endog_names" title="Permalink to this definition">¶</a></dt>
<dd><p>Names of endogenous variables.</p>
</dd></dl>
</article>
</div>
</div>
</main>
</div>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
<a href="statsmodels.multivariate.multivariate_ols._MultivariateOLS.predict.html" title="statsmodels.multivariate.multivariate_ols._MultivariateOLS.predict"
class="md-flex md-footer-nav__link md-footer-nav__link--prev"
rel="prev">
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span
class="md-footer-nav__direction"> Previous </span> statsmodels.multivariate.multivariate_ols._MultivariateOLS.predict </span>
</div>
</a>
<a href="statsmodels.multivariate.multivariate_ols._MultivariateOLS.exog_names.html" title="statsmodels.multivariate.multivariate_ols._MultivariateOLS.exog_names"
class="md-flex md-footer-nav__link md-footer-nav__link--next"
rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"><span
class="md-flex__ellipsis"> <span
class="md-footer-nav__direction"> Next </span> statsmodels.multivariate.multivariate_ols._MultivariateOLS.exog_names </span>
</div>
<div class="md-flex__cell md-flex__cell--shrink"><i
class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
© Copyright 2009-2019, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
</div>
Last updated on
Feb 02, 2021.
<br/>
Created using
<a href="http://www.sphinx-doc.org/">Sphinx</a> 3.4.3.
and
<a href="https://github.com/bashtage/sphinx-material/">Material for
Sphinx</a>
</div>
</div>
</div>
</footer>
<script src="../_static/javascripts/application.js"></script>
<script>app.initialize({version: "1.0.4", url: {base: ".."}})</script>
</body>
</html>
|
{
"content_hash": "557803089c892fed3285a8e5659beb3a",
"timestamp": "",
"source": "github",
"line_count": 462,
"max_line_length": 999,
"avg_line_length": 39.917748917748916,
"alnum_prop": 0.6073094024509272,
"repo_name": "statsmodels/statsmodels.github.io",
"id": "e1265b1df1b55d040d998505241ba83e6bc76b83",
"size": "18446",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "v0.12.2/generated/statsmodels.multivariate.multivariate_ols._MultivariateOLS.endog_names.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": []
}
|
<!--
Copyright 2014 Google Inc. All rights reserved.
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.
-->
<resources>
<!-- UI elements -->
<dimen name="whats_on_height">64dp</dimen>
<dimen name="track_icon_source_size">48dp</dimen>
<dimen name="track_icon_size">32dp</dimen>
<dimen name="track_icon_padding">2dp</dimen>
<dimen name="page_margin_width">16dp</dimen>
<dimen name="list_extra_button_width">48dp</dimen>
<dimen name="action_button_min_width">56dp</dimen>
<dimen name="multipane_half_padding">8dp</dimen>
<dimen name="multipane_padding">16dp</dimen>
<dimen name="list_scroll_top_offset">16dp</dimen>
<dimen name="schedule_block_time_width">72dp</dimen>
<dimen name="map_multipane_right_padding">48dp</dimen>
<dimen name="map_info_maxwidth">360dp</dimen>
<dimen name="add_to_schedule_button_height">56dp</dimen> <!-- including padding -->
<dimen name="add_to_schedule_button_height_no_padding">40dp</dimen>
<dimen name="indeterminate_progress_size">16dp</dimen>
<dimen name="expert_icon_size">120dp</dimen>
<dimen name="partner_icon_size">120dp</dimen>
<dimen name="data_item_padding">16dp</dimen>
<dimen name="session_details_floating_width">500dp</dimen>
<dimen name="session_details_floating_height">650dp</dimen>
<dimen name="session_details_extra_space_bottom">48dp</dimen>
<dimen name="my_schedule_item_height">136dp</dimen>
<dimen name="my_schedule_item_height_break">80dp</dimen>
<dimen name="my_schedule_item_height_past">60dp</dimen>
<dimen name="my_schedule_time_column_width">100dp</dimen>
<dimen name="my_schedule_title_strip_padding">8dp</dimen>
<dimen name="widget_schedule_time_width">72dp</dimen>
<dimen name="widget_item_height">108dp</dimen>
<dimen name="widget_item_height_break">80dp</dimen>
<!-- Explore activity -->
<dimen name="list_item_action_width">105dp</dimen>
<dimen name="list_item_action_height">90dp</dimen>
<dimen name="list_item_action_margin">2dp</dimen>
<dimen name="action_button_padding">10dp</dimen>
<dimen name="spinner_left_padding">16dp</dimen>
<!-- body content -->
<dimen name="element_spacing_normal">8dp</dimen>
<dimen name="content_padding_normal">16dp</dimen>
<dimen name="text_size_xsmall">11sp</dimen>
<dimen name="text_size_small">12sp</dimen>
<dimen name="text_size_medium">14sp</dimen>
<dimen name="text_size_large">18sp</dimen>
<dimen name="text_size_xlarge">20sp</dimen>
<dimen name="text_size_xxlarge">24sp</dimen>
<dimen name="text_size_diff_large_small">6sp</dimen>
<dimen name="speaker_image_size">40dp</dimen>
<!-- Widget -->
<dimen name="widget_margin">0dp</dimen>
<!-- Map -->
<dimen name="map_content_padding">8dp</dimen>
<dimen name="map_infowindow_width">260dp</dimen>
<dimen name="navdrawer_chosen_account_height">140dp</dimen>
<dimen name="navdrawer_width">260dp</dimen>
<dimen name="navdrawer_profile_image_size">40dp</dimen>
<!-- Action Bar auto-hide-on-scroll behavior parameters -->
<dimen name="action_bar_auto_hide_min_y">152dp</dimen>
<dimen name="action_bar_auto_hide_sensivity">48dp</dimen>
<dimen name="swipe_refresh_progress_bar_start_margin">-40dp</dimen>
<dimen name="swipe_refresh_progress_bar_end_margin">16dp</dimen>
<dimen name="browse_sessions_anim_amount">400dp</dimen>
<dimen name="butter_bar_height">64dp</dimen>
<dimen name="filterbar_height">48dp</dimen>
<dimen name="explore_dropdown_item_padding_normal">16dp</dimen>
<dimen name="explore_dropdown_item_padding_indented">16dp</dimen>
<dimen name="explore_dropdown_item_width">240dp</dimen>
<dimen name="explore_dropdown_item_height">48dp</dimen>
<dimen name="explore_spinner_width">200dp</dimen>
<dimen name="explore_grid_padding">4dp</dimen>
<dimen name="explore_grid_padding_half">2dp</dimen>
<dimen name="explore_hero_item_height">240dp</dimen>
<dimen name="filter_spinner_width">0dp</dimen>
<integer name="filter_spinner_weight">1</integer>
<dimen name="tag_color_dot_size">12dp</dimen>
<!-- Live Stream -->
<dimen name="livestream_dropdown_item_width">240dp</dimen>
<dimen name="livestream_dropdown_item_height">48dp</dimen>
<dimen name="livestream_spinner_width">210dp</dimen>
<dimen name="livestream_spinner_text_size">16sp</dimen>
<dimen name="livestream_dropdown_text_size">14sp</dimen>
<dimen name="livestream_session_title_text_size">20sp</dimen>
<dimen name="livestream_session_summary_text_size">14sp</dimen>
<dimen name="keyline_1">16dp</dimen>
<dimen name="keyline_1_minus_8dp">8dp</dimen>
<dimen name="keyline_2">72dp</dimen>
<dimen name="keyline_2_minus_16dp">56dp</dimen>
<dimen name="keyline_2_session_detail">@dimen/keyline_2</dimen>
<dimen name="session_detail_speaker_left_offset">@dimen/keyline_1</dimen>
<dimen name="fab_elevation">8dp</dimen>
<dimen name="fab_press_translation_z">6dp</dimen>
<dimen name="headerbar_elevation">4dp</dimen>
<dimen name="session_detail_max_header_elevation">@dimen/headerbar_elevation</dimen>
<dimen name="card_elevation">2dp</dimen>
<dimen name="card_corner_radius">2dp</dimen>
<!-- Social -->
<dimen name="hashtag_line_height">1dp</dimen>
<dimen name="hashtag_height">120dp</dimen>
<dimen name="hashtag_desc_size">40dp</dimen>
<dimen name="social_hz_margin">0dp</dimen>
<dimen name="hashtag_text_size">14sp</dimen>
<dimen name="hashtag_hero_text_size">45sp</dimen>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<!-- Per the design guidelines, navigation drawers should be between 240dp and 320dp:
https://developer.android.com/design/patterns/navigation-drawer.html -->
<dimen name="navigation_drawer_width">240dp</dimen>
</resources>
|
{
"content_hash": "3e82cf0461f25d89c935f0a970afd1db",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 89,
"avg_line_length": 44.73287671232877,
"alnum_prop": 0.6926963711529628,
"repo_name": "achiever202/InfoX",
"id": "9921e2c33250cfe9862e346cbc3795e2d0e3b60f",
"size": "6531",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "android/app/src/main/res/values/dimens.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "548303"
},
{
"name": "PHP",
"bytes": "7746"
}
]
}
|
<?php
namespace Google\AdsApi\AdManager\v202208;
/**
* This file was generated from WSDL. DO NOT EDIT.
*/
class MobileApplicationTargeting
{
/**
* @var int[] $mobileApplicationIds
*/
protected $mobileApplicationIds = null;
/**
* @var boolean $isTargeted
*/
protected $isTargeted = null;
/**
* @param int[] $mobileApplicationIds
* @param boolean $isTargeted
*/
public function __construct(array $mobileApplicationIds = null, $isTargeted = null)
{
$this->mobileApplicationIds = $mobileApplicationIds;
$this->isTargeted = $isTargeted;
}
/**
* @return int[]
*/
public function getMobileApplicationIds()
{
return $this->mobileApplicationIds;
}
/**
* @param int[]|null $mobileApplicationIds
* @return \Google\AdsApi\AdManager\v202208\MobileApplicationTargeting
*/
public function setMobileApplicationIds(array $mobileApplicationIds = null)
{
$this->mobileApplicationIds = $mobileApplicationIds;
return $this;
}
/**
* @return boolean
*/
public function getIsTargeted()
{
return $this->isTargeted;
}
/**
* @param boolean $isTargeted
* @return \Google\AdsApi\AdManager\v202208\MobileApplicationTargeting
*/
public function setIsTargeted($isTargeted)
{
$this->isTargeted = $isTargeted;
return $this;
}
}
|
{
"content_hash": "842848d065e1ce6f2590e1518047ce4e",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 87,
"avg_line_length": 21.11764705882353,
"alnum_prop": 0.6232590529247911,
"repo_name": "googleads/googleads-php-lib",
"id": "c031753edf234d70c1dc282d28d2c5e2961cfe7b",
"size": "1436",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "src/Google/AdsApi/AdManager/v202208/MobileApplicationTargeting.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "PHP",
"bytes": "11415914"
}
]
}
|
<!DOCTYPE html>
<html lang="en" ng-app>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Secure Chat - PWS</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/site.css">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-xs-12 header">
<div class="row">
<header class="col-md-4 col-lg-3">
<button id="nav-toggle" class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-header">☰</button>
<button id="button_back" class="navbar-toggler small-invisible hidden-md hidden-lg visible-xs visible-sm" type="button"><</button>
<p class="pull-right">Secure chat</p>
</header>
</div>
</div>
</div>
<div id="content" class="row main">
<center><p style="margin-top: 50px;">Loading...</p></center>
</div>
</div>
<!-- Templates -->
<script src="chatview.html" name="chatview" type="x-tmpl-mustache"></script>
<script src="username.html" name="username" type="x-tmpl-mustache"></script>
<script src="base.html" name="base" type="x-tmpl-mustache"></script>
<script src="add_contact.html" name="add_contact" type="x-tmpl-mustache"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"></script>
<script src="js/site.js"></script>
<script src="js/pnglib.js"></script>
<script src="js/identicon.js"></script>
<script src="js/pgp/openpgp.js"></script>
<script src="js/mustache.js"></script>
<script src="js/template.js"></script>
<script src="js/apirequest.js"></script>
<script src="js/site.js"></script>
</body>
</html>
|
{
"content_hash": "2389c799ffa1f33bb576daef43dd727c",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 236,
"avg_line_length": 52.19565217391305,
"alnum_prop": 0.6522282382340692,
"repo_name": "Yoeori/pws",
"id": "e1f889d6580dafbc9d30f82f7e22e6710aae207c",
"size": "2401",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3605"
},
{
"name": "HTML",
"bytes": "12190"
},
{
"name": "JavaScript",
"bytes": "627708"
},
{
"name": "Ruby",
"bytes": "19041"
}
]
}
|
require "monet/version"
require 'monet/config'
require 'monet/capture'
require 'monet/baseline_control'
require 'monet/router'
require 'monet/image'
module Monet
end
|
{
"content_hash": "acfa4ce66b1240788e8c228cc4772dc2",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 32,
"avg_line_length": 18.555555555555557,
"alnum_prop": 0.7904191616766467,
"repo_name": "plukevdh/monet",
"id": "020e6aa5f479c38f14fddabb1da8e3e15656a7a7",
"size": "167",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/monet.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "38506"
}
]
}
|
package cpup.mc.personalTech.air
sealed trait AirMode {}
object AirMode {
case object Disabled extends AirMode
case class Attack(dmg: Int) extends AirMode
case class Harvest(tool: String, level: Int) extends AirMode
}
|
{
"content_hash": "121659eb64e37a050adcaee3424b299f",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 61,
"avg_line_length": 24.666666666666668,
"alnum_prop": 0.7837837837837838,
"repo_name": "CoderPuppy/personaltech-mc",
"id": "cdd2aca18d2421a955f1b9527fb21ce38b2b0f0b",
"size": "222",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/scala/cpup/mc/personalTech/air/AirMode.scala",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Groovy",
"bytes": "1242"
},
{
"name": "Scala",
"bytes": "10895"
}
]
}
|
require 'spec_helper'
describe Banzai::Filter::AutolinkFilter do
include FilterSpecHelper
let(:link) { 'http://about.gitlab.com/' }
let(:quotes) { ['"', "'"] }
it 'does nothing when :autolink is false' do
exp = act = link
expect(filter(act, autolink: false).to_html).to eq exp
end
it 'does nothing with non-link text' do
exp = act = 'This text contains no links to autolink'
expect(filter(act).to_html).to eq exp
end
context 'Various schemes' do
it 'autolinks http' do
doc = filter("See #{link}")
expect(doc.at_css('a').text).to eq link
expect(doc.at_css('a')['href']).to eq link
end
it 'autolinks https' do
link = 'https://google.com/'
doc = filter("See #{link}")
expect(doc.at_css('a').text).to eq link
expect(doc.at_css('a')['href']).to eq link
end
it 'autolinks ftp' do
link = 'ftp://ftp.us.debian.org/debian/'
doc = filter("See #{link}")
expect(doc.at_css('a').text).to eq link
expect(doc.at_css('a')['href']).to eq link
end
it 'autolinks short URLs' do
link = 'http://localhost:3000/'
doc = filter("See #{link}")
expect(doc.at_css('a').text).to eq link
expect(doc.at_css('a')['href']).to eq link
end
it 'autolinks multiple URLs' do
link1 = 'http://localhost:3000/'
link2 = 'http://google.com/'
doc = filter("See #{link1} and #{link2}")
found_links = doc.css('a')
expect(found_links.size).to eq(2)
expect(found_links[0].text).to eq(link1)
expect(found_links[0]['href']).to eq(link1)
expect(found_links[1].text).to eq(link2)
expect(found_links[1]['href']).to eq(link2)
end
it 'accepts link_attr options' do
doc = filter("See #{link}", link_attr: { class: 'custom' })
expect(doc.at_css('a')['class']).to eq 'custom'
end
it 'autolinks smb' do
link = 'smb:///Volumes/shared/foo.pdf'
doc = filter("See #{link}")
expect(doc.at_css('a').text).to eq link
expect(doc.at_css('a')['href']).to eq link
end
it 'autolinks multiple occurences of smb' do
link1 = 'smb:///Volumes/shared/foo.pdf'
link2 = 'smb:///Volumes/shared/bar.pdf'
doc = filter("See #{link1} and #{link2}")
found_links = doc.css('a')
expect(found_links.size).to eq(2)
expect(found_links[0].text).to eq(link1)
expect(found_links[0]['href']).to eq(link1)
expect(found_links[1].text).to eq(link2)
expect(found_links[1]['href']).to eq(link2)
end
it 'autolinks irc' do
link = 'irc://irc.freenode.net/git'
doc = filter("See #{link}")
expect(doc.at_css('a').text).to eq link
expect(doc.at_css('a')['href']).to eq link
end
it 'autolinks rdar' do
link = 'rdar://localhost.com/blah'
doc = filter("See #{link}")
expect(doc.at_css('a').text).to eq link
expect(doc.at_css('a')['href']).to eq link
end
it 'does not autolink javascript' do
link = 'javascript://alert(document.cookie);'
doc = filter("See #{link}")
expect(doc.at_css('a')).to be_nil
end
it 'does not autolink bad URLs' do
link = 'foo://23423:::asdf'
doc = filter("See #{link}")
expect(doc.to_s).to eq("See #{link}")
end
it 'does not include trailing punctuation' do
['.', ', ok?', '...', '?', '!', ': is that ok?'].each do |trailing_punctuation|
doc = filter("See #{link}#{trailing_punctuation}")
expect(doc.at_css('a').text).to eq link
end
end
it 'includes trailing punctuation when part of a balanced pair' do
described_class::PUNCTUATION_PAIRS.each do |close, open|
next if open.in?(quotes)
balanced_link = "#{link}#{open}abc#{close}"
balanced_actual = filter("See #{balanced_link}...")
unbalanced_link = "#{link}#{close}"
unbalanced_actual = filter("See #{unbalanced_link}...")
expect(balanced_actual.at_css('a').text).to eq(balanced_link)
expect(unescape(balanced_actual.to_html)).to eq(Rinku.auto_link("See #{balanced_link}..."))
expect(unbalanced_actual.at_css('a').text).to eq(link)
expect(unescape(unbalanced_actual.to_html)).to eq(Rinku.auto_link("See #{unbalanced_link}..."))
end
end
it 'removes trailing quotes' do
quotes.each do |quote|
balanced_link = "#{link}#{quote}abc#{quote}"
balanced_actual = filter("See #{balanced_link}...")
unbalanced_link = "#{link}#{quote}"
unbalanced_actual = filter("See #{unbalanced_link}...")
expect(balanced_actual.at_css('a').text).to eq(balanced_link[0...-1])
expect(unescape(balanced_actual.to_html)).to eq(Rinku.auto_link("See #{balanced_link}..."))
expect(unbalanced_actual.at_css('a').text).to eq(link)
expect(unescape(unbalanced_actual.to_html)).to eq(Rinku.auto_link("See #{unbalanced_link}..."))
end
end
it 'removes one closing punctuation mark when the punctuation in the link is unbalanced' do
complicated_link = "(#{link}(a'b[c'd]))'"
expected_complicated_link = %Q{(<a href="#{link}(a'b[c'd]))">#{link}(a'b[c'd]))</a>'}
actual = unescape(filter(complicated_link).to_html)
expect(actual).to eq(Rinku.auto_link(complicated_link))
expect(actual).to eq(expected_complicated_link)
end
it 'does not double-encode HTML entities' do
encoded_link = "#{link}?foo=bar&baz=quux"
expected_encoded_link = %Q{<a href="#{encoded_link}">#{encoded_link}</a>}
actual = unescape(filter(encoded_link).to_html)
expect(actual).to eq(Rinku.auto_link(encoded_link))
expect(actual).to eq(expected_encoded_link)
end
it 'does not include trailing HTML entities' do
doc = filter("See <<<#{link}>>>")
expect(doc.at_css('a')['href']).to eq link
expect(doc.text).to eq "See <<<#{link}>>>"
end
it 'accepts link_attr options' do
doc = filter("See #{link}", link_attr: { class: 'custom' })
expect(doc.at_css('a')['class']).to eq 'custom'
end
described_class::IGNORE_PARENTS.each do |elem|
it "ignores valid links contained inside '#{elem}' element" do
exp = act = "<#{elem}>See #{link}</#{elem}>"
expect(filter(act).to_html).to eq exp
end
end
end
context 'when the link is inside a tag' do
%w[http rdar].each do |protocol|
it "renders text after the link correctly for #{protocol}" do
doc = filter(ERB::Util.html_escape_once("<#{protocol}://link><another>"))
expect(doc.children.last.text).to include('<another>')
end
end
end
# Rinku does not escape these characters in HTML attributes, but content_tag
# does. We don't care about that difference for these specs, though.
def unescape(html)
%w([ ] { }).each do |cgi_escape|
html.sub!(CGI.escape(cgi_escape), cgi_escape)
end
quotes.each do |html_escape|
html.sub!(CGI.escape_html(html_escape), html_escape)
html.sub!(CGI.escape(html_escape), CGI.escape_html(html_escape))
end
html
end
end
|
{
"content_hash": "e999fdc41ac88a1c9b0c941b3792f863",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 103,
"avg_line_length": 32.053811659192824,
"alnum_prop": 0.5989087856743145,
"repo_name": "jirutka/gitlabhq",
"id": "a50329473addab11298956e0a839b6d97fd9edb5",
"size": "7148",
"binary": false,
"copies": "1",
"ref": "refs/heads/11-3-stable",
"path": "spec/lib/banzai/filter/autolink_filter_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "651536"
},
{
"name": "Clojure",
"bytes": "79"
},
{
"name": "Dockerfile",
"bytes": "1676"
},
{
"name": "HTML",
"bytes": "1281244"
},
{
"name": "JavaScript",
"bytes": "3887640"
},
{
"name": "Ruby",
"bytes": "17664250"
},
{
"name": "Shell",
"bytes": "30673"
},
{
"name": "Vue",
"bytes": "967573"
}
]
}
|
/* vim: set expandtab ts=4 sw=4: */
/*
* You may redistribute this program and/or modify it under the terms of
* the GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "crypto/random/Random.h"
#include "memory/MallocAllocator.h"
#include "util/Bits.h"
#include "util/Base32.h"
#include "util/Assert.h"
#include <stdio.h>
int main()
{
struct Allocator* alloc = MallocAllocator_new(20000);
struct Random* rand = Random_new(alloc, NULL, NULL);
uint8_t bytes[32];
Random_bytes(rand, bytes, 32);
uint8_t base32[64];
Bits_memset(base32, 0, 64);
Assert_true(Base32_encode(base32, 64, bytes, 32) == 52);
//printf("base32 encoded: %s\n", base32);
uint8_t bytes2[32];
Assert_true(Base32_decode(bytes2, 32, base32, 52) == 32);
Assert_true(Bits_memcmp(bytes, bytes2, 32) == 0);
Allocator_free(alloc);
return 0;
}
|
{
"content_hash": "a0cad766c6f3a93b12054afbc9831bbb",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 79,
"avg_line_length": 30.4,
"alnum_prop": 0.6915204678362573,
"repo_name": "krattai/noo-ebs",
"id": "fb5e050df0e46c7b8693fd445ce9519d521d5d20",
"size": "1368",
"binary": false,
"copies": "28",
"ref": "refs/heads/master",
"path": "ref_code/cjdns/util/test/Base32_test.c",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "ActionScript",
"bytes": "2384"
},
{
"name": "Assembly",
"bytes": "4590201"
},
{
"name": "Awk",
"bytes": "396"
},
{
"name": "Batchfile",
"bytes": "19241"
},
{
"name": "C",
"bytes": "15563482"
},
{
"name": "C#",
"bytes": "265955"
},
{
"name": "C++",
"bytes": "691846"
},
{
"name": "CMake",
"bytes": "104078"
},
{
"name": "CSS",
"bytes": "72772"
},
{
"name": "DTrace",
"bytes": "1258"
},
{
"name": "Erlang",
"bytes": "4424888"
},
{
"name": "GAP",
"bytes": "1517"
},
{
"name": "HTML",
"bytes": "65461"
},
{
"name": "Haxe",
"bytes": "6282"
},
{
"name": "Java",
"bytes": "6899"
},
{
"name": "JavaScript",
"bytes": "494026"
},
{
"name": "Lua",
"bytes": "274783"
},
{
"name": "M4",
"bytes": "107581"
},
{
"name": "Makefile",
"bytes": "143161"
},
{
"name": "NSIS",
"bytes": "27658"
},
{
"name": "Objective-C",
"bytes": "13321"
},
{
"name": "PHP",
"bytes": "43263"
},
{
"name": "PLpgSQL",
"bytes": "80625"
},
{
"name": "Perl",
"bytes": "344546"
},
{
"name": "Python",
"bytes": "500718"
},
{
"name": "QML",
"bytes": "150"
},
{
"name": "QMake",
"bytes": "3028"
},
{
"name": "Ragel",
"bytes": "46210"
},
{
"name": "Roff",
"bytes": "120721"
},
{
"name": "Ruby",
"bytes": "121530"
},
{
"name": "Shell",
"bytes": "293349"
},
{
"name": "TeX",
"bytes": "788237"
},
{
"name": "XSLT",
"bytes": "1459"
},
{
"name": "Yacc",
"bytes": "5139"
}
]
}
|
End of preview.
No dataset card yet
- Downloads last month
- 3