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
c7eaf4595fa7c4782940f546ef7d2ac680e9029c
2,339
py
Python
lib/layer.py
nghiattran/mentality
5904003461a535be4df4524298cfa3645c1c32b7
[ "MIT" ]
null
null
null
lib/layer.py
nghiattran/mentality
5904003461a535be4df4524298cfa3645c1c32b7
[ "MIT" ]
null
null
null
lib/layer.py
nghiattran/mentality
5904003461a535be4df4524298cfa3645c1c32b7
[ "MIT" ]
null
null
null
from lib.neuron import Neuron class Layer(object): def __init__(self, setting): self.neurons = [] if type(setting) is int: self.name = '' for i in range(setting): self.neurons.append(Neuron(self)) elif type(setting) is dict: try: self.name = setting['name'] for neuron in setting['neurons']: self.neurons.append(Neuron(self, neuron)) except: raise ValueError('Input file is corrupted.') else: raise ValueError('Layer constructor only takes either an integer argument for a dictionary.') def to_json(self): return { 'name': self.name, 'neurons': [neuron.to_json() for neuron in self.neurons] } def set_name(self, name): self.name = name @staticmethod def from_json(setting): return Layer(setting) def activate(self, inputs = None): if inputs is None: return [self.neurons[i].activate() for i in range(len(self.neurons))] if len(inputs) != len(self.neurons): raise ValueError('Input size does not match number of neurons.') return [self.neurons[i].activate(inputs[i]) for i in range(len(self.neurons))] def propagate(self, learning_rate, outputs = None, momentum=0): if outputs is None: return [ self.neurons[i].propagate(learning_rate=learning_rate, output=None, momentum=momentum) for i in range(len(self.neurons)) ] if len(outputs) != len(self.neurons): raise ValueError('Output size does not match number of neurons.') return [ self.neurons[i].propagate(learning_rate=learning_rate, output=outputs[i], momentum=momentum) for i in range(len(self.neurons)) ] def project(self, layer): if type(layer) is not Layer: raise ValueError('Projected object is not a Layer instance') for neuron in self.neurons: for projected_neuron in layer.neurons: neuron.connect(projected_neuron) def get_connections(self): connections = [] for neuron in self.neurons: connections += neuron.next return connections
32.943662
105
0.58401
167bcb553c305315abffdd5fc1b5127e01af7dc9
541
ts
TypeScript
angular-app/src/app/shared/shared.module.ts
AzeeSoft/RC-Robot
efa4f215d2761fb8ade0f43ab2db420e8bb45234
[ "MIT" ]
null
null
null
angular-app/src/app/shared/shared.module.ts
AzeeSoft/RC-Robot
efa4f215d2761fb8ade0f43ab2db420e8bb45234
[ "MIT" ]
null
null
null
angular-app/src/app/shared/shared.module.ts
AzeeSoft/RC-Robot
efa4f215d2761fb8ade0f43ab2db420e8bb45234
[ "MIT" ]
null
null
null
import { NgModule, Type, ModuleWithProviders } from '@angular/core'; import { CommonModule } from '@angular/common'; import { CommandInterfaceComponent } from './components/command-interface/command-interface.component'; import { MaterialModule } from '../helpers/material/material.module'; import { FormsModule } from '@angular/forms'; @NgModule({ imports: [ CommonModule, MaterialModule, FormsModule ], declarations: [CommandInterfaceComponent, ], exports: [CommandInterfaceComponent], }) export class SharedModule {}
31.823529
103
0.744917
3d329cfbe456d9a5a12513cf47ab4f9a92b2c2b8
1,685
go
Go
gopter-fizzbuzz/fizzbuzz_test.go
jlucktay/golang-workbench
246bbe61e7324e9eec1858fcd5db7669ce12348f
[ "Unlicense" ]
null
null
null
gopter-fizzbuzz/fizzbuzz_test.go
jlucktay/golang-workbench
246bbe61e7324e9eec1858fcd5db7669ce12348f
[ "Unlicense" ]
1
2018-10-08T01:16:57.000Z
2018-10-08T01:16:57.000Z
gopter-fizzbuzz/fizzbuzz_test.go
jlucktay/golang-workbench
246bbe61e7324e9eec1858fcd5db7669ce12348f
[ "Unlicense" ]
1
2021-02-27T11:18:35.000Z
2021-02-27T11:18:35.000Z
package fizzbuzz import ( "math" "strconv" "strings" "testing" "github.com/leanovate/gopter" "github.com/leanovate/gopter/gen" "github.com/leanovate/gopter/prop" ) func TestUndefined(t *testing.T) { properties := gopter.NewProperties(nil) properties.Property("Undefined for all <= 0", prop.ForAll( func(number int) bool { result, err := fizzbuzz(number) return err != nil && result == "" }, gen.IntRange(math.MinInt32, 0), )) properties.TestingRun(t) } func TestStartFizz(t *testing.T) { properties := gopter.NewProperties(nil) properties.Property("Start with Fizz for all multiples of 3", prop.ForAll( func(i int) bool { result, err := fizzbuzz(i * 3) return err == nil && strings.HasPrefix(result, "Fizz") }, gen.IntRange(1, math.MaxInt32/3), )) properties.TestingRun(t) } func TestEndBuzz(t *testing.T) { properties := gopter.NewProperties(nil) properties.Property("End with Buzz for all multiples of 5", prop.ForAll( func(i int) bool { result, err := fizzbuzz(i * 5) return err == nil && strings.HasSuffix(result, "Buzz") }, gen.IntRange(1, math.MaxInt32/5), )) properties.TestingRun(t) } func TestIntAsString(t *testing.T) { properties := gopter.NewProperties(nil) properties.Property("Int as string for all non-divisible by 3 or 5", prop.ForAll( func(number int) bool { result, err := fizzbuzz(number) if err != nil { return false } parsed, err := strconv.ParseInt(result, 10, 64) return err == nil && parsed == int64(number) }, gen.IntRange(1, math.MaxInt32).SuchThat(func(v interface{}) bool { return v.(int)%3 != 0 && v.(int)%5 != 0 }), )) properties.TestingRun(t) }
20.802469
82
0.667062
5fb563348828b2eaf6399d71b9499a9f8cc7bc6f
5,781
sql
SQL
douban.sql
ChaosSoong/ScrapyDouban
e6a018a09e76f5f5506934e90b104091dfffe693
[ "MIT" ]
1
2021-04-12T13:37:48.000Z
2021-04-12T13:37:48.000Z
douban.sql
ChaosSoong/ScrapyDouban
e6a018a09e76f5f5506934e90b104091dfffe693
[ "MIT" ]
null
null
null
douban.sql
ChaosSoong/ScrapyDouban
e6a018a09e76f5f5506934e90b104091dfffe693
[ "MIT" ]
null
null
null
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; DROP TABLE IF EXISTS books; CREATE TABLE books ( id int(10) UNSIGNED NOT NULL, slug varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', name varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', sub_name varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', alt_name varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', cover varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', summary text COLLATE utf8mb4_unicode_ci, authors varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', author_intro text COLLATE utf8mb4_unicode_ci, translators varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', series varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', publisher varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', publish_date varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', pages varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', price varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', binding varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', isbn varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', tags varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', douban_id int(10) UNSIGNED NOT NULL DEFAULT '0', douban_score decimal(3,1) UNSIGNED NOT NULL DEFAULT '0.0', douban_votes int(10) UNSIGNED NOT NULL DEFAULT '0', created_at timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', updated_at timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; DROP TABLE IF EXISTS comments; CREATE TABLE comments ( id int(10) UNSIGNED NOT NULL, douban_id int(10) UNSIGNED NOT NULL DEFAULT '0', douban_comment_id int(10) UNSIGNED NOT NULL DEFAULT '0', douban_user_nickname varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', douban_user_avatar varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', douban_user_url varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', content text COLLATE utf8mb4_unicode_ci NOT NULL, votes int(10) UNSIGNED NOT NULL DEFAULT '0', created_at timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', updated_at timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; DROP TABLE IF EXISTS movies; CREATE TABLE movies ( id int(10) UNSIGNED NOT NULL, type varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', slug varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', name varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', alias varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', cover varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', year smallint(5) UNSIGNED NOT NULL DEFAULT '0', regions varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', genres varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', languages varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', release_date date DEFAULT NULL, official_site varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', directors varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', actors text COLLATE utf8mb4_unicode_ci, storyline text COLLATE utf8mb4_unicode_ci, mins smallint(5) UNSIGNED NOT NULL DEFAULT '0', recommend_tip varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', tags varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', avg_score decimal(3,1) UNSIGNED NOT NULL DEFAULT '0.0', imdb_id varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', imdb_score decimal(3,1) UNSIGNED NOT NULL DEFAULT '0.0', imdb_votes int(10) UNSIGNED NOT NULL DEFAULT '0', douban_id int(10) UNSIGNED NOT NULL DEFAULT '0', douban_score decimal(3,1) UNSIGNED NOT NULL DEFAULT '0.0', douban_votes int(10) UNSIGNED NOT NULL DEFAULT '0', created_at timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', updated_at timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; DROP TABLE IF EXISTS subjects; CREATE TABLE subjects ( id int(10) UNSIGNED NOT NULL, douban_id int(10) UNSIGNED NOT NULL DEFAULT '0', type enum('movie','book') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'movie' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ALTER TABLE books ADD PRIMARY KEY (id), ADD KEY books_slug_index (slug), ADD KEY books_name_index (name), ADD KEY books_douban_id_index (douban_id); ALTER TABLE comments ADD PRIMARY KEY (id), ADD KEY comments_douban_id_index (douban_id), ADD KEY comments_douban_comment_id_index (douban_comment_id); ALTER TABLE movies ADD PRIMARY KEY (id), ADD KEY movies_slug_index (slug), ADD KEY movies_name_index (name), ADD KEY movies_imdb_id_index (imdb_id), ADD KEY movies_douban_id_index (douban_id); ALTER TABLE subjects ADD PRIMARY KEY (id), ADD UNIQUE KEY subjects_douban_id_unique (douban_id); ALTER TABLE books MODIFY id int(10) UNSIGNED NOT NULL AUTO_INCREMENT; ALTER TABLE comments MODIFY id int(10) UNSIGNED NOT NULL AUTO_INCREMENT; ALTER TABLE movies MODIFY id int(10) UNSIGNED NOT NULL AUTO_INCREMENT; ALTER TABLE subjects MODIFY id int(10) UNSIGNED NOT NULL AUTO_INCREMENT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
46.620968
83
0.778239
e3d2064563f02f5df6fc54d94fe7f0f954ccc6f4
357
kt
Kotlin
komapper-dialect-h2/src/main/kotlin/org/komapper/dialect/h2/H2SchemaStatementBuilder.kt
komapper/komapper
3c91b73c7e0c9d9002405577e939eee868f9054f
[ "Apache-2.0" ]
60
2021-05-12T10:20:28.000Z
2022-03-30T22:26:19.000Z
komapper-dialect-h2/src/main/kotlin/org/komapper/dialect/h2/H2SchemaStatementBuilder.kt
komapper/komapper
3c91b73c7e0c9d9002405577e939eee868f9054f
[ "Apache-2.0" ]
25
2021-03-22T15:06:15.000Z
2022-03-26T15:23:17.000Z
komapper-dialect-h2/src/main/kotlin/org/komapper/dialect/h2/H2SchemaStatementBuilder.kt
komapper/komapper
3c91b73c7e0c9d9002405577e939eee868f9054f
[ "Apache-2.0" ]
1
2022-03-27T22:02:26.000Z
2022-03-27T22:02:26.000Z
package org.komapper.dialect.h2 import org.komapper.core.Statement import org.komapper.core.dsl.builder.AbstractSchemaStatementBuilder open class H2SchemaStatementBuilder(dialect: H2Dialect) : AbstractSchemaStatementBuilder<H2Dialect>(dialect) { override fun dropAll(): Statement { return buf.append("drop all objects;").toStatement() } }
32.454545
110
0.784314
e3cef4d833fc1cfdd1cfa07326a53caf33fc5786
1,320
go
Go
x/participation/keeper/params.go
moneyhoardermike/MHG.Network
7c1ef4b4d17223d91b613b4f96b100248bd45a74
[ "Apache-2.0" ]
1
2022-03-27T20:20:54.000Z
2022-03-27T20:20:54.000Z
x/participation/keeper/params.go
moneyhoardermike/MHG.Network
7c1ef4b4d17223d91b613b4f96b100248bd45a74
[ "Apache-2.0" ]
null
null
null
x/participation/keeper/params.go
moneyhoardermike/MHG.Network
7c1ef4b4d17223d91b613b4f96b100248bd45a74
[ "Apache-2.0" ]
null
null
null
package keeper import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tendermint/spn/x/participation/types" ) // GetParams get all parameters as types.Params func (k Keeper) GetParams(ctx sdk.Context) types.Params { return types.NewParams( k.AllocationPrice(ctx), k.ParticipationTierList(ctx), k.RegistrationPeriod(ctx), k.WithdrawalDelay(ctx), ) } // SetParams set the params func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { k.paramstore.SetParamSet(ctx, &params) } // AllocationPrice returns the AllocationPrice param func (k Keeper) AllocationPrice(ctx sdk.Context) (res types.AllocationPrice) { k.paramstore.Get(ctx, types.KeyAllocationPrice, &res) return } // ParticipationTierList returns the ParticipationTierList param func (k Keeper) ParticipationTierList(ctx sdk.Context) (res []types.Tier) { k.paramstore.Get(ctx, types.KeyParticipationTierList, &res) return } // RegistrationPeriod returns the RegistrationPeriod param func (k Keeper) RegistrationPeriod(ctx sdk.Context) (res time.Duration) { k.paramstore.Get(ctx, types.KeyRegistrationPeriod, &res) return } // WithdrawalDelay returns the WithdrawalDelay param func (k Keeper) WithdrawalDelay(ctx sdk.Context) (res time.Duration) { k.paramstore.Get(ctx, types.KeyWithdrawalDelay, &res) return }
26.938776
78
0.771212
507e148c60bf0d006fdc3b0bb0553d5b4a6bfdf0
1,469
go
Go
app/models/info_model.go
coopersec/api-cheksum
e813ed8f3fb9b5d9e603ad76d11ab8153a17214f
[ "MIT" ]
null
null
null
app/models/info_model.go
coopersec/api-cheksum
e813ed8f3fb9b5d9e603ad76d11ab8153a17214f
[ "MIT" ]
null
null
null
app/models/info_model.go
coopersec/api-cheksum
e813ed8f3fb9b5d9e603ad76d11ab8153a17214f
[ "MIT" ]
null
null
null
package models import ( "database/sql/driver" "encoding/json" "errors" "time" "github.com/google/uuid" ) // Info struct to describe Info object. type Info struct { ID uuid.UUID `db:"id" json:"id" validate:"required,uuid"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` UserID uuid.UUID `db:"user_id" json:"user_id" validate:"required,uuid"` Name string `db:"name" json:"name" validate:"required,lte=255"` Portfolio string `db:"portfolio" json:"portfolio" validate:"required,lte=255"` InfoStatus int `db:"Info_status" json:"Info_status" validate:"required,len=1"` InfoAttrs InfoAttrs `db:"Info_attrs" json:"Info_attrs" validate:"required,dive"` } // InfoAttrs struct to describe Info attributes. type InfoAttrs struct { Picture string `json:"picture"` Description string `json:"description"` } // Value make the InfoAttrs struct implement the driver.Valuer interface. // This method simply returns the JSON-encoded representation of the struct. func (b InfoAttrs) Value() (driver.Value, error) { return json.Marshal(b) } // Scan make the InfoAttrs struct implement the sql.Scanner interface. // This method simply decodes a JSON-encoded value into the struct fields. func (b *InfoAttrs) Scan(value interface{}) error { j, ok := value.([]byte) if !ok { return errors.New("type assertion to []byte failed") } return json.Unmarshal(j, &b) }
31.934783
85
0.716133
50e91bd5e7b8e9b9788a7eaa12be3ad635491583
438
go
Go
util/general_test.go
tatthien/giraffe.go
9152956dfb2263afe5613a96f1d7c3c9bbfe8f91
[ "MIT" ]
null
null
null
util/general_test.go
tatthien/giraffe.go
9152956dfb2263afe5613a96f1d7c3c9bbfe8f91
[ "MIT" ]
null
null
null
util/general_test.go
tatthien/giraffe.go
9152956dfb2263afe5613a96f1d7c3c9bbfe8f91
[ "MIT" ]
null
null
null
package util import ( "testing" "github.com/stretchr/testify/require" ) func TestGenerateSlug(t *testing.T) { tc := []struct { str string expect string }{ { str: "Xin chào", expect: "xin-chao", }, { str: "123-xin-chào", expect: "123-xin-chao", }, { str: "ạ-á-à-ã", expect: "a-a-a-a", }, } for i := range tc { slug := Slugify(tc[i].str) require.Equal(t, tc[i].expect, slug) } }
13.272727
38
0.538813
d9a2e6b7628663c8692a83da3326aaa7587425ee
1,481
rs
Rust
git-ref/tests/file/transaction/mod.rs
Byron/grit
61abb0b006292d2122784b032e198cc716fb7b92
[ "Apache-2.0", "MIT" ]
149
2020-07-07T09:56:14.000Z
2020-07-30T15:12:14.000Z
git-ref/tests/file/transaction/mod.rs
Byron/grit
61abb0b006292d2122784b032e198cc716fb7b92
[ "Apache-2.0", "MIT" ]
4
2020-06-29T06:53:11.000Z
2020-07-25T04:04:14.000Z
git-ref/tests/file/transaction/mod.rs
Byron/grit
61abb0b006292d2122784b032e198cc716fb7b92
[ "Apache-2.0", "MIT" ]
2
2020-07-12T18:25:01.000Z
2020-07-24T08:45:22.000Z
pub(crate) mod prepare_and_commit { use git_actor::{Sign, Time}; use git_hash::ObjectId; use git_object::bstr::BString; use git_ref::file; fn reflog_lines(store: &file::Store, name: &str) -> crate::Result<Vec<git_ref::log::Line>> { let mut buf = Vec::new(); let res = store .reflog_iter(name, &mut buf)? .expect("existing reflog") .map(|l| l.map(git_ref::log::Line::from)) .collect::<std::result::Result<Vec<_>, _>>()?; Ok(res) } fn empty_store() -> crate::Result<(tempfile::TempDir, file::Store)> { let dir = tempfile::TempDir::new().unwrap(); let store = file::Store::at(dir.path(), git_ref::store::WriteReflog::Normal, git_hash::Kind::Sha1); Ok((dir, store)) } pub(crate) fn committer() -> git_actor::Signature { git_actor::Signature { name: "committer".into(), email: "committer@example.com".into(), time: Time { seconds_since_unix_epoch: 1234, offset_in_seconds: 1800, sign: Sign::Plus, }, } } fn log_line(previous: ObjectId, new: ObjectId, message: impl Into<BString>) -> git_ref::log::Line { git_ref::log::Line { previous_oid: previous, new_oid: new, signature: committer(), message: message.into(), } } mod create_or_update; mod delete; }
30.854167
107
0.542201
7a8f22d9b3bd1849b13c359134f98e7719d20c51
4,045
rs
Rust
src/main.rs
goshlanguage/mate
263dff2e13a0ceee11aa73dd8fbfcaec8858fe56
[ "MIT" ]
2
2022-02-04T00:52:53.000Z
2022-02-07T04:01:06.000Z
src/main.rs
goshlanguage/mate
263dff2e13a0ceee11aa73dd8fbfcaec8858fe56
[ "MIT" ]
4
2021-11-27T03:40:54.000Z
2021-12-22T20:12:44.000Z
src/main.rs
goshlanguage/mate
263dff2e13a0ceee11aa73dd8fbfcaec8858fe56
[ "MIT" ]
2
2022-02-04T00:58:37.000Z
2022-03-18T14:47:57.000Z
use clap::Parser; use log::info; use std::{collections::HashMap, thread, time::Duration}; use tda_sdk::responses::Candle; use accounts::kraken::KrakenAccount; use accounts::tdameritrade::TDAmeritradeAccount; use accounts::types::AccountType; use matelog::init_logging; use ta::average::{ema, sma}; /// You can see the spec for clap's arg attributes here: /// <https://github.com/clap-rs/clap/blob/v3.0.0-rc.11/examples/derive_ref/README.md#arg-attributes> #[derive(Parser, Debug)] #[clap( name = "mate", about = "mini algorithmic trading engine", version = "0.1.0", author )] struct Args { #[clap(short, long, default_value = "tdameritrade")] accounts: Vec<String>, #[clap(short, long, parse(from_occurrences))] verbose: usize, } // mate makes use of the tda-sdk crate for access to a brokerage API // https://github.com/rideron89/tda-sdk-rs pub struct Mate { accounts: Vec<AccountType>, candles: HashMap<String, Vec<Candle>>, symbols: Vec<String>, } impl Mate { pub fn new(accounts: Vec<String>) -> Mate { let mut mate = Mate { accounts: Vec::new(), candles: HashMap::new(), symbols: Vec::new(), }; for account in accounts { let new_account = accounts::new_account(account.as_str(), account.as_str(), "", None, "", "") .unwrap(); mate.accounts.push(new_account); } mate } pub fn default() -> Self { Mate { accounts: Vec::new(), candles: HashMap::new(), symbols: Vec::new(), } } pub fn status(&self) { for account in &self.accounts { match account { AccountType::TDAmeritradeAccount(account) => { info!("Found TDAmeritrade Accounts: {}", account.get_account_ids()) } AccountType::KrakenAccount(account) => { info!("Found Kraken Accounts: {}", account.get_account_balance()); } } } } pub fn update_td(&mut self, account: TDAmeritradeAccount) { let symbols = self.symbols.clone(); for symbol in symbols { self.candles .insert(symbol.to_string(), account.get_candles(symbol.to_string())); } let msft_candles = self.candles.get("MSFT").unwrap(); let sma20 = sma(msft_candles, 0, 20); let sma50 = sma(msft_candles, 0, 50); let sma100 = sma(msft_candles, 0, 100); info!("SMA20: {}\tSMA50: {}\tSMA100: {}", sma20, sma50, sma100); let ema20 = ema(msft_candles, 20); let ema50 = ema(msft_candles, 50); // TODO Check for NaN values to ensure we don't submit a faulty order info!("EMA20: {}\tEMA50: {}", ema20, ema50); if ema20 > 0.0 && ema50 > 0.0 { if ema20 > ema50 { info!("buy"); info!("set stop loss at 95%"); } else { info!("sell"); } } } pub fn update_kraken(&self, account: KrakenAccount) { info!("BTC: {}", account.get_pairs("XXBTZUSD").as_str()); info!("ETH: {}", account.get_pairs("XETHZUSD").as_str()); } } fn main() { let args = Args::parse(); init_logging(args.verbose); let mut mate = Mate::new(args.accounts); mate.symbols = vec!["MSFT".to_string()]; loop { mate.status(); for account in mate.accounts.clone() { match account { AccountType::TDAmeritradeAccount(account) => { mate.update_td(account); } AccountType::KrakenAccount(account) => { mate.update_kraken(account); } } } // sleep for an hour, as not to miss any trading window let hour = Duration::from_secs(60 * 60); // let day = Duration::from_secs(60 * 60 * 24); thread::sleep(hour); } }
28.687943
105
0.543634
5195ad0aa62ce48535a5545d5fbdd897447a0f5e
1,942
swift
Swift
Shari-Demo/Base/DetailViewController.swift
nakajijapan/shari
45388822b8f8032df5cc81ef269783e5d01cb8e8
[ "MIT" ]
121
2015-12-25T02:49:12.000Z
2022-01-13T06:42:18.000Z
Shari-Demo/Base/DetailViewController.swift
nakajijapan/shari
45388822b8f8032df5cc81ef269783e5d01cb8e8
[ "MIT" ]
16
2015-12-27T08:46:49.000Z
2021-05-12T07:23:23.000Z
Shari-Demo/Base/DetailViewController.swift
nakajijapan/shari
45388822b8f8032df5cc81ef269783e5d01cb8e8
[ "MIT" ]
15
2016-03-24T23:51:50.000Z
2020-10-09T10:10:55.000Z
// // DetailViewController.swift // Shari // // Created by nakajijapan on 2015/12/07. // Copyright © 2015 nakajijapan. All rights reserved. // import UIKit import Shari class DetailViewController: UIViewController { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) } // MARK: - Button Actions @IBAction func buttonDidTap(button: UIButton) { guard let modalNavigationController = storyboard!.instantiateViewController(withIdentifier: "ModalNavigationController") as? ShariNavigationController else { fatalError("Need the ShariNavigationController") } // Transition Setting ShariSettings.shouldTransformScaleDown = false ShariSettings.backgroundColorOfOverlayView = UIColor(red: 1, green: 0, blue: 0, alpha: 0.6) ShariSettings.isUsingScreenShotImage = false modalNavigationController.parentNavigationController = navigationController modalNavigationController.cornerRadius = 8 //modalNavigationController.visibleHeight = 200 // Default: UIScreen.main.bounds.height * 0.5 navigationController?.si.present(modalNavigationController) } @IBAction func button2DidTap(button: UIButton) { guard let modalNavigationController = storyboard!.instantiateViewController(withIdentifier: "ModalV2NavigationController") as? ShariNavigationController else { fatalError("Need the ShariNavigationController") } // Transition Setting ShariSettings.shouldTransformScaleDown = false ShariSettings.backgroundColorOfOverlayView = UIColor(red: 0, green: 0, blue: 0, alpha: 0.6) ShariSettings.isUsingScreenShotImage = false modalNavigationController.parentNavigationController = navigationController modalNavigationController.cornerRadius = 8 navigationController?.si.present(modalNavigationController) } }
37.346154
167
0.733265
6ed8fb5c6f2f51f610f02a2079da857f57d76088
856
kt
Kotlin
app/src/main/java/com/moran/baseproject/common/activity/StartActivity.kt
mstains/BaseProject
a20718c0b2b0f1a15041554ee02270562b7eec84
[ "MIT" ]
2
2019-08-19T02:14:59.000Z
2020-03-18T13:14:23.000Z
app/src/main/java/com/moran/baseproject/common/activity/StartActivity.kt
mstains/BaseProject
a20718c0b2b0f1a15041554ee02270562b7eec84
[ "MIT" ]
null
null
null
app/src/main/java/com/moran/baseproject/common/activity/StartActivity.kt
mstains/BaseProject
a20718c0b2b0f1a15041554ee02270562b7eec84
[ "MIT" ]
null
null
null
package com.moran.baseproject.common.activity import android.view.View import com.moran.base.activity.BasicsActivity import com.moran.base.utils.StatusBarUtil import com.moran.baseproject.R import kotlinx.android.synthetic.main.activity_start.* class StartActivity : BasicsActivity(), View.OnClickListener { override fun getLayoutId(): Int { return R.layout.activity_start } override fun initView() { tv_leapfrog.setOnClickListener(this) } override fun initData() { } override fun setStatusBar() { StatusBarUtil.setTranslucentForImageView(this, 0, tv_leapfrog) } override fun onClick(p0: View?) { when (p0?.id) { R.id.tv_leapfrog -> { baseStartActivity(HomeActivity::class.java) finish() } } } }
16.461538
70
0.64486
4319e5a28c10ee035d941f4779b58c15f738c1e4
571
asm
Assembly
oeis/037/A037955.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/037/A037955.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/037/A037955.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A037955: a(n) = binomial(n, floor(n/2)-1). ; 0,0,1,1,4,5,15,21,56,84,210,330,792,1287,3003,5005,11440,19448,43758,75582,167960,293930,646646,1144066,2496144,4457400,9657700,17383860,37442160,67863915,145422675,265182525,565722720,1037158320,2203961430,4059928950,8597496600,15905368710,33578000610,62359143990,131282408400,244662670200,513791607420,960566918220,2012616400080,3773655750150,7890371113950,14833897694226,30957699535776,58343356817424,121548660036300,229591913401900,477551179875952,903936161908052,1877405874732108 mov $1,$0 div $1,2 sub $1,1 bin $0,$1
71.375
486
0.833625
7f5f9db05bcc7af7d836e569e81618041becf744
459
html
HTML
src/components/inspector/field-selector-tmpl.html
blueshed/blueshed-js
4312f885f8cc0f105ee9d0a4e457479f4da94b4e
[ "MIT" ]
1
2016-12-16T08:07:06.000Z
2016-12-16T08:07:06.000Z
src/components/inspector/field-selector-tmpl.html
blueshed/blueshed-js
4312f885f8cc0f105ee9d0a4e457479f4da94b4e
[ "MIT" ]
null
null
null
src/components/inspector/field-selector-tmpl.html
blueshed/blueshed-js
4312f885f8cc0f105ee9d0a4e457479f4da94b4e
[ "MIT" ]
null
null
null
<div class="sort-visible-panel"> <div data-bind="sortable:order_columns"> <div> <i class="fa fa-navicon fa-fw pull-right"></i> <label> <input type="checkbox" data-bind="checkedValue:$data, checked:$parent.visible_columns"/> <span data-bind="text:name"></span> </label> </div> </div> <hr/> <label> <input type="checkbox" value="1" data-bind="checked:show_types"/> <span>show types</span> </label> </div>
24.157895
49
0.607843
87703dc826f5acfa98a276e4714d0018355babd0
1,688
html
HTML
application/admin/view/layout/header.html
hmlwan/candyworld
41ca7af2493423922a0351fe7c431eaae4681e23
[ "Apache-2.0" ]
null
null
null
application/admin/view/layout/header.html
hmlwan/candyworld
41ca7af2493423922a0351fe7c431eaae4681e23
[ "Apache-2.0" ]
null
null
null
application/admin/view/layout/header.html
hmlwan/candyworld
41ca7af2493423922a0351fe7c431eaae4681e23
[ "Apache-2.0" ]
null
null
null
<header class="header header-fixed navbar"> <div class="brand" style="background-color: #535A7C"> <a href="javascript:;" class="fa fa-bars off-left visible-xs" data-toggle="off-canvas" data-move="ltr"></a> <a href="{:url('admin/index/index')}" class="navbar-brand"> <i class="fa fa-stop mg-r-sm"></i> <span class="heading-font">后台管理系统</span> </a> </div> <ul class="nav navbar-nav navbar-right off-right"> <li class="quickmenu"> <a href="javascript:;" data-toggle="dropdown"> {$manage['name']} <i class="caret mg-l-xs hidden-xs no-margin"></i> </a> <ul class="dropdown-menu dropdown-menu-right mg-r-xs"> <li> <a href="{:url('index/updateInfo')}">修改密码</a> </li> <li> <a onclick="logoutSys(this)" data-href="{:url('index/logout')}">退出</a> </li> </ul> </li> </ul> </header> <script> function logoutSys(event) { var url = $(event).attr('data-href'); $.confirm({ title: '<strong style="color: #c7254e;font-size: 16px">温馨提示</strong>', content: '<div class="text-center" style="border-top:1px solid #eee;padding-top: 20px">你确定要退出系统吗?</div>', confirmButton: '确定', confirmButtonClass: 'btn btn-info', cancelButton: '取消', cancelButtonClass: 'btn btn-danger', animation: 'scaleY', theme: 'material', confirm: function () { window.location.href = url; } }) } </script>
38.363636
117
0.501185
996048038743f777e114ff6a48bc2bb682271a46
6,534
c
C
linux-lts-quantal-3.5.0/arch/arm/mach-ux500/board-mop500-msp.c
huhong789/shortcut
bce8a64c4d99b3dca72ffa0a04c9f3485cbab13a
[ "BSD-2-Clause" ]
47
2015-03-10T23:21:52.000Z
2022-02-17T01:04:14.000Z
linux-lts-quantal-3.5.0/arch/arm/mach-ux500/board-mop500-msp.c
shortcut-sosp19/shortcut
f0ff3d9170dbc6de38e0d8c200db056aa26b9c48
[ "BSD-2-Clause" ]
1
2020-06-30T18:01:37.000Z
2020-06-30T18:01:37.000Z
linux-lts-quantal-3.5.0/arch/arm/mach-ux500/board-mop500-msp.c
shortcut-sosp19/shortcut
f0ff3d9170dbc6de38e0d8c200db056aa26b9c48
[ "BSD-2-Clause" ]
19
2015-02-25T19:50:05.000Z
2021-10-05T14:35:54.000Z
/* * Copyright (C) ST-Ericsson SA 2010 * * License terms: GNU General Public License (GPL), version 2 */ #include <linux/platform_device.h> #include <linux/init.h> #include <linux/gpio.h> #include <linux/pinctrl/consumer.h> #include <plat/gpio-nomadik.h> #include <plat/pincfg.h> #include <plat/ste_dma40.h> #include <mach/devices.h> #include <mach/hardware.h> #include <mach/irqs.h> #include <mach/msp.h> #include "ste-dma40-db8500.h" #include "board-mop500.h" #include "devices-db8500.h" #include "pins-db8500.h" /* MSP1/3 Tx/Rx usage protection */ static DEFINE_SPINLOCK(msp_rxtx_lock); /* Reference Count */ static int msp_rxtx_ref; /* Pin modes */ struct pinctrl *msp1_p; struct pinctrl_state *msp1_def; struct pinctrl_state *msp1_sleep; int msp13_i2s_init(void) { int retval = 0; unsigned long flags; spin_lock_irqsave(&msp_rxtx_lock, flags); if (msp_rxtx_ref == 0 && !(IS_ERR(msp1_p) || IS_ERR(msp1_def))) { retval = pinctrl_select_state(msp1_p, msp1_def); if (retval) pr_err("could not set MSP1 defstate\n"); } if (!retval) msp_rxtx_ref++; spin_unlock_irqrestore(&msp_rxtx_lock, flags); return retval; } int msp13_i2s_exit(void) { int retval = 0; unsigned long flags; spin_lock_irqsave(&msp_rxtx_lock, flags); WARN_ON(!msp_rxtx_ref); msp_rxtx_ref--; if (msp_rxtx_ref == 0 && !(IS_ERR(msp1_p) || IS_ERR(msp1_sleep))) { retval = pinctrl_select_state(msp1_p, msp1_sleep); if (retval) pr_err("could not set MSP1 sleepstate\n"); } spin_unlock_irqrestore(&msp_rxtx_lock, flags); return retval; } static struct stedma40_chan_cfg msp0_dma_rx = { .high_priority = true, .dir = STEDMA40_PERIPH_TO_MEM, .src_dev_type = DB8500_DMA_DEV31_MSP0_RX_SLIM0_CH0_RX, .dst_dev_type = STEDMA40_DEV_DST_MEMORY, .src_info.psize = STEDMA40_PSIZE_LOG_4, .dst_info.psize = STEDMA40_PSIZE_LOG_4, /* data_width is set during configuration */ }; static struct stedma40_chan_cfg msp0_dma_tx = { .high_priority = true, .dir = STEDMA40_MEM_TO_PERIPH, .src_dev_type = STEDMA40_DEV_DST_MEMORY, .dst_dev_type = DB8500_DMA_DEV31_MSP0_TX_SLIM0_CH0_TX, .src_info.psize = STEDMA40_PSIZE_LOG_4, .dst_info.psize = STEDMA40_PSIZE_LOG_4, /* data_width is set during configuration */ }; static struct msp_i2s_platform_data msp0_platform_data = { .id = MSP_I2S_0, .msp_i2s_dma_rx = &msp0_dma_rx, .msp_i2s_dma_tx = &msp0_dma_tx, }; static struct stedma40_chan_cfg msp1_dma_rx = { .high_priority = true, .dir = STEDMA40_PERIPH_TO_MEM, .src_dev_type = DB8500_DMA_DEV30_MSP3_RX, .dst_dev_type = STEDMA40_DEV_DST_MEMORY, .src_info.psize = STEDMA40_PSIZE_LOG_4, .dst_info.psize = STEDMA40_PSIZE_LOG_4, /* data_width is set during configuration */ }; static struct stedma40_chan_cfg msp1_dma_tx = { .high_priority = true, .dir = STEDMA40_MEM_TO_PERIPH, .src_dev_type = STEDMA40_DEV_DST_MEMORY, .dst_dev_type = DB8500_DMA_DEV30_MSP1_TX, .src_info.psize = STEDMA40_PSIZE_LOG_4, .dst_info.psize = STEDMA40_PSIZE_LOG_4, /* data_width is set during configuration */ }; static struct msp_i2s_platform_data msp1_platform_data = { .id = MSP_I2S_1, .msp_i2s_dma_rx = NULL, .msp_i2s_dma_tx = &msp1_dma_tx, .msp_i2s_init = msp13_i2s_init, .msp_i2s_exit = msp13_i2s_exit, }; static struct stedma40_chan_cfg msp2_dma_rx = { .high_priority = true, .dir = STEDMA40_PERIPH_TO_MEM, .src_dev_type = DB8500_DMA_DEV14_MSP2_RX, .dst_dev_type = STEDMA40_DEV_DST_MEMORY, /* MSP2 DMA doesn't work with PSIZE == 4 on DB8500v2 */ .src_info.psize = STEDMA40_PSIZE_LOG_1, .dst_info.psize = STEDMA40_PSIZE_LOG_1, /* data_width is set during configuration */ }; static struct stedma40_chan_cfg msp2_dma_tx = { .high_priority = true, .dir = STEDMA40_MEM_TO_PERIPH, .src_dev_type = STEDMA40_DEV_DST_MEMORY, .dst_dev_type = DB8500_DMA_DEV14_MSP2_TX, .src_info.psize = STEDMA40_PSIZE_LOG_4, .dst_info.psize = STEDMA40_PSIZE_LOG_4, .use_fixed_channel = true, .phy_channel = 1, /* data_width is set during configuration */ }; static struct platform_device *db8500_add_msp_i2s(struct device *parent, int id, resource_size_t base, int irq, struct msp_i2s_platform_data *pdata) { struct platform_device *pdev; struct resource res[] = { DEFINE_RES_MEM(base, SZ_4K), DEFINE_RES_IRQ(irq), }; pr_info("Register platform-device 'ux500-msp-i2s', id %d, irq %d\n", id, irq); pdev = platform_device_register_resndata(parent, "ux500-msp-i2s", id, res, ARRAY_SIZE(res), pdata, sizeof(*pdata)); if (!pdev) { pr_err("Failed to register platform-device 'ux500-msp-i2s.%d'!\n", id); return NULL; } return pdev; } /* Platform device for ASoC U8500 machine */ static struct platform_device snd_soc_u8500 = { .name = "snd-soc-u8500", .id = 0, .dev = { .platform_data = NULL, }, }; /* Platform device for Ux500-PCM */ static struct platform_device ux500_pcm = { .name = "ux500-pcm", .id = 0, .dev = { .platform_data = NULL, }, }; static struct msp_i2s_platform_data msp2_platform_data = { .id = MSP_I2S_2, .msp_i2s_dma_rx = &msp2_dma_rx, .msp_i2s_dma_tx = &msp2_dma_tx, }; static struct msp_i2s_platform_data msp3_platform_data = { .id = MSP_I2S_3, .msp_i2s_dma_rx = &msp1_dma_rx, .msp_i2s_dma_tx = NULL, .msp_i2s_init = msp13_i2s_init, .msp_i2s_exit = msp13_i2s_exit, }; int mop500_msp_init(struct device *parent) { struct platform_device *msp1; pr_info("%s: Register platform-device 'snd-soc-u8500'.\n", __func__); platform_device_register(&snd_soc_u8500); pr_info("Initialize MSP I2S-devices.\n"); db8500_add_msp_i2s(parent, 0, U8500_MSP0_BASE, IRQ_DB8500_MSP0, &msp0_platform_data); msp1 = db8500_add_msp_i2s(parent, 1, U8500_MSP1_BASE, IRQ_DB8500_MSP1, &msp1_platform_data); db8500_add_msp_i2s(parent, 2, U8500_MSP2_BASE, IRQ_DB8500_MSP2, &msp2_platform_data); db8500_add_msp_i2s(parent, 3, U8500_MSP3_BASE, IRQ_DB8500_MSP1, &msp3_platform_data); /* Get the pinctrl handle for MSP1 */ if (msp1) { msp1_p = pinctrl_get(&msp1->dev); if (IS_ERR(msp1_p)) dev_err(&msp1->dev, "could not get MSP1 pinctrl\n"); else { msp1_def = pinctrl_lookup_state(msp1_p, PINCTRL_STATE_DEFAULT); if (IS_ERR(msp1_def)) { dev_err(&msp1->dev, "could not get MSP1 defstate\n"); } msp1_sleep = pinctrl_lookup_state(msp1_p, PINCTRL_STATE_SLEEP); if (IS_ERR(msp1_sleep)) dev_err(&msp1->dev, "could not get MSP1 idlestate\n"); } } pr_info("%s: Register platform-device 'ux500-pcm'\n", __func__); platform_device_register(&ux500_pcm); return 0; }
24.380597
72
0.733548
751a33163490132984b5fbd27bba6cdae4bfd4aa
27,378
h
C
ScrapCalc/Shared/Libraries/chilkat-9.5.0-ios/cpp_include/C_CkHttpW.h
hamza1216/metalcalc-ios
57f83a0a614ca4d024e706d253df3246c0e3a301
[ "MIT" ]
null
null
null
ScrapCalc/Shared/Libraries/chilkat-9.5.0-ios/cpp_include/C_CkHttpW.h
hamza1216/metalcalc-ios
57f83a0a614ca4d024e706d253df3246c0e3a301
[ "MIT" ]
null
null
null
ScrapCalc/Shared/Libraries/chilkat-9.5.0-ios/cpp_include/C_CkHttpW.h
hamza1216/metalcalc-ios
57f83a0a614ca4d024e706d253df3246c0e3a301
[ "MIT" ]
null
null
null
// This is a generated source file for Chilkat version 9.5.0.40 #ifndef _C_CkHttpWH #define _C_CkHttpWH #include "chilkatDefs.h" #include "Chilkat_C.h" CK_VISIBLE_PUBLIC HCkHttpW CkHttpW_Create(void); CK_VISIBLE_PUBLIC HCkHttpW CkHttpW_Create2(BOOL bCallbackOwned); CK_VISIBLE_PUBLIC void CkHttpW_Dispose(HCkHttpW handle); CK_VISIBLE_PUBLIC void CkHttpW_getAccept(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putAccept(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_ck_accept(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getAcceptCharset(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putAcceptCharset(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_acceptCharset(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getAcceptLanguage(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putAcceptLanguage(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_acceptLanguage(HCkHttpW cHandle); CK_VISIBLE_PUBLIC BOOL CkHttpW_getAllowGzip(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putAllowGzip(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC BOOL CkHttpW_getAutoAddHostHeader(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putAutoAddHostHeader(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC void CkHttpW_getAwsAccessKey(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putAwsAccessKey(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_awsAccessKey(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getAwsEndpoint(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putAwsEndpoint(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_awsEndpoint(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getAwsSecretKey(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putAwsSecretKey(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_awsSecretKey(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getAwsSubResources(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putAwsSubResources(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_awsSubResources(HCkHttpW cHandle); CK_VISIBLE_PUBLIC BOOL CkHttpW_getBasicAuth(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putBasicAuth(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC void CkHttpW_getBgLastErrorText(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_bgLastErrorText(HCkHttpW cHandle); CK_VISIBLE_PUBLIC int CkHttpW_getBgPercentDone(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getBgResultData(HCkHttpW cHandle, HCkByteData retval); CK_VISIBLE_PUBLIC int CkHttpW_getBgResultInt(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getBgResultString(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_bgResultString(HCkHttpW cHandle); CK_VISIBLE_PUBLIC BOOL CkHttpW_getBgTaskFinished(HCkHttpW cHandle); CK_VISIBLE_PUBLIC BOOL CkHttpW_getBgTaskRunning(HCkHttpW cHandle); CK_VISIBLE_PUBLIC BOOL CkHttpW_getBgTaskSuccess(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getClientIpAddress(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putClientIpAddress(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_clientIpAddress(HCkHttpW cHandle); CK_VISIBLE_PUBLIC int CkHttpW_getConnectTimeout(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putConnectTimeout(HCkHttpW cHandle, int newVal); CK_VISIBLE_PUBLIC void CkHttpW_getConnection(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putConnection(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_connection(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getCookieDir(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putCookieDir(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_cookieDir(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getDebugLogFilePath(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putDebugLogFilePath(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_debugLogFilePath(HCkHttpW cHandle); CK_VISIBLE_PUBLIC int CkHttpW_getDefaultFreshPeriod(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putDefaultFreshPeriod(HCkHttpW cHandle, int newVal); CK_VISIBLE_PUBLIC BOOL CkHttpW_getDigestAuth(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putDigestAuth(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC int CkHttpW_getEventLogCount(HCkHttpW cHandle); CK_VISIBLE_PUBLIC BOOL CkHttpW_getFetchFromCache(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putFetchFromCache(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC void CkHttpW_getFinalRedirectUrl(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_finalRedirectUrl(HCkHttpW cHandle); CK_VISIBLE_PUBLIC BOOL CkHttpW_getFollowRedirects(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putFollowRedirects(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC int CkHttpW_getFreshnessAlgorithm(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putFreshnessAlgorithm(HCkHttpW cHandle, int newVal); CK_VISIBLE_PUBLIC int CkHttpW_getHeartbeatMs(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putHeartbeatMs(HCkHttpW cHandle, int newVal); CK_VISIBLE_PUBLIC BOOL CkHttpW_getIgnoreMustRevalidate(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putIgnoreMustRevalidate(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC BOOL CkHttpW_getIgnoreNoCache(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putIgnoreNoCache(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC BOOL CkHttpW_getKeepEventLog(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putKeepEventLog(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC int CkHttpW_getLMFactor(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putLMFactor(HCkHttpW cHandle, int newVal); CK_VISIBLE_PUBLIC void CkHttpW_getLastContentType(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_lastContentType(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getLastErrorHtml(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_lastErrorHtml(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getLastErrorText(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_lastErrorText(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getLastErrorXml(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_lastErrorXml(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getLastHeader(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_lastHeader(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getLastModDate(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_lastModDate(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getLastResponseHeader(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_lastResponseHeader(HCkHttpW cHandle); CK_VISIBLE_PUBLIC int CkHttpW_getLastStatus(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getLogin(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putLogin(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_login(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getLoginDomain(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putLoginDomain(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_loginDomain(HCkHttpW cHandle); CK_VISIBLE_PUBLIC int CkHttpW_getMaxConnections(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putMaxConnections(HCkHttpW cHandle, int newVal); CK_VISIBLE_PUBLIC int CkHttpW_getMaxFreshPeriod(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putMaxFreshPeriod(HCkHttpW cHandle, int newVal); CK_VISIBLE_PUBLIC unsigned long CkHttpW_getMaxResponseSize(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putMaxResponseSize(HCkHttpW cHandle, unsigned long newVal); CK_VISIBLE_PUBLIC int CkHttpW_getMaxUrlLen(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putMaxUrlLen(HCkHttpW cHandle, int newVal); CK_VISIBLE_PUBLIC BOOL CkHttpW_getMimicFireFox(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putMimicFireFox(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC BOOL CkHttpW_getMimicIE(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putMimicIE(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC int CkHttpW_getMinFreshPeriod(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putMinFreshPeriod(HCkHttpW cHandle, int newVal); CK_VISIBLE_PUBLIC BOOL CkHttpW_getNegotiateAuth(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putNegotiateAuth(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC BOOL CkHttpW_getNtlmAuth(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putNtlmAuth(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC int CkHttpW_getNumCacheLevels(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putNumCacheLevels(HCkHttpW cHandle, int newVal); CK_VISIBLE_PUBLIC int CkHttpW_getNumCacheRoots(HCkHttpW cHandle); CK_VISIBLE_PUBLIC BOOL CkHttpW_getOAuth1(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putOAuth1(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC void CkHttpW_getOAuthConsumerKey(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putOAuthConsumerKey(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_oAuthConsumerKey(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getOAuthConsumerSecret(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putOAuthConsumerSecret(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_oAuthConsumerSecret(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getOAuthRealm(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putOAuthRealm(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_oAuthRealm(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getOAuthSigMethod(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putOAuthSigMethod(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_oAuthSigMethod(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getOAuthToken(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putOAuthToken(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_oAuthToken(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getOAuthTokenSecret(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putOAuthTokenSecret(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_oAuthTokenSecret(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getOAuthVerifier(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putOAuthVerifier(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_oAuthVerifier(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getPassword(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putPassword(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_password(HCkHttpW cHandle); CK_VISIBLE_PUBLIC BOOL CkHttpW_getPreferIpv6(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putPreferIpv6(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC void CkHttpW_getProxyAuthMethod(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putProxyAuthMethod(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_proxyAuthMethod(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getProxyDomain(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putProxyDomain(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_proxyDomain(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getProxyLogin(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putProxyLogin(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_proxyLogin(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getProxyLoginDomain(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putProxyLoginDomain(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_proxyLoginDomain(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getProxyPassword(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putProxyPassword(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_proxyPassword(HCkHttpW cHandle); CK_VISIBLE_PUBLIC int CkHttpW_getProxyPort(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putProxyPort(HCkHttpW cHandle, int newVal); CK_VISIBLE_PUBLIC int CkHttpW_getReadTimeout(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putReadTimeout(HCkHttpW cHandle, int newVal); CK_VISIBLE_PUBLIC void CkHttpW_getRedirectVerb(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putRedirectVerb(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_redirectVerb(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getReferer(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putReferer(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_referer(HCkHttpW cHandle); CK_VISIBLE_PUBLIC BOOL CkHttpW_getRequireSslCertVerify(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putRequireSslCertVerify(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC void CkHttpW_getRequiredContentType(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putRequiredContentType(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_requiredContentType(HCkHttpW cHandle); CK_VISIBLE_PUBLIC BOOL CkHttpW_getS3Ssl(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putS3Ssl(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC BOOL CkHttpW_getSaveCookies(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putSaveCookies(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC int CkHttpW_getSendBufferSize(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putSendBufferSize(HCkHttpW cHandle, int newVal); CK_VISIBLE_PUBLIC BOOL CkHttpW_getSendCookies(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putSendCookies(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC void CkHttpW_getSessionLogFilename(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putSessionLogFilename(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_sessionLogFilename(HCkHttpW cHandle); CK_VISIBLE_PUBLIC int CkHttpW_getSoRcvBuf(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putSoRcvBuf(HCkHttpW cHandle, int newVal); CK_VISIBLE_PUBLIC int CkHttpW_getSoSndBuf(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putSoSndBuf(HCkHttpW cHandle, int newVal); CK_VISIBLE_PUBLIC void CkHttpW_getSocksHostname(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putSocksHostname(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_socksHostname(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_getSocksPassword(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putSocksPassword(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_socksPassword(HCkHttpW cHandle); CK_VISIBLE_PUBLIC int CkHttpW_getSocksPort(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putSocksPort(HCkHttpW cHandle, int newVal); CK_VISIBLE_PUBLIC void CkHttpW_getSocksUsername(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putSocksUsername(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_socksUsername(HCkHttpW cHandle); CK_VISIBLE_PUBLIC int CkHttpW_getSocksVersion(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putSocksVersion(HCkHttpW cHandle, int newVal); CK_VISIBLE_PUBLIC void CkHttpW_getSslProtocol(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putSslProtocol(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_sslProtocol(HCkHttpW cHandle); CK_VISIBLE_PUBLIC BOOL CkHttpW_getUpdateCache(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putUpdateCache(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC BOOL CkHttpW_getUseBgThread(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putUseBgThread(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC BOOL CkHttpW_getUseIEProxy(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putUseIEProxy(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC void CkHttpW_getUserAgent(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC void CkHttpW_putUserAgent(HCkHttpW cHandle, const wchar_t *newVal); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_userAgent(HCkHttpW cHandle); CK_VISIBLE_PUBLIC BOOL CkHttpW_getVerboseLogging(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_putVerboseLogging(HCkHttpW cHandle, BOOL newVal); CK_VISIBLE_PUBLIC void CkHttpW_getVersion(HCkHttpW cHandle, HCkString retval); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_version(HCkHttpW cHandle); CK_VISIBLE_PUBLIC BOOL CkHttpW_getWasRedirected(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_AddCacheRoot(HCkHttpW cHandle, const wchar_t *dir); CK_VISIBLE_PUBLIC BOOL CkHttpW_AddQuickHeader(HCkHttpW cHandle, const wchar_t *headerFieldName, const wchar_t *headerFieldValue); CK_VISIBLE_PUBLIC HCkHttpResponseW CkHttpW_BgResponseObject(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_BgTaskAbort(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_ClearBgEventLog(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_ClearInMemoryCookies(HCkHttpW cHandle); CK_VISIBLE_PUBLIC BOOL CkHttpW_CloseAllConnections(HCkHttpW cHandle); CK_VISIBLE_PUBLIC void CkHttpW_DnsCacheClear(HCkHttpW cHandle); CK_VISIBLE_PUBLIC BOOL CkHttpW_Download(HCkHttpW cHandle, const wchar_t *url, const wchar_t *localFilePath); CK_VISIBLE_PUBLIC BOOL CkHttpW_DownloadAppend(HCkHttpW cHandle, const wchar_t *url, const wchar_t *filename); CK_VISIBLE_PUBLIC BOOL CkHttpW_DownloadHash(HCkHttpW cHandle, const wchar_t *url, const wchar_t *hashAlgorithm, const wchar_t *encoding, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_downloadHash(HCkHttpW cHandle, const wchar_t *url, const wchar_t *hashAlgorithm, const wchar_t *encoding); CK_VISIBLE_PUBLIC BOOL CkHttpW_EventLogName(HCkHttpW cHandle, int index, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_eventLogName(HCkHttpW cHandle, int index); CK_VISIBLE_PUBLIC BOOL CkHttpW_EventLogValue(HCkHttpW cHandle, int index, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_eventLogValue(HCkHttpW cHandle, int index); CK_VISIBLE_PUBLIC BOOL CkHttpW_ExtractMetaRefreshUrl(HCkHttpW cHandle, const wchar_t *htmlContent, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_extractMetaRefreshUrl(HCkHttpW cHandle, const wchar_t *htmlContent); CK_VISIBLE_PUBLIC BOOL CkHttpW_GenTimeStamp(HCkHttpW cHandle, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_genTimeStamp(HCkHttpW cHandle); CK_VISIBLE_PUBLIC BOOL CkHttpW_GetCacheRoot(HCkHttpW cHandle, int index, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_getCacheRoot(HCkHttpW cHandle, int index); CK_VISIBLE_PUBLIC BOOL CkHttpW_GetCookieXml(HCkHttpW cHandle, const wchar_t *domain, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_getCookieXml(HCkHttpW cHandle, const wchar_t *domain); CK_VISIBLE_PUBLIC BOOL CkHttpW_GetDomain(HCkHttpW cHandle, const wchar_t *url, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_getDomain(HCkHttpW cHandle, const wchar_t *url); CK_VISIBLE_PUBLIC HCkHttpResponseW CkHttpW_GetHead(HCkHttpW cHandle, const wchar_t *url); CK_VISIBLE_PUBLIC BOOL CkHttpW_GetRequestHeader(HCkHttpW cHandle, const wchar_t *name, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_getRequestHeader(HCkHttpW cHandle, const wchar_t *name); CK_VISIBLE_PUBLIC HCkCertW CkHttpW_GetServerSslCert(HCkHttpW cHandle, const wchar_t *domain, int port); CK_VISIBLE_PUBLIC BOOL CkHttpW_GetUrlPath(HCkHttpW cHandle, const wchar_t *url, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_getUrlPath(HCkHttpW cHandle, const wchar_t *url); CK_VISIBLE_PUBLIC BOOL CkHttpW_HasRequestHeader(HCkHttpW cHandle, const wchar_t *name); CK_VISIBLE_PUBLIC BOOL CkHttpW_IsUnlocked(HCkHttpW cHandle); CK_VISIBLE_PUBLIC BOOL CkHttpW_PostBinary(HCkHttpW cHandle, const wchar_t *url, HCkByteData byteData, const wchar_t *contentType, BOOL md5, BOOL gzip, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_postBinary(HCkHttpW cHandle, const wchar_t *url, HCkByteData byteData, const wchar_t *contentType, BOOL md5, BOOL gzip); CK_VISIBLE_PUBLIC HCkHttpResponseW CkHttpW_PostJson(HCkHttpW cHandle, const wchar_t *url, const wchar_t *jsonText); CK_VISIBLE_PUBLIC HCkHttpResponseW CkHttpW_PostJson2(HCkHttpW cHandle, const wchar_t *url, const wchar_t *contentType, const wchar_t *jsonText); CK_VISIBLE_PUBLIC HCkHttpResponseW CkHttpW_PostMime(HCkHttpW cHandle, const wchar_t *url, const wchar_t *mime); CK_VISIBLE_PUBLIC HCkHttpResponseW CkHttpW_PostUrlEncoded(HCkHttpW cHandle, const wchar_t *url, HCkHttpRequestW req); CK_VISIBLE_PUBLIC HCkHttpResponseW CkHttpW_PostXml(HCkHttpW cHandle, const wchar_t *endpointUrl, const wchar_t *xmlContent, const wchar_t *xmlCharset); CK_VISIBLE_PUBLIC BOOL CkHttpW_PutBinary(HCkHttpW cHandle, const wchar_t *url, HCkByteData byteData, const wchar_t *contentType, BOOL md5, BOOL gzip, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_putBinary(HCkHttpW cHandle, const wchar_t *url, HCkByteData byteData, const wchar_t *contentType, BOOL md5, BOOL gzip); CK_VISIBLE_PUBLIC BOOL CkHttpW_PutText(HCkHttpW cHandle, const wchar_t *url, const wchar_t *textData, const wchar_t *charset, const wchar_t *contentType, BOOL md5, BOOL gzip, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_putText(HCkHttpW cHandle, const wchar_t *url, const wchar_t *textData, const wchar_t *charset, const wchar_t *contentType, BOOL md5, BOOL gzip); CK_VISIBLE_PUBLIC BOOL CkHttpW_QuickDeleteStr(HCkHttpW cHandle, const wchar_t *url, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_quickDeleteStr(HCkHttpW cHandle, const wchar_t *url); CK_VISIBLE_PUBLIC BOOL CkHttpW_QuickGet(HCkHttpW cHandle, const wchar_t *url, HCkByteData outData); CK_VISIBLE_PUBLIC HCkHttpResponseW CkHttpW_QuickGetObj(HCkHttpW cHandle, const wchar_t *url); CK_VISIBLE_PUBLIC BOOL CkHttpW_QuickGetStr(HCkHttpW cHandle, const wchar_t *url, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_quickGetStr(HCkHttpW cHandle, const wchar_t *url); CK_VISIBLE_PUBLIC BOOL CkHttpW_QuickPutStr(HCkHttpW cHandle, const wchar_t *url, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_quickPutStr(HCkHttpW cHandle, const wchar_t *url); CK_VISIBLE_PUBLIC BOOL CkHttpW_RemoveQuickHeader(HCkHttpW cHandle, const wchar_t *headerFieldName); CK_VISIBLE_PUBLIC void CkHttpW_RemoveRequestHeader(HCkHttpW cHandle, const wchar_t *name); CK_VISIBLE_PUBLIC BOOL CkHttpW_RenderGet(HCkHttpW cHandle, const wchar_t *url, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_renderGet(HCkHttpW cHandle, const wchar_t *url); CK_VISIBLE_PUBLIC BOOL CkHttpW_ResumeDownload(HCkHttpW cHandle, const wchar_t *url, const wchar_t *targetFilename); CK_VISIBLE_PUBLIC BOOL CkHttpW_S3_CreateBucket(HCkHttpW cHandle, const wchar_t *bucketPath); CK_VISIBLE_PUBLIC BOOL CkHttpW_S3_DeleteBucket(HCkHttpW cHandle, const wchar_t *bucketPath); CK_VISIBLE_PUBLIC BOOL CkHttpW_S3_DeleteObject(HCkHttpW cHandle, const wchar_t *bucketPath, const wchar_t *objectName); CK_VISIBLE_PUBLIC BOOL CkHttpW_S3_DownloadBytes(HCkHttpW cHandle, const wchar_t *bucketPath, const wchar_t *objectName, HCkByteData outBytes); CK_VISIBLE_PUBLIC BOOL CkHttpW_S3_DownloadFile(HCkHttpW cHandle, const wchar_t *bucketPath, const wchar_t *objectName, const wchar_t *localFilePath); CK_VISIBLE_PUBLIC BOOL CkHttpW_S3_DownloadString(HCkHttpW cHandle, const wchar_t *bucketPath, const wchar_t *objectName, const wchar_t *charset, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_s3_DownloadString(HCkHttpW cHandle, const wchar_t *bucketPath, const wchar_t *objectName, const wchar_t *charset); CK_VISIBLE_PUBLIC int CkHttpW_S3_FileExists(HCkHttpW cHandle, const wchar_t *bucketPath, const wchar_t *objectName); CK_VISIBLE_PUBLIC BOOL CkHttpW_S3_ListBucketObjects(HCkHttpW cHandle, const wchar_t *bucketPath, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_s3_ListBucketObjects(HCkHttpW cHandle, const wchar_t *bucketPath); CK_VISIBLE_PUBLIC BOOL CkHttpW_S3_ListBuckets(HCkHttpW cHandle, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_s3_ListBuckets(HCkHttpW cHandle); CK_VISIBLE_PUBLIC BOOL CkHttpW_S3_UploadBytes(HCkHttpW cHandle, HCkByteData contentBytes, const wchar_t *contentType, const wchar_t *bucketPath, const wchar_t *objectName); CK_VISIBLE_PUBLIC BOOL CkHttpW_S3_UploadFile(HCkHttpW cHandle, const wchar_t *localFilePath, const wchar_t *contentType, const wchar_t *bucketPath, const wchar_t *objectName); CK_VISIBLE_PUBLIC BOOL CkHttpW_S3_UploadString(HCkHttpW cHandle, const wchar_t *objectContent, const wchar_t *charset, const wchar_t *contentType, const wchar_t *bucketPath, const wchar_t *objectName); CK_VISIBLE_PUBLIC BOOL CkHttpW_SaveLastError(HCkHttpW cHandle, const wchar_t *path); CK_VISIBLE_PUBLIC BOOL CkHttpW_SetCookieXml(HCkHttpW cHandle, const wchar_t *domain, const wchar_t *cookieXml); CK_VISIBLE_PUBLIC BOOL CkHttpW_SetOAuthRsaKey(HCkHttpW cHandle, HCkPrivateKeyW privKey); CK_VISIBLE_PUBLIC void CkHttpW_SetRequestHeader(HCkHttpW cHandle, const wchar_t *headerFieldName, const wchar_t *headerFieldValue); CK_VISIBLE_PUBLIC BOOL CkHttpW_SetSslClientCert(HCkHttpW cHandle, HCkCertW cert); CK_VISIBLE_PUBLIC BOOL CkHttpW_SetSslClientCertPem(HCkHttpW cHandle, const wchar_t *pemDataOrPath, const wchar_t *pemPassword); CK_VISIBLE_PUBLIC BOOL CkHttpW_SetSslClientCertPfx(HCkHttpW cHandle, const wchar_t *pfxPath, const wchar_t *pfxPassword); CK_VISIBLE_PUBLIC void CkHttpW_SleepMs(HCkHttpW cHandle, int millisec); CK_VISIBLE_PUBLIC HCkHttpResponseW CkHttpW_SynchronousRequest(HCkHttpW cHandle, const wchar_t *domain, int port, BOOL ssl, HCkHttpRequestW req); CK_VISIBLE_PUBLIC BOOL CkHttpW_UnlockComponent(HCkHttpW cHandle, const wchar_t *unlockCode); CK_VISIBLE_PUBLIC BOOL CkHttpW_UrlDecode(HCkHttpW cHandle, const wchar_t *str, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_urlDecode(HCkHttpW cHandle, const wchar_t *str); CK_VISIBLE_PUBLIC BOOL CkHttpW_UrlEncode(HCkHttpW cHandle, const wchar_t *str, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_urlEncode(HCkHttpW cHandle, const wchar_t *str); CK_VISIBLE_PUBLIC BOOL CkHttpW_XmlRpc(HCkHttpW cHandle, const wchar_t *urlEndpoint, const wchar_t *xmlIn, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_xmlRpc(HCkHttpW cHandle, const wchar_t *urlEndpoint, const wchar_t *xmlIn); CK_VISIBLE_PUBLIC BOOL CkHttpW_XmlRpcPut(HCkHttpW cHandle, const wchar_t *urlEndpoint, const wchar_t *xmlIn, HCkString outStr); CK_VISIBLE_PUBLIC const wchar_t *CkHttpW_xmlRpcPut(HCkHttpW cHandle, const wchar_t *urlEndpoint, const wchar_t *xmlIn); #endif
85.024845
201
0.869055
a1b357cb3e390897890afb48ef93c30e3115402e
2,807
go
Go
algo_runner.go
seaglex/hector
2133a100d1cfd9ed85c982e1b746e5a717c44809
[ "MIT" ]
null
null
null
algo_runner.go
seaglex/hector
2133a100d1cfd9ed85c982e1b746e5a717c44809
[ "MIT" ]
null
null
null
algo_runner.go
seaglex/hector
2133a100d1cfd9ed85c982e1b746e5a717c44809
[ "MIT" ]
null
null
null
/* Package hector is a golang based machine learning lib. It intend to implement all famous machine learning algoirhtms by golang. Currently, it only support algorithms which can solve binary classification problems. Supported algorithms include: 1. Decision Tree (CART, Random Forest, GBDT) 2. Logistic Regression 3. SVM 4. Neural Network */ package hector import ( "strconv" "os" ) func AlgorithmRun(classifier Classifier, train_path string, test_path string, pred_path string, params map[string]string) (float64, []*LabelPrediction, error) { global, _ := strconv.ParseInt(params["global"], 10, 64) train_dataset := NewDataSet() err := train_dataset.Load(train_path, global) if err != nil{ return 0.5, nil, err } test_dataset := NewDataSet() err = test_dataset.Load(test_path, global) if err != nil{ return 0.5, nil, err } classifier.Init(params) auc, predictions := AlgorithmRunOnDataSet(classifier, train_dataset, test_dataset, pred_path, params) return auc, predictions, nil } func AlgorithmTrain(classifier Classifier, train_path string, params map[string]string) (error) { global, _ := strconv.ParseInt(params["global"], 10, 64) train_dataset := NewDataSet() err := train_dataset.Load(train_path, global) if err != nil{ return err } classifier.Init(params) classifier.Train(train_dataset) model_path, _ := params["model"] if model_path != "" { classifier.SaveModel(model_path) } return nil } func AlgorithmTest(classifier Classifier, test_path string, pred_path string, params map[string]string) (float64, []*LabelPrediction, error) { global, _ := strconv.ParseInt(params["global"], 10, 64) model_path, _ := params["model"] classifier.Init(params) if model_path != "" { classifier.LoadModel(model_path) } else { return 0.0, nil, nil } test_dataset := NewDataSet() err := test_dataset.Load(test_path, global) if err != nil{ return 0.0, nil, err } auc, predictions := AlgorithmRunOnDataSet(classifier, nil, test_dataset, pred_path, params) return auc, predictions, nil } func AlgorithmRunOnDataSet(classifier Classifier, train_dataset, test_dataset *DataSet, pred_path string, params map[string]string) (float64, []*LabelPrediction) { if train_dataset != nil { classifier.Train(train_dataset) } predictions := []*LabelPrediction{} var pred_file *os.File if pred_path != ""{ pred_file, _ = os.Create(pred_path) } for _,sample := range test_dataset.Samples { prediction := classifier.Predict(sample) if pred_file != nil{ pred_file.WriteString(strconv.FormatFloat(prediction, 'g', 5, 64) + "\n") } predictions = append(predictions, &(LabelPrediction{Label: sample.Label, Prediction: prediction})) } if pred_path != ""{ defer pred_file.Close() } auc := AUC(predictions) return auc, predictions }
26.481132
163
0.728536
0408e5dd5f32d2e218bd532a955a7c80cb16ca6c
257
js
JavaScript
src/utils/treeHandler.js
ysaaron/react-collapse-tree
d014e4f78393c96d39422ecab2ac7d09e8b53752
[ "MIT" ]
null
null
null
src/utils/treeHandler.js
ysaaron/react-collapse-tree
d014e4f78393c96d39422ecab2ac7d09e8b53752
[ "MIT" ]
null
null
null
src/utils/treeHandler.js
ysaaron/react-collapse-tree
d014e4f78393c96d39422ecab2ac7d09e8b53752
[ "MIT" ]
null
null
null
import d3 from 'd3'; export function getTreeHandler(size, getChildren) { if(!size || !getChildren) return; return d3.layout.tree().size(size).children(getChildren); } export function diagonal(custom) { return d3.svg.diagonal().projection(custom); }
19.769231
58
0.731518
4074a48023da8abe747732cd0445f7d0bf88d5c5
1,071
py
Python
scraper/storage_spiders/banbuonmaytinhcom.py
chongiadung/choinho
d2a216fe7a5064d73cdee3e928a7beef7f511fd1
[ "MIT" ]
null
null
null
scraper/storage_spiders/banbuonmaytinhcom.py
chongiadung/choinho
d2a216fe7a5064d73cdee3e928a7beef7f511fd1
[ "MIT" ]
10
2020-02-11T23:34:28.000Z
2022-03-11T23:16:12.000Z
scraper/storage_spiders/banbuonmaytinhcom.py
chongiadung/choinho
d2a216fe7a5064d73cdee3e928a7beef7f511fd1
[ "MIT" ]
3
2018-08-05T14:54:25.000Z
2021-06-07T01:49:59.000Z
# Auto generated by generator.py. Delete this line if you make modification. from scrapy.spiders import Rule from scrapy.linkextractors import LinkExtractor XPATH = { 'name' : "//div[@id='detail_pro']/h1[@id='text_name']", 'price' : "//div[@id='detail_pro']/p[@id='text_price']", 'category' : "//div[@id='main_container']/table//tr/td/div/ul/li/a", 'description' : "//div[@id='detail_pro']/div/h2", 'images' : "//div[@class='ad-image-wrapper']/div[@class='ad-image']/img/@src | //div[@class='ad-gallery']/div[@class='ad-nav']/div[@class='ad-thumbs']/ul[@id='gallery']/li/a/img/@src", 'canonical' : "", 'base_url' : "", 'brand' : "" } name = 'banbuonmaytinh.com' allowed_domains = ['banbuonmaytinh.com'] start_urls = ['http://banbuonmaytinh.com'] tracking_url = '' sitemap_urls = [''] sitemap_rules = [('', 'parse_item')] sitemap_follow = [] rules = [ Rule(LinkExtractor(allow=['/chitiet/']), 'parse_item'), Rule(LinkExtractor(allow=['/sanpham/'], deny=['/tintuc']), 'parse'), #Rule(LinkExtractor(), 'parse_item_and_links'), ]
39.666667
188
0.637722
38b5dbb05d60f026c89426b4c41703c366c5eee8
1,563
h
C
MKToolsKit/MKHelper/MKDeviceAuthorizationHelper.h
mk2016/MKToolsKit
2fa05ce7d6740fa0444b43d31c78ed0993401725
[ "MIT" ]
2
2016-10-20T03:52:55.000Z
2019-01-15T06:34:50.000Z
MKToolsKit/MKHelper/MKDeviceAuthorizationHelper.h
mk2016/MKToolsKit
2fa05ce7d6740fa0444b43d31c78ed0993401725
[ "MIT" ]
null
null
null
MKToolsKit/MKHelper/MKDeviceAuthorizationHelper.h
mk2016/MKToolsKit
2fa05ce7d6740fa0444b43d31c78ed0993401725
[ "MIT" ]
null
null
null
// // MKDeviceAuthorizationHelper.h // MKDevelopSolutions // // Created by xiaomk on 16/5/15. // Copyright © 2016年 xiaomk. All rights reserved. // #import <Foundation/Foundation.h> #import <EventKit/EventKit.h> #import "MKConst.h" typedef NS_ENUM(NSInteger, MKAppAuthorizationType) { MKAppAuthorizationType_assetsLib = 1, /*!< 照片库授权 */ MKAppAuthorizationType_camera = 2, /*!< 相机授权 */ MKAppAuthorizationType_contacts = 3, /*!< 通讯录授权 */ MKAppAuthorizationType_location = 4, /*!< 定位服务 */ MKAppAuthorizationType_nofity = 5, /*!< 通知 */ MKAppAuthorizationType_cellularData = 6, /*!< 网络 */ }; @interface MKDeviceAuthorizationHelper : NSObject + (void)getAppAuthorizationWithType:(MKAppAuthorizationType)type block:(MKBoolBlock)block; + (void)getAppAuthorizationWithType:(MKAppAuthorizationType)type showAlert:(BOOL)show block:(MKBoolBlock)block; /** 网络是否被限制 */ + (BOOL)getCellularAuthorization; + (BOOL)getNotifycationAuthorization; /** 日历、提醒事项授权 */ + (void)eventWitType:(EKEntityType)type Authorization:(MKBoolBlock)block; /** 蓝牙授权 */ + (void)bluetoothPeripheralAuthorization:(MKBoolBlock)block; /** 麦克风 */ + (void)recordAuthorization:(MKBoolBlock)block; #pragma mark - ***** open app authorization set page ****** + (void)openAppAuthorizationSetPageWith:(NSString *)msg; + (void)openAppAuthorizationSetPage; #pragma mark - ***** 摄像头 ****** /** 判断设备是否有摄像头 */ + (BOOL)isCameraAvailable; /** 前面的摄像头是否可用 */ + (BOOL)isFrontCameraAvailable; /** 后面的摄像头是否可用 */ + (BOOL)isRearCameraAvailable; @end
30.057692
111
0.711452
4d3b45cf7dd49ddeb3d3ae68622140df6c1c375c
3,857
swift
Swift
Swift/RemainingWork/AVKitExample/AVKitExample/ViewController.swift
JoongChangYang/TIL
b2a773dc31af54620fd83da9e487495099febcf5
[ "MIT" ]
null
null
null
Swift/RemainingWork/AVKitExample/AVKitExample/ViewController.swift
JoongChangYang/TIL
b2a773dc31af54620fd83da9e487495099febcf5
[ "MIT" ]
null
null
null
Swift/RemainingWork/AVKitExample/AVKitExample/ViewController.swift
JoongChangYang/TIL
b2a773dc31af54620fd83da9e487495099febcf5
[ "MIT" ]
null
null
null
// // ViewController.swift // AVKitExample // // Created by 양중창 on 2020/03/19. // Copyright © 2020 didwndckd. All rights reserved. // import AVKit class ViewController: UIViewController { private let nextButton = UIButton(type: .system) private let scrollView = UIScrollView() private let starURL = "https://fc-netflex.s3.ap-northeast-2.amazonaws.com/%E1%84%89%E1%85%A6%E1%86%AB%E1%84%90%E1%85%A5%E1%84%85%E1%85%B3%E1%86%AF+%E1%84%91%E1%85%A9%E1%84%90%E1%85%A9+300%E1%84%80%E1%85%A2%E1%84%85%E1%85%A9+%E1%84%81%E1%85%AA%E1%86%A8%E1%84%81%E1%85%AA%E1%86%A8+%E1%84%8E%E1%85%A2%E1%84%8B%E1%85%AE%E1%84%86%E1%85%A7%E1%86%AB+%E1%84%89%E1%85%A2%E1%86%BC%E1%84%80%E1%85%B5%E1%84%82%E1%85%B3%E1%86%AB+%E1%84%8B%E1%85%B5%E1%86%AF.mp4" private let dogURL = "https://fc-netflex.s3.ap-northeast-2.amazonaws.com/videoplayback.mp4" private let shortURL = "https://fc-netflex.s3.ap-northeast-2.amazonaws.com/mov_bbb.mp4" private let views = [UIView(), UIView(), UIView(), UIView()] private let colors = [UIColor.red, UIColor.blue, UIColor.gray, UIColor.green] override func viewDidLoad() { super.viewDidLoad() setUI() setConstraint() // setScrollView() } private func setScrollView() { view.addSubview(scrollView) scrollView.translatesAutoresizingMaskIntoConstraints = false scrollView.isPagingEnabled = true scrollView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true scrollView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true scrollView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true scrollView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true for (index, view) in views.enumerated() { scrollView.addSubview(view) view.backgroundColor = colors[index] view.translatesAutoresizingMaskIntoConstraints = false let leading = index == 0 ? scrollView.leadingAnchor: views[index - 1 ].trailingAnchor view.leadingAnchor.constraint(equalTo: leading).isActive = true view.topAnchor.constraint(equalTo: scrollView.topAnchor).isActive = true view.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor).isActive = true view.widthAnchor.constraint(equalTo: scrollView.widthAnchor).isActive = true view.heightAnchor.constraint(equalTo: scrollView.heightAnchor).isActive = true if index == views.count - 1 { view.trailingAnchor.constraint(equalTo: scrollView.trailingAnchor).isActive = true } } } private func setUI() { view.addSubview(nextButton) nextButton.setTitle("Next", for: .normal) nextButton.addTarget(self, action: #selector(didTapNextButton), for: .touchUpInside) } private func setConstraint() { nextButton.translatesAutoresizingMaskIntoConstraints = false nextButton.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true nextButton.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true } @objc private func didTapNextButton() { guard let url = URL(string: starURL) else { return print("urlError")} let player = AVPlayer(url: url) let videoController = VideoController() videoController.player = player videoController.modalPresentationStyle = .fullScreen present(videoController, animated: true) { player.play() } } }
35.063636
453
0.630801
5f299e5c0c8c1be8e046fe9d667ebc6a72f12598
970
ts
TypeScript
src/collections/accountLinks.ts
leifgehrmann/node-tempo-client
4920a38e9138ebe9184027e1592eb554b19eac9a
[ "MIT" ]
1
2019-10-07T22:42:57.000Z
2019-10-07T22:42:57.000Z
src/collections/accountLinks.ts
leifgehrmann/node-tempo-client
4920a38e9138ebe9184027e1592eb554b19eac9a
[ "MIT" ]
156
2019-10-16T10:46:34.000Z
2022-03-26T20:44:12.000Z
src/collections/accountLinks.ts
leifgehrmann/node-tempo-client
4920a38e9138ebe9184027e1592eb554b19eac9a
[ "MIT" ]
null
null
null
import { AccountLink } from '../requestTypes'; import { AccountLinkByScopeResponse, AccountLinkResponse, ResultSetResponse, } from '../responseTypes'; import Collection from './abstractCollection'; export default class AccountLinks extends Collection { public async post(accountLink: AccountLink): Promise<AccountLinkResponse> { return this.createAndSendRequest('/account-links', { body: accountLink, method: 'POST', }); } public async getAccountLink(id: string): Promise<AccountLinkResponse> { return this.createAndSendRequest(`/account-links/${id}`); } public async deleteAccountLink(id: string): Promise<void> { await this.createAndSendRequest(`/account-links/${id}`, { method: 'DELETE', }); } public async getForProject( projectKey: string, ): Promise<ResultSetResponse<AccountLinkByScopeResponse>> { return this.createAndSendRequest( `/account-links/project/${projectKey}`, ); } }
27.714286
77
0.708247
95bd442cbb76d52dd96a3c3d567f14855f5aa8c4
558
css
CSS
web_twtxt/static/style.css
myles/web.twtxt.mylesb.ca
5163c00c0e77a48aa7b464d2b8df57eb19917989
[ "MIT" ]
null
null
null
web_twtxt/static/style.css
myles/web.twtxt.mylesb.ca
5163c00c0e77a48aa7b464d2b8df57eb19917989
[ "MIT" ]
null
null
null
web_twtxt/static/style.css
myles/web.twtxt.mylesb.ca
5163c00c0e77a48aa7b464d2b8df57eb19917989
[ "MIT" ]
null
null
null
body { padding-top: 20px; padding-bottom: 20px; } .header, .footer { padding-right: 15px; padding-left: 15px; } .header { padding-bottom: 20px; margin-bottom: 15px; border-bottom: 1px solid #e5e5e5; } .footer { text-align: center; padding-top: 20px; margin-top: 15px; border-top: 1px solid #e5e5e5; } .header h3 { margin-top: 0; margin-bottom: 0; line-height: 40px; } .panel-embedly { margin-top: 0; border-top: 1px solid #ddd; } .iconic { height: 1.5em; width: 1.5em; vertical-align: middle; } .iconic-heart * { fill: #da3a35; }
12.681818
34
0.655914
6ba63eb72aab01911ba4bd4d77809105ab3ca88d
1,807
rs
Rust
src/ffi/structs.rs
mullvad/openvpn-plugin-rs
1da047c4fb0d0d8fbcd0d1b637ce6ac95e3991a1
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
14
2017-07-22T04:25:24.000Z
2022-03-22T17:59:29.000Z
src/ffi/structs.rs
mullvad/openvpn-plugin-rs
1da047c4fb0d0d8fbcd0d1b637ce6ac95e3991a1
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
9
2017-07-18T18:51:49.000Z
2018-11-02T18:05:17.000Z
src/ffi/structs.rs
mullvad/openvpn-plugin-rs
1da047c4fb0d0d8fbcd0d1b637ce6ac95e3991a1
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
null
null
null
// Copyright 2017 Amagicom AB. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. //! Constants for OpenVPN. Taken from include/openvpn-plugin.h in the OpenVPN repository: //! https://github.com/OpenVPN/openvpn/blob/master/include/openvpn-plugin.h.in use std::os::raw::{c_char, c_int, c_uint, c_void}; /// Struct sent to `openvpn_plugin_open_v3` containing input values. #[repr(C)] pub struct openvpn_plugin_args_open_in { type_mask: c_int, pub argv: *const *const c_char, pub envp: *const *const c_char, callbacks: *const c_void, ssl_api: ovpnSSLAPI, ovpn_version: *const c_char, ovpn_version_major: c_uint, ovpn_version_minor: c_uint, ovpn_version_patch: *const c_char, } #[allow(dead_code)] #[repr(C)] enum ovpnSSLAPI { None, OpenSsl, MbedTls, } /// Struct used for returning values from `openvpn_plugin_open_v3` to OpenVPN. #[repr(C)] pub struct openvpn_plugin_args_open_return { pub type_mask: c_int, pub handle: *const c_void, return_list: *const c_void, } /// Struct sent to `openvpn_plugin_func_v3` containing input values. #[repr(C)] pub struct openvpn_plugin_args_func_in { pub event_type: c_int, pub argv: *const *const c_char, pub envp: *const *const c_char, pub handle: *const c_void, per_client_context: *const c_void, current_cert_depth: c_int, current_cert: *const c_void, } /// Struct used for returning values from `openvpn_plugin_func_v3` to OpenVPN. #[repr(C)] pub struct openvpn_plugin_args_func_return { return_list: *const c_void, }
29.622951
89
0.723852
16aa2f8d8f8a468c82acd4fe1e4999f0ec2ef387
78
ts
TypeScript
assets/portal/src/interface/page.interface.ts
desmondappiahkubi/quickstart-onica-cci-postcall-analytics-1
c5fc4023bb2825103eec5459719225b79e6bdcc8
[ "Apache-2.0" ]
null
null
null
assets/portal/src/interface/page.interface.ts
desmondappiahkubi/quickstart-onica-cci-postcall-analytics-1
c5fc4023bb2825103eec5459719225b79e6bdcc8
[ "Apache-2.0" ]
null
null
null
assets/portal/src/interface/page.interface.ts
desmondappiahkubi/quickstart-onica-cci-postcall-analytics-1
c5fc4023bb2825103eec5459719225b79e6bdcc8
[ "Apache-2.0" ]
null
null
null
export interface PageInterface<T> { data: T[]; next: string | null; }
15.6
35
0.615385
0c1a8107afb6e0c6055b07262949af7f0e105de2
114
kt
Kotlin
android/src/main/java/com/reactnativefilegateway/exceptions/DeleteFileException.kt
iJimmyWei/react-native-file-gateway
2c14b8b43b5330a5a2139805faf2f01f87aebb1d
[ "MIT" ]
4
2021-05-17T07:35:59.000Z
2021-05-22T22:19:21.000Z
android/src/main/java/com/reactnativefilegateway/exceptions/DeleteFileException.kt
iJimmyWei/react-native-file-gateway
2c14b8b43b5330a5a2139805faf2f01f87aebb1d
[ "MIT" ]
16
2021-05-16T09:18:19.000Z
2021-09-11T22:24:06.000Z
android/src/main/java/com/reactnativefilegateway/exceptions/DeleteFileException.kt
iJimmyWei/react-native-file-gateway
2c14b8b43b5330a5a2139805faf2f01f87aebb1d
[ "MIT" ]
null
null
null
package com.reactnativefilegateway.exceptions class DeleteFileException(message: String) : Exception(message) {}
28.5
66
0.833333
2f43bb1b885c7233009626868be6bef6eaadf387
653
php
PHP
src/AppBundle/Entity/Busqueda.php
AlesisZapana/BibliotecaUniversitaria
b93f8f05a7fae263be3cdd17b5c727705957fd65
[ "MIT" ]
null
null
null
src/AppBundle/Entity/Busqueda.php
AlesisZapana/BibliotecaUniversitaria
b93f8f05a7fae263be3cdd17b5c727705957fd65
[ "MIT" ]
null
null
null
src/AppBundle/Entity/Busqueda.php
AlesisZapana/BibliotecaUniversitaria
b93f8f05a7fae263be3cdd17b5c727705957fd65
[ "MIT" ]
null
null
null
<?php namespace AppBundle\Entity; /** * Busqueda */ class Busqueda { /** * @var int */ private $id; /** * @var string */ private $buscar; /** * Get id * * @return int */ public function getId() { return $this->id; } /** * Set buscar * * @param string $buscar * * @return Busqueda */ public function setBuscar($buscar) { $this->buscar = $buscar; return $this; } /** * Get buscar * * @return string */ public function getBuscar() { return $this->buscar; } }
11.660714
38
0.436447
81203d33483edaa125577c1db2a4cfcb15c7e801
10,243
rs
Rust
third_party/rust_crates/vendor/futures-channel/tests/mpsc-close.rs
allansrc/fuchsia
a2c235b33fc4305044d496354a08775f30cdcf37
[ "BSD-2-Clause" ]
1,397
2019-11-23T06:45:56.000Z
2022-03-31T23:38:14.000Z
third_party/rust_crates/vendor/futures-channel/tests/mpsc-close.rs
allansrc/fuchsia
a2c235b33fc4305044d496354a08775f30cdcf37
[ "BSD-2-Clause" ]
453
2019-11-22T16:33:31.000Z
2022-03-25T16:48:05.000Z
third_party/rust_crates/vendor/futures-channel/tests/mpsc-close.rs
allansrc/fuchsia
a2c235b33fc4305044d496354a08775f30cdcf37
[ "BSD-2-Clause" ]
207
2019-11-23T02:45:46.000Z
2022-03-30T02:00:48.000Z
use futures::channel::mpsc; use futures::executor::block_on; use futures::future::Future; use futures::sink::SinkExt; use futures::stream::StreamExt; use futures::task::{Context, Poll}; use std::pin::Pin; use std::sync::{Arc, Weak}; use std::thread; use std::time::{Duration, Instant}; #[test] fn smoke() { let (mut sender, receiver) = mpsc::channel(1); let t = thread::spawn(move || while let Ok(()) = block_on(sender.send(42)) {}); // `receiver` needs to be dropped for `sender` to stop sending and therefore before the join. block_on(receiver.take(3).for_each(|_| futures::future::ready(()))); t.join().unwrap() } #[test] fn multiple_senders_disconnect() { { let (mut tx1, mut rx) = mpsc::channel(1); let (tx2, mut tx3, mut tx4) = (tx1.clone(), tx1.clone(), tx1.clone()); // disconnect, dropping and Sink::poll_close should all close this sender but leave the // channel open for other senders tx1.disconnect(); drop(tx2); block_on(tx3.close()).unwrap(); assert!(tx1.is_closed()); assert!(tx3.is_closed()); assert!(!tx4.is_closed()); block_on(tx4.send(5)).unwrap(); assert_eq!(block_on(rx.next()), Some(5)); // dropping the final sender will close the channel drop(tx4); assert_eq!(block_on(rx.next()), None); } { let (mut tx1, mut rx) = mpsc::unbounded(); let (tx2, mut tx3, mut tx4) = (tx1.clone(), tx1.clone(), tx1.clone()); // disconnect, dropping and Sink::poll_close should all close this sender but leave the // channel open for other senders tx1.disconnect(); drop(tx2); block_on(tx3.close()).unwrap(); assert!(tx1.is_closed()); assert!(tx3.is_closed()); assert!(!tx4.is_closed()); block_on(tx4.send(5)).unwrap(); assert_eq!(block_on(rx.next()), Some(5)); // dropping the final sender will close the channel drop(tx4); assert_eq!(block_on(rx.next()), None); } } #[test] fn multiple_senders_close_channel() { { let (mut tx1, mut rx) = mpsc::channel(1); let mut tx2 = tx1.clone(); // close_channel should shut down the whole channel tx1.close_channel(); assert!(tx1.is_closed()); assert!(tx2.is_closed()); let err = block_on(tx2.send(5)).unwrap_err(); assert!(err.is_disconnected()); assert_eq!(block_on(rx.next()), None); } { let (tx1, mut rx) = mpsc::unbounded(); let mut tx2 = tx1.clone(); // close_channel should shut down the whole channel tx1.close_channel(); assert!(tx1.is_closed()); assert!(tx2.is_closed()); let err = block_on(tx2.send(5)).unwrap_err(); assert!(err.is_disconnected()); assert_eq!(block_on(rx.next()), None); } } #[test] fn single_receiver_drop_closes_channel_and_drains() { { let ref_count = Arc::new(0); let weak_ref = Arc::downgrade(&ref_count); let (sender, receiver) = mpsc::unbounded(); sender.unbounded_send(ref_count).expect("failed to send"); // Verify that the sent message is still live. assert!(weak_ref.upgrade().is_some()); drop(receiver); // The sender should know the channel is closed. assert!(sender.is_closed()); // Verify that the sent message has been dropped. assert!(weak_ref.upgrade().is_none()); } { let ref_count = Arc::new(0); let weak_ref = Arc::downgrade(&ref_count); let (mut sender, receiver) = mpsc::channel(1); sender.try_send(ref_count).expect("failed to send"); // Verify that the sent message is still live. assert!(weak_ref.upgrade().is_some()); drop(receiver); // The sender should know the channel is closed. assert!(sender.is_closed()); // Verify that the sent message has been dropped. assert!(weak_ref.upgrade().is_none()); assert!(sender.is_closed()); } } // Stress test that `try_send()`s occurring concurrently with receiver // close/drops don't appear as successful sends. #[test] fn stress_try_send_as_receiver_closes() { const AMT: usize = 10000; // To provide variable timing characteristics (in the hopes of // reproducing the collision that leads to a race), we busy-re-poll // the test MPSC receiver a variable number of times before actually // stopping. We vary this countdown between 1 and the following // value. const MAX_COUNTDOWN: usize = 20; // When we detect that a successfully sent item is still in the // queue after a disconnect, we spin for up to 100ms to confirm that // it is a persistent condition and not a concurrency illusion. const SPIN_TIMEOUT_S: u64 = 10; const SPIN_SLEEP_MS: u64 = 10; struct TestRx { rx: mpsc::Receiver<Arc<()>>, // The number of times to query `rx` before dropping it. poll_count: usize, } struct TestTask { command_rx: mpsc::Receiver<TestRx>, test_rx: Option<mpsc::Receiver<Arc<()>>>, countdown: usize, } impl TestTask { /// Create a new TestTask fn new() -> (TestTask, mpsc::Sender<TestRx>) { let (command_tx, command_rx) = mpsc::channel::<TestRx>(0); ( TestTask { command_rx, test_rx: None, countdown: 0, // 0 means no countdown is in progress. }, command_tx, ) } } impl Future for TestTask { type Output = (); fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { // Poll the test channel, if one is present. if let Some(rx) = &mut self.test_rx { if let Poll::Ready(v) = rx.poll_next_unpin(cx) { let _ = v.expect("test finished unexpectedly!"); } self.countdown -= 1; // Busy-poll until the countdown is finished. cx.waker().wake_by_ref(); } // Accept any newly submitted MPSC channels for testing. match self.command_rx.poll_next_unpin(cx) { Poll::Ready(Some(TestRx { rx, poll_count })) => { self.test_rx = Some(rx); self.countdown = poll_count; cx.waker().wake_by_ref(); } Poll::Ready(None) => return Poll::Ready(()), Poll::Pending => {} } if self.countdown == 0 { // Countdown complete -- drop the Receiver. self.test_rx = None; } Poll::Pending } } let (f, mut cmd_tx) = TestTask::new(); let bg = thread::spawn(move || block_on(f)); for i in 0..AMT { let (mut test_tx, rx) = mpsc::channel(0); let poll_count = i % MAX_COUNTDOWN; cmd_tx.try_send(TestRx { rx, poll_count }).unwrap(); let mut prev_weak: Option<Weak<()>> = None; let mut attempted_sends = 0; let mut successful_sends = 0; loop { // Create a test item. let item = Arc::new(()); let weak = Arc::downgrade(&item); match test_tx.try_send(item) { Ok(_) => { prev_weak = Some(weak); successful_sends += 1; } Err(ref e) if e.is_full() => {} Err(ref e) if e.is_disconnected() => { // Test for evidence of the race condition. if let Some(prev_weak) = prev_weak { if prev_weak.upgrade().is_some() { // The previously sent item is still allocated. // However, there appears to be some aspect of the // concurrency that can legitimately cause the Arc // to be momentarily valid. Spin for up to 100ms // waiting for the previously sent item to be // dropped. let t0 = Instant::now(); let mut spins = 0; loop { if prev_weak.upgrade().is_none() { break; } assert!( t0.elapsed() < Duration::from_secs(SPIN_TIMEOUT_S), "item not dropped on iteration {} after \ {} sends ({} successful). spin=({})", i, attempted_sends, successful_sends, spins ); spins += 1; thread::sleep(Duration::from_millis(SPIN_SLEEP_MS)); } } } break; } Err(ref e) => panic!("unexpected error: {}", e), } attempted_sends += 1; } } drop(cmd_tx); bg.join().expect("background thread join"); } #[test] fn unbounded_try_next_after_none() { let (tx, mut rx) = mpsc::unbounded::<String>(); // Drop the sender, close the channel. drop(tx); // Receive the end of channel. assert_eq!(Ok(None), rx.try_next().map_err(|_| ())); // None received, check we can call `try_next` again. assert_eq!(Ok(None), rx.try_next().map_err(|_| ())); } #[test] fn bounded_try_next_after_none() { let (tx, mut rx) = mpsc::channel::<String>(17); // Drop the sender, close the channel. drop(tx); // Receive the end of channel. assert_eq!(Ok(None), rx.try_next().map_err(|_| ())); // None received, check we can call `try_next` again. assert_eq!(Ok(None), rx.try_next().map_err(|_| ())); }
34.257525
97
0.523772
169598bee0dc8f9433ed3826b5a3d6e12a014231
1,631
ts
TypeScript
src/app/data.stub.ts
salmanthecoder/fast-pay
13bfabdbecaad45b7823e451f7fed2dcec2b643e
[ "MIT" ]
null
null
null
src/app/data.stub.ts
salmanthecoder/fast-pay
13bfabdbecaad45b7823e451f7fed2dcec2b643e
[ "MIT" ]
null
null
null
src/app/data.stub.ts
salmanthecoder/fast-pay
13bfabdbecaad45b7823e451f7fed2dcec2b643e
[ "MIT" ]
null
null
null
import { Observable, of, Subject} from 'rxjs'; import { Transaction } from 'src/app/model/Transaction'; export const testData = { data: [{ categoryCode: '#12a580', dates: { valueDate: '2020-09-23' }, transaction: { amountCurrency: { amount: 5000, currencyCode: 'EUR' }, type: 'Salaries', creditDebitIndicator: 'CRDT' }, merchant: { name: 'Backbase', accountNumber: 'SI64397745065188826' } }, { categoryCode: '#12a580', dates: { valueDate: '2020-09-05' }, transaction: { amountCurrency: { amount: '82.02', currencyCode: 'EUR' }, type: 'Card Payment', creditDebitIndicator: 'DBIT' }, merchant: { name: 'The Tea Lounge', accountNumber: 'SI64397745065188826' } }, { categoryCode: '#d51271', dates: { valueDate: '2020-09-21' }, transaction: { amountCurrency: { amount: '84.64', currencyCode: 'EUR' }, type: 'Card Payment', creditDebitIndicator: 'DBIT' }, merchant: { name: 'Texaco', accountNumber: 'SI64397745065188826' } } ] }; export class DataStub { public observableTransactions: Subject<Transaction[]>; constructor() { this.observableTransactions = new Subject<Transaction[]>(); } public get(): Observable<Transaction[]> { return Observable.create( observer => { observer.next(testData); observer.complete(); }); } }
22.342466
63
0.527284
eb2e4bf66f02819818de88c76cac574c834bb7ac
1,460
kt
Kotlin
LibDebug/src/main/java/com/bihe0832/android/lib/debug/icon/DebugLogTipsIcon.kt
bihe0832/AndroidAppFactory
422344766b44a4c792b545cc5bea6b3d3654e667
[ "Apache-2.0" ]
28
2020-04-16T06:05:12.000Z
2022-02-08T03:23:52.000Z
LibDebug/src/main/java/com/bihe0832/android/lib/debug/icon/DebugLogTipsIcon.kt
bihe0832/AndroidAppFactory
422344766b44a4c792b545cc5bea6b3d3654e667
[ "Apache-2.0" ]
1
2022-01-05T07:44:32.000Z
2022-01-06T02:48:19.000Z
LibDebug/src/main/java/com/bihe0832/android/lib/debug/icon/DebugLogTipsIcon.kt
bihe0832/AndroidAppFactory
422344766b44a4c792b545cc5bea6b3d3654e667
[ "Apache-2.0" ]
11
2020-09-16T08:43:35.000Z
2022-02-23T21:01:55.000Z
package com.bihe0832.android.lib.debug.icon import android.content.Context import android.text.TextUtils import android.view.View import android.widget.TextView import com.bihe0832.android.lib.debug.R import com.bihe0832.android.lib.floatview.BaseIconView import com.bihe0832.android.lib.text.TextFactoryUtils import kotlinx.android.synthetic.main.log_view.view.* open class DebugLogTipsIcon(context: Context) : BaseIconView(context) { private var currentText = "" private fun updateText(text: String) { getTextView()?.text = TextFactoryUtils.getSpannedTextByHtml(text) } fun getTextView(): TextView? { return log_view_text } override fun ignoreStatusBar(): Boolean { return true } override fun getLayoutId(): Int { return R.layout.log_view } override fun getRootId(): Int { return R.id.log_root } override fun getDefaultX(): Int { return 0 } override fun getDefaultY(): Int { return 0 } fun show(text: String) { currentText = text showResult() } fun append(text: String) { currentText += text showResult() } private fun showResult() { if (TextUtils.isEmpty(currentText)) { hide() } else { updateText(currentText) visibility = View.VISIBLE } } private fun hide() { this.visibility = View.GONE } }
21.470588
73
0.636986
ffdf556d49f11fa32e3efbfe4f2289669803701e
1,409
html
HTML
layouts/partials/style.html
roschart/talks
8c3268b6fb377e4951feb9d498699ade3183a6e1
[ "MIT" ]
null
null
null
layouts/partials/style.html
roschart/talks
8c3268b6fb377e4951feb9d498699ade3183a6e1
[ "MIT" ]
null
null
null
layouts/partials/style.html
roschart/talks
8c3268b6fb377e4951feb9d498699ade3183a6e1
[ "MIT" ]
1
2021-09-28T09:46:59.000Z
2021-09-28T09:46:59.000Z
<style> @import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz); @import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic); @import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic); body { font-family: 'Droid Serif'; } h1, h2, h3 { font-family: 'Yanone Kaffeesatz'; font-weight: normal; } .remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; } li { margin: 40px; } .footnote { position: absolute; bottom: 3em; } strong { color: #fa0000; font-weight: bold; } .large { font-size: 2em; } code { background: #e7e8e2; border-radius: 5px; } .remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; } .remark-code-line-highlighted { background-color: #373832; } .inverse { background: #272822; color: #a9ac9e; } .inverse h1, .inverse h2 { color: #f3f3f3; } .boxed { margin: 0 auto; margin-top: 20px; padding: 10px; background: #272822; color: #a9ac9e; border: 1px solid #ccc; border-radius: 3px/6px; font-size: 30px; font-family: 'Ubuntu Mono'; } .formula { font-size: 50px; } .big { font-size: 200px; } .justify { text-align: justify; text-justify: inter-word; } .two-columns { column-count: 2; } </style>
15.150538
85
0.591199
ed915ba85065b0d40b29f021b71b39b007386cf2
6,272
lua
Lua
tests/wave equation in spacetime.lua
thenumbernine/symmath-lua
a356b02b814d4a5fc2a7ca778527a21f25c4a570
[ "MIT" ]
37
2015-01-04T10:38:49.000Z
2022-03-01T21:37:47.000Z
tests/wave equation in spacetime.lua
thenumbernine/symmath-lua
a356b02b814d4a5fc2a7ca778527a21f25c4a570
[ "MIT" ]
13
2015-05-29T19:23:04.000Z
2022-03-31T17:01:25.000Z
tests/wave equation in spacetime.lua
thenumbernine/symmath-lua
a356b02b814d4a5fc2a7ca778527a21f25c4a570
[ "MIT" ]
2
2016-09-02T01:37:03.000Z
2021-08-11T13:14:58.000Z
#!/usr/bin/env luajit require 'ext' local env = setmetatable({}, {__index=_G}) if setfenv then setfenv(1, env) else _ENV = env end require 'symmath'.setup{ env=env, MathJax={title='wave equation in spacetime'}, fixVariableNames=true, -- automatically add the \\ to the greek letter names } printbr[[ Sources:<br> 2010 Alcubierre, Mendez, "Formulations of the 3+1 evolution equations in curvilinear coordinates"<br> 2017 Escorihuela-Tomàs, Sanchis-Gual, Degollado, Font, "Quasistationary solutions of scalar fields aroundcollapsing self-interacting boson stars"<br> <br> ]] local g = var'g' local alpha = var'alpha' local beta = var'beta' local gamma = var'gamma' printbr'ADM metric:' printbr() local ADMdef = g' _mu _nu':eq(Matrix( {-alpha^2 + beta'^k' * beta'_k', beta'_j' }, { beta'_i', gamma'_ij' })) printbr(ADMdef) printbr() local ADMInv_def = g' ^mu ^nu':eq(Matrix( {-frac(1, alpha^2), frac(1, alpha^2) * beta'^j' }, { frac(1, alpha^2) * beta'^i', gamma'^ij' - frac(1, alpha^2) * beta'^i' * beta'^j' })) printbr(ADMInv_def) printbr() local n = var'n' local normalL_def = n' _mu':eq(Matrix({ -alpha, 0 })) printbr(normalL_def) printbr() local normalU_def = n' ^mu':eq(Matrix({ frac(1,alpha), -frac(1,alpha) * beta'^i' })) printbr(normalU_def) printbr() printbr[[Also let $\frac{d}{dx^0} = \partial_0 - \mathcal{L}_\vec\beta$]] printbr() local K = var'K' local conn3 = var'Gamma' local conn4 = var'\\bar{Gamma}' printbr[[From 2008 Alcubierre "Introduction to 3+1 Numerical Relativity" Appendix B]] local conn40U_def = conn4'^0':eq( -frac(1,alpha^3) * (alpha'_,0' - beta'^m' * alpha'_,m' + alpha^2 * K) ) printbr(conn40U_def) local conn4iU_def = conn4'^i':eq( conn3'^i' + frac(1,alpha^3) * beta'^i' * (alpha'_,0' - beta'^m' * alpha'_,m' + alpha^2 * K) - frac(1,alpha^2) * (beta'^i_,0' - beta'^m' * beta'^i_,m' + alpha * alpha'_,j' * gamma'^ij') ) printbr(conn4iU_def) printbr() printbr[[Let ${\bar{\Gamma}^\alpha}_{\mu\nu}$ is the 4-metric connection.]] printbr[[Let $\bar{\Gamma}^\alpha = {\bar{\Gamma}^\alpha}_{\mu\nu} g^{\mu\nu}$]] printbr() local Phi = var'Phi' local f = var'f' printbr'wave equation in spacetime:' local waveEqn = Phi' _;mu ^;mu':eq(f) printbr(waveEqn) waveEqn = (g' ^mu ^nu' * Phi' _;mu _nu'):eq(f) printbr(waveEqn) waveEqn = (g' ^mu ^nu' * (Phi' _,mu _nu' - conn4' ^alpha _mu _nu' * Phi' _,alpha')):eq(f) printbr(waveEqn) waveEqn = (g' ^mu ^nu' * Phi' _,mu _nu' - conn4' ^alpha' * Phi' _,alpha'):eq(f) printbr(waveEqn) printbr'split space and time:' waveEqn = (g'^00' * Phi'_,00' + 2 * g'^0i' * Phi'_,0i' + g'^ij' * Phi'_,ij' - conn4'^0' * Phi'_,0' - conn4'^i' * Phi'_,i'):eq(f) printbr(waveEqn) printbr'substitute ADM metric components into wave equation:' waveEqn = waveEqn :replace(g'^00', ADMInv_def:rhs()[1][1]) :replace(g'^0i', ADMInv_def:rhs()[2][1]) :replace(g'^ij', ADMInv_def:rhs()[2][2]) :simplifyAddMulDiv() printbr(waveEqn) printbr[[solve for $\Phi_{,00}$:]] local d00_Phi_def = waveEqn:solve(Phi'_,00') printbr(d00_Phi_def) printbr() local Pi = var'Pi' local Pi_def = Pi:eq(n' ^mu' * Phi' _,mu') printbr('Let ', Pi_def) -- Pi_def = splitIndexes(Pi_def, {' mu' = {'0', 'i'}}) Pi_def = Pi:eq(n'^0' * Phi'_,0' + n'^i' * Phi'_,i') printbr(Pi_def) Pi_def = Pi_def :replace(n'^0', normalU_def:rhs()[1][1]) :replace(n'^i', normalU_def:rhs()[1][2]) :simplifyAddMulDiv() printbr(Pi_def, '(eqn. 5)') printbr() local Psi = var'Psi' local Psi_def = Psi'_i':eq(Phi'_,i') printbr[[Let $\Psi_i = \nabla^\perp_i \Phi$ (eqn. 6)]] printbr[[$\Psi_i = {\gamma_i}^\mu \nabla_\mu \Phi$]] printbr(Psi_def) local di_Phi_def = Psi_def:solve(Phi'_,i') -- this is just switching the equation printbr() printbr[[Solve $\Pi$ for $\Phi_{,0}$:]] local d0_Phi_def = Pi_def:solve(Phi'_,0'):simplifyAddMulDiv() printbr(d0_Phi_def, '(eqn. 7)') printbr[[$\frac{d}{dx^0} \Phi = \alpha \Pi$]] d0_Phi_def = d0_Phi_def:subst(Psi_def:switch()):simplifyAddMulDiv() printbr(d0_Phi_def ) printbr() printbr[[Solve $\Pi_{,i}$ for $\Psi_{i,0}$:]] di_Pi_def = Pi_def:reindex{i='j'}'_,i'():symmetrizeIndexes(Phi, {1,2}):simplifyAddMulDiv() printbr(di_Pi_def) printbr('substitute', d0_Phi_def, ',', di_Phi_def, ',', di_Phi_def'_,0'():symmetrizeIndexes(Phi, {1,2})) di_Pi_def = di_Pi_def:subst( d0_Phi_def:reindex{i='j'}, di_Phi_def:reindex{i='j'}, di_Phi_def'_,0'():symmetrizeIndexes(Phi, {1,2}) ):simplifyAddMulDiv() printbr(di_Pi_def) printbr('solve for', Psi'_i,0') local d0_Psi_def = di_Pi_def:solve(Psi'_i,0') printbr(d0_Psi_def) d0_Psi_def[2] = ((d0_Psi_def[2] - (alpha * Pi)'_,i'())):simplifyAddMulDiv() + (alpha * Pi)'_,i' printbr(d0_Psi_def, '(eqn. 8)') -- TODO this needs to be updated manually printbr[[$\frac{d}{dx^0} \Psi_i = (\alpha \Pi)_{,i}$]] printbr() printbr[[Solve $\Pi_{,0}$]] local d0_Pi_def = Pi_def'_,0'():symmetrizeIndexes(Phi, {1,2}):simplifyAddMulDiv() printbr(d0_Pi_def) printbr('substitute', di_Phi_def, ',', d0_Phi_def) d0_Pi_def = d0_Pi_def:subst(di_Phi_def, d0_Phi_def):simplifyAddMulDiv() printbr(d0_Pi_def) printbr('substitute', d00_Phi_def, ',', di_Phi_def, ',', di_Phi_def'_,j'()) d0_Pi_def = d0_Pi_def:subst(d00_Phi_def, di_Phi_def, di_Phi_def'_,j'()):simplifyAddMulDiv() printbr(d0_Pi_def) printbr('substitute', conn40U_def, ',', d0_Phi_def, ',', d0_Phi_def:reindex{i='j'}'_,i'()) d0_Pi_def = d0_Pi_def:subst( conn40U_def, d0_Phi_def, d0_Phi_def:reindex{i='j'}'_,i'() ):replace(Psi'_j,i', Psi'_i,j')() d0_Pi_def = d0_Pi_def:replace( beta'^i' * alpha'_,i', beta'^m' * alpha'_,m')() d0_Pi_def = d0_Pi_def:reindex{m='j'} d0_Pi_def = d0_Pi_def:simplifyAddMulDiv() printbr(d0_Pi_def) -- hmm, I need to get this to ignore indexes... otherwise it gives an error ---d0_Pi_def = d0_Pi_def:tidyIndexes{fixed='0'} --printbr(d0_Pi_def) printbr('substitute', conn4iU_def:reindex{m='j'}) d0_Pi_def = d0_Pi_def:subst(conn4iU_def:reindex{m='j'})() -- I can't do this on all of d0_Pi_def, but only on the rhs (because it has no _,0's) d0_Pi_def[2] = d0_Pi_def[2]:tidyIndexes():reindex{ab='ij'} d0_Pi_def = d0_Pi_def:simplifyAddMulDiv() printbr(d0_Pi_def) printbr([[$\frac{d}{dx^0} \Pi = $]], (d0_Pi_def:rhs() - Pi'_,i' * beta'^i'):simplifyAddMulDiv() ) printbr() printbr'collected:' local eqn = Matrix{Phi, Pi, Psi'_i'}:T()'_,0':eq( Matrix{d0_Phi_def:rhs(), d0_Pi_def:rhs(), d0_Psi_def:rhs()}:T() ) printbr(eqn) printbr()
37.783133
220
0.672991
019283db9d5c62b7d4aa03e385463d056ac66483
4,925
kt
Kotlin
app/src/main/kotlin/co/netguru/android/carrecognition/feature/camera/ProgressView.kt
plweegie/CarLens-Android
400e794ed69fe758400a9da4f9641f772dbe79ec
[ "Apache-2.0" ]
19
2019-01-31T15:31:53.000Z
2021-04-29T07:21:05.000Z
app/src/main/kotlin/co/netguru/android/carrecognition/feature/camera/ProgressView.kt
plweegie/CarLens-Android
400e794ed69fe758400a9da4f9641f772dbe79ec
[ "Apache-2.0" ]
12
2018-09-19T08:36:45.000Z
2019-01-31T09:12:56.000Z
app/src/main/kotlin/co/netguru/android/carrecognition/feature/camera/ProgressView.kt
plweegie/CarLens-Android
400e794ed69fe758400a9da4f9641f772dbe79ec
[ "Apache-2.0" ]
8
2019-04-08T00:35:44.000Z
2021-06-18T08:16:08.000Z
package co.netguru.android.carrecognition.feature.camera import android.content.Context import android.graphics.* import android.util.AttributeSet import android.view.View import co.netguru.android.carrecognition.R import co.netguru.android.carrecognition.common.extensions.getColorCompat import org.jetbrains.anko.dimen class GradientProgress : View { constructor(context: Context) : super(context) constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { applyAttributes(context, attrs) } constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super( context, attrs, defStyleAttr ) { applyAttributes(context, attrs) } constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super( context, attrs, defStyleAttr, defStyleRes ) { applyAttributes(context, attrs) } /** * progress should be values in [0,1] */ var progress: Float = 0f set(value) { angle = maxSweep * value invalidate() } private var angle = 0f private var width = 0f private var height = 0f private var paintStrokeWidth = DEFAULT_PAINT_STROKE private var minAngle = DEFAULT_MIN_ANGLE private var maxSweep = DEFAULT_MAX_SWEEP private var gradientStart = Color.BLUE private var gradientEnd = Color.RED private var backCircleColor = Color.LTGRAY private var drawRect = RectF() private val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply { isDither = true style = Paint.Style.STROKE pathEffect = CornerPathEffect(0.5f) strokeCap = Paint.Cap.ROUND strokeJoin = Paint.Join.ROUND strokeWidth = paintStrokeWidth } private val backPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { isDither = true style = Paint.Style.STROKE pathEffect = CornerPathEffect(0.5f) strokeCap = Paint.Cap.ROUND strokeJoin = Paint.Join.ROUND strokeWidth = paintStrokeWidth color = Color.LTGRAY } private fun applyAttributes(context: Context, attrs: AttributeSet) { val typedArray = context.obtainStyledAttributes(attrs, R.styleable.GradientProgress) gradientStart = typedArray.getColor( R.styleable.GradientProgress_gradientStart, context.getColorCompat(R.color.pink) ) gradientEnd = typedArray.getColor( R.styleable.GradientProgress_gradientEnd, context.getColorCompat(R.color.orange) ) backCircleColor = typedArray.getColor( R.styleable.GradientProgress_backCircleColor, context.getColorCompat(R.color.light_gray) ) minAngle = typedArray.getFloat(R.styleable.GradientProgress_minAngle, DEFAULT_MIN_ANGLE) maxSweep = typedArray.getFloat(R.styleable.GradientProgress_maxSweep, DEFAULT_MAX_SWEEP) paintStrokeWidth = typedArray.getDimension( R.styleable.GradientProgress_lineWidth, context.dimen(R.dimen.progress_line_width).toFloat() ) typedArray.recycle() paint.strokeWidth = paintStrokeWidth backPaint.strokeWidth = paintStrokeWidth backPaint.color = backCircleColor } override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { super.onSizeChanged(w, h, oldw, oldh) width = w.toFloat() height = h.toFloat() paint.shader = LinearGradient( w.toFloat() / 2, 0f, w.toFloat() / 2, h.toFloat(), gradientStart, gradientEnd, Shader.TileMode.CLAMP ) //canvas is rotated 90 so paddings needs to be rotated drawRect = RectF( 0f + paintStrokeWidth + paddingTop, 0f + paintStrokeWidth + paddingEnd, width - paintStrokeWidth - paddingBottom, height - paintStrokeWidth - paddingStart ) } override fun onDraw(canvas: Canvas?) { super.onDraw(canvas) if (canvas != null) { canvas.save() canvas.rotate(90f, width / 2, height / 2) canvas.drawArc( drawRect, minAngle, maxSweep, false, backPaint ) canvas.drawArc( drawRect, minAngle, angle, false, paint ) canvas.restore() } } companion object { const val DEFAULT_MIN_ANGLE = 60f const val DEFAULT_MAX_SWEEP = 240f const val DEFAULT_PAINT_STROKE = 30f } }
30.974843
100
0.596954
40ad4ec15e6fbc12daf4eaef1065dd1341f2b550
4,233
py
Python
tests/cli_test.py
fchastanet/json-schema-for-humans
0fe3e53ee1f49deb80a7231e6bbf38194bac4056
[ "Apache-2.0" ]
null
null
null
tests/cli_test.py
fchastanet/json-schema-for-humans
0fe3e53ee1f49deb80a7231e6bbf38194bac4056
[ "Apache-2.0" ]
null
null
null
tests/cli_test.py
fchastanet/json-schema-for-humans
0fe3e53ee1f49deb80a7231e6bbf38194bac4056
[ "Apache-2.0" ]
null
null
null
import traceback from pathlib import Path from bs4 import BeautifulSoup from click.testing import CliRunner, Result from json_schema_for_humans.generate import main from tests.test_utils import assert_css_and_js_copied, assert_css_and_js_not_copied, get_test_case_path def assert_cli_runner_result(result: Result) -> None: """Assert that the exit code of a CliRunner run is 0. If it isn't, print the exception info before""" if not result.exit_code == 0: print(result.exception) if result.exc_info: if len(result.exc_info) >= 3: traceback.print_tb(result.exc_info[2]) else: print(result.exc_info) assert result.exit_code == 0 def test_generate_using_cli_default() -> None: """Test the standard case of generating using the CLI""" test_path = get_test_case_path("basic") runner = CliRunner() with runner.isolated_filesystem(): result = runner.invoke(main, [test_path]) assert_cli_runner_result(result) assert Path("schema_doc.html").exists() assert_css_and_js_copied(Path.cwd()) def test_generate_using_cli_default_result_file() -> None: """Test providing a different result file path to the CLI""" test_path = get_test_case_path("basic") runner = CliRunner() with runner.isolated_filesystem(): result = runner.invoke(main, [test_path, "doc.html"]) assert_cli_runner_result(result) assert Path("doc.html").exists() assert_css_and_js_copied(Path.cwd()) def test_config_parameters() -> None: """Test providing configuration parameters using the --config CLI parameter""" test_path = get_test_case_path("basic") runner = CliRunner() with runner.isolated_filesystem(): result = runner.invoke(main, [test_path, "--config", "copy_css=false", "--config", "copy_js=false"]) assert_cli_runner_result(result) assert_css_and_js_not_copied(Path.cwd()) def test_config_parameters_flags_yes() -> None: """Test providing configuration parameters using the --config CLI parameter and the special syntax for flags""" test_path = get_test_case_path("basic") runner = CliRunner() with runner.isolated_filesystem(): result = runner.invoke(main, [test_path, "--config", "expand_buttons"]) assert_cli_runner_result(result) assert_css_and_js_copied(Path.cwd()) assert Path("schema_doc.html").exists() with open("schema_doc.html", "r", encoding="utf-8") as schema_doc: soup = BeautifulSoup(schema_doc.read(), "html.parser") expand_button = soup.find("button", text="Expand all") assert expand_button def test_config_parameters_flags_no() -> None: """Test providing configuration parameters using the --config CLI parameter and the special 'no_' syntax for flags""" test_path = get_test_case_path("basic") runner = CliRunner() with runner.isolated_filesystem(): result = runner.invoke(main, [test_path, "--config", "no_copy_css", "--config", "no_copy_js"]) assert_cli_runner_result(result) assert_css_and_js_not_copied(Path.cwd()) def test_config_file_parameter_json() -> None: test_path = get_test_case_path("basic") runner = CliRunner() with runner.isolated_filesystem(): config_file_name = "jsfh_config.json" with open(config_file_name, "w", encoding="utf-8") as config_file: config_file.write("""{"copy_css": false, "copy_js": false}""") result = runner.invoke(main, [test_path, "--config-file", config_file_name]) assert_cli_runner_result(result) assert_css_and_js_not_copied(Path.cwd()) def test_config_file_parameter_yaml() -> None: test_path = get_test_case_path("basic") runner = CliRunner() with runner.isolated_filesystem(): config_file_name = "jsfh_config.yaml" with open(config_file_name, "w", encoding="utf-8") as config_file: config_file.write("""copy_css: false\ncopy_js: false""") result = runner.invoke(main, [test_path, "--config-file", config_file_name]) assert_cli_runner_result(result) assert_css_and_js_not_copied(Path.cwd())
37.131579
121
0.690999
2a247df88ae3a47a3fb1cf5139cdca0672d030e2
1,528
java
Java
library/src/main/java/com/yumo/common/net/YmFileNetUtil.java
yumodev/ym_android_utils
24f7a3a8a96db57ddab8195484d74c6dd1c6fb99
[ "Apache-2.0" ]
null
null
null
library/src/main/java/com/yumo/common/net/YmFileNetUtil.java
yumodev/ym_android_utils
24f7a3a8a96db57ddab8195484d74c6dd1c6fb99
[ "Apache-2.0" ]
null
null
null
library/src/main/java/com/yumo/common/net/YmFileNetUtil.java
yumodev/ym_android_utils
24f7a3a8a96db57ddab8195484d74c6dd1c6fb99
[ "Apache-2.0" ]
null
null
null
package com.yumo.common.net; import android.text.TextUtils; import com.yumo.common.io.YmCloseUtil; import java.io.BufferedInputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; /** * Created by yumodev on 4/26/16. * 与网络相关的文件类,下载文件 * 网络部分使用OkHttp实现 */ public class YmFileNetUtil { /** * 下载一个文件,并保存到给定的文件中 * @param url * @param fileName * @return */ public static boolean downFile(String url, String fileName) { if (TextUtils.isEmpty(url)) { return false; } boolean result = false; InputStream is = null; FileOutputStream fileStream = null; BufferedInputStream bis = null; try { is = YmOkHttpUtil.getBodyInputStream(url); File file = new File(fileName); if (file.exists()){ file.delete(); } file.createNewFile(); fileStream = new FileOutputStream(file); bis = new BufferedInputStream(is); int len = 0; byte[] buffer = new byte[1024]; while ((len = bis.read(buffer)) != -1) { fileStream.write(buffer, 0, len); } result = true; } catch (IOException e) { e.printStackTrace(); } finally { YmCloseUtil.close(is); YmCloseUtil.close(fileStream); YmCloseUtil.close(bis); } return result; } }
22.80597
65
0.557592
c7efe1f44703bb65b92e27320dc5bc65f654ed24
789
java
Java
saas/dataops/api/metric-flink/metric-alarm/src/main/java/com/elasticsearch/cloud/monitor/metric/alarm/blink/utils/TagsUtils.java
harry-xiaomi/SREWorks
e85c723ff15d2c9739d4d240be449b00b6db096d
[ "Apache-2.0" ]
1
2022-03-22T01:09:10.000Z
2022-03-22T01:09:10.000Z
saas/dataops/api/metric-flink/metric-alarm/src/main/java/com/elasticsearch/cloud/monitor/metric/alarm/blink/utils/TagsUtils.java
Kwafoor/SREWorks
37a64a0a84b29c65cf6b77424bd2acd0c7b42e2b
[ "Apache-2.0" ]
null
null
null
saas/dataops/api/metric-flink/metric-alarm/src/main/java/com/elasticsearch/cloud/monitor/metric/alarm/blink/utils/TagsUtils.java
Kwafoor/SREWorks
37a64a0a84b29c65cf6b77424bd2acd0c7b42e2b
[ "Apache-2.0" ]
null
null
null
package com.elasticsearch.cloud.monitor.metric.alarm.blink.utils; import java.util.HashMap; import java.util.Map; import org.apache.commons.lang.StringUtils; /** * @author xingming.xuxm * @Date 2019-12-12 */ public class TagsUtils { public final static String TAGS_SEPARATOR = ","; public final static String TAGS_KEY_VALUE_SEPARATOR = "="; public static Map<String, String> toTagsMap(String tagStr) { Map<String, String> tags = new HashMap<>(16); if (StringUtils.isNotEmpty(tagStr)) { String[] tagArray = tagStr.split(TAGS_SEPARATOR); for (String tag : tagArray) { String[] kv = tag.split(TAGS_KEY_VALUE_SEPARATOR, 2); tags.put(kv[0], kv[1]); } } return tags; } }
28.178571
69
0.628644
708527a59753ada5c20f021f8ba922781ef0a487
6,444
h
C
libraries/SmartMatrix/src/FontGfx_apple6x10.h
adinath1/A4Arduino
54429f095223db8016ede54188cc927784f4f02b
[ "Apache-2.0" ]
null
null
null
libraries/SmartMatrix/src/FontGfx_apple6x10.h
adinath1/A4Arduino
54429f095223db8016ede54188cc927784f4f02b
[ "Apache-2.0" ]
null
null
null
libraries/SmartMatrix/src/FontGfx_apple6x10.h
adinath1/A4Arduino
54429f095223db8016ede54188cc927784f4f02b
[ "Apache-2.0" ]
1
2021-09-06T06:20:07.000Z
2021-09-06T06:20:07.000Z
// Adafruit GFX font Apple6x10 size: 6x10 const uint8_t Apple6x10Bitmaps[] PROGMEM = { 0xFA, // exclam 0xB6,0x80, // quotedbl 0x52,0xBE,0xAF,0xA9,0x40, // numbersign 0x23,0xA8,0xE2,0xB8,0x80, // dollar 0x4D,0x54,0x45,0x56,0x40, // percent 0x45,0x28,0x8A,0xC9,0xA0, // ampersand 0xE0, // quotesingle 0x2A,0x48,0x88, // parenleft 0x88,0x92,0xA0, // parenright 0x8A,0xBE,0xA8,0x80, // asterisk 0x21,0x3E,0x42,0x00, // plus 0x6A,0x00, // comma 0xF8, // hyphen 0x5D,0x00, // period 0x08,0x44,0x44,0x42,0x00, // slash 0x22,0xA3,0x18,0xA8,0x80, // zero 0x23,0x28,0x42,0x13,0xE0, // one 0x74,0x42,0x64,0x43,0xE0, // two 0xF8,0x44,0x60,0xC5,0xC0, // three 0x11,0x95,0x2F,0x88,0x40, // four 0xFC,0x2D,0x90,0xC5,0xC0, // five 0x32,0x21,0x6C,0xC5,0xC0, // six 0xF8,0x44,0x22,0x21,0x00, // seven 0x74,0x62,0xE8,0xC5,0xC0, // eight 0x74,0x66,0xD0,0x89,0x80, // nine 0x5D,0x05,0xD0, // colon 0x5D,0x06,0xA0, // semicolon 0x12,0x48,0x42,0x10, // less 0xF8,0x3E, // equal 0x84,0x21,0x24,0x80, // greater 0x74,0x44,0x42,0x00,0x80, // question 0x74,0x67,0x5B,0x41,0xC0, // at 0x22,0xA3,0x1F,0xC6,0x20, // A 0xF2,0x52,0xE4,0xA7,0xC0, // B 0x74,0x61,0x08,0x45,0xC0, // C 0xF2,0x52,0x94,0xA7,0xC0, // D 0xFC,0x21,0xE8,0x43,0xE0, // E 0xFC,0x21,0xE8,0x42,0x00, // F 0x74,0x61,0x09,0xC5,0xC0, // G 0x8C,0x63,0xF8,0xC6,0x20, // H 0xE9,0x24,0xB8, // I 0x38,0x84,0x21,0x49,0x80, // J 0x8C,0xA9,0x8A,0x4A,0x20, // K 0x84,0x21,0x08,0x43,0xE0, // L 0x8C,0x77,0x58,0xC6,0x20, // M 0x8C,0x73,0x59,0xC6,0x20, // N 0x74,0x63,0x18,0xC5,0xC0, // O 0xF4,0x63,0xE8,0x42,0x00, // P 0x74,0x63,0x18,0xD5,0xC1, // Q 0xF4,0x63,0xEA,0x4A,0x20, // R 0x74,0x60,0xE0,0xC5,0xC0, // S 0xF9,0x08,0x42,0x10,0x80, // T 0x8C,0x63,0x18,0xC5,0xC0, // U 0x8C,0x62,0xA5,0x28,0x80, // V 0x8C,0x63,0x5A,0xEE,0x20, // W 0x8C,0x54,0x45,0x46,0x20, // X 0x8C,0x54,0x42,0x10,0x80, // Y 0xF8,0x44,0x44,0x43,0xE0, // Z 0xF2,0x49,0x38, // bracketleft 0x84,0x10,0x41,0x04,0x20, // backslash 0xE4,0x92,0x78, // bracketright 0x22,0xA2, // asciicircum 0xF8, // underscore 0x90, // grave 0x70,0x5F,0x17,0x80, // a 0x84,0x2D,0x98,0xE6,0xC0, // b 0x74,0x61,0x17,0x00, // c 0x08,0x5B,0x38,0xCD,0xA0, // d 0x74,0x7F,0x07,0x00, // e 0x32,0x51,0xE4,0x21,0x00, // f 0x7C,0x62,0xF0,0xC5,0xC0, // g 0x84,0x2D,0x98,0xC6,0x20, // h 0x43,0x24,0xB8, // i 0x10,0x31,0x11,0x99,0x60, // j 0x84,0x23,0x2E,0x4A,0x20, // k 0xC9,0x24,0xB8, // l 0xD5,0x6B,0x58,0x80, // m 0xB6,0x63,0x18,0x80, // n 0x74,0x63,0x17,0x00, // o 0xB6,0x63,0x9B,0x42,0x00, // p 0x6C,0xE3,0x36,0x84,0x20, // q 0xB6,0x61,0x08,0x00, // r 0x74,0x1C,0x1F,0x00, // s 0x42,0x3C,0x84,0x24,0xC0, // t 0x8C,0x63,0x36,0x80, // u 0x8C,0x54,0xA2,0x00, // v 0x8C,0x6B,0x55,0x00, // w 0x8A,0x88,0xA8,0x80, // x 0x8C,0x66,0xD0,0xC5,0xC0, // y 0xF8,0x88,0x8F,0x80, // z 0x34,0x2C,0x24,0x30, // braceleft 0xFE, // bar 0xC2,0x43,0x42,0xC0, // braceright 0x4D,0x64 // asciitilde }; const GFXglyph Apple6x10Glyphs[] PROGMEM = { { 0, 0, 0, 6, 0, 0 }, // space { 0, 1, 7, 6, 2, -8 }, // exclam { 1, 3, 3, 6, 1, -8 }, // quotedbl { 3, 5, 7, 6, 0, -8 }, // numbersign { 8, 5, 7, 6, 0, -8 }, // dollar { 13, 5, 7, 6, 0, -8 }, // percent { 18, 5, 7, 6, 0, -8 }, // ampersand { 23, 1, 3, 6, 2, -8 }, // quotesingle { 24, 3, 7, 6, 1, -8 }, // parenleft { 27, 3, 7, 6, 1, -8 }, // parenright { 30, 5, 5, 6, 0, -7 }, // asterisk { 34, 5, 5, 6, 0, -7 }, // plus { 38, 3, 3, 6, 1, -3 }, // comma { 40, 5, 1, 6, 0, -5 }, // hyphen { 41, 3, 3, 6, 1, -3 }, // period { 43, 5, 7, 6, 0, -8 }, // slash { 48, 5, 7, 6, 0, -8 }, // zero { 53, 5, 7, 6, 0, -8 }, // one { 58, 5, 7, 6, 0, -8 }, // two { 63, 5, 7, 6, 0, -8 }, // three { 68, 5, 7, 6, 0, -8 }, // four { 73, 5, 7, 6, 0, -8 }, // five { 78, 5, 7, 6, 0, -8 }, // six { 83, 5, 7, 6, 0, -8 }, // seven { 88, 5, 7, 6, 0, -8 }, // eight { 93, 5, 7, 6, 0, -8 }, // nine { 98, 3, 7, 6, 1, -7 }, // colon { 101, 3, 7, 6, 1, -7 }, // semicolon { 104, 4, 7, 6, 1, -8 }, // less { 108, 5, 3, 6, 0, -6 }, // equal { 110, 4, 7, 6, 1, -8 }, // greater { 114, 5, 7, 6, 0, -8 }, // question { 119, 5, 7, 6, 0, -8 }, // at { 124, 5, 7, 6, 0, -8 }, // A { 129, 5, 7, 6, 0, -8 }, // B { 134, 5, 7, 6, 0, -8 }, // C { 139, 5, 7, 6, 0, -8 }, // D { 144, 5, 7, 6, 0, -8 }, // E { 149, 5, 7, 6, 0, -8 }, // F { 154, 5, 7, 6, 0, -8 }, // G { 159, 5, 7, 6, 0, -8 }, // H { 164, 3, 7, 6, 1, -8 }, // I { 167, 5, 7, 6, 0, -8 }, // J { 172, 5, 7, 6, 0, -8 }, // K { 177, 5, 7, 6, 0, -8 }, // L { 182, 5, 7, 6, 0, -8 }, // M { 187, 5, 7, 6, 0, -8 }, // N { 192, 5, 7, 6, 0, -8 }, // O { 197, 5, 7, 6, 0, -8 }, // P { 202, 5, 8, 6, 0, -8 }, // Q { 207, 5, 7, 6, 0, -8 }, // R { 212, 5, 7, 6, 0, -8 }, // S { 217, 5, 7, 6, 0, -8 }, // T { 222, 5, 7, 6, 0, -8 }, // U { 227, 5, 7, 6, 0, -8 }, // V { 232, 5, 7, 6, 0, -8 }, // W { 237, 5, 7, 6, 0, -8 }, // X { 242, 5, 7, 6, 0, -8 }, // Y { 247, 5, 7, 6, 0, -8 }, // Z { 252, 3, 7, 6, 1, -8 }, // bracketleft { 255, 5, 7, 6, 0, -8 }, // backslash { 260, 3, 7, 6, 1, -8 }, // bracketright { 263, 5, 3, 6, 0, -8 }, // asciicircum { 265, 5, 1, 6, 0, -1 }, // underscore { 266, 2, 2, 6, 2, -9 }, // grave { 267, 5, 5, 6, 0, -6 }, // a { 271, 5, 7, 6, 0, -8 }, // b { 276, 5, 5, 6, 0, -6 }, // c { 280, 5, 7, 6, 0, -8 }, // d { 285, 5, 5, 6, 0, -6 }, // e { 289, 5, 7, 6, 0, -8 }, // f { 294, 5, 7, 6, 0, -6 }, // g { 299, 5, 7, 6, 0, -8 }, // h { 304, 3, 7, 6, 1, -8 }, // i { 307, 4, 9, 6, 1, -8 }, // j { 312, 5, 7, 6, 0, -8 }, // k { 317, 3, 7, 6, 1, -8 }, // l { 320, 5, 5, 6, 0, -6 }, // m { 324, 5, 5, 6, 0, -6 }, // n { 328, 5, 5, 6, 0, -6 }, // o { 332, 5, 7, 6, 0, -6 }, // p { 337, 5, 7, 6, 0, -6 }, // q { 342, 5, 5, 6, 0, -6 }, // r { 346, 5, 5, 6, 0, -6 }, // s { 350, 5, 7, 6, 0, -8 }, // t { 355, 5, 5, 6, 0, -6 }, // u { 359, 5, 5, 6, 0, -6 }, // v { 363, 5, 5, 6, 0, -6 }, // w { 367, 5, 5, 6, 0, -6 }, // x { 371, 5, 7, 6, 0, -6 }, // y { 376, 5, 5, 6, 0, -6 }, // z { 380, 4, 7, 6, 1, -8 }, // braceleft { 384, 1, 7, 6, 2, -8 }, // bar { 385, 4, 7, 6, 1, -8 }, // braceright { 389, 5, 3, 6, 0, -8 } // asciitilde }; const GFXfont Apple6x10 PROGMEM = { (uint8_t *)Apple6x10Bitmaps, (GFXglyph *)Apple6x10Glyphs, 32, 126, 10};
31.90099
44
0.487896
dd6e6f932ff0a35c31eabdd2d7363323c9c0bc93
30,854
php
PHP
analyst/plate_report.php
DennisGoldfarb/ProHits
43c5ccd8c3325ab85fd9457f68e3e5f3dbb645e6
[ "Apache-2.0" ]
null
null
null
analyst/plate_report.php
DennisGoldfarb/ProHits
43c5ccd8c3325ab85fd9457f68e3e5f3dbb645e6
[ "Apache-2.0" ]
null
null
null
analyst/plate_report.php
DennisGoldfarb/ProHits
43c5ccd8c3325ab85fd9457f68e3e5f3dbb645e6
[ "Apache-2.0" ]
null
null
null
<?php /*********************************************************************** Copyright 2010 Gingras and Tyers labs, Samuel Lunenfeld Research Institute, Mount Sinai Hospital. 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. *************************************************************************/ $expect_exclusion_color="#93ffff"; $bait_color="red"; $excludecolor = "#a7a7a7"; $theaction = 'exclusion'; $submitted = 0; $whichPlate =''; $img_total = 0; $sub = ''; //$frm_Frequency = ''; $is_reincluded = ''; $typeBioArr = array(); $typeExpArr = array(); $typeFrequencyArr = ''; $frm_Expect_check = ''; $frm_Expect2_check = ''; require("../common/site_permission.inc.php"); require("common/common_fun.inc.php"); require("analyst/common_functions.inc.php"); require_once("msManager/is_dir_file.inc.php"); require("analyst/site_header.php"); if(!$Plate_ID ) { ?> <script language=javascript> document.location.href='noaccess.html'; </script> <?php exit; } $colorArr = array('C5CBF7','A7B2F6','E6B751','AC9A72','F6B2A9','DF9DF7','884D9E','798AF9','687CFA','AE15E7', 'D5CCCD','586EFA','8ED0F5','69B0D8','4C90B7','54F4F6','82ACAD','909595','A0F4B8','7BBC8D', '43CB69','E9E86F','A9A850','ffff99','99ffff','99cc00','999900','ffccff','006600','6666ff', '663399','0000ff','cc3300','0099ff','9999ff','99ccff','996600','cc99ff','ff3300','ff66ff', 'ff00ff','99ccff','996600','00ff00','990000','993333','99cc33','9999ff','ccccff','9933cc', 'ffffcc','ccffff','ccff99','ccff33','99ffcc','99ff00','ff00ff','6633ff','6633ff','6600ff', 'ffffff','66ffcc','ffcccc','66cccc','ff99cc','6699cc','ff66cc','6666cc','ff33cc','6633cc', 'ffff66','66ff66','ffcc66','66cc66','ff9966','669966','ff6666','666666','ff3366','663366', '99ff33','00ff33','99cc33','00cc33','999933','009933','996633','006633','993333','003333', '99ffcc','00ffcc','99cccc','00cccc','9999cc','0099cc','9966cc','0066cc','9933cc','0033cc'); $giArr = array(); $colorIndex = 0; $outDir = "../TMP/plate_report/"; if(!_is_dir($outDir)) _mkdir_path($outDir); $filename = $outDir.$_SESSION['USER']->Username."_plate.csv"; if (!$handle = fopen($filename, 'w')){ echo "Cannot open file ($filename)"; exit; } $oldDBName = to_defaultDB($mainDB); $SQL = "SELECT FilterNameID FROM Filter WHERE FilterSetID=" . $_SESSION['workingFilterSetID'] . " ORDER BY FilterNameID"; $filterIDArr=$mainDB->fetchAll($SQL); foreach($filterIDArr as $Value) { $SQL = "SELECT ID, Name, Alias, Color, Type, Init FROM FilterName WHERE ID=" . $Value['FilterNameID']; $filterAttrArr=$mainDB->fetch($SQL); if($filterAttrArr['Type'] == 'Fre'){ $filterAttrArr['Counter'] = 0; $typeFrequencyArr = $filterAttrArr; if(!$theaction || !$submitted){ $frm_Frequency = $filterAttrArr['Init']; }else{ if(!isset($frm_Frequency)){ $frm_Frequency = 0; } } }else{ $filterAttrArr['Counter'] = 0; if($filterAttrArr['Type'] == 'Bio'){ array_push($typeBioArr, $filterAttrArr); }else if($filterAttrArr['Type'] == 'Exp'){ array_push($typeExpArr, $filterAttrArr); } $frmName = 'frm_' . $filterAttrArr['Alias']; if(!$theaction || !$submitted){ $$frmName = $filterAttrArr['Init']; }else{ if(!isset($$frmName)){ $$frmName = "0"; } } } } back_to_oldDB($mainDB, $oldDBName); if(!isset($frequencyLimit)){ $frequencyLimit = $_SESSION["workingProjectFrequency"]; if(!$frequencyLimit) $frequencyLimit = 101; }else{ if($theaction != 'exclusion' || (isset($frm_Frequency) && !$frm_Frequency)){ $frequencyLimit = $_SESSION["workingProjectFrequency"]; } } if($theaction != 'exclusion'){ $frm_Expect_check = ''; $frm_Expect2_check = ''; } $proteinDB = new mysqlDB(PROHITS_PROTEINS_DB, HOSTNAME, USERNAME, DBPASSWORD); //-------------if move plate ------------------------------ if($whichPlate == 'last'){ $Plate_ID = move_plate($mainDB, 'last'); }else if($whichPlate == 'first'){ $Plate_ID = move_plate($mainDB, 'first'); }else if($whichPlate == 'next' and $Plate_ID){ $Plate_ID = move_plate($mainDB, 'next',$Plate_ID); }else if($whichPlate == 'previous' and $Plate_ID){ $Plate_ID = move_plate($mainDB, 'previous', $Plate_ID); } //--------------------------------------------------------- $URL = getURL(); $SQL = "SELECT ID, Name, DigestedBy, Buffer, MSDate FROM Plate where ID='$Plate_ID'"; $Plate = $mainDB->fetch($SQL); //--------- color --------------------- $bgcolordark = "#94c1c9"; $bgcolor = "white"; ?> <script language='javascript'> function print_view(theTarget){ document.plate_form.theaction.value = '<?php echo $theaction;?>'; document.plate_form.action = theTarget document.plate_form.target = "_blank"; document.plate_form.submit(); } function trimString(str) { var str = this != window? this : str; return str.replace(/^\s+/g, '').replace(/\s+$/g, ''); } function is_numberic(str){ str = trimString(str); if(/^\d*\.?\d+$/.test(str)){ return true; }else{ return false; } } function applyExclusion(){ theForm = document.plate_form; <?php if($typeFrequencyArr){?> if(theForm.frm_Frequency.checked == true){ var frequency = theForm.frequencyLimit.value; if(!is_numberic(frequency)){ alert("Please enter numbers or uncheck check box on frequency field."); return; }else{ if(frequency > 100 || frequency < 0){ alert("frequence value should be great than 0 and less than 100"); return; } } }else{ theForm.frequencyLimit.value = ''; } <?php }?> theForm.action = ''; theForm.theaction.value = 'exclusion'; theForm.action = '<?php echo $PHP_SELF;?>'; theForm.target = "_self"; theForm.submit(); } function NoExclusion(){ theForm = document.plate_form; theForm.theaction.value = ''; theForm.action = '<?php echo $PHP_SELF;?>'; theForm.target = "_self"; theForm.submit(); } function hitedit(Hit_ID){ file = 'hit_editor.php?Hit_ID=' + Hit_ID; newwin = window.open(file,"Hit",'toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=480,height=400'); } function change_plate(whichPlate){ var theForm = document.plate_form; if(whichPlate == 'last') { theForm.whichPlate.value = 'last'; } else if(whichPlate == 'first') { theForm.whichPlate.value = 'first'; } else if(whichPlate == 'next') { theForm.whichPlate.value = 'next'; } else if(whichPlate == 'previous') { theForm.whichPlate.value = 'previous'; } theForm.theaction.value = 'exclusion'; document.plate_form.action = '<?php echo $PHP_SELF;?>'; theForm.submitted.value = 0; theForm.submit(); } function pop_filter_set(filter_ID){ file = 'mng_set.php?filterID=' + filter_ID; window.open(file,"",'toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=620'); } function pop_Frequency_set(){ file = 'mng_set_frequency.php'; window.open(file,"",'toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=620'); } </script> <form name=plate_form action=<?php echo $PHP_SELF;?> method=post> <input type=hidden name=Plate_ID value='<?php echo $Plate['ID'];?>'> <input type=hidden name=theaction value='<?php echo $theaction;?>'> <input type=hidden name=submitted value='1'> <input type=hidden name=whichPlate value=''> <table border="0" cellpadding="0" cellspacing="0" width="97%"> <tr> <td colspan=2><div class=maintext> <img src="images/icon_carryover_color.gif"> Exclude Color <!--img src="images/icon_itisbait_color.gif"> Bait Color--> <img src="images/icon_Mascot.gif"> Mascot <img src="images/icon_GPM.gif"> GPM <img src="images/icon_notes.gif"> Hit Notes <img src="images/icon_first.gif" width="31" height="17" border="0"> Move Plate </div><BR> </td> </tr> <tr> <td align="left"> <font color="navy" face="helvetica,arial,futura" size="3"><b>Plate Reported Hits <?php if($AccessProjectName){ echo " <BR><font color='red' face='helvetica,arial,futura' size='3'>(Project: $AccessProjectName)</font>"; } ?> </b> </font> </td> <td align="right"> <a href="./export_peptides.php?infileName=<?php echo $filename;?>&table=plate" class=button>[Export Peptides]</a> <a href="<?php echo $filename;?>" class=button target=_blank>[Export Plate Report]</a> <a href="javascript: print_view('plate_report_hit_list.php');" class=button>[Export Hit List]</a> <a href="./plate_show.php" class=button>[Back to Plate List]</a> </td> </tr> <tr> <td colspan=2 height=1 bgcolor="black"><img src="./images/pixel.gif"></td> </tr> <tr> <td align="left" colspan=2><br> <table border=0 cellspacing="0" cellpadding="2" width="97%"> <tr> <td valign=top> <table border=0 cellspacing="0" cellpadding="0"> <tr> <td width=100><div class=large>Plate ID:</div></td> <td width=100><div class=large><b><?php echo $Plate['ID'];?></b> &nbsp;</div></td> <td width=100><div class=large>Name:</div></td> <td width=100><div class=large>&nbsp;<b><?php echo $Plate['Name'];?></b> &nbsp;</div></td> <td width=200><div class=large> <a href="javascript:change_plate('first');"> <img src="images/icon_first.gif" width="31" height="18" border="0" alt='move to first'></a>&nbsp; <a href="javascript:change_plate('previous');"> <img src="images/icon_previous.gif" width="30" height="18" border="0" alt='move to provious'></a>&nbsp; <a href="javascript:change_plate('next');"> <img src="images/icon_next.gif" width="30" height="18" border="0" alt='move to next'></a>&nbsp; <a href="javascript:change_plate('last');"> <img src="images/icon_last.gif" width="30" height="18" border="0" alt='move to last'></a>&nbsp; </div></td> <td width=1><div class=large>&nbsp;</div></td> </tr> <?php $Plate['Name'] = str_replace(",", ";", $Plate['Name']); $Plate['DigestedBy'] = str_replace(",", ";", $Plate['DigestedBy']); $Plate['Buffer'] = str_replace(",", ";", $Plate['Buffer']); fwrite($handle, "Plate ID: ".$Plate['ID'].",Name: ".$Plate['Name']); fwrite($handle, ",MS Complit Date: ".$Plate['MSDate'].",Digested By: ".$Plate['DigestedBy'].",Resusp. Buffer: ".$Plate['Buffer']."\n\n"); ?> <tr> <td><div class=large>MS Complit Date:</div></td> <td><div class=large>&nbsp;<b><?php echo $Plate['MSDate'];?></b> &nbsp;</div></td> <td><div class=large>Digested By:</div></td> <td><div class=large>&nbsp;<b><?php echo $Plate['DigestedBy'];?></b> &nbsp;</div></td> <td><div class=large>Resusp. Buffer:</div></td> <td><div class=large>&nbsp;<b><?php echo $Plate['Buffer'];?></b> &nbsp;</div></td> </tr> </table> </td> </tr> <?php include("filterSelection.inc.php"); ?> </table> </td> </tr> <tr> <td colspan=2>&nbsp; <input type=button value='No Exclusion' class=black_but onClick='javascript: NoExclusion();'> <input type=button value='Apply Exclusion' class=black_but onClick='javascript: applyExclusion();'> </td> </tr> <tr> <td align="center" colspan=2><br> <table border="0" cellpadding="0" cellspacing="1" width="100%"> <tr bgcolor=""> <td width="5" height="25" bgcolor="<?php echo $bgcolordark;?>" align=center> <div class=tableheader>Well</div></td> <td width="50" bgcolor="<?php echo $bgcolordark;?>" align="center" align=center> <div class=tableheader>Protein</div></td> <td width="50" bgcolor="<?php echo $bgcolordark;?>" align="center" align=center> <div class=tableheader>Gene</div></td> <!--td width="50" bgcolor="<?php echo $bgcolordark;?>" align="center" align=center> <div class=tableheader>LocusTag</div></td--> <?php if($frequencyLimit < 101){?> <td width="25" height="25" bgcolor="<?php echo $bgcolordark;?>" align=center> <div class=tableheader>Frequency</div></td> <?php }?> <td width="25" height="25" bgcolor="<?php echo $bgcolordark;?>" align=center> <div class=tableheader>Redundant</div></td> <td width="50" bgcolor="<?php echo $bgcolordark;?>" align=center> <div class=tableheader>MW<BR>kDa</div></td> <td width="600" bgcolor="<?php echo $bgcolordark;?>" align="center" align=center> <div class=tableheader>Description</div></td> <td width="" bgcolor="<?php echo $bgcolordark;?>" align="center" align=center> <div class=tableheader>Score</div></td> <td width="" bgcolor="<?php echo $bgcolordark;?>" align="center" align=center> <div class=tableheader>Expect</div></td> <td width="" bgcolor="<?php echo $bgcolordark;?>" align="center" align=center> <div class=tableheader># Uniqe<BR>Peptide</div></td> <td width="" bgcolor="<?php echo $bgcolordark;?>" align="center"> <div class=tableheader>Links</div></td> <td width="" bgcolor="<?php echo $bgcolordark;?>" align="center"> <div class=tableheader>Filter</div></td> <td width="80" bgcolor="<?php echo $bgcolordark;?>" align="center"> <div class=tableheader>Option</div></td> </tr> <?php $filedNameStr = "HitID,Well,GI,GeneID,GeneName,LocusTag,"; if($frequencyLimit < 101){ $filedNameStr .= "Frequency,"; } $filedNameStr .= "Redundant,MW,Description,Score,Search Database,Search Date,Filters\n\n"; fwrite($handle, $filedNameStr); $tmpCounter = 0; //-------1/9----------------------------------- $SQL = "SELECT BaitGeneID FROM BaitToHits WHERE ProjectID ='".$_SESSION["workingProjectID"]."' GROUP BY BaitGeneID"; $totalGenes = $mainDB->get_total($SQL); //------------------------------------------ $tmpBait['ID'] = ''; $tmpBand['ID'] = ''; $SQL = "SELECT H.ID, H.WellID, H.BaitID, H.BandID, H.Instrument, H.GeneID, H.LocusTag, H.HitGI, H.HitName, H.Expect, H.Expect2, H.MW, H.Pep_num_uniqe, H.RedundantGI, H.ResultFile, H.SearchDatabase, H.DateTime, H.OwnerID, H.SearchEngine, W.WellCode FROM Hits H, PlateWell W "; $SQL .= " WHERE H.WellID=W.ID and PlateID='".$Plate['ID']."' "; $SQL .= " and W.ProjectID=$AccessProjectID"; $SQL .= ' ORDER By W.WellCode'; $sqlResult = mysqli_query($mainDB->link, $SQL); $img_total = mysqli_num_rows($sqlResult); while (list( $HitID, $HitWellID, $HitBaitID, $HitBandID, $HitInstrument, $HitGeneID, $HitLocusTag, $HitGI, $HitName, $HitExpect, $HitExpect2, $HitMW, $HitPepNumUniqe, $HitRedundantGI, $HitResultFile, $HitSearchDatabase, $HitDateTime, $HitOwnerID, $HitSearchEngine, $HitWellCode )= mysqli_fetch_row($sqlResult)){ $tmpHitNotes = array(); $HitGeneName = ''; //--------------1/9----------------------- $HitFrequency = 0; if($HitGeneID) { $SQL = "SELECT GeneName, BioFilter FROM Protein_Class WHERE EntrezGeneID=$HitGeneID"; $ProteinArr = $proteinDB->fetch($SQL); if(count($ProteinArr) && $ProteinArr['GeneName']){ $HitGeneName = $ProteinArr['GeneName']; } if(count($ProteinArr) && $ProteinArr['BioFilter']){ $tmpHitNotes = explode(",", $ProteinArr['BioFilter']); } //---add 1/9-------------------------------------------------------------------- $SQL = "SELECT Value, FilterAlias FROM ExpFilter WHERE ProjectID ='".$_SESSION["workingProjectID"]."' AND GeneID=$HitGeneID"; $ExpFilterArr = $mainDB->fetchAll($SQL); if($ExpFilterArr){ for($n=0; $n<count($ExpFilterArr); $n++){ if($ExpFilterArr[$n]['FilterAlias'] == 'FQ'){ if($ExpFilterArr[$n]['Value'] && $totalGenes){ $HitFrequency = round(($ExpFilterArr[$n]['Value'] / $totalGenes) * 100, 2); } }else if($ExpFilterArr[$n]['FilterAlias']){ array_push($tmpHitNotes, $ExpFilterArr[$n]['FilterAlias']); } } } } $SQL = "SELECT FilterAlias FROM HitNote WHERE HitID=$HitID"; $HitNoteArr = $mainDB->fetchAll($SQL); if($HitNoteArr){ for($n=0; $n<count($HitNoteArr); $n++){ if($HitNoteArr[$n]['FilterAlias']){ array_push($tmpHitNotes, $HitNoteArr[$n]['FilterAlias']); } } } //---add 1/9------------------------------------------------------------------- if(is_one_peptide($HitID,$HITSDB,$HitPepNumUniqe)) array_push($tmpHitNotes, "OP"); $SQL = "SELECT B.BandMW FROM Band B, PlateWell P WHERE B.ID=P.BandID AND P.ID=$HitWellID"; $BandMWArr = $mainDB->fetch($SQL); $tmpNum = 0; if($BandMWArr && $BandMWArr['BandMW']){ if($BandMWArr['BandMW'] > 0){ $tmpNum = abs(($BandMWArr['BandMW'] - $HitMW)*100/$BandMWArr['BandMW']); } if($BandMWArr['BandMW'] < 25 or $BandMWArr['BandMW'] > 100){ if($tmpNum > 50){ array_push($tmpHitNotes, "AW"); } }else{ if($tmpNum > 30 ){ array_push($tmpHitNotes, "AW"); } } }//from checkCarryOver.inc.php===================== //--------------------------------------------------------------------------------- $tmpbgcolor = $bgcolor; $tmptextfont = "maintext"; if($HitBaitID != $tmpBait['ID']){ $SQL = "SELECT ID, GeneID, LocusTag, GeneName, BaitMW FROM Bait where ID='$HitBaitID'"; $tmpBait = $mainDB->fetch($SQL);; } if($tmpBait['GeneID'] && $HitGeneID && ($tmpBait['GeneID'] == $HitGeneID)){ array_push($tmpHitNotes, "BT"); } $rc_excluded = 0; if(!isset($frm_BT) || !$frm_BT and $tmpBait['GeneID'] == $HitGeneID){ $rc_excluded = 0; }else if($theaction == 'exclusion' && !in_array(ID_REINCLUDE, $tmpHitNotes)){ if(($frm_Expect_check && $HitExpect && $HitExpect <= $frm_Expect) || ($frm_Expect2_check && $HitExpect2 && $HitExpect2 >= $frm_Expect2) || (isset($frm_Frequency) && $frm_Frequency and $HitFrequency >= $frequencyLimit)){ $rc_excluded=1; } if(count($tmpHitNotes) && !$rc_excluded){ foreach($typeBioArr as $Value) { $frmName = 'frm_' . $Value['Alias']; if($$frmName and in_array($Value['Alias'] ,$tmpHitNotes)){ $rc_excluded=1; break; } } if(!$rc_excluded){ foreach($typeExpArr as $Value) { $frmName = 'frm_' . $Value['Alias']; if($$frmName and in_array($Value['Alias'] ,$tmpHitNotes)){ $rc_excluded=1; break; } } } if(in_array(ID_MANUALEXCLUSION, $tmpHitNotes) && !$rc_excluded) $rc_excluded=1; } } if(!$rc_excluded and $theaction != 'exclusion' && !in_array(ID_REINCLUDE,$tmpHitNotes)){ $isTrue = 0; foreach($typeBioArr as $Value){ //if(in_array($Value['Alias'] ,$tmpHitNotes) && $Value['Alias'] != "HP"){ if(in_array($Value['Alias'] ,$tmpHitNotes)){ $isTrue = 1; break; } } if(!$isTrue){ foreach($typeExpArr as $Value) { if(in_array($Value['Alias'], $tmpHitNotes)){ $isTrue = 1; break; } } } if(!$isTrue){ if($HitFrequency >= $frequencyLimit || ($HitExpect and $HitExpect <= DEFAULT_EXPECT_EXCLUSION )){ $isTrue = 1; } } if($isTrue){ $tmpbgcolor = $excludecolor; $tmptextfont = "excludetext"; } } if(!$rc_excluded){ $tmpCounter++; if($HitBandID != $tmpBand['ID']) { $SQL = "SELECT ID, BandMW, Location FROM Band WHERE ID='$HitBandID' and ProjectID=$AccessProjectID"; $tmpBand = $mainDB->fetch($SQL); ?> <tr bgcolor=""> <td colspan=14><div class=maintext_color><hr> <?php echo "Band ID: <b>".$tmpBand['ID']."</b> &nbsp; Observed MW: <b>".$tmpBand['BandMW']."</b> kDa &nbsp; Band Code: <b>".$tmpBand['Location']."</b><br> Bait ID: <b>".$tmpBait['ID']."</b> &nbsp: Bait Gene: <b>".$tmpBait['GeneID']."/".$tmpBait['GeneName']."</b> &nbsp: Bait LocusTag: <b>".$tmpBait['LocusTag']."</b> &nbsp: Bait MW: <b>".$tmpBait['BaitMW']."</b>"; ?></div> </td> </tr> <?php $tmpBait['GeneName'] = str_replace(",", ";", $tmpBait['GeneName']); $tmpBait['LocusTag'] = str_replace(",", ";", $tmpBait['LocusTag']); fwrite($handle, "\n\nBand ID: ".$tmpBand['ID'].",Observed MW: ".$tmpBand['BandMW'].",Band Code: ".$tmpBand['Location']."\n"); fwrite($handle, "Bait ID: ".$tmpBait['ID'].",Bait Gene: ".$tmpBait['GeneID'].",Bait LocusTag: ".$tmpBait['LocusTag'].",Bait MW: ".$tmpBait['BaitMW']."\n"); } if($HitFrequency){ $HitFrequencyPercent = $HitFrequency."%"; }else{ $HitFrequencyPercent = "0%"; } $fileRedundantGI = str_replace("gi","<br>gi", $HitRedundantGI); $Description = str_replace(",", ";", $HitName); $Description = str_replace("\n", "", $Description); $HitWellCode = str_replace(",", ";", $HitWellCode); $HitGeneName = str_replace(",", ";", $HitGeneName); $HitLocusTag = str_replace(",", ";", $HitLocusTag); $HitExpect = str_replace(",", ";", $HitExpect); $HitSearchDatabase = str_replace(",", ";", $HitSearchDatabase); $HitGI = str_replace(",", ";", $HitGI); fwrite($handle, $HitID.",".$HitWellCode.",".$HitGI.",".$HitGeneID.",".$HitGeneName.",".$HitLocusTag.","); if($frequencyLimit < 101){ fwrite($handle, $HitFrequencyPercent.","); } fwrite($handle, $HitRedundantGI.",".$HitMW.",".$Description.",".$HitExpect.",".$HitSearchDatabase.",".$HitDateTime.","); $filterString = ''; ?> <tr bgcolor='<?php echo $tmpbgcolor;?>' onmousedown="highlightTR(this, 'click', '#CCFFCC', '<?php echo $tmpbgcolor;?>');"> <td width="" align="center" bgcolor=<?php if($HitGeneID && ($tmpBait['GeneID'] == $HitGeneID)){ echo "'$bait_color'"; $counter = count($typeBioArr); for($m=0; $m<$counter; $m++){ if($typeBioArr[$m]['Alias'] == ID_BAIT){ $typeBioArr[$m]['Counter']++; break; } } }else{ echo "'$tmpbgcolor'"; } ?>><div class=<?php echo $tmptextfont;?>> <?php echo $HitWellCode;?>&nbsp; </div> </td> <td width="" align="center"><div class=<?php echo $tmptextfont;?>> <?php echo $HitGI ;?>&nbsp; </div> </td> <td width="" align="center"><div class=<?php echo $tmptextfont;?>> <?php if($HitGeneID || $HitGeneName){ echo $HitGeneID." / ".$HitGeneName; } ?>&nbsp; </div> </td> <!--td width="" align="center"><div class=maintext> <?php echo $HitLocusTag ;?>&nbsp; </div> </td--> <?php if($frequencyLimit < 101){?> <td width="" align="left"><div class=<?php echo $tmptextfont;?>> <?php echo ($HitFrequency)?$HitFrequency."%":'0%';?>&nbsp; </div> </td> <?php }?> <td width="" align="left"><div class=<?php echo $tmptextfont;?>> <?php echo str_replace("gi","<br>gi", $HitRedundantGI);?>&nbsp; </div> </td> <td width="" align="center"><div class=<?php echo $tmptextfont;?>> <?php echo $HitMW ;?>&nbsp; </div> </td> <td width="" align="left"><div class=<?php echo $tmptextfont;?>> <?php echo $HitName;?>&nbsp; </div> </td> <td width="" align="right" nowrap><div class=<?php echo $tmptextfont;?>> <?php echo $HitExpect; //echo expectFormat($Hits->Expect[$i]); ?>&nbsp; </div> </td> <td width="" align="right" nowrap><div class=<?php echo $tmptextfont;?>> <?php echo $HitExpect2; //echo expectFormat($Hits->Expect[$i]); ?>&nbsp; </div> </td> <td width="" align="right" ><div class=<?php echo $tmptextfont;?>> <?php echo $HitPepNumUniqe;?>&nbsp;</div> </td> <td width="" align="center" nowrap><div class=<?php echo $tmptextfont;?>> <?php $urlLocusTag = $HitLocusTag; $urlGeneID = $HitGeneID; $urlGI = $HitGI; echo get_URL_str($HitGI, $HitGeneID, $HitLocusTag); ?> </td> <td> <table border=0 cellpadding="1" cellspacing="1"><tr> <?php $counter = count($typeBioArr); for($m=0; $m<$counter; $m++){ if(($typeBioArr[$m]['Alias'] != ID_BAIT) && in_array($typeBioArr[$m]['Alias'] ,$tmpHitNotes)){ $tmp_color = $typeBioArr[$m]['Color']; echo "<td bgcolor=$tmp_color nowrap><div class=maintext>&nbsp; &nbsp;</div></td>"; ($filterString)? $filterString.=";".$typeBioArr[$m]['Name'] : $filterString.=$typeBioArr[$m]['Name']; $typeBioArr[$m]['Counter']++; } } $counter = count($typeExpArr); for($m=0; $m<$counter; $m++){ if(($typeExpArr[$m]['Alias'] != ID_BAIT) && in_array($typeExpArr[$m]['Alias'] ,$tmpHitNotes)){ $tmp_color = $typeExpArr[$m]['Color']; echo "<td bgcolor=$tmp_color nowrap><div class=maintext>&nbsp; &nbsp;</div></td>"; ($filterString)? $filterString.=";".$typeExpArr[$m]['Name'] : $filterString.=$typeExpArr[$m]['Name']; $typeExpArr[$m]['Counter']++; } } if($typeFrequencyArr && $HitFrequency >= $frequencyLimit and !$is_reincluded){ $typeFrequencyArr['Counter']++; echo "<td bgcolor='" . $typeFrequencyArr['Color'] . "' nowrap><div class=maintext>&nbsp; &nbsp;</div></td>"; ($filterString)? $filterString.=";frequence>=$frequencyLimit" : $filterString.="frequence>=$frequencyLimit"; } if(($HitExpect and $HitExpect <= DEFAULT_EXPECT_EXCLUSION) and !$theaction and !$is_reincluded){ echo "<td bgcolor='$expect_exclusion_color' nowrap><div class=maintext>&nbsp; &nbsp;</div></td>"; ($filterString)? $filterString.=";expect<=".DEFAULT_EXPECT_EXCLUSION : $filterString.="expect<=".DEFAULT_EXPECT_EXCLUSION; } if(in_array(ID_REINCLUDE,$tmpHitNotes)) { //reinclude echo "<td bgcolor=#660000><font face='Arial' color=white size=-1><b>R</b></font></td>"; ($filterString)? $filterString.=";reinclude" : $filterString.="reinclude"; } if(in_array(ID_MANUALEXCLUSION,$tmpHitNotes)) { //manual exclude echo "<td bgcolor=black><font face='Arial' color=yellow size=-1><b>X</b></font></td>"; ($filterString)? $filterString.=";manualexclusion" : $filterString.="manualexclusion"; } fwrite($handle, $filterString."\n"); ?> </tr></table> </td> <td width="" align="left" nowrap><div class=maintext>&nbsp; <?php if($HitSearchEngine=='Mascot' or $HitSearchEngine=='GPM'){?> <a href="javascript:view_peptides(<?php echo $HitID;?>);"><img border="0" src="./images/icon_<?php echo $HitSearchEngine;?>.gif" alt="Peptides"></a> <a href="javascript:view_master_results('<?php echo $HitResultFile;?>','<?php echo $HitSearchEngine;?>');"><img border="0" src="./images/icon_<?php echo $HitSearchEngine;?>2.gif" alt="Peptides"></a> <?php }?> <a href="javascript: add_notes('<?php echo $HitID;?>');"><img src="./images/icon_notes.gif" border=0 alt="Hit Notes"></a> <?php if($AUTH->Modify and ($HitOwnerID == $AccessUserID || $SuperUsers) and 0){?> <a href="javascript: hitedit('<?php echo $HitID;?>');"><img src="./images/icon_view.gif" border=0 alt="modify hit"></a> <?php } $coip_color_and_ID = array('color'=>'', 'ID'=> ''); $coip_color_and_ID = get_coip_color($mainDB, $tmpBait['GeneID'], $HitGeneID); if($coip_color_and_ID && $coip_color_and_ID['ID'] && $coip_color_and_ID['color']){ echo "<a href='./coip.php?theaction=modify&Coip_ID=".$coip_color_and_ID['ID'] . "' target=new>"; echo "<img src=\"./images/icon_coip_".$coip_color_and_ID['color'].".gif\" border=0 alt='co-ip detail'>"; echo "</a>"; } ?> </div> </td> </tr> <?php }//end if re_excluded } //end for //echo $tmpCounter; $currentSetArr = array(); foreach($typeBioArr as $Value){ array_push($currentSetArr, $Value); } foreach($typeExpArr as $Value){ array_push($currentSetArr, $Value); } if($typeFrequencyArr && $frequencyLimit < 101){ array_push($currentSetArr, $typeFrequencyArr); } ?> </table> </td> </tr> </table> </form> <?php if($currentSetArr){ $_SESSION["currentSetArr"] = $currentSetArr; ?> <script language=javascript> document['reportgif'].src = 'bait_report_gif.inc.php?total=<?php echo $img_total?>'; </script> <?php } require("site_footer.php"); //************************************** // this function will return 10 base power // string value for displaying by passing // a float value. function expectFormat($Value){ $rt=''; if($Value == 0) return "0"; $decimals = log10($Value); $tmp_int = intval( $decimals ); if($decimals < 0){ $tmpPow = $decimals + abs($tmp_int) + 1; $rt = sprintf("%0.1f", pow(10,$tmpPow)); $tmp_int = $tmp_int -1; $rt .= "?0<sup>$tmp_int</sup>"; }else if($decimals > 1){ $tmpPow = $decimals - $tmp_int; $rt = sprintf("%0.1f", pow(10,$tmpPow)); $rt .= "?0<sup>$tmp_int</sup>"; }else{ $rt = sprintf("%0.1f", $Value); } return $rt; } function move_plate($DB, $whichPlate,$Plate_ID = 0){ $re = $Plate_ID; if($whichPlate == 'last'){ $SQL = "select PlateID from PlateWell group by PlateID order by PlateID desc limit 1"; }elseif($whichPlate == 'first'){ $SQL = "select PlateID from PlateWell where PlateID > 0 group by PlateID order by PlateID limit 1"; }elseif($whichPlate == 'next' and $Plate_ID){ $SQL = "select PlateID from PlateWell WHERE PlateID > $Plate_ID group by PlateID order by PlateID limit 1"; }elseif($whichPlate == 'previous' and $Plate_ID){ $SQL = "select PlateID from PlateWell WHERE PlateID < $Plate_ID group by PlateID order by PlateID desc limit 1"; } //echo $SQL; $row = mysqli_fetch_array(mysqli_query($DB->link, $SQL)); if($row[0]) $re = $row[0]; return $re; } ?>
36.906699
222
0.582518
84474fa6700bdee70fd0c5a17af298601a748624
16,994
html
HTML
src/detail-game.html
armdong/web-0901
55750782fea81ab844dd8263c3d2668c0fe7465f
[ "MIT" ]
null
null
null
src/detail-game.html
armdong/web-0901
55750782fea81ab844dd8263c3d2668c0fe7465f
[ "MIT" ]
null
null
null
src/detail-game.html
armdong/web-0901
55750782fea81ab844dd8263c3d2668c0fe7465f
[ "MIT" ]
null
null
null
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="renderer" content="webkit"> <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1"> <meta name="description" content=""> <meta name="author" content=""> <title>泉州体育服务平台 | 赛事详情</title> <link rel="stylesheet" href="static/css/normalize.css"> <link rel="stylesheet" href="static/css/layout.css"> <link rel="stylesheet" href="static/css/detail-game.css"> <link rel="shortcut icon" href="favicon.ico" /> </head> <body> <!-- layout begin --> <div class="layout"> <!-- layout header begin --> <div class="layout-header"> <div class="container clearfix"> <!-- logo begin --> <a href="javascript:;" class="logo"> <img src="static/images/logo.jpg" alt="Logo"> </a> <!-- logo end --> <!-- nav begin --> <ul class="nav clearfix"> <li> <a href="index.html">首页</a> </li> <li> <a href="list-venues.html">场馆预订</a> </li> <li> <a href="list-courses.html">培训课程</a> </li> <li class="active"> <a href="list-games.html">赛事报名</a> </li> <li> <a href="list-sports.html">体育电商</a> </li> <li> <a href="list-clubs.html">俱乐部</a> </li> </ul> <!-- nav end --> </div> </div> <!-- layout header end --> <!-- layout container begin --> <div class="layout-container"> <!-- detail page begin --> <div class="page detail-page"> <!-- page container begin --> <div class="page-container"> <!-- detail wrapper begin --> <div class="detail-wrapper"> <div class="detail-container"> <!-- position begin --> <p class="position">当前位置: <a href="index.html">泉州体育服务平台</a> > <a href="list-games.html">赛事报名</a> > 赛事详情</p> <!-- position end --> <!-- qrcode begin --> <div class="qrcode"> <p class="text">扫一扫下方二维码,立即报名~</p> <div class="img"> <img src="static/images/qrcode_detail.jpg" alt="qrcode"> </div> </div> <!-- qrcode end --> <!-- summary begin --> <div class="summary"> <h2>2017首届福建省青少年网球排名赛 龙岩站</h2> <div class="btn-buy" id="btnBuy"> <p>立即报名</p> <div class="qrcode-container"> <span class="triangle"></span> <span class="btn-close"></span> <p>扫一扫下方二维码,立即预订~</p> <div class="img"> <img src="static/images/qrcode_detail.jpg" alt="qrcode"> </div> </div> </div> </div> <!-- summary end --> <div class="section"> <p class="title">活动详情</p> <div class="content"> <ul class="description"> <li class="clearfix"> <p class="desc-title">活动时间:</p> <p class="desc-content">2017-07-11 至 2017-07-14</p> </li> <li class="clearfix"> <p class="desc-title">活动地点:</p> <p class="desc-content">龙岩市体育公园</p> </li> <li class="clearfix"> <p class="desc-title">详细地址:</p> <p class="desc-content">龙岩体育公园网球场:龙岩市新罗区龙腾中路龙腾桥附近(甲、乙、丁组赛区); 龙岩体育中心网球场:龙岩市新罗区九一南路180号(丙组赛区)</p> </li> <li class="clearfix"> <p class="desc-title">报名时间:</p> <p class="desc-content">2017-07-11 至 2017-07-14</p> </li> <li class="clearfix"> <p class="desc-title">活动人数:</p> <p class="desc-content"><span>0</span>/18</p> </li> <li class="clearfix"> <p class="desc-title">报名费用: </p> <p class="desc-content"><span>¥30</span></p> </li> <li class="clearfix"> <p class="desc-title">是否可以线上报名:</p> <p class="desc-content">可以/不可以</p> </li> <li class="clearfix"> <p class="desc-title">是否需要审核:</p> <p class="desc-content">不需审核/需审核</p> </li> <li class="clearfix"> <p class="desc-title">是否公开:</p> <p class="desc-content">俱乐部内活动(只允许俱乐部成员报名)/公开</p> </li> <li class="clearfix"> <p class="desc-title">活动说明:</p> <p class="desc-content">活动详细说明</p> </li> </ul> </div> </div> <div class="section"> <p class="title">赛事详情</p> <div class="content"> <ul class="description"> <li class="clearfix"> <p class="desc-title">比赛时间:</p> <p class="desc-content">2017-07-11 至 2017-07-14</p> </li> <li class="clearfix"> <p class="desc-title">比赛地点:</p> <p class="desc-content">龙岩市体育公园</p> </li> <li class="clearfix"> <p class="desc-title">详细地址:</p> <p class="desc-content">龙岩体育公园网球场:龙岩市新罗区龙腾中路龙腾桥附近(甲、乙、丁组赛区); 龙岩体育中心网球场:龙岩市新罗区九一南路180号(丙组赛区)</p> </li> <li class="clearfix"> <p class="desc-title">报名时间:</p> <p class="desc-content">2017-07-11 至 2017-07-14</p> </li> <li class="table clearfix"> <p class="desc-title">年龄限制:</p> <div class="desc-content"> <table> <tbody> <tr> <td class="tt">甲组</td> <td class="ctt">2000年01月01日-2002年12月31日 出生</td> </tr> <tr> <td class="tt">乙组</td> <td class="ctt">2003年01月01日-2005年12月31日 出生</td> </tr> <tr> <td class="tt">丙组</td> <td class="ctt">2006年01月01日-2007年12月31日 出生</td> </tr> <tr> <td class="tt">丁组</td> <td class="ctt">2008年01月01日-2017年01月01日 出生</td> </tr> </tbody> </table> </div> </li> <li class="table clearfix"> <p class="desc-title">报名项目:</p> <div class="desc-content"> <table> <tbody> <tr> <td class="tt">甲组</td> <td class="ctt">女子双打 , 女子单打 , 男子双打 , 男子单打</td> </tr> <tr> <td class="tt">乙组</td> <td class="ctt">女子双打 , 女子单打 , 男子双打 , 男子单打</td> </tr> <tr> <td class="tt">丙组</td> <td class="ctt">女子双打 , 女子单打 , 男子双打 , 男子单打 </td> </tr> <tr> <td class="tt">丁组</td> <td class="ctt">单打</td> </tr> </tbody> </table> </div> </li> <li class="table clearfix"> <p class="desc-title">报名费用:</p> <div class="desc-content"> <table> <tbody> <tr> <td class="tt">甲组</td> <td class="ctt">150元</td> </tr> <tr> <td class="tt">乙组</td> <td class="ctt">150元</td> </tr> <tr> <td class="tt">丙组</td> <td class="ctt">150元</td> </tr> <tr> <td class="tt">丁组</td> <td class="ctt">150元</td> </tr> </tbody> </table> </div> </li> <li class="table clearfix"> <p class="desc-title">报名人数:</p> <div class="desc-content"> <table> <thead> <tr> <td class="tt">组别</td> <td class="ctt1">项目</td> <td class="ctt2">已报</td> <td class="ctt3">可报</td> </tr> </thead> <tbody> <tr> <td class="tt">甲组</td> <td class="ctt1"> <table> <tr><td>女子双打</td></tr> <tr><td>女子单打</td></tr> <tr><td>男子双打</td></tr> <tr class="last"><td>男子单打</td></tr> </table> </td> <td class="ctt2"> <table> <tr><td>14人</td></tr> <tr><td>16人</td></tr> <tr><td>11人</td></tr> <tr class="last"><td>12人</td></tr> </table> </td> <td class="ctt3"> <table> <tr><td>50人</td></tr> <tr><td>50人</td></tr> <tr><td>50人</td></tr> <tr class="last"><td>50人</td></tr> </table> </td> </tr> <tr> <td class="tt">乙组</td> <td class="ctt1"> <table> <tr><td>女子双打</td></tr> <tr><td>女子单打</td></tr> <tr><td>男子双打</td></tr> <tr class="last"><td>男子单打</td></tr> </table> </td> <td class="ctt2"> <table> <tr><td>14人</td></tr> <tr><td>32人</td></tr> <tr><td>13人</td></tr> <tr class="last"><td>14人</td></tr> </table> </td> <td class="ctt3"> <table> <tr><td>50人</td></tr> <tr><td>50人</td></tr> <tr><td>50人</td></tr> <tr class="last"><td>50人</td></tr> </table> </td> </tr> <tr> <td class="tt">丙组</td> <td class="ctt1"> <table> <tr><td>女子双打</td></tr> <tr><td>女子单打</td></tr> <tr><td>男子双打</td></tr> <tr class="last"><td>男子单打</td></tr> </table> </td> <td class="ctt2"> <table> <tr><td>23人</td></tr> <tr><td>22人</td></tr> <tr><td>32人</td></tr> <tr class="last"><td>15人</td></tr> </table> </td> <td class="ctt3"> <table> <tr><td>50人</td></tr> <tr><td>50人</td></tr> <tr><td>50人</td></tr> <tr class="last"><td>50人</td></tr> </table> </td> </tr> <tr> <td class="tt">丁组</td> <td class="ctt1">单打</td> <td class="ctt2">8人</td> <td class="ctt3">64人</td> </tr> </tbody> </table> </div> </li> <li class="clearfix"> <p class="desc-title">取消报名:</p> <p class="desc-content">赛前7天</p> </li> <li class="clearfix"> <p class="desc-title">备注信息:</p> <p class="desc-content">7月1号截止报名 7月4号截止退款</p> </li> </ul> </div> </div> </div> </div> <!-- detail wrapper end --> </div> <!-- page container end --> </div> <!-- detail page end --> </div> <!-- layout container end --> <!-- layout footer begin --> <div class="layout-footer"> <!-- footer body begin --> <div class="footer-body"> <div class="container clearfix"> <!-- sitemap begin --> <div class="sitemap clearfix"> <dl> <dt>商务合作</dt> <dd><a href="join-venue.html">场馆入驻</a></dd> <dd><a href="javascript:;">课程入驻</a></dd> <dd><a href="javascript:;">赛事入驻</a></dd> <dd><a href="javascript:;">电商入驻</a></dd> <dd><a href="javascript:;">俱乐部入驻</a></dd> </dl> <dl> <dt>网站导航</dt> <dd><a href="list-venues.html">场馆预订</a></dd> <dd><a href="list-courses.html">课程培训</a></dd> <dd><a href="list-games.html">赛事报名</a></dd> <dd><a href="list-sports.html">体育电商</a></dd> <dd><a href="list-clubs.html">俱乐部</a></dd> </dl> <dl> <dt>官方微信</dt> <dd> <p>泉州乐赛体育</p> <img src="static/images/qrcode_wechat.jpg" alt="泉州乐赛体育"> </dd> </dl> </div> <!-- sitemap end --> <!-- cooperation begin --> <div class="cooperation"> <img src="static/images/footer_cooperation.jpg" alt=""> </div> <!-- cooperation end --> </div> </div> <!-- footer body end --> <!-- footer copyright begin --> <div class="footer-copyright"> <div class="container"> <p><span>@2017-2027</span><span>乐赛体育有限公司</span><span>版权所有</span></p> <p>粤ICP备14066056号</p> </div> </div> <!-- footer copyright end --> </div> <!-- layout footer end --> </div> <!-- layout end --> <!-- javscript begin --> <script src="static/js/jquery-1.12.4.min.js"></script> <script src="static/js/detail-game.js"></script> <!-- javascript end --> </body> </html>
38.622727
121
0.315464
1fb79165e120ce0c19bd6eb662fabaa1e2b66635
954
html
HTML
manuscript/page-1970/body.html
marvindanig/our-mutual-friend
33391be687d121aa8098137f2085616d2ca757ed
[ "BlueOak-1.0.0", "MIT" ]
null
null
null
manuscript/page-1970/body.html
marvindanig/our-mutual-friend
33391be687d121aa8098137f2085616d2ca757ed
[ "BlueOak-1.0.0", "MIT" ]
null
null
null
manuscript/page-1970/body.html
marvindanig/our-mutual-friend
33391be687d121aa8098137f2085616d2ca757ed
[ "BlueOak-1.0.0", "MIT" ]
null
null
null
<div class="leaf "><div class="inner justify"><p class="no-indent ">done; for, the instant she mentioned Mr Lightwood’s name, John stopped, with his hand upon the lock of the room door.</p><p>‘Come up stairs, my darling.’</p><p>Bella was amazed by the flush in his face, and by his sudden turning away. ‘What can it mean?’ she thought, as she accompanied him up stairs.</p><p>‘Now, my life,’ said John, taking her on his knee, ‘tell me all about it.’</p><p>All very well to say, ‘Tell me all about it;’ but John was very much confused. His attention evidently trailed off, now and then, even while Bella told him all about it. Yet she knew that he took a great interest in Lizzie and her fortunes. What could it mean?</p><p>‘You will come to this marriage with me, John dear?’</p><p>‘N—no, my love; I can’t do that.’</p><p>‘You can’t do that, John?’</p><p class=" stretch-last-line ">‘No, my dear, it’s quite out of the question. Not to</p></div> </div>
954
954
0.706499
feb585cf32e061470049b2bdaa33cb129c45d732
127
sql
SQL
settings.sql
buggydev1/Hip_yelp_Back
f80407d898d267465e5cfbf7f73905b776e91b43
[ "MIT" ]
null
null
null
settings.sql
buggydev1/Hip_yelp_Back
f80407d898d267465e5cfbf7f73905b776e91b43
[ "MIT" ]
null
null
null
settings.sql
buggydev1/Hip_yelp_Back
f80407d898d267465e5cfbf7f73905b776e91b43
[ "MIT" ]
2
2021-04-22T14:42:57.000Z
2021-05-18T01:11:58.000Z
CREATE DATABASE hipyelp; CREATE USER hipyelpuser WITH PASSWORD 'hipyelp'; GRANT ALL PRIVILEGES ON DATABASE tunr TO hipyelpuser;
42.333333
53
0.834646
9c2ef3472cd10134a2cae879059c6ae9a508b516
1,044
js
JavaScript
src/utils/tokenGuide.js
FahimFBA/a-tree
1802510bdc538551f244e21f50cd27c1cdebf05f
[ "MIT" ]
56
2021-11-26T14:43:08.000Z
2022-02-25T07:47:02.000Z
src/utils/tokenGuide.js
FahimFBA/a-tree
1802510bdc538551f244e21f50cd27c1cdebf05f
[ "MIT" ]
3
2021-09-16T18:03:50.000Z
2021-12-04T03:55:57.000Z
src/utils/tokenGuide.js
FahimFBA/a-tree
1802510bdc538551f244e21f50cd27c1cdebf05f
[ "MIT" ]
4
2021-11-26T15:46:49.000Z
2022-03-17T07:30:44.000Z
import { TOKEN_VALUE_TTL, TOKEN_GUIDE_LOCAL_STORAGE_KEY, NEW_TOKEN_PATHNAME, PHASE, } from 'constants/tokenPage' import { toSafeInteger, values } from 'lodash' export const storePhase = (phase = 0, prevUrl) => { if (phase === PHASE.NONE || !values(PHASE).includes(phase)) { localStorage.removeItem(TOKEN_GUIDE_LOCAL_STORAGE_KEY) } else { const value = { phase, timestamp: new Date().getTime(), prevUrl } localStorage.setItem(TOKEN_GUIDE_LOCAL_STORAGE_KEY, JSON.stringify(value)) } } export const getCurrentPhase = () => { try { const { phase, timestamp, prevUrl } = JSON.parse( localStorage.getItem(TOKEN_GUIDE_LOCAL_STORAGE_KEY) ) if (new Date().getTime() - toSafeInteger(timestamp) > TOKEN_VALUE_TTL) { throw new Error('Timeout') } return { phase: toSafeInteger(phase), prevUrl } } catch { storePhase() return { phase: 0 } } } export const startTokenGuide = () => { storePhase(PHASE.START_TOUR, window.location.href) window.location.href = NEW_TOKEN_PATHNAME }
26.769231
78
0.692529
74534bbcb0e8c31086194cffafa61bad23096aea
1,064
h
C
include/typedef.h
JerryBluesnow/pmediacodes
228c441169fb9d86ec06c0db847bec60b3163c13
[ "MIT" ]
null
null
null
include/typedef.h
JerryBluesnow/pmediacodes
228c441169fb9d86ec06c0db847bec60b3163c13
[ "MIT" ]
null
null
null
include/typedef.h
JerryBluesnow/pmediacodes
228c441169fb9d86ec06c0db847bec60b3163c13
[ "MIT" ]
null
null
null
#include "sysconfig.h" #ifdef VER_G729A_ARM /* ITU-T G.729A Speech Coder ANSI-C Source Code Version 1.1 Last modified: September 1996 Copyright (c) 1996, AT&T, France Telecom, NTT, Universite de Sherbrooke All rights reserved. */ /* WARNING: Make sure that the proper flags are defined for your system */ /* Types definitions */ #ifndef TYPEDEF_G729_ARM_H_ #define TYPEDEF_G729_ARM_H_ #if defined(__BORLANDC__) || defined (__WATCOMC__) || defined(_MSC_VER) || defined(__ZTC__) || defined(__HIGHC__) || defined(_TURBOC_) typedef long int Word32 ; typedef short int Word16 ; typedef short int Flag ; #elif defined( __sun) typedef short Word16; typedef long Word32; typedef int Flag; #elif defined(__unix__) || defined(__unix) typedef short Word16; typedef int Word32; typedef int Flag; #elif defined(VMS) || defined(__VMS) typedef short Word16; typedef long Word32; typedef int Flag; #else #error COMPILER NOT TESTED typedef.h needs to be updated, see readme #endif #endif /* TYPEDEF_G729_ARM_H_ */ #endif
23.644444
134
0.723684
387656a4251d6c8e104239a997720e318dd59633
4,359
swift
Swift
Sources/BitcoinKit/Messages/VersionMessage.swift
asobicoin/BitcoinKit
adf36d6225d6e7f155222e98368e8a7cfe04b6da
[ "MIT" ]
465
2018-02-05T06:36:23.000Z
2018-08-08T08:06:23.000Z
Sources/BitcoinKit/Messages/VersionMessage.swift
asobicoin/BitcoinKit
adf36d6225d6e7f155222e98368e8a7cfe04b6da
[ "MIT" ]
233
2018-07-28T11:05:55.000Z
2018-08-28T04:29:49.000Z
Sources/BitcoinKit/Messages/VersionMessage.swift
asobicoin/BitcoinKit
adf36d6225d6e7f155222e98368e8a7cfe04b6da
[ "MIT" ]
171
2018-08-15T20:35:45.000Z
2022-03-28T14:45:24.000Z
// // VersionMessage.swift // // Copyright © 2018 Kishikawa Katsumi // Copyright © 2018 BitcoinKit developers // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in 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: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // 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 // AUTHORS 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 IN // THE SOFTWARE. // import Foundation /// When a node creates an outgoing connection, it will immediately advertise its version. /// The remote node will respond with its version. No further communication is possible until both peers have exchanged their version. public struct VersionMessage { /// Identifies protocol version being used by the node public let version: Int32 /// bitfield of features to be enabled for this connection public let services: UInt64 /// standard UNIX timestamp in seconds public let timestamp: Int64 // The network address of the node receiving this message public let yourAddress: NetworkAddress /* Fields below require version ≥ 106 */ /// The network address of the node emitting this message public let myAddress: NetworkAddress? /// Node random nonce, randomly generated every time a version packet is sent. This nonce is used to detect connections to self. public let nonce: UInt64? /// User Agent (0x00 if string is 0 bytes long) public let userAgent: VarString? // The last block received by the emitting node public let startHeight: Int32? /* Fields below require version ≥ 70001 */ /// Whether the remote peer should announce relayed transactions or not, see BIP 0037 public let relay: Bool? public func serialized() -> Data { var data = Data() data += version.littleEndian data += services.littleEndian data += timestamp.littleEndian data += yourAddress.serialized() data += myAddress?.serialized() ?? Data(count: 26) data += nonce?.littleEndian ?? UInt64(0) data += userAgent?.serialized() ?? Data([UInt8(0x00)]) data += startHeight?.littleEndian ?? Int32(0) data += relay ?? false return data } public static func deserialize(_ data: Data) -> VersionMessage { let byteStream = ByteStream(data) let version = byteStream.read(Int32.self) let services = byteStream.read(UInt64.self) let timestamp = byteStream.read(Int64.self) let yourAddress = NetworkAddress.deserialize(byteStream) guard byteStream.availableBytes > 0 else { return VersionMessage(version: version, services: services, timestamp: timestamp, yourAddress: yourAddress, myAddress: nil, nonce: nil, userAgent: nil, startHeight: nil, relay: nil) } let myAddress = NetworkAddress.deserialize(byteStream) let nonce = byteStream.read(UInt64.self) let userAgent = byteStream.read(VarString.self) let startHeight = byteStream.read(Int32.self) guard byteStream.availableBytes > 0 else { return VersionMessage(version: version, services: services, timestamp: timestamp, yourAddress: yourAddress, myAddress: myAddress, nonce: nonce, userAgent: userAgent, startHeight: startHeight, relay: nil) } let relay = byteStream.read(Bool.self) return VersionMessage(version: version, services: services, timestamp: timestamp, yourAddress: yourAddress, myAddress: myAddress, nonce: nonce, userAgent: userAgent, startHeight: startHeight, relay: relay) } }
49.534091
215
0.712778
40f475cb2a4ddce7ea7ca5bcc9f61f8a5c5a882b
3,568
py
Python
RecoTauTag/RecoTau/python/RecoTauPiZeroBuilderPlugins_cfi.py
ahmad3213/cmssw
750b64a3cb184f702939fdafa241214c77e7f4fd
[ "Apache-2.0" ]
null
null
null
RecoTauTag/RecoTau/python/RecoTauPiZeroBuilderPlugins_cfi.py
ahmad3213/cmssw
750b64a3cb184f702939fdafa241214c77e7f4fd
[ "Apache-2.0" ]
null
null
null
RecoTauTag/RecoTau/python/RecoTauPiZeroBuilderPlugins_cfi.py
ahmad3213/cmssw
750b64a3cb184f702939fdafa241214c77e7f4fd
[ "Apache-2.0" ]
1
2019-04-03T19:23:27.000Z
2019-04-03T19:23:27.000Z
import FWCore.ParameterSet.Config as cms ''' Configuration for Pi Zero producer plugins. Author: Evan K. Friis, UC Davis ''' from RecoTauTag.RecoTau.PFRecoTauQualityCuts_cfi import PFTauQualityCuts # Produce a PiZero candidate for each photon - the "trivial" case allSinglePhotons = cms.PSet( name = cms.string("1"), plugin = cms.string("RecoTauPiZeroTrivialPlugin"), qualityCuts = PFTauQualityCuts, ) # Produce a PiZero candidate for each possible photon pair combinatoricPhotonPairs = cms.PSet( name = cms.string("2"), plugin = cms.string("RecoTauPiZeroCombinatoricPlugin"), qualityCuts = PFTauQualityCuts, # Determine the maximum number of PiZeros to use. -1 for all maxInputGammas = cms.uint32(10), # Mass constraints taken care of during cleaning. minMass = cms.double(0.0), maxMass = cms.double(-1.0), choose = cms.uint32(2), ) # Produce a "strips" of photons strips = cms.PSet( name = cms.string("s"), plugin = cms.string("RecoTauPiZeroStripPlugin"), qualityCuts = PFTauQualityCuts, # Clusterize photons and electrons (PF numbering) stripCandidatesParticleIds = cms.vint32(2, 4), stripEtaAssociationDistance = cms.double(0.05), stripPhiAssociationDistance = cms.double(0.2), makeCombinatoricStrips = cms.bool(False) ) comboStrips = cms.PSet( name = cms.string("cs"), plugin = cms.string("RecoTauPiZeroStripPlugin"), qualityCuts = PFTauQualityCuts, # Clusterize photons and electrons (PF numbering) stripCandidatesParticleIds = cms.vint32(2, 4), stripEtaAssociationDistance = cms.double(0.05), stripPhiAssociationDistance = cms.double(0.2), makeCombinatoricStrips = cms.bool(True), maxInputStrips = cms.int32(5), stripMassWhenCombining = cms.double(0.0), # assume photon like ) # Produce a "strips" of photons # with no track quality cuts applied to PFElectrons modStrips = strips.clone( plugin = cms.string('RecoTauPiZeroStripPlugin2'), applyElecTrackQcuts = cms.bool(False), minGammaEtStripSeed = cms.double(1.0), minGammaEtStripAdd = cms.double(1.0), minStripEt = cms.double(1.0), updateStripAfterEachDaughter = cms.bool(False), maxStripBuildIterations = cms.int32(-1), verbosity = cms.int32(0) ) # Produce a "strips" of photons # with no track quality cuts applied to PFElectrons # and eta x phi size of strip increasing for low pT photons modStrips2 = cms.PSet( name = cms.string("s"), plugin = cms.string('RecoTauPiZeroStripPlugin3'), applyElecTrackQcuts = cms.bool(False), # Clusterize photons and electrons (PF numbering) stripCandidatesParticleIds = cms.vint32(2, 4), stripEtaAssociationDistanceFunc = cms.PSet( function = cms.string("TMath::Min(0.15, TMath::Max(0.05, [0]*TMath::Power(pT, -[1])))"), par0 = cms.double(1.97077e-01), par1 = cms.double(6.58701e-01) ), stripPhiAssociationDistanceFunc = cms.PSet( function = cms.string("TMath::Min(0.3, TMath::Max(0.05, [0]*TMath::Power(pT, -[1])))"), par0 = cms.double(3.52476e-01), par1 = cms.double(7.07716e-01) ), makeCombinatoricStrips = cms.bool(False), minGammaEtStripSeed = cms.double(1.0), minGammaEtStripAdd = cms.double(1.0), minStripEt = cms.double(1.0), # CV: parametrization of strip size in eta and phi determined by Yuta Takahashi, # chosen to contain 95% of photons from tau decays updateStripAfterEachDaughter = cms.bool(False), maxStripBuildIterations = cms.int32(-1), verbosity = cms.int32(0) )
35.326733
96
0.700392
a16bbda013dba5c5463350779b2a73566196735e
661
c
C
LAB1/p2.c
sahusourav/CNS-LAB
58d2dbc7df1801d0ec191bdcef99ad6397aeed84
[ "MIT" ]
null
null
null
LAB1/p2.c
sahusourav/CNS-LAB
58d2dbc7df1801d0ec191bdcef99ad6397aeed84
[ "MIT" ]
null
null
null
LAB1/p2.c
sahusourav/CNS-LAB
58d2dbc7df1801d0ec191bdcef99ad6397aeed84
[ "MIT" ]
null
null
null
// wap that contains a string(char pointer) with a value "Hello World". The program should AND, OR and XOR each character in this // string with 127 and display the result #include<stdio.h> int main() { char str[16]= "Hello World", temp; int i = 0; printf("Exclusive OR with 127:\n"); for(i = 0; str[i] != '\0'; i++) { temp = str[i] ^ 127; printf("%c", temp); } printf("\n"); printf("OR with 127:\n"); for(i = 0; str[i] != '\0'; i++) { temp = str[i] | 127; printf("%c", temp); } printf("\n"); printf("AND with 127:\n"); for(i = 0; str[i] != '\0'; i++) { temp = str[i] & 127; printf("%c", temp); } printf("\n"); return 0; }
17.864865
130
0.550681
0bd558bea9837b0307fd79c21bc7b99f3bca6161
81
swift
Swift
Sources/_URLRouting/RoutingError.swift
FilinCode/swift-parsing
54fb34bd55166f3a74ce2d22ba9b67e71559c852
[ "MIT" ]
null
null
null
Sources/_URLRouting/RoutingError.swift
FilinCode/swift-parsing
54fb34bd55166f3a74ce2d22ba9b67e71559c852
[ "MIT" ]
null
null
null
Sources/_URLRouting/RoutingError.swift
FilinCode/swift-parsing
54fb34bd55166f3a74ce2d22ba9b67e71559c852
[ "MIT" ]
null
null
null
@usableFromInline struct RoutingError: Error { @usableFromInline init() {} }
13.5
28
0.728395
6aadb1837839e367a4293c1738d14e787cb69fe0
398
lua
Lua
src/measures/set.lua
g8tr1522/AlgoRhythms
b3d959a18de1631de77a35306fd5ddd238e8368a
[ "MIT" ]
null
null
null
src/measures/set.lua
g8tr1522/AlgoRhythms
b3d959a18de1631de77a35306fd5ddd238e8368a
[ "MIT" ]
null
null
null
src/measures/set.lua
g8tr1522/AlgoRhythms
b3d959a18de1631de77a35306fd5ddd238e8368a
[ "MIT" ]
null
null
null
-- set the `rhythm` which also sets the `converted` property --local convert = require('src/measures/convert') --print("convert method location: ", tostring(AlgoRhythms.measures.convert)) return function (self, t) local pre_offset = AlgoRhythms.globals.PROGRAMMERS_NOTATION_OFFSET for i=1,#t do t[i] = t[i] - pre_offset end self.rhythm = t self:convert(t) self:convert_mantissa() end
23.411765
76
0.733668
f076212c69c217204a0f335bc5923354550eed68
671
py
Python
tutorials/W0D1_PythonWorkshop1/solutions/W0D1_Tutorial1_Solution_93456241.py
eduardojdiniz/CompNeuro
20269e66540dc4e802273735c97323020ee37406
[ "CC-BY-4.0", "BSD-3-Clause" ]
2,294
2020-05-11T12:05:35.000Z
2022-03-28T21:23:34.000Z
tutorials/W0D1_PythonWorkshop1/solutions/W0D1_Tutorial1_Solution_93456241.py
pellet/course-content
bb383857992469e0e7a9c36639ac0d05e842d9bd
[ "CC-BY-4.0", "BSD-3-Clause" ]
629
2020-05-11T15:42:26.000Z
2022-03-29T12:23:35.000Z
tutorials/W0D1_PythonWorkshop1/solutions/W0D1_Tutorial1_Solution_93456241.py
pellet/course-content
bb383857992469e0e7a9c36639ac0d05e842d9bd
[ "CC-BY-4.0", "BSD-3-Clause" ]
917
2020-05-11T12:47:53.000Z
2022-03-31T12:14:41.000Z
# Set random number generator np.random.seed(2020) # Initialize step_end, n, t_range, v and i step_end = int(t_max / dt) n = 50 t_range = np.linspace(0, t_max, num=step_end) v_n = el * np.ones([n, step_end]) i = i_mean * (1 + 0.1 * (t_max / dt)**(0.5) * (2 * np.random.random([n, step_end]) - 1)) # Loop for step_end - 1 steps for step in range(1, step_end): # Compute v_n v_n[:, step] = v_n[:, step - 1] + (dt / tau) * (el - v_n[:, step - 1] + r * i[:, step]) # Plot figure with plt.xkcd(): plt.figure() plt.title('Multiple realizations of $V_m$') plt.xlabel('time (s)') plt.ylabel('$V_m$ (V)') plt.plot(t_range, v_n.T, 'k', alpha=0.3) plt.show()
25.807692
90
0.600596
8760f26b306d418b65900e2e90fcd6104ed436b3
14,456
html
HTML
_site/2014/09/07/bible-passages/index.html
kakubei/kakubei.github.io
3213abd3e5d6ed9efb499dfefb0f2eceea5a205e
[ "MIT" ]
null
null
null
_site/2014/09/07/bible-passages/index.html
kakubei/kakubei.github.io
3213abd3e5d6ed9efb499dfefb0f2eceea5a205e
[ "MIT" ]
null
null
null
_site/2014/09/07/bible-passages/index.html
kakubei/kakubei.github.io
3213abd3e5d6ed9efb499dfefb0f2eceea5a205e
[ "MIT" ]
null
null
null
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us"> <head> <link href="http://gmpg.org/xfn/11" rel="profile"> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <!-- Enable responsiveness on mobile devices--> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> <title> Bible passages explained in modern language &middot; Kakuweb Blog </title> <!-- This is a header with the pages_list array declared in config.yml --> <!-- <h3 class="masthead-title"> <a href="/" title="Home">Kakuweb Blog</a> </h3> --> <!-- CSS --> <link rel="stylesheet" href="/public/css/poole.css"> <link rel="stylesheet" href="/public/css/syntax.css"> <link rel="stylesheet" href="/public/css/lanyon.css"> <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Serif:400,400italic,700|PT+Sans:400"> <!-- Icons --> <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/public/apple-touch-icon-144-precomposed.png"> <link rel="shortcut icon" href="/public/favicon.ico"> <!-- RSS --> <link rel="alternate" type="application/rss+xml" title="RSS" href="/atom.xml"> </head> <body class="theme-base-08 layout-reverse"> <!-- Target for toggling the sidebar `.sidebar-checkbox` is for regular styles, `#sidebar-checkbox` for behavior. --> <input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox"> <!-- Toggleable sidebar --> <div class="sidebar" id="sidebar"> <div class="sidebar-item"> <p>Hodgepodge bunch of stuff, mostly related to programming but really anything I feel like ranting about.</p> </div> <nav class="sidebar-nav"> <a class="sidebar-nav-item" href="/">Home</a> <a class="sidebar-nav-item" href="/about/">About</a> <a class="sidebar-nav-item" href="/archive/">Posts</a> <a class="sidebar-nav-item" href="/novel/">My Novel</a> <!-- listing the latest 10 entries --> <section> <span class="sidebar-nav-item">Recent Posts</span> <ul> <li> <a href="/2017/01/19/buying-a-new-videogame/">The sure-fire way to buy a new video game</a> </li> <li> <a href="/2017/01/15/back-to-work/">Back to work</a> </li> <li> <a href="/2017/01/14/move-to-london/">So you want to move to London</a> </li> <li> <a href="/2016/02/24/Tap-Gesture-and-TableView/">Using a Tap Gesture That Doesn't Interfere with a TableView in iOS</a> </li> <li> <a href="/2016/02/24/Close-iOS-Keyboard/">Best Way to Close the iOS Keyboard</a> </li> <li> <a href="/2016/02/05/Apple-Music-HipHop/">Apple Radio = The HipHop Channel</a> </li> <li> <a href="/2016/02/04/Bicycle-Wheel-Sizes/">Bicycle Wheel Sizes</a> </li> <li> <a href="/2015/08/19/Swift-is-cool/">Swift is Actually Cool!</a> </li> <li> <a href="/2015/08/19/Apple-Watch-is-a-gimmick/">The Apple Watch is a Gimmick</a> </li> <li> <a href="/2015/06/05/Irony-of-To-Do-Apps/">The Irony of To Do Apps</a> </li> </ul> </section> <span class="sidebar-nav-item">Currently v0.7</span> </nav> <div class="sidebar-item"> <p> &copy; 2017. All rights reserved. </p> </div> </div> <!-- Wrap is the content to shift when toggling the sidebar. We wrap the content to avoid any CSS collisions with our real content. --> <div class="wrap"> <div class="masthead"> <div class="container"> <h3 class="masthead-title"> <a href="/" title="Home">Kakuweb Blog</a> <small>Rants and raves. Some interesting stuff, most of it not.</small> </h3> </div> </div> <div class="container content"> <div class="post"> <h1 class="post-title">Bible passages explained in modern language</h1> <span class="post-date">07 Sep 2014</span> <p>I’m not bashing Christianity or any other religion, believe in whatever you want, it’s your choice, you’re free to choose. I for, example, believe that my dog is my god. Think about it, we feed them, groom them, pamper them, take them for a walk, pick up their shit! Something I wouldn’t do even for my own kids, cater to their every need, stroke them, brush them, do anything for them, unconditionally. If that’s not the description of a god then I don’t know what is. I know a lot of fervent Christians that are more devout to their dogs than to their god.</p> <p>This is just me having a little fun. Try not to be offended.</p> <p>Here is a very good article about <a href="http://www.patheos.com/blogs/friendlyatheist/2014/08/26/40-problems-with-christianity/">things that might be “wrong” with Christianity</a></p> <p>I’ve taken the bible passages from this article for convenience sakes, but really it could apply to any part of the bible.</p> <p>Why hasn’t the bible been updated? Because it’s the word of God I hear you say, but, surely, if it were translated into a bit more modern speak more people would understand it, isn’t that the whole point?</p> <p>Anyway, here are a couple of bible passages translated to modern speak.</p> <blockquote> <p>The Son of Man will send out his angels, and they will weed out of his kingdom everything that causes sin and all who do evil. They will throw them into the blazing furnace, where there will be weeping and gnashing of teeth.</p> </blockquote> <p>Translation: Jesus will get pissed and send some badass dudes to kick ass, every asshole is gonna get whacked. They’ll burn, and there will be a lot of bitching.</p> <blockquote> <p>But I tell you that anyone who looks at a woman lustfully has already committed adultery with her in his heart. If your right eye causes you to stumble, gouge it out and throw it away. It is better for you to lose one part of your body than for your whole body to be thrown into hell.</p> </blockquote> <p>Translation: basically, you’re all fucked. Just thinking about a woman means you committed adultery, which is a capital sin, you’re going straight to hell. Ladies, you think you’re safe? Think again, jealousy is also a big no-no, straight to hell with you too. Just don’t chop off your body parts, it’s not meant to be taken literally, it means try not to be such a pervert.</p> <blockquote> <p>Now go, attack the Amalekites and totally destroy all that belongs to them. Do not spare them; put to death men and women, children and infants, cattle and sheep, camels and donkeys.</p> </blockquote> <p>Translation: these mother fuckers pissed me off good. Wipe them off the face of the earth, that’s right, I’m telling you to commit sanctioned genocide. Oh, and make sure you kill the women, children and even their fucking pets! Did I mention they pissed me off?</p> <blockquote> <p>“Truly I tell you, some who are standing here will not taste death before they see the Son of Man coming in his kingdom.”</p> </blockquote> <p>Translation: I’ll be right back. (Voy a lleva a la jeba y vengo).</p> <blockquote> <p>For the Lord Himself will descend from heaven with a shout, with the voice of the archangel, and with the trumpet of God; and the dead in Christ shall rise first. Then we who are alive and remain shall be caught up together with them in the clouds to meet the Lord in the air, and thus we shall always be with the Lord.</p> </blockquote> <p>Translation: God is coming down to play a gig; it’s going to be filled with fucking zombies! People will fly.</p> <blockquote> <p>If someone slaps you on one cheek, turn to them the other also. If someone takes your coat, do not withhold your shirt from them. Give to everyone who asks you, and if anyone takes what belongs to you, do not demand it back.</p> </blockquote> <p>Translation: move to a hippie commune. If you can’t find one, move to a communist country.</p> <blockquote> <p>But I tell you that anyone who divorces his wife, except for sexual immorality, makes her the victim of adultery, and anyone who marries a divorced woman commits adultery.</p> </blockquote> <p>Translation: don’t get married! You’ll inevitably commit adultery.</p> <blockquote> <p>Do not store up for yourselves treasures on earth, where moths and vermin destroy, and where thieves break in and steal.</p> </blockquote> <p>Translation: get a good Swiss bank account where people can’t steal your shit.</p> <blockquote> <p>Women should remain silent in the churches. They are not allowed to speak, but must be in submission, as the law says.</p> </blockquote> <p>Translation: take your wife to church often, it’s the only peace and quiet you’ll ever get!</p> <blockquote> <p>Then Jesus said to his host, “When you give a luncheon or dinner, do not invite your friends, your brothers or sisters, your relatives, or your rich neighbors; if you do, they may invite you back and so you will be repaid. But when you give a banquet, invite the poor, the crippled, the lame, the blind, and you will be blessed. Although they cannot repay you, you will be repaid at the resurrection of the righteous.”</p> </blockquote> <p>Translation: your friends suck. You’re better off with a bunch of strangers.</p> <blockquote> <p>Anyone who beats their male or female slave with a rod must be punished if the slave dies as a direct result, but they are not to be punished if the slave recovers after a day or two, since the slave is their property.</p> </blockquote> <p>Translation: beat your lazy-ass slaves within an inch if their lives to avoid getting punished.</p> <blockquote> <p>Your male and female slaves are to come from the nations around you; from them you may buy slaves. You may also buy some of the temporary residents living among you and members of their clans born in your country, and they will become your property. You can bequeath them to your children as inherited property and can make them slaves for life, but you must not rule over your fellow Israelites ruthlessly.</p> </blockquote> <p>Translation: buy your slaves from your neighbor, you’ll get better quality. Jewish slaves are the worst.</p> <blockquote> <p>For man did not come from woman, but woman from man; neither was man created for woman, but woman for man.</p> </blockquote> <p>Translation: women were put on this earth to serve you, make sure they know that.</p> <p>I could go on and on, but I’m out of time. Hope you had a laugh.</p> </div> <img src="/images/twitter_logo_blue.png" alt="Twitter" style="width: 30px; float: left; margin-right: 10px;"> <a href="https://twitter.com/intent/tweet?url=http://localhost:4000/2014/09/07/bible-passages/&text=Bible passages explained in modern language&via=kakubei" target="_blank">Share this post </a>if you want, or <a href="https://twitter.com/kakubei"> follow me on Twitter</a> if you're into that stuff. <div class="comments"> <div id="disqus_thread"></div> <script type="text/javascript"> /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ var disqus_shortname = 'noirnovel'; // required: replace example with your forum shortname /* * * DON'T EDIT BELOW THIS LINE * * */ (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); </script> <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a> </div> <div class="related"> <h2>Related Posts</h2> <ul class="related-posts"> <li> <h3> <a href="/2017/01/19/buying-a-new-videogame/"> The sure-fire way to buy a new video game <small>19 Jan 2017</small> </a> </h3> </li> <li> <h3> <a href="/2017/01/15/back-to-work/"> Back to work <small>15 Jan 2017</small> </a> </h3> </li> <li> <h3> <a href="/2017/01/14/move-to-london/"> So you want to move to London <small>14 Jan 2017</small> </a> </h3> </li> </ul> </div> </div> </div> <label for="sidebar-checkbox" class="sidebar-toggle"></label> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-50242492-1', 'kakubei.github.io'); ga('require', 'displayfeatures'); ga('send', 'pageview'); </script> </body> </html>
31.021459
567
0.613102
079babb20fa51e297241cfcfd632808569582160
55
sql
SQL
_/6747_10_Code/Create_SPFILE.sql
paullewallencom/oracle-978-1-8496-8674-7
72e16e777496bb0699973e7bf912d688e62bbfa9
[ "Apache-2.0" ]
null
null
null
_/6747_10_Code/Create_SPFILE.sql
paullewallencom/oracle-978-1-8496-8674-7
72e16e777496bb0699973e7bf912d688e62bbfa9
[ "Apache-2.0" ]
null
null
null
_/6747_10_Code/Create_SPFILE.sql
paullewallencom/oracle-978-1-8496-8674-7
72e16e777496bb0699973e7bf912d688e62bbfa9
[ "Apache-2.0" ]
null
null
null
-- Create SPFILE CREATE spfile FROM pfile='c:\xe.ora';
27.5
37
0.709091
5f0ee0ea639f07ba574ddf44b4cede667b1d8288
5,633
kt
Kotlin
src/main/java/no/nav/fo/veilarbregistrering/db/arbeidssoker/ArbeidssokerRepositoryImpl.kt
blommish/veilarbregistrering
03db1aa9054e3401ebbc3d878180a34227761af8
[ "MIT" ]
5
2019-07-16T13:00:12.000Z
2020-11-11T14:31:40.000Z
src/main/java/no/nav/fo/veilarbregistrering/db/arbeidssoker/ArbeidssokerRepositoryImpl.kt
blommish/veilarbregistrering
03db1aa9054e3401ebbc3d878180a34227761af8
[ "MIT" ]
44
2018-12-11T07:38:38.000Z
2022-03-30T06:37:28.000Z
src/main/java/no/nav/fo/veilarbregistrering/db/arbeidssoker/ArbeidssokerRepositoryImpl.kt
blommish/veilarbregistrering
03db1aa9054e3401ebbc3d878180a34227761af8
[ "MIT" ]
5
2020-03-17T09:32:33.000Z
2021-12-02T14:07:44.000Z
package no.nav.fo.veilarbregistrering.db.arbeidssoker import no.nav.fo.veilarbregistrering.arbeidssoker.ArbeidssokerRepository import no.nav.fo.veilarbregistrering.arbeidssoker.Arbeidssokerperioder import no.nav.fo.veilarbregistrering.arbeidssoker.EndretFormidlingsgruppeCommand import no.nav.fo.veilarbregistrering.arbeidssoker.Formidlingsgruppe import no.nav.fo.veilarbregistrering.bruker.Foedselsnummer import org.slf4j.LoggerFactory import org.springframework.dao.DataIntegrityViolationException import org.springframework.jdbc.core.RowMapper import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate import java.sql.Timestamp import java.time.LocalDateTime class ArbeidssokerRepositoryImpl(private val db: NamedParameterJdbcTemplate) : ArbeidssokerRepository { override fun lagre(command: EndretFormidlingsgruppeCommand): Long { val personId = command.personId val fnr = command.foedselsnummer?.stringValue() ?: throw IllegalStateException("Foedselsnummer var ikke satt. Skulle vært filtrert bort i forkant!") val formidlingsgruppe = command.formidlingsgruppe.stringValue() val formidlingsgruppeEndret = Timestamp.valueOf(command.formidlingsgruppeEndret) if (erAlleredePersistentLagret(personId, formidlingsgruppe, formidlingsgruppeEndret)) { LOG.info("Endringen er allerede lagret, denne forkastes. PersonID:" + " $personId, Formidlingsgruppe: $formidlingsgruppe, Endret: $formidlingsgruppeEndret" ) return -1 } val id = nesteFraSekvens() val params = mapOf( "id" to id, "fnr" to fnr, "person_id" to personId, "person_id_status" to command.personIdStatus, "operasjon" to command.operation.name, "formidlingsgruppe" to formidlingsgruppe, "formidlingsgruppe_endret" to formidlingsgruppeEndret, "forrige_formidlingsgruppe" to command.forrigeFormidlingsgruppe?.let(Formidlingsgruppe::stringValue), "forrige_formidlingsgruppe_endret" to command.forrigeFormidlingsgruppeEndret?.let(Timestamp::valueOf), "formidlingsgruppe_lest" to Timestamp.valueOf(LocalDateTime.now()) ) val sql = "INSERT INTO $FORMIDLINGSGRUPPE ($ID, $FOEDSELSNUMMER, $PERSON_ID, $PERSON_ID_STATUS, $OPERASJON," + " $FORMIDLINGSGRUPPE, $FORMIDLINGSGRUPPE_ENDRET, $FORR_FORMIDLINGSGRUPPE," + " $FORR_FORMIDLINGSGRUPPE_ENDRET, $FORMIDLINGSGRUPPE_LEST)" + " VALUES (:id, :fnr, :person_id, :person_id_status, :operasjon, :formidlingsgruppe, " + " :formidlingsgruppe_endret, :forrige_formidlingsgruppe, :forrige_formidlingsgruppe_endret," + " :formidlingsgruppe_lest)" try { db.update(sql, params) } catch (e: DataIntegrityViolationException) { throw DataIntegrityViolationException("Lagring av følgende formidlingsgruppeendring feilet: $command", e) } return id } private fun erAlleredePersistentLagret(personID: String, formidlingsgruppe: String, endret: Timestamp): Boolean { val params = mapOf("person_id" to personID, "formidlingsgruppe" to formidlingsgruppe, "endret" to endret) val sql = "SELECT * FROM $FORMIDLINGSGRUPPE " + " WHERE $PERSON_ID = :person_id " + " AND $FORMIDLINGSGRUPPE = :formidlingsgruppe " + " AND $FORMIDLINGSGRUPPE_ENDRET = :endret" val formidlingsgruppeendringer = db.query(sql, params, fgruppeMapper) return formidlingsgruppeendringer.isNotEmpty() } private fun nesteFraSekvens(): Long { return db.queryForObject("SELECT $FORMIDLINGSGRUPPE_SEQ.nextval FROM DUAL", emptyMap<String, Any>(), Long::class.java)!! } override fun finnFormidlingsgrupper(foedselsnummerList: List<Foedselsnummer>): Arbeidssokerperioder { val sql = "SELECT * FROM $FORMIDLINGSGRUPPE WHERE $FOEDSELSNUMMER IN (:foedselsnummer)" val parameters = mapOf("foedselsnummer" to foedselsnummerList.map(Foedselsnummer::stringValue)) val formidlingsgruppeendringer = db.query(sql, parameters, fgruppeMapper) LOG.info( String.format( "Fant følgende rådata med formidlingsgruppeendringer: %s", formidlingsgruppeendringer.toString() ) ) return ArbeidssokerperioderMapper.map(formidlingsgruppeendringer) } companion object { private val LOG = LoggerFactory.getLogger(ArbeidssokerRepositoryImpl::class.java) const val FORMIDLINGSGRUPPE_SEQ = "FORMIDLINGSGRUPPE_SEQ" const val FORMIDLINGSGRUPPE = "FORMIDLINGSGRUPPE" const val ID = "ID" const val FOEDSELSNUMMER = "FOEDSELSNUMMER" const val PERSON_ID = "PERSON_ID" const val PERSON_ID_STATUS = "PERSON_ID_STATUS" const val OPERASJON = "OPERASJON" private const val FORMIDLINGSGRUPPE_ENDRET = "FORMIDLINGSGRUPPE_ENDRET" private const val FORR_FORMIDLINGSGRUPPE = "FORR_FORMIDLINGSGRUPPE" private const val FORR_FORMIDLINGSGRUPPE_ENDRET = "FORR_FORMIDLINGSGRUPPE_ENDRET" private const val FORMIDLINGSGRUPPE_LEST = "FORMIDLINGSGRUPPE_LEST" private val fgruppeMapper = RowMapper { rs, _ -> Formidlingsgruppeendring( rs.getString(FORMIDLINGSGRUPPE), rs.getInt(PERSON_ID), rs.getString(PERSON_ID_STATUS), rs.getTimestamp(FORMIDLINGSGRUPPE_ENDRET) ) } } }
49.849558
128
0.699095
23583306d59b7d17335395e0d8b1237e70140ea2
819
rs
Rust
src/constants.rs
vsilent/stackdog
7c25842b222e8af6557812f1c1bda9205eb8e214
[ "MIT" ]
1
2021-03-04T11:34:57.000Z
2021-03-04T11:34:57.000Z
src/constants.rs
vsilent/stackdog
7c25842b222e8af6557812f1c1bda9205eb8e214
[ "MIT" ]
16
2021-03-17T11:54:29.000Z
2022-03-28T07:05:35.000Z
src/constants.rs
vsilent/stackdog
7c25842b222e8af6557812f1c1bda9205eb8e214
[ "MIT" ]
2
2021-03-05T08:52:23.000Z
2021-12-02T09:37:25.000Z
// Messages pub const MESSAGE_OK: &str = "ok"; pub const MESSAGE_LOGIN_SUCCESS: &str = "Login successfully"; pub const MESSAGE_LOGIN_FAILED: &str = "Wrong username or password, please try again"; pub const MESSAGE_USER_NOT_FOUND: &str = "User not found"; pub const MESSAGE_LOGOUT_SUCCESS: &str = "Logout successfully"; pub const MESSAGE_PROCESS_TOKEN_ERROR: &str = "Error while processing token"; pub const MESSAGE_INVALID_TOKEN: &str = "Invalid token, please login again"; pub const MESSAGE_INTERNAL_SERVER_ERROR: &str = "Internal Server Error"; // Bad request messages pub const MESSAGE_TOKEN_MISSING: &str = "Token is missing"; // Headers pub const AUTHORIZATION: &str = "Authorization"; // Misc pub const EMPTY: &str = ""; // ignore routes pub const IGNORE_ROUTES: [&str; 2] = ["/api/ping", "/api/auth/login"];
37.227273
86
0.744811
b6684384e85b100ed99f5e5de7d54ac167d196f0
13,476
sql
SQL
minimvc.sql
emrahnalci/MediumMVC
b3d81996adb4bc0de12de60db594a976700ec2c6
[ "MIT" ]
null
null
null
minimvc.sql
emrahnalci/MediumMVC
b3d81996adb4bc0de12de60db594a976700ec2c6
[ "MIT" ]
null
null
null
minimvc.sql
emrahnalci/MediumMVC
b3d81996adb4bc0de12de60db594a976700ec2c6
[ "MIT" ]
null
null
null
-- phpMyAdmin SQL Dump -- version 4.2.11 -- http://www.phpmyadmin.net -- -- Anamakine: 127.0.0.1 -- Üretim Zamanı: 27 Ara 2015, 22:38:31 -- Sunucu sürümü: 5.6.21 -- PHP Sürümü: 5.6.3 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Veritabanı: `minimvc` -- -- -------------------------------------------------------- -- -- Tablo için tablo yapısı `category` -- CREATE TABLE IF NOT EXISTS `category` ( `ID` int(11) NOT NULL, `name` varchar(255) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; -- -- Tablo döküm verisi `category` -- INSERT INTO `category` (`ID`, `name`) VALUES (1, 'Menu Content'), (2, 'News'); -- -------------------------------------------------------- -- -- Tablo için tablo yapısı `content` -- CREATE TABLE IF NOT EXISTS `content` ( `ID` int(11) NOT NULL, `title` text CHARACTER SET utf8, `seo_title` text CHARACTER SET utf8, `seo_desc` text CHARACTER SET utf8, `seo_keywords` text CHARACTER SET utf8, `permalink` text CHARACTER SET utf8, `description` text CHARACTER SET utf8, `content` text CHARACTER SET utf8, `image` text CHARACTER SET utf8, `thumbnail` varchar(250) CHARACTER SET utf8 DEFAULT NULL, `categoryID` int(11) DEFAULT NULL, `lang` varchar(11) CHARACTER SET utf8 DEFAULT NULL, `create_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `publish_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `status` int(11) DEFAULT NULL ) ENGINE=MyISAM AUTO_INCREMENT=80 DEFAULT CHARSET=latin1; -- -- Tablo döküm verisi `content` -- INSERT INTO `content` (`ID`, `title`, `seo_title`, `seo_desc`, `seo_keywords`, `permalink`, `description`, `content`, `image`, `thumbnail`, `categoryID`, `lang`, `create_date`, `publish_date`, `status`) VALUES (1, 'Ulaşmaya çalıştığınız sayfa bulunamadı.', '404 - Sayfa Bulunamadı!', 'Sayfa Bulunamadı', '404, Sayfa Bulunamadı', '404', 'Lütfen ulaşmak istediğiniz sayfanın adresini doğru yazdığınızı kontrol edin.', '<p align="justify">Lütfen ulaşmak istediğiniz sayfanın adresini doğru yazdığınızı kontrol edin.</p>\r\n\r\n<p align="justify"> Eğer doğru adresi yazdığınıza eminseniz, ulaşmak istediğiniz sayfa silinmiş olabilir.</p>', '', '', 1, 'tr', '0000-00-00 00:00:00', '2015-09-24 21:39:43', 1), (2, 'Page not found.', '404 - Page not found.!', 'Page not found', '404, Page not found', '404', 'Page not found.', '<p align="justify">It looks like nothing was found at this location. Maybe try a search?</p><p align="justify">Refresh the page for a new one!</p>', '', '', 1, 'en', '0000-00-00 00:00:00', '2015-09-24 21:39:43', 1), (3, 'About Us', '', '', '', 'about-us', '', '<p><b>This content comes from database.</b></p> <div id="lipsum"> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sit amet dignissim ipsum. Duis luctus iaculis efficitur. Donec nisl mauris, consectetur quis massa nec, tempus dignissim justo. Proin at luctus nibh. Mauris massa lacus, tincidunt sit amet sapien auctor, tempor pulvinar dui. Maecenas aliquam tellus lectus, quis lobortis leo viverra id. Nulla cursus tincidunt odio, at ultrices mauris porta vel. Duis vitae dolor id metus rhoncus tempus. Nulla gravida lobortis nibh et vulputate. Phasellus eget tristique enim. </p> <p> Mauris tortor nunc, consequat sit amet lacus condimentum, pellentesque egestas nisi. Proin porta tristique nibh. Nam sollicitudin velit dui, sit amet convallis orci imperdiet quis. Nunc laoreet blandit rhoncus. In placerat turpis vel fermentum elementum. Curabitur sit amet malesuada arcu. Donec viverra elit non maximus faucibus. Quisque vehicula metus a viverra suscipit. Morbi enim diam, posuere vitae dapibus ut, convallis quis erat. Vestibulum non ipsum tortor. Cras fringilla risus volutpat lacinia congue. Maecenas dignissim diam orci, sit amet egestas lectus rhoncus quis. Praesent dignissim ante sit amet magna ultrices, eget varius ipsum placerat. Etiam sodales libero et euismod vehicula. </p> <p> Pellentesque pharetra quis quam eget volutpat. Donec interdum turpis urna, quis elementum augue porta dapibus. Vestibulum ut tristique est, sed lobortis dui. Maecenas imperdiet sapien vel sem volutpat feugiat. Quisque condimentum aliquet rutrum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent laoreet ut neque a elementum. Maecenas eget laoreet nisi. Donec finibus volutpat blandit. Aliquam feugiat velit at quam egestas cursus. Sed non erat ex. Praesent sagittis finibus fringilla. Praesent non arcu dapibus, lobortis erat vel, efficitur risus. Ut facilisis lobortis diam non pulvinar. Nunc sed tellus erat. </p> <p> Quisque tempus imperdiet imperdiet. In mollis bibendum sapien in volutpat. Vivamus vitae tristique felis. Mauris vehicula enim justo. Mauris posuere ultrices tortor, ac euismod neque imperdiet dignissim. Aliquam enim purus, feugiat vitae mollis et, lobortis vel felis. Aenean egestas nunc quis nisl porta laoreet. Ut malesuada auctor sem molestie vulputate. Maecenas lacus nulla, porta eget risus at, commodo sodales elit. Donec arcu metus, pellentesque vel suscipit in, fermentum at orci. Suspendisse justo erat, sodales nec egestas nec, porta et dolor. </p> <p> Nullam rutrum facilisis facilisis. Aliquam facilisis, urna sed sollicitudin posuere, augue nulla viverra dolor, vel vehicula justo est sit amet eros. Cras dui turpis, sollicitudin et porttitor mollis, volutpat non orci. Pellentesque erat elit, consectetur at luctus a, auctor eleifend velit. Praesent dapibus lacus vel tortor cursus mattis. Maecenas volutpat nibh a odio dapibus, a fermentum urna fringilla. Etiam bibendum viverra scelerisque. Maecenas varius urna sit amet elit faucibus tincidunt. Praesent blandit placerat nibh a dignissim. In augue eros, mattis sit amet interdum vel, blandit eu magna. Vestibulum eget dignissim velit. Nunc porta, eros eleifend eleifend iaculis, enim neque aliquam nisi, ac mattis mauris risus eget tellus. Nam hendrerit commodo neque et lacinia. Nulla vel dictum mauris, at dictum nisl. Aliquam erat volutpat. </p></div>', '', '', 1, 'en', '0000-00-00 00:00:00', '2015-09-24 21:39:43', 1), (4, 'Hakkımızda', '', '', '', 'hakkimizda', '', '<p><b>Bu içerik veritabanından gelmektedir.</b></p><div id="lipsum"> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sit amet dignissim ipsum. Duis luctus iaculis efficitur. Donec nisl mauris, consectetur quis massa nec, tempus dignissim justo. Proin at luctus nibh. Mauris massa lacus, tincidunt sit amet sapien auctor, tempor pulvinar dui. Maecenas aliquam tellus lectus, quis lobortis leo viverra id. Nulla cursus tincidunt odio, at ultrices mauris porta vel. Duis vitae dolor id metus rhoncus tempus. Nulla gravida lobortis nibh et vulputate. Phasellus eget tristique enim. </p> <p> Mauris tortor nunc, consequat sit amet lacus condimentum, pellentesque egestas nisi. Proin porta tristique nibh. Nam sollicitudin velit dui, sit amet convallis orci imperdiet quis. Nunc laoreet blandit rhoncus. In placerat turpis vel fermentum elementum. Curabitur sit amet malesuada arcu. Donec viverra elit non maximus faucibus. Quisque vehicula metus a viverra suscipit. Morbi enim diam, posuere vitae dapibus ut, convallis quis erat. Vestibulum non ipsum tortor. Cras fringilla risus volutpat lacinia congue. Maecenas dignissim diam orci, sit amet egestas lectus rhoncus quis. Praesent dignissim ante sit amet magna ultrices, eget varius ipsum placerat. Etiam sodales libero et euismod vehicula. </p> <p> Pellentesque pharetra quis quam eget volutpat. Donec interdum turpis urna, quis elementum augue porta dapibus. Vestibulum ut tristique est, sed lobortis dui. Maecenas imperdiet sapien vel sem volutpat feugiat. Quisque condimentum aliquet rutrum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent laoreet ut neque a elementum. Maecenas eget laoreet nisi. Donec finibus volutpat blandit. Aliquam feugiat velit at quam egestas cursus. Sed non erat ex. Praesent sagittis finibus fringilla. Praesent non arcu dapibus, lobortis erat vel, efficitur risus. Ut facilisis lobortis diam non pulvinar. Nunc sed tellus erat. </p> <p> Quisque tempus imperdiet imperdiet. In mollis bibendum sapien in volutpat. Vivamus vitae tristique felis. Mauris vehicula enim justo. Mauris posuere ultrices tortor, ac euismod neque imperdiet dignissim. Aliquam enim purus, feugiat vitae mollis et, lobortis vel felis. Aenean egestas nunc quis nisl porta laoreet. Ut malesuada auctor sem molestie vulputate. Maecenas lacus nulla, porta eget risus at, commodo sodales elit. Donec arcu metus, pellentesque vel suscipit in, fermentum at orci. Suspendisse justo erat, sodales nec egestas nec, porta et dolor. </p> <p> Nullam rutrum facilisis facilisis. Aliquam facilisis, urna sed sollicitudin posuere, augue nulla viverra dolor, vel vehicula justo est sit amet eros. Cras dui turpis, sollicitudin et porttitor mollis, volutpat non orci. Pellentesque erat elit, consectetur at luctus a, auctor eleifend velit. Praesent dapibus lacus vel tortor cursus mattis. Maecenas volutpat nibh a odio dapibus, a fermentum urna fringilla. Etiam bibendum viverra scelerisque. Maecenas varius urna sit amet elit faucibus tincidunt. Praesent blandit placerat nibh a dignissim. In augue eros, mattis sit amet interdum vel, blandit eu magna. Vestibulum eget dignissim velit. Nunc porta, eros eleifend eleifend iaculis, enim neque aliquam nisi, ac mattis mauris risus eget tellus. Nam hendrerit commodo neque et lacinia. Nulla vel dictum mauris, at dictum nisl. Aliquam erat volutpat. </p></div>', '', '', 1, 'tr', '0000-00-00 00:00:00', '2015-09-24 21:39:43', 1); -- -------------------------------------------------------- -- -- Tablo için tablo yapısı `menu` -- CREATE TABLE IF NOT EXISTS `menu` ( `ID` int(11) NOT NULL, `parent_id` int(11) NOT NULL DEFAULT '0', `type` int(11) NOT NULL, `content_id` int(11) NOT NULL DEFAULT '0', `text` text CHARACTER SET utf8 NOT NULL, `permalink` text CHARACTER SET utf8 NOT NULL, `lang` varchar(11) CHARACTER SET utf8 NOT NULL, `sort` int(11) NOT NULL ) ENGINE=MyISAM AUTO_INCREMENT=61 DEFAULT CHARSET=latin1; -- -- Tablo döküm verisi `menu` -- INSERT INTO `menu` (`ID`, `parent_id`, `type`, `content_id`, `text`, `permalink`, `lang`, `sort`) VALUES (1, 0, 1, 0, 'Hakkımızda', 'hakkimizda', 'tr', 2), (2, 0, 1, 0, 'About Us', 'about-us', 'en', 2), (3, 0, 1, 0, 'İletişim', 'iletisim', 'tr', 3), (4, 0, 1, 0, 'Contact', 'contact', 'en', 3), (5, 0, 1, 0, 'Ana Sayfa', '', 'tr', 1), (6, 0, 1, 0, 'Home', '', 'en', 1); -- -------------------------------------------------------- -- -- Tablo için tablo yapısı `options` -- CREATE TABLE IF NOT EXISTS `options` ( `ID` int(11) NOT NULL, `name` varchar(255) CHARACTER SET utf8 NOT NULL, `value` text CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; -- -- Tablo döküm verisi `options` -- INSERT INTO `options` (`ID`, `name`, `value`) VALUES (1, 'site_title', 'MiniMVC Project - Application Framework for PHP'), (2, 'site_desc', 'MiniMVC is an MVC (Model-View-Controller) application framework for PHP.'), (3, 'site_keywords', 'MiniMVC, MVC, PHP, Model, View, Controller, PHP Framework, Framework, Framework Application'); -- -------------------------------------------------------- -- -- Tablo için tablo yapısı `users` -- CREATE TABLE IF NOT EXISTS `users` ( `ID` int(11) NOT NULL, `mail` varchar(255) CHARACTER SET utf8 NOT NULL, `password` varchar(255) CHARACTER SET utf8 NOT NULL, `name` varchar(250) CHARACTER SET utf8 NOT NULL, `role` int(2) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=MyISAM AUTO_INCREMENT=169 DEFAULT CHARSET=latin1; -- -- Tablo döküm verisi `users` -- INSERT INTO `users` (`ID`, `mail`, `password`, `name`, `role`, `date`) VALUES (1, 'admin@arifacar.com', 'Test123', 'Administrator', 10, '2015-10-24 00:24:04'); -- -- Dökümü yapılmış tablolar için indeksler -- -- -- Tablo için indeksler `category` -- ALTER TABLE `category` ADD PRIMARY KEY (`ID`); -- -- Tablo için indeksler `content` -- ALTER TABLE `content` ADD PRIMARY KEY (`ID`); -- -- Tablo için indeksler `menu` -- ALTER TABLE `menu` ADD PRIMARY KEY (`ID`); -- -- Tablo için indeksler `options` -- ALTER TABLE `options` ADD PRIMARY KEY (`ID`); -- -- Tablo için indeksler `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`ID`); -- -- Dökümü yapılmış tablolar için AUTO_INCREMENT değeri -- -- -- Tablo için AUTO_INCREMENT değeri `category` -- ALTER TABLE `category` MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=4; -- -- Tablo için AUTO_INCREMENT değeri `content` -- ALTER TABLE `content` MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=80; -- -- Tablo için AUTO_INCREMENT değeri `menu` -- ALTER TABLE `menu` MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=61; -- -- Tablo için AUTO_INCREMENT değeri `options` -- ALTER TABLE `options` MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=4; -- -- Tablo için AUTO_INCREMENT değeri `users` -- ALTER TABLE `users` MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=169; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
62.971963
3,493
0.732116
c0796c0f0050a890485766ac32f7eeb9901198ee
318
sql
SQL
layered_gis/natural/peak.sql
zdenulo/bigquery-openstreetmap
2d30845513ac4fa36eec1537456c91a49164eaff
[ "BSD-3-Clause" ]
null
null
null
layered_gis/natural/peak.sql
zdenulo/bigquery-openstreetmap
2d30845513ac4fa36eec1537456c91a49164eaff
[ "BSD-3-Clause" ]
null
null
null
layered_gis/natural/peak.sql
zdenulo/bigquery-openstreetmap
2d30845513ac4fa36eec1537456c91a49164eaff
[ "BSD-3-Clause" ]
null
null
null
SELECT 4111 AS layer_code, 'natural' AS layer_class, 'peak' AS layer_name, feature_type AS gdal_type, osm_id, osm_way_id, osm_timestamp, all_tags, geometry FROM `openstreetmap-public-data-prod.osm_planet.features` WHERE EXISTS(SELECT 1 FROM UNNEST(all_tags) as tags WHERE tags.key = 'natural' AND tags.value='peak')
63.6
150
0.792453
7d62ce3847c573561fbc55b9c1f0624b26c841ea
941
html
HTML
example/printStar.html
ckswjd99/HTPL
1c95814ba760d51d137a7526d798b44f0e539faa
[ "MIT" ]
null
null
null
example/printStar.html
ckswjd99/HTPL
1c95814ba760d51d137a7526d798b44f0e539faa
[ "MIT" ]
1
2022-02-08T01:01:47.000Z
2022-02-08T02:16:54.000Z
example/printStar.html
ckswjd99/HTPL
1c95814ba760d51d137a7526d798b44f0e539faa
[ "MIT" ]
null
null
null
<!DOCTYPE html> <html lang="en"> <head> <title>Beautiful Stars</title> </head> <body> <h1>Let's Print Stars</h1> <span>SPAN will be used to print something.</span> <p dontpop="co" numof_star="co">P has input value.</p> <header dontpop="co"> <p dontpop="co">HEADER has input value.</p> </header> <footer dontpop="co">FOOTER has value 0.</footer> <h2>Now start loop...</h2> <div> <header add="alone" dontpop="co">decrease HEADER...</header> <footer add="cat" dontpop="co">increase FOOTER...</footer> <div> <a dontpop="co"> <footer dontpop="co">A has FOOTER value.</footer> </a> <a add="alone" dontpop="co">decrease A...</a> <span printVal="158">print "*"</span> <a dontpop="co" jumpin.g="heaven">check if A is zero.</a> </div> <span printVal="8">print "\n"</span> <header dontpop="co" jumpin.g="cat">until HEADER is 0.</header> </div> </body> </html>
25.432432
67
0.597237
b1cb8cc751206528268f63478f8ac6a3281af38c
2,748
h
C
include/QBDI/Logs.h
gmh5225/QBDI
d31872adae1099ac74a2e2238f909ad1e63cc3e8
[ "Apache-2.0" ]
661
2018-08-17T22:50:33.000Z
2022-03-30T15:14:58.000Z
include/QBDI/Logs.h
gmh5225/QBDI
d31872adae1099ac74a2e2238f909ad1e63cc3e8
[ "Apache-2.0" ]
102
2018-08-22T16:39:46.000Z
2022-03-11T10:20:08.000Z
include/QBDI/Logs.h
gmh5225/QBDI
d31872adae1099ac74a2e2238f909ad1e63cc3e8
[ "Apache-2.0" ]
82
2018-08-23T05:43:12.000Z
2022-03-25T05:45:23.000Z
/* * This file is part of QBDI. * * Copyright 2017 - 2021 Quarkslab * * 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 QBDI_LOGS_H_ #define QBDI_LOGS_H_ #include <stdio.h> #include "QBDI/Platform.h" #ifdef __cplusplus #include <string> #endif #ifdef __cplusplus namespace QBDI { extern "C" { #endif /*! Each log has a priority (or level) which can be used to control verbosity. * In production builds, only Warning and Error logs are kept. */ typedef enum { _QBDI_EI(DEBUG) = 0, /*!< Debug logs */ _QBDI_EI(INFO), /*!< Info logs (default) */ _QBDI_EI(WARNING), /*!< Warning logs */ _QBDI_EI(ERROR), /*!< Error logs */ _QBDI_EI(DISABLE) = 0xff, /*!< Disable logs message */ } LogPriority; /*! Redirect logs to a file. * * @param[in] filename the path of the file to append the log * @param[in] truncate Set to true to clear the file before append the log */ QBDI_EXPORT void qbdi_setLogFile(const char *filename, bool truncate); /*! Write log to the console (stderr) */ QBDI_EXPORT void qbdi_setLogConsole(); /*! Write log to the default location (stderr for linux, android_logger for * android) */ QBDI_EXPORT void qbdi_setLogDefault(); /*! Enable logs matching priority. * * @param[in] priority Filter logs with greater or equal priority. */ QBDI_EXPORT void qbdi_setLogPriority(LogPriority priority); #ifdef __cplusplus /* * C API C++ bindings */ /*! Redirect logs to a file. * * @param[in] filename the path of the file to append the log * @param[in] truncate Set to true to clear the file before append the log */ QBDI_EXPORT void setLogFile(const std::string &filename, bool truncate = false); /*! Enable logs matching priority. * * @param[in] priority Filter logs with greater or equal priority. */ inline void setLogPriority(LogPriority priority = LogPriority::INFO) { return qbdi_setLogPriority(priority); } /*! Write log to the console (stderr) */ inline void setLogConsole() { return qbdi_setLogConsole(); } /*! Write log to the default location (stderr for linux, android_logger for * android) */ inline void setLogDefault() { return qbdi_setLogDefault(); } } // "C" } // QBDI:: #endif #endif // QBDI_LOGS_H_
26.941176
80
0.702329
751a9d258d405386e38683ae74853b552b11e261
13,414
c
C
src/drv_oculus_rift/packet.c
haklina2/OpenHMD
38d396c483b87c23976db390df8ededfdfcb1b29
[ "BSL-1.0" ]
1,034
2015-01-03T03:28:18.000Z
2022-03-30T13:49:10.000Z
src/drv_oculus_rift/packet.c
haklina2/OpenHMD
38d396c483b87c23976db390df8ededfdfcb1b29
[ "BSL-1.0" ]
258
2015-06-09T19:18:27.000Z
2022-03-28T11:59:29.000Z
src/drv_oculus_rift/packet.c
haklina2/OpenHMD
38d396c483b87c23976db390df8ededfdfcb1b29
[ "BSL-1.0" ]
189
2015-01-06T15:33:56.000Z
2022-03-29T20:52:46.000Z
/* * Copyright 2013, Fredrik Hultin. * Copyright 2013, Jakob Bornecrantz. * Copyright 2016 Philipp Zabel * Copyright 2019 Jan Schmidt * SPDX-License-Identifier: BSL-1.0 * * OpenHMD - Free and Open Source API and drivers for immersive technology. */ /* Oculus Rift Driver - Packet Decoding and Utilities */ #include <stdio.h> #include <string.h> #include "rift.h" #define SKIP8 (buffer++) #define SKIP16 (buffer+=2) #define SKIP_CMD (buffer++) #define READ8 *(buffer++); #define READ16 *buffer | (*(buffer + 1) << 8); buffer += 2; #define READ32 *buffer | (*(buffer + 1) << 8) | (*(buffer + 2) << 16) | (*(buffer + 3) << 24); buffer += 4; #define READFLOAT ((float)(*buffer)); buffer += 4; #define READFIXED (float)(*buffer | (*(buffer + 1) << 8) | (*(buffer + 2) << 16) | (*(buffer + 3) << 24)) / 1000000.0f; buffer += 4; #define WRITE8(_val) *(buffer++) = (_val); #define WRITE16(_val) WRITE8((_val) & 0xff); WRITE8(((_val) >> 8) & 0xff); #define WRITE32(_val) WRITE16((_val) & 0xffff) *buffer; WRITE16(((_val) >> 16) & 0xffff); bool decode_position_info(pkt_position_info* p, const unsigned char* buffer, int size) { if(size != 30) { LOGE("invalid packet size (expected 30 but got %d)", size); return false; } SKIP_CMD; SKIP16; p->flags = READ8; p->pos_x = READ32; p->pos_y = READ32; p->pos_z = READ32; p->dir_x = READ16; p->dir_y = READ16; p->dir_z = READ16; SKIP16; p->index = READ8; SKIP8; p->num = READ8; SKIP8; p->type = READ8; return true; } bool decode_led_pattern_info(pkt_led_pattern_report * p, const unsigned char* buffer, int size) { if(size != 12) { LOGE("invalid packet size (expected 12 but got %d)", size); return false; } SKIP_CMD; SKIP16; p->pattern_length = READ8; p->pattern = READ32; p->index = READ16; p->num = READ16; return true; } bool decode_sensor_range(pkt_sensor_range* range, const unsigned char* buffer, int size) { if(!(size == 8 || size == 9)){ LOGE("invalid packet size (expected 8 or 9 but got %d)", size); return false; } SKIP_CMD; range->command_id = READ16; range->accel_scale = READ8; range->gyro_scale = READ16; range->mag_scale = READ16; return true; } bool decode_sensor_display_info(pkt_sensor_display_info* info, const unsigned char* buffer, int size) { if(!(size == 56 || size == 57)){ LOGE("invalid packet size (expected 56 or 57 but got %d)", size); return false; } SKIP_CMD; info->command_id = READ16; info->distortion_type = READ8; info->h_resolution = READ16; info->v_resolution = READ16; info->h_screen_size = READFIXED; info->v_screen_size = READFIXED; info->v_center = READFIXED; info->lens_separation = READFIXED; info->eye_to_screen_distance[0] = READFIXED; info->eye_to_screen_distance[1] = READFIXED; info->distortion_type_opts = 0; for(int i = 0; i < 6; i++){ info->distortion_k[i] = READFLOAT; } return true; } bool decode_sensor_config(pkt_sensor_config* config, const unsigned char* buffer, int size) { if(!(size == 7 || size == 8)){ LOGE("invalid packet size (expected 7 or 8 but got %d)", size); return false; } SKIP_CMD; config->command_id = READ16; config->flags = READ8; config->packet_interval = READ8; config->keep_alive_interval = READ16; return true; } static void decode_sample(const unsigned char* buffer, int32_t* smp) { /* * Decode 3 tightly packed 21 bit values from 4 bytes. * We unpack them in the higher 21 bit values first and then shift * them down to the lower in order to get the sign bits correct. */ int x = (buffer[0] << 24) | (buffer[1] << 16) | ((buffer[2] & 0xF8) << 8); int y = ((buffer[2] & 0x07) << 29) | (buffer[3] << 21) | (buffer[4] << 13) | ((buffer[5] & 0xC0) << 5); int z = ((buffer[5] & 0x3F) << 26) | (buffer[6] << 18) | (buffer[7] << 10); smp[0] = x >> 11; smp[1] = y >> 11; smp[2] = z >> 11; } bool decode_tracker_sensor_msg_dk1(pkt_tracker_sensor* msg, const unsigned char* buffer, int size) { if(!(size == 62 || size == 64)){ LOGE("invalid packet size (expected 62 or 64 but got %d)", size); return false; } SKIP_CMD; msg->num_samples = READ8; msg->total_sample_count = 0; /* No sample count in DK1 */ msg->timestamp = READ16; msg->timestamp *= 1000; // DK1 timestamps are in milliseconds buffer += 2; /* Skip unused last_command_id */ msg->temperature = READ16; msg->num_samples = OHMD_MIN(msg->num_samples, 3); for(int i = 0; i < msg->num_samples; i++){ decode_sample(buffer, msg->samples[i].accel); buffer += 8; decode_sample(buffer, msg->samples[i].gyro); buffer += 8; } // Skip empty samples buffer += (3 - msg->num_samples) * 16; for(int i = 0; i < 3; i++){ msg->mag[i] = READ16; } // positional tracking data and frame data - do these exist on DK1? msg->frame_count = 0; msg->frame_timestamp = 0; msg->frame_id = 0; msg->led_pattern_phase = 0; msg->exposure_count = 0; msg->exposure_timestamp = 0; return true; } bool decode_tracker_sensor_msg_dk2(pkt_tracker_sensor* msg, const unsigned char* buffer, int size) { if(!(size == 64)){ LOGE("invalid packet size (expected 64 but got %d)", size); return false; } SKIP_CMD; SKIP16; msg->num_samples = READ8; /* Next is the number of samples since start, excluding the samples contained in this packet */ msg->total_sample_count = READ16; msg->temperature = READ16; msg->timestamp = READ32; /* Second sample value is junk (outdated/uninitialized) value if num_samples < 2. */ msg->num_samples = OHMD_MIN(msg->num_samples, 2); for(int i = 0; i < msg->num_samples; i++){ decode_sample(buffer, msg->samples[i].accel); buffer += 8; decode_sample(buffer, msg->samples[i].gyro); buffer += 8; } // Skip empty samples buffer += (2 - msg->num_samples) * 16; for(int i = 0; i < 3; i++){ msg->mag[i] = READ16; } // positional tracking data and frame data msg->frame_count = READ16; msg->frame_timestamp = READ32; msg->frame_id = READ8; msg->led_pattern_phase = READ8; msg->exposure_count = READ16; msg->exposure_timestamp = READ32; return true; } bool decode_radio_address(uint8_t radio_address[5], const unsigned char* buffer, int size) { if (size < 8) return false; /* Ignore the command and echo bytes, then 5 bytes of radio address payload */ SKIP_CMD; SKIP16; memcpy (radio_address, buffer, 5); return true; } static bool decode_rift_radio_message(pkt_rift_radio_message *m, const unsigned char* buffer) { int i; m->flags = READ16; m->device_type = READ8; /* 2019-6 All the valid messages I've seen have 0x1c or 0x5 in these 16 bits - JS */ /* 0x5 always seems to be the rift remote, and there are 2 other cases I've seen: * device type 0x22 flags 0x0000 and device type 0x04 flags 0x7600 */ m->valid = (m->flags == 0x1c || m->flags == 0x05); if (!m->valid) { LOGV ("Invalid radio report from unknown remote device type 0x%02x flags 0x%04x", m->device_type, m->flags); return true; } switch (m->device_type) { case RIFT_REMOTE: m->remote.buttons = READ16; break; case RIFT_TOUCH_CONTROLLER_LEFT: case RIFT_TOUCH_CONTROLLER_RIGHT: { uint8_t tgs[5]; m->touch.timestamp = READ32; for (i = 0; i < 3; i++) { m->touch.accel[i] = READ16; } for (i = 0; i < 3; i++) { m->touch.gyro[i] = READ16; } m->touch.buttons = READ8; for (i = 0; i < 5; i++) { tgs[i] = READ8; } m->touch.trigger = tgs[0] | ((tgs[1] & 0x03) << 8); m->touch.grip = ((tgs[1] & 0xfc) >> 2) | ((tgs[2] & 0x0f) << 6); m->touch.stick[0] = ((tgs[2] & 0xf0) >> 4) | ((tgs[3] & 0x3f) << 4); m->touch.stick[1] = ((tgs[3] & 0xc0) >> 6) | ((tgs[4] & 0xff) << 2); m->touch.adc_channel = READ8; m->touch.adc_value = READ16; break; } default: LOGE ("Radio report from unknown remote device type 0x%02x flags 0x%04x", m->device_type, m->flags); return false; } return true; } bool decode_rift_radio_report(pkt_rift_radio_report *r, const unsigned char* buffer, int size) { if (size != RIFT_RADIO_REPORT_SIZE) { LOGE("invalid packet size (expected 64 but got %d)", size); return false; } if (buffer[0] != RIFT_RADIO_REPORT_ID) { LOGE("Unknown radio report id 0x%02x\n", buffer[0]); return false; } r->id = READ8; SKIP16; // Ignore the echo for (int i = 0; i < 2; i++) { if (!decode_rift_radio_message (&r->message[i], buffer)) return false; buffer += 28; } return true; } // TODO do we need to consider HMD vs sensor "centric" values void vec3f_from_rift_vec(const int32_t* smp, vec3f* out_vec) { out_vec->x = (float)smp[0] * 0.0001f; out_vec->y = (float)smp[1] * 0.0001f; out_vec->z = (float)smp[2] * 0.0001f; } int encode_sensor_config(unsigned char* buffer, const pkt_sensor_config* config) { WRITE8(RIFT_CMD_SENSOR_CONFIG); WRITE16(config->command_id); WRITE8(config->flags); WRITE8(config->packet_interval); WRITE16(config->keep_alive_interval); return 7; // sensor config packet size } int encode_tracking_config(unsigned char* buffer, const pkt_tracking_config* tracking) { WRITE8(RIFT_CMD_TRACKING_CONFIG); WRITE16(tracking->command_id); WRITE8(tracking->pattern); WRITE8(tracking->flags); WRITE8(tracking->reserved); WRITE16(tracking->exposure_us); WRITE16(tracking->period_us); WRITE16(tracking->vsync_offset); WRITE8 (tracking->duty_cycle); return 13; } int encode_dk1_keep_alive(unsigned char* buffer, const pkt_keep_alive* keep_alive) { WRITE8(RIFT_CMD_DK1_KEEP_ALIVE); WRITE16(keep_alive->command_id); WRITE16(keep_alive->keep_alive_interval); return 5; // keep alive packet size } int encode_enable_components(unsigned char* buffer, bool display, bool audio, bool leds) { uint8_t flags = 0; WRITE8(RIFT_CMD_ENABLE_COMPONENTS); WRITE16(0); // last command ID if (display) flags |= RIFT_COMPONENT_DISPLAY; if (audio) flags |= RIFT_COMPONENT_AUDIO; if (leds) flags |= RIFT_COMPONENT_LEDS; WRITE8(flags); return 4; // component flags packet size } int encode_radio_control_cmd(unsigned char* buffer, uint8_t a, uint8_t b, uint8_t c) { WRITE8(RIFT_CMD_RADIO_CONTROL); WRITE16(0); // last command ID WRITE8(a); WRITE8(b); WRITE8(c); return 6; } int encode_radio_data_read_cmd(unsigned char *buffer, uint16_t offset, uint16_t length) { int i; WRITE8(RIFT_CMD_RADIO_READ_DATA); WRITE16(0); // last command ID WRITE16(offset); WRITE16(length); for (i = 0; i < 28; i++) { WRITE8(0); } return 31; } void dump_packet_sensor_range(const pkt_sensor_range* range) { (void)range; LOGD("sensor range\n"); LOGD(" command id: %d", range->command_id); LOGD(" accel scale: %d", range->accel_scale); LOGD(" gyro scale: %d", range->gyro_scale); LOGD(" mag scale: %d", range->mag_scale); } void dump_packet_sensor_display_info(const pkt_sensor_display_info* info) { (void)info; LOGD("display info"); LOGD(" command id: %d", info->command_id); LOGD(" distortion_type: %d", info->distortion_type); LOGD(" resolution: %d x %d", info->h_resolution, info->v_resolution); LOGD(" screen size: %f x %f", info->h_screen_size, info->v_screen_size); LOGD(" vertical center: %f", info->v_center); LOGD(" lens_separation: %f", info->lens_separation); LOGD(" eye_to_screen_distance: %f, %f", info->eye_to_screen_distance[0], info->eye_to_screen_distance[1]); LOGD(" distortion_k: %f, %f, %f, %f, %f, %f", info->distortion_k[0], info->distortion_k[1], info->distortion_k[2], info->distortion_k[3], info->distortion_k[4], info->distortion_k[5]); } void dump_packet_sensor_config(const pkt_sensor_config* config) { (void)config; LOGD("sensor config"); LOGD(" command id: %u", config->command_id); LOGD(" flags: %02x", config->flags); LOGD(" raw mode: %d", !!(config->flags & RIFT_SCF_RAW_MODE)); LOGD(" calibration test: %d", !!(config->flags & RIFT_SCF_CALIBRATION_TEST)); LOGD(" use calibration: %d", !!(config->flags & RIFT_SCF_USE_CALIBRATION)); LOGD(" auto calibration: %d", !!(config->flags & RIFT_SCF_AUTO_CALIBRATION)); LOGD(" motion keep alive: %d", !!(config->flags & RIFT_SCF_MOTION_KEEP_ALIVE)); LOGD(" motion command keep alive: %d", !!(config->flags & RIFT_SCF_COMMAND_KEEP_ALIVE)); LOGD(" sensor coordinates: %d", !!(config->flags & RIFT_SCF_SENSOR_COORDINATES)); LOGD(" packet interval: %u", config->packet_interval); LOGD(" keep alive interval: %u", config->keep_alive_interval); } void dump_packet_tracker_sensor(const pkt_tracker_sensor* sensor) { (void)sensor; LOGD("tracker sensor:"); LOGD(" total sample count: %u", sensor->total_sample_count); LOGD(" timestamp: %u", sensor->timestamp); LOGD(" temperature: %d", sensor->temperature); LOGD(" num samples: %u", sensor->num_samples); LOGD(" magnetic field: %i %i %i", sensor->mag[0], sensor->mag[1], sensor->mag[2]); for(int i = 0; i < sensor->num_samples; i++){ LOGD(" accel: %d %d %d", sensor->samples[i].accel[0], sensor->samples[i].accel[1], sensor->samples[i].accel[2]); LOGD(" gyro: %d %d %d", sensor->samples[i].gyro[0], sensor->samples[i].gyro[1], sensor->samples[i].gyro[2]); } LOGD("frame_id %u frame count %u timestamp %u led pattern %u exposure_count %u exposure time %u", sensor->frame_id, sensor->frame_count, sensor->frame_timestamp, sensor->led_pattern_phase, sensor->exposure_count, sensor->exposure_timestamp); }
27.714876
132
0.663188
2a31ac07256d42ea4478cc1c1efe4e1a4bcf2aaa
12,799
java
Java
vahub-model/src/test/java/com/acuity/visualisations/rawdatamodel/trellis/CvotEndpointDatasetsBinnedAttributesTest.java
digital-ECMT/acuity-vahub
244eb7ec0f56cdac81ac6a8245ba2959b012b246
[ "Apache-2.0" ]
7
2022-01-25T18:12:19.000Z
2022-03-22T18:31:08.000Z
vahub-model/src/test/java/com/acuity/visualisations/rawdatamodel/trellis/CvotEndpointDatasetsBinnedAttributesTest.java
digital-ECMT/acuity-vahub
244eb7ec0f56cdac81ac6a8245ba2959b012b246
[ "Apache-2.0" ]
null
null
null
vahub-model/src/test/java/com/acuity/visualisations/rawdatamodel/trellis/CvotEndpointDatasetsBinnedAttributesTest.java
digital-ECMT/acuity-vahub
244eb7ec0f56cdac81ac6a8245ba2959b012b246
[ "Apache-2.0" ]
1
2022-03-28T15:20:09.000Z
2022-03-28T15:20:09.000Z
/* * Copyright 2021 The University of Manchester * * 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.acuity.visualisations.rawdatamodel.trellis; import com.acuity.visualisations.rawdatamodel.trellis.grouping.CvotEndpointGroupByOptions; import com.acuity.visualisations.rawdatamodel.trellis.grouping.EmptyBin; import com.acuity.visualisations.rawdatamodel.trellis.grouping.IntBin; import com.acuity.visualisations.rawdatamodel.util.Attributes; import com.acuity.visualisations.rawdatamodel.util.DateUtils; import com.acuity.visualisations.rawdatamodel.vo.CvotEndpointRaw; import com.acuity.visualisations.rawdatamodel.vo.GroupByOption; import com.acuity.visualisations.rawdatamodel.vo.Subject; import com.acuity.visualisations.rawdatamodel.vo.wrappers.CvotEndpoint; import org.assertj.core.api.JUnitSoftAssertions; import org.junit.Rule; import org.junit.Test; import java.util.Date; import java.util.HashMap; public class CvotEndpointDatasetsBinnedAttributesTest { public static final Subject SUBJECT1; static { final HashMap<String, Date> drugFirstDoseDate1 = new HashMap<>(); drugFirstDoseDate1.put("drug1", DateUtils.toDate("01.08.2015")); drugFirstDoseDate1.put("drug2", DateUtils.toDate("01.10.2015")); SUBJECT1 = Subject.builder().subjectId("sid1").subjectCode("E01").datasetId("test") .firstTreatmentDate(DateUtils.toDate("01.08.2015")) .drugFirstDoseDate(drugFirstDoseDate1).build(); } public static final CvotEndpoint EVENT1 = new CvotEndpoint(CvotEndpointRaw.builder() .startDate(DateUtils.toDate("01.09.2015")).aeNumber(1).category1("cat1").subjectId("sid1").build(), SUBJECT1); public static final CvotEndpoint EVENT2 = new CvotEndpoint(CvotEndpointRaw.builder() .startDate(DateUtils.toDate("01.11.2015")).aeNumber(1).category1("cat1").subjectId("sid1").build(), SUBJECT1); public static final CvotEndpoint EVENT3 = new CvotEndpoint(CvotEndpointRaw.builder() .startDate(null).aeNumber(1).category1("cat1").subjectId("sid1").build(), SUBJECT1); @Rule public final JUnitSoftAssertions softly = new JUnitSoftAssertions(); @Test public void shouldCalc1BinDaysSinceFirstDose() throws Exception { final Object bin1 = Attributes.get( CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, 1) .with(GroupByOption.Param.TIMESTAMP_TYPE, GroupByOption.TimestampType.DAYS_SINCE_FIRST_DOSE).build()), EVENT1); System.out.println(bin1); softly.assertThat(bin1.toString()).isEqualTo("31"); final Object bin2 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, 1) .with(GroupByOption.Param.TIMESTAMP_TYPE, GroupByOption.TimestampType.DAYS_SINCE_FIRST_DOSE).build()), EVENT2); System.out.println(bin2); softly.assertThat(bin2.toString()).isEqualTo("92"); final Object bin3 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, 1) .with(GroupByOption.Param.TIMESTAMP_TYPE, GroupByOption.TimestampType.DAYS_SINCE_FIRST_DOSE).build()), EVENT3); System.out.println(bin3); softly.assertThat(bin3.toString()).isEqualTo("(Empty)"); } @Test public void shouldCalcNullBinDaysSinceFirstDose() throws Exception { final Object bin1 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, null) .with(GroupByOption.Param.TIMESTAMP_TYPE, GroupByOption.TimestampType.DAYS_SINCE_FIRST_DOSE).build()), EVENT1); System.out.println(bin1); softly.assertThat(bin1.toString()).isEqualTo("31"); final Object bin2 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, null) .with(GroupByOption.Param.TIMESTAMP_TYPE, GroupByOption.TimestampType.DAYS_SINCE_FIRST_DOSE).build()), EVENT2); System.out.println(bin2); softly.assertThat(bin2.toString()).isEqualTo("92"); final Object bin3 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, null) .with(GroupByOption.Param.TIMESTAMP_TYPE, GroupByOption.TimestampType.DAYS_SINCE_FIRST_DOSE).build()), EVENT3); System.out.println(bin3); softly.assertThat(bin3.toString()).isEqualTo("(Empty)"); } @Test @SuppressWarnings("unchecked") public void shouldCalc7BinDaysSinceFirstDose() throws Exception { final Object bin1 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, 7) .with(GroupByOption.Param.TIMESTAMP_TYPE, GroupByOption.TimestampType.DAYS_SINCE_FIRST_DOSE).build()), EVENT1); System.out.println(bin1); softly.assertThat(bin1).isInstanceOf(IntBin.class); softly.assertThat(bin1.toString()).isEqualTo("28 - 34"); final Object bin2 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, 7) .with(GroupByOption.Param.TIMESTAMP_TYPE, GroupByOption.TimestampType.DAYS_SINCE_FIRST_DOSE).build()), EVENT2); softly.assertThat(bin2).isInstanceOf(IntBin.class); softly.assertThat(bin2.toString()).isEqualTo("91 - 97"); final Object bin3 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, 7) .with(GroupByOption.Param.TIMESTAMP_TYPE, GroupByOption.TimestampType.DAYS_SINCE_FIRST_DOSE).build()), EVENT3); System.out.println(bin3); softly.assertThat(bin3).isInstanceOf(EmptyBin.class); softly.assertThat(bin3.toString()).isEqualTo("(Empty)"); } @Test public void shouldCalc7BinDaysSinceFirstDoseByDrug() throws Exception { final Object bin11 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, 7).with(GroupByOption.Param.DRUG_NAME, "drug1") .with(GroupByOption.Param.TIMESTAMP_TYPE, GroupByOption.TimestampType.DAYS_SINCE_FIRST_DOSE_OF_DRUG).build()), EVENT1); System.out.println(bin11); softly.assertThat(bin11.toString()).isEqualTo("28 - 34"); final Object bin12 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, 7).with(GroupByOption.Param.DRUG_NAME, "drug2") .with(GroupByOption.Param.TIMESTAMP_TYPE, GroupByOption.TimestampType.DAYS_SINCE_FIRST_DOSE_OF_DRUG).build()), EVENT1); System.out.println(bin12); softly.assertThat(bin12.toString()).isEqualTo("-35 - -29"); final Object bin21 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, 7).with(GroupByOption.Param.DRUG_NAME, "drug1") .with(GroupByOption.Param.TIMESTAMP_TYPE, GroupByOption.TimestampType.DAYS_SINCE_FIRST_DOSE_OF_DRUG).build()), EVENT2); System.out.println(bin21); softly.assertThat(bin21.toString()).isEqualTo("91 - 97"); final Object bin22 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, 7).with(GroupByOption.Param.DRUG_NAME, "drug2") .with(GroupByOption.Param.TIMESTAMP_TYPE, GroupByOption.TimestampType.DAYS_SINCE_FIRST_DOSE_OF_DRUG).build()), EVENT2); System.out.println(bin22); softly.assertThat(bin22.toString()).isEqualTo("28 - 34"); final Object bin31 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, 7).with(GroupByOption.Param.DRUG_NAME, "drug1") .with(GroupByOption.Param.TIMESTAMP_TYPE, GroupByOption.TimestampType.DAYS_SINCE_FIRST_DOSE_OF_DRUG).build()), EVENT3); System.out.println(bin31); softly.assertThat(bin31.toString()).isEqualTo("(Empty)"); final Object bin32 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, 7).with(GroupByOption.Param.DRUG_NAME, "drug2") .with(GroupByOption.Param.TIMESTAMP_TYPE, GroupByOption.TimestampType.DAYS_SINCE_FIRST_DOSE_OF_DRUG).build()), EVENT3); System.out.println(bin32); softly.assertThat(bin32.toString()).isEqualTo("(Empty)"); } @Test public void shouldCalc1BinStartDate() throws Exception { final Object bin1 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, 1).build()), EVENT1); System.out.println(bin1); softly.assertThat(bin1.toString()).isEqualTo("2015-09-01"); final Object bin2 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, 1).build()), EVENT2); System.out.println(bin2); softly.assertThat(bin2.toString()).isEqualTo("2015-11-01"); final Object bin3 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, 1).build()), EVENT3); System.out.println(bin3); softly.assertThat(bin3.toString()).isEqualTo("(Empty)"); } @Test public void shouldCalcNullBinStartDate() throws Exception { final Object bin1 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, null).build()), EVENT1); System.out.println(bin1); softly.assertThat(bin1.toString()).isEqualTo("2015-09-01"); final Object bin2 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, null).build()), EVENT2); System.out.println(bin2); softly.assertThat(bin2.toString()).isEqualTo("2015-11-01"); final Object bin3 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, null).build()), EVENT3); System.out.println(bin3); softly.assertThat(bin3.toString()).isEqualTo("(Empty)"); } @Test public void shouldCalc7BinStartDate() throws Exception { final Object bin1 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, 7).build()), EVENT1); System.out.println(bin1); softly.assertThat(bin1.toString()).isEqualTo("2015-08-27 - 2015-09-02"); final Object bin2 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, 7).build()), EVENT2); System.out.println(bin2); softly.assertThat(bin2.toString()).isEqualTo("2015-10-29 - 2015-11-04"); final Object bin3 = Attributes.get(CvotEndpointGroupByOptions.START_DATE.getAttribute( GroupByOption.Params.builder().with(GroupByOption.Param.BIN_SIZE, 7).build()), EVENT3); System.out.println(bin3); softly.assertThat(bin3.toString()).isEqualTo("(Empty)"); } }
62.131068
143
0.710681
d4e95195e67decf0a971faf117467c769857c681
1,289
rs
Rust
src/closures-value_capture.rs
chenyukang/rust-rosetta
99433afd01846fdc00da0a51f1fd21a2d2645835
[ "Unlicense" ]
null
null
null
src/closures-value_capture.rs
chenyukang/rust-rosetta
99433afd01846fdc00da0a51f1fd21a2d2645835
[ "Unlicense" ]
null
null
null
src/closures-value_capture.rs
chenyukang/rust-rosetta
99433afd01846fdc00da0a51f1fd21a2d2645835
[ "Unlicense" ]
null
null
null
// http://rosettacode.org/wiki/Closures/Value_capture #![allow(unstable)] use std::iter::{count, Counter, Map}; use std::num::Float; // given a number x, return the (boxed) closure that // computes x squared fn closure_gen<'a>(x: u32) -> Box<Fn() -> f64 + 'a> { Box::new(move |&:| (x as f64).powi(2)) } // type alias for the closure iterator type ClosureIter<'a> = Map<u32, Box<Fn() -> f64 + 'a>, Counter<u32>, fn(u32) -> Box<Fn() -> f64 + 'a>>; // return an iterator that on every iteration returns // a closure computing the index of the iteration squared fn closures_iterator<'a>() -> ClosureIter<'a> { let cl_gen : fn(u32) -> Box<Fn() -> f64 + 'a> = closure_gen; count(0, 1).map(cl_gen) } #[cfg(not(test))] fn main() { // Take the first 9 closures from the iterator and call them for c in closures_iterator().take(9) { println!("{}", c()) } } #[cfg(test)] mod test { use std::num::Float; use super::{closure_gen, closures_iterator}; #[test] fn closure_generator() { let five_squarer = closure_gen(5); assert!(five_squarer() == 25f64); } #[test] fn closure_iterator() { for (idx, f) in closures_iterator().take(9).enumerate() { assert!(f() == (idx as f64).powi(2)); } } }
27.425532
103
0.598138
020d08816d2e9cc6119d81c6d9b914d85a206213
6,999
kt
Kotlin
client/src/main/kotlin/ui/utils/OutlinedTextFieldWithError.kt
neckbosov/software-engineering
ef61dac687e15a68970d7ce4d49ae02c7591d22b
[ "Apache-2.0" ]
1
2021-09-29T09:52:30.000Z
2021-09-29T09:52:30.000Z
client/src/main/kotlin/ui/utils/OutlinedTextFieldWithError.kt
neckbosov/software-engineering
ef61dac687e15a68970d7ce4d49ae02c7591d22b
[ "Apache-2.0" ]
6
2021-09-30T08:04:04.000Z
2021-12-22T22:16:10.000Z
client/src/main/kotlin/ui/utils/OutlinedTextFieldWithError.kt
neckbosov/software-engineering
ef61dac687e15a68970d7ce4d49ae02c7591d22b
[ "Apache-2.0" ]
null
null
null
package ui.utils import androidx.compose.desktop.ui.tooling.preview.Preview import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.requiredHeight import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.* import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.Error import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Shape import androidx.compose.ui.graphics.vector.rememberVectorPainter import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp @Composable fun OutlinedTextFieldWithError( value: TextFieldValue, onValueChange: (TextFieldValue) -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, readOnly: Boolean = false, textStyle: TextStyle = LocalTextStyle.current, label: @Composable (() -> Unit)? = null, placeholder: @Composable (() -> Unit)? = null, leadingIcon: @Composable (() -> Unit)? = null, trailingIcon: @Composable (() -> Unit)? = null, errorIcon: @Composable (() -> Unit)? = null, helperMessage: @Composable (() -> Unit)? = null, errorMessage: @Composable (() -> Unit)? = null, isError: Boolean = false, visualTransformation: VisualTransformation = VisualTransformation.None, keyboardOptions: KeyboardOptions = KeyboardOptions.Default, keyboardActions: KeyboardActions = KeyboardActions(), singleLine: Boolean = false, maxLines: Int = Int.MAX_VALUE, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, shape: Shape = MaterialTheme.shapes.small, colors: TextFieldColors = TextFieldDefaults.textFieldColors() ) { Column( modifier = modifier ) { androidx.compose.material.OutlinedTextField( value = value, onValueChange = onValueChange, enabled = enabled, readOnly = readOnly, textStyle = textStyle, label = label, placeholder = placeholder, leadingIcon = leadingIcon, trailingIcon = if (isError) errorIcon else trailingIcon, isError = isError, visualTransformation = visualTransformation, keyboardOptions = keyboardOptions, keyboardActions = keyboardActions, singleLine = singleLine, maxLines = maxLines, interactionSource = interactionSource, shape = shape, colors = colors ) Box( modifier = Modifier .requiredHeight(32.dp) .padding(start = 16.dp, end = 12.dp) ) { CompositionLocalProvider( LocalTextStyle provides LocalTextStyle.current.copy( fontSize = 12.sp, color = if (isError) MaterialTheme.colors.error else LocalTextStyle.current.color ) ) { if (isError) { if (errorMessage != null) { errorMessage() } } else { if (helperMessage != null) { CompositionLocalProvider( LocalContentAlpha provides ContentAlpha.medium ) { helperMessage() } } } } } } } @Composable fun OutlinedTextFieldWithError( value: String, onValueChange: (String) -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, readOnly: Boolean = false, textStyle: TextStyle = LocalTextStyle.current, label: @Composable (() -> Unit)? = null, placeholder: @Composable (() -> Unit)? = null, leadingIcon: @Composable (() -> Unit)? = null, trailingIcon: @Composable (() -> Unit)? = null, errorIcon: @Composable (() -> Unit)? = null, helperMessage: @Composable (() -> Unit)? = null, errorMessage: @Composable (() -> Unit)? = null, isError: Boolean = false, visualTransformation: VisualTransformation = VisualTransformation.None, keyboardOptions: KeyboardOptions = KeyboardOptions.Default, keyboardActions: KeyboardActions = KeyboardActions(), singleLine: Boolean = false, maxLines: Int = Int.MAX_VALUE, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, shape: Shape = MaterialTheme.shapes.small, colors: TextFieldColors = TextFieldDefaults.textFieldColors() ) { val textFieldValueState = remember { mutableStateOf(TextFieldValue(text = value)) } val textFieldValue = textFieldValueState.value.copy(text = value) OutlinedTextFieldWithError( value = textFieldValue, onValueChange = { textFieldValueState.value = it if (value != it.text) { onValueChange(it.text) } }, modifier = modifier, enabled = enabled, readOnly = readOnly, singleLine = singleLine, textStyle = textStyle, label = label, placeholder = placeholder, leadingIcon = leadingIcon, trailingIcon = trailingIcon, errorIcon = errorIcon, helperMessage = helperMessage, errorMessage = errorMessage, isError = isError, visualTransformation = visualTransformation, keyboardOptions = keyboardOptions, keyboardActions = keyboardActions, maxLines = maxLines, interactionSource = interactionSource, shape = shape, colors = colors ) } @Preview() @Composable fun OutlinedTextFieldNightHelperPreview() { val text = remember { mutableStateOf("") } MaterialTheme { Surface(modifier = Modifier.padding(15.dp)) { OutlinedTextFieldWithError( value = TextFieldValue(text.value), onValueChange = { text.value = it.text }, errorMessage = { Text(text = "This is an error!") }, errorIcon = { Icon( painter = rememberVectorPainter(image = Icons.Rounded.Error), contentDescription = null ) }, isError = (text.value.isNotBlank() && text.value.toIntOrNull() != null), ) } } }
37.629032
101
0.625661
86bf6c11dadd761979feb88ef8eae1034bea7b8c
1,665
rs
Rust
src/rusty/subprotocols/template-distribution/src/coinbase_output_data_size.rs
stratum-mining/bitcoin
bb059e4be395a34433149c6d1b465a1584c4c285
[ "MIT" ]
null
null
null
src/rusty/subprotocols/template-distribution/src/coinbase_output_data_size.rs
stratum-mining/bitcoin
bb059e4be395a34433149c6d1b465a1584c4c285
[ "MIT" ]
14
2022-03-28T20:33:16.000Z
2022-03-29T14:42:33.000Z
src/rusty/subprotocols/template-distribution/src/coinbase_output_data_size.rs
stratum-mining/bitcoin
bb059e4be395a34433149c6d1b465a1584c4c285
[ "MIT" ]
null
null
null
#[cfg(not(feature = "with_serde"))] use alloc::vec::Vec; #[cfg(not(feature = "with_serde"))] use binary_sv2::binary_codec_sv2; use binary_sv2::{Deserialize, Serialize}; /// ## CoinbaseOutputDataSize (Client -> Server) /// Ultimately, the pool is responsible for adding coinbase transaction outputs for payouts and /// other uses, and thus the Template Provider will need to consider this additional block size /// when selecting transactions for inclusion in a block (to not create an invalid, oversized block). /// Thus, this message is used to indicate that some additional space in the block/coinbase /// transaction be reserved for the pool’s use (while always assuming the pool will use the entirety /// of available coinbase space). /// The Job Negotiator MUST discover the maximum serialized size of the additional outputs which /// will be added by the pool(s) it intends to use this work. It then MUST communicate the /// maximum such size to the Template Provider via this message. The Template Provider MUST /// NOT provide NewWork messages which would represent consensus-invalid blocks once this /// additional size — along with a maximally-sized (100 byte) coinbase field — is added. Further, /// the Template Provider MUST consider the maximum additional bytes required in the output /// count variable-length integer in the coinbase transaction when complying with the size limits. #[derive(Serialize, Deserialize, Copy, Clone, Debug)] #[repr(C)] pub struct CoinbaseOutputDataSize { /// The maximum additional serialized bytes which the pool will add in /// coinbase transaction outputs. pub coinbase_output_max_additional_size: u32, }
59.464286
101
0.770571
74bab964d0b2b9846627d0ec1afc29378e3e7200
292
js
JavaScript
web/js/main.js
jerrygacket/dashboards
265d8c8b5c1ded1c6685c02ac9332184467a6657
[ "BSD-3-Clause" ]
null
null
null
web/js/main.js
jerrygacket/dashboards
265d8c8b5c1ded1c6685c02ac9332184467a6657
[ "BSD-3-Clause" ]
null
null
null
web/js/main.js
jerrygacket/dashboards
265d8c8b5c1ded1c6685c02ac9332184467a6657
[ "BSD-3-Clause" ]
null
null
null
window.onload = function() { //let charts = getChartList(); //let charts = document.getElementsByTagName('canvas'); // getCharts('sales'); //getChartList(pageName); console.log('ddd'); //chartList.forEach(element => console.log(element)); //getCharts(pageName); };
32.444444
59
0.643836
1f87a84f4adf03ea2e1697e2f46efe65b97bba27
3,681
html
HTML
lists.whatwg.org/pipermail/implementors-whatwg.org/2008-April/000876.html
zcorpan/whatwg.org
3374e69f013e5939abc5f3fffaae50bb6eaf0bd3
[ "CC-BY-4.0" ]
1
2022-02-14T23:44:51.000Z
2022-02-14T23:44:51.000Z
lists.whatwg.org/pipermail/implementors-whatwg.org/2008-April/000876.html
Seanpm2001-Google/whatwg.org
33ad837c0dc53b68865f4a35ccdc1c68dc07fce6
[ "BSD-3-Clause" ]
1
2021-01-31T11:51:12.000Z
2021-01-31T11:51:12.000Z
lists.whatwg.org/pipermail/implementors-whatwg.org/2008-April/000876.html
Seanpm2001-Google/whatwg.org
33ad837c0dc53b68865f4a35ccdc1c68dc07fce6
[ "BSD-3-Clause" ]
null
null
null
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML> <HEAD> <TITLE> [imps] HTML5 parser test location </TITLE> <LINK REL="Index" HREF="index.html" > <LINK REL="made" HREF="mailto:implementors%40lists.whatwg.org?Subject=Re%3A%20%5Bimps%5D%20HTML5%20parser%20test%20location&In-Reply-To=%3Cop.t8470fog64w2qv%40annevk-t60.oslo.opera.com%3E"> <META NAME="robots" CONTENT="index,nofollow"> <style type="text/css"> pre { white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */ } </style> <META http-equiv="Content-Type" content="text/html; charset=us-ascii"> <LINK REL="Previous" HREF="000875.html"> <LINK REL="Next" HREF="000879.html"> </HEAD> <BODY BGCOLOR="#ffffff"> <H1>[imps] HTML5 parser test location</H1> <!--htdig_noindex--> <B>Anne van Kesteren</B> <A HREF="mailto:implementors%40lists.whatwg.org?Subject=Re%3A%20%5Bimps%5D%20HTML5%20parser%20test%20location&In-Reply-To=%3Cop.t8470fog64w2qv%40annevk-t60.oslo.opera.com%3E" TITLE="[imps] HTML5 parser test location">annevk at opera.com </A><BR> <I>Sat Apr 5 08:01:17 PDT 2008</I> <P><UL> <LI>Previous message: <A HREF="000875.html">[imps] HTML5 parser test location </A></li> <LI>Next message: <A HREF="000879.html">[imps] HTML5 parser test location </A></li> <LI> <B>Messages sorted by:</B> <a href="date.html#876">[ date ]</a> <a href="thread.html#876">[ thread ]</a> <a href="subject.html#876">[ subject ]</a> <a href="author.html#876">[ author ]</a> </LI> </UL> <HR> <!--/htdig_noindex--> <!--beginarticle--> <PRE>On Sat, 05 Apr 2008 15:22:48 +0200, Thomas Broyer &lt;<A HREF="http://lists.whatwg.org/listinfo.cgi/implementors-whatwg.org">t.broyer at gmail.com</A>&gt; wrote: &gt;<i> My main goal with the new tests is to keep them: </I>&gt;<i> - independant of any implementation, so that we can keep them in sync </I>&gt;<i> with the spec, not the software (see the above thread's first message) </I> I thought about this and agree that this is problematic. Given that the main code is more stable maybe we could move to a model where it is not problematic for the trunk code to fail tests that have been reviewed by several sources. To make a new release we basically need to pass all tests we currently fail on trunk instead of trying to develop tests and code side by side. This would remove the need for the tests to be independent of the implementation. If people still prefer stability for their implementation in the html5lib trunk tree they could make a copy of the test suite and merge that everytime the test suite changes while updating their implementation. -- Anne van Kesteren &lt;<A HREF="http://annevankesteren.nl/">http://annevankesteren.nl/</A>&gt; &lt;<A HREF="http://www.opera.com/">http://www.opera.com/</A>&gt; </PRE> <!--endarticle--> <!--htdig_noindex--> <HR> <P><UL> <!--threads--> <LI>Previous message: <A HREF="000875.html">[imps] HTML5 parser test location </A></li> <LI>Next message: <A HREF="000879.html">[imps] HTML5 parser test location </A></li> <LI> <B>Messages sorted by:</B> <a href="date.html#876">[ date ]</a> <a href="thread.html#876">[ thread ]</a> <a href="subject.html#876">[ subject ]</a> <a href="author.html#876">[ author ]</a> </LI> </UL> <hr> <a href="http://lists.whatwg.org/listinfo.cgi/implementors-whatwg.org">More information about the Implementors mailing list</a><br> <!--/htdig_noindex--> </body></html>
40.9
192
0.646835
5111cd87c024b8911cf7ee7658e1b3c6d82f0bf8
13,825
c
C
ncc1/output.c
moneytech/ncc
ef6b9875a14d208d9fd5c3957499351aa3dde04f
[ "BSD-2-Clause" ]
9
2019-12-27T13:43:17.000Z
2022-03-12T16:52:33.000Z
ncc1/output.c
uael/ncc
ef6b9875a14d208d9fd5c3957499351aa3dde04f
[ "BSD-2-Clause" ]
null
null
null
ncc1/output.c
uael/ncc
ef6b9875a14d208d9fd5c3957499351aa3dde04f
[ "BSD-2-Clause" ]
3
2019-09-09T08:58:21.000Z
2021-12-30T15:58:55.000Z
/* Copyright (c) 2018 Charles E. Youse (charles@gnuless.org). All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "ncc1.h" #include <stdarg.h> /* write a register name to the output file. the T_* type bits are used solely as a hint to the proper size for integer registers. */ static output_reg(reg, ts) { static char *iregs[NR_REGS][4] = { { "al", "ax", "eax", "rax" }, { "dl", "dx", "edx", "rdx" }, { "cl", "cx", "ecx", "rcx" }, { "bl", "bx", "ebx", "rbx" }, { "sil", "si", "esi", "rsi" }, { "dil", "di", "edi", "rdi" }, { "bpl", "bp", "ebp", "rbp" }, { "spl", "sp", "esp", "rsp" }, { "r8b", "r8w", "r8d", "r8" }, { "r9b", "r9w", "r9d", "r9" }, { "r10b", "r10w", "r10d", "r10" }, { "r11b", "r11w", "r11d", "r11" }, { "r12b", "r12w", "r12d", "r12" }, { "r13b", "r13w", "r13d", "r13" }, { "r14b", "r14w", "r14d", "r14" }, { "r15b", "r15w", "r15d", "r15" } }; int i; if (R_IS_PSEUDO(reg)) { fprintf(output_file, "%c#%d", (reg & R_IS_FLOAT) ? 'f' : 'i', R_IDX(reg)); if (reg & R_IS_INTEGRAL) { if (ts & T_IS_BYTE) fputc('b', output_file); if (ts & T_IS_WORD) fputc('w', output_file); if (ts & T_IS_DWORD) fputc('d', output_file); if (ts & T_IS_QWORD) fputc('q', output_file); } } else { if (reg & R_IS_FLOAT) fprintf(output_file, "xmm%d", R_IDX(reg)); else { if (ts & T_IS_BYTE) i = 0; if (ts & T_IS_WORD) i = 1; if (ts & T_IS_DWORD) i = 2; if (ts & T_IS_QWORD) i = 3; fprintf(output_file, "%s", iregs[R_IDX(reg)][i]); } } } /* outputting operands is an easy, if messy, business. */ static output_operand(tree) struct tree * tree; { double lf; float f; int indexed; switch (tree->op) { case E_CON: if (tree->type->ts & T_FLOAT) { f = tree->u.con.f; fprintf(output_file, "0x%x", *((unsigned *) &f)); } else if (tree->type->ts & T_LFLOAT) { lf = tree->u.con.f; fprintf(output_file, "0x%lx", *((unsigned long *) &lf)); } else fprintf(output_file, "%ld", tree->u.con.i); break; case E_REG: output_reg(tree->u.reg, tree->type->ts); break; case E_IMM: case E_MEM: if (tree->op == E_MEM) { if (tree->type->ts & T_IS_BYTE) fprintf(output_file, "byte "); if (tree->type->ts & T_IS_WORD) fprintf(output_file, "word "); if (tree->type->ts & T_IS_DWORD) fprintf(output_file, "dword "); if (tree->type->ts & T_IS_QWORD) fprintf(output_file, "qword "); fputc('[', output_file); } if (tree->u.mi.rip) { fprintf(output_file, "rip "); output("%G", tree->u.mi.glob); if (tree->u.mi.ofs) { if (tree->u.mi.ofs > 0) fputc('+', output_file); fprintf(output_file, "%ld", tree->u.mi.ofs); } } else { indexed = 0; if (tree->u.mi.b != R_NONE) { output_reg(tree->u.mi.b, T_PTR); indexed++; } if (tree->u.mi.i != R_NONE) { fputc(',', output_file); output_reg(tree->u.mi.i, T_PTR); if (tree->u.mi.s > 1) fprintf(output_file, "*%d", tree->u.mi.s); indexed++; } if (tree->u.mi.glob) { if (indexed) fputc(',', output_file); output("%G", tree->u.mi.glob); } if (tree->u.mi.ofs) { if (tree->u.mi.glob && (tree->u.mi.ofs > 0)) fputc('+', output_file); else if (indexed) fputc(',', output_file); fprintf(output_file, "%ld", tree->u.mi.ofs); } } if (tree->op == E_MEM) fputc(']', output_file); break; default: error(ERROR_INTERNAL); } } /* write to the output file. the recognized specifiers are: %% (no argument) the literal '%' %L (int) an asm label %R (int, int) a register (with type bits) %G (struct symbol *) the assembler name of a global %O (struct tree *) an operand expression %s, %d, %x like printf() %X like %x, but for long any unrecognized specifiers will bomb */ #ifdef __STDC__ void output(char * fmt, ...) #else output(fmt) char * fmt; #endif { va_list args; struct symbol * symbol; int reg; int ts; va_start(args, fmt); while (*fmt) { if (*fmt == '%') { fmt++; switch (*fmt) { case '%': fputc('%', output_file); break; case 'd': fprintf(output_file, "%d", va_arg(args, int)); break; case 'L': fprintf(output_file, "L%d", va_arg(args, int)); break; case 's': fprintf(output_file, "%s", va_arg(args, char *)); break; case 'x': fprintf(output_file, "%x", va_arg(args, int)); break; case 'X': fprintf(output_file, "%lx", va_arg(args, long)); break; case 'G': symbol = va_arg(args, struct symbol *); if ((symbol->ss & (S_EXTERN | S_STATIC)) && (symbol->scope == SCOPE_GLOBAL) && symbol->id) fprintf(output_file, "_%s", symbol->id->data); else if (symbol->ss & (S_STATIC | S_EXTERN)) fprintf(output_file, "L%d", symbol->i); else error(ERROR_INTERNAL); break; case 'O': output_operand(va_arg(args, struct tree *)); break; case 'R': reg = va_arg(args, int); ts = va_arg(args, int); output_reg(reg, ts); break; default: error(ERROR_INTERNAL); } } else fputc(*fmt, output_file); fmt++; } va_end(args); } /* emit assembler directive to select the appropriate SEGMENT_*, if not already selected */ segment(new) { static int current = -1; if (new != current) { output("%s\n", (new == SEGMENT_TEXT) ? ".text" : ".data"); current = new; } } /* output 'length' bytes of 'string' to the assembler output. the caller is assumed to have selected the appropriate segment and emitted a label, if necessary. if 'length' exceeds the length of the string, the output is padded with zeroes. */ output_string(string, length) struct string * string; { int i = 0; while (i < length) { if (i % 16) output(","); else { if (i) output("\n"); output(" .byte "); } output("%d", (i >= string->length) ? 0 : string->data[i]); i++; } output("\n"); } /* conditional jump mnemonics. these must match the CC_* values in block.h. */ static char * jmps[] = { "jz", "jnz", "jg", "jle", "jge", "jl", "ja", "jbe", "jae", "jb", "jmp", "NEVER" }; /* instruction mnemonics. keyed to I_IDX() from insn.h */ static char *insns[] = { /* 0 */ "nop", "mov", "movsx", "movzx", "movss", /* 5 */ "movsd", "lea", "cmp", "ucomiss", "ucomisd", /* 10 */ "pxor", "cvtss2si", "cvtsd2si", "cvtsi2ss", "cvtsi2sd", /* 15 */ "cvtss2sd", "cvtsd2ss", "shl", "shr", "sar", /* 20 */ "add", "addss", "addsd", "sub", "subss", /* 25 */ "subsd", "imul", "mulss", "mulsd", "or", /* 30 */ "xor", "and", "cdq", "cqo", "div", /* 35 */ "idiv", "divss", "divsd", "cbw", "cwd", /* 40 */ "setz", "setnz", "setg", "setle", "setge", /* 45 */ "setl", "seta", "setbe", "setae", "setb", /* 50 */ "not", "neg", "push", "pop", "call", /* 55 */ "test", "ret", "inc", "dec" }; /* output a block. the main task of this function is to output the instructions -- a simple task. the debugging data is most of the work! */ static output_block1(block, du) struct block * block; { struct defuse * defuse; output("\n; "); switch (du) { case DU_USE: output("USE: "); break; case DU_DEF: output("DEF: "); break; case DU_IN: output(" IN: "); break; case DU_OUT: output("OUT: "); break; } for (defuse = block->defuses; defuse; defuse = defuse->link) { if (defuse->dus & du) { output("%R", defuse->symbol->reg, defuse->symbol->type->ts); if (defuse->reg != R_NONE) output("=%R", defuse->reg, defuse->symbol->type->ts); if (defuse->symbol->id) output("(%s)", defuse->symbol->id->data); if ((du == DU_OUT) && DU_TRANSIT(*defuse)) output("[dist %d]", defuse->distance); output(" "); } } } output_block(block) struct block * block; { struct insn * insn; int i; struct block * cessor; int n; if (g_flag) { output("\n; block %d", block->asm_label); if (block == entry_block) output(" ENTRY"); if (block == exit_block) output(" EXIT"); if (block->bs & B_RECON) output(" RECON"); else { output_block1(block, DU_IN); output_block1(block, DU_USE); output_block1(block, DU_DEF); output_block1(block, DU_OUT); } output("\n; %d predecessors:", block->nr_predecessors); for (n = 0; cessor = block_predecessor(block, n); ++n) output(" %d", cessor->asm_label); output("\n; %d successors:", block->nr_successors); for (n = 0; cessor = block_successor(block, n); ++n) output(" %s=%d", jmps[block_successor_cc(block, n)], cessor->asm_label); } output("\n%L:\n", block->asm_label); for (insn = block->first_insn; insn; insn = insn->next) { output(" %s ", insns[I_IDX(insn->opcode)]); for (i = 0; i < I_NR_OPERANDS(insn->opcode); i++) { if (i) output(","); output("%O", insn->operand[i]); } if ((insn->flags & INSN_FLAG_CC) && g_flag) output(" ; FLAG_CC"); output("\n"); } } /* called after the code generator is complete, to output all the function blocks. the main task of this function is to glue the successive blocks together with appropriate jump instructions, which is surprisingly tedious. */ output_function() { struct block * block; struct block * successor1; struct block * successor2; int cc1; block = first_block; segment(SEGMENT_TEXT); if (current_function->ss & S_EXTERN) output(".global %G\n", current_function); output("%G:\n", current_function); for (block = first_block; block; block = block->next) { output_block(block); successor1 = block_successor(block, 0); if (successor1) cc1 = block_successor_cc(block, 0); /* there's no glue if there aren't any successors (exit block) */ if (!successor1) continue; /* if there's only one successor, it should be unconditional, so emit a jump unless the target is being output next. */ if (block->nr_successors == 1) { if (cc1 != CC_ALWAYS) error(ERROR_INTERNAL); if (block->next != successor1) output(" jmp %L\n", successor1->asm_label); continue; } /* the only remaining case is that of two successors, which must have opposite condition codes. we make an extra effort here to emit unconditional branches, rather than conditional ones, to minimize the impact on the branch predictor. */ successor2 = block_successor(block, 1); if (block_successor_cc(block, 1) != CC_INVERT(cc1)) error(ERROR_INTERNAL); if (successor1 == block->next) output(" %s %L\n", jmps[CC_INVERT(cc1)], successor2->asm_label); else { output(" %s %L\n", jmps[cc1], successor1->asm_label); if (successor2 != block->next) output(" jmp %L\n", successor2->asm_label); } } }
32.606132
106
0.518843
d995b3a6abf64c7eff4f0e872410c33450cd6543
3,268
kt
Kotlin
libs/pandautils/src/main/java/com/instructure/pandautils/features/elementary/course/ElementaryCourseViewModel.kt
instructure/canvas-android
c54d4921767bb318356504bce515ec94c20795d6
[ "Apache-2.0" ]
93
2019-04-07T22:57:47.000Z
2022-02-27T20:20:22.000Z
libs/pandautils/src/main/java/com/instructure/pandautils/features/elementary/course/ElementaryCourseViewModel.kt
instructure/canvas-android
c54d4921767bb318356504bce515ec94c20795d6
[ "Apache-2.0" ]
939
2019-04-04T17:55:31.000Z
2022-03-31T14:57:48.000Z
libs/pandautils/src/main/java/com/instructure/pandautils/features/elementary/course/ElementaryCourseViewModel.kt
instructure/canvas-android
c54d4921767bb318356504bce515ec94c20795d6
[ "Apache-2.0" ]
72
2019-04-11T09:26:25.000Z
2022-03-02T13:44:12.000Z
/* * Copyright (C) 2021 - present Instructure, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.instructure.pandautils.features.elementary.course import android.content.res.Resources import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.instructure.canvasapi2.managers.TabManager import com.instructure.canvasapi2.models.CanvasContext import com.instructure.canvasapi2.models.Tab import com.instructure.canvasapi2.utils.Logger import com.instructure.canvasapi2.utils.exhaustive import com.instructure.pandautils.R import com.instructure.pandautils.mvvm.Event import com.instructure.pandautils.mvvm.ViewState import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.launch import javax.inject.Inject @HiltViewModel class ElementaryCourseViewModel @Inject constructor( private val tabManager: TabManager, private val resources: Resources ) : ViewModel() { val state: LiveData<ViewState> get() = _state private val _state = MutableLiveData<ViewState>() val data: LiveData<ElementaryCourseViewData> get() = _data private val _data = MutableLiveData<ElementaryCourseViewData>() fun getData(canvasContext: CanvasContext, forceNetwork: Boolean = false) { _state.postValue(ViewState.Loading) viewModelScope.launch { try { val tabs = tabManager.getTabsForElementaryAsync(canvasContext, forceNetwork).await().dataOrThrow val filteredTabs = tabs.filter { !it.isHidden }.sortedBy { it.position } val tabViewData = createTabs(filteredTabs) _data.postValue(ElementaryCourseViewData(tabViewData)) _state.postValue(ViewState.Success) } catch (e: Exception) { _state.postValue(ViewState.Error(resources.getString(R.string.error_loading_course_details))) Logger.e("Failed to load tabs") } } } private fun createTabs(tabs: List<Tab>): List<ElementaryCourseTab> { return tabs.map { val drawable = when (it.tabId) { Tab.HOME_ID -> resources.getDrawable(R.drawable.ic_home) Tab.SCHEDULE_ID -> resources.getDrawable(R.drawable.ic_schedule) Tab.MODULES_ID -> resources.getDrawable(R.drawable.ic_modules) Tab.GRADES_ID -> resources.getDrawable(R.drawable.ic_grades) Tab.RESOURCES_ID -> resources.getDrawable(R.drawable.ic_resources) else -> null } ElementaryCourseTab(drawable, it.label, it.htmlUrl) } } }
40.85
112
0.712668
fb2d6aae496ff4ad4fabb0d66b1352aeb341367a
150
go
Go
main.go
mccutchen/printenv
eeb93e426c1f632a1112c05ceb6f323f9e702eb9
[ "MIT" ]
null
null
null
main.go
mccutchen/printenv
eeb93e426c1f632a1112c05ceb6f323f9e702eb9
[ "MIT" ]
null
null
null
main.go
mccutchen/printenv
eeb93e426c1f632a1112c05ceb6f323f9e702eb9
[ "MIT" ]
null
null
null
package main import ( "fmt" "os" "sort" ) func main() { env := os.Environ() sort.Strings(env) for _, kv := range env { fmt.Println(kv) } }
9.375
25
0.573333
7ffa09e0b1dae09716dafafe31cbaa3729983619
4,178
go
Go
go/lib/slayers/path/hopfield.go
marcfrei/scion
73d2bf883525c94a6761b015a7af6055154af028
[ "Apache-2.0" ]
211
2017-12-12T21:40:49.000Z
2022-03-20T13:45:17.000Z
go/lib/slayers/path/hopfield.go
marcfrei/scion
73d2bf883525c94a6761b015a7af6055154af028
[ "Apache-2.0" ]
1,360
2017-11-30T18:29:31.000Z
2022-03-28T09:31:58.000Z
go/lib/slayers/path/hopfield.go
marcfrei/scion
73d2bf883525c94a6761b015a7af6055154af028
[ "Apache-2.0" ]
85
2017-11-30T16:30:21.000Z
2022-03-08T17:22:48.000Z
// Copyright 2020 Anapaya Systems // // 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 path import ( "encoding/binary" "time" "github.com/scionproto/scion/go/lib/serrors" ) const ( // HopLen is the size of a HopField in bytes. HopLen = 12 // MacLen is the size of the MAC of each HopField. MacLen = 6 ) // MaxTTL is the maximum age of a HopField in seconds. const MaxTTL = 24 * 60 * 60 // One day in seconds const expTimeUnit = MaxTTL / 256 // ~5m38s // HopField is the HopField used in the SCION and OneHop path types. // // The Hop Field has the following format: // 0 1 2 3 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // |r r r r r r I E| ExpTime | ConsIngress | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // | ConsEgress | | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + // | MAC | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // type HopField struct { // IngressRouterAlert flag. If the IngressRouterAlert is set, the ingress router (in // construction direction) will process the L4 payload in the packet. IngressRouterAlert bool // EgressRouterAlert flag. If the EgressRouterAlert is set, the egress router (in // construction direction) will process the L4 payload in the packet. EgressRouterAlert bool // Exptime is the expiry time of a HopField. The field is 1-byte long, thus there are 256 // different values available to express an expiration time. The expiration time expressed by // the value of this field is relative, and an absolute expiration time in seconds is computed // in combination with the timestamp field (from the corresponding info field) as follows // // Timestamp + (1 + ExpTime) * (24*60*60)/256 ExpTime uint8 // ConsIngress is the ingress interface ID in construction direction. ConsIngress uint16 // ConsEgress is the egress interface ID in construction direction. ConsEgress uint16 // Mac is the 6-byte Message Authentication Code to authenticate the HopField. Mac []byte } // DecodeFromBytes populates the fields from a raw buffer. The buffer must be of length >= // path.HopLen. func (h *HopField) DecodeFromBytes(raw []byte) error { if len(raw) < HopLen { return serrors.New("HopField raw too short", "expected", HopLen, "actual", len(raw)) } h.EgressRouterAlert = raw[0]&0x1 == 0x1 h.IngressRouterAlert = raw[0]&0x2 == 0x2 h.ExpTime = raw[1] h.ConsIngress = binary.BigEndian.Uint16(raw[2:4]) h.ConsEgress = binary.BigEndian.Uint16(raw[4:6]) h.Mac = append([]byte(nil), raw[6:6+MacLen]...) return nil } // SerializeTo writes the fields into the provided buffer. The buffer must be of length >= // path.HopLen. func (h *HopField) SerializeTo(b []byte) error { if len(b) < HopLen { return serrors.New("buffer for HopField too short", "expected", MacLen, "actual", len(b)) } b[0] = 0 if h.EgressRouterAlert { b[0] |= 0x1 } if h.IngressRouterAlert { b[0] |= 0x2 } b[1] = h.ExpTime binary.BigEndian.PutUint16(b[2:4], h.ConsIngress) binary.BigEndian.PutUint16(b[4:6], h.ConsEgress) copy(b[6:12], h.Mac) return nil } // ExpTimeToDuration calculates the relative expiration time in seconds. // Note that for a 0 value ExpTime, the minimal duration is expTimeUnit. func ExpTimeToDuration(expTime uint8) time.Duration { return (time.Duration(expTime) + 1) * time.Duration(expTimeUnit) * time.Second }
37.303571
95
0.637865
d29cbad095429815035332c67dfeccdbd42b77c8
6,759
php
PHP
api/app/Timeline/Infrastructure/Persistence/Eloquent/Repositories/EloquentUserRepository.php
mingchaoliao/timeline
b62c4cdc911467ebf8be501630fe65e77e72b253
[ "Apache-2.0" ]
null
null
null
api/app/Timeline/Infrastructure/Persistence/Eloquent/Repositories/EloquentUserRepository.php
mingchaoliao/timeline
b62c4cdc911467ebf8be501630fe65e77e72b253
[ "Apache-2.0" ]
7
2020-09-04T11:04:57.000Z
2022-02-26T04:44:46.000Z
api/app/Timeline/Infrastructure/Persistence/Eloquent/Repositories/EloquentUserRepository.php
mingchaoliao/timeline
b62c4cdc911467ebf8be501630fe65e77e72b253
[ "Apache-2.0" ]
null
null
null
<?php /** * Created by PhpStorm. * User: ubuntu * Date: 6/21/18 * Time: 9:24 PM */ namespace App\Timeline\Infrastructure\Persistence\Eloquent\Repositories; use App\Timeline\Domain\Collections\UserCollection; use App\Timeline\Domain\Models\User; use App\Timeline\Domain\Models\UserToken; use App\Timeline\Domain\Repositories\UserRepository; use App\Timeline\Domain\ValueObjects\Email; use App\Timeline\Domain\ValueObjects\UserId; use App\Timeline\Exceptions\TimelineException; use App\Timeline\Infrastructure\Persistence\Eloquent\Models\EloquentUser; use Illuminate\Contracts\Hashing\Hasher; use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\QueryException; use Tymon\JWTAuth\JWTGuard; class EloquentUserRepository implements UserRepository { /** * @var EloquentUser */ private $userModel; /** * @var Hasher */ private $hasher; /** * @var JWTGuard */ private $guard; /** * EloquentUserRepository constructor. * @param EloquentUser $userModel * @param Hasher $hasher * @param JWTGuard $guard */ public function __construct(EloquentUser $userModel, Hasher $hasher, JWTGuard $guard) { $this->userModel = $userModel; $this->hasher = $hasher; $this->guard = $guard; } /** * @return User|null */ public function getCurrentUser(): ?User { if (!$this->guard->check()) { return null; } /** @var EloquentUser $eloquentUser */ $eloquentUser = $this->guard->user(); return $this->constructUser($eloquentUser); } public function getByEmail(Email $email): ?User { $eloquentUser = $this->userModel->where('email', (string)$email)->first(); if ($eloquentUser === null) { return null; } return $this->constructUser($eloquentUser); } /** * @param Email $email * @param string $password * @return UserToken * @throws TimelineException */ public function login(Email $email, string $password): UserToken { /** @var EloquentUser|null $user */ $user = $this->userModel->where('email', $email->getValue())->first(); if ($user === null) { throw TimelineException::ofUserWithEmailDoesNotFound($email); } if (!$user->isActive()) { throw TimelineException::ofUserAccountIsLocked(); } $token = $this->guard->attempt([ 'email' => $email->getValue(), 'password' => $password ]); if ($token === false) { throw TimelineException::ofInvalidCredentials(); } return new UserToken( 'Bearer', $token ); } public function validatePassword(UserId $id, string $password): bool { /** @var EloquentUser $eloquentUser */ $eloquentUser = $this->userModel->find($id->getValue()); if ($eloquentUser === null) { return false; } return $this->hasher->check($password, $eloquentUser->getPasswordHash()); } /** * @return UserCollection */ public function getAll(): UserCollection { return $this->constructUserCollection($this->userModel->orderBy('id')->get()); } /** * @param string $name * @param Email $email * @param string $password * @param bool $isAdmin * @param bool $isEditor * @return User * @throws TimelineException */ public function create( string $name, Email $email, string $password, bool $isAdmin = false, bool $isEditor = false ): User { try { $passwordHash = $this->hasher->make($password); $eloquentUser = $this->userModel ->create([ 'name' => $name, 'email' => $email, 'password' => $passwordHash, 'is_admin' => $isAdmin ? 1 : 0, 'is_editor' => $isEditor ? 1 : 0 ]); return $this->constructUser($eloquentUser); } catch (QueryException $e) { $errorInfo = $e->errorInfo; if ($errorInfo[1] === 1062) { // duplicated email throw TimelineException::ofDuplicatedUserEmail($email, $e); } throw $e; } } /** * @param UserId $id * @param null|string $name * @param null|string $password * @param bool|null $isAdmin * @param bool|null $isEditor * @param bool|null $isActive * @return User * @throws TimelineException */ public function update( UserId $id, ?string $name = null, ?string $password = null, ?bool $isAdmin = null, ?bool $isEditor = null, ?bool $isActive = null ): User { $eloquentUser = $this->userModel->find($id->getValue()); if ($eloquentUser === null) { throw TimelineException::ofUserWithIdDoesNotExist($id); } $update = []; if ($name !== null) { $update['name'] = $name; } if ($password !== null) { $passwordHash = $this->hasher->make($password); $update['password'] = $passwordHash; } if ($isAdmin !== null) { $update['is_admin'] = $isAdmin ? 1 : 0; } if ($isEditor !== null) { $update['is_editor'] = $isEditor ? 1 : 0; } if ($isActive !== null) { $update['is_active'] = $isActive ? 1 : 0; } if (count($update) !== 0) { $eloquentUser->update($update); } return $this->constructUser($this->userModel->find($id->getValue())); } /** * @param EloquentUser $eloquentUser * @return User */ private function constructUser(EloquentUser $eloquentUser): User { return new User( new UserId($eloquentUser->getId()), $eloquentUser->getName(), new Email($eloquentUser->getEmail()), $eloquentUser->isAdmin(), $eloquentUser->isEditor(), $eloquentUser->isActive(), $eloquentUser->getCreatedAt(), $eloquentUser->getUpdatedAt() ); } /** * @param Collection $eloquentUsers * @return UserCollection */ private function constructUserCollection(Collection $eloquentUsers): UserCollection { return new UserCollection( $eloquentUsers->map(function (EloquentUser $eloquentUser) { return $this->constructUser($eloquentUser); })->toArray() ); } }
26.402344
89
0.549046
33d7474d677e13911d190593aa4420a125b1d4b5
638
sql
SQL
src/database/data/appliedInsert.sql
vietdanh1899/be-it-network
7a9511c0c9ab05c79277fe93ecf0703d79dde5f2
[ "MIT" ]
null
null
null
src/database/data/appliedInsert.sql
vietdanh1899/be-it-network
7a9511c0c9ab05c79277fe93ecf0703d79dde5f2
[ "MIT" ]
null
null
null
src/database/data/appliedInsert.sql
vietdanh1899/be-it-network
7a9511c0c9ab05c79277fe93ecf0703d79dde5f2
[ "MIT" ]
null
null
null
CREATE OR ALTER TRIGGER trigger_applied ON [dbo].[applied_job] FOR INSERT AS BEGIN DECLARE @jobId varchar(256) DECLARE @userId varchar(256) DECLARE @rating int SELECT @userId = INSERTED.userId FROM INSERTED SELECT @jobId = inserted.jobId FROM INSERTED BEGIN BEGIN TRY BEGIN TRANSACTION IF EXISTS (SELECT TOP 1 ID FROM [dbo].[user_rating] where userId = @userId and jobId = @jobId) UPDATE [dbo].[user_rating] SET rating = 5 where userId = @userId and jobId = @jobId ELSE INSERT INTO [dbo].[user_rating](jobId, userId, rating) VALUES (@jobId, @userId, 5) COMMIT END TRY BEGIN CATCH ROLLBACK TRANSACTION END CATCH END END
25.52
96
0.747649
e8f5e5aaaf237abae1b7ee4f6b5a71282972a181
428
py
Python
snapmerge/home/migrations/0010_project_email.py
R4356th/smerge
2f2a6a4acfe3903ed4f71d90537f7277248e8b59
[ "MIT" ]
13
2018-07-16T09:59:55.000Z
2022-01-27T19:07:17.000Z
snapmerge/home/migrations/0010_project_email.py
R4356th/smerge
2f2a6a4acfe3903ed4f71d90537f7277248e8b59
[ "MIT" ]
55
2018-07-16T12:17:58.000Z
2022-03-17T16:10:30.000Z
snapmerge/home/migrations/0010_project_email.py
R4356th/smerge
2f2a6a4acfe3903ed4f71d90537f7277248e8b59
[ "MIT" ]
4
2019-10-10T20:16:49.000Z
2021-03-12T07:15:50.000Z
# Generated by Django 2.0.1 on 2018-07-26 12:51 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('home', '0009_auto_20180726_1214'), ] operations = [ migrations.AddField( model_name='project', name='email', field=models.EmailField(blank=True, max_length=254, null=True, verbose_name='Email'), ), ]
22.526316
97
0.61215
b1a7de4f0ba2b920b6a619943e92e4fd56428ac1
298
h
C
tutoriat-poo-02/Seria MI 21/pb05/headers/Casa.h
MaximTiberiu/Tutoriat-POO-2021-2022
73170623979ad3786007344c05e588f7f64f6435
[ "MIT" ]
null
null
null
tutoriat-poo-02/Seria MI 21/pb05/headers/Casa.h
MaximTiberiu/Tutoriat-POO-2021-2022
73170623979ad3786007344c05e588f7f64f6435
[ "MIT" ]
null
null
null
tutoriat-poo-02/Seria MI 21/pb05/headers/Casa.h
MaximTiberiu/Tutoriat-POO-2021-2022
73170623979ad3786007344c05e588f7f64f6435
[ "MIT" ]
null
null
null
#ifndef PB05_CASA_H #define PB05_CASA_H #include "Client.h" class Casa { private: int numarCasa; std::vector<Client> clienti; public: Casa() = default; ~Casa() = default; Casa(int numarCasa, const std::vector<Client> &clienti); void serveste(); }; #endif //PB05_CASA_H
14.9
60
0.661074
fb42403f30b67d4a8e8bbfe6a47ca17e3a28b2a3
205
h
C
GCNL_Athena_LlamaRoaster_Firing_classes.h
NotDiscordOfficial/Fortnite_SDK
58f8da148256f99cb35518003306fffee33c4a21
[ "MIT" ]
null
null
null
GCNL_Athena_LlamaRoaster_Firing_classes.h
NotDiscordOfficial/Fortnite_SDK
58f8da148256f99cb35518003306fffee33c4a21
[ "MIT" ]
null
null
null
GCNL_Athena_LlamaRoaster_Firing_classes.h
NotDiscordOfficial/Fortnite_SDK
58f8da148256f99cb35518003306fffee33c4a21
[ "MIT" ]
1
2021-07-22T00:31:44.000Z
2021-07-22T00:31:44.000Z
// BlueprintGeneratedClass GCNL_Athena_LlamaRoaster_Firing.GCNL_Athena_LlamaRoaster_Firing_C // Size: 0x7d0 (Inherited: 0x7d0) struct AGCNL_Athena_LlamaRoaster_Firing_C : AFortGameplayCueNotify_Loop { };
34.166667
92
0.863415
bb58534d2a40d29452708ebe91ce0f48f74581db
3,416
html
HTML
_includes/services.html
pixiestavern/american-chestnut-foundation
5e3f7aa45f48ed37973a45ee85c90304f575b83f
[ "Apache-2.0" ]
null
null
null
_includes/services.html
pixiestavern/american-chestnut-foundation
5e3f7aa45f48ed37973a45ee85c90304f575b83f
[ "Apache-2.0" ]
null
null
null
_includes/services.html
pixiestavern/american-chestnut-foundation
5e3f7aa45f48ed37973a45ee85c90304f575b83f
[ "Apache-2.0" ]
null
null
null
<!-- Services Section --> <section id="services"> <div class="container"> <div class="row"> <div class="col-lg-12 text-center"> <h2 class="section-heading">Services</h2> <h3 class="section-subheading text-muted">What is a Heritage Educational Forest?</h3> </div> </div> <div class="row text-center"> <div class="col-md-4"> <span class="fa-stack fa-4x"> <i class="fa fa-circle fa-stack-2x text-primary"></i> <i class="fa fa-book fa-stack-1x fa-inverse"></i> </span> <h4 class="service-heading">Heritage Forest Lessons</h4> <p class="text-muted">Visit our Heritage Forest in Hickory, NC and learn about the history of the American Chestnut tree while walking amongst them. Visitors will also learn about other heritage trees that played an instrumental part of Appalachian history. Each visitor will be able to utilize an American Chestnut Learning Box that includes nuts, burs and leaves from American and Chinese chestnut trees, a chestnut “tree cookie” (tree ring slice), five different types of wood blocks, chestnut tree sections showing inoculation sites and chestnut blight, and a binder with explanatory fact sheets for each sample and learning materials.</p> </div> <div class="col-md-4"> <span class="fa-stack fa-4x"> <i class="fa fa-circle fa-stack-2x text-primary"></i> <i class="fa fa-pagelines fa-stack-1x fa-inverse"></i> </span> <h4 class="service-heading">A Night In the Woods</h4> <p class="text-muted">A special event to raise funds and awareness for The American Chestnut Foundation and the Heritage Educational Forest. Individuals and families will be able to purchase tickets to have an overnight camping experience suspended from tree branches in the Heritage Educational Forest. Special hammocks will be cabled to branches allowing campers a bird’s eye view of the natural habitat of the American Chestnut. For those wanting to stay on the ground tents will be erected around the communal fire pit. All participants will learn about The Eastern Forest Ecosystem from American Chestnut Foundation experts. .</p> </div> <div class="col-md-4"> <span class="fa-stack fa-4x"> <i class="fa fa-circle fa-stack-2x text-primary"></i> <i class="fa fa-home fa-stack-1x fa-inverse"></i> </span> <h4 class="service-heading">Indoor Learning Spaces</h4> <p class="text-muted">We were fortunate to have an old farmstead at the Heritage Educational Forest. In the main farmhouse there are several rooms for indoor learning and research. There is also a room dedicated to the history of the American Chestnut in the Appalachian region since it was such an integral part of the society. These can also be rented out for special events. You will also discover a gift shop with a variety of local crafts, books, movies, and American Chestnut memorabilia.</p> </div> </div> </div> </section>
89.894737
663
0.625293
856b657a6573678698678845ba843989573eeb21
374
js
JavaScript
controller/test/servo.test.js
marc-despland/camera-multispectral
ca58454e1dda87044f77ad519241a51f1e83e056
[ "Apache-2.0" ]
null
null
null
controller/test/servo.test.js
marc-despland/camera-multispectral
ca58454e1dda87044f77ad519241a51f1e83e056
[ "Apache-2.0" ]
null
null
null
controller/test/servo.test.js
marc-despland/camera-multispectral
ca58454e1dda87044f77ad519241a51f1e83e056
[ "Apache-2.0" ]
null
null
null
const assert = require('assert'); const chai = require('chai'); const chaiAsPromised = require('chai-as-promised'); chai.use(chaiAsPromised); const expect = chai.expect; const Gpio = require('pigpio').Gpio; describe('PiGpio', () => { it('servo move', async () => { const motor = new Gpio(18, {mode: Gpio.OUTPUT}); motor.servoWrite(1000); }); });
22
56
0.625668
e721a02c1820eae821b7b389cc4dd0386da9cd17
5,397
js
JavaScript
src/XmlWriter.js
Dintero/njs-tfso-xml
7d2864815ae23a267a108cb1639a4994ac891d06
[ "MIT" ]
null
null
null
src/XmlWriter.js
Dintero/njs-tfso-xml
7d2864815ae23a267a108cb1639a4994ac891d06
[ "MIT" ]
null
null
null
src/XmlWriter.js
Dintero/njs-tfso-xml
7d2864815ae23a267a108cb1639a4994ac891d06
[ "MIT" ]
1
2021-03-04T09:48:35.000Z
2021-03-04T09:48:35.000Z
const DOMImplementation = require('xmldom').DOMImplementation const XMLSerializer = require('xmldom').XMLSerializer const DOMParser = require('xmldom').DOMParser const XmlReader = require('./XmlReader') class XmlWriter{ /** * @param {Document} doc * @param {Element} elem */ constructor(doc, elem){ this._doc = doc this._elem = elem } /** * @param namespace * @param namespaceURI * @param schemaLocation * @param documentName * @returns {XmlWriter} */ static create(namespace, namespaceURI, schemaLocation, documentName = 'Document'){ const {xmlWriter, doc, documentElement} = this.createRaw(namespace, documentName, 'version="1.0" encoding="utf-8"') if(namespaceURI && schemaLocation){ documentElement.setAttribute('xmlns:xsi', namespaceURI) documentElement.setAttribute('xsi:schemaLocation', schemaLocation) } return xmlWriter } static createRaw(namespace, documentName, processingIntruction = 'version="1.0" encoding="utf-8"') { const dom = new DOMImplementation() const doc = dom.createDocument(namespace, documentName) doc.insertBefore(doc.createProcessingInstruction('xml', processingIntruction), doc.documentElement) const documentElement = doc.documentElement const xmlWriter = new XmlWriter(doc, documentElement) return {xmlWriter, doc, documentElement} } /** * @param {XmlReader} reader * @returns {*} */ static fromReader(reader){ const writer = XmlWriter.create('', '', '', reader.currentTag) /** * @param {XmlReader} reader * @param {XmlWriter} writer */ let write = (reader, writer) => { for(let key of reader.keys()){ for(let obj of reader.asArray(key)){ const writeChildren = nextWriter => write(obj, nextWriter) writer.add(key, writeChildren, obj.attributes(), obj.val()) } } } write(reader, writer) return writer } /** * @callback elementCallback * @param {XmlWriter} */ /** * @param {string} path * @param {elementCallback|*} valueOrFunctionOrNull * @param {Object|null} attributes * @param value * @returns {XmlWriter} */ add(path, valueOrFunctionOrNull = null, attributes = null, value = null){ this.addAndGet(path, valueOrFunctionOrNull, attributes, value) return this } /** * Ex: * // simple element creation * writer.adds('node', ['a','b']) * <node>a<node> * <node>b<node> * // or a custom element creation * writer.adds('node', ['a','b'], (node, str) => node * .add('Id', str) * ) * <node><Id>a</Id><node> * <node><Id>b</Id><node> * @param {string} path * @param {Array} values * @param {elementCallback|*} valueOrFunctionOrNull * @param {Object|null} attributes * @returns {XmlWriter} */ adds(path, values, valueOrFunctionOrNull = null, attributes = null){ valueOrFunctionOrNull = valueOrFunctionOrNull || ((writer, value) => writer.setVal(value)) values.forEach(value =>{ this.addAndGet(path, (writer) => valueOrFunctionOrNull(writer, value), attributes) }) return this } /** * @param {string} path * @param {elementCallback|*} valueOrFunctionOrNull * @param {Object|null} attributes * @param value * @returns {XmlWriter} */ addAndGet(path, valueOrFunctionOrNull = null, attributes = null, value = null){ const parts = path.split('.') const firstPath = parts[0] const remainingPath = parts.slice(1).join('.') const elem = this._doc.createElementNS(this._doc.documentElement.namespaceURI, firstPath) this._elem.appendChild(elem) const writer = new XmlWriter(this._doc, elem) if(remainingPath.length === 0){ if(typeof valueOrFunctionOrNull === 'function'){ if(value !== null){ writer.setVal(value) } valueOrFunctionOrNull(writer) }else if(valueOrFunctionOrNull !== null){ writer.setVal(valueOrFunctionOrNull) } if(attributes !== null){ Object.keys(attributes).forEach(name => { writer.setAttr(name, attributes[name]) }) } return writer } return writer.addAndGet(remainingPath, valueOrFunctionOrNull, attributes) } setValRaw(raw){ const parser = new DOMParser() this._elem.appendChild(parser.parseFromString(raw)) return this } setVal(value){ this._elem.textContent = value return this } setAttr(name, value){ this._elem.setAttribute(name, value) return this } toString(){ const s = new XMLSerializer() return s.serializeToString(this._doc) } /** * toString of the current document element */ toFragmentString(){ const s = new XMLSerializer() return s.serializeToString(this._elem) } } module.exports = XmlWriter
29.491803
123
0.579396
40b82acc9b5e32bb62885f0c4ff0ceb661d4c207
480
py
Python
Algorithms/Medium/287. Find the Duplicate Number/answer.py
KenWoo/Algorithm
4012a2f0a099a502df1e5df2e39faa75fe6463e8
[ "Apache-2.0" ]
null
null
null
Algorithms/Medium/287. Find the Duplicate Number/answer.py
KenWoo/Algorithm
4012a2f0a099a502df1e5df2e39faa75fe6463e8
[ "Apache-2.0" ]
null
null
null
Algorithms/Medium/287. Find the Duplicate Number/answer.py
KenWoo/Algorithm
4012a2f0a099a502df1e5df2e39faa75fe6463e8
[ "Apache-2.0" ]
null
null
null
from typing import List class Solution: def findDuplicate(self, nums: List[int]) -> int: t = h = nums[0] while True: t = nums[t] h = nums[nums[h]] if t == h: break p1 = nums[0] p2 = t while p1 != p2: p1 = nums[p1] p2 = nums[p2] return p1 if __name__ == "__main__": s = Solution() result = s.findDuplicate([3, 1, 3, 4, 2]) print(result)
20
52
0.445833
dd5fd6f73a35c45be5d2fb5fc5545571700ec5dc
339
swift
Swift
ConciseRx/Sources/Dispose.swift
ConciseMVVM/concise-ios
1e3360eec2ae573e339c8e0373626475596b1cc9
[ "MIT" ]
null
null
null
ConciseRx/Sources/Dispose.swift
ConciseMVVM/concise-ios
1e3360eec2ae573e339c8e0373626475596b1cc9
[ "MIT" ]
null
null
null
ConciseRx/Sources/Dispose.swift
ConciseMVVM/concise-ios
1e3360eec2ae573e339c8e0373626475596b1cc9
[ "MIT" ]
null
null
null
// // Dispose.swift // ConciseRx // // Created by Ethan Nagel on 2/27/20. // Copyright © 2020 Product Ops. All rights reserved. // import Foundation import Concise import RxSwift extension Subscription { public func asDisposable() -> Disposable { return Disposables.create { self.dispose() } } }
16.142857
54
0.637168
7011270d2e3f07e43107bf8c6b6d4595698556cb
457
go
Go
main/600-699/610C.go
lpi/codeforces-go
4f8e6a02c9bdce277c9a1c32012523d9739b867c
[ "MIT" ]
659
2019-10-07T00:58:10.000Z
2022-03-31T03:50:37.000Z
main/600-699/610C.go
ShuangpengPang/codeforces-go
c23295c1345310dea35b045264103069e2e446e7
[ "MIT" ]
1
2020-07-06T10:34:08.000Z
2020-11-15T05:54:54.000Z
main/600-699/610C.go
ShuangpengPang/codeforces-go
c23295c1345310dea35b045264103069e2e446e7
[ "MIT" ]
92
2020-11-17T13:06:17.000Z
2022-03-21T15:57:13.000Z
package main import ( "bufio" . "fmt" "io" "math/bits" ) // github.com/EndlessCheng/codeforces-go func CF610C(in io.Reader, _w io.Writer) { out := bufio.NewWriter(_w) defer out.Flush() var k int Fscan(in, &k) n := 1 << k for i := 0; i < n; i++ { for j := 0; j < n; j++ { if bits.OnesCount(uint(i&j))&1 > 0 { Fprint(out, "*") } else { Fprint(out, "+") } } Fprintln(out) } } //func main() { CF610C(os.Stdin, os.Stdout) }
14.741935
45
0.544858
71033b4f73daca0eb1d935558f8a360bbf9973b1
2,906
tsx
TypeScript
client/src/components/TodoAdder.tsx
berakoc/todo-app
f78ca42fc36f2832093a038df7ef0c3115b7c219
[ "MIT" ]
null
null
null
client/src/components/TodoAdder.tsx
berakoc/todo-app
f78ca42fc36f2832093a038df7ef0c3115b7c219
[ "MIT" ]
null
null
null
client/src/components/TodoAdder.tsx
berakoc/todo-app
f78ca42fc36f2832093a038df7ef0c3115b7c219
[ "MIT" ]
null
null
null
import React, { Component } from 'react' import './TodoAdder.css' import Input from './native/Input' import TextArea from './native/TextArea' import Button from './native/Button' import Card from './native/Card' import Utils from '../libs/Utils' import Middleware from '../libs/Middleware' import { CardHandleOption } from '../libs/Enums' interface TodoProps { addTodoCard(card: JSX.Element | void): void removeTodoCard(card: JSX.Element, option: CardHandleOption | void): void } interface TodoAdderState { title: string content: string getTitle?: {(): string} getContent?: {(): string} emitTitleWarning?: {(): void} resetTitle?: {(): void} resetContent?: {(): void} emitContentWarning?: {(): void} } export default class TodoAdder extends Component<TodoProps, TodoAdderState> { private titleRef: (input: Input) => void private contentRef: (textArea: TextArea) => void constructor(props: TodoProps) { super(props) this.state = { title: '', content: '' } this.titleRef = (input: Input) => { this.setState({ getTitle: input.getTitle, resetTitle: input.resetTitle, emitTitleWarning: input.emitWarning }) } this.contentRef = (textArea: TextArea) => { this.setState({ getContent: textArea.getContent, resetContent: textArea.resetContent, emitContentWarning: textArea.emitWarning }) } this.handleClick = this.handleClick.bind(this) } handleClick() { this.setState({ title: this.state.getTitle!(), content: this.state.getContent!() }, () => { if (this.state.title === '') { this.state.emitTitleWarning!() return } if (this.state.content === '') { this.state.emitContentWarning!() } if (!(this.state.title && this.state.content)) return const date = Utils.convertDateToString(new Date()) Middleware.addTodo({ title: this.state.title, content: this.state.content, isFinished: false, date }) this.props.addTodoCard(<Card handleClick={this.props.removeTodoCard} title={this.state.title} content={this.state.content} date={date} />) this.state.resetTitle!() this.state.resetContent!() }) } render() { return ( <div id="TodoAdder"> <Input ref={this.titleRef} type="text" placeHolder="Title"/> <TextArea ref={this.contentRef} title="Content"/> <Button colorName="color-primary" text="add" handler={this.handleClick}/> </div> ) } }
32.651685
150
0.556779
cb249efa684f0cc05a1cda9fa291969e247fe24c
582
h
C
conservator-framework/src/ExistsBuilderImpl.h
gatech-cc/conservator
06e3e845e78a26bba173439b2f526ef96fb69f4e
[ "Apache-2.0" ]
20
2016-07-01T22:47:24.000Z
2021-02-26T03:59:15.000Z
conservator-framework/src/ExistsBuilderImpl.h
gatech-cc/conservator
06e3e845e78a26bba173439b2f526ef96fb69f4e
[ "Apache-2.0" ]
7
2015-12-07T14:44:12.000Z
2017-10-06T19:51:47.000Z
conservator-framework/src/ExistsBuilderImpl.h
gatech-cc/conservator
06e3e845e78a26bba173439b2f526ef96fb69f4e
[ "Apache-2.0" ]
11
2015-12-06T21:24:30.000Z
2020-10-08T20:07:02.000Z
// // Created by Ray Jenkins on 4/28/15. // #ifndef CONSERVATOR_EXISTSBUILDERIMPL_H #define CONSERVATOR_EXISTSBUILDERIMPL_H #include <stdbool.h> #include <zookeeper.h> #include "ExistsBuilder.h" class ExistsBuilderImpl : public ExistsBuilder<int> { public: virtual ~ExistsBuilderImpl() { } ExistsBuilderImpl(zhandle_t *zk); Pathable<int>* withWatcher(watcher_fn watcherFn, void * watcherCtx); ZOOAPI int forPath(string path); private: zhandle_t *zk; watcher_fn watcherFn = NULL; void * watcherCtx = NULL; }; #endif //CONSERVATOR_EXISTSBUILDERIMPL_H
22.384615
72
0.74055
34985a9d8bffdc6ef59d6aa8a3adb3f3cb64c1c1
22,584
asm
Assembly
src/pm/smx/_vflat.asm
OS2World/DEV-UTIL-ScitechOS_PML
fd285be7203a6bac25aebd0a856fa17058c8a4c0
[ "Naumen", "Condor-1.1", "MS-PL" ]
null
null
null
src/pm/smx/_vflat.asm
OS2World/DEV-UTIL-ScitechOS_PML
fd285be7203a6bac25aebd0a856fa17058c8a4c0
[ "Naumen", "Condor-1.1", "MS-PL" ]
null
null
null
src/pm/smx/_vflat.asm
OS2World/DEV-UTIL-ScitechOS_PML
fd285be7203a6bac25aebd0a856fa17058c8a4c0
[ "Naumen", "Condor-1.1", "MS-PL" ]
null
null
null
;**************************************************************************** ;* ;* SciTech OS Portability Manager Library ;* ;* ======================================================================== ;* ;* The contents of this file are subject to the SciTech MGL Public ;* License Version 1.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.scitechsoft.com/mgl-license.txt ;* ;* Software distributed under the License is distributed on an ;* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or ;* implied. See the License for the specific language governing ;* rights and limitations under the License. ;* ;* The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. ;* ;* The Initial Developer of the Original Code is SciTech Software, Inc. ;* All Rights Reserved. ;* ;* ======================================================================== ;* ;* Based on original code Copyright 1994 Otto Chrons ;* ;* Language: 80386 Assembler, TASM 4.0 or later ;* Environment: IBM PC 32 bit protected mode ;* ;* Description: Low level page fault handler for virtual linear framebuffers. ;* ;**************************************************************************** IDEAL JUMPS include "scitech.mac" ; Memory model macros header _vflat ; Set up memory model VFLAT_START EQU 0F0000000h VFLAT_END EQU 0F03FFFFFh PAGE_PRESENT EQU 1 PAGE_NOTPRESENT EQU 0 PAGE_READ EQU 0 PAGE_WRITE EQU 2 ifdef DOS4GW ;---------------------------------------------------------------------------- ; DOS4G/W flat linear framebuffer emulation. ;---------------------------------------------------------------------------- begdataseg _vflat ; Near pointers to the page directory base and our page tables. All of ; this memory is always located in the first Mb of DOS memory. PDBR dd 0 ; Page directory base register (CR3) accessPageAddr dd 0 accessPageTable dd 0 ; CauseWay page directory & 1st page table linear addresses. CauseWayDIRLinear dd 0 CauseWay1stLinear dd 0 ; Place to store a copy of the original Page Table Directory before we ; intialised our virtual buffer code. pageDirectory: resd 1024 ; Saved page table directory ValidCS dw 0 ; Valid CS for page faults Ring0CS dw 0 ; Our ring 0 code selector LastPage dd 0 ; Last page we mapped in BankFuncBuf: resb 101 ; Place to store bank switch code BankFuncPtr dd offset BankFuncBuf INT14Gate: INT14Offset dd 0 ; eip of original vector INT14Selector dw 0 ; cs of original vector cextern _PM_savedDS,USHORT cextern VF_haveCauseWay,BOOL enddataseg _vflat begcodeseg _vflat ; Start of code segment cextern VF_malloc,FPTR ;---------------------------------------------------------------------------- ; PF_handler64k - Page fault handler for 64k banks ;---------------------------------------------------------------------------- ; The handler below is a 32 bit ring 0 page fault handler. It receives ; control immediately after any page fault or after an IRQ6 (hardware ; interrupt). This provides the fastest possible handling of page faults ; since it jump directly here. If this is a page fault, the number ; immediately on the stack will be an error code, at offset 4 will be ; the eip of the faulting instruction, at offset 8 will be the cs of the ; faulting instruction. If it is a hardware interrupt, it will not have ; the error code and the eflags will be at offset 8. ;---------------------------------------------------------------------------- cprocfar PF_handler64k ; Check if this is a processor exeception or a page fault push eax mov ax,[cs:ValidCS] ; Use CS override to access data cmp [ss:esp+12],ax ; Is this a page fault? jne @@ToOldHandler ; Nope, jump to the previous handler ; Get address of page fault and check if within our handlers range mov eax,cr2 ; EBX has page fault linear address cmp eax,VFLAT_START ; Is the fault less than ours? jb @@ToOldHandler ; Yep, go to previous handler cmp eax,VFLAT_END ; Is the fault more than ours? jae @@ToOldHandler ; Yep, go to previous handler ; This is our page fault, so we need to handle it pushad push ds push es mov ebx,eax ; EBX := page fault address and ebx,invert 0FFFFh ; Mask to 64k bank boundary mov ds,[cs:_PM_savedDS]; Load segment registers mov es,[cs:_PM_savedDS] ; Map in the page table for our virtual framebuffer area for modification mov edi,[PDBR] ; EDI points to page directory mov edx,ebx ; EDX = linear address shr edx,22 ; EDX = offset to page directory mov edx,[edx*4+edi] ; EDX = physical page table address mov eax,edx mov edx,[accessPageTable] or eax,7 mov [edx],eax mov eax,cr3 mov cr3,eax ; Update page table cache ; Mark all pages valid for the new page fault area mov esi,ebx ; ESI := linear address for page shr esi,10 and esi,0FFFh ; Offset into page table add esi,[accessPageAddr] ifdef USE_NASM %assign off 0 %rep 16 or [DWORD esi+off],0000000001h ; Enable pages %assign off off+4 %endrep else off = 0 REPT 16 or [DWORD esi+off],0000000001h ; Enable pages off = off+4 ENDM endif ; Mark all pages invalid for the previously mapped area xchg esi,[LastPage] ; Save last page for next page fault test esi,esi jz @@DoneMapping ; Dont update if first time round ifdef USE_NASM %assign off 0 %rep 16 or [DWORD esi+off],0FFFFFFFEh ; Disable pages %assign off off+4 %endrep else off = 0 REPT 16 and [DWORD esi+off],0FFFFFFFEh ; Disable pages off = off+4 ENDM endif @@DoneMapping: mov eax,cr3 mov cr3,eax ; Flush the TLB ; Now program the new SuperVGA starting bank address mov eax,ebx ; EAX := page fault address shr eax,16 and eax,0FFh ; Mask to 0-255 call [BankFuncPtr] ; Call the bank switch function pop es pop ds popad pop eax add esp,4 ; Pop the error code from stack iretd ; Return to faulting instruction @@ToOldHandler: pop eax ifdef USE_NASM jmp far dword [cs:INT14Gate]; Chain to previous handler else jmp [FWORD cs:INT14Gate]; Chain to previous handler endif cprocend ;---------------------------------------------------------------------------- ; PF_handler4k - Page fault handler for 4k banks ;---------------------------------------------------------------------------- ; The handler below is a 32 bit ring 0 page fault handler. It receives ; control immediately after any page fault or after an IRQ6 (hardware ; interrupt). This provides the fastest possible handling of page faults ; since it jump directly here. If this is a page fault, the number ; immediately on the stack will be an error code, at offset 4 will be ; the eip of the faulting instruction, at offset 8 will be the cs of the ; faulting instruction. If it is a hardware interrupt, it will not have ; the error code and the eflags will be at offset 8. ;---------------------------------------------------------------------------- cprocfar PF_handler4k ; Fill in when we have tested all the 64Kb code ifdef USE_NASM jmp far dword [cs:INT14Gate]; Chain to previous handler else jmp [FWORD cs:INT14Gate]; Chain to previous handler endif cprocend ;---------------------------------------------------------------------------- ; void InstallFaultHandler(void *baseAddr,int bankSize) ;---------------------------------------------------------------------------- ; Installes the page fault handler directly int the interrupt descriptor ; table for maximum performance. This of course requires ring 0 access, ; but none of this stuff will run without ring 0! ;---------------------------------------------------------------------------- cprocstart InstallFaultHandler ARG baseAddr:ULONG, bankSize:UINT enter_c mov [DWORD LastPage],0 ; No pages have been mapped mov ax,cs mov [ValidCS],ax ; Save CS value for page faults ; Put address of our page fault handler into the IDT directly sub esp,6 ; Allocate space on stack ifdef USE_NASM sidt [ss:esp] ; Store pointer to IDT else sidt [FWORD ss:esp] ; Store pointer to IDT endif pop ax ; add esp,2 pop eax ; Absolute address of IDT add eax,14*8 ; Point to Int #14 ; Note that Interrupt gates do not have the high and low word of the ; offset in adjacent words in memory, there are 4 bytes separating them. mov ecx,[eax] ; Get cs and low 16 bits of offset mov edx,[eax+6] ; Get high 16 bits of offset in dx shl edx,16 mov dx,cx ; edx has offset mov [INT14Offset],edx ; Save offset shr ecx,16 mov [INT14Selector],cx ; Save original cs mov [eax+2],cs ; Install new cs mov edx,offset PF_handler64k cmp [UINT bankSize],4 jne @@1 mov edx,offset PF_handler4k @@1: mov [eax],dx ; Install low word of offset shr edx,16 mov [eax+6],dx ; Install high word of offset leave_c ret cprocend ;---------------------------------------------------------------------------- ; void RemoveFaultHandler(void) ;---------------------------------------------------------------------------- ; Closes down the virtual framebuffer services and restores the previous ; page fault handler. ;---------------------------------------------------------------------------- cprocstart RemoveFaultHandler enter_c ; Remove page fault handler from IDT sub esp,6 ; Allocate space on stack ifdef USE_NASM sidt [ss:esp] ; Store pointer to IDT else sidt [FWORD ss:esp] ; Store pointer to IDT endif pop ax ; add esp,2 pop eax ; Absolute address of IDT add eax,14*8 ; Point to Int #14 mov cx,[INT14Selector] mov [eax+2],cx ; Restore original CS mov edx,[INT14Offset] mov [eax],dx ; Install low word of offset shr edx,16 mov [eax+6],dx ; Install high word of offset leave_c ret cprocend ;---------------------------------------------------------------------------- ; void InstallBankFunc(int codeLen,void *bankFunc) ;---------------------------------------------------------------------------- ; Installs the bank switch function by relocating it into our data segment ; and making it into a callable function. We do it this way to make the ; code identical to the way that the VflatD devices work under Windows. ;---------------------------------------------------------------------------- cprocstart InstallBankFunc ARG codeLen:UINT, bankFunc:DPTR enter_c mov esi,[bankFunc] ; Copy the code into buffer mov edi,offset BankFuncBuf mov ecx,[codeLen] rep movsb mov [BYTE edi],0C3h ; Terminate the function with a near ret leave_c ret cprocend ;---------------------------------------------------------------------------- ; int InitPaging(void) ;---------------------------------------------------------------------------- ; Initializes paging system. If paging is not enabled, builds a page table ; directory and page tables for physical memory ; ; Exit: 0 - Successful ; -1 - Couldn't initialize paging mechanism ;---------------------------------------------------------------------------- cprocstart InitPaging push ebx push ecx push edx push esi push edi ; Are we running under CauseWay? mov ax,0FFF9h int 31h jc @@NotCauseway cmp ecx,"CAUS" jnz @@NotCauseway cmp edx,"EWAY" jnz @@NotCauseway mov [BOOL VF_haveCauseWay],1 mov [CauseWayDIRLinear],esi mov [CauseWay1stLinear],edi ; Check for DPMI mov ax,0ff00h push es int 31h pop es shr edi,2 and edi,3 cmp edi,2 jz @@ErrExit ; Not supported under DPMI mov eax,[CauseWayDIRLinear] jmp @@CopyCR3 @@NotCauseway: mov ax,cs test ax,3 ; Which ring are we running jnz @@ErrExit ; Needs zero ring to access ; page tables (CR3) mov eax,cr0 ; Load CR0 test eax,80000000h ; Is paging enabled? jz @@ErrExit ; No, we must have paging! mov eax,cr3 ; Load directory address and eax,0FFFFF000h @@CopyCR3: mov [PDBR],eax ; Save it mov esi,eax mov edi,offset pageDirectory mov ecx,1024 cld rep movsd ; Copy the original page table directory cmp [DWORD accessPageAddr],0; Check if we have allocated page jne @@HaveRealMem ; table already (we cant free it) mov eax,0100h ; DPMI DOS allocate mov ebx,8192/16 int 31h ; Allocate 8192 bytes and eax,0FFFFh shl eax,4 ; EAX points to newly allocated memory add eax,4095 and eax,0FFFFF000h ; Page align mov [accessPageAddr],eax @@HaveRealMem: mov eax,[accessPageAddr] ; EAX -> page table in 1st Mb shr eax,12 and eax,3FFh ; Page table offset shl eax,2 cmp [BOOL VF_haveCauseWay],0 jz @@NotCW0 mov ebx,[CauseWay1stLinear] jmp @@Put1st @@NotCW0: mov ebx,[PDBR] mov ebx,[ebx] and ebx,0FFFFF000h ; Page table for 1st megabyte @@Put1st: add eax,ebx mov [accessPageTable],eax sub eax,eax ; No error jmp @@Exit @@ErrExit: mov eax,-1 @@Exit: pop edi pop esi pop edx pop ecx pop ebx ret cprocend ;---------------------------------------------------------------------------- ; void ClosePaging(void) ;---------------------------------------------------------------------------- ; Closes the paging system ;---------------------------------------------------------------------------- cprocstart ClosePaging push eax push ecx push edx push esi push edi mov eax,[accessPageAddr] call AccessPage ; Restore AccessPage mapping mov edi,[PDBR] mov esi,offset pageDirectory mov ecx,1024 cld rep movsd ; Restore the original page table directory @@Exit: pop edi pop esi pop edx pop ecx pop eax ret cprocend ;---------------------------------------------------------------------------- ; long AccessPage(long phys) ;---------------------------------------------------------------------------- ; Maps a known page to given physical memory ; Entry: EAX - Physical memory ; Exit: EAX - Linear memory address of mapped phys mem ;---------------------------------------------------------------------------- cprocstatic AccessPage push edx mov edx,[accessPageTable] or eax,7 mov [edx],eax mov eax,cr3 mov cr3,eax ; Update page table cache mov eax,[accessPageAddr] pop edx ret cprocend ;---------------------------------------------------------------------------- ; long GetPhysicalAddress(long linear) ;---------------------------------------------------------------------------- ; Returns the physical address of linear address ; Entry: EAX - Linear address to convert ; Exit: EAX - Physical address ;---------------------------------------------------------------------------- cprocstatic GetPhysicalAddress push ebx push edx mov edx,eax shr edx,22 ; EDX is the directory offset mov ebx,[PDBR] mov edx,[edx*4+ebx] ; Load page table address push eax mov eax,edx call AccessPage ; Access the page table mov edx,eax pop eax shr eax,12 and eax,03FFh ; EAX offset into page table mov eax,[edx+eax*4] ; Load physical address and eax,0FFFFF000h pop edx pop ebx ret cprocend ;---------------------------------------------------------------------------- ; void CreatePageTable(long pageDEntry) ;---------------------------------------------------------------------------- ; Creates a page table for specific address (4MB) ; Entry: EAX - Page directory entry (top 10-bits of address) ;---------------------------------------------------------------------------- cprocstatic CreatePageTable push ebx push ecx push edx push edi mov ebx,eax ; Save address mov eax,8192 push eax call VF_malloc ; Allocate page table directory add esp,4 add eax,0FFFh and eax,0FFFFF000h ; Page align (4KB) mov edi,eax ; Save page table linear address sub eax,eax ; Fill with zero mov ecx,1024 cld rep stosd ; Clear page table sub edi,4096 mov eax,edi call GetPhysicalAddress mov edx,[PDBR] or eax,7 ; Present/write/user bit mov [edx+ebx*4],eax ; Save physical address into page directory mov eax,cr3 mov cr3,eax ; Update page table cache pop edi pop edx pop ecx pop ebx ret cprocend ;---------------------------------------------------------------------------- ; void MapPhysical2Linear(ulong pAddr, ulong lAddr, int pages, int flags); ;---------------------------------------------------------------------------- ; Maps physical memory into linear memory ; Entry: pAddr - Physical address ; lAddr - Linear address ; pages - Number of 4K pages to map ; flags - Page flags ; bit 0 = present ; bit 1 = Read(0)/Write(1) ;---------------------------------------------------------------------------- cprocstart MapPhysical2Linear ARG pAddr:ULONG, lAddr:ULONG, pages:UINT, pflags:UINT enter_c and [ULONG pAddr],0FFFFF000h; Page boundary and [ULONG lAddr],0FFFFF000h; Page boundary mov ecx,[pflags] and ecx,11b ; Just two bits or ecx,100b ; Supervisor bit mov [pflags],ecx mov edx,[lAddr] shr edx,22 ; EDX = Directory mov esi,[PDBR] mov edi,[pages] ; EDI page count mov ebx,[lAddr] @@CreateLoop: mov ecx,[esi+edx*4] ; Load page table address test ecx,1 ; Is it present? jnz @@TableOK mov eax,edx call CreatePageTable ; Create a page table @@TableOK: mov eax,ebx shr eax,12 and eax,3FFh sub eax,1024 neg eax ; EAX = page count in this table inc edx ; Next table mov ebx,0 ; Next time we'll map 1K pages sub edi,eax ; Subtract mapped pages from page count jns @@CreateLoop ; Create more tables if necessary mov ecx,[pages] ; ECX = Page count mov esi,[lAddr] shr esi,12 ; Offset part isn't needed mov edi,[pAddr] @@MappingLoop: mov eax,esi shr eax,10 ; EAX = offset to page directory mov ebx,[PDBR] mov eax,[eax*4+ebx] ; EAX = page table address call AccessPage mov ebx,esi and ebx,3FFh ; EBX = offset to page table mov edx,edi add edi,4096 ; Next physical address inc esi ; Next linear page or edx,[pflags] ; Update flags... mov [eax+ebx*4],edx ; Store page table entry loop @@MappingLoop mov eax,cr3 mov cr3,eax ; Update page table cache leave_c ret cprocend endcodeseg _vflat endif END ; End of module
34.584992
83
0.476178
b9451334b7dba993a123ea270001656b385f32f0
299
lua
Lua
MMOCoreORB/bin/scripts/object/custom_content/draft_schematic/chemistry/enhancer/enhancer_disinfect.lua
V-Fib/FlurryClone
40e0ca7245ec31b3815eb6459329fd9e70f88936
[ "Zlib", "OpenSSL" ]
18
2017-02-09T15:36:05.000Z
2021-12-21T04:22:15.000Z
MMOCoreORB/bin/scripts/object/custom_content/draft_schematic/chemistry/enhancer/enhancer_disinfect.lua
V-Fib/FlurryClone
40e0ca7245ec31b3815eb6459329fd9e70f88936
[ "Zlib", "OpenSSL" ]
61
2016-12-30T21:51:10.000Z
2021-12-10T20:25:56.000Z
MMOCoreORB/bin/scripts/object/custom_content/draft_schematic/chemistry/enhancer/enhancer_disinfect.lua
V-Fib/FlurryClone
40e0ca7245ec31b3815eb6459329fd9e70f88936
[ "Zlib", "OpenSSL" ]
71
2017-01-01T05:34:38.000Z
2022-03-29T01:04:00.000Z
object_draft_schematic_chemistry_enhancer_enhancer_disinfect = object_draft_schematic_chemistry_enhancer_shared_enhancer_disinfect:new { } ObjectTemplates:addTemplate(object_draft_schematic_chemistry_enhancer_enhancer_disinfect, "object/draft_schematic/chemistry/enhancer/enhancer_disinfect.iff")
49.833333
157
0.919732
716f07f611b5646d81cdcf27a9f0b5e1365e768d
1,978
tsx
TypeScript
front/old_version/components/Admin/input-inputing.tsx
Jingyi21/LandingPage
b1f50f8bcc3cf8a5008693bab97507b75eac643e
[ "MIT" ]
3
2020-11-28T06:28:07.000Z
2021-03-08T15:27:27.000Z
front/old_version/components/Admin/input-inputing.tsx
iMisty/LandingPage-old
b1f50f8bcc3cf8a5008693bab97507b75eac643e
[ "MIT" ]
11
2021-06-15T21:26:03.000Z
2022-02-14T04:48:09.000Z
front/old_version/components/Admin/input-inputing.tsx
iMisty/Single-Search
b1f50f8bcc3cf8a5008693bab97507b75eac643e
[ "MIT" ]
null
null
null
import { Component, Vue, Prop, Emit } from 'vue-property-decorator'; @Component({}) export default class InputingInput extends Vue { // tips图标 private tipsicon: object = require('@/assets/tips.svg'); // 题目 @Prop({ default: '测试标题', required: true }) private title!: string; // Name @Prop({ default: 'setting' }) private name!: string; // 类型 @Prop({ default: 'text' }) private type!: string; // 输入框类型 @Prop({ default: 'line' }) private style!: string; // 聚焦边框颜色 @Prop({ default: 'default' }) private color!: string; // 是否需要指引内容 @Prop({ default: false }) private needtip!: boolean; // 指引文字 @Prop() private tiptext?: string; // 是否禁止修改 @Prop({ default: false }) private disabled?: boolean; // 输入文字 @Prop() private value?: string; // 点击事件 @Emit('clickevent') private clickEvent() {} // 聚焦事件 @Emit('focusevent') private focusEvent() {} // 修改事件 @Emit('changeevent') private changeEvent() {} // 失焦事件 @Emit('blurevent') private blurEvent() {} private render() { return ( <div class="admin__user--setting"> <section class="admin__user--setting--title"> <h5>{this.title}</h5> {this.needtip ? ( <section class="admin__user--setting--tips"> <img class="admin__user--setting--tips--image" src={this.tipsicon} /> <div class="admin__user--setting--tips--text">{this.tiptext}</div> </section> ) : ( '' )} </section> <input class={`mermaid__input input--color--${this.color}`} type={this.type} name={this.name} value={this.value} v-model={this.value} onClick={() => this.clickEvent()} onFocus={() => this.focusEvent()} onChange={() => this.changeEvent()} onBlur={() => this.blurEvent()} /> </div> ); } }
21.5
80
0.537412
9d1612223d6d8fbc20a1a8cdc7d09388e9f04a42
6,278
html
HTML
com.archimatetool.help.fr/nl/fr/help/Text/model_tree_working.html
poum/archi-nls-fr
fd613f677768066ab2847851ddc284ccfd017b92
[ "MIT" ]
null
null
null
com.archimatetool.help.fr/nl/fr/help/Text/model_tree_working.html
poum/archi-nls-fr
fd613f677768066ab2847851ddc284ccfd017b92
[ "MIT" ]
null
null
null
com.archimatetool.help.fr/nl/fr/help/Text/model_tree_working.html
poum/archi-nls-fr
fd613f677768066ab2847851ddc284ccfd017b92
[ "MIT" ]
null
null
null
<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Travailler dans l'arborescence des modèles</title> <link href="../Styles/style.css" rel="stylesheet" type="text/css" /> </head> <body> <h2>Travailler dans l'arborescence des modèles</h2> <p>Généralement, vous pouvez ajouter, supprimer, dupliquer, déplacer et renommer des concepts et des vues dans l'arborescence des modèles. Vous pouvez également créer des dossiers dans le groupe des dossiers principaux de façon à regrouper ensemble des concepts.</p> <br/> <h2>Glisser déposer</h2> <p>Les objets sont gérés par glisser déposer dans les dossiers. Notez que vous ne pouvez pas déplacer des concepts d'un type de dossier principal dans un autre. Par exemple, les concepts Métier ne peuvent être que dans le dossier "Métier" ou l'un de ses sous-dossiers et les relations ne peuvent être que dans le dossier "Relations" ou l'un de ses sous-dossiers.</p> <br/> <h2>Couper Coller</h2> <p>Enumeration plus de glisser déposer, vous pouvez couper et coller des objets d'un dossier à l'autre. Après avoir choisi des objets dans l'arborescence, sélectionnez "Couper" puis, après avoir choisi le répertoire cible, sélectionnez "Coller" pour déplacer les objets.</p> <br/> <h2>Supprimer des objets de l'arborescence des modèles</h2> <p>Pour supprimer un ou plusieurs objets dans l'arborescence des modèles, sélectionnez les puis choisissez "Supprimer" dans le menu principal "Modifier" ou depuis la barre d'outils principale.</p> <p>Notez que si un concept que vous souhaitez supprimer apparaît dans une ou plus vues, vous serez averti qu'il est référencé dans ces vues. <strong>Si vous supprimer ensuite le concept de l'arborescence, vous le supprimerez également de toutes les vues dans lesquelles il est référencé.</strong></p> <img src="../Images/delete_warning.png"/> <p class="caption">Avertissement relatif à la suppression d'un concept</p> <br/> <h2>Renommer un objet dans l'arborescence des modèles</h2> <p>Pour renommer un objet dans l'arborescence des modèles, choisir "Renommer" dans le menu principal "Modifier" ou dans le menu contextuel obtenu par clic droit. Vous pouvez également le renommer dans la <a href="properties_element.html">fenêtre des propriétés</a>.</p> <br/> <h2>Dupliquer un élément ou une vue dans l'arborescence des modèles</h2> <p>Pour dupliquer des éléments ou des vues dans l'arborescence des modèles, choisissez "Dupliquer" dans le menu principal "Modifier" ou depuis le menu contextuel obtenu par clic droit. Notez que les vues dupliquées contiennent des références vers les concepts originaux copiés.</p> <br/> <h2>Modifier les propriétés d'un objet dans l'arborescence des modèles</h2> <p>Pour modifier les propriétés pour un objet sélectionné dans l'arborescence des modèles, choisissez l'objet dans l'arborescence et ouvrir la fenêtre des propriétés soit en double cliquant sur l'objet ou via le menu principal "Fenêtre" ou encore par la barre d'outils principale.</p> <p>Chaque objet dans l'arborescence des modèles possède différentes propriétés qui peuvent être définies ou visualisées dans la fenêtre des propriétés. Pour avoir plus d'information, voir la section <a href="properties_window.html">La fenêtre des propriétés</a>.</p> <p>Note - certaines propriétés ne peuvent être modifiées que lorsque l'objet est sélectionné dans une vue (par exemple, la couleur de remplissage, la police de caractères ou la largeur de la ligne).</p> <br/> <h2>Concepts dans l'arborescence des modèles et dans les vues</h2> <p>Les concepts présents dans l'arborescence des modèles peuvent être ajoutés à n'importe quel nombre des diagrammes de vues dans le modèle en les tirant sur le canevas de la Vue (voir la section "Vues"). Quand un concept a été ajouté ou utilisé dans une Vue, la police de caractères utilisée dans l'arborescence des modèles pour ce concept est normale. Cependant, si le concept n'existe que dans l'arborescence des modèles et n'est utilisé dans aucune des vues, il est affiché avec une police de caractères en <em>italique</em>: <img src="../Images/model-tree-italic.png"/> <p class="caption">Les polices de caractères en italique montrent les concepts qui ne sont pas utilisés dans les vues</p> <p>Ceci facilite la détection des concepts qui peuvent être devenus superflus et peuvent être supprimés.</p> <br/> <h2>Synchroniser les sélections dans l'arborescence des modèles et dans une vue</h2> <p>Quand on sélectionne des concepts dans l'arborescence des modèles et dans les diagrammes des vues, il est parfois pratique de synchronise la sélection entre les concepts des deux fenêtres. Cliquez sur le bouton "Lier à la vue" dans la fenêtre de l'arborescence des modèles active ou désactive la synchronisation des concepts sélectionnés entre l'arborescence des modèles et un diagramme:</p> <img src="../Images/model-tree-sync.png"/> <p class="caption">Le bouton "Lier à la vue"</p> <p>Ce bouton est une bascule et peut être activé ou désactivé.</p> <p>La sélection synchronisée est possible sur plusieurs concepts sélectionnés à la fois.</p> <p>Notez que la sélection synchronisée n'est possible que si une vue pertinente est ouverte. Choisir un concept dans l'arborescence des modèles ne synchronisera pas une sélection dans une vue si cette vue ne contient pas ce ou ces concepts particuliers.</p> <br/> <h2>Explorer</h2> <p>En utilisant les boutons d'exploration, "Accueil", "Retour" et "Aller dans", il est possible d'explorer dans un modèle ou un dossier. Le chemin vers l'objet ou le dossier actuellement sélectionné est affiché dans la barre d'état.</p> <img src="../Images/model-tree-drill.png"/> <p class="caption">Les boutons "Exploration"</p> <p>&nbsp;</p> </body> </html>
73.858824
534
0.732877
70b4599327ee2872698472f324ed4abce73ebfe0
1,637
h
C
voice/asr.h
sgy1993/watch_github
fe81e43a5872964c006ec37927a5606af6eb02ad
[ "Unlicense" ]
null
null
null
voice/asr.h
sgy1993/watch_github
fe81e43a5872964c006ec37927a5606af6eb02ad
[ "Unlicense" ]
null
null
null
voice/asr.h
sgy1993/watch_github
fe81e43a5872964c006ec37927a5606af6eb02ad
[ "Unlicense" ]
null
null
null
#ifndef __AIWORLD_ASR_H__ #define __AIWORLD_ASR_H__ #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <arpa/inet.h> #include <unistd.h> #include <string.h> #include <strings.h> #include <stdlib.h> #include <net/if.h> #include <sys/ioctl.h> #include <sys/stat.h> #include <fcntl.h> #include <curl/curl.h> #include <stdlib.h> #include <iconv.h> #include <cJSON.h> #include <openssl/pem.h> #include <openssl/bio.h> #include <openssl/evp.h> #include <errno.h> #define FILENAME "./test01.pcm" #define FORMAT "pcm" #define FILESIZE 1024*1024 #define RATE 16000 #define ASR_URL "http://vop.baidu.com/server_api" typedef struct watch_asr{ char *pcPcm; char *pcPcm64; char *pcCjson; char *pcReplyAsr; char cszVtoT[2048]; int iSize; int iBase; }watch_asr_t; extern int asr_init(watch_asr_t *pstWatch_asr); extern int asr_server(watch_asr_t *pstWatch_asr); int getReply(void * ptr, size_t size, size_t nmemb, void * userdata); int charset_convert(const char *from_charset, const char *to_charset,char *in_buf, size_t in_left, char *out_buf, size_t out_left); int analysis_json(char *pcInput,char *pcOutput); int base64_encode(char *in_str, int in_len, char *out_str); int base64_decode(char *in_str, int in_len, char *out_str); int del_space(char *src); int read_pcm(char *pcPcm,int iSize); int struct_cjson(char *pcPut,int iSize,char *pcCjson); int curl_Upload(char *pcCjson,char *pcReply,char *pcUrl); int struct_cjson_Trans(char *pcPut,char *pcCjson,char *pcSkill); int analysis_json_Trans(char *pcInput,char *pcName,char *pcCmd,char *pcParameter); #endif
25.578125
135
0.730605
2a7d73d94fa7a0343730204793c19c5ed09f1865
1,710
java
Java
xyz/icexmoon/java_notes/ch19/finger_game8/Main.java
icexmoon/java-notebook
a9f20eee069c8d3e8cfc145f7c6ddb4d1192568b
[ "Apache-2.0" ]
null
null
null
xyz/icexmoon/java_notes/ch19/finger_game8/Main.java
icexmoon/java-notebook
a9f20eee069c8d3e8cfc145f7c6ddb4d1192568b
[ "Apache-2.0" ]
null
null
null
xyz/icexmoon/java_notes/ch19/finger_game8/Main.java
icexmoon/java-notebook
a9f20eee069c8d3e8cfc145f7c6ddb4d1192568b
[ "Apache-2.0" ]
null
null
null
package ch19.finger_game8; import java.util.EnumMap; import java.util.Random; import ch15.test2.Generator; import util.Fmt; enum Result { WIN, LOSE, DRAW } enum Item { PAPER, ROCK, SCISSORS; private static EnumMap<Item, EnumMap<Item, Result>> table = new EnumMap<>(Item.class); static { EnumMap<Item, Result> paperRow = new EnumMap<>(Item.class); EnumMap<Item, Result> rockRow = new EnumMap<>(Item.class); EnumMap<Item, Result> scissorsRow = new EnumMap<>(Item.class); table.put(PAPER, paperRow); table.put(ROCK, rockRow); table.put(SCISSORS, scissorsRow); paperRow.put(PAPER, Result.DRAW); paperRow.put(ROCK, Result.WIN); paperRow.put(SCISSORS, Result.LOSE); rockRow.put(PAPER, Result.LOSE); rockRow.put(SCISSORS, Result.WIN); rockRow.put(ROCK, Result.DRAW); scissorsRow.put(SCISSORS, Result.DRAW); scissorsRow.put(ROCK, Result.LOSE); scissorsRow.put(PAPER, Result.WIN); } public Result compete(Item item) { return table.get(this).get(item); } } class RandomItem implements Generator<Item> { private static Random rand = new Random(); @Override public Item next() { Item[] items = Item.values(); return items[rand.nextInt(items.length)]; } } public class Main { public static void main(String[] args) { RandomItem ri = new RandomItem(); for (int i = 0; i < 10; i++) { vs(ri.next(), ri.next()); } } private static void vs(Item item1, Item item2) { Result r = item1.compete(item2); Fmt.printf("%s vs %s = %s\n", item1, item2, r); } }
25.147059
90
0.608772
11d25c2dda12225b45c71faa79a014effc023864
292
html
HTML
hypha/apply/activity/templates/messages/email/transition.html
slifty/hypha
93313933c26589858beb9a861e33431658cd3b24
[ "BSD-3-Clause" ]
20
2021-04-08T16:38:49.000Z
2022-02-09T20:05:57.000Z
hypha/apply/activity/templates/messages/email/transition.html
OpenTechFund/WebApp
d6e2bb21a39d1fa7566cb60fe19f372dabfa5f0f
[ "BSD-3-Clause" ]
492
2021-03-31T16:19:56.000Z
2022-03-29T10:28:39.000Z
hypha/apply/activity/templates/messages/email/transition.html
OpenTechFund/WebApp
d6e2bb21a39d1fa7566cb60fe19f372dabfa5f0f
[ "BSD-3-Clause" ]
10
2021-02-23T12:00:26.000Z
2022-03-24T13:03:37.000Z
{% extends "messages/email/applicant_base.html" %} {% load i18n %} {% block content %}{% blocktrans with old_status=old_phase.public_name new_status=source.phase.public_name %}Your application has been progressed from {{ old_status }} to {{ new_status }}.{% endblocktrans %}{% endblock %}
41.714286
221
0.729452
959a477747800d3680ba3fa171ee0e4ec3ce994b
1,474
css
CSS
MyWebPage/assets/css/3_headerAndStuff.css
Josega149/WebDevelopment
51b24f5f9abf7d7736acc4508fbb69298c5f098c
[ "MIT" ]
null
null
null
MyWebPage/assets/css/3_headerAndStuff.css
Josega149/WebDevelopment
51b24f5f9abf7d7736acc4508fbb69298c5f098c
[ "MIT" ]
null
null
null
MyWebPage/assets/css/3_headerAndStuff.css
Josega149/WebDevelopment
51b24f5f9abf7d7736acc4508fbb69298c5f098c
[ "MIT" ]
null
null
null
.header-area-table{ background-image: url(../images/bitmoji.jpeg) ; background-repeat: no-repeat; width: 100% } .header-area { background-size: cover; background-position: center center; height: 100%; color:black; } .header-area-tablecell { display: table-cell; vertical-align: middle; } .header-text > div> h1 { width: 25%; margin: 0; font-weight: 700; margin-bottom: 20px; font-size: 5em; color:black; } #headerH1{ float:left; box-sizing:border-box; /**border-style: solid; border-color: black;*/ height:5em; color:black; } .header-text > h3 { font-size: 30px; font-weight: 200; letter-spacing: 7px; float:left; color:black; } .header-text { color:black; box-sizing:border-box; padding-left:24em; } .header-area-table { display: table; width: 100%; height: 100%; } #byJoseT{ word-spacing: 0.5em; font-size: 1em; text-transform: uppercase; float:right; position: relative; left: 7em; color:black; } #welcome{ height: 20em; } #hi{ display: none; } @media only screen and (max-device-width: 480px) { .header-text > div> h1 { display: none; } .header-text { display: none; } #headerH1{ display: none; } #hi{ display:block; font-size: 3em; padding-left: 1em; } #personalSite{ display: none; } }
14.45098
51
0.570556
32ced7800eae0ce2dbb66aa9d425ef77ab7a4906
695
sql
SQL
src/main/resources/schema.sql
bajpaihb/applause-tester-matching
bf8d6b3b90257e78dc2ad5ce68143ff2db8b8612
[ "MIT" ]
null
null
null
src/main/resources/schema.sql
bajpaihb/applause-tester-matching
bf8d6b3b90257e78dc2ad5ce68143ff2db8b8612
[ "MIT" ]
null
null
null
src/main/resources/schema.sql
bajpaihb/applause-tester-matching
bf8d6b3b90257e78dc2ad5ce68143ff2db8b8612
[ "MIT" ]
null
null
null
CREATE TABLE DEVICES ( device_id INT PRIMARY KEY, description VARCHAR(250) ) AS SELECT * FROM CSVREAD('classpath:testerdata/devices.csv'); CREATE TABLE BUGS ( bug_id INT NOT NULL, device_id INT NOT NULL, tester_id INT NOT NULL ) AS SELECT * FROM CSVREAD('classpath:testerdata/bugs.csv'); CREATE TABLE TESTER_DEVICE ( tester_id INT NOT NULL, device_id INT NOT NULL ) AS SELECT * FROM CSVREAD('classpath:testerdata/tester_device.csv'); CREATE TABLE TESTERS ( tester_id INT PRIMARY KEY, first_name VARCHAR(250), last_name VARCHAR(250), country VARCHAR(3), last_login TIMESTAMP ) AS SELECT * FROM CSVREAD('classpath:testerdata/testers.csv');
18.289474
67
0.719424
1340142dcbe94478cf6a02b69f1f179a13eec520
2,778
h
C
SurgSim/Graphics/OsgPointCloudRepresentation.h
dbungert/opensurgsim
bd30629f2fd83f823632293959b7654275552fa9
[ "Apache-2.0" ]
24
2015-01-19T16:18:59.000Z
2022-03-13T03:29:11.000Z
SurgSim/Graphics/OsgPointCloudRepresentation.h
dbungert/opensurgsim
bd30629f2fd83f823632293959b7654275552fa9
[ "Apache-2.0" ]
3
2018-12-21T14:54:08.000Z
2022-03-14T12:38:07.000Z
SurgSim/Graphics/OsgPointCloudRepresentation.h
dbungert/opensurgsim
bd30629f2fd83f823632293959b7654275552fa9
[ "Apache-2.0" ]
8
2015-04-10T19:45:36.000Z
2022-02-02T17:00:59.000Z
// This file is a part of the OpenSurgSim project. // Copyright 2013-2016, SimQuest Solutions Inc. // // 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 SURGSIM_GRAPHICS_OSGPOINTCLOUDREPRESENTATION_H #define SURGSIM_GRAPHICS_OSGPOINTCLOUDREPRESENTATION_H #include <osg/Array> #include <osg/Geometry> #include <osg/Point> #include "SurgSim/Framework/Macros.h" #include "SurgSim/Framework/ObjectFactory.h" #include "SurgSim/Graphics/PointCloudRepresentation.h" #include "SurgSim/Graphics/OsgRepresentation.h" namespace SurgSim { namespace DataStructures { class EmptyData; template<class Data> class Vertices; } namespace Graphics { #if defined(_MSC_VER) #pragma warning(push) #pragma warning(disable:4250) #endif SURGSIM_STATIC_REGISTRATION(OsgPointCloudRepresentation); /// Osg point cloud representation, implementation of a PointCloudRepresenation using OSG. class OsgPointCloudRepresentation : public PointCloudRepresentation, public OsgRepresentation { public: /// Constructor /// \param name The name of the Representation. explicit OsgPointCloudRepresentation(const std::string& name); /// Destructor ~OsgPointCloudRepresentation(); SURGSIM_CLASSNAME(SurgSim::Graphics::OsgPointCloudRepresentation); std::shared_ptr<PointCloud> getVertices() const override; void setPointSize(double val) override; double getPointSize() const override; void doUpdate(double dt) override; void setColor(const SurgSim::Math::Vector4d& color) override; SurgSim::Math::Vector4d getColor() const override; private: /// Local pointer to vertices with data std::shared_ptr<PointCloud> m_vertices; /// OSG vertex data for updating osg::ref_ptr<osg::Vec3Array> m_vertexData; /// OSG Geometry node holding the data osg::ref_ptr<osg::Geometry> m_geometry; /// OSG DrawArrays for local operations osg::ref_ptr<osg::DrawArrays> m_drawArrays; /// OSG::Point for local operations osg::ref_ptr<osg::Point> m_point; /// Color backing variable SurgSim::Math::Vector4d m_color; /// Update the geometry /// \param vertices new vertices void updateGeometry(const DataStructures::VerticesPlain& vertices); }; #if defined(_MSC_VER) #pragma warning(pop) #endif }; // Graphics }; // SurgSim #endif // SURGSIM_GRAPHICS_OSGPOINTCLOUDREPRESENTATION_H
26.457143
93
0.776458
7421bad9046f5b807eccee549e76bb638e0e927e
540
h
C
EffezzientOrder/ExtraLibrary/CustomPicker/M_CustomPicker.h
pratikhmehta/EffezzientOrder
fe4ee5623a0d1acc48ec81a2a2f2c106177b14b1
[ "MIT" ]
null
null
null
EffezzientOrder/ExtraLibrary/CustomPicker/M_CustomPicker.h
pratikhmehta/EffezzientOrder
fe4ee5623a0d1acc48ec81a2a2f2c106177b14b1
[ "MIT" ]
null
null
null
EffezzientOrder/ExtraLibrary/CustomPicker/M_CustomPicker.h
pratikhmehta/EffezzientOrder
fe4ee5623a0d1acc48ec81a2a2f2c106177b14b1
[ "MIT" ]
1
2020-07-19T09:27:06.000Z
2020-07-19T09:27:06.000Z
// // M_CustomPicker.h // Effezient // // Created by Yahya Bagia on 22/10/18. // Copyright © 2018 Inspiro Infotech. All rights reserved. // #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN @interface M_CustomPicker : NSObject @property (nonatomic) NSInteger key; @property (nonatomic) NSString *value; @property (nonatomic) id customObject; -(id)initWithKey:(NSInteger)key andValue:(NSString *)value; -(id)initWithKey:(NSInteger)key Value:(NSString *)value andCustomObject:(id)customObject; @end NS_ASSUME_NONNULL_END
20
89
0.757407
cb59d9376f0fc80b336c1d0feacf60495a4ee1d4
2,431
h
C
ccnxlibs/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_ContentObjectSchema.h
cherouvim/cicn-nrs
440d6a7f56e7240f179205ed5ce1fe8000d03b83
[ "Apache-2.0" ]
10
2018-11-04T06:37:14.000Z
2022-02-18T00:26:34.000Z
ccnxlibs/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_ContentObjectSchema.h
cherouvim/cicn-nrs
440d6a7f56e7240f179205ed5ce1fe8000d03b83
[ "Apache-2.0" ]
null
null
null
ccnxlibs/libccnx-common/ccnx/common/codec/schema_v1/testdata/v1_ContentObjectSchema.h
cherouvim/cicn-nrs
440d6a7f56e7240f179205ed5ce1fe8000d03b83
[ "Apache-2.0" ]
3
2019-01-17T19:47:55.000Z
2022-02-18T00:28:18.000Z
/* * Copyright (c) 2017 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * This is from the version 1 codec. All the test vectors in this directory (e.g. interest_nameA.h) * are encoded using these constants. These are no longer used for any functional code, only to interpret the test vectors. * */ #ifndef Libccnx_v1_ContentObjectSchema_h #define Libccnx_v1_ContentObjectSchema_h #include <ccnx/common/codec/testdata/tlv_Schema.h> #define T_CONTENTOBJECT 0x0002 // these are the array indicies used to store the TlvExtent for the item typedef enum { // top level entities V1_MANIFEST_OBJ_NAME = 0, V1_MANIFEST_OBJ_CONTENTOBJECT = 1, // the top container V1_MANIFEST_OBJ_NAMEAUTH = 2, V1_MANIFEST_OBJ_PAYLOADTYPE = 3, V1_MANIFEST_OBJ_PAYLOAD = 4, V1_MANIFEST_OBJ_SIGBITS = 5, // inside the name authenticator V1_MANIFEST_OBJ_KEYID = 6, V1_MANIFEST_OBJ_CRYPTO_SUITE = 7, V1_MANIFEST_OBJ_KEY = 8, V1_MANIFEST_OBJ_CERT = 9, V1_MANIFEST_OBJ_KEYNAME = 10, V1_MANIFEST_OBJ_KEYNAME_NAME = 11, V1_MANIFEST_OBJ_KEYNAME_OBJHASH = 12, // inside the protocol information V1_MANIFEST_OBJ_METADATA = 13, // inside metadata V1_MANIFEST_OBJ_OBJ_TYPE = 14, V1_MANIFEST_OBJ_CREATE_TIME = 15, V1_MANIFEST_OBJ_EXPIRY_TIME = 16, // inside signature block V1_MANIFEST_OBJ_ValidationPayload = 17, V1_MANIFEST_OBJ_ENDSEGMENT = 18, V1_MANIFEST_OBJ_PUBKEY = 19, V1_MANIFEST_OBJ_ValidationAlg = 20, V1_MANIFEST_OBJ_SigningTime = 21, V1_MANIFEST_OBJ_BODYEND = 22 } SchemaV1ManifestContentObjectBody; typedef enum { V1_MANIFEST_OBJ_OPTHEAD = 0, V1_MANIFEST_OBJ_E2EFRAG = 2, V1_MANIFEST_OBJ_FIXEDHEADER = 3, V1_MANIFEST_OBJ_RecommendedCacheTime = 4, V1_MANIFEST_OBJ_HEADEND = 5 } SchemaV1ManifestContentObjectHeaders; #endif // Libccnx_tlv_ContentObjectSchema_h
32.413333
124
0.751131
3e45b51056593a55580d04d07bfa65acc9ad0309
2,334
c
C
examples/task2/helpers.c
pieter-hendriks/contiki-ng
a2c360659aef57b917b2d97eccde06240391e97d
[ "BSD-3-Clause" ]
null
null
null
examples/task2/helpers.c
pieter-hendriks/contiki-ng
a2c360659aef57b917b2d97eccde06240391e97d
[ "BSD-3-Clause" ]
null
null
null
examples/task2/helpers.c
pieter-hendriks/contiki-ng
a2c360659aef57b917b2d97eccde06240391e97d
[ "BSD-3-Clause" ]
null
null
null
#include "conf_my_app.h" #include "helpers.h" #define LOG_LEVEL LOG_LEVEL_INFO #define LOG_MODULE "HELPERS" void outputFileContents(int filehandle) { char* buffer = calloc(128, 1); int read = cfs_read(filehandle, buffer, 128); LOG_INFO("Reading filehandle %i. Output below.\n--------------------------------------------\n", filehandle); while (read == 128) { LOG_INFO_(&(buffer[0])); read = cfs_read(filehandle, buffer, 128); } LOG_INFO_(buffer); LOG_INFO_("\n--------------------------------------------\n"); free(buffer); cfs_close(filehandle); filehandle = -1; } void resetEnergy() { energest_flush(); energest_init(); } void logEnergy(int filehandle) { energest_flush(); logToFile(filehandle, CPUPREFIX, energest_type_time(ENERGEST_TYPE_CPU)); logToFile(filehandle, LPMPREFIX, energest_type_time(ENERGEST_TYPE_LPM)); logToFile(filehandle, DLPMPREFIX, energest_type_time(ENERGEST_TYPE_DEEP_LPM)); logToFile(filehandle, TXPREFIX, energest_type_time(ENERGEST_TYPE_TRANSMIT)); logToFile(filehandle, RXPREFIX, energest_type_time(ENERGEST_TYPE_LISTEN)); } void logEnergySerial() { energest_flush(); logSerial(CPUPREFIX, energest_type_time(ENERGEST_TYPE_CPU)); logSerial(LPMPREFIX, energest_type_time(ENERGEST_TYPE_LPM)); logSerial(DLPMPREFIX, energest_type_time(ENERGEST_TYPE_DEEP_LPM)); logSerial(TXPREFIX, energest_type_time(ENERGEST_TYPE_TRANSMIT)); logSerial(RXPREFIX, energest_type_time(ENERGEST_TYPE_LISTEN)); } void doInitialSetup() { // removeOldFiles(); resetInterfaces(); resetEnergy(); } void logToFile(int filehandle, char* prefix, uint64_t value) { char buffer[128] = {0}; int len = snprintf(buffer, 128, "%s%"PRIu64"\n", prefix, value); LOG_INFO("Writing %s to filehandle %i (length=%i)\n", buffer, filehandle, len); int ret = cfs_write(filehandle, buffer, len); if (ret < 0) { LOG_ERR("File write failed! SNPRINTF: %i, CFS_WRITE: %i\n", len, ret); } else { LOG_INFO("File write returned %i\n", ret); filehandle = -1; } } void logSerial(char* prefix, uint64_t value) { LOG_INFO("%s%"PRIu64"\n", prefix, value); } void resetInterfaces() { NETSTACK_RADIO.init(); NETSTACK_MAC.init(); NETSTACK_NETWORK.init(); } void removeOldFiles() { int ret = cfs_remove(MYFILENAME); if (ret != 0) { LOG_ERR("Failed to remove file. Reason unknown; error code = %i", ret); } }
29.175
110
0.70994
fec161a367cabec4c3d43ca096ad5afb354f4200
5,807
html
HTML
zebra/zebra-console/src/main/resources/static/page/welcome.html
AurtyMX/zebra
4d636073dbd1eb6c7134692db574834c523ba002
[ "Apache-2.0" ]
31
2019-12-09T06:44:01.000Z
2021-08-06T11:56:42.000Z
zebra/zebra-console/src/main/resources/static/page/welcome.html
gszebra/zebra
4d636073dbd1eb6c7134692db574834c523ba002
[ "Apache-2.0" ]
null
null
null
zebra/zebra-console/src/main/resources/static/page/welcome.html
gszebra/zebra
4d636073dbd1eb6c7134692db574834c523ba002
[ "Apache-2.0" ]
13
2019-12-03T09:10:14.000Z
2022-03-09T06:29:02.000Z
<!DOCTYPE html> <html lang="zh-cmn-Hans"> <head> <meta charset="UTF-8"> <meta name="renderer" content="webkit"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <title>欢迎</title> <link rel="stylesheet" href="../frame/layui/css/layui.css"> <link rel="stylesheet" href="../frame/static/css/style.css"> <link rel="icon" href="../frame/static/image/code.png"> </head> <body class="body"> <div class="layui-row layui-col-space10 my-index-main"> <div class="layui-col-xs4 layui-col-sm2 layui-col-md2"> <div class="my-nav-btn layui-clear" data-href="./demo/userTable.html"> <div class="layui-col-md5"> <button class="layui-btn layui-btn-big layui-btn-danger layui-icon">&#xe756;</button> </div> <div class="layui-col-md7 tc"> <p class="my-nav-text">-</p> <p class="my-nav-text layui-elip">服务依赖</p> </div> </div> </div> <div class="layui-col-xs4 layui-col-sm2 layui-col-md2"> <div class="my-nav-btn layui-clear" data-href="./demo/fundTable.html"> <div class="layui-col-md5"> <button class="layui-btn layui-btn-big layui-btn-warm layui-icon">&#xe735;</button> </div> <div class="layui-col-md7 tc"> <p class="my-nav-text">-</p> <p class="my-nav-text layui-elip">资源类配置</p> </div> </div> </div> <div class="layui-col-xs4 layui-col-sm2 layui-col-md2"> <div class="my-nav-btn layui-clear" data-href="./demo/zcTable.html"> <div class="layui-col-md5"> <button class="layui-btn layui-btn-big layui-icon">&#xe715;</button> </div> <div class="layui-col-md7 tc"> <p class="my-nav-text">-</p> <p class="my-nav-text layui-elip">业务类配置</p> </div> </div> </div> <div class="layui-col-xs4 layui-col-sm2 layui-col-md2"> <div class="my-nav-btn layui-clear" data-href="./demo/taskTable.html"> <div class="layui-col-md5"> <button class="layui-btn layui-btn-big layui-btn-normal layui-icon">&#xe705;</button> </div> <div class="layui-col-md7 tc"> <p class="my-nav-text">-</p> <p class="my-nav-text layui-elip">服务方法测试</p> </div> </div> </div> <!-- 为 ECharts 准备一个具备大小(宽高)的 DOM --> <div id="main-line" style="width: 100%;height:400px;"></div> <div id="main-bing" style="width: 100%;height:400px;"></div> </div> <script type="text/javascript" src="../frame/layui/layui.js"></script> <script type="text/javascript" src="../js/index.js"></script> <script type="text/javascript" src="../frame/echarts/echarts.min.js"></script> <script type="text/javascript" src="../js/jquery-3.3.1.min.js"></script> <script type="text/javascript"> layui.use(['element', 'form', 'table', 'layer', 'vip_tab'], function () { var form = layui.form , table = layui.table , layer = layui.layer , vipTab = layui.vip_tab , element = layui.element , $ = layui.jquery; // 打开选项卡 $('.my-nav-btn').on('click', function(){ if($(this).attr('data-href')){ //vipTab.add('','标题','路径'); vipTab.add($(this),'<i class="layui-icon">'+$(this).find("button").html()+'</i>'+$(this).find('p:last-child').html(),$(this).attr('data-href')); } }); // you code ... }); $(document).ready(function() { $.ajax({ type : "post", //提交方式 url : "/api/user/qryStatics",//路径 async : false, data : {},//数据,这里使用的是Json格式进行传输 dataType : 'json', //返回的数据格式:json/xml/html/script/jsonp/text success : function(result) {//返回数据根据结果进行相应的处理 if (result.code == 0) { // 基于准备好的dom,初始化echarts实例 var myChart = echarts.init(document.getElementById('main-line')); // 使用刚指定的配置项和数据显示图表。 myChart.setOption({ title: { text: '基本信息' }, tooltip: {}, legend: { data:['数量'] }, xAxis: { data: ["服务","机器","配置","主动探测"] }, yAxis: {}, series: [{ name: '数量', type: 'bar', data: [result.data.sCount, result.data.dCount, result.data.confCount, result.data.testCount] }] }); // 基于准备好的dom,初始化echarts实例 var chart = echarts.init(document.getElementById('main-bing')); // 配置 chart.setOption({ legend: { data:['延迟'] }, series : [ { name: '延迟', type: 'pie', radius: '55%', data:[ {value:result.data.i1, name:'0-100毫秒'}, {value:result.data.i2, name:'100-500毫秒'}, {value:result.data.i3, name:'500-1000毫秒'}, {value:result.data.i4, name:'1-3秒'}, {value:result.data.i5, name:'>3秒'} ], itemStyle:{ normal:{ label:{ show: true, formatter: '{b} : {c} ({d}%)' }, labelLine :{show:true} } } } ] }); } }, error : function(XMLHttpRequest, textStatus, errorThrown) { layer.msg('系统异常'); window.parent.location.href = '/login.html'; } }); }); </script> </body> </html>
36.753165
159
0.492337
16aa5f5b80b8d6080efe8ea2f49a4b85c54e76c8
17,340
c
C
src/drt/drt.c
GrieferAtWork/dcc
e70803aef1d7dc83ecedc6134c3e7902e6b6bbca
[ "Zlib" ]
19
2017-08-27T16:27:44.000Z
2021-12-02T21:17:17.000Z
src/drt/drt.c
GrieferAtWork/dcc
e70803aef1d7dc83ecedc6134c3e7902e6b6bbca
[ "Zlib" ]
null
null
null
src/drt/drt.c
GrieferAtWork/dcc
e70803aef1d7dc83ecedc6134c3e7902e6b6bbca
[ "Zlib" ]
1
2022-02-17T18:51:21.000Z
2022-02-17T18:51:21.000Z
/* Copyright (c) 2017 Griefer@Work * * * * This software is provided 'as-is', without any express or implied * * warranty. In no event will the authors be held liable for any damages * * arising from the use of this software. * * * * Permission is granted to anyone to use this software for any purpose, * * including commercial applications, and to alter it and redistribute it * * freely, subject to the following restrictions: * * * * 1. The origin of this software must not be misrepresented; you must not * * claim that you wrote the original software. If you use this software * * in a product, an acknowledgement in the product documentation would be * * appreciated but is not required. * * 2. Altered source versions must be plainly marked as such, and must not be * * misrepresented as being the original software. * * 3. This notice may not be removed or altered from any source distribution. * */ #ifndef GUARD_DRT_DRT_C #define GUARD_DRT_DRT_C 1 #define _GNU_SOURCE 1 /* For 'REG_xxx' constants used by 'ucontext_t' */ #include <dcc/common.h> #include <dcc/target.h> #if DCC_CONFIG_HAVE_DRT #include <dcc/compiler.h> #include <dcc/gen.h> #include <dcc/unit.h> #include <drt/drt.h> #include "drt.h" #if !!(DCC_HOST_OS&DCC_OS_F_UNIX) #include <sys/mman.h> #include <signal.h> #endif DCC_DECL_BEGIN PUBLIC struct DRT DRT_Current; #if DCC_TARGET_BIN == DCC_BINARY_PE PUBLIC target_ptr_t *DRT_AllocPEIndirection(void) { struct DRTPEInd *curr = drt.rt_peind.ic_first; if (!curr || (assert(curr->i_using <= DRT_PEIND_SLOTSIZE), curr->i_using == DRT_PEIND_SLOTSIZE)) { curr = (struct DRTPEInd *)malloc(sizeof(struct DRTPEInd)); if unlikely(!curr) { DCC_AllocFailed(sizeof(struct DRTPEInd)); } curr->i_next = drt.rt_peind.ic_first; drt.rt_peind.ic_first = curr; curr->i_using = 0; } return &curr->i_ptr[curr->i_using++]; } #endif #define PROT_MASK (DCC_SYMFLAG_SEC_R|DCC_SYMFLAG_SEC_W|DCC_SYMFLAG_SEC_X) #define PROT(prot) (((prot)&PROT_MASK) >> 16) #if DCC_HOST_OS == DCC_OS_WINDOWS PRIVATE DWORD const mall_prot[] = { /* [PROT(0)] = */0, /* [PROT(DCC_SYMFLAG_SEC_R)] = */PAGE_READONLY, /* [PROT(DCC_SYMFLAG_SEC_W)] = */PAGE_READWRITE, /* [PROT(DCC_SYMFLAG_SEC_R|DCC_SYMFLAG_SEC_W)] = */PAGE_READWRITE, /* [PROT(DCC_SYMFLAG_SEC_X)] = */PAGE_EXECUTE, /* [PROT(DCC_SYMFLAG_SEC_R|DCC_SYMFLAG_SEC_X)] = */PAGE_EXECUTE_READ, /* [PROT(DCC_SYMFLAG_SEC_W|DCC_SYMFLAG_SEC_X)] = */PAGE_EXECUTE_READWRITE, /* [PROT(DCC_SYMFLAG_SEC_R|DCC_SYMFLAG_SEC_W|DCC_SYMFLAG_SEC_X)] = */PAGE_EXECUTE_READWRITE, }; INTERN void DRT_USER * DRT_VMall(void DRT_USER *vaddr, size_t n_bytes, symflag_t prot) { void *result = VirtualAlloc(vaddr,n_bytes,MEM_COMMIT,mall_prot[PROT(prot)]); if (!result) result = VirtualAlloc(vaddr,n_bytes,MEM_COMMIT|MEM_RESERVE,mall_prot[PROT(prot)]); return result; } PUBLIC void DRT_USER * DRT_VProt(void DRT_USER *vaddr, size_t n_bytes, symflag_t prot) { DWORD old_prot; return VirtualProtect(vaddr,n_bytes,mall_prot[PROT(prot)],&old_prot) ? vaddr : DRT_VERROR; } PUBLIC void DRT_VFree(void DRT_USER *vaddr, size_t n_bytes) { VirtualFree(vaddr,n_bytes,MEM_DECOMMIT); } #elif !!(DCC_HOST_OS&DCC_OS_F_UNIX) #ifndef PROT_NONE #define PROT_NONE 0 #endif #ifndef MAP_PRIVATE #define MAP_PRIVATE 0 #endif #if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) #define MAP_ANONYMOUS MAP_ANON #endif #ifndef MAP_FIXED #error "Cannot allocate fixed memory (DCC must be compiled with '-DDCC_CONFIG_HAVE_DRT=0')" #endif #ifndef __KOS__ #define HAVE_MPROTECT #endif PRIVATE int const mall_prot[] = { /* [PROT(0)] = */PROT_NONE, #ifdef HAVE_MPROTECT /* [PROT(DCC_SYMFLAG_SEC_R)] = */PROT_READ, /* [PROT(DCC_SYMFLAG_SEC_W)] = */PROT_WRITE, /* [PROT(DCC_SYMFLAG_SEC_R|DCC_SYMFLAG_SEC_W)] = */PROT_READ|PROT_WRITE, /* [PROT(DCC_SYMFLAG_SEC_X)] = */PROT_EXEC, /* [PROT(DCC_SYMFLAG_SEC_R|DCC_SYMFLAG_SEC_X)] = */PROT_READ|PROT_EXEC, /* [PROT(DCC_SYMFLAG_SEC_W|DCC_SYMFLAG_SEC_X)] = */PROT_WRITE|PROT_EXEC, /* [PROT(DCC_SYMFLAG_SEC_R|DCC_SYMFLAG_SEC_W|DCC_SYMFLAG_SEC_X)] = */PROT_READ|PROT_WRITE|PROT_EXEC, #else /* [PROT(DCC_SYMFLAG_SEC_R)] = */PROT_READ|PROT_WRITE, /* [PROT(DCC_SYMFLAG_SEC_W)] = */PROT_WRITE, /* [PROT(DCC_SYMFLAG_SEC_R|DCC_SYMFLAG_SEC_W)] = */PROT_READ|PROT_WRITE, /* [PROT(DCC_SYMFLAG_SEC_X)] = */PROT_WRITE|PROT_EXEC, /* [PROT(DCC_SYMFLAG_SEC_R|DCC_SYMFLAG_SEC_X)] = */PROT_READ|PROT_WRITE|PROT_EXEC, /* [PROT(DCC_SYMFLAG_SEC_W|DCC_SYMFLAG_SEC_X)] = */PROT_WRITE|PROT_EXEC, /* [PROT(DCC_SYMFLAG_SEC_R|DCC_SYMFLAG_SEC_W|DCC_SYMFLAG_SEC_X)] = */PROT_READ|PROT_WRITE|PROT_EXEC, #endif }; PUBLIC void DRT_USER * DRT_VMall(void DRT_USER *vaddr, size_t n_bytes, symflag_t prot) { #ifdef MAP_ANONYMOUS return mmap(vaddr,n_bytes,mall_prot[PROT(prot)], MAP_PRIVATE|MAP_ANONYMOUS| (vaddr != DRT_VANY ? MAP_FIXED : 0),-1,0); #else static int fd_null = -1; if (fd_null < 0) fd_null = open("/dev/null",O_RDONLY); if (fd_null < 0) return DRT_VERROR; return mmap(vaddr,n_bytes,mall_prot[PROT(prot)], MAP_PRIVATE| (vaddr != DRT_VANY ? MAP_FIXED : 0),fd_null,0); #endif } PUBLIC void DRT_USER * DRT_VProt(void DRT_USER *vaddr, size_t n_bytes, symflag_t prot) { #ifdef HAVE_MPROTECT if (mprotect(vaddr,n_bytes,mall_prot[PROT(prot)]) < 0) return DRT_VERROR; return vaddr; #else (void)n_bytes,(void)prot; return vaddr; #endif } PUBLIC void DRT_VFree(void DRT_USER *vaddr, size_t n_bytes) { munmap(vaddr,n_bytes); } #else #error FIXME #endif #if DCC_HOST_CPUI == DCC_CPUI_X86 #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable: 4731) PUBLIC /*__declspec(naked)*/ DCC_ATTRIBUTE_NORETURN void DRT_SetCPUState(struct DCPUState const *__restrict state) { #ifdef _WIN64 __asm mov rax, state; __asm push dword ptr [eax+DCPUSTATE_OFFSETOF_EFREG+DCPUEFREGISTER_OFFSETOF_FLAGS]; __asm popfq; __asm mov rcx, dword ptr [rax+DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_CX]; __asm mov rdx, dword ptr [rax+DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_DX]; __asm mov rbx, dword ptr [rax+DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_BX]; __asm mov rsp, dword ptr [rax+DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_SP]; __asm mov rbp, dword ptr [rax+DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_BP]; __asm mov rsi, dword ptr [rax+DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_SI]; __asm mov rdi, dword ptr [rax+DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_DI]; __asm push dword ptr [rax+DCPUSTATE_OFFSETOF_IPREG+DCPUIPREGISTER_OFFSETOF_IP]; __asm mov rax, dword ptr [rax+DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_AX]; __asm ret; #else __asm mov eax, state; __asm push dword ptr [eax+DCPUSTATE_OFFSETOF_EFREG+DCPUEFREGISTER_OFFSETOF_FLAGS]; __asm popfd; __asm mov ecx, dword ptr [eax+DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_CX]; __asm mov edx, dword ptr [eax+DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_DX]; __asm mov ebx, dword ptr [eax+DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_BX]; __asm mov esp, dword ptr [eax+DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_SP]; __asm mov ebp, dword ptr [eax+DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_BP]; __asm mov esi, dword ptr [eax+DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_SI]; __asm mov edi, dword ptr [eax+DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_DI]; __asm push dword ptr [eax+DCPUSTATE_OFFSETOF_IPREG+DCPUIPREGISTER_OFFSETOF_IP]; __asm mov eax, dword ptr [eax+DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_AX]; __asm ret; #endif } #undef LOAD_STATE #pragma warning(pop) #else PUBLIC DCC_ATTRIBUTE_NORETURN void DRT_SetCPUState(struct DCPUState const *__restrict state); #if !!(DCC_HOST_CPUF&DCC_CPUF_X86_64) # define LEVEL "r" # define PFX "q" #else # define LEVEL "e" # define PFX "l" #endif __asm__("DRT_SetCPUState:" " mov" PFX " " DCC_PP_STR(__SIZEOF_POINTER__) "(%" LEVEL "bp), %" LEVEL "ax\n" " push" PFX " " DCC_PP_STR(DCPUSTATE_OFFSETOF_EFREG+DCPUEFREGISTER_OFFSETOF_FLAGS) "(%" LEVEL "ax)\n" " popf" PFX "\n" " mov" PFX " " DCC_PP_STR(DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_CX) "(%" LEVEL "ax), %" LEVEL "cx\n" " mov" PFX " " DCC_PP_STR(DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_DX) "(%" LEVEL "ax), %" LEVEL "dx\n" " mov" PFX " " DCC_PP_STR(DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_BX) "(%" LEVEL "ax), %" LEVEL "bx\n" " mov" PFX " " DCC_PP_STR(DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_SP) "(%" LEVEL "ax), %" LEVEL "sp\n" " mov" PFX " " DCC_PP_STR(DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_BP) "(%" LEVEL "ax), %" LEVEL "bp\n" " mov" PFX " " DCC_PP_STR(DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_SI) "(%" LEVEL "ax), %" LEVEL "si\n" " mov" PFX " " DCC_PP_STR(DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_DI) "(%" LEVEL "ax), %" LEVEL "di\n" " push" PFX " " DCC_PP_STR(DCPUSTATE_OFFSETOF_IPREG+DCPUIPREGISTER_OFFSETOF_IP) "(%" LEVEL "ax)\n" " mov" PFX " " DCC_PP_STR(DCPUSTATE_OFFSETOF_GPREG+DCPUGPREGISTER_OFFSETOF_AX) "(%" LEVEL "ax), %" LEVEL "ax\n" " ret\n" ".size DRT_SetCPUState, . - DRT_SetCPUState\n"); #undef PFX #undef LEVEL #endif #else #error FIXME #endif PUBLIC void DCCSection_RTInit(struct DCCSection *__restrict self) { if (!DRT_ENABLED()) return; #if DCC_HOST_OS == DCC_OS_WINDOWS self->sc_dat.sd_rt.rs_vaddr = (uint8_t DRT_USER *) VirtualAlloc(0,drt.rt_maxsection,MEM_RESERVE,PAGE_NOACCESS); if unlikely(!self->sc_dat.sd_rt.rs_vaddr) #endif { self->sc_dat.sd_rt.rs_vaddr = drt.rt_nextaddr; drt.rt_nextaddr += drt.rt_maxsection; } } PUBLIC void DCCSection_RTQuit(struct DCCSection *__restrict self) { /* Free all allocated virtual memory. */ #if DCC_HOST_OS == DCC_OS_WINDOWS VirtualFree(self->sc_dat.sd_rt.rs_vaddr,0,MEM_RELEASE); #else { void DRT_USER *addr; size_t size; DCCRTSECTION_FOREACH_BEGIN(&self->sc_dat.sd_rt,0x3,addr,size) { DRT_VFree(addr,size); } DCCRTSECTION_FOREACH_END; } #endif free(self->sc_dat.sd_rt.rs_pagev); DCCFreeData_Quit(&self->sc_dat.sd_rt.rs_mtext); } PUBLIC uint8_t DRT_USER * DCCSection_RTAlloc(struct DCCSection *__restrict self, target_ptr_t addr, target_siz_t size, int for_write) { uint8_t DRT_USER *result; size_t i,page_min,page_max; int has_existing_pages = 0; assert(self); assert(!DCCSection_ISIMPORT(self)); assert(addr+size >= addr); result = self->sc_dat.sd_rt.rs_vaddr+addr; if unlikely(!size) return result; /* Handle special case: empty range. */ page_min = (addr)/DCC_TARGET_PAGESIZE; page_max = (addr+(size-1))/DCC_TARGET_PAGESIZE; assert(page_min <= page_max); if (page_max*DCC_TARGET_PAGESIZE >= drt.rt_maxsection) { /* Once a section grows larger than the predefined maximum, * the chance that it'll start using memory intended for * use by another section becomes present. * >> Eventually, everything may fail when the other section try to allocate its memory, * but even before then, the DRT thread may access memory intended for another section. */ WARN(W_DRT_SECTION_TOO_LARGE, self->sc_start.sy_name->k_name, drt.rt_maxsection); if unlikely(!OK) goto err; } /* Make sure the page allocation tracker has sufficient length. */ { size_t page_alloc = (page_max+((DCC_TARGET_BITPERBYTE/DCC_RT_PAGEATTR_COUNT)-1))/ (DCC_TARGET_BITPERBYTE/DCC_RT_PAGEATTR_COUNT); if (page_alloc >= self->sc_dat.sd_rt.rs_pagea) { uint8_t *new_allocv; size_t newsize; newsize = self->sc_dat.sd_rt.rs_pagea; if unlikely(!newsize) newsize = 1; do newsize *= 2; while (page_alloc >= newsize); new_allocv = (uint8_t *)realloc(self->sc_dat.sd_rt.rs_pagev, newsize*sizeof(uint8_t)); if unlikely(!new_allocv) { DCC_AllocFailed(newsize*sizeof(uint8_t)); goto err; } memset(new_allocv+self->sc_dat.sd_rt.rs_pagea,0, (newsize-self->sc_dat.sd_rt.rs_pagea)*sizeof(uint8_t)); self->sc_dat.sd_rt.rs_pagea = newsize; self->sc_dat.sd_rt.rs_pagev = new_allocv; } } /* Allocate all pages */ for (i = page_min; i <= page_max; ++i) { if (DCCRTSection_PAGE_ISUNUSED(&self->sc_dat.sd_rt,i)) { size_t alloc_begin = i,alloc_end = i; symflag_t flags; void *base_address; size_t alloc_size; do ++alloc_end; while (alloc_end <= page_max && DCCRTSection_PAGE_ISUNUSED(&self->sc_dat.sd_rt,alloc_end)); flags = self->sc_start.sy_flags; if (for_write) flags |= DCC_SYMFLAG_SEC_W; base_address = (void *)DCCRTSection_PAGEADDR(&self->sc_dat.sd_rt,alloc_begin); alloc_size = (size_t)(alloc_end-alloc_begin)*DCC_TARGET_PAGESIZE; if (DRT_VMall(base_address,alloc_size,flags) == DRT_VERROR) { WARN(W_DRT_VMALL_FAILED_ALLOC, self->sc_start.sy_name->k_name, (void *)(base_address), (void *)((uintptr_t)base_address+alloc_size-1), (int)GetLastError()); goto err; } /* Pre-initialize DRT memory. */ if (flags&DCC_SYMFLAG_SEC_W) memset(base_address,DRT_U_FILLER,alloc_size); /* Mark all pages as allocated. */ do DCCRTSection_SET_PAGEATTR(&self->sc_dat.sd_rt,alloc_begin,0x1); while (++alloc_begin != alloc_end); } else { has_existing_pages = 1; } } if (for_write && has_existing_pages && !(self->sc_start.sy_flags&DCC_SYMFLAG_SEC_W)) { /* Must update memory protection on the entire address range. */ if (DRT_VProt(result,size,self->sc_start.sy_flags|DCC_SYMFLAG_SEC_W) == DRT_VERROR) { WARN(W_DRT_VPROT_FAILED_WRITABLE, self->sc_start.sy_name->k_name, (void *)result,(void *)(result+(size-1)), (int)GetLastError()); goto err; } } return result; err: return (uint8_t *)DRT_VERROR; } PUBLIC void DCCSection_RTDoneWrite(struct DCCSection *__restrict self, target_ptr_t addr, target_siz_t size) { assert(self); assert(!DCCSection_ISIMPORT(self)); assert(addr+size >= addr); /* Nothing to do if the section is naturally writable. */ if (self->sc_start.sy_flags&DCC_SYMFLAG_SEC_W) return; if (DRT_VProt(DCCRTSection_BYTEADDR(&self->sc_dat.sd_rt,addr),size, self->sc_start.sy_flags) == DRT_VERROR) { WARN(W_DRT_VPROT_FAILED_READONLY, self->sc_start.sy_name->k_name, (void *)(DCCRTSection_BYTEADDR(&self->sc_dat.sd_rt,addr)), (void *)(DCCRTSection_BYTEADDR(&self->sc_dat.sd_rt,addr)+(size-1)), (int)GetLastError()); } #ifndef NO_FlushInstructionCache if (self->sc_start.sy_flags&DCC_SYMFLAG_SEC_X) { /* Flush the instruction cache after writing to an executable section. */ FlushInstructionCache(GetCurrentProcess(), DCCRTSection_BYTEADDR(&self->sc_dat.sd_rt,addr), size); } #endif /* !NO_FlushInstructionCache */ } PUBLIC void DRT_Init(void) { memset(&drt,0,sizeof(drt)); drt.rt_stacksize = DRT_DEFAULT_STACKSIZE; drt.rt_framesize = DRT_DEFAULT_FRAMESIZE; drt.rt_maxsection = DRT_DEFAULT_MAXSECTION; drt.rt_baseaddr = (uint8_t DRT_USER *)DRT_DEFAULT_BASEADDR; drt.rt_nextaddr = (uint8_t DRT_USER *)DRT_DEFAULT_BASEADDR; } PUBLIC void DRT_Quit(void) { if (drt.rt_flags&DRT_FLAG_STARTED) { /* Destroy the RT thread. */ #if !!(DCC_HOST_OS&DCC_OS_F_WINDOWS) TerminateThread(drt.rt_thread,42); CloseHandle(drt.rt_thread); #else if (!(drt.rt_flags&DRT_FLAG_JOINING2)) { pthread_cancel(drt.rt_thread); pthread_kill(drt.rt_thread,SIGINT); /* Try to send an interrupt?s */ pthread_detach(drt.rt_thread); /* If it's still running, just give up... */ } #endif DCC_semaphore_quit(drt.rt_event.ue_sem); /* Just in case the drt thread still had a pending * event set, clear that even to prevent any false * detection of a DRT synchronization point. */ memset(&drt.rt_event,0,sizeof(drt.rt_event)); drt.rt_flags &= ~(DRT_FLAG_STARTED); } #if DCC_TARGET_BIN == DCC_BINARY_PE { struct DRTPEInd *iter,*next; iter = drt.rt_peind.ic_first; while (iter) { next = iter->i_next; free(iter); iter = next; } } #endif } DCC_DECL_END #ifndef __INTELLISENSE__ #include "drt-sync.c.inl" #include "drt-thread.c.inl" #include "drt-user.c.inl" #endif #endif /* DCC_CONFIG_HAVE_DRT */ #endif /* !GUARD_DRT_DRT_C */
40.046189
123
0.682238
53d3b741783c4d6a0012266807bb7be8b32bfdc6
341
java
Java
dnode-protocol/src/main/java/com/tiyxing/rpc/example/SettingSync.java
bitoceango/dnode-pull
a547c4fde315a4f2c2bab69ddb83dea81f78de08
[ "MIT" ]
null
null
null
dnode-protocol/src/main/java/com/tiyxing/rpc/example/SettingSync.java
bitoceango/dnode-pull
a547c4fde315a4f2c2bab69ddb83dea81f78de08
[ "MIT" ]
2
2020-06-16T01:24:08.000Z
2021-01-21T00:51:11.000Z
dnode-protocol/src/main/java/com/tiyxing/rpc/example/SettingSync.java
tiyxing/dnode-pull
a547c4fde315a4f2c2bab69ddb83dea81f78de08
[ "MIT" ]
null
null
null
package com.tiyxing.rpc.example; import com.google.gson.JsonPrimitive; import lombok.extern.slf4j.Slf4j; /** * @author tiyxing * @date 2020-01-05 * @since 1.0.0 */ @Slf4j public class SettingSync { public void syncRespond(JsonPrimitive setting){ log.info("vehicle handle setting sync respond complete :{}",setting); } }
20.058824
76
0.706745
dc03ced61eba2baa387c41ade6742012983dbecd
2,260
py
Python
modelvshuman/datasets/base.py
TizianThieringer/model-vs-human
17729b8167520f682d93d55c340c27de07bb2681
[ "Apache-2.0", "CC-BY-4.0", "MIT" ]
158
2021-06-04T15:19:58.000Z
2022-03-30T00:31:28.000Z
modelvshuman/datasets/base.py
TizianThieringer/model-vs-human
17729b8167520f682d93d55c340c27de07bb2681
[ "Apache-2.0", "CC-BY-4.0", "MIT" ]
7
2021-07-20T03:57:34.000Z
2022-02-01T11:00:47.000Z
modelvshuman/datasets/base.py
TizianThieringer/model-vs-human
17729b8167520f682d93d55c340c27de07bb2681
[ "Apache-2.0", "CC-BY-4.0", "MIT" ]
14
2021-06-16T13:33:11.000Z
2022-03-29T15:04:09.000Z
#!/usr/bin/env python3 import os from os.path import join as pjoin class Dataset(object): """Base Dataset class Attributes: name (str): name of the dataset params (object): Dataclass object contains following attributes path, image_size, metric, decision_mapping, experiments and container_session loader (pytorch loader): Data loader args (dict): Other arguments """ def __init__(self, name, params, loader, *args, **kwargs): self.name = name self.image_size = params.image_size self.decision_mapping = params.decision_mapping self.info_mapping = params.info_mapping self.experiments = params.experiments self.metrics = params.metrics self.contains_sessions = params.contains_sessions self.args = args self.kwargs = kwargs resize = False if params.image_size == 224 else True if self.contains_sessions: self.path = pjoin(params.path, "dnn/") else: self.path = params.path assert os.path.exists(self.path), f"dataset {self.name} path not found: " + self.path if self.contains_sessions: assert all(f.startswith("session-") for f in os.listdir(self.path)) else: assert not any(f.startswith("session-") for f in os.listdir(self.path)) if self.experiments: for e in self.experiments: e.name = self.name self._loader = None # this will be lazy-loaded the first time self.loader (the dataloader instance) is called self._loader_callback = lambda: loader()(self.path, resize=resize, batch_size=self.kwargs["batch_size"], num_workers=self.kwargs["num_workers"], info_mapping=self.info_mapping) @property def loader(self): if self._loader is None: self._loader = self._loader_callback() return self._loader @loader.setter def loader(self, new_loader): self._loader = new_loader
33.235294
118
0.576549
3e951245fa2f0e12ed2d8c8583d9912c95a9ae94
23,636
c
C
Firmware/ESP8266/Clay_ESP8266EX_Firmware/user/TCP_Combined.c
mgub/Clay
31a84237d09eb93affb9b2587ff1d5b9a2b8c6a6
[ "MIT" ]
null
null
null
Firmware/ESP8266/Clay_ESP8266EX_Firmware/user/TCP_Combined.c
mgub/Clay
31a84237d09eb93affb9b2587ff1d5b9a2b8c6a6
[ "MIT" ]
null
null
null
Firmware/ESP8266/Clay_ESP8266EX_Firmware/user/TCP_Combined.c
mgub/Clay
31a84237d09eb93affb9b2587ff1d5b9a2b8c6a6
[ "MIT" ]
1
2018-12-19T07:07:50.000Z
2018-12-19T07:07:50.000Z
/* * TCP_Combined.c * * Created on: Mar 31, 2016 * Author: thebh_000 */ //TCP Combined Task. // watches for messages in outgoing queue // sends messages after they are removed from the buffer. // watches for messages from TCP. // puts messages into incoming buffer. // //Later, we can look at separating these into two tasks, as has been // done with TCP_Transmitter and TCP_Receiver, (but hopefully with // a working implementation...) // ////Includes ////////////////////////////////////////////////////// #include "esp_common.h" #include "stdio.h" #include "string.h" #include "UART.h" #include "TCP_Combined.h" #include "Wifi_Message_Serialization.h" #include "System_Monitor.h" #include "Message_Queue.h" #include "Message.h" #include "Queues.h" #include "AddressSerialization.h" #include "Multibyte_Ring_Buffer.h" ////Macros //////////////////////////////////////////////////////// #define DATA_CONNECT_ATTEMPT_MAX 10 #define RECEIVE_DATA_SIZE 1024 #define TRANSMIT_DATA_SIZE 1024 #define LOCAL_TCP_PORT 3000 #define ADDR_STRING_SIZE 50 #define CONNECT_TIMEOUT_ms 100 #define LISTEN_TIMEOUT_ms 100 #define CONNECT_ATTEMPT_MAX 5 #define MESSAGE_TRIGGER_LEVEL 10 #define RECEIVE_BYTES_TRIGGER_LEVEL 512 #define CONNECT_RETRY_TIME 100000 ////Typedefs ///////////////////////////////////////////////////// typedef struct { int socket; struct sockaddr_in * address; volatile bool connected; } Connect_Task_Args; ////Globals ///////////////////////////////////////////////////// bool task_running = false; ////Local vars///////////////////////////////////////////////////// static int32 listen_sock; static int32 data_sock; static int32 received_count; static xTaskHandle idle_handle; static bool connected; static bool promoted; //static char *receive_data; static char *transmit_data; static char * local_address_string; static char * remote_address_string; struct sockaddr_in local_address; struct sockaddr_in remote_address; static Message * temp_msg_ptr; static Message_Type * ignored_message_type; static uint32 last_tcp_activity_time; static uint32 tcp_connection_timeout_us = 2500000; static bool listening; static bool opening_connection = false; static Message_Type connection_type; static const char http_get_format[] = "GET %s HTTP/1.1\r\n\r\n"; static Multibyte_Ring_Buffer tcp_rx_multibyte; ////Local Prototypes/////////////////////////////////////////////// static int32 Open_Listen_Connection(char * local_addr_string, struct sockaddr_in * local_addr); static int32 Listen(int32 listen_socket, char * remote_addr_string, struct sockaddr_in * remote_addr); static int32 Open_Data_Connection(struct sockaddr_in * remote_addr); static bool Initiate_Connection_For_Outgoing_Message(); static bool Dequeue_And_Transmit(int32 data_sock); static bool Receive_And_Enqueue(int32 data_sock); static bool Send_Message(int32 destination_socket, Message * m); static int32 Receive(int32 source_socket, char * destination, uint32 receive_length_max); static bool Check_Needs_Promotion(); static void Connect_Task(void * PvParams); static void Data_Disconnect(); static void Listen_Disconnect(); static bool TCP_Timeout_Check(); static bool Prepare_Http_Message(Message * m); ////Global implementations //////////////////////////////////////// bool ICACHE_RODATA_ATTR TCP_Combined_Init() { bool rval = true; if (!task_running) { idle_handle = xTaskGetIdleTaskHandle(); promoted = false; //crit sections are internal to ring buffer, because of the length of some of its functions. Multibyte_Ring_Buffer_Init(&tcp_rx_multibyte, RECEIVE_DATA_SIZE); taskENTER_CRITICAL(); Free_Message_Queue(&outgoing_tcp_message_queue); local_address_string = zalloc(ADDR_STRING_SIZE); remote_address_string = zalloc(ADDR_STRING_SIZE); transmit_data = zalloc(TRANSMIT_DATA_SIZE); taskEXIT_CRITICAL(); taskYIELD(); xTaskHandle TCP_combined_handle; xTaskCreate(TCP_Combined_Task, "TCP combined", 256, NULL, DEFAULT_PRIORITY, &TCP_combined_handle); System_Register_Task(TASK_TYPE_TCP_RX, TCP_combined_handle, Check_Needs_Promotion); if (TCP_combined_handle != NULL) { task_running = true; } } else { rval = false; } return rval; } void ICACHE_RODATA_ATTR TCP_Combined_Deinit() { if (task_running) { connected = false; Data_Disconnect(); Listen_Disconnect(); taskENTER_CRITICAL(); Free_Message_Queue(&outgoing_tcp_message_queue); outgoing_tcp_message_count = 0; taskEXIT_CRITICAL(); free(local_address_string); free(remote_address_string); Multibyte_Ring_Buffer_Free(&tcp_rx_multibyte); free(transmit_data); task_running = false; System_Stop_Task(TASK_TYPE_TCP_RX); } } void ICACHE_RODATA_ATTR TCP_Combined_Task() { for (;;) { connected = false; opening_connection = true; #if ENABLE_TCP_COMBINED_RX //open listener while (!listening && (listen_sock = Open_Listen_Connection(local_address_string, &local_address)) < 0) { taskYIELD(); } #endif //listen for incoming connection, start a connection if we have an outgoing message. while (!connected) { #if ENABLE_TCP_COMBINED_RX data_sock = Listen(listen_sock, remote_address_string, &remote_address); connected = data_sock > -1; #endif #if ENABLE_TCP_COMBINED_TX if (!connected) { connected = Initiate_Connection_For_Outgoing_Message(); } #endif taskYIELD(); } opening_connection = false; while (connected) { #if ENABLE_TCP_COMBINED_TX connected = Dequeue_And_Transmit(data_sock); #endif #if ENABLE_TCP_COMBINED_RX connected &= Receive_And_Enqueue(data_sock); #endif connected &= TCP_Timeout_Check(); taskYIELD(); } } } ////Local implementations //////////////////////////////////////// //initialize listener socket. Set up timeout too. static int32 ICACHE_RODATA_ATTR Open_Listen_Connection(char * local_addr_string, struct sockaddr_in * local_addr) { uint16 server_port = LOCAL_TCP_PORT; int32 listen_socket = -1; int32 bind_result; int32 listen_result; taskENTER_CRITICAL(); memset(local_addr, 0, sizeof(struct sockaddr_in)); taskEXIT_CRITICAL(); local_addr->sin_family = AF_INET; local_addr->sin_addr.s_addr = INADDR_ANY; local_addr->sin_len = sizeof(*local_addr); local_addr->sin_port = htons(server_port); taskENTER_CRITICAL(); Serialize_Address(Get_IP_Address(), ntohs(local_addr->sin_port), local_addr_string, 50); taskEXIT_CRITICAL(); taskYIELD(); listen_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (listen_socket > -1) { /* Bind to the local port */ bind_result = lwip_bind(listen_socket, (struct sockaddr *) local_addr, sizeof(*local_addr)); taskYIELD(); if (bind_result != 0) { int32 error = 0; uint32 optionLength = sizeof(error); int getReturn = lwip_getsockopt(listen_socket, SOL_SOCKET, SO_ERROR, &error, &optionLength); lwip_close(listen_socket); listen_socket = -1; } else { int millis = LISTEN_TIMEOUT_ms; lwip_setsockopt(listen_socket, SOL_SOCKET, SO_RCVTIMEO, &millis, sizeof(millis)); } } taskYIELD(); if (listen_socket > -1) { listen_result = lwip_listen(listen_socket, TCP_MAX_CONNECTIONS); if (listen_result != 0) { int32 error = 0; uint32 optionLength = sizeof(error); int getReturn = lwip_getsockopt(listen_socket, SOL_SOCKET, SO_ERROR, &error, &optionLength); lwip_close(listen_socket); listen_socket = -1; } else { listening = true; } } taskYIELD(); return listen_socket; } //accepts connections static int32 ICACHE_RODATA_ATTR Listen(int32 listen_socket, char * remote_addr_string, struct sockaddr_in * remote_addr) { int32 accepted_sock; int32 len = sizeof(struct sockaddr_in); if ((accepted_sock = lwip_accept(listen_socket, (struct sockaddr *) remote_addr, (socklen_t *) &len)) < 0) { int32 error = 0; uint32 option_length = sizeof(error); int getReturn = lwip_getsockopt(listen_socket, SOL_SOCKET, SO_ERROR, &error, &option_length); accepted_sock = -1; } else { //Set receive timeout. int millis = TCP_RECEIVE_CONNECTION_TIMEOUT_ms; lwip_setsockopt(accepted_sock, SOL_SOCKET, SO_RCVTIMEO, &millis, sizeof(millis)); last_tcp_activity_time = system_get_time(); taskENTER_CRITICAL(); Serialize_Address(remote_addr->sin_addr.s_addr, ntohs(remote_addr->sin_port), remote_addr_string, 50); taskEXIT_CRITICAL(); connection_type = MESSAGE_TYPE_TCP; } return accepted_sock; } static bool ICACHE_RODATA_ATTR Initiate_Connection_For_Outgoing_Message() { bool rval = false; Message * connection_message = NULL; taskYIELD(); taskENTER_CRITICAL(); //do not dequeue. leave the message in the queue to be processed by the send function.. temp_msg_ptr = Peek_Message(&outgoing_tcp_message_queue); if (temp_msg_ptr != NULL) { connection_message = Create_Message(); Set_Message_Type(connection_message, temp_msg_ptr->message_type); Set_Message_Source(connection_message, temp_msg_ptr->source); Set_Message_Destination(connection_message, temp_msg_ptr->destination); Set_Message_Content_Type(connection_message, temp_msg_ptr->content_type); Set_Message_Content(connection_message, temp_msg_ptr->content, temp_msg_ptr->content_length); connection_type = Get_Message_Type_From_Str( connection_message->message_type); } taskEXIT_CRITICAL(); taskYIELD(); if (temp_msg_ptr != NULL) { temp_msg_ptr = NULL; taskYIELD(); if (connection_type == MESSAGE_TYPE_HTTP) { taskENTER_CRITICAL(); char * start_of_uri = strchr(connection_message->destination, *http_uri_delimiter_fs); taskEXIT_CRITICAL(); if (start_of_uri == NULL) { taskENTER_CRITICAL(); start_of_uri = strchr(connection_message->destination, *http_uri_delimiter_bs); taskEXIT_CRITICAL(); } if (start_of_uri != NULL) { *start_of_uri = '\0'; taskENTER_CRITICAL(); Deserialize_Address(connection_message->destination, &remote_address, ignored_message_type); taskEXIT_CRITICAL(); taskENTER_CRITICAL(); memset(remote_address_string, 0, ADDR_STRING_SIZE); strncpy(remote_address_string, connection_message->destination, start_of_uri - connection_message->destination); taskEXIT_CRITICAL(); rval = true; } else { taskENTER_CRITICAL(); Deserialize_Address(connection_message->destination, &remote_address, ignored_message_type); taskEXIT_CRITICAL(); taskENTER_CRITICAL(); sprintf(remote_address_string, connection_message->destination); taskEXIT_CRITICAL(); rval = true; } } else { taskENTER_CRITICAL(); Deserialize_Address(connection_message->destination, &remote_address, ignored_message_type); taskEXIT_CRITICAL(); taskENTER_CRITICAL(); sprintf(remote_address_string, connection_message->destination); taskEXIT_CRITICAL(); rval = true; } if (rval) { data_sock = Open_Data_Connection(&remote_address); taskYIELD(); rval = data_sock > -1; } if (rval) { socklen_t sockaddr_size = sizeof(local_address); getsockname(data_sock, (struct sockaddr* )&local_address, &sockaddr_size); last_tcp_activity_time = system_get_time(); taskYIELD(); taskENTER_CRITICAL(); Serialize_Address(local_address.sin_addr.s_addr, local_address.sin_port, local_address_string, ADDR_STRING_SIZE); taskEXIT_CRITICAL(); } else { Message * m = Dequeue_Message(&outgoing_tcp_message_queue); if (m != NULL) { --outgoing_tcp_message_count; //couldn't connect. drop this message Delete_Message(m); } } if (connection_message != NULL) { Delete_Message(connection_message); } taskYIELD(); } return rval; } //used to initiate connection. static ICACHE_RODATA_ATTR int32 Open_Data_Connection( struct sockaddr_in * remote_addr) { int opened_socket; opened_socket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); if (opened_socket != -1) { int retries = 0; int millis = CONNECT_TIMEOUT_ms; setsockopt(opened_socket, SOL_SOCKET, SO_RCVTIMEO, &millis, sizeof(millis)); taskYIELD(); Connect_Task_Args connect_args = { opened_socket, remote_addr, false }; xTaskHandle connect_task_handle = NULL; while (connect_task_handle == NULL) { //start new task to connect //high water mark recorded as 28 bytes. Leaving this stack at 128 for safety. xTaskCreate(Connect_Task, "tcp connect task", configMINIMAL_STACK_SIZE, &connect_args, System_Get_Task_Priority(TASK_TYPE_TCP_TX), &connect_task_handle); if (connect_task_handle == NULL) { //raise priority so we make sure connect task gets cleaned up. xTaskHandle idle_handle = xTaskGetIdleTaskHandle(); vTaskPrioritySet(idle_handle, System_Get_Task_Priority(TASK_TYPE_TCP_TX)); vTaskDelay(250 / portTICK_RATE_MS); vTaskPrioritySet(idle_handle, 0); } } if (connect_task_handle != NULL) { uint32 connect_start_time_us = system_get_time(); while (!connect_args.connected && (system_get_time() - connect_start_time_us) < CONNECT_RETRY_TIME) { vTaskDelay(10 / portTICK_RATE_MS); } } if (connect_args.connected) { //task doesn't need to be deleted in this case. if we connected // by now, then the task has deleted itself. millis = TCP_RECEIVE_CONNECTION_TIMEOUT_ms; setsockopt(opened_socket, SOL_SOCKET, SO_RCVTIMEO, &millis, sizeof(millis)); } else { vTaskDelete(connect_task_handle); taskYIELD(); vTaskPrioritySet(idle_handle, System_Get_Task_Priority(TASK_TYPE_TCP_TX)); vTaskDelay(250 / portTICK_RATE_MS); vTaskPrioritySet(idle_handle, 0); lwip_close(opened_socket); opened_socket = -1; } } return opened_socket; } static ICACHE_RODATA_ATTR void Connect_Task(void * PvParams) { ((Connect_Task_Args*) PvParams)->connected = connect(((Connect_Task_Args* )PvParams)->socket, (struct sockaddr * )(((Connect_Task_Args* )PvParams)->address), sizeof(struct sockaddr_in)) == 0; vTaskDelete(NULL); } //send a message to the static ICACHE_RODATA_ATTR bool Send_Message(int32 destination_socket, Message * m) { if (m == NULL) { return true; } size_t length = 0; taskENTER_CRITICAL(); bool rval = strstr(m->destination, remote_address_string) != NULL; taskEXIT_CRITICAL(); if (rval) { if (connection_type == MESSAGE_TYPE_HTTP && (m->content_length) <= MAXIMUM_MESSAGE_LENGTH - 19) //get adds on this much { taskENTER_CRITICAL(); rval = Prepare_Http_Message(m); taskEXIT_CRITICAL(); } else { taskENTER_CRITICAL(); length = (size_t) Serialize_Message_Content(m, transmit_data, TRANSMIT_DATA_SIZE); taskEXIT_CRITICAL(); rval = true; } if (rval) { taskYIELD(); if (connection_type == MESSAGE_TYPE_HTTP) { rval = lwip_write(destination_socket, m->content, m->content_length) == m->content_length; taskYIELD(); } else { rval = lwip_write(destination_socket, transmit_data, length) == length; } taskYIELD(); if (!rval) { int32 error = 0; uint32 optionLength = sizeof(error); int getReturn = lwip_getsockopt(destination_socket, SOL_SOCKET, SO_ERROR, &error, &optionLength); // taskENTER_CRITICAL(); // printf("error: %d", error); // taskEXIT_CRITICAL(); switch (error) { case ECONNRESET: { //we disconnected. return false. Data_Disconnect(); break; } case EAGAIN: { rval = true; break; } default: { rval = true; break; } } } else { last_tcp_activity_time = system_get_time(); } } } else { rval = true; } Delete_Message(m); return rval; } static bool ICACHE_RODATA_ATTR Dequeue_And_Transmit(int32 data_sock) { bool rval = false; Message * message = NULL; taskENTER_CRITICAL(); message = Dequeue_Message(&outgoing_tcp_message_queue); taskEXIT_CRITICAL(); if (message != NULL) { --outgoing_tcp_message_count; taskYIELD(); rval = Send_Message(data_sock, message); } else { //we have no reason to think we've been disconnected. rval = true; } return rval; } static bool ICACHE_RODATA_ATTR Receive_And_Enqueue(int32 data_sock) { bool rval = true; uint32_t received_message_length = 0; Message * dequeued_message = NULL; taskENTER_CRITICAL(); uint32_t rx_temp_buffer_size = tcp_rx_multibyte.max_count + 2; //add extra so we have room for null terminator. char * rx_temp_buffer = zalloc(rx_temp_buffer_size); taskEXIT_CRITICAL(); //crit sections are internal to ring buffer, because of the length of some of its functions. uint32_t buffer_free = Multibyte_Ring_Buffer_Get_Free_Size( &tcp_rx_multibyte); taskYIELD(); received_count = Receive(data_sock, rx_temp_buffer, buffer_free); //crit sections are internal to ring buffer, because of the length of some of its functions. Multibyte_Ring_Buffer_Enqueue(&tcp_rx_multibyte, rx_temp_buffer, received_count); taskYIELD(); if (Multibyte_Ring_Buffer_Get_Count(&tcp_rx_multibyte) > 0) { // DEBUG_Print("rx data"); if (connection_type == MESSAGE_TYPE_TCP) { // DEBUG_Print("tcp msg"); //free, because the dequeue method below allocates into the pointer sent. free(rx_temp_buffer); rx_temp_buffer = NULL; //crit sections are internal to ring buffer, because of the length of some of its functions. Multibyte_Ring_Buffer_Dequeue_Serialized_Message_Content( &tcp_rx_multibyte, &rx_temp_buffer); if (rx_temp_buffer != NULL) { // DEBUG_Print("rx'd msg"); taskENTER_CRITICAL(); dequeued_message = Deserialize_Message_Content(rx_temp_buffer); taskEXIT_CRITICAL(); free(rx_temp_buffer); } } else { //parse http message out of queue // example message: // HTTP/1.1 200 OK // X-Powered-By: Express // Content-Type: application/text; charset=utf-8 // Content-Length: 6 // ETag: W/"6-+nKcZrG+cjY967w8u/TfRA" // Date: Sat, 30 Apr 2016 23:50:41 GMT // Connection: keep-alive // // 130128 //TODO: get the content_type out of here as well. // DEBUG_Print("http rx attempt"); //dq until Content-Length: //crit sections are internal to ring buffer, because of the length of some of its functions. uint32_t dequeued_count = Multibyte_Ring_Buffer_Dequeue_Until_String( &tcp_rx_multibyte, rx_temp_buffer, rx_temp_buffer_size, "Content-Length:"); if (dequeued_count != 0) { // DEBUG_Print("cl"); //dq until newline taskENTER_CRITICAL(); memset(rx_temp_buffer, 0, rx_temp_buffer_size); taskEXIT_CRITICAL(); //crit sections are internal to ring buffer, because of the length of some of its functions. dequeued_count = Multibyte_Ring_Buffer_Dequeue_Until_String( &tcp_rx_multibyte, rx_temp_buffer, rx_temp_buffer_size, "\r\n"); if (dequeued_count != 0) { //parse content-length value out of last parsed string taskENTER_CRITICAL(); received_message_length = atoi(rx_temp_buffer); // printf("cl:%d", received_message_length); taskEXIT_CRITICAL(); //crit sections are internal to ring buffer, because of the length of some of its functions. dequeued_count = Multibyte_Ring_Buffer_Dequeue_Until_String( &tcp_rx_multibyte, rx_temp_buffer, rx_temp_buffer_size, "Connection:"); //dq until Connection: if (dequeued_count != 0) { // DEBUG_Print("got connection"); //crit sections are internal to ring buffer, because of the length of some of its functions. //dq until \n\n dequeued_count = Multibyte_Ring_Buffer_Dequeue_Until_String( &tcp_rx_multibyte, rx_temp_buffer, rx_temp_buffer_size, "\r\n\r\n"); if (dequeued_count != 0) { // DEBUG_Print("got doublenewlien"); //crit sections are internal to ring buffer, because of the length of some of its functions. dequeued_count = Multibyte_Ring_Buffer_Dequeue( &tcp_rx_multibyte, rx_temp_buffer, received_message_length); //dq content-length bytes. if (dequeued_count == received_message_length) { // DEBUG_Print("got message"); taskENTER_CRITICAL(); dequeued_message = Create_Message(); Set_Message_Content_Type(dequeued_message, content_type_strings[CONTENT_TYPE_BINARY]); Set_Message_Content(dequeued_message, rx_temp_buffer, received_message_length); taskEXIT_CRITICAL(); taskYIELD(); } } } } } free(rx_temp_buffer); } } else { // DEBUG_Print("no rx data"); free(rx_temp_buffer); } if (dequeued_message != NULL) { taskENTER_CRITICAL(); Set_Message_Type(dequeued_message, message_type_strings[connection_type]); Set_Message_Source(dequeued_message, remote_address_string); Set_Message_Destination(dequeued_message, local_address_string); incoming_message_count = Queue_Message(&incoming_message_queue, dequeued_message); // DEBUG_Print("nq"); taskEXIT_CRITICAL(); } taskYIELD(); if (received_count < 0) { Data_Disconnect(); rval = false; } return rval; } static ICACHE_RODATA_ATTR int Receive(int32 source_socket, char * destination, uint32 receive_length_max) { if (destination == NULL) { return 0; } int rval = lwip_recv(source_socket, destination, receive_length_max, 0); if (rval < 0) { int32 error = 0; uint32 optionLength = sizeof(error); int getReturn = lwip_getsockopt(source_socket, SOL_SOCKET, SO_ERROR, &error, &optionLength); switch (error) { case ECONNRESET: { rval = -1; break; } case EAGAIN: { rval = 0; break; } default: { break; } } } if (rval > 0) { last_tcp_activity_time = system_get_time(); } return rval; } static void ICACHE_RODATA_ATTR Data_Disconnect() { if (!opening_connection && (data_sock > -1)) { // DEBUG_Print("data_disconnect"); //crit sections are internal to ring buffer, because of the length of some of its functions. Multibyte_Ring_Buffer_Reset(&tcp_rx_multibyte); shutdown(data_sock, 2); lwip_close(data_sock); data_sock = -1; connected = false; } } static void ICACHE_RODATA_ATTR Listen_Disconnect() { // DEBUG_Print("listen_disconnect"); if (listening || listen_sock > -1) { shutdown(listen_sock, 2); lwip_close(listen_sock); listen_sock = -1; listening = false; } } static bool ICACHE_RODATA_ATTR Check_Needs_Promotion() { bool rval = false; //crit sections are internal to ring buffer, because of the length of some of its functions. rval = (outgoing_tcp_message_count > 5 || Multibyte_Ring_Buffer_Get_Count(&tcp_rx_multibyte) > RECEIVE_BYTES_TRIGGER_LEVEL); return rval; } static bool ICACHE_RODATA_ATTR TCP_Timeout_Check() { bool rval = true; if ((system_get_time() - last_tcp_activity_time) > tcp_connection_timeout_us) { Data_Disconnect(); rval = false; } return rval; } static bool ICACHE_RODATA_ATTR Prepare_Http_Message(Message * m) { bool rval = false; char * start_of_uri; start_of_uri = strchr(m->destination, *http_uri_delimiter_fs); if (start_of_uri == NULL) { start_of_uri = strchr(m->destination, *http_uri_delimiter_bs); } if (start_of_uri != NULL) { char * temp = zalloc( strlen(m->destination) + strlen(http_get_format) + 10); m->content_length = sprintf(temp, http_get_format, start_of_uri); Set_Message_Content(m, temp, strlen(temp)); free(temp); rval = true; } return rval; }
22.858801
112
0.706042