hexsha
stringlengths
40
40
size
int64
5
1.05M
ext
stringclasses
98 values
lang
stringclasses
21 values
max_stars_repo_path
stringlengths
3
945
max_stars_repo_name
stringlengths
4
118
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
listlengths
1
10
max_stars_count
int64
1
368k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
945
max_issues_repo_name
stringlengths
4
118
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
10
max_issues_count
int64
1
134k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
945
max_forks_repo_name
stringlengths
4
135
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
10
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
5
1.05M
avg_line_length
float64
1
1.03M
max_line_length
int64
2
1.03M
alphanum_fraction
float64
0
1
40f81863f30f5deda27ec5317f9b6385ca5abdc6
2,951
py
Python
Machine Learning/Classification with GNN using DGL (MXnet)/sagemaker_graph_fraud_detection/dgl_fraud_detection/graph.py
SherryXDing/wwps-payment-integrity-solutions
8c46b24b71f1fcfe1985c61b6b410ef32fe9d412
[ "MIT-0" ]
null
null
null
Machine Learning/Classification with GNN using DGL (MXnet)/sagemaker_graph_fraud_detection/dgl_fraud_detection/graph.py
SherryXDing/wwps-payment-integrity-solutions
8c46b24b71f1fcfe1985c61b6b410ef32fe9d412
[ "MIT-0" ]
null
null
null
Machine Learning/Classification with GNN using DGL (MXnet)/sagemaker_graph_fraud_detection/dgl_fraud_detection/graph.py
SherryXDing/wwps-payment-integrity-solutions
8c46b24b71f1fcfe1985c61b6b410ef32fe9d412
[ "MIT-0" ]
1
2022-03-04T16:07:08.000Z
2022-03-04T16:07:08.000Z
import os import re import dgl import numpy as np from data import * def get_edgelists(edgelist_expression, directory): if "," in edgelist_expression: return edgelist_expression.split(",") files = os.listdir(directory) compiled_expression = re.compile(edgelist_expression) return [filename for filename in files if compiled_expression.match(filename)] def construct_graph(training_dir, edges, nodes, target_node_type, heterogeneous=True): if heterogeneous: print("Getting relation graphs from the following edge lists : {} ".format(edges)) edgelists, id_to_node = {}, {} for i, edge in enumerate(edges): edgelist, id_to_node, src, dst = parse_edgelist(os.path.join(training_dir, edge), id_to_node, header=True) if src == target_node_type: src = 'target' if dst == target_node_type: dst = 'target' edgelists[(src, 'relation{}'.format(i), dst)] = edgelist print("Read edges for relation{} from edgelist: {}".format(i, os.path.join(training_dir, edge))) # reverse edge list so that relation is undirected edgelists[(dst, 'reverse_relation{}'.format(i), src)] = [(b, a) for a, b in edgelist] # get features for target nodes features, new_nodes = get_features(id_to_node[target_node_type], os.path.join(training_dir, nodes)) print("Read in features for target nodes") # handle target nodes that have features but don't have any connections # if new_nodes: # edgelists[('target', 'relation'.format(i+1), 'none')] = [(node, 0) for node in new_nodes] # edgelists[('none', 'reverse_relation{}'.format(i + 1), 'target')] = [(0, node) for node in new_nodes] # add self relation edgelists[('target', 'self_relation', 'target')] = [(t, t) for t in id_to_node[target_node_type].values()] g = dgl.heterograph(edgelists) print( "Constructed heterograph with the following metagraph structure: Node types {}, Edge types{}".format( g.ntypes, g.canonical_etypes)) print("Number of nodes of type target : {}".format(g.number_of_nodes('target'))) g.nodes['target'].data['features'] = features id_to_node = id_to_node[target_node_type] else: sources, sinks, features, id_to_node = read_edges(os.path.join(training_dir, edges[0]), os.path.join(training_dir, nodes)) # add self relation all_nodes = sorted(id_to_node.values()) sources.extend(all_nodes) sinks.extend(all_nodes) g = dgl.graph((sources, sinks)) if features: g.ndata['features'] = np.array(features).astype('float32') print('read graph from node list and edge list') features = g.ndata['features'] return g, features, id_to_node
40.986111
118
0.627923
b8ac67f64a679141d312605640c84ffef417e5cc
838
kt
Kotlin
ktorm-support-sqlserver/src/test/kotlin/org/ktorm/support/sqlserver/BaseSqlServerTest.kt
vincentlauvlwj/KtOrm
85647c01ed6504ea7a13a9e4ee4b50377dfd8e6a
[ "Apache-2.0" ]
1
2018-12-02T13:13:15.000Z
2018-12-02T13:13:15.000Z
ktorm-support-sqlserver/src/test/kotlin/org/ktorm/support/sqlserver/BaseSqlServerTest.kt
vincentlauvlwj/KtOrm
85647c01ed6504ea7a13a9e4ee4b50377dfd8e6a
[ "Apache-2.0" ]
null
null
null
ktorm-support-sqlserver/src/test/kotlin/org/ktorm/support/sqlserver/BaseSqlServerTest.kt
vincentlauvlwj/KtOrm
85647c01ed6504ea7a13a9e4ee4b50377dfd8e6a
[ "Apache-2.0" ]
null
null
null
package org.ktorm.support.sqlserver import org.ktorm.BaseTest import org.ktorm.database.Database import org.testcontainers.containers.MSSQLServerContainer import kotlin.concurrent.thread abstract class BaseSqlServerTest : BaseTest() { override fun init() { database = Database.connect(jdbcUrl, driverClassName, username, password) execSqlScript("init-sqlserver-data.sql") } override fun destroy() { execSqlScript("drop-sqlserver-data.sql") } companion object : MSSQLServerContainer<Companion>("mcr.microsoft.com/mssql/server:2017-CU12") { init { // Start the container when it's first used. start() // Stop the container when the process exits. Runtime.getRuntime().addShutdownHook(thread(start = false) { stop() }) } } }
31.037037
100
0.678998
1befd47990c2aabb999d21870c914ec82a69d2d7
8,558
py
Python
aitlas/datasets/eopatch_crops.py
biasvariancelabs/aitlas
e36913c44d5a8393566b7271607ba839f9be0df3
[ "MIT" ]
32
2020-12-04T19:48:19.000Z
2022-03-16T18:18:05.000Z
aitlas/datasets/eopatch_crops.py
biasvariancelabs/aitlas
e36913c44d5a8393566b7271607ba839f9be0df3
[ "MIT" ]
2
2021-04-11T17:09:14.000Z
2021-05-14T13:22:41.000Z
aitlas/datasets/eopatch_crops.py
biasvariancelabs/aitlas
e36913c44d5a8393566b7271607ba839f9be0df3
[ "MIT" ]
8
2021-04-06T22:06:27.000Z
2022-01-30T06:01:39.000Z
from aitlas.datasets.crops_classification import CropsDataset import os import zipfile import tarfile import urllib import numpy as np import pandas as pd from tqdm import tqdm import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split import seaborn as sns import h5py from ..base import BaseDataset from .urls import CODESURL, CLASSMAPPINGURL, INDEX_FILE_URLs, FILESIZES, SHP_URLs, H5_URLs, RAW_CSV_URL from eolearn.core import EOPatch, FeatureType from eolearn.geometry import VectorToRasterTask import matplotlib.pyplot as plt class DownloadProgressBar(tqdm): def update_to(self, b=1, bsize=1, tsize=None): if tsize is not None: self.total = tsize self.update(b * bsize - self.n) def download_file(url, output_path, overwrite=False): if url is None: raise ValueError("download_file: provided url is None!") if not os.path.exists(output_path) or overwrite: with DownloadProgressBar(unit='B', unit_scale=True, miniters=1, desc=url.split('/')[-1]) as t: urllib.request.urlretrieve(url, filename=output_path, reporthook=t.update_to) else: print(f"file exists in {output_path}. specify overwrite=True if intended") BANDS = ['B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B11', 'B12', 'NDVI', 'NDWI', 'Brightness'] class EOPatchCrops(CropsDataset): """EOPatchCrops - a crop type classification dataset""" def __init__(self, config): CropsDataset.__init__(self, config) self.root = self.config.root self.regions = self.config.regions #'slovenia' self.indexfile = self.config.root+os.sep+self.config.csv_file_path self.h5path = {} self.split_sets = ['train','test','val'] for region in self.split_sets: self.h5path[region] = self.config.root+os.sep+region+'.hdf5' self.classmappingfile = self.config.root+os.sep+"classmapping.csv" #self.regions = ['slovenia'] self.load_classmapping(self.classmappingfile) # Only do the timeseries (breizhcrops) file structure generation once, if a general index doesn't exist if not os.path.isfile(self.indexfile): self.preprocess() self.selected_bands = BANDS self.index= pd.read_csv(self.root+os.sep+self.regions[0]+".csv", index_col=None) for region in self.regions[1:]: region_ind = pd.read_csv(self.root+os.sep+region+".csv", index_col=None) self.index = pd.concatenate([self.index,region_ind], axis=0) # self.index will always be all chosen regions summarized # index.csv will be the entire index for all existing regions self.X_list = None self.show_timeseries(0) plt.show() # if "classid" not in index_region.columns or "classname" not in index_region.columns or "region" not in index_region.columns: # # drop fields that are not in the class mapping # index_region = index_region.loc[index_region["CODE_CULTU"].isin(self.mapping.index)] # index_region[["classid", "classname"]] = index_region["CODE_CULTU"].apply( # lambda code: self.mapping.loc[code]) # index_region.to_csv(self.indexfile) # # filter zero-length time series # if self.index.index.name != "idx": # self.index = self.index.loc[self.index.sequencelength > self.config.filter_length] # set_index('idx') # self.maxseqlength = int(self.index["sequencelength"].max()) def preprocess(self): self.eopatches = [f.name for f in os.scandir(self.root+os.sep+'eopatches') if f.is_dir()] self.indexfile = self.root+os.sep+'index.csv' print(self.eopatches) columns = ['path','eopatch', 'polygon_id','CODE_CULTU', 'sequencelength','classid','classname','region'] #self.index = pd.DataFrame(columns=columns) list_index = list() for patch in self.eopatches: eop = EOPatch.load(self.root+os.sep+'eopatches'+os.sep+patch) polygons = eop.vector_timeless["CROP_TYPE_GDF"] for row in polygons.itertuples(): if row.ct_eu_code not in self.mapping.index.values: continue poly_id = int(row.polygon_id) classid = self.mapping.loc[row.ct_eu_code].id classname = self.mapping.loc[row.ct_eu_code].classname list_index.append( { columns[0]:patch+os.sep+str(poly_id), columns[1]:patch, columns[2]:poly_id, columns[3]:row.ct_eu_code, columns[4]:0,#temp_X.shape[0], columns[5]:classid, columns[6]:classname, columns[7]:''#self.region } ) #self.index = pd.concat([self.index, pd.DataFrame([[patch+os.sep+str(poly_id), patch, poly_id, row.ct_eu_code, temp_X.shape[0], classid, classname]], columns=self.index.columns)], axis=0, ignore_index=True) self.index = pd.DataFrame(list_index) self.split() f = {} for set in self.split_sets: f[set] = h5py.File(self.h5path[set], "w") self.index.set_index("path", drop=False, inplace=True) for patch in self.eopatches: eop = EOPatch.load(self.root+os.sep+'eopatches'+os.sep+patch) polygons = eop.vector_timeless["CROP_TYPE_GDF"] for row in polygons.itertuples(): if row.ct_eu_code not in self.mapping.index.values: continue poly_id = int(row.polygon_id) print(self.index) index_row = self.index.loc[patch+os.sep+str(poly_id)] polygon = polygons[polygons.polygon_id==poly_id] temp = VectorToRasterTask(vector_input=polygon, raster_feature=(FeatureType.MASK_TIMELESS, 'poly'), values=1, raster_shape = (FeatureType.MASK_TIMELESS, 'CROP_TYPE') ) polygon_indicator_mask = temp.execute(eop).mask_timeless['poly'] # plt.figure(figsize=(10,10)) # plt.imshow(new_eop.mask_timeless['poly']) # plt.show() print("num_pixels orig "+str(np.sum(polygon_indicator_mask))) seq_length = eop.data["FEATURES_S2"].shape[0] num_bands = eop.data["FEATURES_S2"].shape[3] polygon_indicator_mask_ts = np.repeat(polygon_indicator_mask[np.newaxis,:,:,:], seq_length, axis=0) polygon_indicator_mask_ts = np.repeat(polygon_indicator_mask_ts, num_bands, axis=3) print(polygon_indicator_mask_ts.shape) print("num_pixels "+str(np.sum(polygon_indicator_mask_ts))) print("aggregation_test "+str(np.sum(polygon_indicator_mask_ts, axis=(1,2)))) print("aggregation_test_shape "+str(np.sum(polygon_indicator_mask_ts, axis=(1,2)).shape)) temp_X=np.sum(np.multiply(polygon_indicator_mask_ts, eop.data["FEATURES_S2"]), axis=(1,2)) dset = f[index_row.region].create_dataset(patch+os.sep+str(poly_id), data=temp_X) self.index.reset_index(inplace=True, drop=True) self.write_index() def split(self): print(self.index) X_train, X_test, y_train, y_test = train_test_split(self.index.values, self.index.classid.values, test_size=0.15, random_state=1) X_train, X_val, y_train, y_val = train_test_split(X_train, y_train, test_size=0.15, random_state=1) # 0.25 x 0.8 = 0.2 X_train = pd.DataFrame(X_train, columns=self.index.columns) X_train['region'] = 'train' X_train.to_csv(self.root+os.sep+'train.csv') X_test = pd.DataFrame(X_test, columns=self.index.columns) X_test['region'] = 'test' X_test.to_csv(self.root+os.sep+'test.csv') X_val = pd.DataFrame(X_val, columns=self.index.columns) X_val['region'] = 'val' X_val.to_csv(self.root+os.sep+'val.csv') self.index = pd.concat([X_train, X_val, X_test], ignore_index=True) # sort? print(self.index) def write_index(self): self.index.to_csv(self.indexfile)
40.947368
222
0.60832
f144825a0466cece4bc6630c62ca529a41893319
396
asm
Assembly
oeis/099/A099462.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/099/A099462.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/099/A099462.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A099462: Expansion of x/(1 - 4*x^2 - 4*x^3). ; Submitted by Christian Krause ; 0,1,0,4,4,16,32,80,192,448,1088,2560,6144,14592,34816,82944,197632,471040,1122304,2674688,6373376,15187968,36192256,86245376,205520896,489750528,1167065088,2781085696,6627262464,15792603136,37633392640 mov $4,1 lpb $0 sub $0,1 mov $1,$4 mul $2,4 mov $4,$2 mov $2,$1 add $2,$3 mov $3,$1 lpe mov $0,$1
24.75
203
0.694444
f0d0e6fd4997b84de5993fc9ccc06505ed3e1808
94
cql
SQL
sunbird-cassandra-migration/cassandra-migration/src/main/resources/db/migration/cassandra/V1.87_cassandra.cql
reshmi-nair/sunbird-utils
e02998d272341d9e5a64df58cf0f026bd7256fbb
[ "MIT" ]
4
2017-09-22T14:13:39.000Z
2019-03-28T09:09:53.000Z
sunbird-cassandra-migration/cassandra-migration/src/main/resources/db/migration/cassandra/V1.87_cassandra.cql
reshmi-nair/sunbird-utils
e02998d272341d9e5a64df58cf0f026bd7256fbb
[ "MIT" ]
456
2018-04-11T12:14:34.000Z
2022-03-25T06:17:51.000Z
sunbird-cassandra-migration/cassandra-migration/src/main/resources/db/migration/cassandra/V1.87_cassandra.cql
reshmi-nair/sunbird-utils
e02998d272341d9e5a64df58cf0f026bd7256fbb
[ "MIT" ]
75
2018-05-31T05:09:47.000Z
2022-03-31T03:11:46.000Z
ALTER TABLE sunbird_courses.course_batch ADD cert_templates map<text,frozen<map<text,text>>>;
47
93
0.829787
d0bcb84a0ac2b7e7587088ec345e92aaec1510f7
25,831
css
CSS
web/app/themes/thegem/css/gallery.css
dazlee/rootsiotest2
2716bd5fd677ff38335c824a0bc4832eccab3ea2
[ "MIT" ]
null
null
null
web/app/themes/thegem/css/gallery.css
dazlee/rootsiotest2
2716bd5fd677ff38335c824a0bc4832eccab3ea2
[ "MIT" ]
null
null
null
web/app/themes/thegem/css/gallery.css
dazlee/rootsiotest2
2716bd5fd677ff38335c824a0bc4832eccab3ea2
[ "MIT" ]
null
null
null
.gallery-preloader-wrapper > .row { margin-left: -10px; margin-right: -10px; } .gem-gallery-grid { padding: 0 10px; } .gem-gallery-grid .gallery-set { position: relative; padding: 0; margin: 0; list-style: none; } .gem-gallery-grid.without-padding .gallery-set { padding: 0; } .gem-gallery-grid .gallery-set .gallery-item { padding: 0 0px; margin: 0 0 0px 0; text-align: center; display: inline-block; overflow: hidden; } .gaps-margin.gem-gallery-grid .gallery-set .gallery-item { margin-bottom: 0px; } .gem-gallery-grid.metro .gallery-set .gallery-item { vertical-align: bottom; } .gem-gallery-grid.without-padding .gallery-set .gallery-item { padding: 0; margin: 0; } .gem-gallery-grid.gallery-lazy-scroll .gallery-item.item-lazy-scroll-not-inited { -webkit-transition-duration: 0s !important; -moz-transition-duration: 0s !important; -o-transition-duration: 0s !important; transition-duration: 0s !important; } .gem-gallery-grid.gallery-lazy-scroll .gallery-item.item-lazy-scroll .wrap { visibility: hidden; } .gem-gallery-grid.gallery-lazy-scroll .gallery-item.item-lazy-scroll.item-lazy-scroll-showed .wrap { visibility: visible; -webkit-animation: fadeInGalleryItem 1s ease; -moz-animation: fadeInGalleryItem 1s ease; -o-animation: fadeInGalleryItem 1s ease; animation: fadeInGalleryItem 1s ease; -webkit-animation-fill-mode: both; -moz-animation-fill-mode: both; -o-animation-fill-mode: both; animation-fill-mode: both; } @-webkit-keyframes fadeInGalleryItem { 0% { -moz-transform: translateY(40px); -ms-transform: translateY(40px); -webkit-transform: translateY(40px); -o-transform: translateY(40px); transform: translateY(40px); zoom: 1; -webkit-opacity: 0; -moz-opacity: 0; filter: alpha(opacity=0); opacity: 0; } 100% { -moz-transform: translateY(0px); -ms-transform: translateY(0px); -webkit-transform: translateY(0px); -o-transform: translateY(0px); transform: translateY(0px); zoom: 1; -webkit-opacity: 1; -moz-opacity: 1; filter: alpha(opacity=100); opacity: 1; } } @-moz-keyframes fadeInGalleryItem { 0% { -moz-transform: translateY(40px); -ms-transform: translateY(40px); -webkit-transform: translateY(40px); -o-transform: translateY(40px); transform: translateY(40px); zoom: 1; -webkit-opacity: 0; -moz-opacity: 0; filter: alpha(opacity=0); opacity: 0; } 100% { -moz-transform: translateY(0px); -ms-transform: translateY(0px); -webkit-transform: translateY(0px); -o-transform: translateY(0px); transform: translateY(0px); zoom: 1; -webkit-opacity: 1; -moz-opacity: 1; filter: alpha(opacity=100); opacity: 1; } } @-o-keyframes fadeInGalleryItem { 0% { -moz-transform: translateY(40px); -ms-transform: translateY(40px); -webkit-transform: translateY(40px); -o-transform: translateY(40px); transform: translateY(40px); zoom: 1; -webkit-opacity: 0; -moz-opacity: 0; filter: alpha(opacity=0); opacity: 0; } 100% { -moz-transform: translateY(0px); -ms-transform: translateY(0px); -webkit-transform: translateY(0px); -o-transform: translateY(0px); transform: translateY(0px); zoom: 1; -webkit-opacity: 1; -moz-opacity: 1; filter: alpha(opacity=100); opacity: 1; } } @keyframes fadeInGalleryItem { 0% { -moz-transform: translateY(40px); -ms-transform: translateY(40px); -webkit-transform: translateY(40px); -o-transform: translateY(40px); transform: translateY(40px); zoom: 1; -webkit-opacity: 0; -moz-opacity: 0; filter: alpha(opacity=0); opacity: 0; } 100% { -moz-transform: translateY(0px); -ms-transform: translateY(0px); -webkit-transform: translateY(0px); -o-transform: translateY(0px); transform: translateY(0px); zoom: 1; -webkit-opacity: 1; -moz-opacity: 1; filter: alpha(opacity=100); opacity: 1; } } .gem-gallery-grid .gallery-set .gallery-item .wrap { max-width: 100%; position: relative; } .gem-gallery-grid .gallery-set .gallery-item .overlay-wrap { max-width: 100%; position: relative; overflow: hidden; z-index: 0; } .gallery-item .image-wrap { overflow: hidden; } .gallery-item .image-wrap.img-circle { border-radius: 50%; -moz-border-radius: 50%; -webkit-border-radius: 50%; } .gem-gallery-grid.without-padding .gallery-item .image-wrap { border-radius: 0; -moz-border-radius: 0; -webkit-border-radius: 0; } .gallery-item .image-wrap img { max-width: 110%; height: auto; } .gem-gallery-grid:not(.hover-horizontal-sliding) .gallery-item .image-wrap img { position: relative; left: -5%; } .gem-gallery-grid.without-padding .gallery-item .image-wrap img { border-radius: 0; -moz-border-radius: 0; -webkit-border-radius: 0; } .gallery-item .overlay { display: none; position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: 2; overflow: hidden; } .gallery-item .overlay .overlay-circle { display: none; } .gallery-item .overlay.img-circle { border-radius: 50%; -moz-border-radius: 50%; -webkit-border-radius: 50%; } .gem-gallery-grid.without-padding .gallery-item .overlay { border-radius: 0; -moz-border-radius: 0; -webkit-border-radius: 0; } .gallery-item .overlay .gallery-item-link { display: block; position: absolute; left: 0; right: 0; top: 0; bottom: 0; text-decoration: none; z-index: 2; cursor: pointer; } .gallery-item .overlay .gallery-item-link.not-link { cursor: default; } .gallery-item .overlay .slide-info { display: none; } .gem-gallery-grid .slide-info { position: static; text-align: left; padding: 19px 15px 17px 15px; } .slideinfo .fancybox-title { text-align: center; width: 100%; padding: 10px 0; } .slideinfo .fancybox-title .slide-info-title { display: block; text-transform: uppercase; } .slideinfo .fancybox-title .slide-info-summary { display: block; padding: 10px 0 0; } .gallery-item .overlay .overlay-content { display: table; width: 100%; height: 100%; } .gallery-item .overlay .overlay-content .overlay-content-center { display: table-cell; width: 100%; height: 100%; text-align: center; vertical-align: middle; padding: 30px; } .hover-gradient .gallery-item .overlay .overlay-content .overlay-content-center { text-align: left; vertical-align: top; } .hover-gradient .gallery-item .overlay .overlay-content-inner .subtitle { display: none !important; } .gem-gallery-grid.hover-gradient.fullwidth-columns-4 .gallery-item:not(.double-item) .overlay .overlay-content-inner .subtitle { display: block !important; } @media only screen and (min-width: 550px) and (max-width: 1550px) { .gem-gallery-grid.hover-gradient.fullwidth-columns-4 .gallery-item:not(.double-item) .overlay .overlay-content-inner .subtitle { display: none !important; } } .hover-gradient .gallery-item .overlay .overlay-content-inner .title { position: absolute; left: 30px; right: 30px; top: auto !important; bottom: 25px; } .hover-gradient .gallery-item .overlay .overlay-content .overlay-content-center { padding: 25px 30px; } .gallery-item .overlay .overlay-content .overlay-content-inner { display: inline-block; } .gallery-item .overlay .overlay-content .overlay-content-inner .gallery-item .overlay a.icon { display: inline-block; text-decoration: none; margin-left: 10px; } .gallery-item .overlay a.icon:first-child { margin-left: 0; } .gem-gallery-grid.hover-horizontal-sliding .gallery-item .overlay .overlay-content .overlay-content-inner{ width: 100%; } .gallery-item .overlay .title { text-transform: uppercase; } .gallery-item .overlay .subtitle, .gallery-item .overlay .subtitle a, .gallery-item .overlay .subtitle p { text-decoration: none; } .gallery-item .overlay .subtitle a { cursor: pointer; } @media only screen and (min-width: 1920px) { .gem-gallery-grid.fullwidth-columns-4 .fullwidth-block .gallery-set .gallery-item { width: 20%; } .gem-gallery-grid.fullwidth-columns-4 .fullwidth-block .gallery-set .gallery-item.double-item:not(.double-item-vertical) { width: 40%; } .gem-gallery-grid.fullwidth-columns-5 .fullwidth-block .gallery-set .gallery-item { width: 16.665%; } .gem-gallery-grid.fullwidth-columns-5 .fullwidth-block .gallery-set .gallery-item.double-item:not(.double-item-vertical) { width: 33.333%; } } @media only screen and (min-width: 1680px) and (max-width: 1920px) { .gem-gallery-grid.fullwidth-columns-4 .fullwidth-block .gallery-set .gallery-item { width: 25%; } .gem-gallery-grid.fullwidth-columns-4 .fullwidth-block .gallery-set .gallery-item.double-item:not(.double-item-vertical) { width: 50%; } .gem-gallery-grid.fullwidth-columns-5 .fullwidth-block .gallery-set .gallery-item { width: 20%; } .gem-gallery-grid.fullwidth-columns-5 .fullwidth-block .gallery-set .gallery-item.double-item:not(.double-item-vertical) { width: 40%; } } @media only screen and (min-width: 992px) and (max-width: 1680px) { .gem-gallery-grid .fullwidth-block .gallery-set .gallery-item { width: 25%; } .gem-gallery-grid .fullwidth-block .gallery-set .gallery-item.double-item:not(.double-item-vertical) { width: 50%; } } @media only screen and (min-width: 700px) and (max-width: 992px) { .gem-gallery-grid .fullwidth-block .gallery-set .gallery-item, .gem-gallery-grid .gallery-set .gallery-item { width: 33.333332%; } .gem-gallery-grid .fullwidth-block .gallery-set .gallery-item.double-item:not(.double-item-vertical), .gem-gallery-grid .gallery-set .gallery-item.double-item:not(.double-item-vertical) { width: 66.66% } } @media only screen and (max-width: 700px) { .gem-gallery-grid .fullwidth-block .gallery-set .gallery-item, .gem-gallery-grid .gallery-set .gallery-item { width: 50%; } .gem-gallery-grid .fullwidth-block .gallery-set .gallery-item.double-item:not(.double-item-vertical), .gem-gallery-grid .gallery-set .gallery-item.double-item:not(.double-item-vertical) { width: 100%; } } @media only screen and (max-width: 550px) { .gem-gallery-grid .fullwidth-block .gallery-set .gallery-item, .gem-gallery-grid .gallery-set .gallery-item { width: 100%; } .gem-gallery-grid .gallery-set .gallery-item.double-item-vertical .image-wrap img { width: 110%; } } @media only screen and (min-width: 992px) and (max-width: 1120px) { .with-sidebar .gem-gallery-grid.columns-3 .gallery-item { width: 50%; } .with-sidebar .gem-gallery-grid.columns-3 .gallery-item.double-item:not(.double-item-vertical) { width: 100%; } } @media only screen and (min-width: 992px) and (max-width: 1100px) { .gem-gallery-grid.columns-4 .gallery-item { width: 33.3333%; } .gem-gallery-grid.columns-4 .gallery-item.double-item:not(.double-item-vertical) { width: 66.66%; } } .gem-gallery-grid.metro.fullwidth-columns-4 .fullwidth-block .gallery-set .gallery-item, .gem-gallery-grid.metro.fullwidth-columns-5 .fullwidth-block .gallery-set .gallery-item { width: auto; } /* Default hover */ .gem-gallery-grid.hover-default .fullwidth-block .overlay .subtitle { display: block; } @media only screen and (max-width: 380px) { .gem-gallery-grid.hover-default .gallery-item .overlay .subtitle { display: none; } } @media only screen and (min-width: 1120px) { .with-sidebar .gem-gallery-grid.hover-default .gallery-item .overlay .subtitle { display: none; } .with-sidebar .gem-gallery-grid.hover-default .gallery-item.double-item .overlay .subtitle { display: block; } } @media only screen and (min-width: 992px) and (max-width: 1040px) { .with-sidebar .gem-gallery-grid.hover-default .gallery-item .overlay .subtitle { display: none; } .with-sidebar .gem-gallery-grid.hover-default .gallery-item.double-item .overlay .subtitle { display: block; } } @media only screen and (min-width: 992px) and (max-width: 1120px) { .gem-gallery-grid.hover-default.columns-3 .gallery-item .overlay .subtitle { display: none; } .gem-gallery-grid.hover-default.columns-3 .gallery-item.double-item .overlay .subtitle { display: block; } } @media only screen and (min-width: 1100px), screen and (min-width: 832px) and (max-width: 1030px) { .gem-gallery-grid.hover-default.columns-4 .gallery-item .overlay .subtitle { display: none; } .gem-gallery-grid.hover-default.columns-4 .gallery-item.double-item .overlay .subtitle { display: block; } } @media only screen and (min-width: 832px) and (max-width: 1100px) { .gem-gallery-grid.hover-default.columns-4 .gallery-item .overlay .subtitle { display: none; } .gem-gallery-grid.hover-default.columns-4 .gallery-item.double-item .overlay .subtitle { display: block; } } @media only screen and (min-width: 992px) { .with-sidebar .gem-gallery-grid.hover-default.columns-4 .gallery-item .overlay .title { font-size: 17px; } } @media only screen and (min-width: 1170px) and (max-width: 1250px), screen and (min-width: 900px) and (max-width: 992px) { .gem-gallery-grid.hover-default .fullwidth-block .gallery-item .overlay .title { font-size: 17px; } } @media only screen and (max-width: 768px) { .gem-gallery-grid.hover-default .fullwidth-block .gallery-item .overlay .subtitle { display: block; } } @media only screen and (max-width: 460px) { .gem-gallery-grid.hover-default .fullwidth-block .gallery-item .overlay .subtitle { display: none; } } @media only screen and (min-width: 1250px) and (max-width: 1770px), screen and (min-width: 992px) and (max-width: 1170px), screen and (min-width: 768px) and (max-width: 900px) { } @media only screen and (min-width: 1170px) and (max-width: 1250px), screen and (min-width: 900px) and (max-width: 992px) { .gem-gallery-grid.hover-default .fullwidth-block .gallery-item .overlay .title { font-size: 17px; } } @media only screen and (max-width: 370px) { } /* Zooming blur hover */ .gem-gallery-grid.hover-zooming-blur .gallery-item .overlay .overlay-line { display: none; } .gem-gallery-grid.hover-zooming-blur .gallery-item .overlay a.icon:before { display: inline-block; width: 70px; height: 70px; text-align: center; font-size: 35px; line-height: 68px; border-radius: 35px; -moz-border-radius: 35px; -webkit-border-radius: 35px; } .gem-gallery-grid.hover-zooming-blur .gallery-item .overlay .subtitle, .gem-gallery-grid.hover-zooming-blur .gallery-item .overlay .subtitle p { } @media only screen and (min-width: 992px) and (max-width: 1060px), screen and (min-width: 768px) and (max-width: 800px) { } @media only screen and (max-width: 380px) { .gem-gallery-grid.hover-zooming-blur .gallery-item .overlay .subtitle { display: none; } } @media only screen and (min-width: 992px) and (max-width: 1100px), screen and (min-width: 768px) and (max-width: 830px) { .with-sidebar .gem-gallery-grid.hover-zooming-blur.columns-2 .gallery-item .overlay .subtitle { display: none; } } @media only screen and (min-width: 768px) { .gem-gallery-grid.hover-zooming-blur.columns-4 .gallery-item .overlay .subtitle { display: none; } .gem-gallery-grid.hover-zooming-blur.columns-4 .gallery-item.double-item .overlay .subtitle { display: block; } } @media only screen and (min-width: 992px) and (max-width: 1120px) { .gem-gallery-grid.hover-zooming-blur.columns-3 .gallery-item .overlay .subtitle { display: none; } .gem-gallery-grid.hover-zooming-blur.columns-3 .gallery-item.double-item .overlay .subtitle { display: block; } } @media only screen and (min-width: 1120px) { .with-sidebar .gem-gallery-grid.hover-zooming-blur.columns-3 .gallery-item .overlay .subtitle { display: none; } .with-sidebar .gem-gallery-grid.hover-zooming-blur.columns-3 .gallery-item.double-item .overlay .subtitle { display: block; } } @media only screen and (min-width: 992px) { .with-sidebar .gem-gallery-grid.hover-zooming-blur.columns-4 .gallery-item .overlay .title { font-size: 17px; } } @media only screen and (min-width: 1250px) and (max-width: 1820px), screen and (min-width: 992px) and (max-width: 1170px), screen and (min-width: 768px) and (max-width: 900px) { .gem-gallery-grid.hover-zooming-blur .fullwidth-block .gallery-item .overlay .title { font-size: 19px; } .gem-gallery-grid.hover-zooming-blur .fullwidth-block .gallery-item .overlay .subtitle { display: none; } .gem-gallery-grid.hover-zooming-blur .fullwidth-block .gallery-item.double-item .overlay .subtitle { display: block; } } @media only screen and (min-width: 1170px) and (max-width: 1250px), screen and (min-width: 900px) and (max-width: 992px) { .gem-gallery-grid.hover-zooming-blur .fullwidth-block .gallery-item .overlay .title { font-size: 17px; } .gem-gallery-grid.hover-zooming-blur .fullwidth-block .gallery-item .overlay .subtitle { display: none; } .gem-gallery-grid.hover-zooming-blur .fullwidth-block .gallery-item.double-item .overlay .subtitle { display: block; } } /* Gradient hover */ .gem-gallery-grid.hover-gradient .gallery-item .overlay .overlay-line { display: none; } .gem-gallery-grid.hover-gradient .gallery-item .overlay a.icon:before { display: inline-block; width: 70px; height: 70px; text-align: center; font-size: 35px; line-height: 68px; border-radius: 35px; -moz-border-radius: 35px; -webkit-border-radius: 35px; } .gem-gallery-grid.hover-gradient.fullwidth-columns-4 .gallery-item:not(.double-item) .overlay a.icon:before { width: 40px; height: 40px; text-align: center; font-size: 16px; line-height: 38px; border-radius: 20px; -moz-border-radius: 20px; -webkit-border-radius: 20px; } .gem-gallery-grid.hover-gradient .gallery-item .overlay .subtitle, .gem-gallery-grid.hover-gradient .gallery-item .overlay .subtitle p { } @media only screen and (min-width: 992px) and (max-width: 1060px), screen and (min-width: 768px) and (max-width: 800px) { } @media only screen and (max-width: 380px) { .gem-gallery-grid.hover-gradient .gallery-item .overlay .subtitle { display: none; } } @media only screen and (min-width: 992px) and (max-width: 1100px), screen and (min-width: 768px) and (max-width: 830px) { .with-sidebar .gem-gallery-grid.hover-gradient.columns-2 .gallery-item .overlay .subtitle { display: none; } } @media only screen and (min-width: 768px) { .gem-gallery-grid.hover-gradient.columns-4 .gallery-item .overlay .subtitle { display: none; } .gem-gallery-grid.hover-gradient.columns-4 .gallery-item.double-item .overlay .subtitle { display: block; } } @media only screen and (min-width: 992px) and (max-width: 1120px) { .gem-gallery-grid.hover-gradient.columns-3 .gallery-item .overlay .subtitle { display: none; } .gem-gallery-grid.hover-gradient.columns-3 .gallery-item.double-item .overlay .subtitle { display: block; } } @media only screen and (min-width: 1120px) { .with-sidebar .gem-gallery-grid.hover-gradient.columns-3 .gallery-item .overlay .subtitle { display: none; } .with-sidebar .gem-gallery-grid.hover-gradient.columns-3 .gallery-item.double-item .overlay .subtitle { display: block; } } @media only screen and (min-width: 992px) { .with-sidebar .gem-gallery-grid.hover-gradient.columns-4 .gallery-item .overlay .title { font-size: 17px; } } @media only screen and (min-width: 1250px) and (max-width: 1820px), screen and (min-width: 992px) and (max-width: 1170px), screen and (min-width: 768px) and (max-width: 900px) { .gem-gallery-grid.hover-gradient .fullwidth-block .gallery-item .overlay .title { font-size: 19px; } .gem-gallery-grid.hover-gradient .fullwidth-block .gallery-item .overlay .subtitle { display: none; } .gem-gallery-grid.hover-gradient .fullwidth-block .gallery-item.double-item .overlay .subtitle { display: block; } } @media only screen and (min-width: 1170px) and (max-width: 1250px), screen and (min-width: 900px) and (max-width: 992px) { .gem-gallery-grid.hover-gradient .fullwidth-block .gallery-item .overlay .title { font-size: 17px; } .gem-gallery-grid.hover-gradient .fullwidth-block .gallery-item .overlay .subtitle { display: none; } .gem-gallery-grid.hover-gradient .fullwidth-block .gallery-item.double-item .overlay .subtitle { display: block; } } @media (max-width: 768px) { body .gem-gallery-grid .gallery-set .gallery-item{ padding: 0; } } .gem-gallery-grid .overlay .title { text-transform: uppercase; } .gem-gallery-grid.hover-vertical-sliding .gallery-set, .gem-gallery-grid.hover-horizontal-sliding .gallery-set, .hover-horizontal-sliding .gallery-item .overlay .overlay-content .overlay-content-center, .gem-gallery-grid.hover-vertical-sliding .gallery-item .overlay .overlay-content .overlay-content-center { text-align: left; } .gem-gallery-grid.hover-vertical-sliding .gallery-item .overlay .overlay-content .overlay-content-center { vertical-align: top; } .gem-gallery-grid.hover-horizontal-sliding .gallery-item .overlay .overlay-content .overlay-content-center { vertical-align: bottom; } .gem-gallery-grid.hover-vertical-sliding .subtitle, .gem-gallery-grid.hover-horizontal-sliding .subtitle { display: none; } .gem-gallery-grid.hover-vertical-sliding .double-item .subtitle, .gem-gallery-grid.hover-horizontal-sliding .double-item .subtitle { display: block; } .gallery-item .overlay a.icon:before { font: 32px 'thegem-icons'; } .hover-default .gallery-item .overlay a.icon.photo:before { content: '\e60f'; } .hover-default .gallery-item .overlay a.icon.link:before { content: '\e61d'; } .gallery-item .overlay a.icon.photo:before { content: '\e629'; } .gallery-item .overlay a.icon.link:before { content: '\e61c'; } .gem-gallery-grid.hover-default .gallery-item .overlay a.icon:before { font-size: 48px; } .gem-gallery-grid.hover-vertical-sliding .overlay .title { margin-top: 15px; } .gem-gallery-grid.hover-vertical-sliding .subtitle { padding-top: 38px; } .gem-gallery-grid.hover-horizontal-sliding .title { margin-bottom: 17px; margin-top: -5px; } .gem-gallery-grid.hover-horizontal-sliding .overlay a.icon { padding-bottom: 20px; } .gem-gallery-grid.hover-horizontal-sliding .subtitle { padding-bottom: 15px; } .gem-gallery-grid.hover-horizontal-sliding .overlay-line { background-color: #FFFFFF; font-size: 0; height: 2px; line-height: 1; max-width: 100%; margin-bottom: 34px; } .gem-gallery-grid.hover-vertical-sliding .overlay-line{ background-color: #FFFFFF; font-size: 0; height: 2px; max-width: 100%; line-height: 1; margin-top: 14px; margin-bottom: 14px; } .gem-gallery-hover-vertical-sliding .gem-gallery-item { text-align: left; } .gem-gallery-hover-default .gem-gallery-preview-carousel-wrap .gem-gallery-item .gem-gallery-caption, .gem-gallery-hover-vertical-sliding .gem-gallery-preview-carousel-wrap .gem-gallery-item .gem-gallery-caption, .gem-gallery-hover-horizontal-sliding .gem-gallery-preview-carousel-wrap .gem-gallery-item .gem-gallery-caption { display: block; } .gem-gallery-grid.hover-circular .gallery-item .overlay .overlay-circle { display: block; } .active .gem-gallery-item-image { position: relative; } .active .gem-gallery-item-image:after { width: 100%; height: 4px; position: absolute; content: ''; top: 0; left: 0; opacity: 1; } @media all and (max-width: 552px) { body .gem-prev.disabled, body .gem-next.disabled { visibility: visible; z-index: 1000; } body .gem-gallery .gem-gallery-preview-carousel-wrap .gem-prev:after, body .gem-gallery .gem-gallery-preview-carousel-wrap .gem-next:after { opacity: 1; z-index: 1000; } .gem-gallery .gem-gallery-item .gem-gallery-item-image a:before, .gem-gallery .gem-gallery-grid.gallery-item .overlay { display: none; } body .gem-gallery .gem-gallery-preview-carousel-wrap .gem-gallery-item a:after, body .gem-gallery .gem-gallery-preview-carousel-wrap .gem-gallery-line { display: none; } body .gem-gallery .gem-gallery-preview-carousel-wrap .gem-prev:after { transform: none; -moz-transform: none; -webkit-transform: none; -o-transform: none; -ms-transform: none; } body .gem-gallery .gem-gallery-preview-carousel-wrap .gem-next:after { transform: none; -moz-transform: none; -webkit-transform: none; -o-transform: none; -ms-transform: none; } body .gem-gallery .gem-gallery-preview-carousel-wrap:hover .gem-gallery-line { display: none; } body .gem-gallery .gem-gallery-thumbs-carousel-wrap { display: none; } .gem-gallery .gem-gallery-preview-carousel-wrap:hover .gem-gallery-item a img { transform: none; -moz-transform: none; -webkit-transform: none; -o-transform: none; -ms-transform: none; } body .fancybox-title.fancybox-title-over-wrap { display: none; } } .columns-4.gem-gallery-grid .gallery-item .overlay a.icon:before { font-size: 24px; } body .gem-gallery-grid .fullwidth-block .gallery-itemm:not(.double-item) .overlay .title, body .gem-gallery-grid.columns-4 .gallery-item:not(.double-item) .overlay .title { font-size: 89.5%; line-height: 1.421; }
26.06559
130
0.684062
fb1e251e83bc47d765869c620c4e4a6c6cc5c956
10,970
c
C
src/forkWindows.c
mudesire/snaphu-1.4.2_vc_win
f280931c01a7ae9e8ef3f92c0a758038b593c599
[ "Unlicense" ]
null
null
null
src/forkWindows.c
mudesire/snaphu-1.4.2_vc_win
f280931c01a7ae9e8ef3f92c0a758038b593c599
[ "Unlicense" ]
null
null
null
src/forkWindows.c
mudesire/snaphu-1.4.2_vc_win
f280931c01a7ae9e8ef3f92c0a758038b593c599
[ "Unlicense" ]
null
null
null
/* * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab * Copyright (C) DIGITEO - 2010 - Allan CORNET * * This file must be used under the terms of the CeCILL. * This source file is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt * */ /*--------------------------------------------------------------------------*/ #include <windows.h> #include <WinNT.h> #include <setjmp.h> #include "forkWindows.h" /*--------------------------------------------------------------------------*/ typedef LONG NTSTATUS; /*--------------------------------------------------------------------------*/ typedef struct _SYSTEM_HANDLE_INFORMATION { ULONG ProcessId; UCHAR ObjectTypeNumber; UCHAR Flags; USHORT Handle; PVOID Object; ACCESS_MASK GrantedAccess; } SYSTEM_HANDLE_INFORMATION, *PSYSTEM_HANDLE_INFORMATION; /*--------------------------------------------------------------------------*/ typedef struct _OBJECT_ATTRIBUTES { ULONG Length; HANDLE RootDirectory; PVOID /* really PUNICODE_STRING */ ObjectName; ULONG Attributes; PVOID SecurityDescriptor; /* type SECURITY_DESCRIPTOR */ PVOID SecurityQualityOfService; /* type SECURITY_QUALITY_OF_SERVICE */ } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES; /*--------------------------------------------------------------------------*/ typedef enum _MEMORY_INFORMATION_ { MemoryBasicInformation, MemoryWorkingSetList, MemorySectionName, MemoryBasicVlmInformation } MEMORY_INFORMATION_CLASS; /*--------------------------------------------------------------------------*/ typedef struct _CLIENT_ID { HANDLE UniqueProcess; HANDLE UniqueThread; } CLIENT_ID, *PCLIENT_ID; /*--------------------------------------------------------------------------*/ typedef struct _USER_STACK { PVOID FixedStackBase; PVOID FixedStackLimit; PVOID ExpandableStackBase; PVOID ExpandableStackLimit; PVOID ExpandableStackBottom; } USER_STACK, *PUSER_STACK; /*--------------------------------------------------------------------------*/ typedef LONG KPRIORITY; typedef ULONG_PTR KAFFINITY; typedef KAFFINITY *PKAFFINITY; /*--------------------------------------------------------------------------*/ typedef struct _THREAD_BASIC_INFORMATION { NTSTATUS ExitStatus; PVOID TebBaseAddress; CLIENT_ID ClientId; KAFFINITY AffinityMask; KPRIORITY Priority; KPRIORITY BasePriority; } THREAD_BASIC_INFORMATION, *PTHREAD_BASIC_INFORMATION; /*--------------------------------------------------------------------------*/ typedef enum _SYSTEM_INFORMATION_CLASS { SystemHandleInformation = 0x10 } SYSTEM_INFORMATION_CLASS; /*--------------------------------------------------------------------------*/ typedef NTSTATUS (NTAPI *ZwWriteVirtualMemory_t)(IN HANDLE ProcessHandle, IN PVOID BaseAddress, IN PVOID Buffer, IN ULONG NumberOfBytesToWrite, OUT PULONG NumberOfBytesWritten OPTIONAL); /*--------------------------------------------------------------------------*/ typedef NTSTATUS (NTAPI *ZwCreateProcess_t)(OUT PHANDLE ProcessHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE InheriteFromProcessHandle, IN BOOLEAN InheritHandles, IN HANDLE SectionHandle OPTIONAL, IN HANDLE DebugPort OPTIONAL, IN HANDLE ExceptionPort OPTIONAL); /*--------------------------------------------------------------------------*/ typedef NTSTATUS (WINAPI *ZwQuerySystemInformation_t)(SYSTEM_INFORMATION_CLASS SystemInformationClass, PVOID SystemInformation, ULONG SystemInformationLength, PULONG ReturnLength); typedef NTSTATUS (NTAPI *ZwQueryVirtualMemory_t)(IN HANDLE ProcessHandle, IN PVOID BaseAddress, IN MEMORY_INFORMATION_CLASS MemoryInformationClass, OUT PVOID MemoryInformation, IN ULONG MemoryInformationLength, OUT PULONG ReturnLength OPTIONAL); /*--------------------------------------------------------------------------*/ typedef NTSTATUS (NTAPI *ZwGetContextThread_t)(IN HANDLE ThreadHandle, OUT PCONTEXT Context); typedef NTSTATUS (NTAPI *ZwCreateThread_t)(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, OUT PCLIENT_ID ClientId, IN PCONTEXT ThreadContext, IN PUSER_STACK UserStack, IN BOOLEAN CreateSuspended); /*--------------------------------------------------------------------------*/ typedef NTSTATUS (NTAPI *ZwResumeThread_t)(IN HANDLE ThreadHandle, OUT PULONG SuspendCount OPTIONAL); typedef NTSTATUS (NTAPI *ZwClose_t)(IN HANDLE ObjectHandle); typedef NTSTATUS (NTAPI *ZwQueryInformationThread_t)(IN HANDLE ThreadHandle, IN THREAD_INFORMATION_CLASS ThreadInformationClass, OUT PVOID ThreadInformation, IN ULONG ThreadInformationLength, OUT PULONG ReturnLength OPTIONAL ); /*--------------------------------------------------------------------------*/ static ZwCreateProcess_t ZwCreateProcess = NULL; static ZwQuerySystemInformation_t ZwQuerySystemInformation = NULL; static ZwQueryVirtualMemory_t ZwQueryVirtualMemory = NULL; static ZwCreateThread_t ZwCreateThread = NULL; static ZwGetContextThread_t ZwGetContextThread = NULL; static ZwResumeThread_t ZwResumeThread = NULL; static ZwClose_t ZwClose = NULL; static ZwQueryInformationThread_t ZwQueryInformationThread = NULL; static ZwWriteVirtualMemory_t ZwWriteVirtualMemory = NULL; /*--------------------------------------------------------------------------*/ #define NtCurrentProcess() ((HANDLE)-1) #define NtCurrentThread() ((HANDLE) -2) /* we use really the Nt versions - so the following is just for completeness */ #define ZwCurrentProcess() NtCurrentProcess() #define ZwCurrentThread() NtCurrentThread() #define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L) #define STATUS_SUCCESS ((NTSTATUS)0x00000000L) /*--------------------------------------------------------------------------*/ /* setjmp env for the jump back into the fork() function */ static jmp_buf jenv; /*--------------------------------------------------------------------------*/ /* entry point for our child thread process - just longjmp into fork */ static int child_entry(void) { longjmp(jenv, 1); return 0; } /*--------------------------------------------------------------------------*/ static BOOL haveLoadedFunctionsForFork(void) { HMODULE ntdll = GetModuleHandle("ntdll"); if (ntdll == NULL) return FALSE; if (ZwCreateProcess && ZwQuerySystemInformation && ZwQueryVirtualMemory && ZwCreateThread && ZwGetContextThread && ZwResumeThread && ZwQueryInformationThread && ZwWriteVirtualMemory && ZwClose) return TRUE; ZwCreateProcess = (ZwCreateProcess_t) GetProcAddress(ntdll, "ZwCreateProcess"); ZwQuerySystemInformation = (ZwQuerySystemInformation_t) GetProcAddress(ntdll, "ZwQuerySystemInformation"); ZwQueryVirtualMemory = (ZwQueryVirtualMemory_t) GetProcAddress(ntdll, "ZwQueryVirtualMemory"); ZwCreateThread = (ZwCreateThread_t) GetProcAddress(ntdll, "ZwCreateThread"); ZwGetContextThread = (ZwGetContextThread_t) GetProcAddress(ntdll, "ZwGetContextThread"); ZwResumeThread = (ZwResumeThread_t) GetProcAddress(ntdll, "ZwResumeThread"); ZwQueryInformationThread = (ZwQueryInformationThread_t) GetProcAddress(ntdll, "ZwQueryInformationThread"); ZwWriteVirtualMemory = (ZwWriteVirtualMemory_t) GetProcAddress(ntdll, "ZwWriteVirtualMemory"); ZwClose = (ZwClose_t) GetProcAddress(ntdll, "ZwClose"); if (ZwCreateProcess && ZwQuerySystemInformation && ZwQueryVirtualMemory && ZwCreateThread && ZwGetContextThread && ZwResumeThread && ZwQueryInformationThread && ZwWriteVirtualMemory && ZwClose) return TRUE; else { ZwCreateProcess = NULL; ZwQuerySystemInformation = NULL; ZwQueryVirtualMemory = NULL; ZwCreateThread = NULL; ZwGetContextThread = NULL; ZwResumeThread = NULL; ZwQueryInformationThread = NULL; ZwWriteVirtualMemory = NULL; ZwClose = NULL; } return FALSE; } /*--------------------------------------------------------------------------*/ int fork(void) { HANDLE hProcess = 0, hThread = 0; OBJECT_ATTRIBUTES oa = { sizeof(oa) }; MEMORY_BASIC_INFORMATION mbi; CLIENT_ID cid; USER_STACK stack; PNT_TIB tib; THREAD_BASIC_INFORMATION tbi; CONTEXT context = {CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS | CONTEXT_FLOATING_POINT}; if (setjmp(jenv) != 0) return 0; /* return as a child */ /* check whether the entry points are initilized and get them if necessary */ if (!ZwCreateProcess && !haveLoadedFunctionsForFork()) return -1; /* create forked process */ ZwCreateProcess(&hProcess, PROCESS_ALL_ACCESS, &oa, NtCurrentProcess(), TRUE, 0, 0, 0); /* set the Eip for the child process to our child function */ ZwGetContextThread(NtCurrentThread(), &context); /* In x64 the Eip and Esp are not present, their x64 counterparts are Rip and Rsp respectively. */ #if _WIN64 context.Rip = (ULONG)child_entry; #else context.Eip = (ULONG)child_entry; #endif #if _WIN64 ZwQueryVirtualMemory(NtCurrentProcess(), (PVOID)context.Rsp, MemoryBasicInformation, &mbi, sizeof mbi, 0); #else ZwQueryVirtualMemory(NtCurrentProcess(), (PVOID)context.Esp, MemoryBasicInformation, &mbi, sizeof mbi, 0); #endif stack.FixedStackBase = 0; stack.FixedStackLimit = 0; stack.ExpandableStackBase = (PCHAR)mbi.BaseAddress + mbi.RegionSize; stack.ExpandableStackLimit = mbi.BaseAddress; stack.ExpandableStackBottom = mbi.AllocationBase; /* create thread using the modified context and stack */ ZwCreateThread(&hThread, THREAD_ALL_ACCESS, &oa, hProcess, &cid, &context, &stack, TRUE); /* copy exception table */ ZwQueryInformationThread(NtCurrentThread(), ThreadMemoryPriority, &tbi, sizeof tbi, 0); tib = (PNT_TIB)tbi.TebBaseAddress; ZwQueryInformationThread(hThread, ThreadMemoryPriority, &tbi, sizeof tbi, 0); ZwWriteVirtualMemory(hProcess, tbi.TebBaseAddress, &tib->ExceptionList, sizeof tib->ExceptionList, 0); /* start (resume really) the child */ ZwResumeThread(hThread, 0); /* clean up */ ZwClose(hThread); ZwClose(hProcess); /* exit with child's pid */ return (int)cid.UniqueProcess; }
44.412955
110
0.608478
47e953edf4e3a054fb7087f89d8754cfa6f2e40e
581
swift
Swift
AmazonFreeRTOS/Services/MqttProxy/Puback.swift
mwillbanks/amazon-freertos-ble-ios-sdk
f29f8ffbb0e64c886b833a3eda8d26df9d3a8353
[ "Apache-2.0" ]
34
2018-12-01T06:36:26.000Z
2021-12-03T21:13:11.000Z
AmazonFreeRTOS/Services/MqttProxy/Puback.swift
mwillbanks/amazon-freertos-ble-ios-sdk
f29f8ffbb0e64c886b833a3eda8d26df9d3a8353
[ "Apache-2.0" ]
15
2018-12-03T15:29:55.000Z
2022-01-15T01:45:53.000Z
AmazonFreeRTOS/Services/MqttProxy/Puback.swift
mwillbanks/amazon-freertos-ble-ios-sdk
f29f8ffbb0e64c886b833a3eda8d26df9d3a8353
[ "Apache-2.0" ]
27
2019-01-28T02:39:34.000Z
2022-02-02T05:31:55.000Z
/// Mqtt proxy message of Puback. /// To reduce the encoded CBOR message size, we maps the variable name with a single character by CodingKey /// Check the "CborKey" Enum to see the mapping relationship. public struct Puback: Encodable { /// Mqtt message type private var messageType: Int /// Mqtt message id. public var msgID: Int public init(msgID: Int) { messageType = MqttMessageType.puback.rawValue self.msgID = msgID } private enum CodingKeys: String, CodingKey { case messageType = "w" case msgID = "i" } }
27.666667
107
0.662651
b07975b5fbaf05982133649318b00bec936ec07d
1,129
dart
Dart
test/ui/recorder_page_test.dart
gitter-badger/audiozitos
82fbd7ef1b538835c91f60e31a773ef3bde621af
[ "BSD-3-Clause" ]
2
2018-07-13T02:39:09.000Z
2018-07-13T03:19:47.000Z
test/ui/recorder_page_test.dart
gitter-badger/audiozitos
82fbd7ef1b538835c91f60e31a773ef3bde621af
[ "BSD-3-Clause" ]
7
2018-07-04T23:28:39.000Z
2018-07-12T02:31:45.000Z
test/ui/recorder_page_test.dart
gitter-badger/audiozitos
82fbd7ef1b538835c91f60e31a773ef3bde621af
[ "BSD-3-Clause" ]
1
2018-07-12T02:30:14.000Z
2018-07-12T02:30:14.000Z
import 'package:audiozitos/shared/containers/circle_icon_button.dart'; import 'package:audiozitos/ui/recorder_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { group('RecorderPage Tests', () { runIntegrationTests(); runUnitTests(); }); } runIntegrationTests() { testWidgets('widget integration test 1', (WidgetTester tester) async { var value = 0.0; // Tells the tester to build a UI based on the widget tree passed to it await tester.pumpWidget( StatefulBuilder( builder: (BuildContext context, StateSetter setState) { return MaterialApp( home: Material( child: RecorderPage(), ), ); }, ), ); expect(value, equals(0.0)); // Taps on the widget found by key await tester.tap(find.byElementType(CircleIconButton)); // Verifies that the widget updated the value correctly expect(value, equals(0.5)); }, skip: true); } runUnitTests() { test('answer unit test 1', () { var answer = 42; expect(answer, 42); }); }
24.543478
75
0.639504
72f22c69811120fe1424f0b05c273ad51e00381a
6,981
lua
Lua
Caocao/Script/control/button.lua
ysm1180/NewJojoGame
d46be6e979642ed3f139ad7905c983ac03356dd2
[ "MIT" ]
6
2018-10-12T08:06:35.000Z
2019-01-20T12:53:35.000Z
Caocao/Script/control/button.lua
ysm1180/ThreeKingdoms-Caocao
d46be6e979642ed3f139ad7905c983ac03356dd2
[ "MIT" ]
2
2018-10-12T08:09:05.000Z
2019-01-20T12:55:27.000Z
Caocao/Script/control/button.lua
ysm1180/NewJojoGame
d46be6e979642ed3f139ad7905c983ac03356dd2
[ "MIT" ]
2
2018-05-19T17:49:23.000Z
2018-10-15T03:10:57.000Z
require "color.lua" require "child_control.lua" require "text_control.lua" ---@class ButtonColor @버튼 색을 표현하는 옵션 ---@field Normal RGB @기본 색 ---@field Focused RGB @버튼이 강조됐을 때의 색 ---@field Pushed RGB @버튼이 눌렸을 때의 색 ---@class Button : ChildControl, ExtendFontControl @게임 내의 Button 컨트롤을 Wrapping 하는 클래스 ---@field control EngineButtonControl Button = Class(ChildControl, ExtendFontControl) ---기본 배경색 ---@type ButtonColor Button.DEFAULT_BACKGROUND_COLOR = { Normal = { R = 0xE1, G = 0xE1, B = 0xE1 }, Focused = { R = 0x00, G = 0x78, B = 0xD7 }, Pushed = { R = 0x00, G = 0x54, B = 0x99 } } ---기본 테두리 색 ---@type ButtonColor Button.DEFAULT_BORDER_COLOR = { Normal = { R = 0xAD, G = 0xAD, B = 0xAD }, Focused = { R = 0x00, G = 0x78, B = 0xD7 }, Pushed = { R = 0x00, G = 0x54, B = 0x99 } } ---기본 텍스트 색 ---@type ButtonColor Button.DEFAULT_TEXT_COLOR = { Normal = { R = 0x00, G = 0x00, B = 0x00 }, Focused = { R = 0x00, G = 0x00, B = 0x00 }, Pushed = { R = 0x00, G = 0x00, B = 0x00 } } ---버튼을 새로 생성합니다. ---@param parent Window @버튼이 생성될 부모, 보통 Window ---@return Button @새로 생성된 Button class function Button:New(parent) local newControl = {} local parentControl = nil if parent ~= nil then parentControl = parent.control end -- controlManager 는 Lua의 ControlManager 랑 다르다!! -- 기본 게임 엔진에 내장되어있는 Control 생성 담당 인스턴스! ---@type EngineButtonControl newControl.control = controlManager:CreateButton(parentControl) setmetatable(newControl, self) self.__index = self return newControl end ---버튼의 텍스트를 설정합니다. ---@param text string function Button:SetText(text) if text ~= nil then self.control:SetText(text) end end ---버튼의 배경을 투명화할건지 설정합니다. ---@param value boolean function Button:SetTransparentBackground(value) if type(value) == "boolean" then self.control:SetTransparentBackground(value) end end ---버튼의 테두리 선 굵기를 설정합니다. ---@param width number function Button:SetBorderWidth(width) if width ~= nil then self.control:SetBorderWidth(width) end end ---버튼의 기본 배경 색을 지정합니다. ---@param color integer | RGB function Button:SetNormalBackgroundColor(color) if color ~= nil then if type(color) == "number" then color = numberToRGB(color) end color.R = color.R or self.DEFAULT_BACKGROUND_COLOR.Normal.R color.G = color.G or self.DEFAULT_BACKGROUND_COLOR.Normal.G color.B = color.B or self.DEFAULT_BACKGROUND_COLOR.Normal.B self.control:SetBackgroundColor(gameManager:Color(color.R, color.G, color.B)) end end ---버튼에 마우스가 올라가 focus 됐을 때의 배경 색을 지정합니다. ---@param color integer | RGB function Button:SetFocusedBackgroundColor(color) if color ~= nil then if type(color) == "number" then color = numberToRGB(color) end color.R = color.R or self.DEFAULT_BACKGROUND_COLOR.Focused.R color.G = color.G or self.DEFAULT_BACKGROUND_COLOR.Focused.G color.B = color.B or self.DEFAULT_BACKGROUND_COLOR.Focused.B self.control:SetFocusedBackgroundColor(gameManager:Color(color.R, color.G, color.B)) end end ---버튼이 눌렸을 때의 배경 색을 지정합니다. ---@param color integer | RGB function Button:SetPushedBackgroundColor(color) if color ~= nil then if type(color) == "number" then color = numberToRGB(color) end color.R = color.R or self.DEFAULT_BACKGROUND_COLOR.Pushed.R color.G = color.G or self.DEFAULT_BACKGROUND_COLOR.Pushed.G color.B = color.B or self.DEFAULT_BACKGROUND_COLOR.Pushed.B self.control:SetPushedBackgroundColor(gameManager:Color(color.R, color.G, color.B)) end end ---버튼의 기본 테두리 색을 지정합니다. ---@param color integer | RGB function Button:SetNormalBorderColor(color) if color ~= nil then if type(color) == "number" then color = numberToRGB(color) end color.R = color.R or self.DEFAULT_BORDER_COLOR.Normal.R color.G = color.G or self.DEFAULT_BORDER_COLOR.Normal.G color.B = color.B or self.DEFAULT_BORDER_COLOR.Normal.B self.control:SetBorderColor(gameManager:Color(color.R, color.G, color.B)) end end ---버튼에 마우스가 올라가 focus 됐을 때의 테두리 색을 지정합니다. ---@param color integer | RGB function Button:SetFocusedBorderColor(color) if color ~= nil then if type(color) == "number" then color = numberToRGB(color) end color.R = color.R or self.DEFAULT_BORDER_COLOR.Focused.R color.G = color.G or self.DEFAULT_BORDER_COLOR.Focused.G color.B = color.B or self.DEFAULT_BORDER_COLOR.Focused.B self.control:SetFocusedBorderColor(gameManager:Color(color.R, color.G, color.B)) end end ---버튼이 눌렸을 때의 테두리 색을 지정합니다. ---@param color integer | RGB function Button:SetPushedBorderColor(color) if color ~= nil then if type(color) == "number" then color = numberToRGB(color) end color.R = color.R or self.DEFAULT_BORDER_COLOR.Pushed.R color.G = color.G or self.DEFAULT_BORDER_COLOR.Pushed.G color.B = color.B or self.DEFAULT_BORDER_COLOR.Pushed.B self.control:SetPushedBorderColor(gameManager:Color(color.R, color.G, color.B)) end end ---버튼의 기본 텍스트 색을 지정합니다. ---@param color integer | RGB function Button:SetNormalTextColor(color) if color ~= nil then if type(color) == "number" then color = numberToRGB(color) end color.R = color.R or self.DEFAULT_TEXT_COLOR.Normal.R color.G = color.G or self.DEFAULT_TEXT_COLOR.Normal.G color.B = color.B or self.DEFAULT_TEXT_COLOR.Normal.B self.control:SetTextColor(gameManager:Color(color.R, color.G, color.B)) end end ---버튼에 마우스가 올라가 focus 됐을 때의 텍스트 색을 지정합니다. ---@param color integer | RGB function Button:SetFocusedTextColor(color) if color ~= nil then if type(color) == "number" then color = numberToRGB(color) end color.R = color.R or self.DEFAULT_TEXT_COLOR.Focused.R color.G = color.G or self.DEFAULT_TEXT_COLOR.Focused.G color.B = color.B or self.DEFAULT_TEXT_COLOR.Focused.B self.control:SetFocusedTextColor(gameManager:Color(color.R, color.G, color.B)) end end ---버튼이 눌렸을 때의 텍스트 색을 지정합니다. ---@param color integer | RGB function Button:SetPushedTextColor(color) if color ~= nil then if type(color) == "number" then color = numberToRGB(color) end color.R = color.R or self.DEFAULT_TEXT_COLOR.Pushed.R color.G = color.G or self.DEFAULT_TEXT_COLOR.Pushed.G color.B = color.B or self.DEFAULT_TEXT_COLOR.Pushed.B self.control:SetPushedTextColor(gameManager:Color(color.R, color.G, color.B)) end end
27.702381
92
0.641599
9b199140845c3be7336867a02204de0a0b77d674
603
sql
SQL
api/db/setup.sql
castletheperson/Territories
2810fbfb10348f830e4340e3d244647cd7329e5a
[ "MIT" ]
1
2018-03-06T18:39:00.000Z
2018-03-06T18:39:00.000Z
api/db/setup.sql
castletheperson/Territories
2810fbfb10348f830e4340e3d244647cd7329e5a
[ "MIT" ]
null
null
null
api/db/setup.sql
castletheperson/Territories
2810fbfb10348f830e4340e3d244647cd7329e5a
[ "MIT" ]
null
null
null
DROP DATABASE IF EXISTS `territories`; CREATE DATABASE `territories`; USE `territories`; CREATE TABLE `users` ( `id` INT NOT NULL AUTO_INCREMENT, `name` VARCHAR(255) NOT NULL, PRIMARY KEY (`id`), UNIQUE(`name`) ); CREATE TABLE `territories` ( `id` INT NOT NULL AUTO_INCREMENT, `userId` INT NOT NULL, `name` VARCHAR(255) NOT NULL, `instructions` TEXT, `boundary` TEXT, `created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `updated` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`, `userId`), UNIQUE (`name`, `userId`) );
24.12
77
0.674959
c42b814a202076a313cea6aa36bc900ee156a0e0
5,515
h
C
code/common/pins_basics.h
iocafe/pins
0d446aee48a4b0dd5b4bbb1eebc8ced14fbe767b
[ "MIT" ]
2
2020-04-28T23:26:41.000Z
2020-06-08T14:00:55.000Z
code/common/pins_basics.h
iocafe/pins
0d446aee48a4b0dd5b4bbb1eebc8ced14fbe767b
[ "MIT" ]
null
null
null
code/common/pins_basics.h
iocafe/pins
0d446aee48a4b0dd5b4bbb1eebc8ced14fbe767b
[ "MIT" ]
null
null
null
/** @file common/pins_basics.h @brief Pins library basic functionality. @author Pekka Lehtikoski @version 1.0 @date 26.4.2021 Copyright 2020 Pekka Lehtikoski. This file is part of the eosal and shall only be used, modified, and distributed under the terms of the project licensing. By continuing to use, modify, or distribute this file you indicate that you have read the license and understand and accept it fully. **************************************************************************************************** */ #pragma once #ifndef PINS_BASICS_H_ #define PINS_BASICS_H_ #include "pins.h" struct Pin; struct PinInterruptConf; struct PinsBusDevice; /** Enumeration of pin types. */ typedef enum { PIN_INPUT, PIN_OUTPUT, PIN_ANALOG_INPUT, PIN_ANALOG_OUTPUT, PIN_PWM, PIN_SPI, PIN_I2C, PIN_TIMER, PIN_UART, PIN_CAMERA } pinType; /* Bit fields for PIN_INTERRUPT_ENABLED parameter. */ #if OSAL_INTERRUPT_LIST_SUPPORT #define PIN_GLOBAL_INTERRUPTS_ENABLED 1 #endif #define PIN_INTERRUPTS_ENABLED_FOR_PIN 2 #define PIN_GPIO_PIN_INTERRUPTS_ENABLED 4 /** Enumeration of possible parameters for the pin. */ typedef enum { PIN_RV, /* Reserved for value or state bits */ PIN_PULL_UP, PIN_PULL_DOWN, PIN_TOUCH, PIN_FREQENCY, PIN_FREQENCY_KHZ, PIN_FREQENCY_MHZ, PIN_RESOLUTION, PIN_INIT, PIN_HPOINT, PIN_INTERRUPT_ENABLED, PIN_TIMER_SELECT, PIN_TIMER_GROUP_SELECT, PIN_MISO, PIN_MOSI, PIN_SCLK, PIN_CS, PIN_SDA, PIN_SCL, PIN_DC, PIN_RX, PIN_TX, PIN_TRANSMITTER_CTRL, PIN_SPEED, PIN_SPEED_KBPS, PIN_FLAGS, PIN_A, PIN_B, PIN_C, PIN_D, PIN_E, PIN_A_BANK, PIN_B_BANK, PIN_C_BANK, PIN_D_BANK, PIN_E_BANK, PIN_MIN, /* Minimum value for signal */ PIN_MAX, /* Maximum value for signal, 0 if not set */ PIN_SMIN, /* Minimum integer value for scaled signal */ PIN_SMAX, /* Maximum integer value for scaled signal, 0 if not set */ PIN_DIGS /* If pin value is scaled to float, number of decimal digits. Value is divided by 10^n */ } pinPrm; /** Number of PinPrm elements (4 bytes) in beginning prm array reserved for PinRV structure (8 bytes) */ #define PINS_N_RESERVED 2 /** Pin flags (flags member of Pin structure). PIN_SCALING_SET flag indicates that scaling for the PIN value is defined by "smin", "smax" or "digs" attributes. */ #define PIN_SCALING_SET 1 typedef struct { os_short n_pins; const struct Pin *pin; } PinGroupHdr; typedef struct { const PinGroupHdr * const *group; os_short n_groups; } IoPinsHdr; #if OSAL_MINIMALISTIC typedef os_char pin_addr; typedef os_char pin_ix; #else typedef os_short pin_addr; typedef os_short pin_ix; #endif typedef struct PinPrmValue { pin_ix ix; os_short value; } PinPrmValue; /* Since Pin structure is "const" and can be only in flash memory, the PinRV structure is used to store dynamic data for IO pin. The PinRV is always 8 bytes and needs to be aligned to 4 byte boundary. */ typedef struct PinRV { os_int value; os_char state_bits; os_char reserved1; #if OSAL_MINIMALISTIC == 0 os_char reserved2; os_char reserved3; #endif } PinRV; struct iocSignal; /** Structure to set up static information about one IO pin or other IO item. */ typedef struct Pin { /** Pint type, like PIN_INPUT, PIN_OUTPUT... See pinType enumeration. */ os_char type; /** Hardware bank number for the pin, if applies. */ os_char bank; /** Hardware address for the pin. */ pin_addr addr; /** Pointer to parameter array, two first os_shorts are reserved for storing value as os_int. */ PinPrmValue *prm; /** Number of items in parameter array. Number of set parameters is this divided by two, since each 16 bit number is parameter number amd parameter value. */ os_char prm_n; /** Number of items in parameter array. Number of set parameters is this divided by two, since each 16 bit number is parameter number amd parameter value. */ os_char flags; /** Next pin in linked list of pins belonging to same group as this one. OS_NULL to indicate that this pin is end of list of not in group. */ const struct Pin *next; /** Pointer to IO signal, if this pin is mapped to one. */ const struct iocSignal *signal; #if PINS_SPI || PINS_I2C /** SPI or IC2 bus device structure. */ struct PinsBusDevice *bus_device; #endif #if PINS_SIMULATED_INTERRUPTS /** Pointer to interrupt configuration when working on simulated environment */ struct PinInterruptConf *int_conf; #endif } Pin; /* Initialize IO hardware library. */ osalStatus pins_ll_initialize_lib( void); /* Clean up resources allocated by IO hardware library. */ void pins_ll_shutdown_lib( void); /* Setup IO hardware pin. */ void pin_ll_setup( const Pin *pin, os_int flags); /* Release any resources allocated for IO hardware "pin". */ #if OSAL_PROCESS_CLEANUP_SUPPORT void pin_ll_shutdown( const Pin *pin); #endif /* Set IO pin state. */ void pin_ll_set( const Pin *pin, os_int x); /* Get pin state. */ os_int pin_ll_get( const Pin *pin, os_char *state_bits); /* SPI and I2C initialization. */ #if PINS_SPI || PINS_I2C void pins_initialize_bus_devices(void); #endif #endif
21.627451
108
0.676337
f5d0fbc8f9f81b9e308f8f72333f0924cbd887d5
1,374
rs
Rust
radicalred/src/shortened_names.rs
RoGryza/rust-pokemon-gen3-save-parser
71323abdb3f72c317a71f65cf7b19501b16bf6bd
[ "MIT" ]
null
null
null
radicalred/src/shortened_names.rs
RoGryza/rust-pokemon-gen3-save-parser
71323abdb3f72c317a71f65cf7b19501b16bf6bd
[ "MIT" ]
null
null
null
radicalred/src/shortened_names.rs
RoGryza/rust-pokemon-gen3-save-parser
71323abdb3f72c317a71f65cf7b19501b16bf6bd
[ "MIT" ]
null
null
null
pub fn expand_name(rom_name: &[u8]) -> Option<&str> { let hash = name_hash(rom_name); SHORTENED_NAMES .iter() .find_map(|(h, name)| if *h == hash { Some(*name) } else { None }) } // From https://stackoverflow.com/a/2351171 const fn name_hash(s: &[u8]) -> u32 { let mut h = 0u32; const MULT: u32 = 37; h = MULT.wrapping_sub(h).wrapping_add(s[0] as u32); h = MULT.wrapping_sub(h).wrapping_add(s[1] as u32); h = MULT.wrapping_sub(h).wrapping_add(s[2] as u32); h = MULT.wrapping_sub(h).wrapping_add(s[3] as u32); h = MULT.wrapping_sub(h).wrapping_add(s[4] as u32); h = MULT.wrapping_sub(h).wrapping_add(s[5] as u32); h = MULT.wrapping_sub(h).wrapping_add(s[6] as u32); h = MULT.wrapping_sub(h).wrapping_add(s[7] as u32); h = MULT.wrapping_sub(h).wrapping_add(s[8] as u32); h = MULT.wrapping_sub(h).wrapping_add(s[9] as u32); h } static SHORTENED_NAMES: &[(u32, &str)] = &[ (name_hash(b"Fletchindr"), "Fletchinder"), (name_hash(b"Crabminble"), "Crabominable"), (name_hash(b"Baraskewda"), "Barraskewda"), (name_hash(b"Centskorch"), "Centiskorch"), (name_hash(b"Corvsquire"), "Corvisquire"), (name_hash(b"Corvknight"), "Corviknight"), (name_hash(b"Stonjorner"), "Stonjourner"), (name_hash(b"Poltegeist"), "Polteageist"), (name_hash(b"Blacphalon"), "Blacephalon"), ];
38.166667
74
0.634643
18032400dcdfa3c8ebecf883b58f7af0cf9505e1
70
rb
Ruby
lib/version.rb
jaapie/how-many
8844fe133a714cd8861b3c7505308ac1569ef5a3
[ "MIT" ]
null
null
null
lib/version.rb
jaapie/how-many
8844fe133a714cd8861b3c7505308ac1569ef5a3
[ "MIT" ]
null
null
null
lib/version.rb
jaapie/how-many
8844fe133a714cd8861b3c7505308ac1569ef5a3
[ "MIT" ]
null
null
null
# frozen_string_literal: true module HowMany VERSION = '0.0.1' end
11.666667
29
0.728571
c4710bc59210542c0d33c102988c55fbd52b5d8a
127
h
C
usr/aosh/builtin/echo.h
Liblor/advanced_operating_systems_2020
1e9137db8a47d922e22c0a2d78b24a7364b7629a
[ "MIT" ]
5
2020-06-12T11:47:21.000Z
2022-02-27T14:39:05.000Z
usr/aosh/builtin/echo.h
Liblor/advanced_operating_systems_2020
1e9137db8a47d922e22c0a2d78b24a7364b7629a
[ "MIT" ]
3
2020-06-04T20:11:26.000Z
2020-07-26T23:16:33.000Z
usr/aosh/builtin/echo.h
Liblor/advanced_operating_systems_2020
1e9137db8a47d922e22c0a2d78b24a7364b7629a
[ "MIT" ]
3
2020-06-12T18:06:29.000Z
2022-03-13T17:19:02.000Z
#ifndef BFOS_ECHO_H #define BFOS_ECHO_H errval_t builtin_echo( int argc, char **argv); #endif //BFOS_ECHO_H
12.7
22
0.669291
9bd6cd9aa0f184b29205962a90d8a656d92994c4
3,851
js
JavaScript
config/webpackConfig.js
liuyinglong/vueSSR
967eda92d2ea60083a08af9fa0fd75e0d95bc0a8
[ "MIT" ]
null
null
null
config/webpackConfig.js
liuyinglong/vueSSR
967eda92d2ea60083a08af9fa0fd75e0d95bc0a8
[ "MIT" ]
null
null
null
config/webpackConfig.js
liuyinglong/vueSSR
967eda92d2ea60083a08af9fa0fd75e0d95bc0a8
[ "MIT" ]
null
null
null
let path = require("path") const webpack = require('webpack') const baseConfig = require("./base") const ExtractTextPlugin = require('extract-text-webpack-plugin') const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') module.exports = { //开发 development: Object.assign(baseConfig.development, { devtool: "#cheap-module-source-map", hints: false, loaders: [ { test: /\.styl(us)?$/, use: ['vue-style-loader', 'css-loader', 'stylus-loader'] }, { test: /\.scss$/, use: ["vue-style-loader", "css-loader?importLoaders=1", "sass-loader"] } ], plugins: [ new FriendlyErrorsPlugin(), ] }), //测试 test: Object.assign(baseConfig.test, { devtool: "#cheap-module-source-map", hints: "warning", loaders: [ { test: /\.styl(us)?$/, use: ExtractTextPlugin.extract({ use: [ { loader: 'css-loader', options: {minimize: true} }, 'stylus-loader' ], fallback: 'vue-style-loader' }) }, { test: /\.scss$/, use: ExtractTextPlugin.extract({ use: [ { loader: 'css-loader?importLoaders=1' }, 'sass-loader' ], fallback: 'vue-style-loader' }) } ], plugins: [ new webpack.optimize.UglifyJsPlugin({ compress: {warnings: false} }), new webpack.optimize.ModuleConcatenationPlugin(), new ExtractTextPlugin({ filename: 'css/common.css?[hash]' }), new webpack.BannerPlugin(function () { return "version:1.0.0 \n" + "author:liuyinglong \n" + "date:" + new Date() + " \n" + "mail:liuyinglong@utimes.cc" }()), ] }), //生产 production: Object.assign(baseConfig.production, { devtool: false, hints: "warning", loaders: [ { test: /\.styl(us)?$/, use: ExtractTextPlugin.extract({ use: [ { loader: 'css-loader', options: {minimize: true} }, 'stylus-loader' ], fallback: "vue-style-loader" }) }, { test: /\.scss$/, use: ExtractTextPlugin.extract({ use: [ { loader: 'css-loader?importLoaders=1' }, 'sass-loader' ], fallback: "vue-style-loader" }) } ], plugins: [ new webpack.optimize.UglifyJsPlugin({ compress: {warnings: false} }), new webpack.optimize.ModuleConcatenationPlugin(), new ExtractTextPlugin({ filename: 'css/common.css?[hash]' }), new webpack.BannerPlugin(function () { return "version:1.0.0 \n" + "author:liuyinglong \n" + "date:" + new Date() + " \n" + "mail:liuyinglong@utimes.cc" }()), ] }) }
31.826446
86
0.384835
eed1bf64b14f733ecdc8210f5df07e3e2b681c90
12,233
sql
SQL
oreciprocas-db/src/main/resources/liquibase/sqlFile/WI/46008/exec/07_insert_configuracion.sql
Artemisa85/OperacionesReciprocas
4489f8ac9e3ccc78f330e240bf0e0603740c79b3
[ "MIT" ]
null
null
null
oreciprocas-db/src/main/resources/liquibase/sqlFile/WI/46008/exec/07_insert_configuracion.sql
Artemisa85/OperacionesReciprocas
4489f8ac9e3ccc78f330e240bf0e0603740c79b3
[ "MIT" ]
null
null
null
oreciprocas-db/src/main/resources/liquibase/sqlFile/WI/46008/exec/07_insert_configuracion.sql
Artemisa85/OperacionesReciprocas
4489f8ac9e3ccc78f330e240bf0e0603740c79b3
[ "MIT" ]
null
null
null
/*****************************************************************************/ /* Archivo: 07_insert_configuracion.sql */ /* Base de datos: oreciprocas */ /* Producto: Operaciones Reciprocas */ /* Aplicaciones Impactadas: oreciprocas */ /* Diseño: Zamir García */ /* */ /* PREREQUISITOS */ /* 1. 01_oreciprocas_db.sql */ /* */ /* PROPOSITO */ /* Carga inicial de la configuracion de la aplicacion */ /* */ /* MODIFICACIONES */ /* FECHA AUTOR RAZON */ /* 2019-04-04 Zamir García Construcción de WI_46008 */ /* 2019-05-31 Zamir García Correccion defectos WI_46008 */ /*****************************************************************************/ USE oreciprocas GO DELETE FROM dbo.CONFIGURACION GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('oreciprocas', 'url-int', 'https://fnabogsoa.fna.gov.co:8099/oreciprocas-ui/#/InicioSesionFNA', 'URL externa para la aplicación') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('oreciprocas', 'url-ext', 'https://www.fna.gov.co:8099/oreciprocas-ui/#/InicioSesion', 'URL externa para la aplicación') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('ldap', 'url', 'ldap://fnabogpr1:389', 'URL del servidor LDAP') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('ldap', 'manager-dn', 'CN=procdesa,OU=Servicios,OU=Otros,DC=FNA,DC=COM,DC=CO', 'Nombre distinguido del usuario de consulta LDAP') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('ldap', 'manager-password', 'EF5C0328C129E77B61D0A8323E2EFEDE', 'Password cifrado del manager-dn') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('seguridad', 'password-expiration-days', '90', 'Número de días límite para cambiar contraseña') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('csrf', 'Access-Control-Allow-Origin', 'https://www.fna.gov.co:8099 https://fnabogsoa.fna.gov.co:8099', 'Orígenes HTTP permitidos') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('csrf', 'Access-Control-Allow-Methods', 'POST, GET, PUT, DELETE, OPTIONS', 'Métodos HTTP permitidos') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('csrf', 'Access-Control-Max-Age', '3600', 'Duración de acceso') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('csrf', 'Access-Control-Allow-Headers', 'Content-Type, x-requested-with, authorization, token, access-control-allow-headers', 'Encabezados HTTP permitidos') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'doc', 'application/msword', 'Microsoft Word') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'docm', 'application/vnd.ms-word.document.macroenabled.12', 'Microsoft Word - Macro-Enabled Document') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Microsoft Office - OOXML - Word Document') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'dot', 'application/msword', 'Microsoft Word') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'dotm', 'application/vnd.ms-word.template.macroenabled.12', 'Microsoft Word - Macro-Enabled Template') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'dotx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', 'Microsoft Office - OOXML - Word Document Template') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'htm', 'text/html', 'HyperText Markup Language (HTML)') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'html', 'text/html', 'HyperText Markup Language (HTML)') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'mht', 'message/rfc822', 'Web Archive file ') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'mhtml', 'message/rfc822', 'Web Archive file ') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'odt', 'application/vnd.oasis.opendocument.text', 'OpenDocument Text') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'pdf', 'application/pdf', 'Adobe Portable Document Format') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'rtf', 'application/rtf', 'Rich Text Format') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'txt', 'text/plain', 'Text File') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'wps', 'application/vnd.ms-works', 'Microsoft Works') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'xml', 'application/xml', 'XML - Extensible Markup Language') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'xps', 'application/vnd.ms-xpsdocument', 'Microsoft XML Paper Specification') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'csv', 'text/csv', 'Comma-Seperated Values') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'dbf', 'application/dbf', 'dBASE Table File Format (DBF)') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'ods', 'application/vnd.oasis.opendocument.spreadsheet', 'OpenDocument Spreadsheet') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'xlam', 'application/vnd.ms-excel.addin.macroenabled.12', 'Microsoft Excel - Add-In File') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'xls', 'application/vnd.ms-excel', 'Microsoft Excel') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'xlsb', 'application/vnd.ms-excel.sheet.binary.macroenabled.12', 'Microsoft Excel - Binary Workbook') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'xlsm', 'application/vnd.ms-excel.sheet.macroenabled.12', 'Microsoft Excel - Macro-Enabled Workbook') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Microsoft Office - OOXML - Spreadsheet') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'xltm', 'application/vnd.ms-excel.template.macroenabled.12', 'Microsoft Excel - Macro-Enabled Template File') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'xltx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', 'Microsoft Office - OOXML - Spreadsheet Template') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'bmp', 'image/bmp', 'Bitmap Image File') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'gif', 'image/gif', 'Graphics Interchange Format') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'jpg', 'image/jpeg', 'JPEG Image') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'mp4', 'video/mp4', 'MPEG-4 Video') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'odp', 'application/vnd.oasis.opendocument.presentation', 'OpenDocument Presentation') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'png', 'image/png', 'Portable Network Graphics (PNG)') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'potm', 'application/vnd.ms-powerpoint.template.macroenabled.12', 'Microsoft PowerPoint - Macro-Enabled Template File') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'potx', 'application/vnd.openxmlformats-officedocument.presentationml.template', 'Microsoft Office - OOXML - Presentation Template') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'ppam', 'application/vnd.ms-powerpoint.addin.macroenabled.12', 'Microsoft PowerPoint - Add-in file') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'pps', 'application/vnd.ms-powerpoint', 'Microsoft PowerPoint file') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'ppsm', 'application/vnd.ms-powerpoint.slideshow.macroenabled.12', 'Microsoft PowerPoint - Macro-Enabled Slide Show File') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'ppsx', 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'Microsoft Office - OOXML - Presentation (Slideshow)') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'ppt', 'application/vnd.ms-powerpoint', 'Microsoft PowerPoint') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'pptm', 'application/vnd.ms-powerpoint.presentation.macroenabled.12', 'Microsoft PowerPoint - Macro-Enabled Presentation File') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'Microsoft Office - OOXML - Presentation') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'thmx', 'application/vnd.ms-officetheme', 'Microsoft Office System Release Theme') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'tiff', 'image/tiff', 'Tagged Image File Format') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'wmf', 'application/x-msmetafile', 'Microsoft Windows Metafile') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'wmv', 'video/x-ms-wmv', 'Microsoft Windows Media Video') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'msg', 'application/octet-stream', 'Microsoft Outlook message') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'eml', 'message/rfc822', 'Email message') GO INSERT INTO dbo.CONFIGURACION (DOMINIO, CODIGO, VALOR, DESCRIPCION) VALUES ('archivos-permitidos', 'mbox', 'application/octet-stream', 'Mailbox files') GO
85.545455
236
0.706368
cb7f5dac2919eb096a714e58dc34e54f97bc93fd
19,360
html
HTML
santa.html
eruffaldi/logowebgl
f75c5b56c715253dcec4eceb4dbeaae213780998
[ "Apache-2.0" ]
1
2019-06-13T15:50:23.000Z
2019-06-13T15:50:23.000Z
santa.html
eruffaldi/logowebgl
f75c5b56c715253dcec4eceb4dbeaae213780998
[ "Apache-2.0" ]
null
null
null
santa.html
eruffaldi/logowebgl
f75c5b56c715253dcec4eceb4dbeaae213780998
[ "Apache-2.0" ]
null
null
null
<!DOCTYPE html> <html lang="en"> <head> <title>Merry Christimas 2016</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> <style> body { font-family: Monospace; background-color: #f0f0f0; margin: 0px; overflow: hidden; } </style> </head> <body> <audio loop="loop" id="ohoh" > <source src="ohoh.mp3" type="audio/mpeg"> <source src="ohoh.ogg" type="audio/ogg"> </audio> <script src="three.min.js"></script> <script src="DragControls.js"></script> <script src="CCapture.all.min.js"></script> <script src="TrackballControls.js"></script> <script src="EffectComposer.js"></script> <script src="ShaderPass.js"></script> <script src="CopyShader.js"></script> <script src="OutlinePass.js"></script> <script src="ClearPass.js"></script> <script src="RenderPass.js"></script> <script src="Timer.js"></script> <script src="stats.min.js"></script> <script> THREE.ShaderTypes = { 'phongDiffuse': { uniforms: { "uDirLightPos": { type: "v3", value: new THREE.Vector3() }, "uDirLightColor": { type: "c", value: new THREE.Color(0xffffff) }, "uMaterialColor": { type: "c", value: new THREE.Color(0xffffff) }, uKd: { type: "f", value: 0.7 }, uBorder: { type: "f", value: 0.4 } }, vertexShader: [ "varying vec3 vNormal;", "varying vec3 vViewPosition;", "void main() {", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "vNormal = normalize( normalMatrix * normal );", "vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );", "vViewPosition = -mvPosition.xyz;", "}" ].join("\n"), fragmentShader: [ "uniform vec3 uMaterialColor;", "uniform vec3 uDirLightPos;", "uniform vec3 uDirLightColor;", "uniform float uKd;", "uniform float uBorder;", "varying vec3 vNormal;", "varying vec3 vViewPosition;", "void main() {", // compute direction to light "vec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );", "vec3 lVector = normalize( lDirection.xyz );", // diffuse: N * L. Normal must be normalized, since it's interpolated. "vec3 normal = normalize( vNormal );", //was: "float diffuse = max( dot( normal, lVector ), 0.0);", // solution "float diffuse = dot( normal, lVector );", "if ( diffuse > 0.6 ) { diffuse = 1.0; }", "else if ( diffuse > -0.2 ) { diffuse = 0.7; }", "else { diffuse = 0.3; }", "gl_FragColor = vec4( uKd * uMaterialColor * uDirLightColor * diffuse, 1.0 );", "}" ].join("\n") } }; /** * LOGO Syntax pen color: Ccolor color codes: bwrypck size: S#,# write: . move: [X|Y|Z]# directions [UDLRFB] lower moves half pushpop position stack: [Pp]# */ var head = "S2,2Cw.US4,4.U.UCp.P8Z2S1,1.p8UP8Z-1S6,2Cp.p8P8Z1X-2S1,1Cp.RCb.RCp.RCb.RCp.p8US5,5Cw.US3,3Cr.US2,2.X1S2,1.U.X1.X1S1,1D." var left = "X4A9S2,2.RD.RD.RD.D.DrCwS1,2.RU.DRCwS3,2Cp.a9\n" var right = "CrX-4S2,2.LU.LU.lDS1,2.DRCwS1,2.LU.DLCwS3,2Cp.\n" var torso = "Y8Z-1S8,4.UCwS10,6.US8,4Cr.UCk.FFS1,1Cy.BBUS8,4Cr.U.U.U" var rightleg = "X-2CkS2,3.Z-1Y1S2,2.Y1Cw.Y1Cr.U.U.U.U." var leftleg = "X2CkS2,3.Z-1Y1S2,2.Y1Cw.Y1Cr.U.U.U.U." // Santa Claus is Here. Anything else is ignored var cmds = parseString("A0"+leftleg+"a0A1"+rightleg+"a1A2"+torso+"A4A5"+right+"a5A6" + left + "a6A7"+head+"a7" ) var controls; var timer = new Timer(); var slots = {} function parseString(x) { var re = /C([a-z])|[XYZ](-?[0-9])|S([0-9]+),([0-9]+)|[UDLRFBudrl]|\.|[AaPp]([0-9])|J(-?[0.-9])(-?[.0-9])(-?[.0-9])/; var rr = [] var motions = { D: [0, -1, 0], U: [0, 1, 0], F: [0, 0, 1], B: [0, 0, -1], R: [1.0, 0, 0], L: [-1.0, 0, 0] } var motionk = "DUFBRL" while (true) { var y = re.exec(x) if (y == null) break var c0 = y[0][0] var j = motionk.indexOf(c0.toUpperCase()) if (j >= 0) { var d = motions[motionk[j]] var s = motionk[j] != c0 ? 0.5 : 1.0 rr.push({ action: "move", dir: [s * d[0], s * d[1], s * d[2]] }) } else { switch (c0) { case "C": rr.push({ action: "color", color: y[1] }) break case "X": case "Y": case "Z": var w = [0, 0, 0] w[{ X: 0, Y: 1, Z: 2 }[c0]] = parseFloat(y[2]) rr.push({ action: "move", dir: w }) break case "S": rr.push({ action: "size", size: [parseFloat(y[3]), 1, parseFloat(y[4])] }) break case ".": rr.push({ action: "write" }) break case "A": rr.push({ action: "apush", slot: parseInt(y[5]) }) break case "a": rr.push({ action: "apop", slot: parseInt(y[5]) }) break case "P": rr.push({ action: "push", slot: parseInt(y[5]) }) break case "p": rr.push({ action: "pop", slot: parseInt(y[5]) }) break case "J": rr.push({ action: "jump", pos: [parseFloat(6), parseFloat(7), parseFloat(8)] }) break } } x = x.substr(y.index + y[0].length) } return rr } var container, stats; var camera, scene, raycaster, renderer, composer; var mouse = new THREE.Vector2(), INTERSECTED; var radius = 20, theta = 0; init(); animate(); function createShaderMaterial(id, light) { var shader = THREE.ShaderTypes[id]; var u = THREE.UniformsUtils.clone(shader.uniforms); var vs = shader.vertexShader; var fs = shader.fragmentShader; var material = new THREE.ShaderMaterial({ uniforms: u, vertexShader: vs, fragmentShader: fs }); material.uniforms.uDirLightPos.value = light.position; material.uniforms.uDirLightColor.value = light.color; return material; } function init() { container = document.createElement('div'); document.body.appendChild(container); control = new function () { this.rotationSpeed = 0.005; this.scale = 1; this.saveMovie = function () { var videoUrl = capturer.save(); var link = document.createElement("a"); link.download = 'video.gif'; link.href = videoUrl; link.click(); }; }; //addControls(control); // capture code capturer = new CCapture({ framerate: 20, format: "gif", workersPath: 'js/', verbose: true }); // capturer.start(); function addControls(controlObject) { var gui = new dat.GUI(); gui.add(controlObject, 'saveMovie'); } var info = document.createElement('div'); info.style.position = 'absolute'; info.style.top = '10px'; info.style.width = '100%'; info.style.textAlign = 'center'; info.innerHTML = 'Santa Claus 2016 ER'; container.appendChild(info); camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 10000); camera.position.z = 30; controls = new THREE.TrackballControls(camera); controls.rotateSpeed = 4.0; controls.zoomSpeed = 1.2; controls.panSpeed = 0.8; controls.noZoom = false; controls.noPan = false; controls.staticMoving = true; controls.dynamicDampingFactor = 0.3; controls.keys = [65, 83, 68]; controls.addEventListener('change', render); scene = new THREE.Scene(); base = new THREE.Object3D(); var light = new THREE.DirectionalLight(0xffffff, 1); light.position.set(1, 1, 1).normalize(); scene.add(light); var light2 = new THREE.DirectionalLight(0x999999, 1); light2.position.set(-1, -1, -1).normalize(); scene.add(light2); function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } function getRandomArrayItem(a) { return a[getRandomInt(0, a.length - 1)] } var geometry = new THREE.BoxBufferGeometry(1, 1, 1); geometry.computeBoundingBox(); geometry.center(); var colors = {} colors["k"] = 0 colors["w"] = 0xffffff colors["r"] = 0xFF0000 colors["g"] = 0x00FF00 colors["y"] = 0xFFFF00 colors["b"] = 0x0000FF colors["c"] = 0x00FFFF colors["p"] = 0xffc0cb var colornames = Object.keys(colors); var colorsmat = {} var materialColor = new THREE.Color(); materialColor.setRGB(1.0, 0.8, 0.6); for (var i = 0; i < colornames.length; i++) { var phongMaterial = createShaderMaterial("phongDiffuse", light); var materialColor = new THREE.Color(colors[colornames[i]]); phongMaterial.uniforms.uMaterialColor.value.copy(materialColor); phongMaterial.side = THREE.DoubleSide; phongMaterial.uniforms.uKd.value = 0.7; phongMaterial.uniforms.uBorder.value = 0.6; //colorsmat[colornames[i]] = phongMaterial; colorsmat[colornames[i]] = new THREE.MeshLambertMaterial({ color: colors[colornames[i]] }); } var objects = [] //console.log(cmds) var pos = [0, 0, 0] var aslots = {} var size = [1, 1, 1] var color = colorsmat["k"] var pendown = false var current = base base.name = "root" for (var i = 0; i < cmds.length; i++) { var cmd = cmds[i] var a = cmd.action if (pendown || a == "write") { var object = new THREE.Mesh(geometry, color) object.position.x = pos[0] object.position.y = pos[1] object.position.z = pos[2] //object.rotation.x = Math.random() * 2 * Math.PI; //object.rotation.y = Math.random() * 2 * Math.PI; //object.rotation.z = Math.random() * 2 * Math.PI; object.scale.x = size[0] object.scale.y = size[1] object.scale.z = size[2] object.visible = false object.name = "my"+i objects.push(object) current.add(object) } base.position.y = -10 scene.add(base) switch (a) { case "write": break case "size": size[0] = cmd.size[0] size[1] = cmd.size[1] size[2] = cmd.size[2] break case "move": pos[0] += cmd.dir[0] pos[1] += cmd.dir[1] pos[2] += cmd.dir[2] break case "jump": pos[0] = cmd.pos[0] pos[1] = cmd.pos[1] pos[2] = cmd.pos[2] break case "apush": // create c = slots[cmd.slot] if(!c) { c = new THREE.Object3D() c.name = "slot"+cmd.slot c.position.x = pos[0] c.position.y = pos[1] c.position.z = pos[2] current.add(c) slots[cmd.slot] = c console.log("new slot",c.name,"child of",current.name) } else { console.log("activate slot",c.name,"child of",c.parent.name) } current = c pos = [0,0,0] break case "apop": // go to parent of slot, in origin c = slots[cmd.slot] if (c) { current = c.parent console.log("reactivate slot",current.name) } pos = [0,0,0] //pos[0] = c[0] //pos[1] = c[1] //pos[2] = c[2] break case "push": // save position aslots[cmd.slot] = [pos[0],pos[1],pos[2]] break case "pop": // recover position c = aslots[cmd.slot] if(c) { pos[0] = c[0] pos[1] = c[1] pos[2] = c[2] } break; case "color": color = colorsmat[cmd.color] break; } } scene.updateMatrixWorld () var intervalId; intervalId = timer.setInterval(function() { var cur = outlinePass.selectedObjects.length if (cur < objects.length) { var o = objects[cur] o.visible = true outlinePass.selectedObjects.push(o) } else { // start oh oh document.getElementById("ohoh").play() // clear build up timer timer.clearInterval(intervalId) // maybe start arm animation } }, 100); raycaster = new THREE.Raycaster(); renderer = new THREE.WebGLRenderer(); renderer.setClearColor(0x777777, 1.0); // overridden by renderpass if renderer.autoClear = true renderer.setPixelRatio(window.devicePixelRatio); renderer.setSize(window.innerWidth, window.innerHeight); renderer.sortObjects = false; container.appendChild(renderer.domElement); composer = new THREE.EffectComposer(renderer); var renderPass = new THREE.RenderPass(scene, camera) composer.addPass(renderPass); outlinePass = new THREE.OutlinePass(new THREE.Vector2(window.innerWidth, window.innerHeight), scene, camera); //outlinePass.renderToScreen = true outlinePass.selectedObjects = [] outlinePass.edgeGlow = 0.4 outlinePass.visibleEdgeColor.r = 1.0 outlinePass.visibleEdgeColor.g = 1.0 outlinePass.visibleEdgeColor.b = 1.0 outlinePass.pulsePeriod = 5 outlinePass.edgeThickness = 1 // default white composer.addPass(outlinePass); var final = new THREE.ShaderPass(THREE.CopyShader); final.renderToScreen = true; composer.addPass(final); /* var dragControls = new THREE.DragControls( objects, camera, renderer.domElement ); dragControls.addEventListener( 'dragstart', function ( event ) { controls.enabled = false; } ); dragControls.addEventListener( 'dragend', function ( event ) { controls.enabled = true; } ); */ stats = new Stats(); container.appendChild(stats.dom); window.addEventListener('resize', onWindowResize, false); } function onWindowResize() { var width = window.innerWidth || 1; var height = window.innerHeight || 1; var devicePixelRatio = window.devicePixelRatio || 1; camera.aspect = window.innerWidth / window.innerHeight; camera.updateProjectionMatrix(); renderer.setSize(width, height); composer.setSize(width, height); } function onDocumentMouseMove(event) { event.preventDefault(); mouse.x = (event.clientX / window.innerWidth) * 2 - 1; mouse.y = -(event.clientY / window.innerHeight) * 2 + 1; } // var lasttime; var rdir = 1.0 var maxval = 80*Math.PI/180.0 var minval = -30*Math.PI/180.0 function animate(time) { requestAnimationFrame(animate); capturer.capture(renderer.domElement); render(); controls.update(); stats.update(); if (lasttime) { delta = time - lasttime timer.update(delta); var r = slots[9].rotation.z + rdir*delta*0.001 if(r > maxval) { r = maxval rdir = -rdir } else if (r < minval) { r = minval rdir = -rdir } slots[9].rotation.z = r } lasttime = time } function render() { composer.render(); } </script> </body> </html>
31.479675
137
0.441942
fc445363cfcf678d4e45af9a51bacf7cf2e9e5d3
775
css
CSS
public/main.css
garthenweb/csscssbeauty
91cef43477612b9328fa56e63025c9f21042911a
[ "MIT" ]
null
null
null
public/main.css
garthenweb/csscssbeauty
91cef43477612b9328fa56e63025c9f21042911a
[ "MIT" ]
1
2015-11-29T12:44:01.000Z
2015-11-29T12:44:01.000Z
public/main.css
garthenweb/csscssbeauty
91cef43477612b9328fa56e63025c9f21042911a
[ "MIT" ]
null
null
null
body { font-family: sans-serif; font-size: 100%; margin: 0; padding: 0; } .header { height: 15em; padding: 1em 1em 4em 2em; } .header--error { background: brown; } .header--success { background: #40B51B; height: 100%; display: flex; box-sizing: border-box; } .header--success h1 { margin: auto; } h1 { color: #fff; font-size: 5em; text-align: center; } .code { padding: 2em; font-size: 1em; } li { display: inline-block; margin: 0 0 2em 2em; vertical-align: top; } ul, dl { margin: 0; list-style: none; } .code-item { position: relative; } .code-item-count { color: brown; background: lightgrey; padding: 7px; border-radius: 5px; position: absolute; right: 0; right: 10px; top: -10px; } code { line-height: 1.1em; }
11.231884
27
0.624516
05b2603a03c13363734729e39cdd9e548d10206e
7,113
asm
Assembly
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xa0_notsx.log_14712_426.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xa0_notsx.log_14712_426.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xa0_notsx.log_14712_426.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
3
2020-07-14T17:07:07.000Z
2022-03-21T01:12:22.000Z
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r8 push %rbx push %rcx push %rdi push %rsi lea addresses_D_ht+0xb249, %rsi lea addresses_D_ht+0x1781d, %rdi and %rbx, %rbx mov $9, %rcx rep movsl nop nop nop nop nop xor $44868, %r8 lea addresses_UC_ht+0x14832, %rsi lea addresses_D_ht+0xfc1d, %rdi clflush (%rdi) nop nop nop nop nop inc %r12 mov $62, %rcx rep movsq cmp %r8, %r8 lea addresses_A_ht+0x569d, %rcx xor $61615, %r8 movl $0x61626364, (%rcx) nop nop sub $48667, %rdi lea addresses_UC_ht+0x7ea5, %rcx nop nop add $29486, %r13 mov $0x6162636465666768, %r8 movq %r8, %xmm0 movups %xmm0, (%rcx) nop nop nop nop and $35836, %r13 lea addresses_normal_ht+0xac1d, %r12 nop nop nop nop nop cmp $60578, %rsi mov (%r12), %ebx nop nop nop nop nop and %rbx, %rbx pop %rsi pop %rdi pop %rcx pop %rbx pop %r8 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r8 push %rbx push %rcx push %rdi push %rdx push %rsi // Store lea addresses_WC+0x1c81d, %rdx clflush (%rdx) nop nop nop nop sub %r8, %r8 mov $0x5152535455565758, %rbx movq %rbx, %xmm5 vmovups %ymm5, (%rdx) nop nop nop nop nop sub %rdi, %rdi // Store lea addresses_A+0x1225d, %rdi nop nop xor $10760, %r8 mov $0x5152535455565758, %r10 movq %r10, (%rdi) xor %r10, %r10 // Store lea addresses_D+0x167e5, %rbx nop cmp %rdx, %rdx movl $0x51525354, (%rbx) nop nop nop nop nop dec %rbx // REPMOV lea addresses_PSE+0x165a7, %rsi lea addresses_UC+0x15603, %rdi nop nop inc %rdx mov $126, %rcx rep movsb nop nop xor $15785, %r12 // Store lea addresses_D+0x5a1d, %rcx nop nop nop nop inc %r12 mov $0x5152535455565758, %r10 movq %r10, %xmm3 vmovups %ymm3, (%rcx) nop nop inc %r12 // Store lea addresses_D+0x4fd5, %r10 nop nop sub %rsi, %rsi mov $0x5152535455565758, %rdx movq %rdx, %xmm0 movups %xmm0, (%r10) nop nop nop add %r8, %r8 // Store lea addresses_A+0xdd1d, %rdi dec %rbx mov $0x5152535455565758, %rcx movq %rcx, %xmm3 vmovaps %ymm3, (%rdi) nop inc %rsi // Faulty Load lea addresses_US+0x1c41d, %rdi nop nop nop cmp $19661, %rcx movntdqa (%rdi), %xmm0 vpextrq $0, %xmm0, %rdx lea oracles, %r8 and $0xff, %rdx shlq $12, %rdx mov (%r8,%rdx,1), %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r8 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_US', 'AVXalign': True, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 10}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 8, 'NT': True, 'same': False, 'congruent': 6}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 1}} {'src': {'type': 'addresses_PSE', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC', 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 6}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 3}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': True, 'size': 32, 'NT': False, 'same': False, 'congruent': 8}} [Faulty Load] {'src': {'type': 'addresses_US', 'AVXalign': False, 'size': 16, 'NT': True, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': True}} {'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 7}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 2}} {'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 11}, 'OP': 'LOAD'} {'00': 14712} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
32.930556
2,999
0.655982
5f3508e7526e93a4f7b6bfed8979036452f19d4d
5,795
swift
Swift
Tests/CombineXTests/Publishers/FlatMapSpec.swift
cxswift/CombineX
299bc0f8861f7aa6708780457aeeafab1c51eaa7
[ "MIT" ]
383
2019-09-08T16:03:21.000Z
2022-03-25T06:11:43.000Z
Tests/CombineXTests/Publishers/FlatMapSpec.swift
cxswift/CombineX
299bc0f8861f7aa6708780457aeeafab1c51eaa7
[ "MIT" ]
54
2019-09-18T13:01:08.000Z
2021-07-12T21:17:00.000Z
Tests/CombineXTests/Publishers/FlatMapSpec.swift
cxswift/CombineX
299bc0f8861f7aa6708780457aeeafab1c51eaa7
[ "MIT" ]
32
2019-09-14T12:35:19.000Z
2022-03-24T08:42:03.000Z
import CXTestUtility import Dispatch import Nimble import Quick class FlatMapSpec: QuickSpec { override func spec() { // MARK: Send Values describe("Send Values") { // MARK: 1.1 should send sub-subscriber's value it("should send sub-subscriber's value") { let sequence = Publishers.Sequence<[Int], Never>(sequence: [1, 2, 3]) let pub = sequence .flatMap { Publishers.Sequence<[Int], Never>(sequence: [$0, $0, $0]) } let sub = pub.subscribeTracingSubscriber(initialDemand: .unlimited) let events = [1, 2, 3].flatMap { [$0, $0, $0] }.map(TracingSubscriber<Int, Never>.Event.value) let expected = events + [.completion(.finished)] expect(sub.eventsWithoutSubscription) == expected } // MARK: 1.2 should send values as demand it("should send values as demand") { let sequence = Publishers.Sequence<[Int], Never>(sequence: [1, 2, 3, 4, 5]) let pub = sequence .flatMap { Publishers.Sequence<[Int], Never>(sequence: [$0, $0, $0]) } .flatMap { Publishers.Sequence<[Int], Never>(sequence: [$0, $0, $0]) } let sub = pub.subscribeTracingSubscriber(initialDemand: .max(10)) { v in [1, 5].contains(v) ? .max(1) : .none } expect(sub.eventsWithoutSubscription.count) == 19 } // MARK: 1.3 should complete when a sub-publisher sends an error it("should complete when a sub-publisher sends an error") { let sequence = Publishers.Sequence<[Int], TestError>(sequence: [0, 1, 2]) let subjects = [ PassthroughSubject<Int, TestError>(), PassthroughSubject<Int, TestError>(), PassthroughSubject<Int, TestError>(), ] let pub = sequence .flatMap { subjects[$0] } let sub = pub.subscribeTracingSubscriber(initialDemand: .unlimited) 3.times { subjects[0].send(0) subjects[1].send(1) subjects[2].send(2) } subjects[1].send(completion: .failure(.e1)) expect(sub.eventsWithoutSubscription.count) == 10 var events = [0, 1, 2].flatMap { _ in [0, 1, 2] }.map(TracingSubscriber<Int, TestError>.Event.value) events.append(.completion(.failure(.e1))) expect(sub.eventsWithoutSubscription) == events } // MARK: 1.4 should buffer one output for each sub-publisher if there is no demand it("should buffer one output for each sub-publisher if there is no demand") { let subjects = [ PassthroughSubject<Int, Never>(), PassthroughSubject<Int, Never>() ] let pub = Publishers.Sequence<[Int], Never>(sequence: [0, 1]).flatMap { subjects[$0] } let sub = pub.subscribeTracingSubscriber(initialDemand: nil) subjects[0].send(0) subjects[1].send(0) subjects[0].send(1) subjects[1].send(1) sub.subscription?.request(.max(2)) subjects[1].send(2) subjects[0].send(3) subjects[1].send(4) subjects[0].send(5) sub.subscription?.request(.unlimited) expect(sub.eventsWithoutSubscription) == [.value(0), .value(0), .value(2), .value(3)] } } // MARK: - Concurrent describe("Concurrent") { // MARK: 2.1 should send as many values ad demand event if there are sent concurrently it("should send as many values ad demand event if there are sent concurrently") { let sequence = Publishers.Sequence<[Int], Never>(sequence: Array(0..<100)) var subjects: [PassthroughSubject<Int, Never>] = [] for _ in 0..<100 { subjects.append(PassthroughSubject<Int, Never>()) } let pub = sequence.flatMap { i -> PassthroughSubject<Int, Never> in return subjects[i] } let sub = pub.subscribeTracingSubscriber(initialDemand: .max(10)) DispatchQueue.global().concurrentPerform(iterations: 100) { i in subjects[i].send(i) } expect(sub.eventsWithoutSubscription.count) == 10 } } // MARK: - Overloads describe("Overloads") { it("convenient overloads for setting failure type") { _ = Just(0).flatMap { _ in Fail<Bool, TestError>(error: .e0) } _ = Fail<Bool, TestError>(error: .e0).flatMap { _ in Just(0) } _ = Just(0).flatMap { _ in Just("") } } } } }
39.691781
116
0.454357
fbba4b741b06d9b9ba4549a72ae9ed8120b5464d
929
h
C
src/ValueColor.h
StianAndreOlsen/ColorVario
c10dbf13dcef09121bf1817a6d07606ef5a89da4
[ "MIT" ]
1
2021-05-05T21:37:55.000Z
2021-05-05T21:37:55.000Z
src/ValueColor.h
StianAndreOlsen/ColorVario
c10dbf13dcef09121bf1817a6d07606ef5a89da4
[ "MIT" ]
null
null
null
src/ValueColor.h
StianAndreOlsen/ColorVario
c10dbf13dcef09121bf1817a6d07606ef5a89da4
[ "MIT" ]
4
2019-11-06T06:25:47.000Z
2021-05-05T21:39:12.000Z
#ifndef KYSTSOFT_VALUECOLOR_H #define KYSTSOFT_VALUECOLOR_H #include "Settings.h" #include "ValueColorPoint.h" #include "ValueZones.h" namespace Kystsoft { class ValueColor { public: void load(const Settings& settings, const std::string& section); const ValueZones& valueZones() const { return zones; } void setValueZones(const ValueZones& valueZones) { zones = valueZones; } void addColorPoint(const ValueColorPoint& point) { colorPoints.push_back(point); } void addColorPoint(double value, const Color& color) { addColorPoint(ValueColorPoint(value, color)); } void clearColorPoints() { colorPoints.clear(); } Color color(double value) const; Color operator()(double value) const { return color(value); } private: size_t colorPointInterval(double value) const; ValueZones zones; std::vector<ValueColorPoint> colorPoints; }; } // namespace Kystsoft #endif // KYSTSOFT_VALUECOLOR_H
29.967742
84
0.744887
268f39b6fb355f4cddc4da6b9a76167165ddb911
419
asm
Assembly
programs/oeis/005/A005358.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/005/A005358.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/005/A005358.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A005358: Number of low discrepancy sequences in base 5. ; 0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,93,96,99,102,105,108,111,114,117,120,123,126,129,132,135,138,141,144,147,150,153,156,159,162 lpb $0 sub $0,1 add $3,3 sub $0,$3 add $1,$0 add $2,$3 add $4,$2 mul $4,2 mov $3,$4 lpe mov $0,$1
27.933333
245
0.625298
610f8164a00f8f561f6415c2ade3a8b99f9b263d
1,319
css
CSS
assets/css/main.css
jwill/grass
20ed94f3118031f7d158a381f44e016bbf687c53
[ "Apache-2.0" ]
2
2018-12-12T01:09:54.000Z
2020-02-03T21:33:49.000Z
assets/css/main.css
joshareed/grass
be3ba8c3b3ce43e4632d8e61b6f428e423146d59
[ "Apache-2.0" ]
null
null
null
assets/css/main.css
joshareed/grass
be3ba8c3b3ce43e4632d8e61b6f428e423146d59
[ "Apache-2.0" ]
null
null
null
a { text-decoration: none; } #sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 30%; border-right: 1px solid #ccc; } #sidebar header { padding: 1em; } #sidebar section { margin: 1em; } #sidebar section h3 { margin-bottom: 0.5em; } #sidebar section ul { margin-top: 0; } #sidebar header h2 { font-size: 20px; line-height: 20px; margin: 0; font-weight: 100; color: #000; } #content { position: absolute; left: 30%; width: 70%; display: block; overflow: scroll; } #content article { padding: 0 1em 2em 1em; border-bottom: 1px solid #ccc; } #content h1 { margin: 0 0 0.5em 0; } article header .meta { text-transform: uppercase; font-size: 0.9em; color: #aaa; } #footer { display: block; text-align: center; margin: 1em; } #content footer nav { text-align: center; } #content .tags { display: inline-block; } #content .tags li { display: inline-block; list-style-type: none; margin-right: 2px; padding: 2px 4px; border: 1px solid #ccc; border-radius: 5px; } #content .tags li:hover { background-color: #ccc; border-color: #aaa; } article footer { margin: 2em 2em 0 2em; } article footer ul { padding-left: 0; margin: 0; } article footer .prev:after { content: "\2022 "; padding-left: 7px; } article footer .next:before { content: "\2022 "; padding-right: 7px; }
14.494505
31
0.661107
fe098b960ef68e6943504f17299782ecf8a92b0d
1,042
kt
Kotlin
app/src/main/java/com/filippoengidashet/spacex/mvvm/vm/CompanyViewModel.kt
filippoengidashet/SpaceX-Android
775fcbf6e89647a7115fbc01d849ee18a9e4f409
[ "MIT" ]
1
2021-11-13T02:57:32.000Z
2021-11-13T02:57:32.000Z
app/src/main/java/com/filippoengidashet/spacex/mvvm/vm/CompanyViewModel.kt
filippoengidashet/SpaceX-Android
775fcbf6e89647a7115fbc01d849ee18a9e4f409
[ "MIT" ]
null
null
null
app/src/main/java/com/filippoengidashet/spacex/mvvm/vm/CompanyViewModel.kt
filippoengidashet/SpaceX-Android
775fcbf6e89647a7115fbc01d849ee18a9e4f409
[ "MIT" ]
null
null
null
package com.filippoengidashet.spacex.mvvm.vm import androidx.lifecycle.* import com.filippoengidashet.spacex.mvvm.model.entity.bean.CompanyData import com.filippoengidashet.spacex.mvvm.model.entity.bean.ResultBean import com.filippoengidashet.spacex.mvvm.model.repository.SpaceXRepository import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.launch import javax.inject.Inject /** * @author Filippo 09/11/2021 */ @HiltViewModel class CompanyViewModel @Inject constructor( private val repository: SpaceXRepository, ) : ViewModel() { private var loaded: Boolean = false private val _companyData = MutableLiveData<ResultBean<CompanyData>>() fun getCompanyLiveData(): LiveData<ResultBean<CompanyData>> = _companyData fun load() { if(loaded) return loaded = true viewModelScope.launch { repository.getCompanyDataFlow().collectLatest { data -> _companyData.value = data } } } }
30.647059
78
0.739923
940e0b2d6b0974dc30305e2ee8f04ebca2413329
274
sql
SQL
src/databases/Query_station_status_for_a_single_station.sql
Biodun/BlueBike-availability-prediction
d60daa2dec269f85c3c38a55338bdabf71a7b6b1
[ "FTL" ]
null
null
null
src/databases/Query_station_status_for_a_single_station.sql
Biodun/BlueBike-availability-prediction
d60daa2dec269f85c3c38a55338bdabf71a7b6b1
[ "FTL" ]
null
null
null
src/databases/Query_station_status_for_a_single_station.sql
Biodun/BlueBike-availability-prediction
d60daa2dec269f85c3c38a55338bdabf71a7b6b1
[ "FTL" ]
null
null
null
select id ,station_id ,num_bikes_available ,num_ebikes_available ,num_bikes_disabled ,num_docks_available ,num_docks_disabled ,is_installed ,is_renting ,is_returning ,last_reported ,timestamp_of_data_read_request from blue_bikes.raw_station_status WHERE station_id = '107';
19.571429
34
0.872263
265b2e6ca25dfb1f00fc621a4ba7f6f0f0e0268b
4,230
java
Java
code/android/src/edu/umbc/cs/ebiquity/mithril/hma/ui/SendAppDataToServerSettingsActivity.java
prajitdas/HeimdallServ
27e43d13c9ed02abaebb6ec48f9094f92f322f27
[ "MIT" ]
null
null
null
code/android/src/edu/umbc/cs/ebiquity/mithril/hma/ui/SendAppDataToServerSettingsActivity.java
prajitdas/HeimdallServ
27e43d13c9ed02abaebb6ec48f9094f92f322f27
[ "MIT" ]
null
null
null
code/android/src/edu/umbc/cs/ebiquity/mithril/hma/ui/SendAppDataToServerSettingsActivity.java
prajitdas/HeimdallServ
27e43d13c9ed02abaebb6ec48f9094f92f322f27
[ "MIT" ]
null
null
null
package edu.umbc.cs.ebiquity.mithril.hma.ui; import android.app.ActivityManager; import android.app.ActivityManager.RunningServiceInfo; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.preference.PreferenceActivity; import android.preference.PreferenceManager; import android.support.v4.content.LocalBroadcastManager; import android.widget.Toast; import edu.umbc.cs.ebiquity.mithril.hma.HMAApplication; import edu.umbc.cs.ebiquity.mithril.hma.R; import edu.umbc.cs.ebiquity.mithril.hma.service.CurrentAppsService; public class SendAppDataToServerSettingsActivity extends PreferenceActivity { private Intent mServiceIntent; @SuppressWarnings("deprecation") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preference_activity_send_app_data_to_server); startCurrentAppsService(); HMAApplication.setPreferences(PreferenceManager.getDefaultSharedPreferences(this)); } private void startCurrentAppsService() { /** * If service is running don't restart it * Otherwise create a new Intent to start the service */ if(!isServiceRunning(CurrentAppsService.class)) { mServiceIntent = new Intent(this, CurrentAppsService.class); this.startService(mServiceIntent); } } /** * Code from: http://stackoverflow.com/questions/600207/how-to-check-if-a-service-is-running-on-android * @param serviceClass * @return true if service is running or else false */ private boolean isServiceRunning(Class<?> serviceClass) { ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) if (serviceClass.getName().equals(service.service.getClassName())) return true; return false; } /* mCurrentAppsDataCollectionAgreementTxtView = (TextView) findViewById(R.id.currentAppsDataCollectionAgreementTxtView); mCurrentAppsDataCollectionAgreementTxtView.setText(R.string.agreementText); mAcceptAgreementBtn = (Button) findViewById(R.id.acceptAgreementBtn); mStartSvcBtn = (Button) findViewById(R.id.startCurrentAppsSvcBtn); boolean acceptedOrNot; if(HMAApplication.getPreferences().contains(HMAApplication.getConstAcceptDecisionKey())) { acceptedOrNot = HMAApplication.getPreferences().getBoolean(HMAApplication.getConstAcceptDecisionKey(), false); if(acceptedOrNot) { mAcceptAgreementBtn.setEnabled(false); mStartSvcBtn.setEnabled(true); } else { mAcceptAgreementBtn.setEnabled(true); mStartSvcBtn.setEnabled(false); } } else { mAcceptAgreementBtn.setEnabled(true); mStartSvcBtn.setEnabled(false); }*/ // HMAApplication.setContextData(this, mLastLocation); //} /* private void setOnClickListeners() { mAcceptAgreementBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Editor editor = HMAApplication.getPreferences().edit(); editor.putBoolean(HMAApplication.getConstAcceptDecisionKey(), true); editor.commit(); mStartSvcBtn.setEnabled(true); mAcceptAgreementBtn.setEnabled(false);//.setVisibility(View.GONE); } }); mStartSvcBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startCurrentAppsService(); } }); } */ @Override public void onResume() { super.onResume(); IntentFilter currentAppsServiceIntentFilter = new IntentFilter(HMAApplication.getConstDataCollectionComplete()); LocalBroadcastManager.getInstance(this).registerReceiver(onEvent, currentAppsServiceIntentFilter); } @Override public void onPause() { LocalBroadcastManager.getInstance(this).unregisterReceiver(onEvent); super.onPause(); } private BroadcastReceiver onEvent = new BroadcastReceiver() { public void onReceive(Context ctxt, Intent i) { // b.setEnabled(true); Toast.makeText(getApplicationContext(), "Data collection complete", Toast.LENGTH_LONG).show(); } }; }
35.25
119
0.758392
de7033136963e99b773b4f1e682e44cdc51dc448
18,669
rs
Rust
implementations/rust/ockam/ockam_node/src/context.rs
jared-s/ockam
a1d482550aeafbc2a6040a5efb3f5effc9974d51
[ "Apache-2.0" ]
null
null
null
implementations/rust/ockam/ockam_node/src/context.rs
jared-s/ockam
a1d482550aeafbc2a6040a5efb3f5effc9974d51
[ "Apache-2.0" ]
null
null
null
implementations/rust/ockam/ockam_node/src/context.rs
jared-s/ockam
a1d482550aeafbc2a6040a5efb3f5effc9974d51
[ "Apache-2.0" ]
null
null
null
use crate::tokio::{ self, runtime::Runtime, sync::mpsc::{channel, Receiver, Sender}, time::timeout, }; use crate::{ error::Error, parser, relay::{CtrlSignal, ProcessorRelay, RelayMessage, WorkerRelay}, router::SenderPair, Cancel, NodeMessage, ShutdownType, }; use core::time::Duration; use ockam_core::compat::{sync::Arc, vec::Vec}; use ockam_core::{ Address, AddressSet, LocalMessage, Message, Processor, Result, Route, TransportMessage, Worker, }; /// A default timeout in seconds pub const DEFAULT_TIMEOUT: u64 = 30; enum AddressType { Worker, Processor, } impl AddressType { fn str(&self) -> &'static str { match self { AddressType::Worker => "worker", AddressType::Processor => "processor", } } } /// Context contains Node state and references to the runtime. pub struct Context { address: AddressSet, sender: Sender<NodeMessage>, rt: Arc<Runtime>, mailbox: Receiver<RelayMessage>, } impl Context { /// Return runtime clone pub fn runtime(&self) -> Arc<Runtime> { self.rt.clone() } /// Wait for the next message from the mailbox pub(crate) async fn mailbox_next(&mut self) -> Option<RelayMessage> { self.mailbox.recv().await } } impl Context { /// Create a new context /// /// This function returns a new instance of Context, the relay /// sender pair, and relay control signal receiver. pub(crate) fn new( rt: Arc<Runtime>, sender: Sender<NodeMessage>, address: AddressSet, ) -> (Self, SenderPair, Receiver<CtrlSignal>) { let (mailbox_tx, mailbox) = channel(32); let (ctrl_tx, ctrl_rx) = channel(1); ( Self { rt, sender, address, mailbox, }, SenderPair { msgs: mailbox_tx, ctrl: ctrl_tx, }, ctrl_rx, ) } /// Return the primary worker address pub fn address(&self) -> Address { self.address.first() } /// Return all addresses of this worker pub fn aliases(&self) -> AddressSet { self.address.clone().into_iter().skip(1).collect() } /// Utility function to sleep tasks from other crates #[doc(hidden)] pub async fn sleep(&self, dur: Duration) { tokio::time::sleep(dur).await; } /// Create a new context without spawning a full worker pub async fn new_context<S: Into<Address>>(&self, addr: S) -> Result<Context> { self.new_context_impl(addr.into()).await } async fn new_context_impl(&self, addr: Address) -> Result<Context> { // Create a new context and get access to the mailbox senders let (ctx, sender, _) = Self::new( Arc::clone(&self.rt), self.sender.clone(), addr.clone().into(), ); // Create a "bare relay" and register it with the router let (msg, mut rx) = NodeMessage::start_worker(addr.into(), sender, true); self.sender .send(msg) .await .map_err(|_| Error::FailedStartWorker)?; Ok(rx .recv() .await .ok_or(Error::InternalIOFailure)? .map(|_| ctx)?) } /// Start a new worker handle at [`Address`](ockam_core::Address) pub async fn start_worker<NM, NW, S>(&self, address: S, worker: NW) -> Result<()> where S: Into<AddressSet>, NM: Message + Send + 'static, NW: Worker<Context = Context, Message = NM>, { self.start_worker_impl(address.into(), worker).await } async fn start_worker_impl<NM, NW>(&self, address: AddressSet, worker: NW) -> Result<()> where NM: Message + Send + 'static, NW: Worker<Context = Context, Message = NM>, { // Pass it to the context let (ctx, sender, ctrl_rx) = Context::new(self.rt.clone(), self.sender.clone(), address.clone()); // Then initialise the worker message relay WorkerRelay::<NW, NM>::init(self.rt.as_ref(), worker, ctx, ctrl_rx); // Send start request to router let (msg, mut rx) = NodeMessage::start_worker(address, sender, false); self.sender .send(msg) .await .map_err(|_| Error::FailedStartWorker)?; // Wait for the actual return code Ok(rx .recv() .await .ok_or(Error::InternalIOFailure)? .map(|_| ())?) } /// Start a new processor at [`Address`](ockam_core::Address) pub async fn start_processor<P>(&self, address: impl Into<Address>, processor: P) -> Result<()> where P: Processor<Context = Context>, { self.start_processor_impl(address.into(), processor).await } async fn start_processor_impl<P>(&self, address: Address, processor: P) -> Result<()> where P: Processor<Context = Context>, { let addr = address.clone(); let (ctx, senders, ctrl_rx) = Context::new(self.rt.clone(), self.sender.clone(), addr.into()); // Initialise the processor relay with the ctrl receiver ProcessorRelay::<P>::init(self.rt.as_ref(), processor, ctx, ctrl_rx); // Send start request to router let (msg, mut rx) = NodeMessage::start_processor(address, senders); self.sender .send(msg) .await .map_err(|_| Error::FailedStartProcessor)?; // Wait for the actual return code Ok(rx .recv() .await .ok_or(Error::InternalIOFailure)? .map(|_| ())?) } /// Shut down a worker by its primary address pub async fn stop_worker<A: Into<Address>>(&self, addr: A) -> Result<()> { self.stop_address(addr.into(), AddressType::Worker).await } /// Shut down a processor by its address pub async fn stop_processor<A: Into<Address>>(&self, addr: A) -> Result<()> { self.stop_address(addr.into(), AddressType::Processor).await } async fn stop_address(&self, addr: Address, t: AddressType) -> Result<()> { debug!("Shutting down {} {}", t.str(), addr); // Send the stop request let (req, mut rx) = match t { AddressType::Worker => NodeMessage::stop_worker(addr), AddressType::Processor => NodeMessage::stop_processor(addr), }; self.sender.send(req).await.map_err(Error::from)?; // Then check that address was properly shut down Ok(rx .recv() .await .ok_or(Error::InternalIOFailure)? .map(|_| ())?) } /// Signal to the local runtime to shut down immediately /// /// **WARNING**: calling this function may result in data loss. /// It is recommended to use the much safer /// [`Context::stop`](Context::stop) function instead! pub async fn stop_now(&mut self) -> Result<()> { let tx = self.sender.clone(); info!("Shutting down all workers"); let (msg, _) = NodeMessage::stop_node(ShutdownType::Immediate); match tx.send(msg).await { Ok(()) => Ok(()), Err(_e) => Err(Error::FailedStopNode.into()), } } /// Signal to the local runtime to shut down /// /// This call will hang until a safe shutdown has been completed. /// The default timeout for a safe shutdown is 1 second. You can /// change this behaviour by calling /// [`Context::stop_timeout`](Context::stop_timeout) directly. pub async fn stop(&mut self) -> Result<()> { self.stop_timeout(1).await } /// Signal to the local runtime to shut down /// /// This call will hang until a safe shutdown has been completed /// or the desired timeout has been reached. pub async fn stop_timeout(&mut self, seconds: u8) -> Result<()> { let (req, mut rx) = NodeMessage::stop_node(ShutdownType::Graceful(seconds)); self.sender.send(req).await.map_err(Error::from)?; // Wait until we get the all-clear Ok(rx .recv() .await .ok_or(Error::InternalIOFailure)? .map(|_| ())?) } /// Send a message via a fully qualified route /// /// Routes can be constructed from a set of [`Address`]es, or via /// the [`RouteBuilder`] type. Routes can contain middleware /// router addresses, which will re-address messages that need to /// be handled by specific domain workers. /// /// [`Address`]: ockam_core::Address /// [`RouteBuilder`]: ockam_core::RouteBuilder pub async fn send<R, M>(&self, route: R, msg: M) -> Result<()> where R: Into<Route>, M: Message + Send + 'static, { self.send_from_address(route.into(), msg, self.address()) .await } /// Send a message via a fully qualified route using specific Worker address /// /// Routes can be constructed from a set of [`Address`]es, or via /// the [`RouteBuilder`] type. Routes can contain middleware /// router addresses, which will re-address messages that need to /// be handled by specific domain workers. /// /// [`Address`]: ockam_core::Address /// [`RouteBuilder`]: ockam_core::RouteBuilder pub async fn send_from_address<R, M>( &self, route: R, msg: M, sending_address: Address, ) -> Result<()> where R: Into<Route>, M: Message + Send + 'static, { self.send_from_address_impl(route.into(), msg, sending_address) .await } async fn send_from_address_impl<M>( &self, route: Route, msg: M, sending_address: Address, ) -> Result<()> where M: Message + Send + 'static, { if !self.address.as_ref().contains(&sending_address) { return Err(Error::SenderAddressDoesntExist.into()); } let (reply_tx, mut reply_rx) = channel(1); let next = route.next().unwrap(); // TODO: communicate bad routes let req = NodeMessage::SenderReq(next.clone(), reply_tx); // First resolve the next hop in the route self.sender.send(req).await.map_err(Error::from)?; let (addr, sender, needs_wrapping) = reply_rx .recv() .await .ok_or(Error::InternalIOFailure)?? .take_sender()?; // Pack the payload into a TransportMessage let payload = msg.encode().unwrap(); let mut transport_msg = TransportMessage::v1(route.clone(), Route::new(), payload); transport_msg.return_route.modify().append(sending_address); let local_msg = LocalMessage::new(transport_msg, Vec::new()); // Pack transport message into relay message wrapper let msg = if needs_wrapping { RelayMessage::pre_router(addr, local_msg, route) } else { RelayMessage::direct(addr, local_msg, route) }; // Send the packed user message with associated route sender.send(msg).await.map_err(Error::from)?; Ok(()) } /// Forward a transport message to its next routing destination /// /// Similar to [`Context::send`], but taking a /// [`TransportMessage`], which contains the full destination /// route, and calculated return route for this hop. /// /// **Note:** you most likely want to use /// [`Context::send`] instead, unless you are writing an /// external router implementation for ockam node. /// /// [`Context::send`]: crate::Context::send /// [`TransportMessage`]: ockam_core::TransportMessage pub async fn forward(&self, local_msg: LocalMessage) -> Result<()> { // Resolve the sender for the next hop in the messages route let (reply_tx, mut reply_rx) = channel(1); let next = local_msg.transport().onward_route.next().unwrap(); // TODO: communicate bad routes let req = NodeMessage::SenderReq(next.clone(), reply_tx); // First resolve the next hop in the route self.sender.send(req).await.map_err(Error::from)?; let (addr, sender, needs_wrapping) = reply_rx .recv() .await .ok_or(Error::InternalIOFailure)?? .take_sender()?; // Pack the transport message into a relay message let onward = local_msg.transport().onward_route.clone(); // let msg = RelayMessage::direct(addr, data, onward); let msg = if needs_wrapping { RelayMessage::pre_router(addr, local_msg, onward) } else { RelayMessage::direct(addr, local_msg, onward) }; sender.send(msg).await.map_err(Error::from)?; Ok(()) } /// Receive a message without a timeout pub async fn receive_block<M: Message>(&mut self) -> Result<Cancel<'_, M>> { let (msg, data, addr) = self.next_from_mailbox().await?; Ok(Cancel::new(msg, data, addr, self)) } /// Block the current worker to wait for a typed message /// /// This function may return a `Err(FailedLoadData)` if the /// underlying worker was shut down, or `Err(Timeout)` if the call /// was waiting for longer than the `default timeout`. Use /// [`receive_timeout`](Context::receive_timeout) to adjust the /// timeout period. /// /// Will return `None` if the corresponding worker has been /// stopped, or the underlying Node has shut down. pub async fn receive<M: Message>(&mut self) -> Result<Cancel<'_, M>> { self.receive_timeout(DEFAULT_TIMEOUT).await } /// Block to wait for a typed message, with explicit timeout pub async fn receive_timeout<M: Message>( &mut self, timeout_secs: u64, ) -> Result<Cancel<'_, M>> { let (msg, data, addr) = timeout(Duration::from_secs(timeout_secs), async { self.next_from_mailbox().await }) .await .map_err(Error::from)??; Ok(Cancel::new(msg, data, addr, self)) } /// Block the current worker to wait for a message satisfying a conditional /// /// Will return `Err` if the corresponding worker has been /// stopped, or the underlying node has shut down. This operation /// has a [default timeout](DEFAULT_TIMEOUT). /// /// Internally this function calls `receive` and `.cancel()` in a /// loop until a matching message is found. pub async fn receive_match<M, F>(&mut self, check: F) -> Result<Cancel<'_, M>> where M: Message, F: Fn(&M) -> bool, { let (m, data, addr) = timeout(Duration::from_secs(DEFAULT_TIMEOUT), async { loop { match self.next_from_mailbox().await { Ok((m, data, addr)) if check(&m) => break Ok((m, data, addr)), Ok((_, data, _)) => { // Requeue self.forward(data).await?; } e => break e, } } }) .await .map_err(Error::from)??; Ok(Cancel::new(m, data, addr, self)) } /// Assign the current worker to a cluster /// /// A cluster is a set of workers that should be stopped together /// when the node is stopped or parts of the system are reloaded. /// **This is not to be confused with supervisors!** /// /// By adding your worker to a cluster you signal to the runtime /// that your worker may be depended on by other workers that /// should be stopped first. /// /// **Your cluster name MUST NOT start with `_internals.` or /// `ockam.`!** /// /// Clusters are de-allocated in reverse order of their /// initialisation when the node is stopped. pub async fn set_cluster<S: Into<String>>(&self, label: S) -> Result<()> { let (msg, mut rx) = NodeMessage::set_cluster(self.address(), label.into()); self.sender.send(msg).await.map_err(Error::from)?; Ok(rx.recv().await.ok_or(Error::InternalIOFailure)??.is_ok()?) } /// Return a list of all available worker addresses on a node pub async fn list_workers(&self) -> Result<Vec<Address>> { let (msg, mut reply_rx) = NodeMessage::list_workers(); self.sender.send(msg).await.map_err(Error::from)?; Ok(reply_rx .recv() .await .ok_or(Error::InternalIOFailure)?? .take_workers()?) } /// Register a router for a specific address type pub async fn register<A: Into<Address>>(&self, type_: u8, addr: A) -> Result<()> { self.register_impl(type_, addr.into()).await } /// Send a shutdown acknowlegement to the router pub(crate) async fn send_stop_ack(&self) -> Result<()> { self.sender .send(NodeMessage::StopAck(self.address())) .await .map_err(Error::from)?; Ok(()) } async fn register_impl(&self, type_: u8, addr: Address) -> Result<()> { let (tx, mut rx) = channel(1); self.sender .send(NodeMessage::Router(type_, addr, tx)) .await .map_err(|_| Error::InternalIOFailure)?; Ok(rx.recv().await.ok_or(Error::InternalIOFailure)??.is_ok()?) } /// A convenience function to get a data 3-tuple from the mailbox /// /// The reason this function doesn't construct a `Cancel<_, M>` is /// to avoid the lifetime collision between the mutation on `self` /// and the ref to `Context` passed to `Cancel::new(..)` /// /// This function will block and re-queue messages into the /// mailbox until it can receive the correct message payload. /// /// WARNING: this will temporarily create a busyloop, this /// mechanism should be replaced with a waker system that lets the /// mailbox work not yield another message until the relay worker /// has woken it. async fn next_from_mailbox<M: Message>(&mut self) -> Result<(M, LocalMessage, Address)> { loop { let msg = self.mailbox_next().await.ok_or(Error::FailedLoadData)?; let (addr, data) = msg.local_msg(); // FIXME: make message parsing idempotent to avoid cloning match parser::message(&data.transport().payload).ok() { Some(msg) => break Ok((msg, data, addr)), None => { // Requeue self.forward(data).await?; } } } } }
34.381215
102
0.580588
9991fa105b3afa71f7d618f8dcbb6bb1455e7b95
78
sql
SQL
src/main/resources/db/migration/V20210415044812__add_public_field.sql
EmreKp/haciko
6bc48fc864c77aff63ee1f7f3a3a264d85b22b36
[ "MIT" ]
null
null
null
src/main/resources/db/migration/V20210415044812__add_public_field.sql
EmreKp/haciko
6bc48fc864c77aff63ee1f7f3a3a264d85b22b36
[ "MIT" ]
null
null
null
src/main/resources/db/migration/V20210415044812__add_public_field.sql
EmreKp/haciko
6bc48fc864c77aff63ee1f7f3a3a264d85b22b36
[ "MIT" ]
null
null
null
ALTER TABLE posts ADD COLUMN is_public TINYINT(1) DEFAULT 1 AFTER category_id;
78
78
0.833333
9d32ef1b1aed8315c124284546f82613eabf79cf
697
asm
Assembly
data/pokemon/base_stats/sandshrew.asm
Karkino/KarkCrystal16
945dde0354016f9357e9d3798312cc6efa52ff7a
[ "blessing" ]
null
null
null
data/pokemon/base_stats/sandshrew.asm
Karkino/KarkCrystal16
945dde0354016f9357e9d3798312cc6efa52ff7a
[ "blessing" ]
null
null
null
data/pokemon/base_stats/sandshrew.asm
Karkino/KarkCrystal16
945dde0354016f9357e9d3798312cc6efa52ff7a
[ "blessing" ]
null
null
null
db 0 ; species ID placeholder db 55, 75, 85, 55, 20, 35 ; hp atk def spd sat sdf db GROUND, GROUND ; type db 255 ; catch rate db 93 ; base exp db NO_ITEM, NO_ITEM ; items db GENDER_F50 ; gender ratio db 100 ; unknown 1 db 20 ; step cycles to hatch db 5 ; unknown 2 INCBIN "gfx/pokemon/sandshrew/front.dimensions" db 0, 0, 0, 0 ; padding db GROWTH_MEDIUM_FAST ; growth rate dn EGG_GROUND, EGG_GROUND ; egg groups ; tm/hm learnset tmhm DYNAMICPUNCH, HEADBUTT, CURSE, TOXIC, ROCK_SMASH, SUNNY_DAY, SNORE, PROTECT, POISON_FANG, IRON_HEAD, EARTHQUAKE, RETURN, DIG, DOUBLE_TEAM, SWAGGER, SLEEP_TALK, SANDSTORM, SWIFT, PURSUIT, REST, ATTRACT, THIEF, CUT, STRENGTH ; end
31.681818
228
0.710187
c7d2567a58c314f17dd27f337b550f87ebab5e66
3,301
py
Python
utils/tester.py
park-sungmoo/odqa_baseline_code
45954be766e5f987bef18e5b8a2e47f1508742cd
[ "Apache-2.0" ]
67
2021-05-12T15:54:28.000Z
2022-03-12T15:55:35.000Z
utils/tester.py
park-sungmoo/odqa_baseline_code
45954be766e5f987bef18e5b8a2e47f1508742cd
[ "Apache-2.0" ]
71
2021-05-01T06:07:37.000Z
2022-01-28T16:54:46.000Z
utils/tester.py
park-sungmoo/odqa_baseline_code
45954be766e5f987bef18e5b8a2e47f1508742cd
[ "Apache-2.0" ]
14
2021-05-24T10:57:27.000Z
2022-02-18T06:34:11.000Z
import random import unittest import wandb from transformers import set_seed, DataCollatorWithPadding from utils.tools import get_args from utils.tools import update_args, run_test from utils.trainer_qa import QuestionAnsweringTrainer from utils.prepare import prepare_dataset, preprocess_dataset, get_reader_model, compute_metrics args = get_args() strategies = args.strategies SEED = random.choice(args.seeds) # fix run_cnt 1 @run_test class TestReader(unittest.TestCase): def test_strategy_is_not_none(self, args=args): self.assertIsNotNone(strategies, "전달받은 전략이 없습니다.") def test_valid_strategy(self, args=args): for strategy in strategies: try: update_args(args, strategy) except FileNotFoundError: assert False, "전략명이 맞는지 확인해주세요. " def test_valid_dataset(self, args=args): for seed, strategy in [(SEED, strategy) for strategy in strategies]: args = update_args(args, strategy) args.strategy, args.seed = strategy, seed set_seed(seed) try: prepare_dataset(args, is_train=True) except KeyError: assert False, "존재하지 않는 dataset입니다. " def test_valid_model(self, args=args): for seed, strategy in [(SEED, strategy) for strategy in strategies]: args = update_args(args, strategy) args.strategy, args.seed = strategy, seed set_seed(seed) try: get_reader_model(args) except Exception: assert False, "hugging face에 존재하지 않는 model 혹은 잘못된 경로입니다. " def test_strategies_with_dataset(self, args=args): """ (Constraint) - num_train_epoch 1 - random seed 1 - dataset fragment (rows : 100) (Caution) ERROR가 표시된다면, 상위 단위 테스트 결과를 확인하세요. """ for seed, strategy in [(SEED, strategy) for strategy in strategies]: wandb.init(project="p-stage-3-test", reinit=True) args = update_args(args, strategy) args.strategy, args.seed = strategy, seed set_seed(seed) datasets = prepare_dataset(args, is_train=True) model, tokenizer = get_reader_model(args) train_dataset, post_processing_function = preprocess_dataset(args, datasets, tokenizer, is_train=True) train_dataset = train_dataset.select(range(100)) # select 100 data_collator = DataCollatorWithPadding(tokenizer, pad_to_multiple_of=8 if args.train.fp16 else None) args.train.do_train = True args.train.run_name = "_".join([strategy, args.alias, str(seed), "test"]) wandb.run.name = args.train.run_name # TRAIN MRC args.train.num_train_epochs = 1.0 # fix epoch 1 trainer = QuestionAnsweringTrainer( model=model, args=args.train, # training_args custom_args=args, train_dataset=train_dataset, tokenizer=tokenizer, data_collator=data_collator, post_process_function=post_processing_function, compute_metrics=compute_metrics, ) trainer.train()
36.274725
114
0.622539
26201f4653125a8120f52c003f8cf3e039a7c34f
3,904
java
Java
2020/src/main/java/org/usfirst/frc/team4488/robot/autonomous/modes/ShootAndGrabTrenchMode.java
shockwave4488/FRC-2020-Public
908c0c4065ef8f9ec6ec44a79ed3559a91562b5b
[ "MIT" ]
null
null
null
2020/src/main/java/org/usfirst/frc/team4488/robot/autonomous/modes/ShootAndGrabTrenchMode.java
shockwave4488/FRC-2020-Public
908c0c4065ef8f9ec6ec44a79ed3559a91562b5b
[ "MIT" ]
null
null
null
2020/src/main/java/org/usfirst/frc/team4488/robot/autonomous/modes/ShootAndGrabTrenchMode.java
shockwave4488/FRC-2020-Public
908c0c4065ef8f9ec6ec44a79ed3559a91562b5b
[ "MIT" ]
null
null
null
package org.usfirst.frc.team4488.robot.autonomous.modes; import java.util.ArrayList; import org.usfirst.frc.team4488.robot.app.paths.PortStartToStartOfSameTrench; import org.usfirst.frc.team4488.robot.app.paths.StartOfSameTrenchToControlPanel; import org.usfirst.frc.team4488.robot.autonomous.AutoModeBase; import org.usfirst.frc.team4488.robot.autonomous.actions.Action; import org.usfirst.frc.team4488.robot.autonomous.actions.DrivePathAction; import org.usfirst.frc.team4488.robot.autonomous.actions.IntakeOut; import org.usfirst.frc.team4488.robot.autonomous.actions.NonBlockingIndex; import org.usfirst.frc.team4488.robot.autonomous.actions.NonBlockingIntake; import org.usfirst.frc.team4488.robot.autonomous.actions.ParallelAction; import org.usfirst.frc.team4488.robot.autonomous.actions.ResetPoseFromPathAction; import org.usfirst.frc.team4488.robot.autonomous.actions.SpinShooterAction; import org.usfirst.frc.team4488.robot.routines.LineUpAndShoot; import org.usfirst.frc.team4488.robot.systems.Indexer; import org.usfirst.frc.team4488.robot.systems.Intake; import org.usfirst.frc.team4488.robot.systems.LimelightManager; import org.usfirst.frc.team4488.robot.systems.Shooter; import org.usfirst.frc.team4488.robot.systems.SubsystemManager; import org.usfirst.frc.team4488.robot.systems.drive.DriveBase; import org.usfirst.frc.team4488.robot.systems.drive.WestCoastDrive; public class ShootAndGrabTrenchMode extends AutoModeBase { private static final double INTAKE_TIME = 5.0; private static final double FAKE_SHOOT_TIME = 5; private static final double FIRST_PRESPIN_RPMS = 4350; private static final double SECOND_PRESPIN_RPMS = 4400; private DriveBase drive = SubsystemManager.getInstance().getDrive(); private Shooter shooter = Shooter.getInstance(); private LimelightManager llManager = LimelightManager.getInstance(); private Intake intake = Intake.getInstance(); private Indexer indexer = Indexer.getInstance(); public ShootAndGrabTrenchMode() { requireSystem(drive); requireSystem(shooter); requireSystem(llManager); requireSystem(intake); requireSystem(indexer); } @Override protected void modeStart() { WestCoastDrive westCoast = (WestCoastDrive) drive; addAction(new ResetPoseFromPathAction(new PortStartToStartOfSameTrench())); addAction(new SpinShooterAction(FIRST_PRESPIN_RPMS)); // Back up to the start of the trench and shoot DrivePathAction driveToTrench = new DrivePathAction(new PortStartToStartOfSameTrench(), westCoast); addAction(driveToTrench); IntakeOut intakeOut = new IntakeOut(); addAction(intakeOut); addAction(new LineUpAndShoot(false, true, 2.5, FIRST_PRESPIN_RPMS)); addAction(new SpinShooterAction(SECOND_PRESPIN_RPMS)); // Back up to the end of the trench while intaking DrivePathAction drive = new DrivePathAction(new StartOfSameTrenchToControlPanel(), westCoast); NonBlockingIndex index = new NonBlockingIndex(); NonBlockingIntake intake = new NonBlockingIntake(); ArrayList<Action> intakeAndIndexAndDriveList = new ArrayList<Action>(); intakeAndIndexAndDriveList.add(intake); intakeAndIndexAndDriveList.add(index); intakeAndIndexAndDriveList.add(drive); ParallelAction intakeAndIndexAndDrive = new ParallelAction(intakeAndIndexAndDriveList); addAction(intakeAndIndexAndDrive); // Shoot balls ArrayList<Action> shootAndIntakeList = new ArrayList<Action>(); shootAndIntakeList.add(new LineUpAndShoot(false, true, 2.5, SECOND_PRESPIN_RPMS)); shootAndIntakeList.add(intake); ParallelAction shootAndIntake = new ParallelAction(shootAndIntakeList); addAction(shootAndIntake); } @Override protected void modeUpdate() {} @Override protected void modeDone() {} @Override protected void modeAbort() {} @Override protected boolean modeIsFinished() { return true; } }
39.434343
98
0.793033
40e4aa767263dbbb1c1c9ba3a37ce738fbbc8394
15,873
py
Python
tests/test_flask.py
shaysw/anyway
35dec531fd4ac79c99d09e684027df017e989ddc
[ "MIT" ]
1
2022-01-19T18:23:03.000Z
2022-01-19T18:23:03.000Z
tests/test_flask.py
shaysw/anyway
35dec531fd4ac79c99d09e684027df017e989ddc
[ "MIT" ]
2
2021-11-02T13:37:23.000Z
2021-11-23T15:51:06.000Z
tests/test_flask.py
shaysw/anyway
35dec531fd4ac79c99d09e684027df017e989ddc
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # from anyway.utilities import open_utf8 import json import typing from collections import Counter from functools import partial from http import HTTPStatus from http import client as http_client from unittest import mock from unittest.mock import patch import pytest from flask import Response from flask.testing import FlaskClient from urlobject import URLObject from anyway.app_and_db import app as flask_app from anyway.backend_constants import BE_CONST from anyway.error_code_and_strings import ( ERROR_TO_HTTP_CODE_DICT, build_json_for_user_api_error, Errors, ) from anyway.views.user_system.api import is_a_valid_role_name @pytest.fixture def app(): flask_app.secret_key = "test_key_dont_use_in_prod" return flask_app.test_client() query_flag = partial(pytest.mark.parametrize, argvalues=["1", ""]) @pytest.mark.server def test_main(app): rv = app.get("/") assert rv.status_code == http_client.OK assert "<title>ANYWAY - משפיעים בכל דרך</title>" in rv.data.decode("utf-8") # It requires parameters to know which markers you want. @pytest.mark.server def test_markers_empty(app): rv = app.get("/markers") assert rv.status_code == http_client.BAD_REQUEST assert "<title>400 Bad Request</title>" in rv.data.decode("utf-8") @pytest.fixture(scope="module") def marker_counter(): counter = Counter() yield counter assert counter["markers"] == 1624 @pytest.mark.server def test_bad_date(app): rv = app.get( "/markers?ne_lat=32.08656790211843&ne_lng=34.80611543655391&sw_lat=32.08003198103277&sw_lng=34.793884563446&zoom=17&thin_markers=false&start_date=a1104537600&end_date=1484697600&show_fatal=1&show_severe=1&show_light=1&approx=1&accurate=1&show_markers=1&show_discussions=1&show_urban=3&show_intersection=3&show_lane=3&show_day=7&show_holiday=0&show_time=24&start_time=25&end_time=25&weather=0&road=0&separation=0&surface=0&acctype=0&controlmeasure=0&district=0&case_type=0" ) assert rv.status_code == http_client.BAD_REQUEST @pytest.mark.partial_db @query_flag("show_fatal") @query_flag("show_severe") @query_flag("show_light") @query_flag("show_approx") @query_flag("show_accurate") def test_markers( app, show_fatal, show_severe, show_light, show_accurate, show_approx, marker_counter ): url = URLObject("/markers").set_query_params( { "ne_lat": "32.085413468822", "ne_lng": "34.797736215591385", "sw_lat": "32.07001357040486", "sw_lng": "34.775548982620194", "zoom": "16", "thin_markers": "false", "start_date": "1104537600", "end_date": "1484697600", "show_fatal": show_fatal, "show_severe": show_severe, "show_light": show_light, "approx": show_approx, "accurate": show_accurate, "show_markers": "1", "show_accidents": "1", "show_rsa": "0", "show_discussions": "1", "show_urban": "3", "show_intersection": "3", "show_lane": "3", "show_day": "7", "show_holiday": "0", "show_time": "24", "start_time": "25", "end_time": "25", "weather": "0", "road": "0", "separation": "0", "surface": "0", "acctype": "0", "controlmeasure": "0", "district": "0", "case_type": "0", } ) rv = app.get(url) assert rv.status_code == http_client.OK assert rv.headers["Content-Type"] == "application/json" resp = json.loads(rv.data.decode("utf-8")) marker_counter["markers"] += len(resp["markers"]) for marker in resp["markers"]: assert show_fatal or marker["accident_severity"] != 1 assert show_severe or marker["accident_severity"] != 2 assert show_light or marker["accident_severity"] != 3 assert show_accurate or marker["location_accuracy"] != 1 assert show_approx or marker["location_accuracy"] == 1 def assert_return_code_for_user_update(error_code: int, rv: Response, extra: str = None) -> None: assert rv.status_code == ERROR_TO_HTTP_CODE_DICT[error_code] assert rv.json == build_json_for_user_api_error(error_code, extra) def user_update_post_json(app: FlaskClient, json_data: typing.Optional[dict] = None) -> Response: return post_json(app, "/user/update", json_data) def post_json(app: FlaskClient, path: str, json_data: typing.Optional[dict] = None) -> Response: return app.post(path, json=json_data, follow_redirects=True, mimetype="application/json") def user_update_post(app: FlaskClient) -> Response: return app.post("/user/update", follow_redirects=True) def test_user_update_not_logged_in(app): rv = user_update_post(app) assert_return_code_for_user_update(Errors.BR_BAD_AUTH, rv) rv = app.get("/user/update", follow_redirects=True) assert rv.status_code == HTTPStatus.METHOD_NOT_ALLOWED def test_user_update_bad_json(app): with patch("flask_login.utils._get_user") as current_user: set_current_user_mock(current_user) rv = user_update_post(app) assert_return_code_for_user_update(Errors.BR_FIELD_MISSING, rv) rv = user_update_post_json(app) assert rv.status_code == HTTPStatus.BAD_REQUEST assert b"Failed to decode JSON object" in rv.data rv = user_update_post_json(app, json_data={}) assert_return_code_for_user_update(Errors.BR_FIELD_MISSING, rv) rv = user_update_post_json(app, json_data={"a": "a"}) assert_return_code_for_user_update(Errors.BR_FIELD_MISSING, rv) def test_user_update_names(app): with patch("flask_login.utils._get_user") as current_user: set_current_user_mock(current_user) rv = user_update_post_json(app, json_data={"first_name": "a"}) assert_return_code_for_user_update(Errors.BR_FIRST_NAME_OR_LAST_NAME_MISSING, rv) rv = user_update_post_json(app, json_data={"last_name": "a"}) assert_return_code_for_user_update(Errors.BR_FIRST_NAME_OR_LAST_NAME_MISSING, rv) def test_user_fail_on_email(app): with patch("flask_login.utils._get_user") as current_user: set_current_user_mock(current_user) with patch("anyway.views.user_system.api.get_current_user_email") as get_current_user_email: get_current_user_email.side_effect = lambda: None rv = user_update_post_json(app, json_data={"first_name": "a", "last_name": "a"}) assert_return_code_for_user_update(Errors.BR_NO_EMAIL, rv) rv = user_update_post_json( app, json_data={"first_name": "a", "last_name": "a", "email": "aaaa"} ) assert_return_code_for_user_update(Errors.BR_BAD_EMAIL, rv) def test_user_fail_on_phone(app): with patch("flask_login.utils._get_user") as current_user: set_current_user_mock(current_user) with patch("anyway.views.user_system.api.get_current_user_email") as get_current_user_email: get_current_user_email.side_effect = lambda: "aa@bb.com" rv = user_update_post_json( app, json_data={"first_name": "a", "last_name": "a", "phone": "1234567"} ) assert_return_code_for_user_update(Errors.BR_BAD_PHONE, rv) def test_user_update_success(app): with patch("flask_login.utils._get_user") as current_user: set_current_user_mock(current_user) with patch("anyway.views.user_system.api.get_current_user_email") as get_current_user_email: get_current_user_email.side_effect = lambda: None with patch("anyway.views.user_system.api.update_user_in_db"): rv = user_update_post_json( app, json_data={"first_name": "a", "last_name": "a", "email": "aa@gmail.com"} ) assert rv.status_code == HTTPStatus.OK get_current_user_email.side_effect = lambda: "aa@bb.com" rv = user_update_post_json( app, json_data={"first_name": "a", "last_name": "a", "phone": "0541234567"} ) assert rv.status_code == HTTPStatus.OK rv = user_update_post_json(app, json_data={"first_name": "a", "last_name": "a"}) assert rv.status_code == HTTPStatus.OK send_json = { "first_name": "a", "last_name": "a", "email": "aa@gmail.com", "phone": "0541234567", "user_type": "journalist", "user_url": "http:\\www.a.com", "user_desc": "a", } rv = user_update_post_json(app, json_data=send_json) assert rv.status_code == HTTPStatus.OK # Used in test_get_current_user USER_ID = 5 USER_EMAIL = "YossiCohen@gmail.com" USER_ACTIVE = True OAUTH_PROVIDER = "google" FIRST_NAME = "Yossi" LAST_NAME = "Cohen" USER_COMPLETED = True def test_get_current_user(app): rv = app.get("/user/info", follow_redirects=True) assert_return_code_for_user_update(Errors.BR_BAD_AUTH, rv) with patch("flask_login.utils._get_user") as current_user: set_current_user_mock(current_user) with patch("anyway.views.user_system.api.get_current_user") as get_current_user: get_mock_current_user(get_current_user) rv = app.get("/user/info", follow_redirects=True) assert rv.status_code == HTTPStatus.OK assert rv.json == { "id": USER_ID, "email": USER_EMAIL, "is_active": USER_ACTIVE, "oauth_provider": OAUTH_PROVIDER, "first_name": FIRST_NAME, "last_name": LAST_NAME, "is_user_completed_registration": USER_COMPLETED, "oauth_provider_user_name": None, "oauth_provider_user_picture_url": None, "phone": None, "user_desc": None, "user_register_date": None, "user_type": None, "user_url": None, "roles": [], } def get_mock_current_user(get_current_user: mock.MagicMock) -> mock.MagicMock: ret_obj = mock.MagicMock() ret_obj.serialize_exposed_to_user.side_effect = lambda: { "id": USER_ID, "user_register_date": None, "email": USER_EMAIL, "is_active": USER_ACTIVE, "oauth_provider": OAUTH_PROVIDER, "oauth_provider_user_name": None, "oauth_provider_user_picture_url": None, "first_name": FIRST_NAME, "last_name": LAST_NAME, "phone": None, "user_type": None, "user_url": None, "user_desc": None, "is_user_completed_registration": USER_COMPLETED, "roles": [], } ret_obj.id = USER_ID ret_obj.user_register_date = None ret_obj.email = USER_EMAIL ret_obj.is_active = USER_ACTIVE ret_obj.oauth_provider = OAUTH_PROVIDER ret_obj.oauth_provider_user_name = None ret_obj.oauth_provider_user_picture_url = None ret_obj.phone = None ret_obj.user_type = None ret_obj.user_url = None ret_obj.user_desc = None ret_obj.first_name = FIRST_NAME ret_obj.last_name = LAST_NAME ret_obj.is_user_completed_registration = USER_COMPLETED ret_obj.roles = [] get_current_user.side_effect = lambda: ret_obj return ret_obj def set_current_user_mock(current_user: mock.MagicMock) -> None: current_user.return_value = mock.MagicMock() current_user.return_value.is_anonymous = False current_user.return_value.id = USER_ID def test_user_remove_from_role(app): user_add_or_remove_role(app, "/user/remove_from_role") def test_user_add_to_role(app): user_add_or_remove_role(app, "/user/add_to_role") def user_add_or_remove_role(app: FlaskClient, path: str) -> None: rv = app.get(path, follow_redirects=True) assert rv.status_code == HTTPStatus.METHOD_NOT_ALLOWED with patch("flask_login.utils._get_user") as current_user: set_mock_and_test_perm(app, current_user, path) rv = post_json(app, path, json_data={"email": "a"}) assert_return_code_for_user_update(Errors.BR_ROLE_NAME_MISSING, rv) with patch("anyway.views.user_system.api.get_role_object") as get_role_object: get_role_object.return_value = mock.MagicMock() get_role_object.return_value.name = BE_CONST.Roles2Names.Admins.value rv = post_json( app, path, json_data={"role": BE_CONST.Roles2Names.Admins.value, "email": "a"} ) assert_return_code_for_user_update(Errors.BR_USER_NOT_FOUND, rv, extra="a") def set_mock_and_test_perm(app, current_user, path): set_current_user_mock(current_user) rv = app.post(path, follow_redirects=True) assert_return_code_for_user_update(Errors.BR_BAD_AUTH, rv) role = mock.MagicMock() role.name = BE_CONST.Roles2Names.Admins.value current_user.return_value.roles = [role] def test_is_a_valid_role_name(): bad_names = [ "בדיקה", "aa bbb", "$%@", "a" * 1024, "", ] good_names = [ "test", ] for url in bad_names: assert not is_a_valid_role_name(url) for url in good_names: assert is_a_valid_role_name(url) def test_user_change_user_active_mode(app: FlaskClient) -> None: path = "/user/change_user_active_mode" rv = app.get(path, follow_redirects=True) assert rv.status_code == HTTPStatus.METHOD_NOT_ALLOWED with patch("flask_login.utils._get_user") as current_user: set_mock_and_test_perm(app, current_user, path) rv = post_json(app, path, json_data={"email": "a"}) assert_return_code_for_user_update(Errors.BR_USER_NOT_FOUND, rv, extra="a") with patch("anyway.views.user_system.api.get_user_by_email") as get_user_by_email: get_user_by_email.side_effect = lambda db, email: mock.MagicMock() rv = post_json(app, path, json_data={"email": "a@b.com"}) assert_return_code_for_user_update(Errors.BR_NO_MODE, rv) rv = post_json(app, path, json_data={"email": "a@b.com", "mode": "true"}) assert_return_code_for_user_update(Errors.BR_BAD_MODE, rv) rv = post_json(app, path, json_data={"email": "a@b.com", "mode": 1}) assert_return_code_for_user_update(Errors.BR_BAD_MODE, rv) rv = post_json(app, path, json_data={"email": "a@b.com", "mode": False}) assert rv.status_code == HTTPStatus.OK def test_add_role(app): path = "/user/add_role" rv = app.get(path, follow_redirects=True) assert rv.status_code == HTTPStatus.METHOD_NOT_ALLOWED with patch("flask_login.utils._get_user") as current_user: set_mock_and_test_perm(app, current_user, path) rv = post_json(app, path, json_data={"email": "a"}) assert_return_code_for_user_update(Errors.BR_ROLE_NAME_MISSING, rv) rv = post_json(app, path, json_data={"description": ""}) assert_return_code_for_user_update(Errors.BR_ROLE_NAME_MISSING, rv) rv = post_json(app, path, json_data={"name": ""}) assert_return_code_for_user_update(Errors.BR_ROLE_NAME_MISSING, rv) rv = post_json(app, path, json_data={"name": "aa vv"}) assert_return_code_for_user_update(Errors.BR_BAD_ROLE_NAME, rv) rv = post_json(app, path, json_data={"name": "aa"}) assert_return_code_for_user_update(Errors.BR_ROLE_DESCRIPTION_MISSING, rv) rv = post_json(app, path, json_data={"name": "aa", "description": ""}) assert_return_code_for_user_update(Errors.BR_ROLE_DESCRIPTION_MISSING, rv)
36.489655
480
0.663202
3448af74c28a16ef2ae1cda2ad955290e200794d
1,302
asm
Assembly
sw/552tests/rand_simple/t_3_ld.asm
JPShen-UWM/ThreadKraken
849c510531f28e36d3469535737b2120bd774935
[ "MIT" ]
1
2022-02-15T16:03:25.000Z
2022-02-15T16:03:25.000Z
sw/552tests/rand_simple/t_3_ld.asm
JPShen-UWM/ThreadKraken
849c510531f28e36d3469535737b2120bd774935
[ "MIT" ]
null
null
null
sw/552tests/rand_simple/t_3_ld.asm
JPShen-UWM/ThreadKraken
849c510531f28e36d3469535737b2120bd774935
[ "MIT" ]
null
null
null
// seed 3 lbi r0, 93 // icount 0 slbi r0, 213 // icount 1 lbi r1, 113 // icount 2 slbi r1, 214 // icount 3 lbi r2, 229 // icount 4 slbi r2, 181 // icount 5 lbi r3, 119 // icount 6 slbi r3, 94 // icount 7 lbi r4, 64 // icount 8 slbi r4, 113 // icount 9 lbi r5, 226 // icount 10 slbi r5, 210 // icount 11 lbi r6, 39 // icount 12 slbi r6, 37 // icount 13 lbi r7, 81 // icount 14 slbi r7, 110 // icount 15 andni r0, r0, 1 // icount 16 ld r2, r0, 4 // icount 17 andni r3, r3, 1 // icount 18 ld r3, r3, 2 // icount 19 andni r5, r5, 1 // icount 20 ld r7, r5, 6 // icount 21 andni r4, r4, 1 // icount 22 ld r4, r4, 4 // icount 23 andni r0, r0, 1 // icount 24 ld r3, r0, 14 // icount 25 andni r7, r7, 1 // icount 26 ld r4, r7, 0 // icount 27 andni r3, r3, 1 // icount 28 ld r4, r3, 10 // icount 29 andni r6, r6, 1 // icount 30 ld r2, r6, 2 // icount 31 andni r1, r1, 1 // icount 32 ld r2, r1, 6 // icount 33 andni r6, r6, 1 // icount 34 ld r6, r6, 0 // icount 35 andni r6, r6, 1 // icount 36 ld r4, r6, 6 // icount 37 andni r2, r2, 1 // icount 38 ld r0, r2, 2 // icount 39 andni r5, r5, 1 // icount 40 ld r6, r5, 8 // icount 41 andni r0, r0, 1 // icount 42 ld r4, r0, 4 // icount 43 andni r4, r4, 1 // icount 44 ld r0, r4, 4 // icount 45 andni r3, r3, 1 // icount 46 ld r4, r3, 4 // icount 47 halt // icount 48
25.529412
28
0.610599
62a68635f3f137ac6f886193b428e22b36d620cc
539
swift
Swift
Sources/Apodini/Properties/ObservableObject.swift
ThePuscher/Apodini
5bfef2a784eab3928b4d1f5b7882c354cce4bb5c
[ "MIT" ]
null
null
null
Sources/Apodini/Properties/ObservableObject.swift
ThePuscher/Apodini
5bfef2a784eab3928b4d1f5b7882c354cce4bb5c
[ "MIT" ]
null
null
null
Sources/Apodini/Properties/ObservableObject.swift
ThePuscher/Apodini
5bfef2a784eab3928b4d1f5b7882c354cce4bb5c
[ "MIT" ]
null
null
null
/// An object that publishes changes of `@Published` properties. /// `ObservableObject`s are used with the property wrapper `@ObservedObject` inside of `Handler`s or `Job`s to re-evaluate them. /// /// Example of an `ObservableObject` with two `@Published` properties. /// ``` /// class Bird: ObservableObject { /// @Published var name: String /// @Published var age: Int /// /// init(name: String, age: Int) { /// self.name = name /// self.age = age /// } /// } /// ``` public protocol ObservableObject {}
31.705882
128
0.625232
90f33a5e5a3fa47821a6f5879048d3bd790c1895
2,729
swift
Swift
Example/WizardFlow/WizardViewController.swift
dmanuelcl/WizardFlow
fa6235a22a4ec583c5148168e1c16d0d457c79cb
[ "MIT" ]
null
null
null
Example/WizardFlow/WizardViewController.swift
dmanuelcl/WizardFlow
fa6235a22a4ec583c5148168e1c16d0d457c79cb
[ "MIT" ]
null
null
null
Example/WizardFlow/WizardViewController.swift
dmanuelcl/WizardFlow
fa6235a22a4ec583c5148168e1c16d0d457c79cb
[ "MIT" ]
null
null
null
// // WizardViewController.swift // WizardFlow_Example // // Created by Dani Manuel Céspedes Lara on 2/20/18. // Copyright © 2018 Dani Manuel Céspedes Lara. All rights reserved. // import UIKit import WizardFlow class WizardViewController: UIViewController { @IBOutlet weak var wizard: Wizard! var wizardSteps: [WizardStep] = [] var commonDelegate = CommonWizardDelegate() override func viewDidLoad() { super.viewDidLoad() self.setupWizardDataSource() self.wizard.dataSource = self self.wizard.delegate = self.commonDelegate } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) self.wizard.displaySteps() } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } func stepFromStoryboard(withColor color: UIColor, at index: Int) -> WizardStep{ let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main) let step = storyboard.instantiateViewController(withIdentifier: "StepViewController") as! StepViewController let view = step.view view?.backgroundColor = color step.stepIdentifier = String(index) step.label.text = "Step #\(index)" return step } func stepFromNib(withColor color: UIColor, at index: Int) -> WizardStep{ let stepNib = StepNib() stepNib.loadView() stepNib.view.backgroundColor = color stepNib.stepIdentifier = String(index) stepNib.label.text = "Step #\(index)" return stepNib } func setupWizardDataSource(){ let colors: [UIColor] = [.red, .black, .brown, .cyan, .green, .blue, .gray] for i in 0..<colors.count{ let index = i + 1 let color = colors[i] if index % 2 == 0{ self.wizardSteps.append(self.stepFromStoryboard(withColor: color, at: index)) }else{ self.wizardSteps.append(self.stepFromNib(withColor: color, at: index)) } } } @IBAction func handleNextStep(_ sender: AnyObject){ self.wizard.navigateToNextStep { print(#function, "navigation to next step did finish") } } @IBAction func handlePreviousStep(_ sender: AnyObject){ self.wizard.navigateToPreviousStep { print(#function, "navigation to previous step did finish") } } @IBAction func handleNavigateToLastStep(_ sender: AnyObject){ let step = self.wizardSteps.last! self.wizard.navigate(to: step, direction: .next) } } extension WizardViewController: BasicWizardDataSource{ }
29.989011
116
0.640161
830c413bf5f831b7ddea8b8a3084ec9f98134c57
1,954
sql
SQL
dog/nodejs/db.sql
chenjieaa/xl
05cadc27c67c5eeaa17bcc95e89dbef7c87ec3b8
[ "MIT" ]
null
null
null
dog/nodejs/db.sql
chenjieaa/xl
05cadc27c67c5eeaa17bcc95e89dbef7c87ec3b8
[ "MIT" ]
null
null
null
dog/nodejs/db.sql
chenjieaa/xl
05cadc27c67c5eeaa17bcc95e89dbef7c87ec3b8
[ "MIT" ]
null
null
null
USE xm; CREATE TABLE xz_news( id INT PRIMARY KEY AUTO_INCREMENT, title VARCHAR(128), shij VARCHAR(128), price VARCHAR(10), img_url VARCHAR(255) ); INSERT INTO xz_news VALUES(null,'医疗服务','60分钟','60元',"http://127.0.0.1:3000/img/dog.png"); INSERT INTO xz_news VALUES(null,'洗澡服务','60分钟','60元',"http://127.0.0.1:3000/img/dog.png"); INSERT INTO xz_news VALUES(null,'哈士奇','60分钟','60元',"http://127.0.0.1:3000/img/dog.png"); INSERT INTO xz_news VALUES(null,'医疗服务','60分钟','60元',"http://127.0.0.1:3000/img/dog.png"); INSERT INTO xz_news VALUES(null,'洗澡服务','60分钟','60元',"http://127.0.0.1:3000/img/dog.png"); CREATE TABLE xz_coment( id INT PRIMARY KEY AUTO_INCREMENT, content VARCHAR(140), ctime DATETIME, user_name VARCHAR(50), nid INT ); INSERT INTO xz_coment VALUES(null,"ha45ha",now(),'匿名',1); INSERT INTO xz_coment VALUES(null,"ha45ha",now(),'匿名',1); INSERT INTO xz_coment VALUES(null,"ha45ha",now(),'匿名',1); INSERT INTO xz_coment VALUES(null,"ha45ha",now(),'匿名',1); INSERT INTO xz_coment VALUES(null,"ha45ha",now(),'匿名',1); INSERT INTO xz_coment VALUES(null,"ha45ha",now(),'匿名',1); INSERT INTO xz_coment VALUES(null,"ha45ha",now(),'匿名',1); INSERT INTO xz_coment VALUES(null,"ha45ha",now(),'匿名',1); INSERT INTO xz_coment VALUES(null,"ha45ha",now(),'匿名',1); INSERT INTO xz_coment VALUES(null,"ha45ha",now(),'匿名',1); INSERT INTO xz_coment VALUES(null,"ha45ha",now(),'匿名',1); INSERT INTO xz_coment VALUES(null,"ha45ha",now(),'匿名',1); INSERT INTO xz_coment VALUES(null,"ha45ha",now(),'匿名',1); INSERT INTO xz_coment VALUES(null,"ha45ha",now(),'匿名',1); INSERT INTO xz_coment VALUES(null,"ha45ha",now(),'匿名',1); INSERT INTO xz_coment VALUES(null,"ha45ha",now(),'匿名',1); CREATE TABLE xz_user2( id INT PRIMARY KEY AUTO_INCREMENT, uname VARCHAR(25), upwd VARCHAR(32) ); INSERT INTO xz_user2 VALUES(null,1355658922,md5('123')); INSERT INTO xz_user2 VALUES(null,12456,md5('123')); INSERT INTO xz_user2 VALUES(null,561684,md5('123'));
39.877551
89
0.702661
53bd4118b16ad89bdf5a68cecc44f9ea28a6a55f
1,727
java
Java
modules/kernel/src/org/apache/axis2/transport/mail/MailWorkerManager.java
ASU/rampart
9a36b6b4102fd39ff62bbd65d8ce0c2c42502e60
[ "Apache-2.0", "Plexus" ]
null
null
null
modules/kernel/src/org/apache/axis2/transport/mail/MailWorkerManager.java
ASU/rampart
9a36b6b4102fd39ff62bbd65d8ce0c2c42502e60
[ "Apache-2.0", "Plexus" ]
null
null
null
modules/kernel/src/org/apache/axis2/transport/mail/MailWorkerManager.java
ASU/rampart
9a36b6b4102fd39ff62bbd65d8ce0c2c42502e60
[ "Apache-2.0", "Plexus" ]
null
null
null
/* * Copyright 2004,2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.axis2.transport.mail; import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService; import edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue; import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; /* * */ public class MailWorkerManager { private LinkedBlockingQueue messageQueue; private ExecutorService workerPool; private int poolSize; private ConfigurationContext configurationContext; public MailWorkerManager() { } public MailWorkerManager(ConfigurationContext configurationContext, LinkedBlockingQueue messageQueue, ExecutorService workerPool, int poolSize) { this.messageQueue = messageQueue; this.workerPool = workerPool; this.poolSize = poolSize; this.configurationContext = configurationContext; } public void start() throws AxisFault { for (int i = 0; i < poolSize; i++) { workerPool.execute(new MailWorker(configurationContext, messageQueue)); } } }
34.54
90
0.71685
2d821db66b6b69624ac30ce41b31e663f97319aa
282
html
HTML
manuscript/page-116/body.html
marvindanig/les-fleurs-du-mal
047dd3ce740988ffe3d172b8890b79046590d9d4
[ "BlueOak-1.0.0", "MIT" ]
null
null
null
manuscript/page-116/body.html
marvindanig/les-fleurs-du-mal
047dd3ce740988ffe3d172b8890b79046590d9d4
[ "BlueOak-1.0.0", "MIT" ]
null
null
null
manuscript/page-116/body.html
marvindanig/les-fleurs-du-mal
047dd3ce740988ffe3d172b8890b79046590d9d4
[ "BlueOak-1.0.0", "MIT" ]
null
null
null
<div class="leaf "><div class="inner justify"><pre class="no-indent "> Elsewhere, far away ... too late, perhaps never more, For I know not whither you fly, nor you, where I go, O soul that I would have loved, and _that_ you know!</code></pre><hr class="section"></div> </div>
56.4
98
0.680851
c1980de2cf1da6ed76a3fd80ecaafe319e85a116
1,805
rs
Rust
src/matrices/strings/iteration.rs
wasml/linalg
d897cf723108e6bd0c2ded0aca3aa61938f0861d
[ "Apache-2.0" ]
1
2022-02-15T10:56:11.000Z
2022-02-15T10:56:11.000Z
src/matrices/strings/iteration.rs
ml-wasm/linalg
d897cf723108e6bd0c2ded0aca3aa61938f0861d
[ "Apache-2.0" ]
null
null
null
src/matrices/strings/iteration.rs
ml-wasm/linalg
d897cf723108e6bd0c2ded0aca3aa61938f0861d
[ "Apache-2.0" ]
2
2021-06-18T09:56:58.000Z
2021-06-18T10:56:16.000Z
use crate::vectors::strings::StringsVector; use super::StringsMatrix; use js_sys; use ndarray::Axis; use wasm_bindgen::prelude::*; #[wasm_bindgen] impl StringsMatrix { pub fn map(&self, js_func: js_sys::Function) -> Self { Self { data: self.data.map(|x| { js_func .call1(&JsValue::NULL, &JsValue::from(x.clone())) .unwrap() .as_string() .unwrap() }), } } pub fn transform(&mut self, js_func: js_sys::Function) { self.data.map_inplace(|x| { *x = js_func .call1(&JsValue::NULL, &JsValue::from(x.clone())) .unwrap() .as_string() .unwrap() }); } #[wasm_bindgen(js_name = forEach)] pub fn for_each(&self, js_func: js_sys::Function) { self.data.for_each(|x| { js_func .call1(&JsValue::NULL, &JsValue::from(x.clone())) .unwrap(); }); } #[wasm_bindgen(js_name = mapRows)] pub fn map_rows(&self, js_func: js_sys::Function) { self.data.map_axis(Axis(1), |x| { js_func .call1(&JsValue::NULL, &JsValue::from( StringsVector { data: x.to_owned() } )) .unwrap() }); } #[wasm_bindgen(js_name = mapCols)] pub fn map_cols(&self, js_func: js_sys::Function) { self.data.map_axis(Axis(0), |x| { js_func .call1(&JsValue::NULL, &JsValue::from( StringsVector { data: x.to_owned() } )) .unwrap() }); } }
26.940299
69
0.444875
90b6a578e249041b6ee49792eb49e1fbd3f38b4f
3,339
swift
Swift
Codemine/Extensions/UIImage+Utilities.swift
FraDeliro/Codemine
eb6e69ec55919c3bbf86f51a678882d49eb91c51
[ "MIT" ]
null
null
null
Codemine/Extensions/UIImage+Utilities.swift
FraDeliro/Codemine
eb6e69ec55919c3bbf86f51a678882d49eb91c51
[ "MIT" ]
null
null
null
Codemine/Extensions/UIImage+Utilities.swift
FraDeliro/Codemine
eb6e69ec55919c3bbf86f51a678882d49eb91c51
[ "MIT" ]
1
2020-06-15T18:47:42.000Z
2020-06-15T18:47:42.000Z
// // UIImage+Utilities.swift // Codemine // // Created by Marius Constantinescu on 18/02/16. // Copyright © 2016 Nodes. All rights reserved. // import Foundation import UIKit public extension UIImage { /** Create an `UIImage` with specified background color, size and corner radius. Parameter `color` is used for the background color, parameter `size` to set the size of the the holder rectangle, parameter `cornerRadius` for setting up the rounded corners. - Parameters: - color: The background color. - size: The size of the image. - cornerRadius: The corner radius. - Returns: A 'UIImage' with the specified color, size and corner radius. */ convenience init(color: UIColor, size: CGSize, cornerRadius: CGFloat) { self.init() /// The base rectangle of the image. let rect = CGRect(x: 0, y: 0, width: size.width, height: size.height) UIGraphicsBeginImageContext(rect.size) /// The graphics context of the image. let context = UIGraphicsGetCurrentContext() context?.setFillColor(color.cgColor) context?.fill(rect) /// Image that will be retured. var image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() UIGraphicsBeginImageContext(size) UIBezierPath(roundedRect: rect, cornerRadius:cornerRadius).addClip() image?.draw(in: rect) image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() } /** Embed an icon/image on top of a background image. `image` will be the background and `icon` is the image that will be on top of `image`. The `UIImage` that is set with the parameter `icon` will be centered on `image`. - Parameters: - icon: The embedded image that will be on top. - image: The background image. - Returns: The combined image as `UIImage`. */ public class func embed(icon: UIImage, inImage image: UIImage ) -> UIImage? { let newSize = CGSize(width: image.size.width, height: image.size.height) UIGraphicsBeginImageContextWithOptions(newSize, false, 0.0) image.draw(in: CGRect(x: 0,y: 0,width: newSize.width,height: newSize.height)) // Center icon icon.draw(in: CGRect(x: image.size.width/2 - icon.size.width/2, y: image.size.height/2 - icon.size.height/2, width: icon.size.width, height: icon.size.height), blendMode:CGBlendMode.normal, alpha:1.0) let newImage = UIGraphicsGetImageFromCurrentImageContext() return newImage } /** Corrects the rotation/orientation of an image. When an image inadvertently was taken with the wrong orientation, this function will correct the rotation/orientation again. - Returns: The orientation corrected image as an `UIImage`. */ public var rotationCorrected: UIImage? { UIGraphicsBeginImageContextWithOptions(self.size, false, self.scale) self.draw(in: CGRect(origin: CGPoint.zero, size: self.size)) let normalizedImage = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() return normalizedImage } }
35.521277
208
0.653789
3307dce436fdb7329f82703b2fd7a200624c248e
11,934
py
Python
apps/steam.py
nestorcalvo/Buencafe_dashboard
e2fbe5dfc5b679ab4d27acea2a23e3dfdeb2699c
[ "MIT" ]
null
null
null
apps/steam.py
nestorcalvo/Buencafe_dashboard
e2fbe5dfc5b679ab4d27acea2a23e3dfdeb2699c
[ "MIT" ]
null
null
null
apps/steam.py
nestorcalvo/Buencafe_dashboard
e2fbe5dfc5b679ab4d27acea2a23e3dfdeb2699c
[ "MIT" ]
null
null
null
import dash import dash_core_components as dcc import dash_bootstrap_components as dbc import dash_html_components as html import pandas as pd import plotly.express as px import plotly.graph_objs as go from datetime import date import dash_loading_spinners as dls from dash.dependencies import Input, Output, ClientsideFunction, State from app import app import requests features = ["Screw Speed", "Gas Flow Rate", "Steam Pressure", "Oven-Home Temperature", "Water Temperature", "Oxygen_pct", "Oven-Home Pressure", "Combustion Air Pressure", "Temperature before prear", "Temperature after prear", "Burner Position", "Burner_pct", "Borra Flow Rate_kgh", "Cisco Flow Rate_kgh"] cardtab_1 = dbc.Card([ html.Div( id='output-container-date-picker-range', className="month-container" ), dls.Hash( dcc.Graph(id="graph-steam", className = "graph-card"), size = 160, speed_multiplier = 0.8, debounce = 200 ) ]) cardtab_2 = dbc.Card([ html.Div( id='output-container-date-picker-range', className="month-container" ), dls.Hash( dcc.Graph(id="graph-distribution", className = "graph-card"), size = 160, speed_multiplier = 0.8, debounce = 200 ) ]) card_3 = dbc.Card( [ dbc.Col([ dbc.Col([ html.P( "Select date range that you want to see:" ), dcc.DatePickerRange( id='my-date-picker-range', min_date_allowed=date(2020, 10, 1), max_date_allowed=date(2021, 6, 30), initial_visible_month=date(2020, 10, 1), end_date=date(2021, 6, 30), clearable=True, with_portal=True, month_format="MMMM, YYYY", number_of_months_shown=3 ) ]), html.Hr(), dbc.Col([ html.P( "Select the data frequency:" ), dbc.RadioItems( id='frequency-radioitems', labelStyle={"display": "inline-block"}, options= [ {"label": "Daily", "value": "data_daily"}, {"label": "Hourly", "value": "data_hourly"} ], value= "data_daily", style= {"color": "black"} ) ]) ]) ]) card_4 = dbc.Card([ dbc.Col([ dbc.FormGroup([ dbc.Label("Y - Axis"), dcc.Dropdown( id="y-variable", options=[{ "label": col, "value": col } for col in features], value="Gas Flow Rate", ), ]), html.H6("Efficiency Range"), dcc.RangeSlider( id='slider-efficiency', min=0, max=1.00, step=0.01, value=[0, 1.00] ), html.P(id='range-efficiency') ]) ]) card_5 = dbc.Card([ html.Div( id='output-container-date-picker-range', className="month-container" ), dls.Hash( dcc.Graph(id="graph-comparison", className = "graph-card"), size = 160, speed_multiplier = 0.8, debounce = 200 ) ]) layout= [ html.Div([ # html.Img( # src = "/assets/images/C1_icon_1.png", # className = "corr-icon" # ), html.Img( src = "/assets/images/Buencafe-logo.png", className = "corr-icon" ), html.H2( "Steam Analytics", className = "content-title" ), html.Div(children=[ html.Div([ # dbc.Row([ # dbc.Col( # dbc.Tabs([ # dbc.Tab(cardtab_1, label="Time series"), # dbc.Tab(cardtab_2, label="Distribution"), # ], # id="card-tabs", # card=True, # active_tab="tab-1", # ), # width=9 # ), # dbc.Col( # card_3, width=3 # ) # ]), dbc.Tabs([ dbc.Tab(cardtab_1, label="Time series"), dbc.Tab(cardtab_2, label="Distribution"), ], id="card-tabs", card=True, active_tab="tab-1", ), card_3, ], className = "graph_col_1"), html.Div(children =[ # dbc.Row([ # dbc.Col( # card_4, width=3 # ), # dbc.Col( # card_5, width=9 # ) # ]), card_4, card_5 ], className = "data_col_2") ], className = "wrapper__steam-data") ],className = "wrapper__steam"), ] @app.callback( Output('graph-steam','figure'), [Input('my-date-picker-range', 'start_date'), Input('my-date-picker-range', 'end_date'), Input('frequency-radioitems', 'value')] ) def update_figure(start_date, end_date, value_radio): # if value_radio == "data_daily": # data = pd.read_csv("data/data_interpolate_daily.csv", parse_dates=["Time"]) # data.set_index(["Time"], inplace=True) # elif value_radio == "data_hourly": # data = pd.read_csv("data/data_interpolate_hourly.csv", parse_dates=["Time"]) # data.set_index(["Time"], inplace=True) try: if value_radio == "data_daily": query = "SELECT * FROM daily" payload = { "query": query } petition = requests.post('https://k8nmzco6tb.execute-api.us-east-1.amazonaws.com/dev/data',payload) test_var = petition.json()['body'] data = pd.DataFrame(test_var) data['Time'] = pd.to_datetime(data['Time']).dt.date.astype("datetime64[ns]") # print("Llegada ", data2['Time'].value_counts()) data.set_index(["Time"], inplace=True) elif value_radio == "data_hourly": query = "SELECT * FROM hourly" payload = { "query": query } petition = requests.post('https://k8nmzco6tb.execute-api.us-east-1.amazonaws.com/dev/data',payload) test_var = petition.json()['body'] data = pd.DataFrame(test_var) data['Time'] = pd.to_datetime(data['Time']) data.set_index(["Time"], inplace=True) fig = go.Figure() fig.add_trace(go.Scatter( x = data.loc[start_date: end_date].index, y = data.loc[start_date: end_date]["Steam Flow Rate"], mode = "lines", name = "Steam" )) fig.update_layout(title = 'Steam Generation', xaxis_title='Date', yaxis_title='Steam (Kg/hour)', transition_duration=500, paper_bgcolor='rgba(0,0,0,0)', plot_bgcolor='rgba(0,0,0,0)') return fig except: fig = go.Figure() fig.update_layout(title = 'Steam Generation', xaxis_title='Date', yaxis_title='Steam (Kg/hour)', transition_duration=500, paper_bgcolor='rgba(0,0,0,0)', plot_bgcolor='rgba(0,0,0,0)') return fig @app.callback( Output('graph-distribution','figure'), [Input('my-date-picker-range', 'start_date'), Input('my-date-picker-range', 'end_date')] ) def update_figure2(start_date, end_date): # df = pd.read_csv("data/data_interpolate_hourly.csv", parse_dates=["Time"]) # df.set_index(["Time"], inplace=True) try: query = "SELECT * FROM daily" payload = { "query": query } petition = requests.post('https://k8nmzco6tb.execute-api.us-east-1.amazonaws.com/dev/data',payload) test_var = petition.json()['body'] df = pd.DataFrame(test_var) df['Time'] = pd.to_datetime(df['Time']).dt.date.astype("datetime64[ns]") # print("Llegada ", data2['Time'].value_counts()) df.set_index(["Time"], inplace=True) # df = pd.read_csv("data/data_interpolate_hourly.csv", parse_dates=["Time"]) # df.set_index(["Time"], inplace=True) fig = px.histogram(df.loc[start_date: end_date], x="Steam Flow Rate", nbins=100) fig.update_layout(title = 'Steam Flow Rate Distribution', xaxis_title='Steam (Kg/hour)', yaxis_title='Count', transition_duration=500, paper_bgcolor='rgba(0,0,0,0)', plot_bgcolor='rgba(0,0,0,0)') return fig except: fig = px.histogram() fig.update_layout(title = 'Steam Flow Rate Distribution', xaxis_title='Steam (Kg/hour)', yaxis_title='Count', transition_duration=500, paper_bgcolor='rgba(0,0,0,0)', plot_bgcolor='rgba(0,0,0,0)') return fig @app.callback( [Output("graph-comparison", "figure"), Output("range-efficiency", "children")], [Input("y-variable", "value"), Input("slider-efficiency", "value"),] ) def update_figure3(feature, efficiency): # df2 = pd.read_csv("data/data_interpolate_hourly.csv", parse_dates=["Time"]) # df2.set_index(["Time"], inplace=True) try: query = "SELECT * FROM hourly" payload = { "query": query } petition = requests.post('https://k8nmzco6tb.execute-api.us-east-1.amazonaws.com/dev/data',payload) test_var = petition.json()['body'] df2 = pd.DataFrame(test_var) df2['Time'] = pd.to_datetime(df2['Time']).dt.date.astype("datetime64[ns]") # print("Llegada ", data2['Time'].value_counts()) df2.set_index(["Time"], inplace=True) fig = px.scatter( x = df2[(df2['Efficiency'] < efficiency[1]) & (df2['Efficiency'] > efficiency[0])]["Steam Flow Rate"], y = df2[(df2['Efficiency'] < efficiency[1]) & (df2['Efficiency'] > efficiency[0])][feature] ) # fig.layout.plot_bgcolor = '#fff' # fig.layout.paper_bgcolor = '#fff' fig.update_layout(title = 'Steam Flow Rate Comparison', xaxis_title= 'Steam (Kg/hour)', yaxis_title= feature, transition_duration= 500, paper_bgcolor='rgba(0,0,0,0)', plot_bgcolor='rgba(0,0,0,0)') range_efficiency = str(efficiency[0]) + " - " + str(efficiency[1]) return fig, range_efficiency except: fig = px.scatter() fig.update_layout(title = 'Steam Flow Rate Comparison', xaxis_title= 'Steam (Kg/hour)', yaxis_title= feature, transition_duration= 500, paper_bgcolor='rgba(0,0,0,0)', plot_bgcolor='rgba(0,0,0,0)') range_efficiency = str(efficiency[0]) + " - " + str(efficiency[1]) return fig, range_efficiency
35.730539
114
0.483576
d0c5684309c35934e2c9f16c14d27f526eb6995f
699
kt
Kotlin
web/src/main/kotlin/com/zeongit/web/core/communal/UserInfoVoAbstract.kt
JunJieFu/beauty
695043ba1e5f4a7a7ad662817de77758c97f408e
[ "MIT" ]
1
2020-11-20T15:07:08.000Z
2020-11-20T15:07:08.000Z
web/src/main/kotlin/com/zeongit/web/core/communal/UserInfoVoAbstract.kt
JunJieFu/zeongit-beauty
695043ba1e5f4a7a7ad662817de77758c97f408e
[ "MIT" ]
1
2020-07-26T03:20:21.000Z
2020-07-26T03:20:21.000Z
web/src/main/kotlin/com/zeongit/web/core/communal/UserInfoVoAbstract.kt
JunJieFu/beauty
695043ba1e5f4a7a7ad662817de77758c97f408e
[ "MIT" ]
2
2021-03-08T09:13:07.000Z
2021-07-18T12:15:34.000Z
package com.zeongit.web.core.communal import com.zeongit.share.database.account.entity.UserInfo import com.zeongit.web.service.FollowService import com.zeongit.web.service.UserInfoService import com.zeongit.web.vo.UserInfoVo abstract class UserInfoVoAbstract { abstract val userInfoService: UserInfoService abstract val followService: FollowService fun getUserVo(targetId: Int, userId: Int? = null): UserInfoVo { return getUserVo(userInfoService.get(targetId), userId) } fun getUserVo(user: UserInfo, userId: Int? = null): UserInfoVo { val infoVo = UserInfoVo(user) infoVo.focus = followService.exists(userId, user.id!!) return infoVo } }
31.772727
68
0.742489
d0f0fc56dc70eced83212a07c464ea8dd756ab42
179
css
CSS
src/components/Search/SearchAutoComplete/styles.css
FledgeXu/matters-web
c36995426e864101dd56b653150d08389f26c605
[ "Apache-2.0" ]
47
2020-09-23T13:27:06.000Z
2022-02-23T16:18:38.000Z
src/components/Search/SearchAutoComplete/styles.css
FledgeXu/matters-web
c36995426e864101dd56b653150d08389f26c605
[ "Apache-2.0" ]
492
2020-09-23T10:55:47.000Z
2022-03-29T17:29:27.000Z
src/components/Search/SearchAutoComplete/styles.css
FledgeXu/matters-web
c36995426e864101dd56b653150d08389f26c605
[ "Apache-2.0" ]
18
2020-09-26T14:28:52.000Z
2022-02-16T10:37:34.000Z
.key { @mixin line-clamp; font-size: var(--font-size-sm); &.highlight { color: var(--color-matters-green); } &.inPage { font-size: var(--font-size-md); } }
12.785714
38
0.553073
2921605405b3945fb53689ec7975f3876770448c
48
py
Python
safe/src/ManSite_vseukr/python/scripts/script4.py
Valentyn-coder/Manproject
e2f73fa82f3878ed424e603e0a859969ffa1c308
[ "MIT" ]
null
null
null
safe/src/ManSite_vseukr/python/scripts/script4.py
Valentyn-coder/Manproject
e2f73fa82f3878ed424e603e0a859969ffa1c308
[ "MIT" ]
null
null
null
safe/src/ManSite_vseukr/python/scripts/script4.py
Valentyn-coder/Manproject
e2f73fa82f3878ed424e603e0a859969ffa1c308
[ "MIT" ]
null
null
null
import sys print(str(sys.argv[1])[::3], end='')
24
36
0.604167
f4a35eabba5d93eb78f9d13a784dba20e864db98
7,709
kt
Kotlin
bukkit/rpk-moderation-bukkit/src/main/kotlin/com/rpkit/moderation/bukkit/RPKModerationBukkit.kt
TearsOfKhyber/RPKit
f2196a76e0822b2c60e4a551de317ed717bbdc7e
[ "Apache-2.0" ]
null
null
null
bukkit/rpk-moderation-bukkit/src/main/kotlin/com/rpkit/moderation/bukkit/RPKModerationBukkit.kt
TearsOfKhyber/RPKit
f2196a76e0822b2c60e4a551de317ed717bbdc7e
[ "Apache-2.0" ]
null
null
null
bukkit/rpk-moderation-bukkit/src/main/kotlin/com/rpkit/moderation/bukkit/RPKModerationBukkit.kt
TearsOfKhyber/RPKit
f2196a76e0822b2c60e4a551de317ed717bbdc7e
[ "Apache-2.0" ]
1
2020-09-04T10:25:47.000Z
2020-09-04T10:25:47.000Z
/* * Copyright 2020 Ren Binden * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.rpkit.moderation.bukkit import com.rpkit.core.bukkit.plugin.RPKBukkitPlugin import com.rpkit.core.database.Database import com.rpkit.moderation.bukkit.command.amivanished.AmIVanishedCommand import com.rpkit.moderation.bukkit.command.onlinestaff.OnlineStaffCommand import com.rpkit.moderation.bukkit.command.ticket.TicketCommand import com.rpkit.moderation.bukkit.command.vanish.UnvanishCommand import com.rpkit.moderation.bukkit.command.vanish.VanishCommand import com.rpkit.moderation.bukkit.command.warn.WarningCommand import com.rpkit.moderation.bukkit.command.warn.WarningCreateCommand import com.rpkit.moderation.bukkit.command.warn.WarningRemoveCommand import com.rpkit.moderation.bukkit.database.table.RPKTicketTable import com.rpkit.moderation.bukkit.database.table.RPKVanishStateTable import com.rpkit.moderation.bukkit.database.table.RPKWarningTable import com.rpkit.moderation.bukkit.listener.PlayerJoinListener import com.rpkit.moderation.bukkit.ticket.RPKTicketProviderImpl import com.rpkit.moderation.bukkit.vanish.RPKVanishProviderImpl import com.rpkit.moderation.bukkit.warning.RPKWarningProviderImpl import org.bstats.bukkit.Metrics class RPKModerationBukkit: RPKBukkitPlugin() { override fun onEnable() { Metrics(this, 4403) serviceProviders = arrayOf( RPKTicketProviderImpl(this), RPKVanishProviderImpl(this), RPKWarningProviderImpl(this) ) } override fun registerCommands() { getCommand("amivanished")?.setExecutor(AmIVanishedCommand(this)) getCommand("onlinestaff")?.setExecutor(OnlineStaffCommand(this)) getCommand("ticket")?.setExecutor(TicketCommand(this)) getCommand("warning")?.setExecutor(WarningCommand(this)) getCommand("warn")?.setExecutor(WarningCreateCommand(this)) getCommand("unwarn")?.setExecutor(WarningRemoveCommand(this)) getCommand("vanish")?.setExecutor(VanishCommand(this)) getCommand("unvanish")?.setExecutor(UnvanishCommand(this)) } override fun registerListeners() { registerListeners( PlayerJoinListener(this) ) } override fun setDefaultMessages() { messages.setDefault("not-from-console", "&cYou must be a player to perform that command.") messages.setDefault("no-minecraft-profile", "&cA Minecraft profile has not been created for you, or was unable to be retrieved. Please try relogging, and contact the server owner if this error persists.") messages.setDefault("no-profile", "&cYour Minecraft profile is currently not linked to a profile. Please link it.") messages.setDefault("amivanished-vanished", "&fYou are currently vanished.") messages.setDefault("amivanished-unvanished", "&fYou are currently &cnot &avanished.") messages.setDefault("online-staff-title", "&fOnline staff: ") messages.setDefault("online-staff-item", "&7 - &f\$name") messages.setDefault("ticket-usage", "&cUsage: /ticket [close|create|list|teleport]") messages.setDefault("ticket-close-usage", "&cUsage: /ticket close [id]") messages.setDefault("ticket-close-valid", "&aTicket closed.") messages.setDefault("ticket-close-invalid-id", "&cPlease provide a valid ticket ID.") messages.setDefault("ticket-close-invalid-ticket", "&cThere is no ticket with that ID.") messages.setDefault("ticket-create-usage", "&cUsage: /ticket create [reason]") messages.setDefault("ticket-create-valid", "&aTicket created: #\$id - \$reason") messages.setDefault("ticket-list-usage", "&cUsage: /ticket list [open|closed]") messages.setDefault("ticket-list-title", "&fTickets:") messages.setDefault("ticket-list-item", "&7#\$id - &f\$reason (\$issuer, \$open-date)") messages.setDefault("ticket-teleport-usage", "&cUsage: /ticket teleport [id]") messages.setDefault("ticket-teleport-invalid-ticket", "&cThere is no ticket with that ID.") messages.setDefault("ticket-teleport-invalid-location", "&cThat ticket has no location.") messages.setDefault("ticket-teleport-valid", "&aTeleported to ticket.") messages.setDefault("vanish-invisible", "&aYou are currently invisible.") messages.setDefault("unvanish-valid", "&aUnvanished.") messages.setDefault("vanish-valid", "&aVanished.") messages.setDefault("warning-usage", "&cUsage: /warning [create|delete|list]") messages.setDefault("warning-create-usage", "&cUsage: /warning create [player] [reason]") messages.setDefault("warning-create-invalid-target", "&cThere is no player by that name online.") messages.setDefault("warning-create-valid", "&aWarning issued to \$profile for \$reason") messages.setDefault("warning-received", "&cYou have received a warning for \$reason at \$time. You have \$index warnings.") messages.setDefault("warning-list-title", "&fWarnings:") messages.setDefault("warning-list-item", "&7\$index &f\$reason &7\$time") messages.setDefault("warning-remove-usage", "&cUsage: /warning remove [player] [index]") messages.setDefault("warning-remove-invalid-target", "&cThere is no player by that name online.") messages.setDefault("warning-remove-invalid-index", "&cYou must specify a valid warning index.") messages.setDefault("warning-remove-valid", "&aWarning removed.") messages.setDefault("no-permission-amivanished", "&cYou do not have permission to check if you are vanished.") messages.setDefault("no-permission-ticket-close", "&cYou do not have permission to close tickets.") messages.setDefault("no-permission-ticket-create", "&cYou do not have permission to create tickets.") messages.setDefault("no-permission-ticket-list", "&cYou do not have permission to list tickets.") messages.setDefault("no-permission-ticket-list-closed", "&cYou do not have permission to list closed tickets.") messages.setDefault("no-permission-ticket-list-open", "&cYou do not have permission to list open tickets.") messages.setDefault("no-permission-ticket-teleport", "&cYou do not have permission to teleport to tickets.") messages.setDefault("no-permission-unvanish", "&cYou do not have permission to unvanish.") messages.setDefault("no-permission-vanish", "&cYou do not have permission to vanish.") messages.setDefault("no-permission-warning", "&cYou do not have permission to use warnings.") messages.setDefault("no-permission-warning-create", "&cYou do not have permission to issue warnings.") messages.setDefault("no-permission-warning-list", "&cYou do not have permission to list your warnings.") messages.setDefault("no-permission-warning-remove", "&cYou do not have permission to remove warnings.") } override fun createTables(database: Database) { database.addTable(RPKTicketTable(database, this)) database.addTable(RPKVanishStateTable(database, this)) database.addTable(RPKWarningTable(database, this)) } }
62.169355
212
0.72344
516fef3560082ee1022f05f4323fc62890cc4623
22
kt
Kotlin
idea/testData/refactoring/inline/inlineVariableOrProperty/property/multiplePackages.1.kt
qussarah/declare
c83b764c7394efa3364915d973ae79c4ebed2437
[ "Apache-2.0" ]
337
2020-05-14T00:40:10.000Z
2022-02-16T23:39:07.000Z
idea/testData/refactoring/inline/inlineVariableOrProperty/property/multiplePackages.1.kt
qussarah/declare
c83b764c7394efa3364915d973ae79c4ebed2437
[ "Apache-2.0" ]
92
2020-06-10T23:17:42.000Z
2020-09-25T10:50:13.000Z
idea/testData/refactoring/inline/inlineVariableOrProperty/property/multiplePackages.1.kt
qussarah/declare
c83b764c7394efa3364915d973ae79c4ebed2437
[ "Apache-2.0" ]
54
2016-02-29T16:27:38.000Z
2020-12-26T15:02:23.000Z
package bar val x = 1
7.333333
11
0.681818
ad0935e067f24874c9118e6cb7e79205ec466d49
1,140
sql
SQL
Test/Konfidence.TestClasses/Generated.Sql/Test3_RequiredField.sql
a3helmich/Konfidence.BaseClasses
f1545d691917cbd7736fc53114bbc8075fa7e417
[ "MIT" ]
null
null
null
Test/Konfidence.TestClasses/Generated.Sql/Test3_RequiredField.sql
a3helmich/Konfidence.BaseClasses
f1545d691917cbd7736fc53114bbc8075fa7e417
[ "MIT" ]
23
2021-05-09T10:45:58.000Z
2022-02-17T03:09:46.000Z
Test/Konfidence.TestClasses/Generated.Sql/Test3_RequiredField.sql
a3helmich/Konfidence.BaseClasses
f1545d691917cbd7736fc53114bbc8075fa7e417
[ "MIT" ]
null
null
null
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO if not exists (SELECT * FROM [sys].[columns] WHERE object_id = OBJECT_ID(N'[dbo].[Test3]') AND name = 'SysInsertTime') begin ALTER TABLE [dbo].[Test3] ADD SysInsertTime datetime NOT NULL CONSTRAINT DF_Test3_SysInsertTime DEFAULT (getdate()) end GO if not exists (SELECT * FROM [sys].[columns] WHERE object_id = OBJECT_ID(N'[dbo].[Test3]') AND name = 'SysUpdateTime') begin ALTER TABLE [dbo].[Test3] ADD SysUpdateTime datetime NOT NULL CONSTRAINT DF_Test3_SysUpdateTime DEFAULT (getdate()) end GO if not exists (SELECT * FROM [sys].[columns] WHERE object_id = OBJECT_ID(N'[dbo].[Test3]') AND name = 'SysLock') begin ALTER TABLE [dbo].[Test3] ADD SysLock varchar(75) NULL end GO if exists (SELECT * FROM [sys].[triggers] WHERE object_id = OBJECT_ID(N'[dbo].[Test3_Update_SysUpdateTime]')) begin DROP TRIGGER [dbo].[Test3_Update_SysUpdateTime] end GO CREATE TRIGGER [dbo].[Test3_Update_SysUpdateTime] ON [dbo].[Test3] FOR UPDATE AS begin UPDATE [Test3] SET [SysUpdateTime] = getdate() FROM inserted i WHERE i.[Id] = [Test3].[Id] end
27.804878
119
0.710526
621913d5b931bc31cfc4aa87e520ea4c20d69d0b
2,480
rs
Rust
runng/src/listener.rs
jeikabu/runng
b0a3a285bab9535ae6568c4dc4cac25a75b99dbe
[ "MIT" ]
24
2018-12-06T06:14:23.000Z
2021-01-11T14:18:25.000Z
runng/src/listener.rs
jeikabu/runng
b0a3a285bab9535ae6568c4dc4cac25a75b99dbe
[ "MIT" ]
38
2018-10-12T09:04:44.000Z
2021-12-08T20:54:34.000Z
runng/src/listener.rs
jeikabu/runng
b0a3a285bab9535ae6568c4dc4cac25a75b99dbe
[ "MIT" ]
3
2019-01-11T06:10:52.000Z
2020-01-15T15:38:30.000Z
//! Listeners accept connections from dialers. use super::*; use runng_derive::{NngGetOpts, NngSetOpts}; use runng_sys::*; /// Wraps `nng_listener`. See [nng_listener](https://nng.nanomsg.org/man/v1.2.2/nng_listener.5). #[derive(Debug, NngGetOpts, NngSetOpts)] #[prefix = "nng_listener_"] pub struct NngListener { listener: nng_listener, socket: NngSocket, } impl NngListener { /// See [nng_listener_create](https://nng.nanomsg.org/man/v1.2.2/nng_listener_create.3). pub(crate) fn new(socket: NngSocket, url: &str) -> Result<Self> { unsafe { let mut listener = nng_listener::default(); let (_cstring, url) = to_cstr(url)?; let res = nng_listener_create(&mut listener, socket.nng_socket(), url); Error::zero_map(res, || NngListener { listener, socket }) } } /// See [nng_listener_start](https://nng.nanomsg.org/man/v1.2.2/nng_listener_start.3). pub fn start(&self) -> Result<()> { // TODO: Use different type for started vs non-started dialer? According to nng docs options can generally only // be set before the dialer is started. unsafe { nng_int_to_result(nng_listener_start(self.listener, 0)) } } pub fn get_sockaddr(&self, option: NngOption) -> Result<SockAddr> { unsafe { let mut sockaddr = nng_sockaddr::default(); nng_int_to_result(nng_listener_getopt_sockaddr( self.listener, option.as_cptr(), &mut sockaddr, )) .and_then(|_| SockAddr::try_from(sockaddr)) } } } impl NngWrapper for NngListener { type NngType = nng_listener; unsafe fn get_nng_type(&self) -> Self::NngType { self.listener } } impl GetSocket for NngListener { fn socket(&self) -> &NngSocket { &self.socket } fn socket_mut(&mut self) -> &mut NngSocket { &mut self.socket } } /// "Unsafe" version of `NngListener`. Merely wraps `nng_listener` and makes no attempt to manage the underlying resources. /// May be invalid, close unexpectedly, etc. #[derive(Debug)] pub struct UnsafeListener { listener: nng_listener, } impl UnsafeListener { pub(crate) fn new(listener: nng_listener) -> Self { Self { listener } } /// See [nng_listener_id](https://nng.nanomsg.org/man/v1.2.2/nng_listener_id.3). pub fn id(&self) -> i32 { unsafe { nng_listener_id(self.listener) } } }
31.392405
124
0.631855
ce0af7607c1f9a46140947a6f01b6e193cc8b794
20,934
sql
SQL
sql/yjbb/600725.sql
liangzi4000/grab-share-info
4dc632442d240c71955bbf927ecf276d570a2292
[ "MIT" ]
null
null
null
sql/yjbb/600725.sql
liangzi4000/grab-share-info
4dc632442d240c71955bbf927ecf276d570a2292
[ "MIT" ]
null
null
null
sql/yjbb/600725.sql
liangzi4000/grab-share-info
4dc632442d240c71955bbf927ecf276d570a2292
[ "MIT" ]
null
null
null
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2017-09-30',@EPS = N'0.0043',@EPSDeduct = N'0',@Revenue = N'3.35亿',@RevenueYoy = N'-75.95',@RevenueQoq = N'-25.39',@Profit = N'534.66万',@ProfitYoy = N'100.54',@ProfiltQoq = N'98.93',@NAVPerUnit = N'0.2212',@ROE = N'2.76',@CashPerUnit = N'-0.1108',@GrossProfitRate = N'3.94',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-10-26' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2017-09-30',@EPS = N'0.0043',@EPSDeduct = N'0',@Revenue = N'3.35亿',@RevenueYoy = N'-75.95',@RevenueQoq = N'-25.39',@Profit = N'534.66万',@ProfitYoy = N'100.54',@ProfiltQoq = N'98.93',@NAVPerUnit = N'0.2212',@ROE = N'2.76',@CashPerUnit = N'-0.1108',@GrossProfitRate = N'3.94',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-10-26' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2017-06-30',@EPS = N'0.0017',@EPSDeduct = N'0.0017',@Revenue = N'2.22亿',@RevenueYoy = N'-73.21',@RevenueQoq = N'118.20',@Profit = N'211.15万',@ProfitYoy = N'100.75',@ProfiltQoq = N'235.14',@NAVPerUnit = N'0.2186',@ROE = N'1.37',@CashPerUnit = N'-0.0939',@GrossProfitRate = N'3.45',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2017-08-16' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2016-09-30',@EPS = N'-1.61',@EPSDeduct = N'0',@Revenue = N'13.95亿',@RevenueYoy = N'-34.44',@RevenueQoq = N'22.83',@Profit = N'-9.93亿',@ProfitYoy = N'-37.47',@ProfiltQoq = N'-426.27',@NAVPerUnit = N'-4.6031',@ROE = N'-',@CashPerUnit = N'-0.0300',@GrossProfitRate = N'-4.56',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-10-26' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2016-06-30',@EPS = N'-0.46',@EPSDeduct = N'-0.43',@Revenue = N'8.28亿',@RevenueYoy = N'-46.50',@RevenueQoq = N'25.69',@Profit = N'-2.82亿',@ProfitYoy = N'31.06',@ProfiltQoq = N'8.41',@NAVPerUnit = N'-3.4832',@ROE = N'-',@CashPerUnit = N'0.0210',@GrossProfitRate = N'-9.52',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2017-08-16' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2016-12-31',@EPS = N'2.48',@EPSDeduct = N'-2.46',@Revenue = N'18.71亿',@RevenueYoy = N'-32.96',@RevenueQoq = N'-15.96',@Profit = N'15.45亿',@ProfitYoy = N'159.40',@ProfiltQoq = N'457.12',@NAVPerUnit = N'0.0778',@ROE = N'-',@CashPerUnit = N'-0.2977',@GrossProfitRate = N'-1.78',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2017-03-08' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2015-12-31',@EPS = N'-4.22',@EPSDeduct = N'-4.24',@Revenue = N'27.91亿',@RevenueYoy = N'-57.86',@RevenueQoq = N'14.41',@Profit = N'-26.00亿',@ProfitYoy = N'-148.16',@ProfiltQoq = N'-500.75',@NAVPerUnit = N'-3.0302',@ROE = N'-',@CashPerUnit = N'-0.1653',@GrossProfitRate = N'-12.19',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2017-03-08' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2015-09-30',@EPS = N'-1.17',@EPSDeduct = N'0',@Revenue = N'21.28亿',@RevenueYoy = N'-54.48',@RevenueQoq = N'7.19',@Profit = N'-7.22亿',@ProfitYoy = N'-27.24',@ProfiltQoq = N'-50.40',@NAVPerUnit = N'-0.2064',@ROE = N'-',@CashPerUnit = N'-0.1793',@GrossProfitRate = N'-8.88',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2016-10-28' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2015-06-30',@EPS = N'-0.66',@EPSDeduct = N'-0.77',@Revenue = N'15.48亿',@RevenueYoy = N'-48.76',@RevenueQoq = N'-46.33',@Profit = N'-4.10亿',@ProfitYoy = N'-12.96',@ProfiltQoq = N'-2.96',@NAVPerUnit = N'0.3019',@ROE = N'-356.23',@CashPerUnit = N'0.1889',@GrossProfitRate = N'-6.67',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2016-08-20' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2015-03-31',@EPS = N'-0.328',@EPSDeduct = N'0',@Revenue = N'10.08亿',@RevenueYoy = N'-29.68',@RevenueQoq = N'-48.31',@Profit = N'-2.02亿',@ProfitYoy = N'-33.63',@ProfiltQoq = N'57.96',@NAVPerUnit = N'0.2076',@ROE = N'-92.20',@CashPerUnit = N'-0.1626',@GrossProfitRate = N'-0.70',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2016-04-29' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2014-12-31',@EPS = N'-1.7',@EPSDeduct = N'-1.72',@Revenue = N'66.23亿',@RevenueYoy = N'-21.84',@RevenueQoq = N'17.92',@Profit = N'-10.48亿',@ProfitYoy = N'-2817.00',@ProfiltQoq = N'-134.22',@NAVPerUnit = N'0.5191',@ROE = N'-123.13',@CashPerUnit = N'0.1248',@GrossProfitRate = N'3.64',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2016-04-29' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2014-09-30',@EPS = N'-0.92',@EPSDeduct = N'0',@Revenue = N'46.74亿',@RevenueYoy = N'-31.51',@RevenueQoq = N'4.03',@Profit = N'-5.68亿',@ProfitYoy = N'-2551.67',@ProfiltQoq = N'3.14',@NAVPerUnit = N'1.3201',@ROE = N'-51.60',@CashPerUnit = N'0.5625',@GrossProfitRate = N'4.16',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2015-11-11' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2017-03-31',@EPS = N'0.0004',@EPSDeduct = N'0',@Revenue = N'6973.67万',@RevenueYoy = N'-81.00',@RevenueQoq = N'-85.35',@Profit = N'48.52万',@ProfitYoy = N'100.33',@ProfiltQoq = N'-99.98',@NAVPerUnit = N'0.0782',@ROE = N'0.50',@CashPerUnit = N'-0.0661',@GrossProfitRate = N'5.07',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-04-26' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2014-06-30',@EPS = N'-0.59',@EPSDeduct = N'-0.6',@Revenue = N'30.22亿',@RevenueYoy = N'-39.36',@RevenueQoq = N'10.89',@Profit = N'-3.63亿',@ProfitYoy = N'-3.87',@ProfiltQoq = N'-40.09',@NAVPerUnit = N'1.6503',@ROE = N'-30.16',@CashPerUnit = N'0.4442',@GrossProfitRate = N'3.70',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2015-08-20' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2013-12-31',@EPS = N'0.06',@EPSDeduct = N'-0.94',@Revenue = N'84.74亿',@RevenueYoy = N'-9.87',@RevenueQoq = N'-13.73',@Profit = N'3856.55万',@ProfitYoy = N'103.29',@ProfiltQoq = N'-74.39',@NAVPerUnit = N'2.2459',@ROE = N'2.83',@CashPerUnit = N'1.2698',@GrossProfitRate = N'9.00',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2015-04-16' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2013-09-30',@EPS = N'-0.035',@EPSDeduct = N'0',@Revenue = N'68.25亿',@RevenueYoy = N'28.81',@RevenueQoq = N'-24.51',@Profit = N'-2140.89万',@ProfitYoy = N'95.96',@ProfiltQoq = N'209.43',@NAVPerUnit = N'2.1649',@ROE = N'-1.58',@CashPerUnit = N'-0.7193',@GrossProfitRate = N'9.19',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2014-10-27' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2013-06-30',@EPS = N'-0.57',@EPSDeduct = N'-0.57',@Revenue = N'49.83亿',@RevenueYoy = N'21.43',@RevenueQoq = N'3.38',@Profit = N'-3.49亿',@ProfitYoy = N'3.04',@ProfiltQoq = N'-58.24',@NAVPerUnit = N'1.6326',@ROE = N'-29.23',@CashPerUnit = N'-0.6869',@GrossProfitRate = N'7.70',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2014-08-30' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2013-03-31',@EPS = N'-0.22',@EPSDeduct = N'-0.223',@Revenue = N'24.50亿',@RevenueYoy = N'45.72',@RevenueQoq = N'33.08',@Profit = N'-1.35亿',@ProfitYoy = N'22.97',@ProfiltQoq = N'78.91',@NAVPerUnit = N'1.9851',@ROE = N'-10.37',@CashPerUnit = N'0.6899',@GrossProfitRate = N'7.33',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2014-04-30' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2012-12-31',@EPS = N'-1.9',@EPSDeduct = N'-1.95',@Revenue = N'94.02亿',@RevenueYoy = N'-18.70',@RevenueQoq = N'11.41',@Profit = N'-11.71亿',@ProfitYoy = N'-6483.86',@ProfiltQoq = N'-278.73',@NAVPerUnit = N'2.2581',@ROE = N'-58.80',@CashPerUnit = N'-0.4822',@GrossProfitRate = N'0.30',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2014-04-17' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2012-06-30',@EPS = N'-0.58',@EPSDeduct = N'-0.58',@Revenue = N'41.04亿',@RevenueYoy = N'-15.05',@RevenueQoq = N'16.83',@Profit = N'-3.60亿',@ProfitYoy = N'-6361.69',@ProfiltQoq = N'-5.16',@NAVPerUnit = N'3.4942',@ROE = N'-15.22',@CashPerUnit = N'-0.3234',@GrossProfitRate = N'6.94',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2013-08-30' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2012-03-31',@EPS = N'-0.285',@EPSDeduct = N'-0.282',@Revenue = N'16.81亿',@RevenueYoy = N'-13.55',@RevenueQoq = N'-16.59',@Profit = N'-1.76亿',@ProfitYoy = N'-5434.27',@ProfiltQoq = N'-11048.88',@NAVPerUnit = N'3.8520',@ROE = N'-7.12',@CashPerUnit = N'-0.1690',@GrossProfitRate = N'7.31',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2013-04-20' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2011-12-31',@EPS = N'0.03',@EPSDeduct = N'0.01',@Revenue = N'87.81亿',@RevenueYoy = N'32.86',@RevenueQoq = N'-17.68',@Profit = N'1833.93万',@ProfitYoy = N'-90.09',@ProfiltQoq = N'-111.12',@NAVPerUnit = N'4.1441',@ROE = N'0.71',@CashPerUnit = N'0.4007',@GrossProfitRate = N'13.10',@Distribution = N'10派0.5',@DividenRate = N'0.89',@AnnounceDate = N'2013-03-20' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2011-09-30',@EPS = N'0.032',@EPSDeduct = N'0.032',@Revenue = N'67.40亿',@RevenueYoy = N'48.59',@RevenueQoq = N'4.34',@Profit = N'1991.39万',@ProfitYoy = N'-58.40',@ProfiltQoq = N'475.53',@NAVPerUnit = N'4.1580',@ROE = N'0.77',@CashPerUnit = N'1.4901',@GrossProfitRate = N'12.09',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2012-10-26' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2011-06-30',@EPS = N'0.009',@EPSDeduct = N'0.01',@Revenue = N'42.92亿',@RevenueYoy = N'53.02',@RevenueQoq = N'20.67',@Profit = N'575.16万',@ProfitYoy = N'-80.08',@ProfiltQoq = N'-25.23',@NAVPerUnit = N'4.1350',@ROE = N'0.22',@CashPerUnit = N'1.0554',@GrossProfitRate = N'12.42',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2012-08-16' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2011-03-31',@EPS = N'0.005',@EPSDeduct = N'0.005',@Revenue = N'19.45亿',@RevenueYoy = N'40.49',@RevenueQoq = N'-5.33',@Profit = N'329.09万',@ProfitYoy = N'-87.67',@ProfiltQoq = N'-97.60',@NAVPerUnit = N'4.2500',@ROE = N'0.13',@CashPerUnit = N'0.6697',@GrossProfitRate = N'12.08',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2012-04-21' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2010-12-31',@EPS = N'0.3',@EPSDeduct = N'0.29',@Revenue = N'65.90亿',@RevenueYoy = N'50.90',@RevenueQoq = N'18.63',@Profit = N'1.85亿',@ProfitYoy = N'97.22',@ProfiltQoq = N'622.15',@NAVPerUnit = N'4.2391',@ROE = N'7.33',@CashPerUnit = N'0.3737',@GrossProfitRate = N'13.57',@Distribution = N'10派1',@DividenRate = N'1.10',@AnnounceDate = N'2012-03-20' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2010-09-30',@EPS = N'0.078',@EPSDeduct = N'0.076',@Revenue = N'45.36亿',@RevenueYoy = N'50.55',@RevenueQoq = N'21.93',@Profit = N'4786.65万',@ProfitYoy = N'502.93',@ProfiltQoq = N'774.08',@NAVPerUnit = N'4.0130',@ROE = N'1.95',@CashPerUnit = N'0.4292',@GrossProfitRate = N'10.82',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2011-10-18' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2010-06-30',@EPS = N'0.047',@EPSDeduct = N'0.044',@Revenue = N'28.04亿',@RevenueYoy = N'53.59',@RevenueQoq = N'2.59',@Profit = N'2887.37万',@ProfitYoy = N'128.76',@ProfiltQoq = N'-91.86',@NAVPerUnit = N'3.9810',@ROE = N'1.18',@CashPerUnit = N'0.4119',@GrossProfitRate = N'11.23',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2011-08-06' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2010-03-31',@EPS = N'0.078',@EPSDeduct = N'0.072',@Revenue = N'13.84亿',@RevenueYoy = N'70.63',@RevenueQoq = N'2.22',@Profit = N'2670.08万',@ProfitYoy = N'127.52',@ProfiltQoq = N'-74.74',@NAVPerUnit = N'7.1790',@ROE = N'1.09',@CashPerUnit = N'0.4279',@GrossProfitRate = N'11.73',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2011-04-16' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2009-12-31',@EPS = N'0.319',@EPSDeduct = N'0.3',@Revenue = N'43.67亿',@RevenueYoy = N'-18.04',@RevenueQoq = N'14.08',@Profit = N'9381.39万',@ProfitYoy = N'-29.72',@ProfiltQoq = N'19.43',@NAVPerUnit = N'7.1130',@ROE = N'5.62',@CashPerUnit = N'0.1823',@GrossProfitRate = N'12.72',@Distribution = N'10转6送2派0.23',@DividenRate = N'0.31',@AnnounceDate = N'2011-03-10' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2009-09-30',@EPS = N'-0.041',@EPSDeduct = N'-0.066',@Revenue = N'30.13亿',@RevenueYoy = N'-33.41',@RevenueQoq = N'16.99',@Profit = N'-1187.97万',@ProfitYoy = N'-104.34',@ProfiltQoq = N'2726.36',@NAVPerUnit = N'5.2200',@ROE = N'-',@CashPerUnit = N'-0.5144',@GrossProfitRate = N'11.00',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2010-10-22' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2009-06-30',@EPS = N'-0.346',@EPSDeduct = N'-0.346',@Revenue = N'18.26亿',@RevenueYoy = N'-37.21',@RevenueQoq = N'25.06',@Profit = N'-1.00亿',@ProfitYoy = N'-148.17',@ProfiltQoq = N'96.53',@NAVPerUnit = N'4.9160',@ROE = N'-6.56',@CashPerUnit = N'-0.3587',@GrossProfitRate = N'6.51',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2010-08-06' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2014-03-31',@EPS = N'-0.245',@EPSDeduct = N'0',@Revenue = N'14.33亿',@RevenueYoy = N'-41.52',@RevenueQoq = N'-13.14',@Profit = N'-1.51亿',@ProfitYoy = N'-11.72',@ProfiltQoq = N'-351.89',@NAVPerUnit = N'1.9985',@ROE = N'-11.55',@CashPerUnit = N'0.2855',@GrossProfitRate = N'6.50',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2015-04-30' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2016-03-31',@EPS = N'-0.24',@EPSDeduct = N'0',@Revenue = N'3.67亿',@RevenueYoy = N'-63.57',@RevenueQoq = N'-44.65',@Profit = N'-1.47亿',@ProfitYoy = N'26.97',@ProfiltQoq = N'92.15',@NAVPerUnit = N'-3.2721',@ROE = N'-',@CashPerUnit = N'-0.0186',@GrossProfitRate = N'-9.78',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-04-26' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2012-09-30',@EPS = N'-0.859',@EPSDeduct = N'-0.856',@Revenue = N'52.98亿',@RevenueYoy = N'-21.40',@RevenueQoq = N'-15.88',@Profit = N'-5.29亿',@ProfitYoy = N'-2758.82',@ProfiltQoq = N'8.28',@NAVPerUnit = N'3.2164',@ROE = N'-23.29',@CashPerUnit = N'-0.6444',@GrossProfitRate = N'7.48',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2013-10-29' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2009-03-31',@EPS = N'-0.334',@EPSDeduct = N'-0.333',@Revenue = N'8.11亿',@RevenueYoy = N'-37.90',@RevenueQoq = N'0.90',@Profit = N'-9700.87万',@ProfitYoy = N'-201.04',@ProfiltQoq = N'30.72',@NAVPerUnit = N'5.1310',@ROE = N'-',@CashPerUnit = N'-0.1820',@GrossProfitRate = N'0.38',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2010-04-20' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2008-12-31',@EPS = N'0.46',@EPSDeduct = N'0.409',@Revenue = N'53.29亿',@RevenueYoy = N'60.49',@RevenueQoq = N'-50.27',@Profit = N'1.33亿',@ProfitYoy = N'-36.42',@ProfiltQoq = N'-314.96',@NAVPerUnit = N'5.4770',@ROE = N'8.70',@CashPerUnit = N'1.5458',@GrossProfitRate = N'13.26',@Distribution = N'10派2',@DividenRate = N'1.42',@AnnounceDate = N'2010-03-18' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2008-09-30',@EPS = N'0.943',@EPSDeduct = N'0',@Revenue = N'45.25亿',@RevenueYoy = N'110.19',@RevenueQoq = N'0.97',@Profit = N'2.74亿',@ProfitYoy = N'115.55',@ProfiltQoq = N'-42.02',@NAVPerUnit = N'5.8280',@ROE = N'-',@CashPerUnit = N'1.2218',@GrossProfitRate = N'17.35',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2009-10-16' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2008-06-30',@EPS = N'0.718',@EPSDeduct = N'0.729',@Revenue = N'29.08亿',@RevenueYoy = N'127.07',@RevenueQoq = N'22.57',@Profit = N'2.08亿',@ProfitYoy = N'207.77',@ProfiltQoq = N'17.03',@NAVPerUnit = N'5.6030',@ROE = N'13.19',@CashPerUnit = N'1.3197',@GrossProfitRate = N'18.80',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2009-08-22' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2008-03-31',@EPS = N'0.331',@EPSDeduct = N'0.34',@Revenue = N'13.07亿',@RevenueYoy = N'140.25',@RevenueQoq = N'11.90',@Profit = N'9600.89万',@ProfitYoy = N'289.54',@ProfiltQoq = N'46.16',@NAVPerUnit = N'5.5200',@ROE = N'-',@CashPerUnit = N'0.3288',@GrossProfitRate = N'19.72',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2009-04-28' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2007-12-31',@EPS = N'0.687',@EPSDeduct = N'0.694',@Revenue = N'33.20亿',@RevenueYoy = N'87.13',@RevenueQoq = N'49.96',@Profit = N'2.10亿',@ProfitYoy = N'61.79',@ProfiltQoq = N'10.98',@NAVPerUnit = N'5.1850',@ROE = N'15.26',@CashPerUnit = N'0.9789',@GrossProfitRate = N'18.05',@Distribution = N'10派3',@DividenRate = N'0.94',@AnnounceDate = N'2009-02-28' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2007-09-30',@EPS = N'0.458',@EPSDeduct = N'0.464',@Revenue = N'21.53亿',@RevenueYoy = N'71.22',@RevenueQoq = N'183.19',@Profit = N'1.27亿',@ProfitYoy = N'92.04',@ProfiltQoq = N'318.91',@NAVPerUnit = N'4.9300',@ROE = N'-',@CashPerUnit = N'0.6923',@GrossProfitRate = N'15.94',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2008-10-30' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2007-06-30',@EPS = N'0.246',@EPSDeduct = N'0.142',@Revenue = N'12.81亿',@RevenueYoy = N'35.87',@RevenueQoq = N'17.58',@Profit = N'6770.13万',@ProfitYoy = N'19.62',@ProfiltQoq = N'82.42',@NAVPerUnit = N'3.0730',@ROE = N'4.31',@CashPerUnit = N'0.2791',@GrossProfitRate = N'15.18',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2008-07-30' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2007-03-31',@EPS = N'0.09',@EPSDeduct = N'0',@Revenue = N'5.44亿',@RevenueYoy = N'40.00',@RevenueQoq = N'-54.77',@Profit = N'2464.69万',@ProfitYoy = N'36.20',@ProfiltQoq = N'-85.37',@NAVPerUnit = N'3.0870',@ROE = N'-',@CashPerUnit = N'0.2434',@GrossProfitRate = N'15.24',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2008-04-24' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2006-12-31',@EPS = N'0.432',@EPSDeduct = N'0.437',@Revenue = N'17.74亿',@RevenueYoy = N'160.12',@RevenueQoq = N'7.49',@Profit = N'1.19亿',@ProfitYoy = N'121.51',@ProfiltQoq = N'51.66',@NAVPerUnit = N'3.0200',@ROE = N'13.36',@CashPerUnit = N'1.4777',@GrossProfitRate = N'17.15',@Distribution = N'10派1',@DividenRate = N'0.63',@AnnounceDate = N'2008-01-23' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2006-09-30',@EPS = N'0.24',@EPSDeduct = N'0',@Revenue = N'12.57亿',@RevenueYoy = N'174.09',@RevenueQoq = N'131.88',@Profit = N'6607.34万',@ProfitYoy = N'171.60',@ProfiltQoq = N'177.12',@NAVPerUnit = N'2.8530',@ROE = N'-',@CashPerUnit = N'1.2001',@GrossProfitRate = N'15.81',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2007-10-24' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2006-06-30',@EPS = N'0.111',@EPSDeduct = N'0',@Revenue = N'3.74亿',@RevenueYoy = N'62.85',@RevenueQoq = N'24.20',@Profit = N'1828.52万',@ProfitYoy = N'81.96',@ProfiltQoq = N'121.55',@NAVPerUnit = N'3.0400',@ROE = N'4.02',@CashPerUnit = N'0.2050',@GrossProfitRate = N'15.68',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2007-07-28' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2006-03-31',@EPS = N'0.034',@EPSDeduct = N'0',@Revenue = N'1.67亿',@RevenueYoy = N'51.96',@RevenueQoq = N'-25.24',@Profit = N'568.65万',@ProfitYoy = N'-11.95',@ProfiltQoq = N'-80.66',@NAVPerUnit = N'2.7790',@ROE = N'-',@CashPerUnit = N'-0.0050',@GrossProfitRate = N'15.65',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2007-04-26' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2005-12-31',@EPS = N'0.326',@EPSDeduct = N'0',@Revenue = N'6.82亿',@RevenueYoy = N'107.90',@RevenueQoq = N'-2.37',@Profit = N'5373.34万',@ProfitYoy = N'223.45',@ProfiltQoq = N'105.94',@NAVPerUnit = N'2.7480',@ROE = N'12.56',@CashPerUnit = N'0.5099',@GrossProfitRate = N'17.87',@Distribution = N'10派1',@DividenRate = N'2.11',@AnnounceDate = N'2007-01-30' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2005-09-30',@EPS = N'0',@EPSDeduct = N'0',@Revenue = N'4.59亿',@RevenueYoy = N'126.68',@RevenueQoq = N'90.63',@Profit = N'2432.77万',@ProfitYoy = N'418.62',@ProfiltQoq = N'297.68',@NAVPerUnit = N'2.5610',@ROE = N'-',@CashPerUnit = N'0.1678',@GrossProfitRate = N'16.01',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2006-10-23' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600725',@CutoffDate = N'2005-06-30',@EPS = N'0.061',@EPSDeduct = N'0',@Revenue = N'2.30亿',@RevenueYoy = N'116.15',@RevenueQoq = N'9.22',@Profit = N'1004.91万',@ProfitYoy = N'141.97',@ProfiltQoq = N'-44.41',@NAVPerUnit = N'2.4740',@ROE = N'2.46',@CashPerUnit = N'-0.1341',@GrossProfitRate = N'15.83',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2006-07-28'
410.470588
420
0.641922
90b7a56e2324e035816d2470501256b883e8bc8e
987
py
Python
main/context_processors.py
Shu-Naing/online_shopping
cfa1da276b522ab75aefb6b3fa91ad672212f7f6
[ "Apache-2.0" ]
null
null
null
main/context_processors.py
Shu-Naing/online_shopping
cfa1da276b522ab75aefb6b3fa91ad672212f7f6
[ "Apache-2.0" ]
null
null
null
main/context_processors.py
Shu-Naing/online_shopping
cfa1da276b522ab75aefb6b3fa91ad672212f7f6
[ "Apache-2.0" ]
null
null
null
from .models import Customer, Category from django.shortcuts import get_object_or_404 def base(request): category_list = list() category_name = Category.objects.distinct().values('category_name') for category in category_name: lop_list = list() query1 = Category.objects.filter(category_name=category['category_name']) for sub_cat in query1.values('sub_category'): lop_list.append(sub_cat) category_list.append({"Name": category['category_name'], "Sub_Name": lop_list}) cart = [] if 'cart' in request.session: cart = request.session['cart'] if 'customer' in request.session: customer = get_object_or_404(Customer, pk = request.session['customer']) customer_username = getattr(customer, 'customer_username') return {'customer': customer, 'context': category_list, 'cart': cart, 'host': request.get_host()} return {'context': category_list, 'cart': cart, 'host': request.get_host()}
44.863636
105
0.68693
d2831bc4a3c6e81047ad0df2741ec4e19bf416cc
871
swift
Swift
ConnpassAttendanceChecker/Common/Extension/UserDefaults.extension.swift
marty-suzuki/ConnpassAttendanceChecker
ccf51ca56b6ad2cee2cae734f11a444cab3537a2
[ "MIT" ]
13
2018-04-14T02:01:08.000Z
2018-09-21T11:11:33.000Z
ConnpassAttendanceChecker/Common/Extension/UserDefaults.extension.swift
marty-suzuki/ConnpassAttendanceChecker
ccf51ca56b6ad2cee2cae734f11a444cab3537a2
[ "MIT" ]
null
null
null
ConnpassAttendanceChecker/Common/Extension/UserDefaults.extension.swift
marty-suzuki/ConnpassAttendanceChecker
ccf51ca56b6ad2cee2cae734f11a444cab3537a2
[ "MIT" ]
null
null
null
// // UserDefaults.extension.swift // ConnpassAttendanceChecker // // Created by marty-suzuki on 2018/04/10. // Copyright © 2018年 marty-suzuki. All rights reserved. // import Foundation protocol UserDefaultsType: class { func set(_ value: Bool, forKey key: String) func bool(forKey key: String) -> Bool } struct UserDefaultsExtension { fileprivate let base: UserDefaultsType } extension UserDefaultsType { var ex: UserDefaultsExtension { return UserDefaultsExtension(base: self) } } extension UserDefaults: UserDefaultsType {} extension UserDefaultsExtension { private enum Const { static let isLoggedIn = "isLoggedIn" } var isLoggedIn: Bool { set { base.set(newValue, forKey: Const.isLoggedIn) } get { return base.bool(forKey: Const.isLoggedIn) } } }
20.738095
56
0.665901
f44f63c890dd2a0234d800ef2fb27b2e43b311ec
1,845
go
Go
server/turn.go
IRHM/chat-app-test
0578fab99b98d3a5f0db476999487ab5c6caf908
[ "MIT" ]
3
2020-12-10T04:47:36.000Z
2021-06-29T14:38:43.000Z
server/turn.go
IRHM/chat-app-test
0578fab99b98d3a5f0db476999487ab5c6caf908
[ "MIT" ]
2
2020-10-12T07:15:13.000Z
2020-10-26T20:21:33.000Z
server/turn.go
IRHM/chat-app-test
0578fab99b98d3a5f0db476999487ab5c6caf908
[ "MIT" ]
3
2020-10-10T16:12:22.000Z
2020-12-10T14:39:29.000Z
package main import ( "log" "net" "os" "os/signal" "strconv" "syscall" "github.com/pion/logging" "github.com/pion/turn" ) const ( publicIP = "192.168.0.11" port = 3478 realm = "chat.app" ) // Initialize turn server func startTurnServer() { log.Println("TURN: Starting server") // Create UDP listener udpListener, err := net.ListenPacket("udp4", "0.0.0.0:"+strconv.Itoa(port)) if err != nil { log.Panicf("Failed to create TURN server listener: %s", err) } // Cache -users flag for easy lookup later usersMap := map[string][]byte{} usersMap["user"] = turn.GenerateAuthKey("user", realm, "pass") s, err := turn.NewServer(turn.ServerConfig{ Realm: realm, // Set AuthHandler callback // This is called everytime a user tries to authenticate with the TURN server // Return the key for that user, or false when no user is found AuthHandler: func(username string, realm string, srcAddr net.Addr) ([]byte, bool) { log.Println("TURN: Authenticating new user") if key, ok := usersMap[username]; ok { return key, true } return nil, false }, // PacketConnConfigs is a list of UDP Listeners and the configuration around them PacketConnConfigs: []turn.PacketConnConfig{ { PacketConn: udpListener, RelayAddressGenerator: &turn.RelayAddressGeneratorStatic{ RelayAddress: net.ParseIP(publicIP), // Claim that we are listening on IP passed by user (This should be your Public IP) Address: "0.0.0.0", // But actually be listening on every interface }, }, }, LoggerFactory: logging.NewDefaultLoggerFactory(), }) if err != nil { log.Panic(err) } // Block until user sends SIGINT or SIGTERM sigs := make(chan os.Signal, 1) signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) <-sigs if err = s.Close(); err != nil { log.Panic(err) } }
25.273973
125
0.675339
4010331d71babf492d006292ac11a937dcbcc228
3,121
py
Python
api/utils/polyline_en_de_coder.py
hazelement/OneBus
4950f663a57a02da38bcdb9bbd505a2afd3a50c2
[ "MIT" ]
null
null
null
api/utils/polyline_en_de_coder.py
hazelement/OneBus
4950f663a57a02da38bcdb9bbd505a2afd3a50c2
[ "MIT" ]
null
null
null
api/utils/polyline_en_de_coder.py
hazelement/OneBus
4950f663a57a02da38bcdb9bbd505a2afd3a50c2
[ "MIT" ]
null
null
null
''' Provides utility functions for encoding and decoding linestrings using the Google encoded polyline algorithm. ''' def encode_coords(coords): ''' Encodes a polyline using Google's polyline algorithm See http://code.google.com/apis/maps/documentation/polylinealgorithm.html for more information. :param coords: list of Point objects :type coords: list :returns: Google-encoded polyline string. :rtype: string ''' result = [] prev_lat = 0 prev_lng = 0 for item in coords: lat, lng = int(item.lat * 1e5), int(item.lng * 1e5) d_lat = _encode_value(lat - prev_lat) d_lng = _encode_value(lng - prev_lng) prev_lat, prev_lng = lat, lng result.append(d_lat) result.append(d_lng) return ''.join(c for r in result for c in r) def _split_into_chunks(value): while value >= 32: #2^5, while there are at least 5 bits # first & with 2^5-1, zeros out all the bits other than the first five # then OR with 0x20 if another bit chunk follows yield (value & 31) | 0x20 value >>= 5 yield value def _encode_value(value): # Step 2 & 4 value = ~(value << 1) if value < 0 else (value << 1) # Step 5 - 8 chunks = _split_into_chunks(value) # Step 9-10 return (chr(chunk + 63) for chunk in chunks) def decode(point_str): '''Decodes a polyline that has been encoded using Google's algorithm http://code.google.com/apis/maps/documentation/polylinealgorithm.html This is a generic method that returns a list of (latitude, longitude) tuples. :param point_str: Encoded polyline string. :type point_str: string :returns: List of 2-tuples where each tuple is (latitude, longitude) :rtype: list ''' # sone coordinate offset is represented by 4 to 5 binary chunks coord_chunks = [[]] for char in point_str: # convert each character to decimal from ascii value = ord(char) - 63 # values that have a chunk following have an extra 1 on the left split_after = not (value & 0x20) value &= 0x1F coord_chunks[-1].append(value) if split_after: coord_chunks.append([]) del coord_chunks[-1] coords = [] for coord_chunk in coord_chunks: coord = 0 for i, chunk in enumerate(coord_chunk): coord |= chunk << (i * 5) #there is a 1 on the right if the coord is negative if coord & 0x1: coord = ~coord #invert coord >>= 1 coord /= 100000.0 coords.append(coord) # convert the 1 dimensional list to a 2 dimensional list and offsets to # actual values points = [] prev_x = 0 prev_y = 0 for i in xrange(0, len(coords) - 1, 2): if coords[i] == 0 and coords[i + 1] == 0: continue prev_x += coords[i + 1] prev_y += coords[i] # a round to 6 digits ensures that the floats are the same as when # they were encoded points.append((round(prev_x, 6), round(prev_y, 6))) return points
26.008333
78
0.616149
965c6204d7701bf1ac0ad7289c29f616bce2f734
1,266
php
PHP
www/lib/Database/namespace.php
DavidHigueraFerrez/reservaespacios-etsit
71216ef17ec645de353e89f28fa83e1894f3cb12
[ "MIT" ]
null
null
null
www/lib/Database/namespace.php
DavidHigueraFerrez/reservaespacios-etsit
71216ef17ec645de353e89f28fa83e1894f3cb12
[ "MIT" ]
null
null
null
www/lib/Database/namespace.php
DavidHigueraFerrez/reservaespacios-etsit
71216ef17ec645de353e89f28fa83e1894f3cb12
[ "MIT" ]
null
null
null
<?php /** Copyright 2011-2019 Nick Korbel This file is part of Booked Scheduler is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version 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 Booked Scheduler. If not, see <http://www.gnu.org/licenses/>. */ require_once(ROOT_DIR . 'lib/Database/IDbConnection.php'); require_once(ROOT_DIR . 'lib/Database/ISqlCommand.php'); require_once(ROOT_DIR . 'lib/Database/IReader.php'); require_once(ROOT_DIR . 'lib/Database/Parameter.php'); require_once(ROOT_DIR . 'lib/Database/Parameters.php'); require_once(ROOT_DIR . 'lib/Database/SqlCommand.php'); require_once(ROOT_DIR . 'lib/Database/Database.php'); require_once(ROOT_DIR . 'lib/Database/DatabaseFactory.php'); require_once(ROOT_DIR . 'lib/Database/SqlFilter.php'); require_once(ROOT_DIR . 'lib/Common/Helpers/namespace.php');
46.888889
94
0.770142
f9c1bbd4baa6275b08f4a0f57a9af8653a461cd4
484
go
Go
cmd/count_test.go
DrJoLe/pufobs
f654a8d0eb0e3d414087ddbf8a4e8b544149e796
[ "MIT" ]
null
null
null
cmd/count_test.go
DrJoLe/pufobs
f654a8d0eb0e3d414087ddbf8a4e8b544149e796
[ "MIT" ]
null
null
null
cmd/count_test.go
DrJoLe/pufobs
f654a8d0eb0e3d414087ddbf8a4e8b544149e796
[ "MIT" ]
null
null
null
package cmd import ( "bytes" "io" "strconv" "strings" "testing" ) func TestNewCountCmd(t *testing.T) { b := bytes.NewBufferString("") cmd := NewCountCmd() cmd.SetOut(b) if err := cmd.Execute(); err != nil { t.Fatal(err) } out, err := io.ReadAll(b) if err != nil { t.Fatal(err) } number, err := strconv.Atoi(strings.TrimSpace(string(out))) if err != nil { t.Fatal(err) } if number <= 0 { t.Fatalf("expected %s got %d", "at least 1 episode", number) } }
14.235294
62
0.603306
041aec007e233f8a9fb0856e14f7c764bebe31d3
8,460
kt
Kotlin
payer/src/test/kotlin/com/lumedic/network/payer/FlowTests.kt
cennest/lumedic-corda-network
d47d49fe643eb00f2c5df5cbfd7fd750ecf43573
[ "Apache-2.0" ]
null
null
null
payer/src/test/kotlin/com/lumedic/network/payer/FlowTests.kt
cennest/lumedic-corda-network
d47d49fe643eb00f2c5df5cbfd7fd750ecf43573
[ "Apache-2.0" ]
null
null
null
payer/src/test/kotlin/com/lumedic/network/payer/FlowTests.kt
cennest/lumedic-corda-network
d47d49fe643eb00f2c5df5cbfd7fd750ecf43573
[ "Apache-2.0" ]
null
null
null
package com.lumedic.network.payer import com.lumedic.network.base.contract.HARSTATE_CONTRACT_ID import com.lumedic.network.base.contract.HARStateContract import com.lumedic.network.base.flow.GetSignedTransaction import com.lumedic.network.base.flow.QueryAuthCode import com.lumedic.network.base.model.HARStatus import com.lumedic.network.base.state.HARState import net.corda.core.contracts.* import net.corda.core.crypto.SecureHash import net.corda.core.identity.CordaX500Name import net.corda.core.identity.Party import net.corda.core.transactions.TransactionBuilder import net.corda.testing.node.MockNetwork import net.corda.testing.node.StartedMockNode import org.junit.After import org.junit.Before import org.junit.Test import java.time.Instant import java.time.LocalDateTime import java.time.ZoneId import java.time.ZonedDateTime import java.util.* import kotlin.test.assertEquals import kotlin.test.assertNotEquals import kotlin.test.assertNotNull class FlowTests { private lateinit var mockNet: MockNetwork lateinit var nodePayer: StartedMockNode lateinit var nodeProvider: StartedMockNode lateinit var nodeOracle: StartedMockNode lateinit var nodeNotary: StartedMockNode @Before fun setup() { mockNet = MockNetwork(listOf("com.lumedic.network.base", "com.lumedic.network.payer", "com.lumedic.network"), threadPerNode = false) nodePayer = mockNet.createPartyNode(CordaX500Name("Payer", "London", "GB")) nodeOracle = mockNet.createPartyNode(CordaX500Name("Oracle", "New York", "US")) nodeNotary = mockNet.createPartyNode(CordaX500Name("Notary", "London", "GB")) nodeProvider = mockNet.createPartyNode(CordaX500Name("Provider", "London", "GB")) registerFlowsAndServices(nodePayer) } fun registerFlowsAndServices(node: StartedMockNode) { node.registerInitiatedFlow(ProposalFlow.ApprovalCodeHandler::class.java) } fun StartedMockNode.legalIdentity(): Party { return this.info.legalIdentities.first() } @After fun tearDownNetwork() { mockNet.stopNodes() } companion object { //val logger: Logger = loggerFor<FlowTest>() } fun LocalDateTime.toDate(): Date { val zdt = ZonedDateTime.of(this, ZoneId.systemDefault()) val cal = GregorianCalendar.from(zdt) return cal.time } fun randomInt(min: Int, max: Int): Int { if (min > max || max - min + 1 > Int.MAX_VALUE) throw IllegalArgumentException("Invalid Range") return Random().nextInt(max - min + 1) + min } fun randomDate(): Date { val ldt = LocalDateTime.now().plusDays(randomInt(0, 30 * 4).toLong()) return ldt.toDate() } data class EpicRecord(val payer: String, val desc: String, val cptCode: String, var scheduledDate: Date? = null) @Test fun testApprovalCodeHandlerCPTCodeExists() { val harID = "10000" val epicRecord = EpicRecord("PNP", "Oncology (colorectal)", "0002U", scheduledDate = randomDate()) val uniqueIdentifier = UniqueIdentifier(harID) val harState = HARState(HARStatus.PENDING.toString(), listOf(nodeProvider.legalIdentity()), epicRecord.desc, harID, epicRecord.cptCode, "", epicRecord.payer, "", "", uniqueIdentifier, epicRecord.scheduledDate!!) val flow = QueryAuthCode(nodePayer.legalIdentity(), harState) val future = nodePayer.startFlow(flow) mockNet.runNetwork() val state = future.get() assertNotEquals("NA",state.authCode, "Auth code mis-matched") assertEquals("PNP", state.payer, "Payer mis-matched") assertEquals("0002U",state.cptCode,"CPTCode mis-matched") assertEquals("Oncology (colorectal)",state.description, "Epic description mis-matched") assertEquals(HARStatus.PENDING.toString(), state.status, "HARStatus mis-matched") assertEquals(uniqueIdentifier, state.linearId, "linearId mis-matched") assertEquals(epicRecord.scheduledDate, state.eventTime, "eventTime mis-matched") } @Test fun testApprovalCodeHandlerCPTCodeNotExists() { val harID = "10000" val epicRecord = EpicRecord("PNP", "Oncology (colorectal)", "000FU", scheduledDate = randomDate()) val uniqueIdentifier = UniqueIdentifier(harID) val harState = HARState(HARStatus.PENDING.toString(), listOf(nodeProvider.legalIdentity()), epicRecord.desc, harID, epicRecord.cptCode,"", epicRecord.payer,"", "", uniqueIdentifier, epicRecord.scheduledDate!!) val flow = QueryAuthCode(nodePayer.legalIdentity(), harState) val future = nodePayer.startFlow(flow) mockNet.runNetwork() val state = future.get() assertEquals("NA",state.authCode, "Auth code mis-matched") assertEquals("PNP", state.payer, "Payer mis-matched") assertEquals("000FU",state.cptCode,"CPTCode mis-matched") assertEquals("Oncology (colorectal)",state.description, "Epic description mis-matched") assertEquals(HARStatus.PENDING.toString(), state.status, "HARStatus mis-matched") assertEquals(uniqueIdentifier, state.linearId, "linearId mis-matched") assertEquals(epicRecord.scheduledDate, state.eventTime, "eventTime mis-matched") } @Test fun testAcceptor() { val harID = "10000" val epicRecord = EpicRecord("PNP", "Oncology (colorectal)", "000FU", scheduledDate = randomDate()) val uniqueIdentifier = UniqueIdentifier(harID) val inputState = HARState(HARStatus.PENDING.toString(), listOf(nodeProvider.legalIdentity()), epicRecord.desc, harID, epicRecord.cptCode,"", epicRecord.payer, "","", uniqueIdentifier, epicRecord.scheduledDate!!) val outputState = HARState(HARStatus.CONFIRMED.toString(), listOf(nodeProvider.legalIdentity(), nodePayer.legalIdentity()), inputState.description, harID, inputState.cptCode, "", inputState.payer,"", "authCode", uniqueIdentifier, inputState.eventTime, Date.from(Instant.now()), inputState.isAuthRequired) val txBuilder = TransactionBuilder(notary = nodeNotary.legalIdentity()) val outputContractAndState = StateAndContract(outputState, HARSTATE_CONTRACT_ID) val cmd = Command(HARStateContract.MarkDeniedConfirmed(), listOf(nodePayer.legalIdentity().owningKey, nodeProvider.legalIdentity().owningKey)) val inputStateRef: StateAndRef<HARState> = StateAndRef(TransactionState(inputState, HARSTATE_CONTRACT_ID, notary = nodeNotary.legalIdentity()), StateRef(SecureHash.zeroHash, 0)) txBuilder.addInputState(inputStateRef) // We add the items to the builder. txBuilder.withItems(outputContractAndState, cmd) val ptx = nodeProvider.services.signInitialTransaction(txBuilder) val flow = GetSignedTransaction(nodePayer.legalIdentity(), ptx) val future = nodePayer.startFlow(flow) mockNet.runNetwork() val transaction = future.get() val signCount = transaction.sigs.count() val payerKey = nodePayer.legalIdentity().owningKey val payerSign = nodePayer.services.createSignature(ptx, payerKey) val payerSignContained = transaction.sigs.contains(payerSign) val providerKey = nodePayer.legalIdentity().owningKey val providerSign = nodePayer.services.createSignature(ptx, providerKey) val providerSignContained = transaction.sigs.contains(providerSign) assert(signCount == 2) assert(payerSignContained) assert(providerSignContained) assertEquals("000FU",inputState.cptCode,"CPTCode mis-matched") assertEquals("000FU",outputState.cptCode,"CPTCode mis-matched") assertEquals("Oncology (colorectal)",inputState.description, "Epic description mis-matched") assertEquals("Oncology (colorectal)",outputState.description, "Epic description mis-matched") assertEquals(HARStatus.PENDING.toString(), inputState.status, "HARStatus mis-matched") assertEquals(HARStatus.CONFIRMED.toString(), outputState.status, "HARStatus mis-matched") assertEquals(uniqueIdentifier, inputState.linearId, "linearId mis-matched") assertEquals(uniqueIdentifier, outputState.linearId, "linearId mis-matched") assertEquals(epicRecord.scheduledDate, inputState.eventTime, "eventTime mis-matched") assertEquals(epicRecord.scheduledDate, outputState.eventTime, "eventTime mis-matched") } }
47.26257
219
0.719858
68c47634afa41382b4676c55041ad80e33952a23
524
asm
Assembly
oeis/315/A315847.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/315/A315847.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/315/A315847.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A315847: Coordination sequence Gal.5.232.3 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; Submitted by Simon Strandgaard ; 1,6,7,18,19,20,36,32,33,54,45,46,72,58,59,90,71,72,108,84,85,126,97,98,144,110,111,162,123,124,180,136,137,198,149,150,216,162,163,234,175,176,252,188,189,270,201,202,288,214 sub $1,$0 seq $0,301720 ; Coordination sequence for node of type V1 in "krb" 2-D tiling (or net). mul $0,5 div $0,3 mul $1,4 add $0,$1
47.636364
177
0.725191
87cd92e0ecba1766f76390d8510c27199ca2937d
699
asm
Assembly
oeis/015/A015190.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/015/A015190.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/015/A015190.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A015190: Sum of (Gaussian) q-binomial coefficients for q=-21. ; Submitted by Christian Krause ; 1,2,-18,844,168404,164477928,-687450157352,14105258809884656,1238186812120404030096,533503696576292562518040352,-983466011800819442632186373851168,8898776193390263176983910297292084624064,344486034279370826947785936357382453706497263424,65457863429984645622942574619498236672339982836746631808,-53213576682138499166192980542553083254773378192206636420925894272,212340067814370768978934540926290244500766884564433161531837515662784304896 mov $1,$0 mov $0,0 add $1,1 mov $2,1 mov $3,1 lpb $1 sub $1,1 mov $4,$2 mul $2,-20 sub $2,$4 mul $4,$3 add $0,$4 sub $3,$4 add $3,$0 lpe mov $0,$3
33.285714
438
0.812589
147c92823bbc1b0bd155b481e7a9f7687fbb3403
3,950
swift
Swift
Sources/Defaults/UserDefaults.swift
daoan1412/Defaults
7a72b23d3af928bd447f5edb4f8ba78deda4fea9
[ "MIT" ]
null
null
null
Sources/Defaults/UserDefaults.swift
daoan1412/Defaults
7a72b23d3af928bd447f5edb4f8ba78deda4fea9
[ "MIT" ]
null
null
null
Sources/Defaults/UserDefaults.swift
daoan1412/Defaults
7a72b23d3af928bd447f5edb4f8ba78deda4fea9
[ "MIT" ]
null
null
null
import Foundation extension UserDefaults { private func _get<Value: Codable>(_ key: String) -> Value? { if UserDefaults.isNativelySupportedType(Value.self) { return object(forKey: key) as? Value } guard let text = string(forKey: key), let data = "[\(text)]".data(using: .utf8) else { return nil } do { return (try JSONDecoder().decode([Value].self, from: data)).first } catch { print(error) } return nil } @available(iOS 11.0, macOS 10.13, tvOS 11.0, watchOS 4.0, iOSApplicationExtension 11.0, macOSApplicationExtension 10.13, tvOSApplicationExtension 11.0, watchOSApplicationExtension 4.0, *) private func _get<Value: NSSecureCoding>(_ key: String) -> Value? { if UserDefaults.isNativelySupportedType(Value.self) { return object(forKey: key) as? Value } guard let data = data(forKey: key) else { return nil } do { return try NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data) as? Value } catch { print(error) } return nil } func _encode<Value: Codable>(_ value: Value) -> String? { do { // Some codable values like URL and enum are encoded as a top-level // string which JSON can't handle, so we need to wrap it in an array // We need this: https://forums.swift.org/t/allowing-top-level-fragments-in-jsondecoder/11750 let data = try JSONEncoder().encode([value]) return String(String(data: data, encoding: .utf8)!.dropFirst().dropLast()) } catch { print(error) return nil } } private func _set<Value: Codable>(_ key: String, to value: Value) { if (value as? _DefaultsOptionalType)?.isNil == true { removeObject(forKey: key) return } if UserDefaults.isNativelySupportedType(Value.self) { set(value, forKey: key) return } set(_encode(value), forKey: key) } @available(iOS 11.0, macOS 10.13, tvOS 11.0, watchOS 4.0, iOSApplicationExtension 11.0, macOSApplicationExtension 10.13, tvOSApplicationExtension 11.0, watchOSApplicationExtension 4.0, *) private func _set<Value: NSSecureCoding>(_ key: String, to value: Value) { // TODO: Handle nil here too. if UserDefaults.isNativelySupportedType(Value.self) { set(value, forKey: key) return } set(try? NSKeyedArchiver.archivedData(withRootObject: value, requiringSecureCoding: true), forKey: key) } public subscript<Value>(key: Defaults.Key<Value>) -> Value { get { _get(key.name) ?? key.defaultValue } set { _set(key.name, to: newValue) } } @available(iOS 11.0, macOS 10.13, tvOS 11.0, watchOS 4.0, iOSApplicationExtension 11.0, macOSApplicationExtension 10.13, tvOSApplicationExtension 11.0, watchOSApplicationExtension 4.0, *) public subscript<Value>(key: Defaults.NSSecureCodingKey<Value>) -> Value { get { _get(key.name) ?? key.defaultValue } set { _set(key.name, to: newValue) } } @available(iOS 11.0, macOS 10.13, tvOS 11.0, watchOS 4.0, iOSApplicationExtension 11.0, macOSApplicationExtension 10.13, tvOSApplicationExtension 11.0, watchOSApplicationExtension 4.0, *) public subscript<Value>(key: Defaults.NSSecureCodingOptionalKey<Value>) -> Value? { get { _get(key.name) } set { guard let value = newValue else { set(nil, forKey: key.name) return } _set(key.name, to: value) } } static func isNativelySupportedType<T>(_ type: T.Type) -> Bool { switch type { case is Bool.Type, is Bool?.Type, // swiftlint:disable:this discouraged_optional_boolean is String.Type, is String?.Type, is Int.Type, is Int?.Type, is Double.Type, is Double?.Type, is Float.Type, is Float?.Type, is Date.Type, is Date?.Type, is Data.Type, is Data?.Type: return true default: return false } } } extension UserDefaults { /** Remove all entries. - Note: This only removes user-defined entries. System-defined entries will remain. */ public func removeAll() { for key in dictionaryRepresentation().keys { removeObject(forKey: key) } } }
26.689189
188
0.694177
3896c30a480069deb9ff82c3835f32d6095554f4
1,864
h
C
Sources/Elastos/Frameworks/Droid/Base/Services/Server/inc/elastos/droid/server/ShutdownActivity.h
jingcao80/Elastos
d0f39852356bdaf3a1234743b86364493a0441bc
[ "Apache-2.0" ]
7
2017-07-13T10:34:54.000Z
2021-04-16T05:40:35.000Z
Sources/Elastos/Frameworks/Droid/Base/Services/Server/inc/elastos/droid/server/ShutdownActivity.h
jingcao80/Elastos
d0f39852356bdaf3a1234743b86364493a0441bc
[ "Apache-2.0" ]
null
null
null
Sources/Elastos/Frameworks/Droid/Base/Services/Server/inc/elastos/droid/server/ShutdownActivity.h
jingcao80/Elastos
d0f39852356bdaf3a1234743b86364493a0441bc
[ "Apache-2.0" ]
9
2017-07-13T12:33:20.000Z
2021-06-19T02:46:48.000Z
//========================================================================= // Copyright (C) 2012 The Elastos Open Source Project // // 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. //========================================================================= #ifndef __ELASTOS_DROID_SERVER_SHUTDOWNACTIVITY_H__ #define __ELASTOS_DROID_SERVER_SHUTDOWNACTIVITY_H__ #include "elastos/droid/app/Activity.h" #include <elastos/core/Thread.h> using Elastos::Core::Thread; using Elastos::Droid::Os::IBundle; using Elastos::Droid::App::Activity; namespace Elastos { namespace Droid { namespace Server { class ShutdownActivity : public Activity { private: class LocalThread : public Thread { public: LocalThread( /* [in] */ ShutdownActivity* host) : mHost(host) { } CARAPI constructor( /* [in] */ const String& name) { return Thread::constructor(name); } CARAPI Run(); private: ShutdownActivity* mHost; }; public: ShutdownActivity(); CARAPI OnCreate( /* [in] */ IBundle* savedInstanceState); private: static const String TAG; Boolean mReboot; Boolean mConfirm; }; } // namespace Server } // namespace Droid } // namespace Elastos #endif //__ELASTOS_DROID_SERVER_SHUTDOWNACTIVITY_H__
25.189189
75
0.622318
add71fd3c9791397215820c4f2efd99509869bcb
426
rs
Rust
libs/datamodel/parser-database/src/attributes/native_types.rs
GQAdonis/prisma-engines
803678eb3d9f17fbbb5c4d7e16b0a0a751e1460c
[ "Apache-2.0" ]
486
2020-02-16T10:57:36.000Z
2022-03-31T16:12:31.000Z
libs/datamodel/parser-database/src/attributes/native_types.rs
GQAdonis/prisma-engines
803678eb3d9f17fbbb5c4d7e16b0a0a751e1460c
[ "Apache-2.0" ]
783
2020-02-10T12:56:10.000Z
2022-03-31T14:17:06.000Z
libs/datamodel/parser-database/src/attributes/native_types.rs
GQAdonis/prisma-engines
803678eb3d9f17fbbb5c4d7e16b0a0a751e1460c
[ "Apache-2.0" ]
82
2020-02-14T15:04:21.000Z
2022-03-30T08:13:07.000Z
use crate::{ast, types::ScalarField}; pub(super) fn visit_native_type_attribute<'ast>( datasource_name: &'ast str, type_name: &'ast str, attr: &'ast ast::Attribute, scalar_field: &mut ScalarField<'ast>, ) { let args = &attr.arguments; let args: Vec<String> = args.iter().map(|arg| arg.value.to_string()).collect(); scalar_field.native_type = Some((datasource_name, type_name, args, attr.span)) }
30.428571
83
0.676056
8150ee4cb4ced604857db861ec41325032a969c6
578
go
Go
vendor/github.com/spiffe/go-spiffe/v2/logger/std.go
lcarva/chains
843c6b3477fee1154093d5a8660630f3ebdaef31
[ "Apache-2.0" ]
130
2020-06-16T14:56:49.000Z
2022-03-29T12:55:12.000Z
vendor/github.com/spiffe/go-spiffe/v2/logger/std.go
lcarva/chains
843c6b3477fee1154093d5a8660630f3ebdaef31
[ "Apache-2.0" ]
397
2020-06-15T12:09:19.000Z
2022-03-31T23:44:56.000Z
vendor/github.com/spiffe/go-spiffe/v2/logger/std.go
lcarva/chains
843c6b3477fee1154093d5a8660630f3ebdaef31
[ "Apache-2.0" ]
66
2020-06-15T12:07:37.000Z
2022-03-25T07:13:01.000Z
package logger import "log" // Std is a logger that uses the Go standard log library. var Std Logger = stdLogger{} type stdLogger struct{} func (stdLogger) Debugf(format string, args ...interface{}) { log.Printf("[DEBUG] "+format+"\n", args...) } func (stdLogger) Infof(format string, args ...interface{}) { log.Printf("[INFO] "+format+"\n", args...) } func (stdLogger) Warnf(format string, args ...interface{}) { log.Printf("[WARN] "+format+"\n", args...) } func (stdLogger) Errorf(format string, args ...interface{}) { log.Printf("[ERROR] "+format+"\n", args...) }
23.12
61
0.652249
d7de16c7ab34aa6fd8e660dd2b916e118240f3a5
420
kt
Kotlin
generator/bin/main/com/laidpack/sourcerer/generator/index/ClassSymbolDescription.kt
dpnolte/sourcerer
9513bbc54768e9248c450b0aba125b433c447e68
[ "Apache-2.0" ]
null
null
null
generator/bin/main/com/laidpack/sourcerer/generator/index/ClassSymbolDescription.kt
dpnolte/sourcerer
9513bbc54768e9248c450b0aba125b433c447e68
[ "Apache-2.0" ]
4
2020-07-17T05:38:29.000Z
2021-09-01T06:26:00.000Z
generator/bin/main/com/laidpack/sourcerer/generator/index/ClassSymbolDescription.kt
dpnolte/sourcerer
9513bbc54768e9248c450b0aba125b433c447e68
[ "Apache-2.0" ]
1
2020-06-11T02:38:33.000Z
2020-06-11T02:38:33.000Z
package com.laidpack.sourcerer.generator.index import com.laidpack.sourcerer.generator.resources.Widget import com.squareup.kotlinpoet.ClassName data class ClassSymbolDescription ( val targetClassName: ClassName, val widget: Widget?, val classCategory : ClassCategory, val isViewGroup: Boolean, val superClassNames: List<ClassName>, val xdDeclaredType: XdDeclaredType )
30
56
0.742857
1755e3ae71ff2abd20d9d866edc036d4ab5afb0c
626
html
HTML
projects/canopy/src/lib/modal/modal.component.html
Devaney/canopy
68705df71965460dbc1204aa2b6b8bb6521f9ebc
[ "Apache-2.0" ]
22
2020-09-28T09:00:10.000Z
2022-02-01T16:16:07.000Z
projects/canopy/src/lib/modal/modal.component.html
Devaney/canopy
68705df71965460dbc1204aa2b6b8bb6521f9ebc
[ "Apache-2.0" ]
637
2020-09-28T16:24:17.000Z
2022-03-31T10:30:30.000Z
projects/canopy/src/lib/modal/modal.component.html
markblandford/canopy
b0670cd37d74cce1c76f802e3055f7c01abbb6f3
[ "Apache-2.0" ]
42
2020-09-28T21:37:50.000Z
2022-03-08T15:07:08.000Z
<ng-container *ngIf="isOpen"> <div class="lg-modal-overlay" aria-hidden="true"></div> <lg-card cdkTrapFocus class="lg-modal" role="dialog" lgPadding="none" [attr.aria-labelledby]="'lg-modal-header-' + id" [attr.aria-describedby]="'lg-modal-body-' + id" aria-modal="true" tabindex="-1" (click)="onModalClick($event)" [lgFocus]="isOpen" > <lg-card-content> <ng-content select="lg-modal-header"></ng-content> <ng-content select="lg-modal-body"></ng-content> <ng-content select="lg-modal-footer"></ng-content> </lg-card-content> </lg-card> </ng-container>
28.454545
57
0.618211
742cbb491f265754d94e9e17b1150bb3b2094c06
373
h
C
lib/quickflux/qfactioncreator.h
denLaure/DictionaryTrainer
fc6d85e0b755eeca7870312653fd03e62447fffb
[ "MIT" ]
null
null
null
lib/quickflux/qfactioncreator.h
denLaure/DictionaryTrainer
fc6d85e0b755eeca7870312653fd03e62447fffb
[ "MIT" ]
null
null
null
lib/quickflux/qfactioncreator.h
denLaure/DictionaryTrainer
fc6d85e0b755eeca7870312653fd03e62447fffb
[ "MIT" ]
1
2019-07-04T09:24:16.000Z
2019-07-04T09:24:16.000Z
#ifndef QFACTIONCREATOR_H #define QFACTIONCREATOR_H #include <QObject> #include <QQmlParserStatus> class QFActionCreator : public QObject, public QQmlParserStatus { Q_OBJECT Q_INTERFACES(QQmlParserStatus) public: explicit QFActionCreator(QObject *parent = 0); protected: void classBegin(); void componentComplete(); }; #endif // QFACTIONCREATOR_H
16.954545
63
0.758713
95b2290a94865562380c92dccb847bdba9ce7c52
615
html
HTML
manifests/templates/manifests/delete.html
aysiu/manana
8af8b57c72f6154affdb5f3a9a3469a49e5818fe
[ "Apache-2.0" ]
9
2016-02-16T23:53:40.000Z
2020-07-13T16:04:18.000Z
manifests/templates/manifests/delete.html
aysiu/manana
8af8b57c72f6154affdb5f3a9a3469a49e5818fe
[ "Apache-2.0" ]
null
null
null
manifests/templates/manifests/delete.html
aysiu/manana
8af8b57c72f6154affdb5f3a9a3469a49e5818fe
[ "Apache-2.0" ]
4
2016-02-16T23:56:13.000Z
2019-05-20T15:12:14.000Z
{% block content %} <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title" id="newLabel">Delete manifest</h4> </div> <div class="modal-body"> <form name='delete_form' action='{% url "manifests.views.delete" manifest_name %}' method="post"> {% csrf_token %} <h4>Really delete manifest <b>{{ manifest_name }}?</b></h4> <br> <input class='btn btn-danger pull-right' type="submit" value="Delete" /> <input type="reset" class="btn btn-default" data-dismiss="modal" value="Close"/> </form> </div> {% endblock content %}
36.176471
98
0.674797
1887989bf2cd12b1fa252e8bb702821a1890ee77
14,560
rs
Rust
src/conv.rs
pthariensflame/refraction
5b74a6ca31658b54b24f7660998d8a22dedd6f09
[ "Apache-2.0" ]
28
2016-04-18T14:52:55.000Z
2021-01-09T15:55:21.000Z
src/conv.rs
pthariensflame/refraction
5b74a6ca31658b54b24f7660998d8a22dedd6f09
[ "Apache-2.0" ]
1
2017-03-06T03:48:26.000Z
2017-03-06T03:48:26.000Z
src/conv.rs
pthariensflame/refraction
5b74a6ca31658b54b24f7660998d8a22dedd6f09
[ "Apache-2.0" ]
null
null
null
//! These lenticuloids handle lossless conversions via the standard library //! traits `Into`, `AsRef` and `AsMut`. use std::fmt::{self, Debug, Formatter}; use std::marker::PhantomData; use super::{Injector, Iso, Lens, Lenticuloid, PartialLens, Prism, util}; /// An isomorphism family that handles lossless conversions by owned value. pub struct Conv<S, A = S, T = S, B = A> { phantom_sa: PhantomData<Fn(S) -> A>, phantom_bt: PhantomData<Fn(B) -> T>, } impl<S, A, T, B> Conv<S, A, T, B> where S: Into<A>, A: Into<S>, B: Into<T>, T: Into<B> { #[cfg(not(feature = "nightly"))] #[inline] pub fn mk() -> Self { Conv { phantom_sa: PhantomData, phantom_bt: PhantomData, } } #[cfg(feature = "nightly")] #[inline] pub const fn mk() -> Self { Conv { phantom_sa: PhantomData, phantom_bt: PhantomData, } } } impl<S, A, T, B> Debug for Conv<S, A, T, B> where S: Into<A>, A: Into<S>, B: Into<T>, T: Into<B> { fn fmt(&self, fm: &mut Formatter) -> fmt::Result { fm.debug_struct("Conv") .field("phantom_sa", &self.phantom_sa) .field("phantom_bt", &self.phantom_bt) .finish() } } impl<S, A, T, B> Clone for Conv<S, A, T, B> where S: Into<A>, A: Into<S>, B: Into<T>, T: Into<B> { #[inline] fn clone(&self) -> Self { *self } #[inline] fn clone_from(&mut self, source: &Self) { *self = *source; } } impl<S, A, T, B> Copy for Conv<S, A, T, B> where S: Into<A>, A: Into<S>, B: Into<T>, T: Into<B> { } impl<S, A, T, B> Default for Conv<S, A, T, B> where S: Into<A>, A: Into<S>, B: Into<T>, T: Into<B> { #[inline] fn default() -> Self { Self::mk() } } impl<S, A, T, B> Lenticuloid for Conv<S, A, T, B> where S: Into<A>, A: Into<S>, B: Into<T>, T: Into<B> { type InitialSource = S; type InitialTarget = A; type FinalSource = T; type FinalTarget = B; type AtInitial = Conv<S, A, S, A>; fn at_initial(&self) -> Self::AtInitial { Conv::mk() } type AtFinal = Conv<T, B, T, B>; fn at_final(&self) -> Self::AtFinal { Conv::mk() } } impl<S, A, T, B> PartialLens for Conv<S, A, T, B> where S: Into<A>, A: Into<S>, B: Into<T>, T: Into<B> { #[inline] fn try_get(&self, v: Self::InitialSource) -> Result<Self::InitialTarget, Self::FinalSource> { Ok(v.into()) } #[inline] fn try_get_inject(&self, v: Self::InitialSource) -> Result<(Self::InitialTarget, Injector<Self::FinalTarget, Self::FinalSource>), Self::FinalSource> { Ok((v.into(), util::once_to_mut(move |x: Self::FinalTarget| -> Self::FinalSource { x.into() }))) } #[inline] fn set(&self, _v: Self::InitialSource, x: Self::FinalTarget) -> Self::FinalSource { x.into() } #[inline] fn exchange(&self, v: Self::InitialSource, x: Self::FinalTarget) -> (Option<Self::InitialTarget>, Self::FinalSource) { (Some(v.into()), x.into()) } #[inline] fn modify<F>(&self, v: Self::InitialSource, f: F) -> Self::FinalSource where F: FnOnce(Self::InitialTarget) -> Self::FinalTarget { f(v.into()).into() } #[inline] fn modify_with<F, X>(&self, v: Self::InitialSource, f: F) -> (Self::FinalSource, Option<X>) where F: FnOnce(Self::InitialTarget) -> (Self::FinalTarget, X) { let (a, b) = f(v.into()); (a.into(), Some(b)) } } impl<S, A, T, B> Lens for Conv<S, A, T, B> where S: Into<A>, A: Into<S>, B: Into<T>, T: Into<B> { #[inline] fn get(&self, v: Self::InitialSource) -> Self::InitialTarget { v.into() } } impl<S, A, T, B> Prism for Conv<S, A, T, B> where S: Into<A>, A: Into<S>, B: Into<T>, T: Into<B> { #[inline] fn inject(&self, v: Self::FinalTarget) -> Self::FinalSource { v.into() } } impl<S, A, T, B> Iso for Conv<S, A, T, B> where S: Into<A>, A: Into<S>, B: Into<T>, T: Into<B> { } /// An isomorphism family that handles lossless conversions by shared reference. pub struct ConvRef<'a, S: ?Sized + 'a, A: ?Sized + 'a = S, T: ?Sized + 'a = S, B: ?Sized + 'a = T> { phantom_sa: PhantomData<Fn(&'a S) -> &'a A>, phantom_bt: PhantomData<Fn(&'a B) -> &'a T>, } impl<'a, S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized> ConvRef<'a, S, A, T, B> where S: AsRef<A> + 'a, A: AsRef<S> + 'a, T: AsRef<B> + 'a, B: AsRef<T> + 'a { #[cfg(not(feature = "nightly"))] #[inline] pub fn mk() -> Self { ConvRef { phantom_sa: PhantomData, phantom_bt: PhantomData, } } #[cfg(feature = "nightly")] #[inline] pub const fn mk() -> Self { ConvRef { phantom_sa: PhantomData, phantom_bt: PhantomData, } } } impl<'a, S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized> Debug for ConvRef<'a, S, A, T, B> where S: AsRef<A> + 'a, A: AsRef<S> + 'a, T: AsRef<B> + 'a, B: AsRef<T> + 'a { fn fmt(&self, fm: &mut Formatter) -> fmt::Result { fm.debug_struct("ConvRef") .field("phantom_sa", &self.phantom_sa) .field("phantom_bt", &self.phantom_bt) .finish() } } impl<'a, S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized> Clone for ConvRef<'a, S, A, T, B> where S: AsRef<A> + 'a, A: AsRef<S> + 'a, T: AsRef<B> + 'a, B: AsRef<T> + 'a { #[inline] fn clone(&self) -> Self { *self } #[inline] fn clone_from(&mut self, source: &Self) { *self = *source; } } impl<'a, S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized> Copy for ConvRef<'a, S, A, T, B> where S: AsRef<A> + 'a, A: AsRef<S> + 'a, T: AsRef<B> + 'a, B: AsRef<T> + 'a { } impl<'a, S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized> Default for ConvRef<'a, S, A, T, B> where S: AsRef<A> + 'a, A: AsRef<S> + 'a, T: AsRef<B> + 'a, B: AsRef<T> + 'a { #[inline] fn default() -> Self { Self::mk() } } impl<'a, S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized> Lenticuloid for ConvRef<'a, S, A, T, B> where S: AsRef<A> + 'a, A: AsRef<S> + 'a, T: AsRef<B> + 'a, B: AsRef<T> + 'a { type InitialSource = &'a S; type InitialTarget = &'a A; type FinalSource = &'a T; type FinalTarget = &'a B; type AtInitial = ConvRef<'a, S, A, S, A>; fn at_initial(&self) -> Self::AtInitial { ConvRef::mk() } type AtFinal = ConvRef<'a, T, B, T, B>; fn at_final(&self) -> Self::AtFinal { ConvRef::mk() } } impl<'a, S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized> PartialLens for ConvRef<'a, S, A, T, B> where S: AsRef<A> + 'a, A: AsRef<S> + 'a, T: AsRef<B> + 'a, B: AsRef<T> + 'a { #[inline] fn try_get(&self, v: Self::InitialSource) -> Result<Self::InitialTarget, Self::FinalSource> { Ok(v.as_ref()) } #[inline] fn try_get_inject(&self, v: Self::InitialSource) -> Result<(Self::InitialTarget, Injector<Self::FinalTarget, Self::FinalSource>), Self::FinalSource> { Ok((v.as_ref(), util::once_to_mut(move |x: Self::FinalTarget| -> Self::FinalSource { x.as_ref() }))) } #[inline] fn set(&self, _v: Self::InitialSource, x: Self::FinalTarget) -> Self::FinalSource { x.as_ref() } fn exchange(&self, v: Self::InitialSource, x: Self::FinalTarget) -> (Option<Self::InitialTarget>, Self::FinalSource) { (Some(v.as_ref()), x.as_ref()) } #[inline] fn modify<F>(&self, v: Self::InitialSource, f: F) -> Self::FinalSource where F: FnOnce(Self::InitialTarget) -> Self::FinalTarget { f(v.as_ref()).as_ref() } #[inline] fn modify_with<F, X>(&self, v: Self::InitialSource, f: F) -> (Self::FinalSource, Option<X>) where F: FnOnce(Self::InitialTarget) -> (Self::FinalTarget, X) { let (a, b) = f(v.as_ref()); (a.as_ref(), Some(b)) } } impl<'a, S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized> Lens for ConvRef<'a, S, A, T, B> where S: AsRef<A> + 'a, A: AsRef<S> + 'a, T: AsRef<B> + 'a, B: AsRef<T> + 'a { #[inline] fn get(&self, v: Self::InitialSource) -> Self::InitialTarget { v.as_ref() } } impl<'a, S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized> Prism for ConvRef<'a, S, A, T, B> where S: AsRef<A> + 'a, A: AsRef<S> + 'a, T: AsRef<B> + 'a, B: AsRef<T> + 'a { #[inline] fn inject(&self, v: Self::FinalTarget) -> Self::FinalSource { v.as_ref() } } impl<'a, S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized> Iso for ConvRef<'a, S, A, T, B> where S: AsRef<A> + 'a, A: AsRef<S> + 'a, T: AsRef<B> + 'a, B: AsRef<T> + 'a { } /// An isomorphism family that handles lossless conversions by mutable /// reference. pub struct ConvMut<'a, S: ?Sized + 'a, A: ?Sized + 'a = S, T: ?Sized + 'a = S, B: ?Sized + 'a = T> { phantom_sa: PhantomData<Fn(&'a mut S) -> &'a mut A>, phantom_bt: PhantomData<Fn(&'a mut B) -> &'a mut T>, } impl<'a, S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized> ConvMut<'a, S, A, T, B> where S: AsMut<A> + 'a, A: AsMut<S> + 'a, T: AsMut<B> + 'a, B: AsMut<T> + 'a { #[cfg(not(feature = "nightly"))] #[inline] pub fn mk() -> Self { ConvMut { phantom_sa: PhantomData, phantom_bt: PhantomData, } } #[cfg(feature = "nightly")] #[inline] pub const fn mk() -> Self { ConvMut { phantom_sa: PhantomData, phantom_bt: PhantomData, } } } impl<'a, S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized> Debug for ConvMut<'a, S, A, T, B> where S: AsMut<A> + 'a, A: AsMut<S> + 'a, T: AsMut<B> + 'a, B: AsMut<T> + 'a { fn fmt(&self, fm: &mut Formatter) -> fmt::Result { fm.debug_struct("ConvMut") .field("phantom_sa", &self.phantom_sa) .field("phantom_bt", &self.phantom_bt) .finish() } } impl<'a, S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized> Clone for ConvMut<'a, S, A, T, B> where S: AsMut<A> + 'a, A: AsMut<S> + 'a, T: AsMut<B> + 'a, B: AsMut<T> + 'a { #[inline] fn clone(&self) -> Self { *self } #[inline] fn clone_from(&mut self, source: &Self) { *self = *source; } } impl<'a, S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized> Copy for ConvMut<'a, S, A, T, B> where S: AsMut<A> + 'a, A: AsMut<S> + 'a, T: AsMut<B> + 'a, B: AsMut<T> + 'a { } impl<'a, S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized> Default for ConvMut<'a, S, A, T, B> where S: AsMut<A> + 'a, A: AsMut<S> + 'a, T: AsMut<B> + 'a, B: AsMut<T> + 'a { #[inline] fn default() -> Self { Self::mk() } } impl<'a, S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized> Lenticuloid for ConvMut<'a, S, A, T, B> where S: AsMut<A> + 'a, A: AsMut<S> + 'a, T: AsMut<B> + 'a, B: AsMut<T> + 'a { type InitialSource = &'a mut S; type InitialTarget = &'a mut A; type FinalSource = &'a mut T; type FinalTarget = &'a mut B; type AtInitial = ConvMut<'a, S, A, S, A>; fn at_initial(&self) -> Self::AtInitial { ConvMut::mk() } type AtFinal = ConvMut<'a, T, B, T, B>; fn at_final(&self) -> Self::AtFinal { ConvMut::mk() } } impl<'a, S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized> PartialLens for ConvMut<'a, S, A, T, B> where S: AsMut<A> + 'a, A: AsMut<S> + 'a, T: AsMut<B> + 'a, B: AsMut<T> + 'a { #[inline] fn try_get(&self, v: Self::InitialSource) -> Result<Self::InitialTarget, Self::FinalSource> { Ok(v.as_mut()) } #[inline] fn try_get_inject(&self, v: Self::InitialSource) -> Result<(Self::InitialTarget, Injector<Self::FinalTarget, Self::FinalSource>), Self::FinalSource> { Ok((v.as_mut(), util::once_to_mut(move |x: Self::FinalTarget| -> Self::FinalSource { x.as_mut() }))) } #[inline] fn set(&self, _v: Self::InitialSource, x: Self::FinalTarget) -> Self::FinalSource { x.as_mut() } #[inline] fn exchange(&self, v: Self::InitialSource, x: Self::FinalTarget) -> (Option<Self::InitialTarget>, Self::FinalSource) { (Some(v.as_mut()), x.as_mut()) } #[inline] fn modify<F>(&self, v: Self::InitialSource, f: F) -> Self::FinalSource where F: FnOnce(Self::InitialTarget) -> Self::FinalTarget { f(v.as_mut()).as_mut() } #[inline] fn modify_with<F, X>(&self, v: Self::InitialSource, f: F) -> (Self::FinalSource, Option<X>) where F: FnOnce(Self::InitialTarget) -> (Self::FinalTarget, X) { let (a, b) = f(v.as_mut()); (a.as_mut(), Some(b)) } } impl<'a, S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized> Lens for ConvMut<'a, S, A, T, B> where S: AsMut<A> + 'a, A: AsMut<S> + 'a, T: AsMut<B> + 'a, B: AsMut<T> + 'a { #[inline] fn get(&self, v: Self::InitialSource) -> Self::InitialTarget { v.as_mut() } } impl<'a, S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized> Prism for ConvMut<'a, S, A, T, B> where S: AsMut<A> + 'a, A: AsMut<S> + 'a, T: AsMut<B> + 'a, B: AsMut<T> + 'a { #[inline] fn inject(&self, v: Self::FinalTarget) -> Self::FinalSource { v.as_mut() } } impl<'a, S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized> Iso for ConvMut<'a, S, A, T, B> where S: AsMut<A> + 'a, A: AsMut<S> + 'a, T: AsMut<B> + 'a, B: AsMut<T> + 'a { }
25.633803
100
0.484684
5664529c86b61dd04b283380ca1997076c0e61ff
321
go
Go
database/mysql/mysql_helper.go
Anderson-Lu/goscrew
3e6c4c2da4203fbbfa8dd3333c371f2ef770bbcb
[ "MIT" ]
1
2018-10-21T11:33:03.000Z
2018-10-21T11:33:03.000Z
database/mysql/mysql_helper.go
Anderson-Lu/gobox
3e6c4c2da4203fbbfa8dd3333c371f2ef770bbcb
[ "MIT" ]
null
null
null
database/mysql/mysql_helper.go
Anderson-Lu/gobox
3e6c4c2da4203fbbfa8dd3333c371f2ef770bbcb
[ "MIT" ]
null
null
null
package mysql import ( "fmt" "github.com/jinzhu/gorm" _ "github.com/jinzhu/gorm/dialects/mysql" ) func NewMysqlClient(host, dbname, user, pwd string) (*gorm.DB, error) { db, err := gorm.Open("mysql", fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8&parseTime=True&loc=Local", user, pwd, host, dbname)) return db, err }
22.928571
126
0.685358
a9a6a842edb571f1c4321afd3645c77151ca3dde
27,366
html
HTML
estimateFIM.html
rhymesg/MC_CRB_nonGaussian
fd7df2f1899965aee68adc1c58ce78a3d5e8d77e
[ "MIT" ]
1
2021-01-12T10:48:21.000Z
2021-01-12T10:48:21.000Z
estimateFIM.html
rhymesg/MC_CRB_nonGaussian
fd7df2f1899965aee68adc1c58ce78a3d5e8d77e
[ "MIT" ]
1
2020-07-14T12:05:35.000Z
2020-07-26T22:42:36.000Z
estimateFIM.html
rhymesg/MC_CRB_nonGaussian
fd7df2f1899965aee68adc1c58ce78a3d5e8d77e
[ "MIT" ]
null
null
null
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!-- This HTML was auto-generated from MATLAB code. To make changes, update the MATLAB code and republish this document. --><title>estimateFIM</title><meta name="generator" content="MATLAB 7.12"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2011-10-09"><meta name="DC.source" content="estimateFIM.m"><style type="text/css"> body { background-color: white; margin:10px; } h1 { color: #990000; font-size: x-large; } h2 { color: #990000; font-size: medium; } /* Make the text shrink to fit narrow windows, but not stretch too far in wide windows. */ p,h1,h2,div.content div { max-width: 600px; /* Hack for IE6 */ width: auto !important; width: 600px; } pre.codeinput { background: #EEEEEE; padding: 10px; } @media print { pre.codeinput {word-wrap:break-word; width:100%;} } span.keyword {color: #0000FF} span.comment {color: #228B22} span.string {color: #A020F0} span.untermstring {color: #B20000} span.syscmd {color: #B28C00} pre.codeoutput { color: #666666; padding: 10px; } pre.error { color: red; } p.footer { text-align: right; font-size: xx-small; font-weight: lighter; font-style: italic; color: gray; } </style></head><body><div class="content"><pre class="codeinput"><span class="comment">% estimateFIM.m: Estimation of FIM per Spall 2005 and Das et al 2010 (citation detail</span> <span class="comment">% below).</span> <span class="comment">%</span> <span class="comment">% *************************************************************************</span> <span class="comment">%</span> <span class="comment">% This file and the supporting matlab files can be found at</span> <span class="comment">% http://lotus.eng.buffalo.edu/Sonjoy_Das/Software.html</span> <span class="comment">%</span> <span class="comment">% Written by Sonjoy Das, sonjoy@buffalo.edu</span> <span class="comment">% The Johns Hopkins University</span> <span class="comment">% January, 2007</span> <span class="comment">% [Currently, at University at Buffalo]</span> <span class="comment">%</span> <span class="comment">% Please cite my following work if you use this file:</span> <span class="comment">% Sonjoy Das, James C. Spall, and Roger Ghanem, ``Efficient Monte</span> <span class="comment">% Carlo computation of Fisher information matrix using prior</span> <span class="comment">% information,'' Computational Statistics and Data Analysis, v. 54,</span> <span class="comment">% no. 2, pp. 272&#150;289, 2010, doi:10.1016/j.csda.2009.09.018.</span> <span class="comment">%</span> <span class="comment">% If you find any bugs, please send me an e-mail.</span> <span class="comment">%</span> <span class="comment">% USAGE:</span> <span class="comment">% 1. Input your problem data in inputfile.m (the data in this file is</span> <span class="comment">% shown for Example 1 of Das et. al. 2010).</span> <span class="comment">% 2. Compute the log-likelihood function in loglikelihood.m (the</span> <span class="comment">% provided function loglikelihood.m is shown for Example 1 of Das</span> <span class="comment">% et. al. 2010; edit loglikelihood_user.m to create your own).</span> <span class="comment">% 3. Compute the gradient vector in gradvec.m (the provided function</span> <span class="comment">% gradvec.m is shown for Example 1 of Das et. al. 2010; edit</span> <span class="comment">% gradvec_user.m to create your own).</span> <span class="comment">% 4. Generate Zpseudo data vector according to your distribution (see</span> <span class="comment">% generateZpseudo.m shown for Example 1 of Das et. al. 2010).</span> <span class="comment">%</span> <span class="comment">% ... you're ready to estimate the FIM. Now, just type estimateFIM at the</span> <span class="comment">% MATLAB prompt.</span> <span class="comment">% *************************************************************************</span> <span class="comment">%</span> inputfile <span class="comment">% Input file (use data for Example 1 of Das et al 2010).</span> <span class="comment">%</span> <span class="comment">% Initialization</span> HhatLbar = zeros(p,p); <span class="comment">% Per Spall 2005</span> <span class="keyword">switch</span> lower(measurement) <span class="keyword">case</span> <span class="string">'both'</span> Hhatgbar = zeros(p,p); <span class="comment">% Per Spall 2005</span> <span class="keyword">end</span> <span class="keyword">switch</span> lower(scheme) <span class="keyword">case</span> <span class="string">'das2010'</span> HtldeLbar = zeros(p,p); <span class="comment">% Per Das et al 2010</span> <span class="keyword">switch</span> lower(measurement) <span class="keyword">case</span> <span class="string">'both'</span> Htldegbar = zeros(p,p); <span class="comment">% Per Das et al 2010</span> <span class="keyword">end</span> <span class="keyword">end</span> <span class="comment">%</span> fprintf([<span class="string">'\nEstimating FIM estimates by using Spall 2005 and Das et al 2010...\n'</span>]) <span class="comment">%</span> <span class="keyword">for</span> iN = 1:1:N generateZpseudo <span class="comment">% Generate pseudo data according to given distribution</span> <span class="comment">% (see generateZpseudo.m for Example 1 of Das et al 2010)</span> <span class="comment">%</span> Delk=2*round(rand(p,1))-1; Delk_tlde=2*round(rand(p,1))-1; <span class="comment">%</span> <span class="comment">%%%% Estimation of FIM based on log-likelihood measurements %%%%</span> thetpp = thet + (c_tlde*Delk_tlde) + (c*Delk); thetp = thet + (c*Delk); G1plus = (1/c_tlde)*(loglikelihood(thetpp,Zpseudo)- <span class="keyword">...</span> loglikelihood(thetp,Zpseudo))*(1./Delk_tlde); <span class="comment">% Calling loglikelihood.m</span> <span class="comment">%</span> thetpm = thet + (c_tlde*Delk_tlde) - (c*Delk); thetm = thet - (c*Delk); G1minus = (1/c_tlde)*(loglikelihood(thetpm,Zpseudo)- <span class="keyword">...</span> loglikelihood(thetm,Zpseudo))*(1./Delk_tlde); <span class="comment">% Calling loglikelihood.m</span> <span class="comment">%</span> JhatL = (1/(2*c))*(G1plus - G1minus)*(1./Delk)'; <span class="comment">% Jacobian estimate</span> <span class="comment">% based on log-likelihood measurements by using Spall 2005</span> <span class="comment">%</span> Hhat0L = (1/2)*(JhatL+JhatL'); <span class="comment">% Hessian estimate based on</span> <span class="comment">% log-likelihood measurements by using Spall 2005.</span> <span class="comment">%</span> <span class="keyword">switch</span> lower(scheme) <span class="keyword">case</span> <span class="string">'das2010'</span> Dk = Delk*(1./Delk)'; Dk_tlde = Delk_tlde*(1./Delk_tlde)'; <span class="comment">%</span> JtldeL = JhatL - (Dk_tlde'*(-Fgvn)*Dk); <span class="comment">% Jacobian estimate</span> <span class="comment">% based on log-likelihood measurements by using Das et</span> <span class="comment">% al 2010</span> <span class="comment">%</span> Htlde0L = (1/2)*(JtldeL+JtldeL'); <span class="comment">% Estimate of H_k0 based</span> <span class="comment">% on log-likelihood measurements by using Das et al</span> <span class="comment">% 2010.</span> <span class="keyword">end</span> <span class="comment">%</span> <span class="comment">%%%% Estimation of FIM based on gradient vector measurements %%%%</span> <span class="keyword">switch</span> lower(measurement) <span class="keyword">case</span> <span class="string">'both'</span> thetp = thet + (c*Delk); thetm = thet - (c*Delk); gplus = gradvec(thetp,Zpseudo); <span class="comment">% Calling gradvec.m</span> gminus = gradvec(thetm,Zpseudo); <span class="comment">% Calling gradvec.m</span> <span class="comment">%</span> Jhatg = (1/(2*c))*(gplus - gminus)*(1./Delk)'; <span class="comment">% Jacobian</span> <span class="comment">% estimate based on gradient vector measurements by</span> <span class="comment">% using Spall 2005.</span> <span class="comment">%</span> Hhat0g = (1/2)*(Jhatg+Jhatg'); <span class="comment">% Hessian estimate based on</span> <span class="comment">% gradient vector measurements by using Spall 2005.</span> <span class="comment">%</span> <span class="keyword">switch</span> lower(scheme) <span class="keyword">case</span> <span class="string">'das2010'</span> Jtldeg = Jhatg - (-Fgvn*Dk); <span class="comment">% Jacobian estimate</span> <span class="comment">% based on gradient vector measurements by</span> <span class="comment">% using Das et al 2010.</span> <span class="comment">%</span> Htlde0g = (1/2)*(Jtldeg+Jtldeg'); <span class="comment">% Estimate of</span> <span class="comment">% H_k0 based on gradient vector</span> <span class="comment">% measurements by using Das et al 2010.</span> <span class="keyword">end</span> <span class="keyword">end</span> <span class="comment">%</span> <span class="comment">%</span> HhatL = Hhat0L; <span class="keyword">switch</span> lower(measurement) <span class="keyword">case</span> <span class="string">'both'</span> Hhatg = Hhat0g; <span class="keyword">end</span> <span class="keyword">switch</span> lower(scheme) <span class="keyword">case</span> <span class="string">'das2010'</span> HtldeL = Htlde0L; <span class="keyword">switch</span> lower(measurement) <span class="keyword">case</span> <span class="string">'both'</span> Htldeg = Htlde0g; <span class="keyword">end</span> <span class="comment">%</span> <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span> <span class="comment">%%%% Substitution of negative of the known elements of FIM into</span> <span class="comment">%%%% the Hessian estimates based on modified algorithm</span> <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span> <span class="keyword">for</span> iK = 1:1:length(KnwnFIMindex(:,1)) irow = KnwnFIMindex(iK,1); jcol = KnwnFIMindex(iK,2); <span class="keyword">switch</span> lower(NaiveSubstitution) <span class="keyword">case</span> <span class="string">'yes'</span> <span class="comment">% Naive approach: prior information is also used</span> <span class="comment">% in Spall 2005</span> HhatL(irow,jcol) = -Fgvn(irow,jcol); HhatL(jcol,irow) = HhatL(irow,jcol); <span class="keyword">end</span> HtldeL(irow,jcol) = -Fgvn(irow,jcol); <span class="comment">% Das et al 2010</span> <span class="keyword">switch</span> lower(measurement) <span class="keyword">case</span> <span class="string">'both'</span> <span class="keyword">switch</span> lower(NaiveSubstitution) <span class="keyword">case</span> <span class="string">'yes'</span> <span class="comment">% Naive approach: prior information is also</span> <span class="comment">% used in Spall 2005</span> Hhatg(irow,jcol) = -Fgvn(irow,jcol); Hhatg(jcol,irow) = Hhatg(irow,jcol); <span class="keyword">end</span> Htldeg(irow,jcol) = -Fgvn(irow,jcol); <span class="comment">% Das et al 2010</span> Htldeg(jcol,irow) = Htldeg(irow,jcol); <span class="comment">% Das et al 2010</span> <span class="keyword">end</span> <span class="keyword">end</span> <span class="keyword">end</span> <span class="comment">%</span> HhatLbar = (((iN-1)/iN)*HhatLbar) + ((1/iN)*HhatL); <span class="keyword">switch</span> lower(measurement) <span class="keyword">case</span> <span class="string">'both'</span> Hhatgbar = (((iN-1)/iN)*Hhatgbar) + ((1/iN)*Hhatg); <span class="keyword">end</span> <span class="keyword">switch</span> lower(scheme) <span class="keyword">case</span> <span class="string">'das2010'</span> HtldeLbar = (((iN-1)/iN)*HtldeLbar) + ((1/iN)*HtldeL); <span class="keyword">switch</span> lower(measurement) <span class="keyword">case</span> <span class="string">'both'</span> Htldegbar = (((iN-1)/iN)*Htldegbar) + ((1/iN)*Htldeg); <span class="keyword">end</span> <span class="keyword">end</span> <span class="comment">%</span> <span class="comment">%%%%%%%%%%%%%%</span> FhatL = -HhatLbar; <span class="comment">% if min(eig(FhatL)) &lt; 0; FhatL = sqrtm(FhatL*FhatL);end</span> <span class="keyword">switch</span> lower(measurement) <span class="keyword">case</span> <span class="string">'both'</span> Fhatg = -Hhatgbar; <span class="comment">% if min(eig(Fhatg)) &lt; 0; Fhatg = sqrtm(Fhatg*Fhatg);end</span> <span class="keyword">end</span> </pre><pre class="codeinput"> <span class="keyword">switch</span> lower(scheme) <span class="keyword">case</span> <span class="string">'das2010'</span> FtldeL = -HtldeLbar; <span class="comment">% if min(eig(FtldeL)) &lt; 0; FtldeL = sqrtm(FtldeL*FtldeL);end</span> <span class="keyword">switch</span> lower(measurement) <span class="keyword">case</span> <span class="string">'both'</span> Ftldeg = -Htldegbar; <span class="comment">% if min(eig(Ftldeg)) &lt; 0; Ftldeg = sqrtm(Ftldeg*Ftldeg);end</span> <span class="keyword">end</span> <span class="keyword">end</span> <span class="comment">%</span> <span class="keyword">end</span> <span class="comment">% End of for iN = 1:1:N</span> <span class="comment">%</span> fprintf([<span class="string">'\nFhatL: The FIM estimate based on log-likelihood '</span><span class="keyword">...</span> <span class="string">'measurements by using Spall 2005.\n'</span>]), FhatL <span class="keyword">switch</span> lower(measurement) <span class="keyword">case</span> <span class="string">'both'</span> fprintf([<span class="string">'\nFhatg: The FIM estimate based on gradient vector '</span><span class="keyword">...</span> <span class="string">'measurements by using Spall 2005.\n'</span>]), Fhatg <span class="keyword">end</span> <span class="keyword">switch</span> lower(scheme) <span class="keyword">case</span> <span class="string">'das2010'</span> fprintf([<span class="string">'\nFtldeL: The FIM estimate based on log-likelihood '</span><span class="keyword">...</span> <span class="string">'measurements by using Das et al 2010.\n'</span>]), FtldeL <span class="keyword">switch</span> lower(measurement) <span class="keyword">case</span> <span class="string">'both'</span> fprintf([<span class="string">'\nFtldeg: The FIM estimate based on gradient vector '</span><span class="keyword">...</span> <span class="string">'measurements by using Das et al 2010.\n'</span>]), Ftldeg <span class="keyword">end</span> <span class="keyword">end</span> </pre><pre class="codeoutput">This is an extension of Example 13.7 in ISSO. In this problem, theta = (mu, sigma^2,alpha), where q_i = q_i(alpha) for all i. It is considered here q_i(alpha) = (c_i)(alpha), where the c_i are some non-negative constants and alpha &gt; 0. Different values of c_i across i are required to generate a full rank F. dim(theta) = p = 3, Number of data = n = 30, Number of pseudodata vector = N = 1000, theta(1) = mu = 0, theta(2) = variance = 1, theta(3) = alpha = 1. The value of c in (Bernoulli +/- c) for Delta: 0.0001 The value of tilde{c} in (Bernoulli +/- tilde{c}) for tilde{Delta}: 0.00011 Computing the analytical FIM... Eigenvalues the analytical FIM: ans = 0.5466 8.7517 20.9004 The known elements of the FIM. Fgvn = 20.9004 0 0 0 7.5994 0 0 0 0 Estimating FIM estimates by using Spall 2005 and Das et al 2010... FhatL: The FIM estimate based on log-likelihood measurements by using Spall 2005. FhatL = 20.6170 -0.6096 -0.4288 -0.6096 7.1443 2.8675 -0.4288 2.8675 1.1888 Fhatg: The FIM estimate based on gradient vector measurements by using Spall 2005. Fhatg = 20.9130 -0.6753 -0.1488 -0.6753 7.2657 2.5476 -0.1488 2.5476 1.4758 FtldeL: The FIM estimate based on log-likelihood measurements by using Das et al 2010. FtldeL = 20.9004 0 -0.0697 -0.0966 7.5994 2.7022 -0.0697 2.7022 1.6790 Ftldeg: The FIM estimate based on gradient vector measurements by using Das et al 2010. Ftldeg = 20.9004 0 -0.2115 0 7.5994 2.6920 -0.2115 2.6920 1.4758 </pre><p class="footer"><br> Published with MATLAB&reg; 7.12<br></p></div><!-- ##### SOURCE BEGIN ##### % estimateFIM.m: Estimation of FIM per Spall 2005 and Das et al 2010 (citation detail % below). % % ************************************************************************* % % This file and the supporting matlab files can be found at % http://lotus.eng.buffalo.edu/Sonjoy_Das/Software.html % % Written by Sonjoy Das, sonjoy@buffalo.edu % The Johns Hopkins University % January, 2007 % [Currently, at University at Buffalo] % % Please cite my following work if you use this file: % Sonjoy Das, James C. Spall, and Roger Ghanem, ``Efficient Monte % Carlo computation of Fisher information matrix using prior % information,'' Computational Statistics and Data Analysis, v. 54, % no. 2, pp. 272–289, 2010, doi:10.1016/j.csda.2009.09.018. % % If you find any bugs, please send me an e-mail. % % USAGE: % 1. Input your problem data in inputfile.m (the data in this file is % shown for Example 1 of Das et. al. 2010). % 2. Compute the log-likelihood function in loglikelihood.m (the % provided function loglikelihood.m is shown for Example 1 of Das % et. al. 2010; edit loglikelihood_user.m to create your own). % 3. Compute the gradient vector in gradvec.m (the provided function % gradvec.m is shown for Example 1 of Das et. al. 2010; edit % gradvec_user.m to create your own). % 4. Generate Zpseudo data vector according to your distribution (see % generateZpseudo.m shown for Example 1 of Das et. al. 2010). % % ... you're ready to estimate the FIM. Now, just type estimateFIM at the % MATLAB prompt. % ************************************************************************* % inputfile % Input file (use data for Example 1 of Das et al 2010). % % Initialization HhatLbar = zeros(p,p); % Per Spall 2005 switch lower(measurement) case 'both' Hhatgbar = zeros(p,p); % Per Spall 2005 end switch lower(scheme) case 'das2010' HtldeLbar = zeros(p,p); % Per Das et al 2010 switch lower(measurement) case 'both' Htldegbar = zeros(p,p); % Per Das et al 2010 end end % fprintf(['\nEstimating FIM estimates by using Spall 2005 and Das et al 2010...\n']) % for iN = 1:1:N generateZpseudo % Generate pseudo data according to given distribution % (see generateZpseudo.m for Example 1 of Das et al 2010) % Delk=2*round(rand(p,1))-1; Delk_tlde=2*round(rand(p,1))-1; % %%%% Estimation of FIM based on log-likelihood measurements %%%% thetpp = thet + (c_tlde*Delk_tlde) + (c*Delk); thetp = thet + (c*Delk); G1plus = (1/c_tlde)*(loglikelihood(thetpp,Zpseudo)- ... loglikelihood(thetp,Zpseudo))*(1./Delk_tlde); % Calling loglikelihood.m % thetpm = thet + (c_tlde*Delk_tlde) - (c*Delk); thetm = thet - (c*Delk); G1minus = (1/c_tlde)*(loglikelihood(thetpm,Zpseudo)- ... loglikelihood(thetm,Zpseudo))*(1./Delk_tlde); % Calling loglikelihood.m % JhatL = (1/(2*c))*(G1plus - G1minus)*(1./Delk)'; % Jacobian estimate % based on log-likelihood measurements by using Spall 2005 % Hhat0L = (1/2)*(JhatL+JhatL'); % Hessian estimate based on % log-likelihood measurements by using Spall 2005. % switch lower(scheme) case 'das2010' Dk = Delk*(1./Delk)'; Dk_tlde = Delk_tlde*(1./Delk_tlde)'; % JtldeL = JhatL - (Dk_tlde'*(-Fgvn)*Dk); % Jacobian estimate % based on log-likelihood measurements by using Das et % al 2010 % Htlde0L = (1/2)*(JtldeL+JtldeL'); % Estimate of H_k0 based % on log-likelihood measurements by using Das et al % 2010. end % %%%% Estimation of FIM based on gradient vector measurements %%%% switch lower(measurement) case 'both' thetp = thet + (c*Delk); thetm = thet - (c*Delk); gplus = gradvec(thetp,Zpseudo); % Calling gradvec.m gminus = gradvec(thetm,Zpseudo); % Calling gradvec.m % Jhatg = (1/(2*c))*(gplus - gminus)*(1./Delk)'; % Jacobian % estimate based on gradient vector measurements by % using Spall 2005. % Hhat0g = (1/2)*(Jhatg+Jhatg'); % Hessian estimate based on % gradient vector measurements by using Spall 2005. % switch lower(scheme) case 'das2010' Jtldeg = Jhatg - (-Fgvn*Dk); % Jacobian estimate % based on gradient vector measurements by % using Das et al 2010. % Htlde0g = (1/2)*(Jtldeg+Jtldeg'); % Estimate of % H_k0 based on gradient vector % measurements by using Das et al 2010. end end % % HhatL = Hhat0L; switch lower(measurement) case 'both' Hhatg = Hhat0g; end switch lower(scheme) case 'das2010' HtldeL = Htlde0L; switch lower(measurement) case 'both' Htldeg = Htlde0g; end % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%% Substitution of negative of the known elements of FIM into %%%% the Hessian estimates based on modified algorithm %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for iK = 1:1:length(KnwnFIMindex(:,1)) irow = KnwnFIMindex(iK,1); jcol = KnwnFIMindex(iK,2); switch lower(NaiveSubstitution) case 'yes' % Naive approach: prior information is also used % in Spall 2005 HhatL(irow,jcol) = -Fgvn(irow,jcol); HhatL(jcol,irow) = HhatL(irow,jcol); end HtldeL(irow,jcol) = -Fgvn(irow,jcol); % Das et al 2010 switch lower(measurement) case 'both' switch lower(NaiveSubstitution) case 'yes' % Naive approach: prior information is also % used in Spall 2005 Hhatg(irow,jcol) = -Fgvn(irow,jcol); Hhatg(jcol,irow) = Hhatg(irow,jcol); end Htldeg(irow,jcol) = -Fgvn(irow,jcol); % Das et al 2010 Htldeg(jcol,irow) = Htldeg(irow,jcol); % Das et al 2010 end end end % HhatLbar = (((iN-1)/iN)*HhatLbar) + ((1/iN)*HhatL); switch lower(measurement) case 'both' Hhatgbar = (((iN-1)/iN)*Hhatgbar) + ((1/iN)*Hhatg); end switch lower(scheme) case 'das2010' HtldeLbar = (((iN-1)/iN)*HtldeLbar) + ((1/iN)*HtldeL); switch lower(measurement) case 'both' Htldegbar = (((iN-1)/iN)*Htldegbar) + ((1/iN)*Htldeg); end end % %%%%%%%%%%%%%% FhatL = -HhatLbar; % if min(eig(FhatL)) < 0; FhatL = sqrtm(FhatL*FhatL);end switch lower(measurement) case 'both' Fhatg = -Hhatgbar; % if min(eig(Fhatg)) < 0; Fhatg = sqrtm(Fhatg*Fhatg);end end %%% switch lower(scheme) case 'das2010' FtldeL = -HtldeLbar; % if min(eig(FtldeL)) < 0; FtldeL = sqrtm(FtldeL*FtldeL);end switch lower(measurement) case 'both' Ftldeg = -Htldegbar; % if min(eig(Ftldeg)) < 0; Ftldeg = sqrtm(Ftldeg*Ftldeg);end end end % end % End of for iN = 1:1:N % fprintf(['\nFhatL: The FIM estimate based on log-likelihood '... 'measurements by using Spall 2005.\n']), FhatL switch lower(measurement) case 'both' fprintf(['\nFhatg: The FIM estimate based on gradient vector '... 'measurements by using Spall 2005.\n']), Fhatg end switch lower(scheme) case 'das2010' fprintf(['\nFtldeL: The FIM estimate based on log-likelihood '... 'measurements by using Das et al 2010.\n']), FtldeL switch lower(measurement) case 'both' fprintf(['\nFtldeg: The FIM estimate based on gradient vector '... 'measurements by using Das et al 2010.\n']), Ftldeg end end ##### SOURCE END ##### --></body></html>
47.264249
254
0.566433
dfea2e114ef676cb3a0677d0ec4d61a152e1cc40
402
swift
Swift
Example/Dependency Inversion Principle/Wrong/DataCustomerLogic.swift
rinoarmadiaz/MovieDB-VIPER-iOS
c4a54eb463c5b47fe72083a06f94a26fb77b8b31
[ "MIT" ]
null
null
null
Example/Dependency Inversion Principle/Wrong/DataCustomerLogic.swift
rinoarmadiaz/MovieDB-VIPER-iOS
c4a54eb463c5b47fe72083a06f94a26fb77b8b31
[ "MIT" ]
null
null
null
Example/Dependency Inversion Principle/Wrong/DataCustomerLogic.swift
rinoarmadiaz/MovieDB-VIPER-iOS
c4a54eb463c5b47fe72083a06f94a26fb77b8b31
[ "MIT" ]
null
null
null
// // DataCustomerLogic.swift // Viper App Wrong Example // // Created by Rino Armadiaz on 09/10/20. // class DataCustomerLogic { init() { /* Instantiate dataAccess with DataAccessFactory.getDataAccessObject */ let dataAccess = DataAccessFactory.getDataAccessObject() /* Call dataAccess.getCustomerName function */ _ = dataAccess.getCustomerName(id: 1) } }
23.647059
79
0.679104
169580292a86efd399179f41e8f1c62e36df0679
510
ts
TypeScript
node_modules/@aws-sdk/util-waiter/dist-types/createWaiter.d.ts
aouinaayoub/Ghost-4-di
a8b50c4acba28a382d4328209cc0dffa62014ba9
[ "MIT" ]
2
2021-11-29T12:48:06.000Z
2021-11-29T16:30:20.000Z
node_modules/@aws-sdk/util-waiter/dist-types/createWaiter.d.ts
aouinaayoub/Ghost-4-di
a8b50c4acba28a382d4328209cc0dffa62014ba9
[ "MIT" ]
9
2022-03-12T09:24:04.000Z
2022-03-27T16:30:29.000Z
node_modules/@aws-sdk/util-waiter/dist-types/createWaiter.d.ts
aouinaayoub/Ghost-4-di
a8b50c4acba28a382d4328209cc0dffa62014ba9
[ "MIT" ]
3
2021-02-26T00:30:30.000Z
2021-12-15T20:34:08.000Z
import { WaiterOptions, WaiterResult } from "./waiter"; /** * Create a waiter promise that only resolves when: * 1. Abort controller is signaled * 2. Max wait time is reached * 3. `acceptorChecks` succeeds, or fails * Otherwise, it invokes `acceptorChecks` with exponential-backoff delay. * * @internal */ export declare const createWaiter: <Client, Input>(options: WaiterOptions<Client>, input: Input, acceptorChecks: (client: Client, input: Input) => Promise<WaiterResult>) => Promise<WaiterResult>;
42.5
195
0.737255
56b383ab749915cb30d9044d438889a9688bff2e
620
go
Go
ClosurePendingStatusReason1.go
fgrid/iso20022
1ec3952e565835b0bac076d4b574f88cc7bd0f74
[ "MIT" ]
18
2016-04-13T22:39:32.000Z
2020-09-22T11:48:07.000Z
iso20022/ClosurePendingStatusReason1.go
fairxio/finance-messaging
00ea27edb2cfa113132e8d7a1bdb321e544feed2
[ "Apache-2.0" ]
4
2016-04-29T21:44:36.000Z
2016-06-06T21:20:04.000Z
ClosurePendingStatusReason1.go
fgrid/iso20022
1ec3952e565835b0bac076d4b574f88cc7bd0f74
[ "MIT" ]
11
2016-08-29T08:54:09.000Z
2019-12-17T04:55:33.000Z
package iso20022 // Reason for a closure pending status. type ClosurePendingStatusReason1 struct { // Reason for the closure pending status. Code *ClosurePendingStatusReason2Choice `xml:"Cd"` // Additional information about the reason for the closure pending status. AdditionalInformation *Max350Text `xml:"AddtlInf,omitempty"` } func (c *ClosurePendingStatusReason1) AddCode() *ClosurePendingStatusReason2Choice { c.Code = new(ClosurePendingStatusReason2Choice) return c.Code } func (c *ClosurePendingStatusReason1) SetAdditionalInformation(value string) { c.AdditionalInformation = (*Max350Text)(&value) }
29.52381
84
0.8
6ec5c17f6d33af7dee6cdb1cbfad34b26cf4a778
1,024
swift
Swift
Networking/Module/Classes/Protocols/NetworkRoute.swift
vegopunk/VegopunkNetworking
a6502ce1102cbe29a9c76698a69181168560b726
[ "MIT" ]
null
null
null
Networking/Module/Classes/Protocols/NetworkRoute.swift
vegopunk/VegopunkNetworking
a6502ce1102cbe29a9c76698a69181168560b726
[ "MIT" ]
null
null
null
Networking/Module/Classes/Protocols/NetworkRoute.swift
vegopunk/VegopunkNetworking
a6502ce1102cbe29a9c76698a69181168560b726
[ "MIT" ]
null
null
null
import Moya public protocol NetworkRoute: TargetType, CustomStringConvertible { associatedtype DecodeType: Decodable var urlType: BaseUrlType { get } var responseType: DecodeType.Type { get } var parameters: [String: Any] { get } } extension NetworkRoute { public var description: String { let urlString = urlType.urlString let parametersString = parameters.description let pathString = path let methodString = method.rawValue let sampleDataString = sampleData.description let headersString = headers?.description ?? "empty headers" let result = urlString + parametersString + pathString + methodString + sampleDataString + headersString return result } } extension NetworkRoute { public var baseURL: URL { urlType.url } public var responseType: DecodeType.Type { DecodeType.self } }
22.755556
67
0.611328
f983e4b12b14997a9a3deca1877335d02fd19182
1,655
go
Go
modules/userterm/userterm_test.go
herb-go/usersystem
085aa8477cee7be0270f8226e499676a440683c8
[ "MIT" ]
null
null
null
modules/userterm/userterm_test.go
herb-go/usersystem
085aa8477cee7be0270f8226e499676a440683c8
[ "MIT" ]
null
null
null
modules/userterm/userterm_test.go
herb-go/usersystem
085aa8477cee7be0270f8226e499676a440683c8
[ "MIT" ]
null
null
null
package userterm import ( "testing" "github.com/herb-go/herbsystem" "github.com/herb-go/usersystem/usersession" "github.com/herb-go/herbsecurity/authority" "github.com/herb-go/usersystem" ) func testSession(id string) *usersystem.Session { p := authority.NewPayloads() p.Set(usersystem.PayloadUID, []byte(id)) return usersystem.NewSession().WithType("test").WithPayloads(p) } type testService struct { Term string } //Start start service func (s *testService) Start() error { return nil } //Stop stop service func (s *testService) Stop() error { return nil } func (s *testService) MustCurrentTerm(uid string) string { return s.Term } func (s *testService) MustStartNewTerm(uid string) string { s.Term = "New" return s.Term } func (t *testService) Purge(uid string) error { return nil } func newTestService() *testService { return &testService{} } func TestTerm(t *testing.T) { s := usersystem.New() ss := newTestService() userterm := MustNewAndInstallTo(s) herbsystem.MustReady(s) userterm.Service = ss herbsystem.MustConfigure(s) if MustGetModule(s) != userterm.UserTerm { t.Fatal() } herbsystem.MustStart(s) defer herbsystem.MustStop(s) p := usersession.MustExecInitPayloads(s, s.SystemContext(), "test", "test") session := testSession("test").WithPayloads(p) ok := usersession.MustExecCheckSession(s, session) if !ok { t.Fatal() } userterm.MustStartNewTerm("test") ok = usersession.MustExecCheckSession(s, session) if ok { t.Fatal() } } func TestMustGetModule(t *testing.T) { s := usersystem.New() herbsystem.MustReady(s) herbsystem.MustConfigure(s) if MustGetModule(s) != nil { t.Fatal() } }
20.432099
76
0.720242
189d3840454c1e7160b377c59a6abdcd5d08b958
5,141
lua
Lua
game/scripts/vscripts/encounters/wind_harpy/wind_harpy_tornado_damage_modifier.lua
Sniqi/dungeoneer-dota2
2296c5241dcf1a8b7cca3e96b24f6acf337caee3
[ "MIT" ]
null
null
null
game/scripts/vscripts/encounters/wind_harpy/wind_harpy_tornado_damage_modifier.lua
Sniqi/dungeoneer-dota2
2296c5241dcf1a8b7cca3e96b24f6acf337caee3
[ "MIT" ]
null
null
null
game/scripts/vscripts/encounters/wind_harpy/wind_harpy_tornado_damage_modifier.lua
Sniqi/dungeoneer-dota2
2296c5241dcf1a8b7cca3e96b24f6acf337caee3
[ "MIT" ]
null
null
null
wind_harpy_tornado_damage_modifier = class({}) function wind_harpy_tornado_damage_modifier:OnCreated( kv ) self.AoERadius = self:GetAbility():GetSpecialValueFor("AoERadius") self.damage = self:GetAbility():GetSpecialValueFor("damage") self.damage_interval = self:GetAbility():GetSpecialValueFor("damage_interval") self.move_speed = self:GetAbility():GetSpecialValueFor("move_speed") self.phase_two = self:GetAbility():GetSpecialValueFor("phase_two") self.phase_two_move_speed = self:GetAbility():GetSpecialValueFor("phase_two_move_speed") self.phase_two_radius_percentage = self:GetAbility():GetSpecialValueFor("phase_two_radius_percentage") self.phase_three = self:GetAbility():GetSpecialValueFor("phase_three") self.phase_three_move_speed = self:GetAbility():GetSpecialValueFor("phase_three_move_speed") self.phase_three_radius_percentage= self:GetAbility():GetSpecialValueFor("phase_three_radius_percentage") if not IsServer() then return end local unit = self:GetParent() -- Particle -- self.particle = ParticleManager:CreateParticle("particles/units/heroes/hero_brewmaster/brewmaster_cyclone.vpcf", PATTACH_ABSORIGIN_FOLLOW, unit) ParticleManager:SetParticleControlEnt( self.particle, 0, unit, PATTACH_ABSORIGIN_FOLLOW, nil, unit:GetAbsOrigin(), true) PersistentParticle_Add(self.particle) self:StartIntervalThink(self.damage_interval) end function wind_harpy_tornado_damage_modifier:OnIntervalThink() if not IsServer() then return end local caster = self:GetCaster() local unit = self:GetParent() local unit_loc = unit:GetAbsOrigin() local team = caster:GetTeamNumber() local AoERadius = self.AoERadius local damage = self.damage * self.damage_interval -- PHASE 2 -- if caster:GetHealthPercent() < self.phase_two then AoERadius = AoERadius * ( 1 + (self.phase_two_radius_percentage / 100) ) end -- PHASE 3 -- if caster:GetHealthPercent() < self.phase_three then AoERadius = AoERadius * ( 1 + (self.phase_three_radius_percentage / 100) ) end -- DOTA_UNIT_TARGET_TEAM_FRIENDLY; DOTA_UNIT_TARGET_TEAM_ENEMY; DOTA_UNIT_TARGET_TEAM_BOTH local units = FindUnitsInRadius(team, unit_loc, nil, AoERadius, DOTA_UNIT_TARGET_TEAM_ENEMY, DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC, DOTA_UNIT_TARGET_FLAG_NONE, FIND_ANY_ORDER, false) for _,victim in pairs(units) do -- Apply Damage -- EncounterApplyDamage(victim, caster, self:GetAbility(), damage, DAMAGE_TYPE_MAGICAL, DOTA_DAMAGE_FLAG_NONE) end -- Movement -- if self.time == nil or self.time >= 10 then self.time = 0 if self.prev_point == nil then self.prev_point = GetRandomBorderPoint() else self.prev_point = GetRandomBorderPointCounterpart(self.prev_point) end unit:MoveToPosition(self.prev_point) end self.time = self.time + self.damage_interval end function wind_harpy_tornado_damage_modifier:OnDestroy() if not IsServer() then return end if self.particle == nil then return end if self.particle:IsNull() then return end ParticleManager:DestroyParticle( self.particle, false ) ParticleManager:ReleaseParticleIndex( self.particle ) self.particle = nil end function wind_harpy_tornado_damage_modifier:DeclareFunctions() local funcs = { MODIFIER_PROPERTY_MOVESPEED_ABSOLUTE, MODIFIER_PROPERTY_MOVESPEED_ABSOLUTE_MAX, MODIFIER_PROPERTY_TOOLTIP, --MODIFIER_PROPERTY_MODEL_CHANGE, --MODIFIER_PROPERTY_MODEL_SCALE } return funcs end --[[ function wind_harpy_tornado_damage_modifier:GetModifierModelChange() return "particles/units/heroes/hero_brewmaster/brewmaster_cyclone.vpcf" end function wind_harpy_tornado_damage_modifier:GetModifierModelScale() return 1.0 end ]] function wind_harpy_tornado_damage_modifier:GetModifierMoveSpeed_Absolute( params ) if not IsServer() then return end local caster = self:GetCaster() -- PHASE 2 -- if caster:GetHealthPercent() < self.phase_two then return self.phase_two_move_speed end -- PHASE 3 -- if caster:GetHealthPercent() < self.phase_three then return self.phase_three_move_speed end return self.move_speed end function wind_harpy_tornado_damage_modifier:GetModifierMoveSpeed_AbsoluteMax( params ) if not IsServer() then return end local caster = self:GetCaster() -- PHASE 2 -- if caster:GetHealthPercent() < self.phase_two then return self.phase_two_move_speed end -- PHASE 3 -- if caster:GetHealthPercent() < self.phase_three then return self.phase_three_move_speed end return self.move_speed end function wind_harpy_tornado_damage_modifier:OnTooltip( params ) return self.damage end function wind_harpy_tornado_damage_modifier:GetAttributes() return MODIFIER_ATTRIBUTE_IGNORE_INVULNERABLE end function wind_harpy_tornado_damage_modifier:IsHidden() return true end function wind_harpy_tornado_damage_modifier:IsPurgable() return false end function wind_harpy_tornado_damage_modifier:IsPurgeException() return false end function wind_harpy_tornado_damage_modifier:IsStunDebuff() return false end function wind_harpy_tornado_damage_modifier:IsDebuff() return false end
31.157576
192
0.788174
2a2d529c45913a5b33731324b71513e4348a23aa
2,012
swift
Swift
Controller/QRScannerViewController.swift
guorenxi/Bark
01dbb1e55f676ceba72637b7ec0a57a581c17d8f
[ "MIT" ]
null
null
null
Controller/QRScannerViewController.swift
guorenxi/Bark
01dbb1e55f676ceba72637b7ec0a57a581c17d8f
[ "MIT" ]
null
null
null
Controller/QRScannerViewController.swift
guorenxi/Bark
01dbb1e55f676ceba72637b7ec0a57a581c17d8f
[ "MIT" ]
null
null
null
// // QRScannerViewController.swift // Bark // // Created by huangfeng on 2022/3/10. // Copyright © 2022 Fin. All rights reserved. // import MercariQRScanner import RxCocoa import RxSwift import UIKit class QRScannerViewController: UIViewController { var scannerDidSuccess: Observable<String> { return self.rx.methodInvoked(#selector(didSeccess(code:))).map { a in try castOrThrow(String.self, a[0]) } } let closeButton: UIButton = { let closeButton = UIButton(type: .custom) closeButton.setImage(UIImage(named: "baseline_close_white_48pt"), for: .normal) closeButton.tintColor = UIColor.white closeButton.backgroundColor = UIColor(white: 0, alpha: 0.2) closeButton.layer.cornerRadius = 40 closeButton.clipsToBounds = true return closeButton }() override func viewDidLoad() { super.viewDidLoad() self.view.backgroundColor = UIColor.black let qrScannerView = QRScannerView(frame: view.bounds) qrScannerView.configure(delegate: self) view.addSubview(qrScannerView) view.addSubview(closeButton) closeButton.snp.makeConstraints { make in make.bottom.equalToSuperview().offset(-120) make.centerX.equalToSuperview() make.width.height.equalTo(80) } closeButton.rx.tap.subscribe { [weak self] in self?.dismiss(animated: true, completion: nil) } onError: { _ in }.disposed(by: rx.disposeBag) qrScannerView.startRunning() } } extension QRScannerViewController: QRScannerViewDelegate { func qrScannerView(_ qrScannerView: QRScannerView, didFailure error: QRScannerError) { self.showSnackbar(text: error.rawString()) } func qrScannerView(_ qrScannerView: QRScannerView, didSuccess code: String) { self.didSeccess(code: code) self.dismiss(animated: true, completion: nil) } @objc private func didSeccess(code: String) {} }
30.953846
90
0.671968
12e8117f7b042fcf2550d46bb062b5cb05f800b8
6,019
html
HTML
app/views/universal-credit/claiming-other-benefits.html
quis/notify-public-research-prototype
de76ef89a8705a471e77ca96ef26493f39637d2b
[ "MIT" ]
1
2016-12-16T07:29:44.000Z
2016-12-16T07:29:44.000Z
app/views/universal-credit/claiming-other-benefits.html
quis/notify-public-research-prototype
de76ef89a8705a471e77ca96ef26493f39637d2b
[ "MIT" ]
4
2016-07-27T14:42:12.000Z
2016-09-29T10:27:10.000Z
app/views/universal-credit/claiming-other-benefits.html
quis/notify-public-research-prototype
de76ef89a8705a471e77ca96ef26493f39637d2b
[ "MIT" ]
3
2016-08-09T07:40:49.000Z
2021-04-10T20:01:00.000Z
{% extends "layout.html" %} {% block head %} <link href="/public/stylesheets/application.css" media="screen" rel="stylesheet" type="text/css" /> <link href="/public/stylesheets/static-2016-07-04.css" media="screen" rel="stylesheet" type="text/css" /> {% endblock %} {% block page_title %} Universal Credit - GOV.UK {% endblock %} {% block content %} {% include "includes/breadcrumbs/benefits.html" %} <div id="wrapper" class="guide guide"> <div class="grid-row"> <main id="content" role="main" class="multi-page"> <header class="page-header"> <div> <h1>Universal Credit</h1> </div> </header> <div class="article-container group"> <div class="content-block"> <div class="inner"> <aside> <div class="inner"> <nav role="navigation" class="page-navigation" aria-label="parts to this guide"> <ol> <li> <span class="part-number">1.</span> <a title="Part 1: Overview" href="/universal-credit/overview">Overview</a> </li> <li> <span class="part-number">2.</span> <a title="Part 2: What you'll get" href="/universal-credit/what-youll-get">What you'll get</a> </li> <li> <span class="part-number">3.</span> <a title="Part 3: How to claim" href="/universal-credit/how-to-claim">How to claim</a> </li> <li class="active"> <span class="part-number">4.</span> <span>You're claiming other benefits </span> </li> </ol> <ol start="5"> <li> <span class="part-number">5.</span> <a title="Part 5: If your payment is stopped or reduced" href="/universal-credit/if-your-payment-is-stopped-or-reduced">If your payment is stopped or reduced</a> </li> <li> <span class="part-number">6.</span> <a title="Part 6: Change of circumstances" href="/universal-credit/change-in-circumstances">Change of circumstances</a> </li> <li> <span class="part-number">7.</span> <a title="Part 7: Appeal a decision" href="/universal-credit/appeal-decision">Appeal a decision</a> </li> <li> <span class="part-number">8.</span> <a title="Part 8: Getting help" href="/universal-credit/getting-help">Getting help</a> </li> </ol> </nav> </div> </aside> <header> <h1>4. You're claiming other benefits </h1> </header> <p>Universal Credit will replace the following:</p> <ul> <li>Jobseeker’s Allowance</li> <li>Housing Benefit</li> <li>Working Tax Credit</li> <li>Child Tax Credit</li> <li>Employment and Support Allowance</li> <li>Income Support</li> </ul> <p>Apply for any other <a href="#">benefits you’re eligible for</a> as usual.</p> <p>Once you’ve claimed Universal Credit, any benefits that it replaces will stop and you’ll start getting Universal Credit instead.</p> <div role="note" aria-label="Information" class="application-notice info-notice"> <p>Your benefits may end before your Universal Credit starts.</p> </div> <p>You may be able to get an advance on your first Universal Credit payment if:</p> <ul> <li>you’ve recently been receiving another benefit</li> <li>you’re in urgent financial need</li> </ul> <p>Check with your work coach if this applies to you.</p> <h2>Housing Benefit and paying your rent</h2> <p>Universal Credit may include money towards your housing costs. You’ll have to arrange with your landlord to start paying your own rent, if you don’t do this already.</p> <p>Find out details of your rent from your landlord, for example:</p> <ul> <li>how much the rent is and how you need to pay it</li> <li>if you need to pay any service charges or bills, eg gas and electricity</li> </ul> <p>If you think you’ll have problems managing your rent, talk to your landlord or work coach.</p> <h2>Tax credits</h2> <p>You’ll be told by HM Revenue and Customs (HMRC) that your tax credits will stop. You then need to <a href="#">end your claim</a>.</p> <p>If you have any tax credits overpayments, you still need to <a href="#">pay them back</a>.</p> <h2>If you move in with someone on Universal Credit</h2> <p>You’ll have to end your benefits claims.</p> <p>Your partner’s Universal Credit will become a joint claim and you’ll both have to sign new Claimant Commitments.</p> <footer> <nav class="pagination" role="navigation" aria-label="Pagination"> <ul class="group"> <li class="previous"> <a title="Navigate to previous part" rel="prev" href="/universal-credit/how-to-claim"> <span class="pagination-label">Previous </span> <span class="pagination-part-title">How to claim</span> </a> </li> <li class="next"> <a title="Navigate to next part" rel="next" href="/universal-credit/if-your-payment-is-stopped-or-reduced"> <span class="pagination-label">Next</span> <span class="pagination-part-title">If your payment is stopped or reduced</span> </a> </li> </ul> </nav> </footer> <div class="print-link"><a rel="nofollow" href="#" target="_blank">Print entire guide</a></div> </div> </div> <div class="meta-data group"> <p class="modified-date">Last updated: 11 May 2016</p> </div> </div> </main> {% include "includes/related-content/benefits.html" %} </div> {% include "includes/report-a-problem.html" %} </div> {% endblock %}
56.252336
256
0.576175
573fc2d577d3e006628701342c375d38e4c6b9d7
85
kt
Kotlin
src/main/kotlin/anissia/domain/account/core/AccountRole.kt
anissia-net/anissia-core
f2af520cace8185f443e0818b311cc567dae367b
[ "CC-BY-4.0" ]
12
2019-11-17T04:20:10.000Z
2022-03-01T17:02:29.000Z
src/main/kotlin/anissia/domain/account/core/AccountRole.kt
anissia-net/anissia-core
f2af520cace8185f443e0818b311cc567dae367b
[ "CC-BY-4.0" ]
4
2021-04-26T08:40:25.000Z
2021-05-16T18:41:36.000Z
src/main/kotlin/anissia/domain/account/core/AccountRole.kt
anissia-net/anissia-core
f2af520cace8185f443e0818b311cc567dae367b
[ "CC-BY-4.0" ]
2
2021-03-29T00:08:48.000Z
2021-03-31T05:53:06.000Z
package anissia.domain.account.core enum class AccountRole { TRANSLATOR, ROOT }
14.166667
35
0.764706
30e85a733c609fb92e41390a76668f09858dcde1
685
asm
Assembly
programs/oeis/078/A078734.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/078/A078734.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/078/A078734.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A078734: Start with 1,2, concatenate 2^k previous terms and change last term as follows: 1->2, 2->3, 3->1. ; 1,2,1,3,1,2,1,1,1,2,1,3,1,2,1,2,1,2,1,3,1,2,1,1,1,2,1,3,1,2,1,3,1,2,1,3,1,2,1,1,1,2,1,3,1,2,1,2,1,2,1,3,1,2,1,1,1,2,1,3,1,2,1,1,1,2,1,3,1,2,1,1,1,2,1,3,1,2,1,2,1,2,1,3,1,2,1,1,1,2,1,3,1,2,1,3,1,2,1,3,1,2,1,1,1,2,1,3,1,2,1,2,1,2,1,3,1,2,1,1,1,2,1,3,1,2,1,2,1,2,1,3,1,2,1,1,1,2,1,3,1,2,1,2,1,2,1,3,1,2,1,1,1,2,1,3,1,2,1,3,1,2,1,3,1,2,1,1,1,2,1,3,1,2,1,2,1,2,1,3,1,2,1,1,1,2,1,3,1,2,1,1,1,2,1,3,1,2,1,1,1,2,1,3,1,2,1,2,1,2,1,3,1,2,1,1,1,2,1,3,1,2,1,3,1,2,1,3,1,2,1,1,1,2,1,3,1,2,1,2,1,2,1,3,1,2,1,1,1,2 add $0,1 pow $0,2 gcd $0,1073741824 mod $0,9 mov $1,$0 div $1,3 add $1,1
62.272727
501
0.540146
26a2a30de12da1e3d1f1634170db15368e25b464
58,866
java
Java
app/src/main/java/com/rudolfhladik/rd/disciplines/RepUtilityDescription.java
Terrell6/MCard0.4.4
2c5e6635934ba3e5ff0807e40b4883f01282a7d9
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/rudolfhladik/rd/disciplines/RepUtilityDescription.java
Terrell6/MCard0.4.4
2c5e6635934ba3e5ff0807e40b4883f01282a7d9
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/rudolfhladik/rd/disciplines/RepUtilityDescription.java
Terrell6/MCard0.4.4
2c5e6635934ba3e5ff0807e40b4883f01282a7d9
[ "Apache-2.0" ]
null
null
null
package com.rudolfhladik.rd.disciplines; /** * Created by RD on 27.1.2015. */ public class RepUtilityDescription { String[] desc = new String[2]; int ac; int utPointPossition; // f, ac, utility point, title/description String[][][] allDescriptions = new String[8][21][2]; // REP Advanced classes: 0: guardian, 1: sentinel, 2: sage, 3: shadow, 4: commando, 5: vanguard, 6: scoundrel, 7: gunslinger // IMP Advanced classes: 0: juggernaut, 1: marauder, 2: sorcerer, 3: assassin, 4: mercenarz, 5: powertech, 6: operative, 7: sniper // guardian 0 0 * * private static final String guardian_0_0_0_0 = "Second Wind"; private static final String guardian_0_0_0_1 = "Reduces the cooldown of Resolute by 30 seconds and causes Resolute to heal you for 10% of your maximum health when used"; private static final String guardian_0_0_1_0 = "Battlefield Command"; private static final String guardian_0_0_1_1 = "Getting attacked reduces the active cooldown of Force Leap by 1 second. This effect cannot occur more than once every 1.5 seconds."; private static final String guardian_0_0_2_0 = "Defiance"; private static final String guardian_0_0_2_1 = "Generates 4 Focus when stunned, slept or knoked down."; private static final String guardian_0_0_3_0 = "Debilitation"; private static final String guardian_0_0_3_1 = "Master Strike immobilizes the target for the duration of the ability."; private static final String guardian_0_0_4_0 = "Gather Strength"; private static final String guardian_0_0_4_1 = "Whenever your movement is impaired, you gain a 5% damage bonus to your next melee ability that costs Focus. This effect can stack up to 5 times and lasts 15 seconds."; private static final String guardian_0_0_5_0 = "Trailblazer"; private static final String guardian_0_0_5_1 = "Cyclone Slash deals 25% more damage."; private static final String guardian_0_0_6_0 = "Stagger"; private static final String guardian_0_0_6_1 = "Increases the duration of Force Leap's immobilize effect by 1 second."; private static final String guardian_0_0_7_0 = "Intervention"; private static final String guardian_0_0_7_1 = "Force Leap, Guardian Slash, Overhead Slash, Zealous Leap, and Guardian Leap grant Intervention, which makes your next Freezing Force consume no Focus and activate with 0.5 second global cooldown."; private static final String guardian_0_0_8_0 = "Narrowed Focus"; private static final String guardian_0_0_8_1 = "Taking non-periodic area of effect damage generates 1 focus. This effect cannot occur more than once per second."; private static final String guardian_0_0_9_0 = "Purifying Sweep"; private static final String guardian_0_0_9_1 = "For the Defense discipline, Force Sweep slows the targets it damages by 60% for 10 seconds, For the Vigiliance and Focus disciplines, Force Sweep and Vigilant Thurst sunder the targets they damage for 45 seconds. Sundered targets have their armor rating decreased by 20%."; private static final String guardian_0_0_10_0 = "Guardianship"; private static final String guardian_0_0_10_1 = "Challenging Call protects all allies within range, excluding yourself, granting Guardianship, which absorbs a moderate amount of damage. Lasts 10 seconds."; private static final String guardian_0_0_11_0 = "Pulse"; private static final String guardian_0_0_11_1 = "Reduces the cooldown of Force Statis by 15 seconds."; private static final String guardian_0_0_12_0 = "Inspring Force"; private static final String guardian_0_0_12_1 = "Freezing Force increases the movement speed of all allies within 8 meters, excluding yourself, by 50% for 8 seconds."; private static final String guardian_0_0_13_0 = "Preparation"; private static final String guardian_0_0_13_1 = "When you exit combat, the active cooldowns of Force Leap, Combat Focus, and Saber Throw are reduced by 100%."; private static final String guardian_0_0_14_0 = "Jedi Warden"; private static final String guardian_0_0_14_1 = "Reduces the cooldown of Force Push by 15 seconds, and Freezing Force no longer consumes any Focus."; private static final String guardian_0_0_15_0 = "Daunting Presence"; private static final String guardian_0_0_15_1 = "Force Leap finishis the cooldown on Force Kick. In addition, Saber Reflect lasts 2 seconds longer, and while Soresu Form is active, generates a high amount of threat on all engaged enemies within 30 meters when activated."; private static final String guardian_0_0_16_0 = "Through Peace"; private static final String guardian_0_0_16_1 = "Reduces the cooldown of Focused Defense by 30 seconds."; private static final String guardian_0_0_17_0 = "Intercessor"; private static final String guardian_0_0_17_1 = "Reduces the cooldown of Guardian Leap by 5 seconds and reduces the threat and damage taken by an additional 10% each for the friendly target of Guardian Leap."; private static final String guardian_0_0_18_0 = "Whiplash"; private static final String guardian_0_0_18_1 = "Saber Throw immobilizes the target for 3 seconds"; private static final String guardian_0_0_19_0 = "Peaceful Focus"; private static final String guardian_0_0_19_1 = "Focused Defense removes all cleansable effects when activated."; private static final String guardian_0_0_20_0 = "True Harmony"; private static final String guardian_0_0_20_1 = "Enure increases your movement speed by 50% and grants immunity to movement-impairing effects while active."; // sentinel 0 1 * * private static final String sentinel_0_1_0_0 = "Jedi Enforcer"; private static final String sentinel_0_1_0_1 = "Increases the damage dealt by Rebuke by 15% and increases its duration by 4 seconds."; private static final String sentinel_0_1_1_0 = "Debilitation"; private static final String sentinel_0_1_1_1 = "Master Strike immobilizes the target for the duration of the ability."; private static final String sentinel_0_1_2_0 = "Jedi Crusader"; private static final String sentinel_0_1_2_1 = "While Rebuke is active, it generates 1 focus whenever you are attacked. This effect cannot occur more than once every 3 seconds."; private static final String sentinel_0_1_3_0 = "Defiance"; private static final String sentinel_0_1_3_1 = "Generates 4 Focus when stunned, slept or knocked down."; private static final String sentinel_0_1_4_0 = "Defensive Forms"; private static final String sentinel_0_1_4_1 = "You build 2 Zen when attacked. This effect cannot occur more than once every 1.5 seconds. Additionally, the effect of your lightsaber forms are improved while they are active: Shii-Cho Form: Further increases damage reduction by 2%. Juyo Form: Increases internal and elemental damage reduction by 5%. Ataru Form: Increases your movement speed by 15%."; private static final String sentinel_0_1_5_0 = "Trailblazer"; private static final String sentinel_0_1_5_1 = "Cyclone Slash deals 25% more damage."; private static final String sentinel_0_1_6_0 = "Stagger"; private static final String sentinel_0_1_6_1 = "Increases the duration of Force Leap's immobilize effect by 1 second."; private static final String sentinel_0_1_7_0 = "Incisor"; private static final String sentinel_0_1_7_1 = "Force Leap, Force Melt, Clashing Blast, and Zealous Leap snare the target, reducing its movement speed by 50% for 6 seconds."; private static final String sentinel_0_1_8_0 = "Jedi Promulgator"; private static final String sentinel_0_1_8_1 = "Each use of Strike, Zealous Strike, and Leg Slash reduces the active cooldown of Rebuke by 3 seconds."; private static final String sentinel_0_1_9_0 = "Defensive Roll"; private static final String sentinel_0_1_9_1 = "Reduces damage taken from area effect by 30%."; private static final String sentinel_0_1_10_0 = "Watchguard"; private static final String sentinel_0_1_10_1 = "Reduces the cooldown of Pacify by 15 seconds and Force Kick by 2 seconds."; private static final String sentinel_0_1_11_0 = "Pulse"; private static final String sentinel_0_1_11_1 = "Reduces the cooldown of Force Statis by 15 seconds."; private static final String sentinel_0_1_12_0 = "Displacement"; private static final String sentinel_0_1_12_1 = "Increases the range of Pacify by 6 meters and allows Rebuke to be used while stunned."; private static final String sentinel_0_1_13_0 = "Force Fade"; private static final String sentinel_0_1_13_1 = "Increase the duration of Force Camouflage by 2 seconds and further increases the movement speed bonus of Force Camouflage by 20%."; private static final String sentinel_0_1_14_0 = "Fleetfooted"; private static final String sentinel_0_1_14_1 = "When Transcendence is applied or refreshed, it purges movement-impairing effects. Additionally, the movement speed bonus of Transcendece is increased by 30%."; private static final String sentinel_0_1_15_0 = "Expunging Camouflage"; private static final String sentinel_0_1_15_1 = "Force Camouflage removes all cleansable effects when activated."; private static final String sentinel_0_1_16_0 = "Force Aegis"; private static final String sentinel_0_1_16_1 = "Increases the duration of Guarded by the Force by 2 seconds."; private static final String sentinel_0_1_17_0 = "Just Pursuit"; private static final String sentinel_0_1_17_1 = "Leg Slash consumes 2 less focus. In addition, using Leg Slash against a target already slowed by your Leg Slash immobilizes that target for 3 seconds. This immobilizing effect cannot be applied to the same target more than once every 10 seconds."; private static final String sentinel_0_1_18_0 = "Enduring"; private static final String sentinel_0_1_18_1 = "Reduces the cooldown of Guarded by the Force by 30 seconds."; private static final String sentinel_0_1_19_0 = "Zealous Ward"; private static final String sentinel_0_1_19_1 = "Getting attacked while Saber Ward is active heals you for 3% of your maximum health. This effect cannot occur more than once every 1.5 seconds."; private static final String sentinel_0_1_20_0 = "Contemplation"; private static final String sentinel_0_1_20_1 = "Reduces the cooldown of Awe by 15 seconds. In addition, you build up to 30 Centering over the course of using Introspection. This effect cannot occur more than once every 30 seconds."; // sage 0 2 * * private static final String sage_0_2_0_0 = "Psychic Suffasion"; private static final String sage_0_2_0_1 = "Force Wave heals you and up to 7 affected allies for 755-1336."; private static final String sage_0_2_1_0 = "Upheaval"; private static final String sage_0_2_1_1 = "Increases the damage dealt by Project by 5%. In addition, Project gains a 50% chance to throw a second chunk of debris that deals 50% less damage."; private static final String sage_0_2_2_0 = "Jedi Resistance"; private static final String sage_0_2_2_1 = "Increases damage reduction by 3%."; private static final String sage_0_2_3_0 = "Tectonic Mastery"; private static final String sage_0_2_3_1 = "Increases the damage dealt by Forcequake by 25%."; private static final String sage_0_2_4_0 = "Pain Bearer"; private static final String sage_0_2_4_1 = "Increases all healing recieved by 10%. Does not effect redistributed life."; private static final String sage_0_2_5_0 = "Humility"; private static final String sage_0_2_5_1 = "Targets stunned by your Force Stun suffer Humility when Force Stun wears off, which reduces all damage dealt by 25% for 10 seconds."; private static final String sage_0_2_6_0 = "Pinning Resolve"; private static final String sage_0_2_6_1 = "Reduces the cooldown of Force Stun by 10 seconds. In addition, your Force Lift affects up to 2 additional standard or weak enemies within 8 meters of target."; private static final String sage_0_2_7_0 = "Blockout"; private static final String sage_0_2_7_1 = "Activating Cloud Mind grants Blockout, which increases damage reduction by 25% for 6 seconds."; private static final String sage_0_2_8_0 = "Mind Ward"; private static final String sage_0_2_8_1 = "Reduces the damage taken by all periodic effects by 15%."; private static final String sage_0_2_9_0 = "Egress"; private static final String sage_0_2_9_1 = "Force Speed grants Egress, removing all movement-impairing effects and granting immunity to them for the duration."; private static final String sage_0_2_10_0 = "Valiance"; private static final String sage_0_2_10_1 = "Reduces the health spent by Noble Sacriffice by 25%, and increases the healing done by Force Mend by 30%."; private static final String sage_0_2_11_0 = "Kinetic Collapse"; private static final String sage_0_2_11_1 = "Force Armors you place on yourself erupt in a flash of light when they end, blinding up to 8 nearby enemies for 3 seconds. This effect breaks from direct damage."; private static final String sage_0_2_12_0 = "Force Wake"; private static final String sage_0_2_12_1 = "Force Wave unbalances its targets, immobilizing them for 5 seconds. Direct damage dealt after 2 seconds ends the effect prematurely."; private static final String sage_0_2_13_0 = "Telekinetic Defense"; private static final String sage_0_2_13_1 = "Increases the amount absorbed by your Force Armor by 10%."; private static final String sage_0_2_14_0 = "Metaphysical Alacrity"; private static final String sage_0_2_14_1 = "Mental Alacrity increases your movement speed by 50% while active. In addition, Force Speed lasts 0.5 seconds longer, and when Force Barrier ends, the active cooldown of Force Speed is finished."; private static final String sage_0_2_15_0 = "Mental Defense"; private static final String sage_0_2_15_1 = "Reduces all damage taken while stunned by 30%."; private static final String sage_0_2_16_0 = "Force Haste"; private static final String sage_0_2_16_1 = "Reduce the cooldown of Force Speed by 5 seconds, Force Slow by 3 seconds, and Force Barrier by 30 seconds."; private static final String sage_0_2_17_0 = "Force Mobility"; private static final String sage_0_2_17_1 = "Turbulance, Healing Trance, and Force Serenity can by activated while moving."; private static final String sage_0_2_18_0 = "Confound"; private static final String sage_0_2_18_1 = "Targets affected by your Weaken Mind are slowed by 30% for its duration."; private static final String sage_0_2_19_0 = "Life Ward"; private static final String sage_0_2_19_1 = "Your Force Armor, Force Barrier, and enduring Bastion heal you for 2% of your total health every second for as long as they last. This healing scales up to 8% with the charges for Enduring Bastion."; private static final String sage_0_2_20_0 = "Containment"; private static final String sage_0_2_20_1 = "If your Force Lift breaks early from damage, the target is stunned for 2 seconds. In addition, Force Lift activates instantly."; /// shadow 0 3 * * private static final String shadow_0_3_0_0 = "Celerity"; private static final String shadow_0_3_0_1 = "Reduces the cooldown of Mind Snap by 2 seconds, Force of Will by 30 seconds, and Force Speed by 5 seconds."; private static final String shadow_0_3_1_0 = "Pinning Resolve"; private static final String shadow_0_3_1_1 = "Reduces the cooldown of Force Stun by 10 seconds. In addition, your Force Lift affects up to 2 additional standard or weak enemies within 8 meters of target."; private static final String shadow_0_3_2_0 = "Mental Defense"; private static final String shadow_0_3_2_1 = "Reduces all damage taken while stunned by 30%."; private static final String shadow_0_3_3_0 = "Misdirection"; private static final String shadow_0_3_3_1 = "Increases your movement speed by 15% and your effective stealth level by 5."; private static final String shadow_0_3_4_0 = "Lambaste"; private static final String shadow_0_3_4_1 = "Increases the damage done by Whirling Blow by 25%."; private static final String shadow_0_3_5_0 = "Shadowy Veil"; private static final String shadow_0_3_5_1 = "Increases your armor rating by 30% while Force Technique or Shadow Technique is active. In addition, targets you Guard gain Shadowy Veil when they take damage, increasing their damage reduction by 1%. This effect stacks up to 3 times, cannot occur more than once per second, and lasts up to 10 seconds if you keep Guard on the target."; private static final String shadow_0_3_6_0 = "Force Wake"; private static final String shadow_0_3_6_1 = "Force Wave unbalances its targets, immobilizing them for 5 seconds. Direct damage dealt after 2 seconds ends the effect prematurely."; private static final String shadow_0_3_7_0 = "Mind Over Matter"; private static final String shadow_0_3_7_1 = "Increases the durations of Resilence by 2 seconds and Force Speed by 0.5 seconds."; private static final String shadow_0_3_8_0 = "Subduing Techniques"; private static final String shadow_0_3_8_1 = "Increases the duration of Force Slow and reduces its cooldown by 6 seconds."; private static final String shadow_0_3_9_0 = "Fade"; private static final String shadow_0_3_9_1 = "Reduces the cooldown of Blackout by 15 seconds and Force Cloak by 30 seconds."; private static final String shadow_0_3_10_0 = "Nerve Wracking"; private static final String shadow_0_3_10_1 = "Targets controlled by your Spinning Kick or Force Stun take 5% more damage from all sources."; private static final String shadow_0_3_11_0 = "Egress"; private static final String shadow_0_3_11_1 = "Force Speed grants Egress, removing all movement-imparing effects and granting immunity to them for the duration."; private static final String shadow_0_3_12_0 = "Sapped Mind"; private static final String shadow_0_3_12_1 = "When damage breaks your Mind Maze prematurely, the target will suffer from Sapped Mind, reducing the damage they deal by 25% for 10 seconds."; private static final String shadow_0_3_13_0 = "Force Harmonics"; private static final String shadow_0_3_13_1 = "Reduces the cooldown of Force Wave by 2.5 seconds and Force Potency grants 1 additional charge when activated."; private static final String shadow_0_3_14_0 = "Humbling Strike"; private static final String shadow_0_3_14_1 = "When a target recovers from being stunned by your Spinning Kick or Force Stun, its movements speed is slowed by 90% for the following 3 seconds."; private static final String shadow_0_3_15_0 = "Shadow's Shelter"; private static final String shadow_0_3_15_1 = "Increases all healing received by 3%, In addition, deplouying Phase Walk also deploys Shadow's Shelter, increasing the healing done by those within 5 meters of the Phase Walk by 5%."; private static final String shadow_0_3_16_0 = "Containment"; private static final String shadow_0_3_16_1 = "If your Force Lift breaks early from damage, the target is stunned for 2 seconds. In addition, Force Lift activates instantly."; private static final String shadow_0_3_17_0 = "Sturdiness"; private static final String shadow_0_3_17_1 = "While Deflection is active, you are immune to stun, sleep, lift, and incapacitating effects."; private static final String shadow_0_3_18_0 = "Martial Prowess"; private static final String shadow_0_3_18_1 = "Force Pull immobilizes its target for 3 seconds, Serenity Strike immobilizes its target for 2 seconds, and Low Slash immobilizes its target for 1 second after the incapacitating effetc wears off."; private static final String shadow_0_3_19_0 = "Cloak of Resilience"; private static final String shadow_0_3_19_1 = "Activating Force Cloak grants 2 seconds of Resilience."; private static final String shadow_0_3_20_0 = "Motion Control"; private static final String shadow_0_3_20_1 = "Force Cloak increases your movement speed by 50% while it is active, and Force Slow reduces the movement speed of its target by additional 20%."; // commando 0 4 * * private static final String commando_0_4_0_0 = "Concussive Force"; private static final String commando_0_4_0_1 = "Stockstrike immobilizes the target for 4 seconds. Direct damage caused after 2 seconds ends effect. In addition, Concussion Charge's knockback effect is stronger and pushes enemies 4 meters further away."; private static final String commando_0_4_1_0 = "Parallactic Combat Stims"; private static final String commando_0_4_1_1 = "You recharge 1 energy cells when stunned, immobilized, knocked down or otherwise incapacitated."; private static final String commando_0_4_2_0 = "Cell Capacitor"; private static final String commando_0_4_2_1 = "recharge Cells now immedietely recharges 15 additional cells and grants 10% alacrity for 6 seconds."; private static final String commando_0_4_3_0 = "Charged Barrier"; private static final String commando_0_4_3_1 = "Charged Bolts, grav round, and Medical Probe build a Charged Barrier that reduces damage taken by 1% for 15 seconds. Stacks up to 5 times."; private static final String commando_0_4_4_0 = "Chain Gunnery"; private static final String commando_0_4_4_1 = "Increases the damage dealt by Hail of Bolts by 25%."; private static final String commando_0_4_5_0 = "Heavy Trooper"; private static final String commando_0_4_5_1 = "Increases Endurance by 3% and all healing received by 3%."; private static final String commando_0_4_6_0 = "Tenacious Defence"; private static final String commando_0_4_6_1 = "Reduces the cooldown of Concussion Charge by 5 seconds and Tenacity by 30 seconds."; private static final String commando_0_4_7_0 = "Advance the Line"; private static final String commando_0_4_7_1 = "Increases the duration of hold the Line by 4 seconds."; private static final String commando_0_4_8_0 = "Nightvision Scope"; private static final String commando_0_4_8_1 = "Increases stealth detection level by 2, melee and ranged defense by 2%, and reduces the cooldown of Stealth Scan by 5 seconds."; private static final String commando_0_4_9_0 = "Suit FOE"; private static final String commando_0_4_9_1 = "When you activate Field Aid on yourself, a Foreign Object Excisor reduces all periodic damage taken by 30% for 12 seconds."; private static final String commando_0_4_10_0 = "Med Zone"; private static final String commando_0_4_10_1 = "Increases all healing received by 20% while Reactive Shield is active."; private static final String commando_0_4_11_0 = "Combat Shield"; private static final String commando_0_4_11_1 = "Reactive Shield now further decreases ability activation pushback by 30% and makes you immune to interupts."; private static final String commando_0_4_12_0 = "Efficient Conversions"; private static final String commando_0_4_12_1 = "Removes the energy cell cost of Concussion Charge, Concussive Round, Field Aid, and Cryo Grenade."; private static final String commando_0_4_13_0 = "Electro Shield"; private static final String commando_0_4_13_1 = "When activated, your Reactive Shield charges with electricity, zapping attackers for 607-607 elemental damage while it remains active. This effect cannot occur more than once each second."; private static final String commando_0_4_14_0 = "Shock Absorbers"; private static final String commando_0_4_14_1 = "Reduces damage taken from area effects by 30%. Additionally, while stunned, you take 30% less damage from all sources."; private static final String commando_0_4_15_0 = "Reflexive Shield"; private static final String commando_0_4_15_1 = "When you take damage, the active cooldown of Reactive Shield is reduced by 3 seconds. This effect cannot occur more than once every 1.5 seconds. In addition, when taking damage, you have a 20% chance to emit an Energy Redoubt, which absorbs a low amount of damage and lasts 6 seconds. This effect cannot occur more than once every 10 seconds."; private static final String commando_0_4_16_0 = "Overclock"; private static final String commando_0_4_16_1 = "Reduces the cooldowns of Concussive Round and Tech Override by 15 seconds each. In addition, Tech Override grants a second charge, making your next two abilities with activation time activate instantly."; private static final String commando_0_4_17_0 = "Reflexive Battery"; private static final String commando_0_4_17_1 = "Increases the damage dealt by Concussion Charge by 30%. In addition, taking damage reduces the active cooldown of Concussion Charge by 1 second. This effect cannot occure more than once every 1.5 seconds."; private static final String commando_0_4_18_0 = "Kolto Wave"; private static final String commando_0_4_18_1 = "Concussion Charge heals you and up to 7 other allies within range for 614-905."; private static final String commando_0_4_19_0 = "Supercharged Reserves"; private static final String commando_0_4_19_1 = "Reduces the cooldowns of Field Aid and Disabling Shot by 3 seconds each. In addition, you build up to 10 stacks of Supercharge over the course of using Recharge and Reloud. This effect cannot occur more than once every 30 seconds."; private static final String commando_0_4_20_0 = "Forced March"; private static final String commando_0_4_20_1 = "Allows Full Auto, Boltstorm, and Successive Treatment to be activated while moving."; // vanguard 0 5 * * private static final String vanguard_0_5_0_0 = "Battlefield Training"; private static final String vanguard_0_5_0_1 = "Increases movement speed by 15%"; private static final String vanguard_0_5_1_0 = "Parallactic Combat Stims"; private static final String vanguard_0_5_1_1 = "You recharge 10 nergy cells when stunned, immobilized, knocked down or otherwise incapacitated."; private static final String vanguard_0_5_2_0 = "Reflective Armor"; private static final String vanguard_0_5_2_1 = "When Into the Fray is triggered, it will also deal 1000-1000 elemental damage to the attacker if the attacker is within 10 meters."; private static final String vanguard_0_5_3_0 = "Entangling Heat"; private static final String vanguard_0_5_3_1 = "Tactical Surge, Ion Pulse, and Explosive Surge reduce the movement speed of affected targets by 50% for 6 seconds."; private static final String vanguard_0_5_4_0 = "Muzzle Augs"; private static final String vanguard_0_5_4_1 = "Increases the range of Ion Pulse and tactical Surge by 5 meters and the radius of Explosive Surge by 2 meters."; private static final String vanguard_0_5_5_0 = "Sharp Satchel"; private static final String vanguard_0_5_5_1 = "Increases Explosive Surge damage by 25%"; private static final String vanguard_0_5_6_0 = "Iron Will"; private static final String vanguard_0_5_6_1 = "Reduces the cooldown of Tenacity by 30 seconds and the cooldown of Hold the Line by 5 seconds."; private static final String vanguard_0_5_7_0 = "Defensive Measures"; private static final String vanguard_0_5_7_1 = "Harpoon immobilizes the target for 3 seconds. In addition, the cooldown of Stealth is reduced by 5 seconds, and any targets it reveals are immobilized for 3 seconds."; private static final String vanguard_0_5_8_0 = "Electro Shield"; private static final String vanguard_0_5_8_1 = "When activated, your Reactive Shield charges with electricity, zapping attackers for 607-607 elemental damage while it remains active. This effect cannot occur more than once each second."; private static final String vanguard_0_5_9_0 = "Advance the Line"; private static final String vanguard_0_5_9_1 = "Increases the duration of Hold the Line by 4 seconds."; private static final String vanguard_0_5_10_0 = "Accelerated Reel"; private static final String vanguard_0_5_10_1 = "Reduces the cooldown of Harpoon by 15 seconds."; private static final String vanguard_0_5_11_0 = "Sonic Rebounder"; private static final String vanguard_0_5_11_1 = "Sonic Round protects all friendly targets in its area of impact, excluding you, granting Sonic Rebounder, which reflects the next direct, single-target attack back at the attacker."; private static final String vanguard_0_5_12_0 = "Containment Tactics"; private static final String vanguard_0_5_12_1 = "Reduces the cooldown of Cryo Grenade by 10 seconds."; private static final String vanguard_0_5_13_0 = "Frontline Defense"; private static final String vanguard_0_5_13_1 = "Reduces the cooldown of Riot Strike by 2 seconds."; private static final String vanguard_0_5_14_0 = "Guard Canoon"; private static final String vanguard_0_5_14_1 = "Damaging a target with your Shoulder Cannon missiles heals you for 5% of your total health."; private static final String vanguard_0_5_15_0 = "Paralytic Augs"; private static final String vanguard_0_5_15_1 = "Increases the stun durations of Cryo Grenade and Neural Surge by 1 second each."; private static final String vanguard_0_5_16_0 = "Emergency Stims"; private static final String vanguard_0_5_16_1 = "Allows Adrenaline Rush to be activated while stunned and causes Adrenaline Rush to purge stun effect when activated. This will not work against other types of incapacitating effects or scripted stuns, which are often used by Flashpoint and Operation bosses or other special non-player characters."; private static final String vanguard_0_5_17_0 = "Re-energizers"; private static final String vanguard_0_5_17_1 = "When Reserve Powercell is activated, it recharges 10 energy cells over the next 5 seconds and immediately increases threat towards all current enemies by a small amount if Ion Cell is active, or reduces threat towards all current enemies if Ion Cell is not active."; private static final String vanguard_0_5_18_0 = "Focus Stims"; private static final String vanguard_0_5_18_1 = "Battle Focus increases damage done by 5% while Ion Cell is active and increases damge reduction by 5% while Ion Cell is not active."; private static final String vanguard_0_5_19_0 = "Charge the Line"; private static final String vanguard_0_5_19_1 = "Hold the Line increases movement speed y and additional 45% while is active."; private static final String vanguard_0_5_20_0 = "Efficient Tools"; private static final String vanguard_0_5_20_1 = "Increases the range of Harpoon and Shoulder Cannon by 10 meters and eliminates the energy cell cost of Cryo Grenade and Neural Surge."; // scoundrel 0 6 * * private static final String scoundrel_0_6_0_0 = "Smuggled Get-up"; private static final String scoundrel_0_6_0_1 = "Reduces all area of effect damage taken by 30%."; private static final String scoundrel_0_6_1_0 = "Scat Tissue"; private static final String scoundrel_0_6_1_1 = "Increases damage reduction by 5%."; private static final String scoundrel_0_6_2_0 = "Let Loose"; private static final String scoundrel_0_6_2_1 = "Blaster Volley deals 25% more damage."; private static final String scoundrel_0_6_3_0 = "Flash Powder"; private static final String scoundrel_0_6_3_1 = "Reduces target's accuracy by 20% for 8 seconds after Flash Grenade ends"; private static final String scoundrel_0_6_4_0 = "Holdout Defense"; private static final String scoundrel_0_6_4_1 = "Slapping a target with Blaster Whip or Bludgeon grants Holdout Defense, increasing your movement speed by 50% for 3 seconds."; private static final String scoundrel_0_6_5_0 = "Sneaky"; private static final String scoundrel_0_6_5_1 = "Increases movement speed by 15% and effective stealth level by 3."; private static final String scoundrel_0_6_6_0 = "Dirty Escape"; private static final String scoundrel_0_6_6_1 = "Reduces the cooldown of Dirty Kick by 15 seconds."; private static final String scoundrel_0_6_7_0 = "Stopping Power"; private static final String scoundrel_0_6_7_1 = "Tendon Blast immobilizes the target for 2 seconds."; private static final String scoundrel_0_6_8_0 = "Anatomy Lessons"; private static final String scoundrel_0_6_8_1 = "Reduces the energy cost of Dirty Kick and Tendon Blast by 5."; private static final String scoundrel_0_6_9_0 = "Med Screen"; private static final String scoundrel_0_6_9_1 = "Your Defense Screen heals you for 5% of your maximum health when it collapses."; private static final String scoundrel_0_6_10_0 = "Flee the Scene"; private static final String scoundrel_0_6_10_1 = "Reduces the cooldown of Disappearing Act by 30 seconds and Sneak by 15 seconds. In addition, activating Disappearing Act increases movement speed by 50% for 6 seconds."; private static final String scoundrel_0_6_11_0 = "Sedatives"; private static final String scoundrel_0_6_11_1 = "When Tranquilizer wears off, the target is struck by Sedatives, reducing all damage dealt by 50% for the next 10 seconds."; private static final String scoundrel_0_6_12_0 = "Dirty Trickster"; private static final String scoundrel_0_6_12_1 = "Surrender will also purge movement-impairing effects when activated."; private static final String scoundrel_0_6_13_0 = "Keep Cool"; private static final String scoundrel_0_6_13_1 = "Cool Head now immediately restores 15 additional energy."; private static final String scoundrel_0_6_14_0 = "Get the Bulge"; private static final String scoundrel_0_6_14_1 = "Tendon Blast will now grant an Upper Hand."; private static final String scoundrel_0_6_15_0 = "Skedaddle"; private static final String scoundrel_0_6_15_1 = "When activated, Disappeating Act grants 2 seconds of Dodge."; private static final String scoundrel_0_6_16_0 = "K.O."; private static final String scoundrel_0_6_16_1 = "When used from stealth, Back Blast and Point Blank Shot interupt and immobilize the target for 3 seconds."; private static final String scoundrel_0_6_17_0 = "Scramble"; private static final String scoundrel_0_6_17_1 = "Every time you get attacked, the active cooldown of your Dodge is reduced by 3 seconds. This effect cannot occur more than once every 1.5 seconds."; private static final String scoundrel_0_6_18_0 = "Surprise Comeback"; private static final String scoundrel_0_6_18_1 = "Pugnacity now additionally grants Surprise Comeback, restoring 5% of total health every 3 seconds and reducing damage received by 20% for the duration."; private static final String scoundrel_0_6_19_0 = "Hotwired Defenses"; private static final String scoundrel_0_6_19_1 = "Increases the amount of damage absorbed by Defense Screen by 30%."; private static final String scoundrel_0_6_20_0 = "Smuggled Defenses"; private static final String scoundrel_0_6_20_1 = "Reduces the cooldown of Escape by 30 seconds, Defense Screen by 5 seconds, and Smuggle by 60 seconds."; // gunslinger 0 7 * * private static final String gunslinger_0_7_0_0 = "Ballistic Dampers"; private static final String gunslinger_0_7_0_1 = "Entering cover grants 3 charges of Ballistic Dampers. Each charge absorbs 30% of the damage dealt by incoming attacks. This effect cannot occur more than once every 1.5 seconds. Ballistic Dampers can only be gained once every 6 seconds."; private static final String gunslinger_0_7_1_0 = "Cool Under Pressure"; private static final String gunslinger_0_7_1_1 = "While in cover, you heal for 1% of your total health every 3 seconds."; private static final String gunslinger_0_7_2_0 = "Cover Screen"; private static final String gunslinger_0_7_2_1 = "When exiting cover, you increase your ranged defense by 20% for 6 seconds."; private static final String gunslinger_0_7_3_0 = "Snap Shot"; private static final String gunslinger_0_7_3_1 = "Entering cover makes the next Charged Burst or Dirty Blast activate instantly. This effect cannot occur more than once every 6 seconds."; private static final String gunslinger_0_7_4_0 = "Flash Powder"; private static final String gunslinger_0_7_4_1 = "Reduces target's accuracy by 20% for 8 seconds after Flash Grenade ends."; private static final String gunslinger_0_7_5_0 = "Efficient Ammo"; private static final String gunslinger_0_7_5_1 = "Increases the damage dealt by Sweeping Gunfire by 25%."; private static final String gunslinger_0_7_6_0 = "Reset Engagement"; private static final String gunslinger_0_7_6_1 = "Slapping a target with Blaster Whip grants Reset Engagement, increasing your movement speed by 50% for 3 seconds. Additionally, the final shot of Speedshot and Penetrating Rounds knocks back the target if they are within 10 meters."; private static final String gunslinger_0_7_7_0 = "Heads Up"; private static final String gunslinger_0_7_7_1 = "When Hunker Down ends or you leave cover while Hunker Down is active, you gain Heads Up, which increases your movement speed by 50% and grants immunity to movement impairing effects. Lasts 6 seconds."; private static final String gunslinger_0_7_8_0 = "Hot Pursuit"; private static final String gunslinger_0_7_8_1 = "You gain 4 charges of Hot Pursuit upon exiting cover, which reduces the energy cost of Quick Shot by 100%. Each use of Quick Shot consumes 1 charge, and consuming the first charge triggers a 20 second rate-limit on this skill. This effect lasts 15 seconds but is also removed by consuming all charges or reentering cover."; private static final String gunslinger_0_7_9_0 = "Pandemonium"; private static final String gunslinger_0_7_9_1 = "Activating Pulse Detonator makes the next Charged Burst or Dirty Blast activate instantly."; private static final String gunslinger_0_7_10_0 = "Dirty Trickster"; private static final String gunslinger_0_7_10_1 = "Surrender will also purge movement-impairing effects when activated."; private static final String gunslinger_0_7_11_0 = "Trip Shot"; private static final String gunslinger_0_7_11_1 = "Reduces the cooldown of Leg Shot by 3 seconds."; private static final String gunslinger_0_7_12_0 = "Hotwired Defenses"; private static final String gunslinger_0_7_12_1 = "Increases the amount of damage absorbed by Defense Screen by 30%."; private static final String gunslinger_0_7_13_0 = "Lay Low"; private static final String gunslinger_0_7_13_1 = "Reduces the cooldown of Hunker Down by 15 seconds and Pulse Detonator knocks targets back an additional 4 meters."; private static final String gunslinger_0_7_14_0 = "Plan B & C"; private static final String gunslinger_0_7_14_1 = "Reduces the cooldown of Dirty Kick and Flash Grenade by 15 seconds."; private static final String gunslinger_0_7_15_0 = "Hold Your Ground"; private static final String gunslinger_0_7_15_1 = "Reduces the cooldown of Escape by 30 seconds, Defense Screen by 4 seconds and Pulse Detonator by 5 seconds."; private static final String gunslinger_0_7_16_0 = "Holed Up"; private static final String gunslinger_0_7_16_1 = "Reduces all area effect damage taken by 60% while Hunker Down is active."; private static final String gunslinger_0_7_17_0 = "Kneecappin' "; private static final String gunslinger_0_7_17_1 = "Increases the Trauma duration of Flourish Shot by 6 seconds. In addition, when Leg Shot's immobilize effect wears off, the target's movement is slowed by 70% for 3 seconds."; private static final String gunslinger_0_7_18_0 = "Compounding Impact"; private static final String gunslinger_0_7_18_1 = "Each shot of Speed Shot and Penetrating Rounds snare the target by 20% for 3 seconds. The effect can stack up to 4 times."; private static final String gunslinger_0_7_19_0 = "Riot Screen"; private static final String gunslinger_0_7_19_1 = "Reduces all damage taken while in cover by 6% and reduces the cooldown of Scrambling Field by 30 seconds."; private static final String gunslinger_0_7_20_0 = "Crippling Diversion"; private static final String gunslinger_0_7_20_1 = "Diversion slows all targets by 50% for as long as they remain in the area."; public String[] getUtilityDescription(int charAC, int position){ //guardian allDescriptions[0][0][0] = guardian_0_0_0_0; allDescriptions[0][0][1] = guardian_0_0_0_1; allDescriptions[0][1][0] = guardian_0_0_1_0; allDescriptions[0][1][1] = guardian_0_0_1_1; allDescriptions[0][2][0] = guardian_0_0_2_0; allDescriptions[0][2][1] = guardian_0_0_2_1; allDescriptions[0][3][0] = guardian_0_0_3_0; allDescriptions[0][3][1] = guardian_0_0_3_1; allDescriptions[0][4][0] = guardian_0_0_4_0; allDescriptions[0][4][1] = guardian_0_0_4_1; allDescriptions[0][5][0] = guardian_0_0_5_0; allDescriptions[0][5][1] = guardian_0_0_5_1; allDescriptions[0][6][0] = guardian_0_0_6_0; allDescriptions[0][6][1] = guardian_0_0_6_1; allDescriptions[0][7][0] = guardian_0_0_7_0; allDescriptions[0][7][1] = guardian_0_0_7_1; allDescriptions[0][8][0] = guardian_0_0_8_0; allDescriptions[0][8][1] = guardian_0_0_8_1; allDescriptions[0][9][0] = guardian_0_0_9_0; allDescriptions[0][9][1] = guardian_0_0_9_1; allDescriptions[0][10][0] = guardian_0_0_10_0; allDescriptions[0][10][1] = guardian_0_0_10_1; allDescriptions[0][11][0] = guardian_0_0_11_0; allDescriptions[0][11][1] = guardian_0_0_11_1; allDescriptions[0][12][0] = guardian_0_0_12_0; allDescriptions[0][12][1] = guardian_0_0_12_1; allDescriptions[0][13][0] = guardian_0_0_13_0; allDescriptions[0][13][1] = guardian_0_0_13_1; allDescriptions[0][14][0] = guardian_0_0_14_0; allDescriptions[0][14][1] = guardian_0_0_14_1; allDescriptions[0][15][0] = guardian_0_0_15_0; allDescriptions[0][15][1] = guardian_0_0_15_1; allDescriptions[0][16][0] = guardian_0_0_16_0; allDescriptions[0][16][1] = guardian_0_0_16_1; allDescriptions[0][17][0] = guardian_0_0_17_0; allDescriptions[0][17][1] = guardian_0_0_17_1; allDescriptions[0][18][0] = guardian_0_0_18_0; allDescriptions[0][18][1] = guardian_0_0_18_1; allDescriptions[0][19][0] = guardian_0_0_19_0; allDescriptions[0][19][1] = guardian_0_0_19_1; allDescriptions[0][20][0] = guardian_0_0_20_0; allDescriptions[0][20][1] = guardian_0_0_20_1; //sent allDescriptions[1][0][0] = sentinel_0_1_0_0; allDescriptions[1][0][1] = sentinel_0_1_0_1; allDescriptions[1][1][0] = sentinel_0_1_1_0; allDescriptions[1][1][1] = sentinel_0_1_1_1; allDescriptions[1][2][0] = sentinel_0_1_2_0; allDescriptions[1][2][1] = sentinel_0_1_2_1; allDescriptions[1][3][0] = sentinel_0_1_3_0; allDescriptions[1][3][1] = sentinel_0_1_3_1; allDescriptions[1][4][0] = sentinel_0_1_4_0; allDescriptions[1][4][1] = sentinel_0_1_4_1; allDescriptions[1][5][0] = sentinel_0_1_5_0; allDescriptions[1][5][1] = sentinel_0_1_5_1; allDescriptions[1][6][0] = sentinel_0_1_6_0; allDescriptions[1][6][1] = sentinel_0_1_6_1; allDescriptions[1][7][0] = sentinel_0_1_7_0; allDescriptions[1][7][1] = sentinel_0_1_7_1; allDescriptions[1][8][0] = sentinel_0_1_8_0; allDescriptions[1][8][1] = sentinel_0_1_8_1; allDescriptions[1][9][0] = sentinel_0_1_9_0; allDescriptions[1][9][1] = sentinel_0_1_9_1; allDescriptions[1][10][0] = sentinel_0_1_10_0; allDescriptions[1][10][1] = sentinel_0_1_10_1; allDescriptions[1][11][0] = sentinel_0_1_11_0; allDescriptions[1][11][1] = sentinel_0_1_11_1; allDescriptions[1][12][0] = sentinel_0_1_12_0; allDescriptions[1][12][1] = sentinel_0_1_12_1; allDescriptions[1][13][0] = sentinel_0_1_13_0; allDescriptions[1][13][1] = sentinel_0_1_13_1; allDescriptions[1][14][0] = sentinel_0_1_14_0; allDescriptions[1][14][1] = sentinel_0_1_14_1; allDescriptions[1][15][0] = sentinel_0_1_15_0; allDescriptions[1][15][1] = sentinel_0_1_15_1; allDescriptions[1][16][0] = sentinel_0_1_16_0; allDescriptions[1][16][1] = sentinel_0_1_16_1; allDescriptions[1][17][0] = sentinel_0_1_17_0; allDescriptions[1][17][1] = sentinel_0_1_17_1; allDescriptions[1][18][0] = sentinel_0_1_18_0; allDescriptions[1][18][1] = sentinel_0_1_18_1; allDescriptions[1][19][0] = sentinel_0_1_19_0; allDescriptions[1][19][1] = sentinel_0_1_19_1; allDescriptions[1][20][0] = sentinel_0_1_20_0; allDescriptions[1][20][1] = sentinel_0_1_20_1; // sage allDescriptions[2][0][0] = sage_0_2_0_0; allDescriptions[2][0][1] = sage_0_2_0_1; allDescriptions[2][1][0] = sage_0_2_1_0; allDescriptions[2][1][1] = sage_0_2_1_1; allDescriptions[2][2][0] = sage_0_2_2_0; allDescriptions[2][2][1] = sage_0_2_2_1; allDescriptions[2][3][0] = sage_0_2_3_0; allDescriptions[2][3][1] = sage_0_2_3_1; allDescriptions[2][4][0] = sage_0_2_4_0; allDescriptions[2][4][1] = sage_0_2_4_1; allDescriptions[2][5][0] = sage_0_2_5_0; allDescriptions[2][5][1] = sage_0_2_5_1; allDescriptions[2][6][0] = sage_0_2_6_0; allDescriptions[2][6][1] = sage_0_2_6_1; allDescriptions[2][7][0] = sage_0_2_7_0; allDescriptions[2][7][1] = sage_0_2_7_1; allDescriptions[2][8][0] = sage_0_2_8_0; allDescriptions[2][8][1] = sage_0_2_8_1; allDescriptions[2][9][0] = sage_0_2_9_0; allDescriptions[2][9][1] = sage_0_2_9_1; allDescriptions[2][10][0] = sage_0_2_10_0; allDescriptions[2][10][1] = sage_0_2_10_1; allDescriptions[2][11][0] = sage_0_2_11_0; allDescriptions[2][11][1] = sage_0_2_11_1; allDescriptions[2][12][0] = sage_0_2_12_0; allDescriptions[2][12][1] = sage_0_2_12_1; allDescriptions[2][13][0] = sage_0_2_13_0; allDescriptions[2][13][1] = sage_0_2_13_1; allDescriptions[2][14][0] = sage_0_2_14_0; allDescriptions[2][14][1] = sage_0_2_14_1; allDescriptions[2][15][0] = sage_0_2_15_0; allDescriptions[2][15][1] = sage_0_2_15_1; allDescriptions[2][16][0] = sage_0_2_16_0; allDescriptions[2][16][1] = sage_0_2_16_1; allDescriptions[2][17][0] = sage_0_2_17_0; allDescriptions[2][17][1] = sage_0_2_17_1; allDescriptions[2][18][0] = sage_0_2_18_0; allDescriptions[2][18][1] = sage_0_2_18_1; allDescriptions[2][19][0] = sage_0_2_19_0; allDescriptions[2][19][1] = sage_0_2_19_1; allDescriptions[2][20][0] = sage_0_2_20_0; allDescriptions[2][20][1] = sage_0_2_20_1; // shadow allDescriptions[3][0][0] = shadow_0_3_0_0; allDescriptions[3][0][1] = shadow_0_3_0_1; allDescriptions[3][1][0] = shadow_0_3_1_0; allDescriptions[3][1][1] = shadow_0_3_1_1; allDescriptions[3][2][0] = shadow_0_3_2_0; allDescriptions[3][2][1] = shadow_0_3_2_1; allDescriptions[3][3][0] = shadow_0_3_3_0; allDescriptions[3][3][1] = shadow_0_3_3_1; allDescriptions[3][4][0] = shadow_0_3_4_0; allDescriptions[3][4][1] = shadow_0_3_4_1; allDescriptions[3][5][0] = shadow_0_3_5_0; allDescriptions[3][5][1] = shadow_0_3_5_1; allDescriptions[3][6][0] = shadow_0_3_6_0; allDescriptions[3][6][1] = shadow_0_3_6_1; allDescriptions[3][7][0] = shadow_0_3_7_0; allDescriptions[3][7][1] = shadow_0_3_7_1; allDescriptions[3][8][0] = shadow_0_3_8_0; allDescriptions[3][8][1] = shadow_0_3_8_1; allDescriptions[3][9][0] = shadow_0_3_9_0; allDescriptions[3][9][1] = shadow_0_3_9_1; allDescriptions[3][10][0] = shadow_0_3_10_0; allDescriptions[3][10][1] = shadow_0_3_10_1; allDescriptions[3][11][0] = shadow_0_3_11_0; allDescriptions[3][11][1] = shadow_0_3_11_1; allDescriptions[3][12][0] = shadow_0_3_12_0; allDescriptions[3][12][1] = shadow_0_3_12_1; allDescriptions[3][13][0] = shadow_0_3_13_0; allDescriptions[3][13][1] = shadow_0_3_13_1; allDescriptions[3][14][0] = shadow_0_3_14_0; allDescriptions[3][14][1] = shadow_0_3_14_1; allDescriptions[3][15][0] = shadow_0_3_15_0; allDescriptions[3][15][1] = shadow_0_3_15_1; allDescriptions[3][16][0] = shadow_0_3_16_0; allDescriptions[3][16][1] = shadow_0_3_16_1; allDescriptions[3][17][0] = shadow_0_3_17_0; allDescriptions[3][17][1] = shadow_0_3_17_1; allDescriptions[3][18][0] = shadow_0_3_18_0; allDescriptions[3][18][1] = shadow_0_3_18_1; allDescriptions[3][19][0] = shadow_0_3_19_0; allDescriptions[3][19][1] = shadow_0_3_19_1; allDescriptions[3][20][0] = shadow_0_3_20_0; allDescriptions[3][20][1] = shadow_0_3_20_1; // commando allDescriptions[4][0][0] = commando_0_4_0_0; allDescriptions[4][0][1] = commando_0_4_0_1; allDescriptions[4][1][0] = commando_0_4_1_0; allDescriptions[4][1][1] = commando_0_4_1_1; allDescriptions[4][2][0] = commando_0_4_2_0; allDescriptions[4][2][1] = commando_0_4_2_1; allDescriptions[4][3][0] = commando_0_4_3_0; allDescriptions[4][3][1] = commando_0_4_3_1; allDescriptions[4][4][0] = commando_0_4_4_0; allDescriptions[4][4][1] = commando_0_4_4_1; allDescriptions[4][5][0] = commando_0_4_5_0; allDescriptions[4][5][1] = commando_0_4_5_1; allDescriptions[4][6][0] = commando_0_4_6_0; allDescriptions[4][6][1] = commando_0_4_6_1; allDescriptions[4][7][0] = commando_0_4_7_0; allDescriptions[4][7][1] = commando_0_4_7_1; allDescriptions[4][8][0] = commando_0_4_8_0; allDescriptions[4][8][1] = commando_0_4_8_1; allDescriptions[4][9][0] = commando_0_4_9_0; allDescriptions[4][9][1] = commando_0_4_9_1; allDescriptions[4][10][0] = commando_0_4_10_0; allDescriptions[4][10][1] = commando_0_4_10_1; allDescriptions[4][11][0] = commando_0_4_11_0; allDescriptions[4][11][1] = commando_0_4_11_1; allDescriptions[4][12][0] = commando_0_4_12_0; allDescriptions[4][12][1] = commando_0_4_12_1; allDescriptions[4][13][0] = commando_0_4_13_0; allDescriptions[4][13][1] = commando_0_4_13_1; allDescriptions[4][14][0] = commando_0_4_14_0; allDescriptions[4][14][1] = commando_0_4_14_1; allDescriptions[4][15][0] = commando_0_4_15_0; allDescriptions[4][15][1] = commando_0_4_15_1; allDescriptions[4][16][0] = commando_0_4_16_0; allDescriptions[4][16][1] = commando_0_4_16_1; allDescriptions[4][17][0] = commando_0_4_17_0; allDescriptions[4][17][1] = commando_0_4_17_1; allDescriptions[4][18][0] = commando_0_4_18_0; allDescriptions[4][18][1] = commando_0_4_18_1; allDescriptions[4][19][0] = commando_0_4_19_0; allDescriptions[4][19][1] = commando_0_4_19_1; allDescriptions[4][20][0] = commando_0_4_20_0; allDescriptions[4][20][1] = commando_0_4_20_1; //vanguard allDescriptions[5][0][0] = vanguard_0_5_0_0; allDescriptions[5][0][1] = vanguard_0_5_0_1; allDescriptions[5][1][0] = vanguard_0_5_1_0; allDescriptions[5][1][1] = vanguard_0_5_1_1; allDescriptions[5][2][0] = vanguard_0_5_2_0; allDescriptions[5][2][1] = vanguard_0_5_2_1; allDescriptions[5][3][0] = vanguard_0_5_3_0; allDescriptions[5][3][1] = vanguard_0_5_3_1; allDescriptions[5][4][0] = vanguard_0_5_4_0; allDescriptions[5][4][1] = vanguard_0_5_4_1; allDescriptions[5][5][0] = vanguard_0_5_5_0; allDescriptions[5][5][1] = vanguard_0_5_5_1; allDescriptions[5][6][0] = vanguard_0_5_6_0; allDescriptions[5][6][1] = vanguard_0_5_6_1; allDescriptions[5][7][0] = vanguard_0_5_7_0; allDescriptions[5][7][1] = vanguard_0_5_7_1; allDescriptions[5][8][0] = vanguard_0_5_8_0; allDescriptions[5][8][1] = vanguard_0_5_8_1; allDescriptions[5][9][0] = vanguard_0_5_9_0; allDescriptions[5][9][1] = vanguard_0_5_9_1; allDescriptions[5][10][0] = vanguard_0_5_10_0; allDescriptions[5][10][1] = vanguard_0_5_10_1; allDescriptions[5][11][0] = vanguard_0_5_11_0; allDescriptions[5][11][1] = vanguard_0_5_11_1; allDescriptions[5][12][0] = vanguard_0_5_12_0; allDescriptions[5][12][1] = vanguard_0_5_12_1; allDescriptions[5][13][0] = vanguard_0_5_13_0; allDescriptions[5][13][1] = vanguard_0_5_13_1; allDescriptions[5][14][0] = vanguard_0_5_14_0; allDescriptions[5][14][1] = vanguard_0_5_14_1; allDescriptions[5][15][0] = vanguard_0_5_15_0; allDescriptions[5][15][1] = vanguard_0_5_15_1; allDescriptions[5][16][0] = vanguard_0_5_16_0; allDescriptions[5][16][1] = vanguard_0_5_16_1; allDescriptions[5][17][0] = vanguard_0_5_17_0; allDescriptions[5][17][1] = vanguard_0_5_17_1; allDescriptions[5][18][0] = vanguard_0_5_18_0; allDescriptions[5][18][1] = vanguard_0_5_18_1; allDescriptions[5][19][0] = vanguard_0_5_19_0; allDescriptions[5][19][1] = vanguard_0_5_19_1; allDescriptions[5][20][0] = vanguard_0_5_20_0; allDescriptions[5][20][1] = vanguard_0_5_20_1; //scoundrel allDescriptions[6][0][0] = scoundrel_0_6_0_0; allDescriptions[6][0][1] = scoundrel_0_6_0_1; allDescriptions[6][1][0] = scoundrel_0_6_1_0; allDescriptions[6][1][1] = scoundrel_0_6_1_1; allDescriptions[6][2][0] = scoundrel_0_6_2_0; allDescriptions[6][2][1] = scoundrel_0_6_2_1; allDescriptions[6][3][0] = scoundrel_0_6_3_0; allDescriptions[6][3][1] = scoundrel_0_6_3_1; allDescriptions[6][4][0] = scoundrel_0_6_4_0; allDescriptions[6][4][1] = scoundrel_0_6_4_1; allDescriptions[6][5][0] = scoundrel_0_6_5_0; allDescriptions[6][5][1] = scoundrel_0_6_5_1; allDescriptions[6][6][0] = scoundrel_0_6_6_0; allDescriptions[6][6][1] = scoundrel_0_6_6_1; allDescriptions[6][7][0] = scoundrel_0_6_7_0; allDescriptions[6][7][1] = scoundrel_0_6_7_1; allDescriptions[6][8][0] = scoundrel_0_6_8_0; allDescriptions[6][8][1] = scoundrel_0_6_8_1; allDescriptions[6][9][0] = scoundrel_0_6_9_0; allDescriptions[6][9][1] = scoundrel_0_6_9_1; allDescriptions[6][10][0] = scoundrel_0_6_10_0; allDescriptions[6][10][1] = scoundrel_0_6_10_1; allDescriptions[6][11][0] = scoundrel_0_6_11_0; allDescriptions[6][11][1] = scoundrel_0_6_11_1; allDescriptions[6][12][0] = scoundrel_0_6_12_0; allDescriptions[6][12][1] = scoundrel_0_6_12_1; allDescriptions[6][13][0] = scoundrel_0_6_13_0; allDescriptions[6][13][1] = scoundrel_0_6_13_1; allDescriptions[6][14][0] = scoundrel_0_6_14_0; allDescriptions[6][14][1] = scoundrel_0_6_14_1; allDescriptions[6][15][0] = scoundrel_0_6_15_0; allDescriptions[6][15][1] = scoundrel_0_6_15_1; allDescriptions[6][16][0] = scoundrel_0_6_16_0; allDescriptions[6][16][1] = scoundrel_0_6_16_1; allDescriptions[6][17][0] = scoundrel_0_6_17_0; allDescriptions[6][17][1] = scoundrel_0_6_17_1; allDescriptions[6][18][0] = scoundrel_0_6_18_0; allDescriptions[6][18][1] = scoundrel_0_6_18_1; allDescriptions[6][19][0] = scoundrel_0_6_19_0; allDescriptions[6][19][1] = scoundrel_0_6_19_1; allDescriptions[6][20][0] = scoundrel_0_6_20_0; allDescriptions[6][20][1] = scoundrel_0_6_20_1; // gunslinger allDescriptions[7][0][0] = gunslinger_0_7_0_0; allDescriptions[7][0][1] = gunslinger_0_7_0_1; allDescriptions[7][1][0] = gunslinger_0_7_1_0; allDescriptions[7][1][1] = gunslinger_0_7_1_1; allDescriptions[7][2][0] = gunslinger_0_7_2_0; allDescriptions[7][2][1] = gunslinger_0_7_2_1; allDescriptions[7][3][0] = gunslinger_0_7_3_0; allDescriptions[7][3][1] = gunslinger_0_7_3_1; allDescriptions[7][4][0] = gunslinger_0_7_4_0; allDescriptions[7][4][1] = gunslinger_0_7_4_1; allDescriptions[7][5][0] = gunslinger_0_7_5_0; allDescriptions[7][5][1] = gunslinger_0_7_5_1; allDescriptions[7][6][0] = gunslinger_0_7_6_0; allDescriptions[7][6][1] = gunslinger_0_7_6_1; allDescriptions[7][7][0] = gunslinger_0_7_7_0; allDescriptions[7][7][1] = gunslinger_0_7_7_1; allDescriptions[7][8][0] = gunslinger_0_7_8_0; allDescriptions[7][8][1] = gunslinger_0_7_8_1; allDescriptions[7][9][0] = gunslinger_0_7_9_0; allDescriptions[7][9][1] = gunslinger_0_7_9_1; allDescriptions[7][10][0] = gunslinger_0_7_10_0; allDescriptions[7][10][1] = gunslinger_0_7_10_1; allDescriptions[7][11][0] = gunslinger_0_7_11_0; allDescriptions[7][11][1] = gunslinger_0_7_11_1; allDescriptions[7][12][0] = gunslinger_0_7_12_0; allDescriptions[7][12][1] = gunslinger_0_7_12_1; allDescriptions[7][13][0] = gunslinger_0_7_13_0; allDescriptions[7][13][1] = gunslinger_0_7_13_1; allDescriptions[7][14][0] = gunslinger_0_7_14_0; allDescriptions[7][14][1] = gunslinger_0_7_14_1; allDescriptions[7][15][0] = gunslinger_0_7_15_0; allDescriptions[7][15][1] = gunslinger_0_7_15_1; allDescriptions[7][16][0] = gunslinger_0_7_16_0; allDescriptions[7][16][1] = gunslinger_0_7_16_1; allDescriptions[7][17][0] = gunslinger_0_7_17_0; allDescriptions[7][17][1] = gunslinger_0_7_17_1; allDescriptions[7][18][0] = gunslinger_0_7_18_0; allDescriptions[7][18][1] = gunslinger_0_7_18_1; allDescriptions[7][19][0] = gunslinger_0_7_19_0; allDescriptions[7][19][1] = gunslinger_0_7_19_1; allDescriptions[7][20][0] = gunslinger_0_7_20_0; allDescriptions[7][20][1] = gunslinger_0_7_20_1; this.ac = charAC; this.utPointPossition = position; desc[0] = allDescriptions[ac][utPointPossition][0]; desc[1] = allDescriptions[ac][utPointPossition][1]; return desc;} }
64.97351
404
0.732698
90d36f66896121a9cb534b32b957815c2c588077
39
dart
Dart
alryne/lib/alryne.dart
goldenercobra/alryne
3b22d0d23c7a16e32d48479380ff6ac723b50a19
[ "MIT" ]
null
null
null
alryne/lib/alryne.dart
goldenercobra/alryne
3b22d0d23c7a16e32d48479380ff6ac723b50a19
[ "MIT" ]
7
2018-02-22T20:07:37.000Z
2018-03-09T17:57:28.000Z
alryne/lib/alryne.dart
goldenercobra/alryne
3b22d0d23c7a16e32d48479380ff6ac723b50a19
[ "MIT" ]
null
null
null
library alryne; export 'models.dart';
9.75
21
0.74359
84965893de1c8e5bf5e430f97286b33d6e714e0f
875
swift
Swift
Sheet Views/Views/AvatarSheetView.swift
Billionapp/alertgridbuilder
a67f1b029e06c19c56975e87887f52c729847479
[ "MIT" ]
null
null
null
Sheet Views/Views/AvatarSheetView.swift
Billionapp/alertgridbuilder
a67f1b029e06c19c56975e87887f52c729847479
[ "MIT" ]
null
null
null
Sheet Views/Views/AvatarSheetView.swift
Billionapp/alertgridbuilder
a67f1b029e06c19c56975e87887f52c729847479
[ "MIT" ]
null
null
null
// // AvatarSheetView.swift // BillionWallet // // Created by Evolution Group Ltd on 14/09/2017. // Copyright © 2017 Evolution Group Ltd. All rights reserved. // import UIKit class AvatarSheetView: LoadableFromXibView { @IBOutlet weak var imageButton: UIButton! override func xibSetup() { super.xibSetup() view.backgroundColor = .clear imageButton.layer.cornerRadius = 15 imageButton.layer.masksToBounds = true imageButton.imageView?.contentMode = .scaleAspectFill } @IBAction func avatarPressed(_ sender: UIButton) { ViewAction(.click, sender: self).invoke() } } // MARK: - Configurable extension AvatarSheetView: Configurable { func configure(with model: UIImage?) { imageButton.setImage(model ?? UIImage(named: "Avatar"), for: .normal) } }
21.875
77
0.650286
ddd51dfff5f3961af75ab046b1d33db8382068b5
211
php
PHP
app/Helpers/Func.php
dominhquan12121994/localtraining.com
4cf1be9ca309d8b2ff56bb1d336f467c4115ec11
[ "MIT" ]
null
null
null
app/Helpers/Func.php
dominhquan12121994/localtraining.com
4cf1be9ca309d8b2ff56bb1d336f467c4115ec11
[ "MIT" ]
null
null
null
app/Helpers/Func.php
dominhquan12121994/localtraining.com
4cf1be9ca309d8b2ff56bb1d336f467c4115ec11
[ "MIT" ]
null
null
null
<?php namespace App\Helpers; class Func { public static function getMicroTime(){ return microtime(true) * 1000; } public function logError($message){ \Log::error($message); } }
15.071429
42
0.616114
b2a99cd476c507258bc19da6556cec5bb7279b81
392
rs
Rust
src/types/parameters.rs
tbot-rs/tbot
6af546982139fffaeb73277cebedcbf7e69ed7bf
[ "MIT" ]
26
2020-05-15T19:53:26.000Z
2022-01-27T14:17:51.000Z
src/types/parameters.rs
tbot-rs/tbot
6af546982139fffaeb73277cebedcbf7e69ed7bf
[ "MIT" ]
2
2020-05-15T19:55:05.000Z
2020-12-26T07:49:19.000Z
src/types/parameters.rs
tbot-rs/tbot
6af546982139fffaeb73277cebedcbf7e69ed7bf
[ "MIT" ]
2
2020-11-08T16:32:29.000Z
2020-12-09T14:19:51.000Z
//! Types used as parameters, mainly for methods. mod allowed_updates; mod callback_action; mod chat_id; mod invoice; mod photo; pub mod poll; mod text; mod tip; pub(crate) use text::ParseMode; pub use { allowed_updates::AllowedUpdates, callback_action::CallbackAction, chat_id::{ChatId, ImplicitChatId}, invoice::Invoice, photo::Photo, text::Text, tip::Tip, };
17.818182
49
0.706633
56cedf68865037cb3bba7462e9e08d7e45af5190
16,844
tsx
TypeScript
src/app/etl/ETLAjax.tsx
DABH/terrain
e938bbdb2a4caf7c05ff33c1cdd0682becadf981
[ "Apache-2.0", "CC0-1.0" ]
7
2019-01-07T23:50:08.000Z
2019-08-29T04:22:52.000Z
src/app/etl/ETLAjax.tsx
DABH/terrain
e938bbdb2a4caf7c05ff33c1cdd0682becadf981
[ "Apache-2.0", "CC0-1.0" ]
12
2020-03-17T02:50:51.000Z
2022-03-08T22:52:18.000Z
src/app/etl/ETLAjax.tsx
DABH/terrain
e938bbdb2a4caf7c05ff33c1cdd0682becadf981
[ "Apache-2.0", "CC0-1.0" ]
1
2019-01-08T03:06:29.000Z
2019-01-08T03:06:29.000Z
/* University of Illinois/NCSA Open Source License Copyright (c) 2018 Terrain Data, Inc. and the authors. All rights reserved. Developed by: Terrain Data, Inc. and the individuals who committed the code in this file. https://github.com/terraindata/terrain Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal with the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimers. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimers in the documentation and/or other materials provided with the distribution. * Neither the names of Terrain Data, Inc., Terrain, nor the names of its contributors may be used to endorse or promote products derived from this Software without specific prior written permission. This license supersedes any copyright notice, license, or related statement following this comment block. All files in this repository are provided under the same license, regardless of whether a corresponding comment block appears in them. This license also applies retroactively to any previous state of the repository, including different branches and commits, which were made public on or after December 8th, 2018. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. */ // Copyright 2018 Terrain Data, Inc. import { List } from 'immutable'; import * as _ from 'lodash'; import * as download from 'downloadjs'; import MidwayError from 'shared/error/MidwayError'; import { SourceConfig } from 'shared/etl/immutable/EndpointRecords'; import { JobConfig } from 'shared/types/jobs/JobConfig'; import { TaskEnum } from 'shared/types/jobs/TaskEnum'; import { recordForSave } from 'shared/util/Classes'; import { AuthActions as Actions } from 'src/app/auth/data/AuthRedux'; import { Ajax } from 'util/Ajax'; import { _ETLTemplate, ETLTemplate, templateForBackend } from 'shared/etl/immutable/TemplateRecords'; import { TemplateBase } from 'shared/etl/types/ETLTypes'; export type ErrorHandler = (response: string | MidwayError) => void; // making this an instance in case we want stateful things like cancelling ajax requests class ETLAjax { public getIntegrations(simple?: boolean): Promise<any[]> { return new Promise((resolve, reject) => { const handleResponse = (response: any) => { resolve(response); }; return Ajax.req( 'get', simple ? 'integrations/simple/' : 'integrations/', {}, handleResponse, { onError: handlerFactory(reject), }); }); } public getIntegration(integrationId: ID, simple?: boolean): Promise<any> { return new Promise((resolve, reject) => { const handleResponse = (response: any) => { resolve(response); }; return Ajax.req( 'get', simple ? `integrations/simple/${integrationId}` : `integrations/${integrationId}`, {}, handleResponse, { onError: handlerFactory(reject), }); }); } public createIntegration(integration: any): Promise<any> { return new Promise((resolve, reject) => { const handleResponse = (response: any) => { resolve(response); }; return Ajax.req( 'post', `integrations/`, integration, handleResponse, { onError: handlerFactory(reject), }); }); } public updateIntegration(integrationId: ID, integration: any): Promise<any> { return new Promise((resolve, reject) => { const handleResponse = (response: any) => { resolve(response); }; return Ajax.req( 'post', `integrations/${integrationId}`, integration, handleResponse, { onError: handlerFactory(reject), }); }); } public deleteIntegration(integrationId: ID): Promise<any> { return new Promise((resolve, reject) => { const handleResponse = (response: any) => { resolve(response); }; return Ajax.req( 'post', `integrations/delete/${integrationId}`, {}, handleResponse, { onError: handlerFactory(reject), }); }); } public templatesToImmutable(templates: TemplateBase[]): List<ETLTemplate> { try { return List(templates) .map((template, index) => _ETLTemplate(template as TemplateBase, true)) .toList(); } catch (e) { // todo better error handleing // tslint:disable-next-line console.error(`Error trying to parse templates ${String(e)}`); return List([]); } } public fetchTemplates(): Promise<List<ETLTemplate>> { return new Promise((resolve, reject) => { const handleResponse = (templates: TemplateBase[]) => { resolve(this.templatesToImmutable(templates)); }; return Ajax.req( 'get', 'etl/templates', {}, handleResponse, { onError: handlerFactory(reject), }, ); }); } public getTemplate(id: number): Promise<List<ETLTemplate>> { return new Promise((resolve, reject) => { const handleResponse = (templates: TemplateBase[]) => { resolve(this.templatesToImmutable(templates)); }; return Ajax.req( 'get', `etl/templates/${id}`, {}, handleResponse, { onError: handlerFactory(reject), }, ); }); } public deleteTemplate(template: ETLTemplate): Promise<void> { return new Promise((resolve, reject) => { const handleResponse = (response: any) => { resolve(); }; return Ajax.req( 'post', 'etl/templates/delete', { templateId: template.id, }, handleResponse, { onError: handlerFactory(reject), }, ); }); } public createTemplate(template: ETLTemplate): Promise<List<ETLTemplate>> { const templateToSave = templateForBackend(template); return new Promise((resolve, reject) => { const handleResponse = (templates: TemplateBase[]) => { resolve(this.templatesToImmutable(templates)); }; return Ajax.req( 'post', `etl/templates/create`, templateToSave, handleResponse, { onError: handlerFactory(reject), }, ); }); } public saveTemplate(template: ETLTemplate): Promise<List<ETLTemplate>> { return new Promise((resolve, reject) => { const id = template.id; const templateToSave = templateForBackend(template); const handleResponse = (templates: TemplateBase[]) => { resolve(this.templatesToImmutable(templates)); }; if (typeof id !== 'number') { reject(`id "${id}" is invalid`); } return Ajax.req( 'post', `etl/templates/update/${id}`, templateToSave, handleResponse, { onError: handlerFactory(reject), }, ); }); } public createExecuteJob(templateName: string): Promise<number> { return new Promise((resolve, reject) => { const job: JobConfig = { meta: null, pausedFilename: null, running: false, runNowPriority: null, scheduleId: null, status: null, workerId: null, name: 'ETL - ' + (templateName.length > 0 ? templateName : 'Unsaved Template'), createdBy: null, priority: -1, type: 'ETL', tasks: JSON.stringify([ { id: 0, taskId: TaskEnum.taskETL, params: null, }, ]), }; return Ajax.req( 'post', 'jobs/', job, (resp) => { if (resp[0] !== undefined) { const jobId = Number(resp[0].id); if (!Number.isNaN(jobId)) { return resolve(jobId); } } return reject('No Job Id Returned.'); }, { onError: handlerFactory(reject), }, ); }); } public runExecuteJob( jobId: number, template: ETLTemplate, files?: { [k: string]: File }, downloadName?: string, mimeType?: string, onProgress?: (progress: string) => void, ): Promise<any> { return new Promise((resolve, reject) => { const config: ReqConfig = { onError: reject, downloadName, mimeType, onProgress, }; const templateToRun = JSON.stringify(templateForBackend(template)); const isUpload = files !== undefined && Object.keys(files).length > 0; const payload = files !== undefined ? files : {}; _.extend(payload, { template: templateToRun }); if (config.downloadName !== undefined && !isUpload) { this.downloadFile( `jobs/runnow/${jobId}`, payload, (resp) => resolve(resp), config, ); } else { this.reqFormData( `jobs/runnow/${jobId}`, payload, (resp) => resolve(resp), config, ); } }); } public fetchPreview( source: SourceConfig, size: number, rawStringOnly: boolean, fileString?: string, ): Promise<List<object> | object> { return new Promise((resolve, reject) => { const handleResponse = (response: any) => { if (rawStringOnly === true) { if (response !== undefined) { resolve(response.result); } else { throw new Error('No valid response'); } } else { let documents; try { documents = List(response); } catch (e) { return reject(e); } if (documents !== undefined) { resolve(documents); } else { throw new Error('No valid response'); } } }; const payload = { source: recordForSave(source), size, fileString, rawString: rawStringOnly, }; return Ajax.req( 'post', 'etl/preview', payload, handleResponse, { onError: handlerFactory(reject), }, ); }); } // should this be in schema? public getMapping( serverId: string, database: string, ): Promise<object> { return new Promise((resolve, reject) => { const handleResponse = (response: any) => { resolve(response); }; return Ajax.req( 'get', `schema/${serverId}/${database}`, {}, handleResponse, { onError: handlerFactory(reject), }, ); }); } private downloadFile( route: string, data: { [k: string]: string | File, }, handleResponse: (response: any) => void, cfg: ReqConfig, ) { const fullUrl = '/midway/v1/' + route; const form = document.createElement('form'); form.setAttribute('action', fullUrl); form.setAttribute('method', 'post'); form.setAttribute('target', '_self'); data['id'] = localStorage['id']; data['accessToken'] = localStorage['accessToken']; data['downloadName'] = cfg.downloadName; Object.keys(data).forEach((key) => { const input = document.createElement('input'); input.setAttribute('type', 'hidden'); input.setAttribute('name', key); input.setAttribute('value', data[key] as any); form.appendChild(input); }); document.body.appendChild(form); // Required for FF form.submit(); form.remove(); handleResponse(''); return; } private reqFormData( route: string, data: { [k: string]: string | File, }, handleResponse: (response: any) => void, cfg: ReqConfig, ) { const isDownload = cfg.downloadName !== undefined; const config: ReqConfig = _.extend({ onError: () => null, downloadName: 'file.txt', mimeType: 'text/plain', }, cfg); const formData = new FormData(); formData.append('id', String(localStorage['id'])); formData.append('accessToken', localStorage['accessToken']); for (const key of Object.keys(data)) { formData.append(key, data[key]); } const xhr = new XMLHttpRequest(); if (isDownload) { xhr.responseType = 'blob'; } xhr.onerror = (err: any) => { const routeError: MidwayError = new MidwayError(400, 'The Connection Has Been Lost.', JSON.stringify(err), {}); config.onError(routeError); }; xhr.onload = (ev: Event) => { if (xhr.status === 401) { // TODO re-enable Ajax.reduxStoreDispatch(Actions({ actionType: 'logout' })); } if (xhr.status !== 200) { config.onError(xhr.responseText); return; } if (isDownload) { download((ev.target as any).response, config.downloadName, config.mimeType); handleResponse(''); } else { handleResponse(xhr.responseText); } }; if (config.onProgress !== undefined) { xhr.upload.addEventListener('progress', (e: ProgressEvent) => { let percent = 0; if (e.total !== 0) { percent = (e.loaded / e.total) * 100; const progress = `Uploading file...${Math.round(percent)}%`; config.onProgress(progress); } }, false); // TODO: Think of a better way to show this progress // xhr.onprogress = (ev: Event) => // { // try // { // const responseText = xhr.responseText.slice(xhr.responseText.lastIndexOf('{'), xhr.responseText.lastIndexOf('}') + 1); // const response = JSON.parse(responseText); // config.onProgress(`Documents processed...${response.successful}`); // } // catch (e) // { // // do nothing // } // } } xhr.open('post', '/midway/v1/' + route); xhr.send(formData); } } interface ReqConfig { onError?: (response: any) => void; downloadName?: string; mimeType?: string; onProgress?: (progress: string) => void; } export interface ExecuteConfig { files?: { [id: string]: File; }; download?: { downloadFilename?: string; mimeType?: string; }; } export function errorToReadable(err: any, defaultMsg: string = 'Unknown Error Occurred') { try { if (err == null) { return defaultMsg; } else if (typeof err.getDetail === 'function') // if the error is already a midway error { return err.getDetail(); } try { try { // attempt to see if the midway error was created from an already wrapped error const detailError = _.get(err, ['response', 'data', 'errors', 0, 'detail']); if (detailError !== undefined && detailError !== null) { if (typeof detailError === 'object') { return JSON.stringify(detailError); } else { return detailError; } } } catch (e) { // do nothing } const readable = MidwayError.fromJSON(err).getDetail(); return readable; } catch (e) { if (typeof err === 'object') { return JSON.stringify(err); } else if (typeof err === 'string') { return err; } } } catch (e) { return defaultMsg; } return defaultMsg; } function handlerFactory(reject) { return (err) => reject(errorToReadable(err)); } export default new ETLAjax();
25.028232
131
0.568095
6fd4bd031d7c477f86c5b06125d7b5bb8a332a86
3,216
lua
Lua
Interface/AddOns/DBM-WorldEvents/Holidays/HeadlessHorseman.lua
liruqi/bigfoot
813a437268b6c55d9b0dc71ed4578753af6166f2
[ "MIT" ]
null
null
null
Interface/AddOns/DBM-WorldEvents/Holidays/HeadlessHorseman.lua
liruqi/bigfoot
813a437268b6c55d9b0dc71ed4578753af6166f2
[ "MIT" ]
null
null
null
Interface/AddOns/DBM-WorldEvents/Holidays/HeadlessHorseman.lua
liruqi/bigfoot
813a437268b6c55d9b0dc71ed4578753af6166f2
[ "MIT" ]
1
2021-06-22T17:25:11.000Z
2021-06-22T17:25:11.000Z
local mod = DBM:NewMod("d285", "DBM-WorldEvents", 1) local L = mod:GetLocalizedStrings() mod:SetRevision(("$Revision: 17257 $"):sub(12, -3)) mod:SetCreatureID(23682, 23775) --mod:SetModelID(22351)--Model doesn't work/render for some reason. mod:SetZone() mod:SetReCombatTime(10) mod:RegisterCombat("combat") --mod:RegisterEvents( -- "CHAT_MSG_SAY" --) mod:RegisterEventsInCombat( "SPELL_AURA_APPLIED 42380 42514", "UNIT_SPELLCAST_SUCCEEDED target focus", "CHAT_MSG_MONSTER_SAY", "UNIT_DIED" ) local warnConflag = mod:NewTargetAnnounce(42380, 3) local warnSquashSoul = mod:NewTargetAnnounce(42514, 2, nil, false, 2) local warnPhase = mod:NewAnnounce("WarnPhase", 2, "Interface\\Icons\\Spell_Nature_WispSplode") local warnHorsemanSoldiers = mod:NewAnnounce("warnHorsemanSoldiers", 2, 97133) local warnHorsemanHead = mod:NewAnnounce("warnHorsemanHead", 3) --local timerCombatStart = mod:NewCombatTimer(17)--rollplay for first pull local timerConflag = mod:NewTargetTimer(4, 42380, nil, "Healer", nil, 3) local timerSquashSoul = mod:NewTargetTimer(15, 42514, nil, false, 2, 3) function mod:SPELL_AURA_APPLIED(args) local spellId = args.spellId if spellId == 42380 then -- Conflagration warnConflag:Show(args.destName) timerConflag:Start(args.destName) elseif spellId == 42514 then -- Squash Soul warnSquashSoul:Show(args.destName) timerSquashSoul:Start(args.destName) end end function mod:UNIT_SPELLCAST_SUCCEEDED(uId, _, _, _, spellId) -- "<48.6> Headless Horseman:Possible Target<Omegal>:target:Headless Horseman Climax - Command, Head Repositions::0:42410", -- [35] if spellId == 42410 then self:SendSync("HeadRepositions") -- "<23.0> Headless Horseman:Possible Target<nil>:target:Headless Horseman Climax, Body Stage 1::0:42547", -- [1] elseif spellId == 42547 then self:SendSync("BodyStage1") -- "<49.0> Headless Horseman:Possible Target<Omegal>:target:Headless Horseman Climax, Body Stage 2::0:42548", -- [7] elseif spellId == 42548 then self:SendSync("BodyStage2") -- "<70.6> Headless Horseman:Possible Target<Omegal>:target:Headless Horseman Climax, Body Stage 3::0:42549", -- [13] elseif spellId == 42549 then self:SendSync("BodyStage3") end end --Use syncing since these unit events require "target" or "focus" to detect. --At least someone in group should be targeting this stuff and sync it to those that aren't (like a healer) function mod:OnSync(event, arg) if event == "HeadRepositions" then warnHorsemanHead:Show() elseif event == "BodyStage1" then warnPhase:Show(1) elseif event == "BodyStage2" then warnPhase:Show(2) elseif event == "BodyStage3" then warnPhase:Show(3) end end function mod:CHAT_MSG_MONSTER_SAY(msg) if msg == L.HorsemanSoldiers and self:AntiSpam(5, 1) then -- Warning for adds spawning. No CLEU or UNIT event for it. warnHorsemanSoldiers:Show() end end --[[ function mod:CHAT_MSG_SAY(msg) if msg == L.HorsemanSummon and self:AntiSpam(5) then -- Summoned timerCombatStart:Start() end end--]] function mod:UNIT_DIED(args) if self:GetCIDFromGUID(args.destGUID) == 23775 then DBM:EndCombat(self) end end
34.956522
132
0.722637
9635743011a1012c0b2225fd5b85ab69dbe9b68b
1,750
php
PHP
application/views/QUEUESYS/current-queue.php
randytrinitylagdaan/trinitysofteng
90a3881618403ac592c8b06e5e78fcae9b209b7b
[ "MIT" ]
null
null
null
application/views/QUEUESYS/current-queue.php
randytrinitylagdaan/trinitysofteng
90a3881618403ac592c8b06e5e78fcae9b209b7b
[ "MIT" ]
null
null
null
application/views/QUEUESYS/current-queue.php
randytrinitylagdaan/trinitysofteng
90a3881618403ac592c8b06e5e78fcae9b209b7b
[ "MIT" ]
1
2018-12-08T14:12:54.000Z
2018-12-08T14:12:54.000Z
<div class="level2"> <link rel="stylesheet" href="<?php echo base_url();?>assets/stylesheets/infotech/queuesys.css"></link> <div class="large-list-box-50"> <b> <?php echo $ID; ?> </b> <b> <?php echo $customerNumber; ?> </b> <span><a href="javascript:void(0)" class="small-button" onclick="finishQueue('<?php echo $ID; ?>', '<?php echo $customerNumber; ?>')" >DONE</a></span> </div> </div> <script> function finishQueue(ID, customerNumber) { jQuery.ajax({ url: "finishQueueNumberQUEUESYS", data: { 'ID': ID, 'customerNumber': customerNumber, }, type: "POST", success:function(data){ var resultValue = $.parseJSON(data); if(resultValue['success'] == 1) { reloadOperator(resultValue['ID'], resultValue['customerNumber']); return true; } else { return false; } }, error:function (){} }); //jQuery.ajax({ } function reloadOperator(ID, customerNumber) { jQuery.ajax({ url: "QUEUESYS/serverOperator", data: { 'ID':ID, 'customerNumber': customerNumber, }, type: "POST", success:function(data){ $('div.level1').remove(); $('div.level2').remove(); $('.levelonecontent').append(data); }, error:function (){} }); //jQuery.ajax({ } </script>
29.661017
158
0.433714
17aafe1366a095e6983ced6baf40bf0bb7ed356a
1,510
swift
Swift
Example/GotoCoreSwift/controller/AlertController.swift
varadig/GotoCoreSwift
10122839e8379a663831c79c5d5a97383c0b9fac
[ "MIT" ]
null
null
null
Example/GotoCoreSwift/controller/AlertController.swift
varadig/GotoCoreSwift
10122839e8379a663831c79c5d5a97383c0b9fac
[ "MIT" ]
null
null
null
Example/GotoCoreSwift/controller/AlertController.swift
varadig/GotoCoreSwift
10122839e8379a663831c79c5d5a97383c0b9fac
[ "MIT" ]
null
null
null
// // AlertController.swift // GotoCoreSwift // // Created by Gábor Váradi on 2018. 01. 04.. // Copyright © 2018. CocoaPods. All rights reserved. // import UIKit import GotoCoreSwift public class AlertController: CoreBaseClass { /*SERVICES*/ public static let SHOW_ALERT:String = "alert.controller.show.alert" /*PARAMS*/ public static let TITLE:String = "alert.controller.title" public static let MESSAGE:String = "alert.controller.message" public static let VC:String = "alert.controller.vc" private static var instance:AlertController? public static func getInstance()->AlertController{ if instance == nil{ instance = AlertController() } return instance! } public override init(){ super.init() self.sc.registerService(name: AlertController.SHOW_ALERT, reference: self.serviceShowAlert) } private func serviceShowAlert(params:[String:Any])->Void{ let alert = UIAlertController(title: params[AlertController.TITLE] as! String, message: params[AlertController.MESSAGE] as! String, preferredStyle: UIAlertControllerStyle.alert) alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil)) let viewController:GUIViewController = params[AlertController.VC] as! GUIViewController viewController.present(alert, animated: true, completion: nil) } }
32.12766
139
0.66755
6b666d606cfcedd184716088b49bb6617d145b18
199
h
C
Pod/Classes/PSDIAWSDynamoImporter.h
limey/pod-subspec-dependency-issue
d192e7729b74d30c80d8bcc3738d1d514e8fb1f1
[ "MIT" ]
null
null
null
Pod/Classes/PSDIAWSDynamoImporter.h
limey/pod-subspec-dependency-issue
d192e7729b74d30c80d8bcc3738d1d514e8fb1f1
[ "MIT" ]
null
null
null
Pod/Classes/PSDIAWSDynamoImporter.h
limey/pod-subspec-dependency-issue
d192e7729b74d30c80d8bcc3738d1d514e8fb1f1
[ "MIT" ]
null
null
null
// // PSDIAWSDynamoImporter.h // Pods // // Created by Robert Clark on 22/12/15. // // #import <Foundation/Foundation.h> @interface PSDIAWSDynamoImporter : NSObject + (void) doSomething; @end
12.4375
43
0.688442
9fef95b13e4741b2112092d761f82175c6df7c33
1,454
rs
Rust
third_party/rust_crates/vendor/difference/examples/underline-words.rs
allansrc/fuchsia
a2c235b33fc4305044d496354a08775f30cdcf37
[ "BSD-2-Clause" ]
233
2015-09-21T22:38:06.000Z
2022-03-30T22:02:31.000Z
third_party/rust_crates/vendor/difference/examples/underline-words.rs
allansrc/fuchsia
a2c235b33fc4305044d496354a08775f30cdcf37
[ "BSD-2-Clause" ]
56
2021-06-03T03:16:25.000Z
2022-03-20T01:07:44.000Z
third_party/rust_crates/vendor/difference/examples/underline-words.rs
allansrc/fuchsia
a2c235b33fc4305044d496354a08775f30cdcf37
[ "BSD-2-Clause" ]
73
2019-03-06T18:55:23.000Z
2022-03-26T12:04:51.000Z
extern crate term; extern crate difference; use difference::{Difference, Changeset}; use std::io::Write; // Screenshot: // https://raw.githubusercontent.com/johannhof/difference.rs/master/assets/word-underline.png #[allow(unused_must_use)] fn main() { let text1 = "Roses are red, violets are blue."; let text2 = "Roses are blue, violets are"; let mut t = term::stdout().unwrap(); let Changeset { diffs, .. } = Changeset::new(text1, text2, ""); for c in &diffs { match *c { Difference::Same(ref z) => { t.fg(term::color::RED).unwrap(); write!(t, "{}", z); } Difference::Rem(ref z) => { t.fg(term::color::WHITE).unwrap(); t.bg(term::color::RED).unwrap(); write!(t, "{}", z); t.reset().unwrap(); } _ => (), } } t.reset().unwrap(); writeln!(t, ""); for c in &diffs { match *c { Difference::Same(ref z) => { t.fg(term::color::GREEN).unwrap(); write!(t, "{}", z); } Difference::Add(ref z) => { t.fg(term::color::WHITE).unwrap(); t.bg(term::color::GREEN).unwrap(); write!(t, "{}", z); t.reset().unwrap(); } _ => (), } } t.reset().unwrap(); t.flush().unwrap(); }
26.436364
93
0.450481
ea82396757855db2121b0342e3fd0efecce58c3f
1,109
kts
Kotlin
buildSrc/src/main/kotlin/profiler.publication.gradle.kts
carstenhag/gradle-profiler
15f8b5c164571d3ebc6347d6de1feaa90b072a1d
[ "Apache-2.0" ]
null
null
null
buildSrc/src/main/kotlin/profiler.publication.gradle.kts
carstenhag/gradle-profiler
15f8b5c164571d3ebc6347d6de1feaa90b072a1d
[ "Apache-2.0" ]
1
2021-04-23T14:20:50.000Z
2021-04-23T14:20:50.000Z
buildSrc/src/main/kotlin/profiler.publication.gradle.kts
carstenhag/gradle-profiler
15f8b5c164571d3ebc6347d6de1feaa90b072a1d
[ "Apache-2.0" ]
null
null
null
import java.net.URI plugins { id("maven-publish") } publishing { publications { register<MavenPublication>("mavenJava") { from(components["java"]) pom { licenses { license { name.set("The Apache License, Version 2.0") url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") } } } } } repositories { maven { name = "GradleBuildInternal" url = gradleInternalRepositoryUrl() credentials { username = project.findProperty("artifactoryUsername") as String? password = project.findProperty("artifactoryPassword") as String? } } } } fun Project.gradleInternalRepositoryUrl(): URI { val isSnapshot = property("profiler.version").toString().endsWith("-SNAPSHOT") val repositoryQualifier = if (isSnapshot) "snapshots" else "releases" return uri("https://repo.gradle.org/gradle/ext-$repositoryQualifier-local") }
27.725
82
0.546438
ca8b785d900edccfda3baf83fa73766786abe6ab
581
swift
Swift
SwiftLayaNative/SwiftLayaNative/ViewController.swift
al1020119/LayaNativeSwiftOC
73ba7624a5f52dff4907a97bb668b0cf0899dcdc
[ "Apache-2.0" ]
1
2019-05-09T07:32:55.000Z
2019-05-09T07:32:55.000Z
SwiftLayaNative/SwiftLayaNative/ViewController.swift
al1020119/LayaNativeSwiftOC
73ba7624a5f52dff4907a97bb668b0cf0899dcdc
[ "Apache-2.0" ]
null
null
null
SwiftLayaNative/SwiftLayaNative/ViewController.swift
al1020119/LayaNativeSwiftOC
73ba7624a5f52dff4907a97bb668b0cf0899dcdc
[ "Apache-2.0" ]
null
null
null
// // ViewController.swift // SwiftLayaNative // // Created by iCocos on 2019/5/9. // Copyright © 2019 com.fiction.jmt. All rights reserved. // import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { let layaBridge = LayaBridgeViewController() self.view.addSubview(layaBridge.view) self.addChild(layaBridge) } }
22.346154
80
0.671256
996f1486a471da219a32f5a3dab40eafc4c706c2
801
c
C
MOO/Fonctions mission/majcriteremission.c
wahtique/tc02_ifc_moo
906579a06066afa54f21f8921c510d6842f9d6b7
[ "MIT" ]
null
null
null
MOO/Fonctions mission/majcriteremission.c
wahtique/tc02_ifc_moo
906579a06066afa54f21f8921c510d6842f9d6b7
[ "MIT" ]
null
null
null
MOO/Fonctions mission/majcriteremission.c
wahtique/tc02_ifc_moo
906579a06066afa54f21f8921c510d6842f9d6b7
[ "MIT" ]
null
null
null
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "../Critere.h" #include "../Mission.h" void MajCritereMission(FlagMission *Liste,unsigned int indexMission) { if(Liste->a_DimPonderation>0) { int i=0; GetMission(Liste,indexMission)->a_tPonderation=(float**)malloc(Liste->a_DimPonderation*sizeof(float*)); for(i=0;i<Liste->a_DimPonderation;i++) { GetMission(Liste,indexMission)->a_tPonderation[i]=(float*)malloc(2*sizeof(float)); GetMission(Liste,indexMission)->a_tPonderation[i][0]=Liste->a_tPonderationSchem[i][0]; GetMission(Liste,indexMission)->a_tPonderation[i][1]=Liste->a_tPonderationSchem[i][1]; } GetMission(Liste,indexMission)->a_DimPonderation=Liste->a_DimPonderation; } }
32.04
111
0.672909
c128b9615362afc35b2c7dfea3183c7cdbf83bc2
10,780
rs
Rust
src/lib/diagnostics/inspect/rust/src/reader/snapshot.rs
liexusong/fuchsia
81897680af92a1848a063e3c20ff3a4892ccff07
[ "BSD-2-Clause" ]
3
2021-09-02T07:21:06.000Z
2022-03-12T03:20:10.000Z
src/lib/diagnostics/inspect/rust/src/reader/snapshot.rs
liexusong/fuchsia
81897680af92a1848a063e3c20ff3a4892ccff07
[ "BSD-2-Clause" ]
56
2021-06-03T03:16:25.000Z
2022-03-20T01:07:44.000Z
src/lib/diagnostics/inspect/rust/src/reader/snapshot.rs
liexusong/fuchsia
81897680af92a1848a063e3c20ff3a4892ccff07
[ "BSD-2-Clause" ]
2
2022-02-25T12:22:49.000Z
2022-03-12T03:20:10.000Z
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. //! A snapshot represents all the loaded blocks of the VMO in a way that we can reconstruct the //! implicit tree. use { crate::{reader::error::ReaderError, Inspector}, fuchsia_zircon::Vmo, inspect_format::{constants, utils, Block, BlockType}, std::convert::TryFrom, }; pub use crate::reader::tree_reader::SnapshotTree; /// Enables to scan all the blocks in a given buffer. pub struct Snapshot { /// The buffer read from an Inspect VMO. buffer: Vec<u8>, } /// A scanned block. pub type ScannedBlock<'a> = Block<&'a [u8]>; const SNAPSHOT_TRIES: u64 = 1024; impl Snapshot { /// Returns an iterator that returns all the Blocks in the buffer. pub fn scan(&self) -> BlockIterator<'_> { BlockIterator::from(self.buffer.as_ref()) } /// Gets the block at the given |index|. pub fn get_block(&self, index: u32) -> Option<ScannedBlock<'_>> { if utils::offset_for_index(index) < self.buffer.len() { Some(Block::new(&self.buffer, index)) } else { None } } /// Try to take a consistent snapshot of the given VMO once. /// /// Returns a Snapshot on success or an Error if a consistent snapshot could not be taken. pub fn try_once_from_vmo(vmo: &Vmo) -> Result<Snapshot, ReaderError> { Snapshot::try_once_with_callback(vmo, &mut || {}) } fn try_once_with_callback<F>(vmo: &Vmo, read_callback: &mut F) -> Result<Snapshot, ReaderError> where F: FnMut() -> (), { // Read the generation count one time let mut header_bytes: [u8; 16] = [0; 16]; vmo.read(&mut header_bytes, 0).map_err(ReaderError::Vmo)?; let generation = header_generation_count(&header_bytes[..]); if let Some(gen) = generation { // Read the buffer let size = vmo.get_size().map_err(ReaderError::Vmo)?; let mut buffer = vec![0u8; size as usize]; vmo.read(&mut buffer[..], 0).map_err(ReaderError::Vmo)?; if cfg!(test) { read_callback(); } // Read the generation count one more time to ensure the previous buffer read is // consistent. vmo.read(&mut header_bytes, 0).map_err(ReaderError::Vmo)?; match header_generation_count(&header_bytes[..]) { None => return Err(ReaderError::InconsistentSnapshot), Some(new_generation) if new_generation != gen => { return Err(ReaderError::InconsistentSnapshot); } Some(_) => return Ok(Snapshot { buffer }), } } Err(ReaderError::InconsistentSnapshot) } fn try_from_with_callback<F>(vmo: &Vmo, mut read_callback: F) -> Result<Snapshot, ReaderError> where F: FnMut() -> (), { let mut i = 0; loop { match Snapshot::try_once_with_callback(&vmo, &mut read_callback) { Ok(snapshot) => return Ok(snapshot), Err(e) => { if i >= SNAPSHOT_TRIES { return Err(e); } } }; i += 1; } } // Used for snapshot tests. #[cfg(test)] pub fn build(bytes: &[u8]) -> Self { Snapshot { buffer: bytes.to_vec() } } } /// Reads the given 16 bytes as an Inspect Block Header and returns the /// generation count if the header is valid: correct magic number, version number /// and nobody is writing to it. fn header_generation_count(bytes: &[u8]) -> Option<u64> { if bytes.len() < 16 { return None; } let block = Block::new(&bytes[..16], 0); if block.block_type_or().unwrap_or(BlockType::Reserved) == BlockType::Header && block.header_magic().unwrap() == constants::HEADER_MAGIC_NUMBER && block.header_version().unwrap() == constants::HEADER_VERSION_NUMBER && !block.header_is_locked().unwrap() { return block.header_generation_count().ok(); } None } /// Construct a snapshot from a byte array. impl TryFrom<&[u8]> for Snapshot { type Error = ReaderError; fn try_from(bytes: &[u8]) -> Result<Self, Self::Error> { if header_generation_count(&bytes).is_some() { Ok(Snapshot { buffer: bytes.to_vec() }) } else { return Err(ReaderError::MissingHeaderOrLocked); } } } /// Construct a snapshot from a byte vector. impl TryFrom<Vec<u8>> for Snapshot { type Error = ReaderError; fn try_from(bytes: Vec<u8>) -> Result<Self, Self::Error> { Snapshot::try_from(&bytes[..]) } } /// Construct a snapshot from a VMO. impl TryFrom<&Vmo> for Snapshot { type Error = ReaderError; fn try_from(vmo: &Vmo) -> Result<Self, Self::Error> { Snapshot::try_from_with_callback(vmo, || {}) } } impl TryFrom<&Inspector> for Snapshot { type Error = ReaderError; fn try_from(inspector: &Inspector) -> Result<Self, Self::Error> { inspector .vmo .as_ref() .ok_or(ReaderError::NoOpInspector) .and_then(|vmo| Snapshot::try_from(&**vmo)) } } /// Iterates over a byte array containing Inspect API blocks and returns the /// blocks in order. pub struct BlockIterator<'h> { /// Current offset at which the iterator is reading. offset: usize, /// The bytes being read. container: &'h [u8], } impl<'a> From<&'a [u8]> for BlockIterator<'a> { fn from(container: &'a [u8]) -> Self { BlockIterator { offset: 0, container } } } impl<'h> Iterator for BlockIterator<'h> { type Item = Block<&'h [u8]>; fn next(&mut self) -> Option<Block<&'h [u8]>> { if self.offset >= self.container.len() { return None; } let index = utils::index_for_offset(self.offset); let block = Block::new(self.container.clone(), index); if self.container.len() - self.offset < utils::order_to_size(block.order()) { return None; } self.offset += utils::order_to_size(block.order()); Some(block) } } #[cfg(test)] mod tests { use { super::*, anyhow::Error, inspect_format::WritableBlockContainer, mapped_vmo::Mapping, std::sync::Arc, }; #[test] fn scan() -> Result<(), Error> { let (mapping, vmo) = Mapping::allocate(4096)?; let mapping_ref = Arc::new(mapping); let mut header = Block::new_free(mapping_ref.clone(), 0, 0, 0)?; header.become_reserved()?; header.become_header()?; let b = Block::new_free(mapping_ref.clone(), 1, 2, 0)?; b.become_reserved()?; b.become_extent(5)?; let b = Block::new_free(mapping_ref.clone(), 5, 0, 0)?; b.become_reserved()?; b.become_int_value(1, 2, 3)?; let snapshot = Snapshot::try_from(&vmo)?; // Scan blocks let blocks = snapshot.scan().collect::<Vec<ScannedBlock<'_>>>(); assert_eq!(blocks[0].block_type(), BlockType::Header); assert_eq!(blocks[0].index(), 0); assert_eq!(blocks[0].order(), 0); assert_eq!(blocks[0].header_magic().unwrap(), constants::HEADER_MAGIC_NUMBER); assert_eq!(blocks[0].header_version().unwrap(), constants::HEADER_VERSION_NUMBER); assert_eq!(blocks[1].block_type(), BlockType::Extent); assert_eq!(blocks[1].index(), 1); assert_eq!(blocks[1].order(), 2); assert_eq!(blocks[1].next_extent().unwrap(), 5); assert_eq!(blocks[2].block_type(), BlockType::IntValue); assert_eq!(blocks[2].index(), 5); assert_eq!(blocks[2].order(), 0); assert_eq!(blocks[2].name_index().unwrap(), 2); assert_eq!(blocks[2].parent_index().unwrap(), 3); assert_eq!(blocks[2].int_value().unwrap(), 1); assert!(blocks[6..].iter().all(|b| b.block_type() == BlockType::Free)); // Verify get_block assert_eq!(snapshot.get_block(0).unwrap().block_type(), BlockType::Header); assert_eq!(snapshot.get_block(1).unwrap().block_type(), BlockType::Extent); assert_eq!(snapshot.get_block(5).unwrap().block_type(), BlockType::IntValue); assert_eq!(snapshot.get_block(6).unwrap().block_type(), BlockType::Free); assert!(snapshot.get_block(4096).is_none()); Ok(()) } #[test] fn invalid_type() -> Result<(), Error> { let (mapping, vmo) = Mapping::allocate(4096)?; let mapping_ref = Arc::new(mapping); mapping_ref.write_bytes(0, &[0x00, 0xff, 0x01]); assert!(Snapshot::try_from(&vmo).is_err()); Ok(()) } #[test] fn invalid_order() -> Result<(), Error> { let (mapping, vmo) = Mapping::allocate(4096)?; let mapping_ref = Arc::new(mapping); mapping_ref.write_bytes(0, &[0xff, 0xff]); assert!(Snapshot::try_from(&vmo).is_err()); Ok(()) } #[test] fn invalid_pending_write() -> Result<(), Error> { let (mapping, vmo) = Mapping::allocate(4096)?; let mapping_ref = Arc::new(mapping); let mut header = Block::new_free(mapping_ref.clone(), 0, 0, 0)?; header.become_reserved()?; header.become_header()?; header.lock_header()?; assert!(Snapshot::try_from(&vmo).is_err()); Ok(()) } #[test] fn invalid_magic_number() -> Result<(), Error> { let (mapping, vmo) = Mapping::allocate(4096)?; let mapping_ref = Arc::new(mapping); let mut header = Block::new_free(mapping_ref.clone(), 0, 0, 0)?; header.become_reserved()?; header.become_header()?; header.set_header_magic(3)?; assert!(Snapshot::try_from(&vmo).is_err()); Ok(()) } #[test] fn invalid_generation_count() -> Result<(), Error> { let (mapping, vmo) = Mapping::allocate(4096)?; let mapping_ref = Arc::new(mapping); let mut header = Block::new_free(mapping_ref.clone(), 0, 0, 0)?; header.become_reserved()?; header.become_header()?; assert!(Snapshot::try_from_with_callback(&vmo, || { header.lock_header().unwrap(); header.unlock_header().unwrap(); }) .is_err()); Ok(()) } #[test] fn snapshot_from_few_bytes() { let values = (0u8..16).collect::<Vec<u8>>(); assert!(Snapshot::try_from(&values[..]).is_err()); assert!(Snapshot::try_from(values).is_err()); assert!(Snapshot::try_from(vec![]).is_err()); assert!(Snapshot::try_from(vec![0u8, 1, 2, 3, 4]).is_err()); } }
33.271605
99
0.583673
74c19a7dcc1e357f0f87b9d3942326466861a939
1,445
kt
Kotlin
app/src/test/java/com/netchar/wallpaperify/ui/di/TestNetworkModule.kt
netchar/Wallpaperify
2bcccb5a5cc161831a11c7976eb2cb1ba7c90923
[ "Apache-2.0" ]
4
2020-09-03T08:25:39.000Z
2021-07-05T06:47:05.000Z
app/src/test/java/com/netchar/wallpaperify/ui/di/TestNetworkModule.kt
netchar/Wallpaperify
2bcccb5a5cc161831a11c7976eb2cb1ba7c90923
[ "Apache-2.0" ]
4
2019-10-08T12:26:44.000Z
2021-07-05T06:56:13.000Z
app/src/test/java/com/netchar/wallpaperify/ui/di/TestNetworkModule.kt
netchar/Wallpaperify
2bcccb5a5cc161831a11c7976eb2cb1ba7c90923
[ "Apache-2.0" ]
3
2020-02-22T21:41:38.000Z
2021-07-05T06:47:08.000Z
package com.netchar.wallpaperify.ui.di import com.jakewharton.retrofit2.adapter.kotlin.coroutines.CoroutineCallAdapterFactory import com.netchar.common.di.BaseUrl import com.netchar.remote.ApplicationJsonAdapterFactory import com.squareup.moshi.Moshi import dagger.Module import dagger.Provides import okhttp3.OkHttpClient import retrofit2.Retrofit import retrofit2.converter.moshi.MoshiConverterFactory import java.util.concurrent.TimeUnit import javax.inject.Singleton /** * Created by Netchar on 01.05.2019. * e.glushankov@gmail.com */ @Module object TestNetworkModule { @JvmStatic @Provides @Singleton fun provideOkHttpClient( ): OkHttpClient = OkHttpClient.Builder() .connectTimeout(10L, TimeUnit.SECONDS) .writeTimeout(10L, TimeUnit.SECONDS) .readTimeout(30L, TimeUnit.SECONDS) .build() @JvmStatic @Provides @Singleton fun provideMoshi(): Moshi = Moshi.Builder() .add(ApplicationJsonAdapterFactory.instance) .add(com.netchar.remote.converters.ThreeTenConverter()) .build() @JvmStatic @Provides @Singleton fun provideRetrofit(httpClient: OkHttpClient, moshi: Moshi, @BaseUrl baseUrl: String): Retrofit = Retrofit.Builder() .baseUrl(baseUrl) .client(httpClient) .addCallAdapterFactory(CoroutineCallAdapterFactory()) .addConverterFactory(MoshiConverterFactory.create(moshi)) .build() }
28.9
120
0.737716
1daa5ae419c2af6e49ba7cd90dfcd761495be1f5
1,222
sql
SQL
EdFi.Ods.Utilities.Migration/Scripts/MsSql/02Upgrade/v24_to_v25/11 Create Constraints/41770 InteractivityStyleType [PK, IX, D].sql
Ed-Fi-Alliance-OSS/Ed-Fi-MigrationUtility
0d990a4d5cec37eec2015ef53e8d9e4fdec8750a
[ "Apache-2.0" ]
null
null
null
EdFi.Ods.Utilities.Migration/Scripts/MsSql/02Upgrade/v24_to_v25/11 Create Constraints/41770 InteractivityStyleType [PK, IX, D].sql
Ed-Fi-Alliance-OSS/Ed-Fi-MigrationUtility
0d990a4d5cec37eec2015ef53e8d9e4fdec8750a
[ "Apache-2.0" ]
9
2020-06-12T16:07:31.000Z
2022-01-20T16:13:12.000Z
EdFi.Ods.Utilities.Migration/Scripts/MsSql/02Upgrade/v24_to_v25/11 Create Constraints/41770 InteractivityStyleType [PK, IX, D].sql
Ed-Fi-Alliance-OSS/Ed-Fi-MigrationUtility
0d990a4d5cec37eec2015ef53e8d9e4fdec8750a
[ "Apache-2.0" ]
3
2020-05-19T13:25:35.000Z
2022-02-26T01:21:18.000Z
-- SPDX-License-Identifier: Apache-2.0 -- Licensed to the Ed-Fi Alliance under one or more agreements. -- The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. -- See the LICENSE and NOTICES files in the project root for more information. PRINT N'Creating primary key [InteractivityStyleType_PK] on [edfi].[InteractivityStyleType]' GO ALTER TABLE [edfi].[InteractivityStyleType] ADD CONSTRAINT [InteractivityStyleType_PK] PRIMARY KEY CLUSTERED ([InteractivityStyleTypeId]) GO PRINT N'Creating index [UX_InteractivityStyleType_Id] on [edfi].[InteractivityStyleType]' GO CREATE UNIQUE NONCLUSTERED INDEX [UX_InteractivityStyleType_Id] ON [edfi].[InteractivityStyleType] ([Id]) WITH (FILLFACTOR=100, PAD_INDEX=ON) GO PRINT N'Adding constraints to [edfi].[InteractivityStyleType]' GO ALTER TABLE [edfi].[InteractivityStyleType] ADD CONSTRAINT [InteractivityStyleType_DF_CreateDate] DEFAULT (getdate()) FOR [CreateDate] GO ALTER TABLE [edfi].[InteractivityStyleType] ADD CONSTRAINT [InteractivityStyleType_DF_LastModifiedDate] DEFAULT (getdate()) FOR [LastModifiedDate] GO ALTER TABLE [edfi].[InteractivityStyleType] ADD CONSTRAINT [InteractivityStyleType_DF_Id] DEFAULT (newid()) FOR [Id] GO
50.916667
146
0.807692
0a0ddc00ace4ac031416ae0fd5a20cd6cff21338
668
asm
Assembly
oeis/310/A310517.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/310/A310517.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/310/A310517.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A310517: Coordination sequence Gal.6.206.6 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; Submitted by Christian Krause ; 1,4,10,16,22,26,30,34,40,46,52,56,60,66,72,78,82,86,90,96,102,108,112,116,122,128,134,138,142,146,152,158,164,168,172,178,184,190,194,198,202,208,214,220,224,228,234,240,246,250 mov $1,$0 seq $1,315188 ; Coordination sequence Gal.6.265.5 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. mov $2,$0 mul $0,7 sub $0,1 mod $0,$1 add $2,1 mul $2,3 add $2,1 add $0,$2 sub $0,3
41.75
182
0.729042
e751a3d27fa70b50226f4f68f6b9ee9b9690e93e
1,078
js
JavaScript
browser_main.js
barelyhuman/apex
ddde55b0d2955ab6bdd2b4bbf5b615b31eebeed8
[ "MIT" ]
null
null
null
browser_main.js
barelyhuman/apex
ddde55b0d2955ab6bdd2b4bbf5b615b31eebeed8
[ "MIT" ]
8
2020-03-31T22:59:25.000Z
2022-03-27T04:47:24.000Z
browser_main.js
barelyhuman/apex
ddde55b0d2955ab6bdd2b4bbf5b615b31eebeed8
[ "MIT" ]
null
null
null
(function () { let currentCode = '' const fontSizeInput = document.getElementById('font-size-input') const hightlightCheckbox = document.getElementById('hightlight-checkbox') let highlight = true fontSizeInput.addEventListener('change', () => { refreshEditor() }) hightlightCheckbox.addEventListener('change', (e) => { highlight = e.target.checked refreshEditor() }) function refreshEditor () { const editor = document.getElementById('editor') editor.innerHTML = '' const apexInstance = new Apex({ el: document.getElementById('editor'), font: 'Hack,monospace', fontSize: fontSizeInput.value || 14, placeholder: 'Enter Code here', disabled: false, value: currentCode || `function main(){ console.log("apex"); }`, className: 'custom-editor', onChange: (code) => { currentCode = code }, highlight: !highlight ? undefined : (code) => hljs.highlightAuto(code).value }) console.log(apexInstance) } refreshEditor() })()
23.434783
75
0.623377
1cef91b4d83ef5209f2468f216fc3efd25ac5c25
144
css
CSS
client/src/containers/EditEpisodes/EditEpisodes.css
toshvelaga/wavvy-clean
e04f196f93562dda001527c648d60ed6f1b76e3e
[ "MIT" ]
10
2021-02-13T11:48:06.000Z
2021-05-10T03:51:47.000Z
client/src/containers/EditEpisodes/EditEpisodes.css
toshvelaga/wavvy-clean
e04f196f93562dda001527c648d60ed6f1b76e3e
[ "MIT" ]
null
null
null
client/src/containers/EditEpisodes/EditEpisodes.css
toshvelaga/wavvy-clean
e04f196f93562dda001527c648d60ed6f1b76e3e
[ "MIT" ]
5
2021-02-09T09:35:04.000Z
2022-03-14T03:27:36.000Z
.edit-container { width: 65%; margin: 0 auto; padding: 20px; background-color: #f6f6f6; /* box-shadow: 0 0 20px 0 rgb(222, 223, 224); */ }
18
49
0.631944