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
2196cde4b8ad853457020165ecfb51ed22a3d899
75
rs
Rust
src/common/mod.rs
andreytkachenko/opencm
fc4b1990be41317cde9c9e55b61df8d94fc873d2
[ "MIT" ]
3
2018-02-08T21:37:05.000Z
2018-11-01T07:31:34.000Z
src/common/mod.rs
andreytkachenko/opencm
fc4b1990be41317cde9c9e55b61df8d94fc873d2
[ "MIT" ]
null
null
null
src/common/mod.rs
andreytkachenko/opencm
fc4b1990be41317cde9c9e55b61df8d94fc873d2
[ "MIT" ]
null
null
null
mod volatile_cell; pub mod asm; pub use self::volatile_cell::VolatileCell;
18.75
42
0.8
3e57121b969b771d0035bbd8dfea65bdbd2bce6b
1,811
asm
Assembly
examples/T/T.asm
brickpool/hp35s
14fc5881af7f72e1dbbf408d0201b411e16a9190
[ "MIT" ]
3
2020-12-08T08:13:46.000Z
2021-12-15T06:06:57.000Z
examples/T/T.asm
brickpool/hp35s
14fc5881af7f72e1dbbf408d0201b411e16a9190
[ "MIT" ]
null
null
null
examples/T/T.asm
brickpool/hp35s
14fc5881af7f72e1dbbf408d0201b411e16a9190
[ "MIT" ]
null
null
null
; This program calculates the sides, angles and area of a triangle MODEL P35S SEGMENT CODE LBL T A01: RCL U ; RCL 4 SIN RCL Z ; RCL 3 * RCL X ; RCL 1 / ASIN ; SIN^-1 STOP STO W ; STO 6 A10: RCL W ; RCL 6 RCL U ; RCL 4 + STO V ; STO 5 GTO A19 A15: RCL V ; RCL 5 RCL U ; RCL 4 + STO W ; STO 6 A19: RCL V ; RCL 5 SIN RCL W ; RCL 6 SIN / RCL Z ; RCL 3 * STO Y ; STO 2 A27: B17: RCL U ; RCL 4 RCL Y ; RCL 2 XEQ P2R ; ->R RCL Z ; RCL 3 x<>y - XEQ R2P ; ->P STO X ; STO 1 x<>y STO V ; STO 5 RCL U ; RCL 4 + COS +/- ACOS STO W ; STO 6 SIN * RCL Y ; RCL 2 * 2 / RTN B01: RCL Y ; RCL 2 x^2 RCL Z ; RCL 3 x^2 + RCL X ; RCL 1 x^2 - RCL Y ; RCL 2 RCL Z ; RCL 3 * 2 * / ACOS STO U ; STO 4 GTO B17 P2R: x<>y SIN LASTx COS Rv x<>y * R^ LASTx * RTN R2P: x<>y i * + ARG LASTx ABS RTN ENDS END ; CK=DE96 ; LN=261
17.247619
66
0.256764
d2c64d900db8fb16936f69f5841eff19d147039d
5,526
php
PHP
src/pocketmine/permission/Permission.php
LiteCoreTeam/pmmp-multi
375731d63534b3bfd10b8eba006ca3d02c88d9e3
[ "Apache-2.0" ]
4
2020-10-14T11:49:51.000Z
2020-11-17T07:02:54.000Z
src/pocketmine/permission/Permission.php
LiteCoreTeam/pmmp-multi
375731d63534b3bfd10b8eba006ca3d02c88d9e3
[ "Apache-2.0" ]
1
2020-12-17T13:36:42.000Z
2020-12-17T13:36:42.000Z
src/pocketmine/permission/Permission.php
LiteCoreTeam/pmmp-multi
375731d63534b3bfd10b8eba006ca3d02c88d9e3
[ "Apache-2.0" ]
2
2021-08-12T11:01:46.000Z
2021-08-19T13:11:00.000Z
<?php /* * * ____ _ _ __ __ _ __ __ ____ * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * @author PocketMine Team * @link http://www.pocketmine.net/ * * */ declare(strict_types=1); /** * Permission related classes */ namespace pocketmine\permission; use function is_array; use function is_bool; use function strtolower; /** * Represents a permission */ class Permission{ public const DEFAULT_OP = "op"; public const DEFAULT_NOT_OP = "notop"; public const DEFAULT_TRUE = "true"; public const DEFAULT_FALSE = "false"; /** @var string */ public static $DEFAULT_PERMISSION = self::DEFAULT_OP; /** * @param bool|string $value * * @throws \InvalidArgumentException */ public static function getByName($value) : string{ if(is_bool($value)){ if($value){ return "true"; }else{ return "false"; } } switch(strtolower($value)){ case "op": case "isop": case "operator": case "isoperator": case "admin": case "isadmin": return self::DEFAULT_OP; case "!op": case "notop": case "!operator": case "notoperator": case "!admin": case "notadmin": return self::DEFAULT_NOT_OP; case "true": return self::DEFAULT_TRUE; case "false": return self::DEFAULT_FALSE; } throw new \InvalidArgumentException("Unknown permission default name \"$value\""); } /** * @param mixed[][] $data * @phpstan-param array<string, array<string, mixed>> $data * * @return Permission[] */ public static function loadPermissions(array $data, string $default = self::DEFAULT_OP) : array{ $result = []; foreach($data as $key => $entry){ $result[] = self::loadPermission($key, $entry, $default, $result); } return $result; } /** * @param mixed[] $data * @param Permission[] $output reference parameter * @phpstan-param array<string, mixed> $data * * @throws \Exception */ public static function loadPermission(string $name, array $data, string $default = self::DEFAULT_OP, array &$output = []) : Permission{ $desc = null; $children = []; if(isset($data["default"])){ $default = Permission::getByName($data["default"]); } if(isset($data["children"])){ if(is_array($data["children"])){ foreach($data["children"] as $k => $v){ if(is_array($v)){ $output[] = self::loadPermission($k, $v, $default, $output); } $children[$k] = true; } }else{ throw new \InvalidStateException("'children' key is of wrong type"); } } if(isset($data["description"])){ $desc = $data["description"]; } return new Permission($name, $desc, $default, $children); } /** @var string */ private $name; /** @var string */ private $description; /** * @var bool[] * @phpstan-var array<string, bool> */ private $children; /** @var string */ private $defaultValue; /** * Creates a new Permission object to be attached to Permissible objects * * @param bool[] $children * @phpstan-param array<string, bool> $children */ public function __construct(string $name, string $description = null, string $defaultValue = null, array $children = []){ $this->name = $name; $this->description = $description ?? ""; $this->defaultValue = $defaultValue ?? self::$DEFAULT_PERMISSION; $this->children = $children; $this->recalculatePermissibles(); } public function getName() : string{ return $this->name; } /** * @return bool[] * @phpstan-return array<string, bool> */ public function &getChildren() : array{ return $this->children; } public function getDefault() : string{ return $this->defaultValue; } /** * @return void */ public function setDefault(string $value){ if($value !== $this->defaultValue){ $this->defaultValue = $value; $this->recalculatePermissibles(); } } public function getDescription() : string{ return $this->description; } /** * @return void */ public function setDescription(string $value){ $this->description = $value; } /** * @return Permissible[] */ public function getPermissibles() : array{ return PermissionManager::getInstance()->getPermissionSubscriptions($this->name); } /** * @return void */ public function recalculatePermissibles(){ $perms = $this->getPermissibles(); PermissionManager::getInstance()->recalculatePermissionDefaults($this); foreach($perms as $p){ $p->recalculatePermissions(); } } /** * @param string|Permission $name * * @return Permission|null Permission if $name is a string, null if it's a Permission */ public function addParent($name, bool $value){ if($name instanceof Permission){ $name->getChildren()[$this->getName()] = $value; $name->recalculatePermissibles(); return null; }else{ $perm = PermissionManager::getInstance()->getPermission($name); if($perm === null){ $perm = new Permission($name); PermissionManager::getInstance()->addPermission($perm); } $this->addParent($perm, $value); return $perm; } } }
22.647541
136
0.622874
58d14508e3ce99ba25c9ca9fadbac4c988d1d5f9
536
rs
Rust
tests/unescape.rs
magiclen/base64-url
8da40a0e80a79d71e0841453b544211163a071c6
[ "MIT" ]
6
2020-05-10T20:18:25.000Z
2022-03-05T05:07:01.000Z
tests/unescape.rs
magiclen/base64-url
8da40a0e80a79d71e0841453b544211163a071c6
[ "MIT" ]
1
2019-01-20T17:46:41.000Z
2019-01-20T18:03:43.000Z
tests/unescape.rs
magiclen/base64-url
8da40a0e80a79d71e0841453b544211163a071c6
[ "MIT" ]
null
null
null
extern crate base64_url; use base64_url::base64; #[test] fn unescape() { assert_eq!( b"https://magiclen.org", base64::decode(base64_url::unescape("aHR0cHM6Ly9tYWdpY2xlbi5vcmc").as_bytes()) .unwrap() .as_slice() ); } #[test] fn unescape_in_place() { let mut base64_url_string = String::from("aHR0cHM6Ly9tYWdpY2xlbi5vcmc"); base64_url::unescape_in_place(&mut base64_url_string); assert_eq!(b"https://magiclen.org", base64::decode(base64_url_string).unwrap().as_slice()); }
23.304348
95
0.66791
e80b955e85b4a5bb3b760d4de2485b440893b5b7
302
css
CSS
css/seller.css
tassiLuca/silmarillion
3db7cc41354049d5826d723d22144403d4be079f
[ "MIT", "OLDAP-2.2.1", "Unlicense" ]
null
null
null
css/seller.css
tassiLuca/silmarillion
3db7cc41354049d5826d723d22144403d4be079f
[ "MIT", "OLDAP-2.2.1", "Unlicense" ]
null
null
null
css/seller.css
tassiLuca/silmarillion
3db7cc41354049d5826d723d22144403d4be079f
[ "MIT", "OLDAP-2.2.1", "Unlicense" ]
null
null
null
div, button, h2, ul, li, main, p{ margin : 0; padding: 0; } main { background-image: url(../img/background/drag_wall.png); height: 750px; } /********************* SELLER KEYPAD *********************/ main > section:nth-child(3) { background: rgba(0, 71, 158, 0.44); }
17.764706
69
0.490066
b607a1cf0253686a6a975ae6e35aae1ef97d0f99
42,914
rb
Ruby
lib/dashboard/charting_and_reports/charts/series_data_manager.rb
Energy-Sparks/energy-sparks_analytics
810ada0ffdc7a0934decb856d6431f1fcc07a85a
[ "MIT" ]
null
null
null
lib/dashboard/charting_and_reports/charts/series_data_manager.rb
Energy-Sparks/energy-sparks_analytics
810ada0ffdc7a0934decb856d6431f1fcc07a85a
[ "MIT" ]
38
2021-01-28T16:28:35.000Z
2022-03-28T14:18:17.000Z
lib/dashboard/charting_and_reports/charts/series_data_manager.rb
Energy-Sparks/energy-sparks_analytics
810ada0ffdc7a0934decb856d6431f1fcc07a85a
[ "MIT" ]
null
null
null
# Series Data Manager # - acts as a single interface for all requests from the aggregation process # - and other sources e.g. alerts for all energy related data # # sources of data: # - raw smart meter/amr data on half hour boundaries, could be electricity or gas # - slightly more derived versions of that data, for example storage heaters, typically auto split # from electricity data (on meter becomes 2) # - simplistic modelled data e.g. baseload # - more sophisticated model data e.g. hot water (useful, non-useful usage), # multiple regression model(predicted heating kWh, difference with actual) # - temperature data, and derived degree days (base temperature) # # breakdown of returned data: # - by time of day (weekend, holiday, school day in school hours, school day out of hours) # - by fuel (gas, electricity) through to (gas, electricity, storage heater, solar pv) # - cusum model split (monday versus all week predictions etc.), trend line data # # unit conversion # - kWh # - kW - needs averaging if aggregated # - cost (ultimately to include time of day/economy 7 pricing) # - CO2 # unit normalisation # - per pupil # - per floor # unit normalisation 2 # - degree day adjustment # # time period # - single day # - single half hour for example in intraday reporting # - time periods - on date boundaries only # # single location containing text name of each series which appears in chart legend class SeriesNames HEATINGDAY = 'Heating Day'.freeze NONHEATINGDAY = 'Non Heating Day'.freeze HEATINGSERIESNAMES = [HEATINGDAY.freeze, NONHEATINGDAY.freeze].freeze SCHOOLDAYHEATING = 'Heating On School Days'.freeze HOLIDAYHEATING = 'Heating On Holidays'.freeze WEEKENDHEATING = 'Heating On Weekends'.freeze SCHOOLDAYHOTWATER = 'Hot water/kitchen only On School Days'.freeze HOLIDAYHOTWATER = 'Hot water/kitchen only On Holidays'.freeze WEEKENDHOTWATER = 'Hot water/kitchen only On Weekends'.freeze BOILEROFF = 'Boiler Off'.freeze HEATINGDAYTYPESERIESNAMES = [SCHOOLDAYHEATING, HOLIDAYHEATING, WEEKENDHEATING, SCHOOLDAYHOTWATER, HOLIDAYHOTWATER, WEEKENDHOTWATER, BOILEROFF].freeze HEATINGDAYMODEL = 'Heating Day Model'.freeze NONHEATINGDAYMODEL = 'Non Heating Day Model'.freeze HEATINGMODELSERIESNAMES = [HEATINGDAYMODEL.freeze, NONHEATINGDAYMODEL.freeze].freeze HOLIDAY = 'Holiday'.freeze WEEKEND = 'Weekend'.freeze SCHOOLDAYOPEN = 'School Day Open'.freeze SCHOOLDAYCLOSED = 'School Day Closed'.freeze DAYTYPESERIESNAMES = [HOLIDAY.freeze, WEEKEND.freeze, SCHOOLDAYOPEN.freeze, SCHOOLDAYCLOSED.freeze].freeze DEGREEDAYS = 'Degree Days'.freeze TEMPERATURE = 'Temperature'.freeze IRRADIANCE = 'Solar Irradiance'.freeze GRIDCARBON = 'Carbon Intensity of Electricity Grid (kg/kWh)'.freeze GASCARBON = 'Carbon Intensity of Gas (kg/kWh)'.freeze TARGETDEGREEDAYS= 'Target degree days'.freeze STORAGEHEATERS = 'storage heaters' SOLARPV = 'solar pv (consumed onsite)' PREDICTEDHEAT = 'Predicted Heat'.freeze CUSUM = 'CUSUM'.freeze BASELOAD = 'BASELOAD'.freeze PEAK_KW = 'Peak (kW)'.freeze USEFULHOTWATERUSAGE = 'Hot Water Usage'.freeze WASTEDHOTWATERUSAGE = 'Wasted Hot Water Usage'.freeze HOTWATERSERIESNAMES = [USEFULHOTWATERUSAGE, WASTEDHOTWATERUSAGE].freeze NONE = 'Energy'.freeze Y2SERIESYMBOLTONAMEMAP = { degreedays: DEGREEDAYS, temperature: TEMPERATURE, irradiance: IRRADIANCE, gridcarbon: GRIDCARBON, gascarbon: GASCARBON, target_degreedays: TARGETDEGREEDAYS }.freeze def self.y2_axis_key(axis_sym, throw_exception = true) if Y2SERIESYMBOLTONAMEMAP.key?(axis_sym) Y2SERIESYMBOLTONAMEMAP[axis_sym] else if throw_exception raise EnergySparksBadChartSpecification.new('nil y2 axis specification') if axis_sym.nil? raise EnergySparksBadChartSpecification.new("unknown y2 axis specification #{axis_sym}") else nil end end end # plus dynamically generated names, for example meter names end class SeriesDataManager include Logging REMOVE_SOLAR_PV_FROM_FUEL_BREAKDOWN_CHARTS = true # TODO(PH, 26Sep2019) - remove if result satisfactory attr_reader :first_meter_date, :last_meter_date, :first_chart_date, :last_chart_date attr_reader :periods, :adjust_by_temperature, :meters def initialize(meter_collection, chart_configuration) @meter_collection = meter_collection @meter_definition = chart_configuration[:meter_definition] @breakdown_list = convert_variable_to_array(chart_configuration[:series_breakdown]) @y2_axis_list = process_y_axis_config(chart_configuration[:y2_axis]) @data_types = convert_variable_to_array(chart_configuration[:data_types]) @heating_model = nil @high_thermal_mass_heating_model = nil @hotwater_model = nil @periods = nil @chart_configuration = chart_configuration @model_type = chart_configuration.key?(:model) ? chart_configuration[:model] : :best configure_manager process_temperature_adjustment_config logger.info "Series Name Manager: Chart Creation for #{meter_collection}" end private def override_meter_end_date? @chart_configuration.key?(:calendar_picker_allow_up_to_1_week_past_last_meter_date) end private def process_y_axis_config(y2_axis_config) return [] if y2_axis_config.nil? || y2_axis_config == :none convert_variable_to_array(y2_axis_config) end private def process_temperature_adjustment_config if @chart_configuration.key?(:adjust_by_temperature) @adjust_by_temperature = true if @chart_configuration[:adjust_by_temperature].is_a?(Float) @adjust_by_temperature_value = @chart_configuration[:adjust_by_temperature] elsif @chart_configuration[:adjust_by_temperature].is_a?(Hash) @adjust_by_temperature_value = @chart_configuration[:temperature_adjustment_map] else raise EnergySparksBadChartSpecification, 'Unexpected temperature adjustment type' end end if @chart_configuration.key?(:adjust_by_average_temperature) if @chart_configuration[:adjust_by_average_temperature].is_a?(Hash) temperatures = adjusted_temperature_values_for_period(@chart_configuration[:adjust_by_average_temperature]) @adjust_by_average_temperature = temperatures.sum / temperatures.length @adjust_by_temperature = true else raise EnergySparksBadChartSpecification, 'Unexpected average temperature adjustment type' end end end private def adjusted_temperature_values_for_period(period_config) period_calc = PeriodsBase.period_factory({timescale: period_config}, @meter_collection, @first_meter_date, @last_meter_date) period = period_calc.periods[0] start_date, end_date = truncate_averaging_range(period) (start_date..end_date).to_a.map { |date| @meter_collection.temperatures.average_temperature(date) } end # allows some fault tolerance in holiday alerts, can be triggered part way through # holiday, only need one day of data for averaging temperature to be calculated private def truncate_averaging_range(period) start_date = [@first_meter_date, period.start_date].max end_date = [@last_meter_date, period.end_date].min if end_date - start_date < 0 dates = "meter #{@first_meter_date} to #{@last_meter_date} and period #{period.start_date} to #{period.end_date}" raise EnergySparksNotEnoughDataException, "No overlap for average temperature between #{dates}" end [start_date, end_date] end def convert_variable_to_array(value) if value.is_a?(Array) value else [value] end end def series_bucket_names buckets = [] [@breakdown_list + @y2_axis_list].flatten.each do |breakdown| case breakdown when :heating; buckets = combinatorially_combine(buckets, SeriesNames::HEATINGSERIESNAMES) when :heating_daytype; buckets = combinatorially_combine(buckets, SeriesNames::HEATINGDAYTYPESERIESNAMES) when :daytype; buckets = combinatorially_combine(buckets, SeriesNames::DAYTYPESERIESNAMES) when :meter; buckets = combinatorially_combine(buckets, meter_names) when :model_type; buckets += heating_model_types when :fuel; buckets = create_fuel_breakdown when :submeter; buckets += submeter_names when :accounting_cost; buckets += accounting_bill_component_names when :hotwater; buckets += SeriesNames::HOTWATERSERIESNAMES when :none; buckets.push(SeriesNames::NONE) when :cusum; buckets.push(SeriesNames::CUSUM) when :baseload; buckets.push(SeriesNames::BASELOAD) when :peak_kw; buckets.push(SeriesNames::PEAK_KW) when :predictedheat; buckets.push(SeriesNames::PREDICTEDHEAT) else if SeriesNames::Y2SERIESYMBOLTONAMEMAP.key?(breakdown) buckets.push(SeriesNames::Y2SERIESYMBOLTONAMEMAP[breakdown]) else # TODO(PH,6Feb2019) - y2 sometimes comes through as nil - not clear why this is happening upstream raise EnergySparksBadChartSpecification.new("Unknown series_definition #{breakdown}") unless breakdown.nil? end end end @series_buckets = buckets end def trendlines @chart_configuration[:trendlines].map { |series_name| self.class.trendline_for_series_name(series_name) } end def self.trendline_for_series_name(series_name) ('trendline_' + series_name.to_s).to_sym end def heating_model_types heating_model.all_heating_model_types end def model_series?(series_name) heating_model_types.include?(series_name) end def heating_model_series?(series_name) # duplicate of above> heating_model_types.include?(series_name) end def degreeday_base_temperature begin return 15.5 # tempeorary fix for unstable models PH 4Jul2019 base = heating_model.average_base_temperature return 30.0 if base > 30.0 return 10.0 if base < 10.0 return base rescue StandardError => _e # TODO(PH, 7Mar2019) - this is a little dangerous as it might give a false # impression of the base temperature, the problem lies in the simulator # which adds degree days onto the by weekly electricity daytype breakdown # chart to provide some indication whether a school has electrical heating # the existing call to the modelling infrastructure doesn't work if the # school has no gas data, need to resolve as part of the storage heater development? 20.0 end end def self.series_name_for_trendline(trendline_name) trendline_name.to_s.sub('trendline_', '' ).to_sym end def trendlines? @chart_configuration.key?(:trendlines) end def get_data(time_period) get_data_private(time_period) end def submeter_names meter = select_one_meter submeter_names = [] meter.sub_meters.values.each do |submeter| submeter_names.push(submeter.name) end submeter_names end def meter_names names = [] if !@meters[0].nil? # indication of solar pv meters only names += @meter_collection.electricity_meters.map(&:display_name) # names += @meter_collection.solar_pv_meters.map(&:display_name) end if !@meters[1].nil? # indication of heat meters only names += @meter_collection.heat_meters.map(&:display_name) names += @meter_collection.storage_heater_meters.map(&:display_name) end names end def accounting_bill_component_names names = [] @meters.each do |meter| next if meter.nil? meter.amr_data.accounting_tariff.bill_component_types.each do |bill_component_type| names.push(bill_component_type) unless names.include?(bill_component_type) end end names end def target_extend? !@chart_configuration.dig(:target, :extend_chart_into_future).nil? end # truncate requested dates to non-target meter range or return nil def target_extended_other_meter_end_date(meter, start_date, end_date) end_date = [meter.amr_data.end_date, end_date].min start_date > end_date ? [nil, nil] : [start_date, end_date] end def request_start_end_dates(meter, start_date, end_date) target_extend? ? target_extended_other_meter_end_date(meter, start_date, end_date) : [start_date, end_date] end def get_data_private(time_period) timetype, dates, halfhour_index = time_period meter = select_one_meter breakdown = {} case timetype when :halfhour, :datetime check_requested_meter_date(meter, dates, dates) breakdown = getdata_by_halfhour(meter, dates, halfhour_index) when :daterange start_date, end_date = request_start_end_dates(meter, dates[0], dates[1]) unless start_date.nil? check_requested_meter_date(meter, start_date, end_date) unless override_meter_end_date? breakdown = getdata_by_daterange(meter, start_date, end_date) end end breakdown end private def check_requested_meter_date(meter, start_date, end_date) if start_date < meter.amr_data.start_date || end_date > meter.amr_data.end_date requested_dates = start_date == end_date ? "requested data for #{start_date}" : "requested data from #{start_date} to #{end_date}" meter_dates = "meter from #{meter.amr_data.start_date} to #{meter.amr_data.end_date}: " raise EnergySparksNotEnoughDataException.new("Not enough data for chart aggregation: " + meter_dates + requested_dates) end end def get_one_days_data_x48(date, type = :kwh) meter = select_one_meter check_requested_meter_date(meter, date, date) # non optimal request amr_data_one_day_readings(meter, date, type) end # implemented for aggregator post aggregaton trend line calculation # perhaps should be better integrated into SeriesDataManager getter methods? def model_type?(date) heating_model.model_type?(date) end def model(regression_model_type) heating_model.model(regression_model_type) end def getdata_by_halfhour(meter, date, halfhour_index) breakdown = {} @breakdown_list.each do |breakdown_type| case breakdown_type when :submeter; breakdown.merge!(submeter_datetime_breakdown(meter, date, halfhour_index)) when :meter; breakdown.merge!(breakdown_to_meter_level(date, date, halfhour_index)) when :fuel; breakdown.merge!(fuel_breakdown_halfhour(date, halfhour_index, @meters[0], @meters[1])) when :daytype; breakdown.merge!(daytype_breakdown_halfhour(date, halfhour_index, meter)) when :accounting_cost; breakdown.merge!(breakdown_to_bill_components_halfhour(date, halfhour_index, meter)) else; breakdown[SeriesNames::NONE] = amr_data_by_half_hour(meter, date, halfhour_index, kwh_cost_or_co2) end end @y2_axis_list.each do |breakdown_type| case breakdown_type when :degreedays; breakdown[SeriesNames::DEGREEDAYS] = @meter_collection.temperatures.degree_hour(date, halfhour_index, degreeday_base_temperature) when :temperature; breakdown[SeriesNames::TEMPERATURE] = @meter_collection.temperatures.temperature(date, halfhour_index) when :irradiance; breakdown[SeriesNames::IRRADIANCE] = @meter_collection.solar_irradiation.solar_irradiance(date, halfhour_index) when :gridcarbon; breakdown[SeriesNames::GRIDCARBON] = @meter_collection.grid_carbon_intensity.grid_carbon_intensity(date, halfhour_index) when :gascarbon; breakdown[SeriesNames::GASCARBON] = EnergyEquivalences::UK_GAS_CO2_KG_KWH end end breakdown end def getdata_by_daterange(meter, d1, d2) breakdown = {} [@breakdown_list + @y2_axis_list].flatten.each do |breakdown_type| case breakdown_type when :daytype; breakdown = daytype_breakdown([d1, d2], meter) when :fuel; breakdown = fuel_breakdown([d1, d2], @meters[0], @meters[1]) when :heating; breakdown = heating_breakdown([d1, d2], @meters[0], @meters[1]) when :heating_daytype; breakdown = heating_daytype_breakdown([d1, d2], @meters[0], @meters[1]) when :model_type; breakdown = heating_model_breakdown([d1, d2], @meters[0], @meters[1]) when :meter; breakdown = breakdown_to_meter_level(d1, d2) when :accounting_cost; breakdown = breakdown_to_bill_components_date_range(d1, d2) when :hotwater; breakdown.merge!(hotwater_breakdown(d1, d2)) when :submeter; breakdown.merge!(submeter_breakdown(meter, d1, d2)) when :none; breakdown[SeriesNames::NONE] = amr_data_date_range(meter, d1, d2, kwh_cost_or_co2) when :baseload; breakdown[SeriesNames::BASELOAD] = meter.amr_data.baseload_kwh_date_range(d1, d2) when :peak_kw; breakdown[SeriesNames::PEAK_KW] = meter.amr_data.peak_kw_kwh_date_range(d1, d2) when :cusum; breakdown[SeriesNames::CUSUM] = cusum(meter, d1, d2) when :degreedays; breakdown[SeriesNames::DEGREEDAYS] = @meter_collection.temperatures.degrees_days_average_in_range(degreeday_base_temperature, d1, d2) when :temperature; breakdown[SeriesNames::TEMPERATURE] = @meter_collection.temperatures.average_temperature_in_date_range(d1, d2) when :irradiance; breakdown[SeriesNames::IRRADIANCE] = @meter_collection.solar_irradiation.average_daytime_irradiance_in_date_range(d1, d2) when :gridcarbon; breakdown[SeriesNames::GRIDCARBON] = @meter_collection.grid_carbon_intensity.average_in_date_range(d1, d2) when :gascarbon; breakdown[SeriesNames::GASCARBON] = EnergyEquivalences::UK_GAS_CO2_KG_KWH when :predictedheat; breakdown[SeriesNames::PREDICTEDHEAT] = heating_model.predicted_kwh_daterange(d1, d2, @meter_collection.temperatures) when :target_degreedays; breakdown[SeriesNames::TARGETDEGREEDAYS] = meter.target_degreedays_average_in_date_range(d1, d2) end end breakdown end def amr_data_by_half_hour(meter, date, halfhour_index, data_type = :kwh) meter.amr_data.kwh(date, halfhour_index, data_type) end def amr_data_one_day_readings(meter, date, data_type = :kwh) meter.amr_data.days_kwh_x48(date, data_type) end def amr_data_one_day(meter, date, data_type = :kwh) meter.amr_data.one_day_kwh(date, data_type) end def predicted_amr_data_one_day(date) heating_model.predicted_kwh(date, @meter_collection.temperatures.average_temperature(date)) end private def scaling_factor_for_model_derived_gas_data(data_type) case data_type when :£, :economic_cost; BenchmarkMetrics::GAS_PRICE when :accounting_cost; BenchmarkMetrics::GAS_PRICE # TODO(PH, 7Apr2019) - not correct, need to look up accounting tariff on day when :co2; EnergyEquivalences::UK_GAS_CO2_KG_KWH else; 1.0 end end def amr_data_date_range(meter, start_date, end_date, data_type) if @adjust_by_temperature && meter.fuel_type == :gas scale = scaling_factor_for_model_derived_gas_data(data_type) if @adjust_by_temperature_value.is_a?(Float) scale * heating_model.temperature_compensated_date_range_gas_kwh(start_date, end_date, @adjust_by_temperature_value, 0.0) elsif !@adjust_by_average_temperature.nil? scale * heating_model.temperature_compensated_date_range_gas_kwh(start_date, end_date, @adjust_by_average_temperature, 0.0) elsif @adjust_by_temperature_value.is_a?(Hash) # see aggregator.temperature_compensation_temperature_map comments for more detailed explanation # but adjusts gas data to corresponding temperatures of first series total_adjusted_kwh = 0.0 (start_date..end_date).each do |date| total_adjusted_kwh += heating_model.temperature_compensated_one_day_gas_kwh(date, @adjust_by_temperature_value[date]) end [scale * total_adjusted_kwh, 0.0].max else raise EnergySparksUnexpectedStateException, "Expecting Float or Hash for @adjust_by_temperature_value when @adjust_by_temperature true: #{@adjust_by_temperature_value}" end elsif override_meter_end_date? total = 0.0 (start_date..end_date).each do |date| total += date > meter.amr_data.end_date ? 0.0 : meter.amr_data.one_day_kwh(date, data_type) end total else meter.amr_data.kwh_date_range(start_date, end_date, data_type) end end def heating_model @heating_model = calculate_model if @heating_model.nil? @heating_model end def kwh_cost_or_co2 case @chart_configuration[:yaxis_units] when :£; :economic_cost when :accounting_cost; :accounting_cost when :co2; :co2 else; :kwh end end def trendline_scale scaling_factor_for_model_derived_gas_data(kwh_cost_or_co2) end private def create_fuel_breakdown buckets = ['electricity', 'gas'] buckets.push(SeriesNames::STORAGEHEATERS) if @meter_collection.storage_heaters? buckets.push(SeriesNames::SOLARPV) if @meter_collection.solar_pv_panels? && !REMOVE_SOLAR_PV_FROM_FUEL_BREAKDOWN_CHARTS buckets end # combinatorially combine 2 arrays of series names def combinatorially_combine(set_one, set_two) if set_one.empty? set_two.dup elsif set_two.empty? set_one.dup else all_keys = [] set_one.each do |one| set_two.each do |two| all_keys.push(one + ': ' + two) end end all_keys end end def calculate_model non_heating_model_type = @chart_configuration[:non_heating_model] calculate_model_by_type(@model_type, non_heating_model_type) end def calculate_model_by_type(model_type, non_heating_model_type = nil) # model calculated using the latest year's regression data,deliberately ignores chart request last_year = SchoolDatePeriod.year_to_date(:year_to_date, 'validate amr', @last_meter_date, @first_meter_date) meter = select_one_meter([:gas, :storage_heater]) logger.info "Calculating heating model for #{meter.mpxn} - SeriesDataManager::calculate_model_by_type" meter.heating_model(last_year, model_type, non_heating_model_type) end def calculate_hotwater_model @hotwater_model = AnalyseHeatingAndHotWater::HotwaterModel.new(@meter_collection) if @hotwater_model.nil? @hotwater_model end # TODO(PH,22May2018) meter selection needs revisiting def select_one_meter(preferred_fuel_types = nil) if @meters[0].nil? @meters[1] elsif !preferred_fuel_types.nil? if !@meters[0].nil? && [preferred_fuel_types].flatten.include?(@meters[0].fuel_type) @meters[0] else @meters[1] end else @meters[0] end end def daytype_breakdown(date_range, meter) data_type = kwh_cost_or_co2 daytype_data = { SeriesNames::HOLIDAY => 0.0, SeriesNames::WEEKEND => 0.0, SeriesNames::SCHOOLDAYOPEN => 0.0, SeriesNames::SCHOOLDAYCLOSED => 0.0 } (date_range[0]..date_range[1]).each do |date| begin if @meter_collection.holidays.holiday?(date) daytype_data[SeriesNames::HOLIDAY] += amr_data_one_day(meter, date, data_type) elsif DateTimeHelper.weekend?(date) daytype_data[SeriesNames::WEEKEND] += amr_data_one_day(meter, date, data_type) else open_kwh, close_kwh = intraday_breakdown(meter, date, data_type) daytype_data[SeriesNames::SCHOOLDAYOPEN] += open_kwh daytype_data[SeriesNames::SCHOOLDAYCLOSED] += close_kwh end rescue StandardError => e logger.error "Unable to aggregate data for #{date} - exception raise" raise e end end daytype_data end def close_to(v1, v2, max_diff) if v1 == 0 && v2 == 0 return true else return ((v1 - v2) / v1) < max_diff end end # for speed aggregate single day breakdown using ranges # does fractional calculation if open/close time not on 30 minute boundary (TODO (PH, 6Feb2019) currently untested) def intraday_breakdown(meter, date, data_type) if @cached_weighted_open_x48.nil? # fudge: override start time if storage heater: TODO(PH, 30Oct2019) move to specialised Meter class # start_time = meter.meter_type == :storage_heater ? TimeOfDay.new(0, 0) : @meter_collection.open_time start_time = @meter_collection.open_time open_time = start_time..@meter_collection.close_time @cached_weighted_open_x48 = DateTimeHelper.weighted_x48_vector_multiple_ranges([open_time]) end one_day_readings = amr_data_one_day_readings(meter, date, data_type) open_kwh_x48 = AMRData.fast_multiply_x48_x_x48(one_day_readings, @cached_weighted_open_x48) open_kwh = open_kwh_x48.sum close_kwh = amr_data_one_day(meter, date, data_type) - open_kwh [open_kwh, close_kwh] end def daytype_breakdown_halfhour(date, halfhour_index, meter) val = amr_data_by_half_hour(meter, date, halfhour_index, kwh_cost_or_co2) daytype_data = { SeriesNames::HOLIDAY => 0.0, SeriesNames::WEEKEND => 0.0, SeriesNames::SCHOOLDAYOPEN => 0.0, SeriesNames::SCHOOLDAYCLOSED => 0.0 } if @meter_collection.holidays.holiday?(date) daytype_data[SeriesNames::HOLIDAY] = val elsif DateTimeHelper.weekend?(date) daytype_data[SeriesNames::WEEKEND] = val else time_of_day = DateTimeHelper.time_of_day(halfhour_index) daytype_type = @meter_collection.is_school_usually_open?(date, time_of_day) ? SeriesNames::SCHOOLDAYOPEN : SeriesNames::SCHOOLDAYCLOSED daytype_data[daytype_type] = val end daytype_data end private def breakdown_to_bill_components_halfhour(date, halfhour_index, meter) meter.amr_data.accounting_tariff.cost_data_halfhour_broken_down(date, halfhour_index) end def cusum(meter, date1, date2) scale = scaling_factor_for_model_derived_gas_data(kwh_cost_or_co2) model_kwh = heating_model.predicted_kwh_daterange(date1, date2, @meter_collection.temperatures) actual_kwh = amr_data_date_range(meter, date1, date2, :kwh) (model_kwh - actual_kwh) * scale end def hotwater_breakdown(date1, date2) breakdown = {} scale = scaling_factor_for_model_derived_gas_data(kwh_cost_or_co2) hotwater_model = calculate_hotwater_model useful_kwh, wasted_kwh = hotwater_model.kwh_daterange(date1, date2) breakdown[SeriesNames::USEFULHOTWATERUSAGE] = useful_kwh * scale breakdown[SeriesNames::WASTEDHOTWATERUSAGE] = wasted_kwh * scale breakdown end def submeter_datetime_breakdown(meter, date, halfhour_index) breakdown = {} meter.sub_meters.values.each do |submeter| breakdown[submeter.name] = amr_data_by_half_hour(submeter, date, halfhour_index, kwh_cost_or_co2) end breakdown end def submeter_breakdown(meter, date1, date2) breakdown = {} meter.sub_meters.values.each do |submeter| breakdown[submeter.name] = amr_data_date_range(submeter, date1, date2, kwh_cost_or_co2) end breakdown end def breakdown_to_meter_level(start_date, end_date, halfhour_index = nil) breakdown = {} meter_names.each do |meter_name| breakdown[meter_name] = 0.0 end unless @meters[0].nil? # indication of electricity only breakdown = merge_breakdown(breakdown, breakdown_one_meter_type(@meter_collection.aggregated_electricity_meters, @meter_collection.electricity_meters, start_date, end_date, halfhour_index)) # breakdown = merge_breakdown(breakdown, breakdown_one_meter_type(@meter_collection.aggregated_electricity_meters.sub_meters[:generation], @meter_collection.solar_pv_meters, start_date, end_date, halfhour_index)) end unless @meters[1].nil? # indication of heat meters only breakdown = merge_breakdown(breakdown, breakdown_one_meter_type(@meter_collection.aggregated_heat_meters, @meter_collection.heat_meters, start_date, end_date, halfhour_index)) breakdown = merge_breakdown(breakdown, breakdown_one_meter_type(@meter_collection.storage_heater_meter, @meter_collection.storage_heater_meters, start_date, end_date, halfhour_index)) end breakdown end private def breakdown_to_bill_components_date_range(start_date, end_date) bill_components = Hash.new(0.0) @meters.each do |meter| next if meter.nil? (start_date..end_date).each do |date| components = meter.amr_data.accounting_tariff.bill_component_costs_for_day(date) components.each do |type, value| bill_components[type] += value end end end bill_components end def breakdown_one_meter_type(aggregate_meter, list_of_meters, start_date, end_date, halfhour_index = nil) breakdown = {} unless list_of_meters.nil? list_of_meters.each do |meter| begin if halfhour_index.nil? sd, ed, ok = truncate_date_range(aggregate_meter, meter, start_date, end_date) breakdown[meter.display_name] = ok ? amr_data_date_range(meter, sd, ed, kwh_cost_or_co2) : 0.0 else breakdown[meter.display_name] = 0.0 (start_date..end_date).each do |date| ok = within_aggregate_date_range?(aggregate_meter, date) breakdown[meter.display_name] = set_zero(amr_data_by_half_hour(meter, date, halfhour_index, kwh_cost_or_co2), !ok) end end rescue Exception => e logger.error "Failure getting meter breakdown data for #{meter.display_name} between #{start_date} and #{end_date}" logger.error e end end end breakdown end def set_zero(value, set_zero) set_zero ? 0.0 : value end def within_aggregate_date_range?(aggregate_meter, date) return true if aggregate_meter.nil? date.between?(aggregate_meter.amr_data.start_date, aggregate_meter.amr_data.end_date) end def truncate_date_range(aggregate_meter, meter, start_date, end_date) start_date = [start_date, aggregate_meter.amr_data.start_date, meter.amr_data.start_date].max end_date = [end_date, aggregate_meter.amr_data.end_date, meter.amr_data.end_date ].min [start_date, end_date, start_date <= end_date] end def merge_breakdown(breakdown1, breakdown2) breakdown = breakdown1.clone breakdown2.each do |series_name, kwh| if breakdown.key?(series_name) breakdown[series_name] += breakdown2[series_name] else breakdown[series_name] = breakdown2[series_name] end end breakdown end def fuel_breakdown(date_range, electricity_meter, gas_meter) has_storage_heaters = @meter_collection.storage_heaters? has_solar_pv_panels = @meter_collection.solar_pv_panels? fuel_data = { 'electricity' => 0.0, 'gas' => 0.0 } fuel_data[SeriesNames::STORAGEHEATERS] = 0.0 if has_storage_heaters fuel_data[SeriesNames::SOLARPV] = 0.0 if has_solar_pv_panels && !REMOVE_SOLAR_PV_FROM_FUEL_BREAKDOWN_CHARTS (date_range[0]..date_range[1]).each do |date| begin if gas_meter.nil? fuel_data['gas'] += 0.0 else fuel_data['gas'] += amr_data_one_day(gas_meter, date, kwh_cost_or_co2) end if electricity_meter.nil? fuel_data['electricity'] += 0.0 else fuel_data['electricity'] += amr_data_one_day(electricity_meter, date, kwh_cost_or_co2) end fuel_data[SeriesNames::STORAGEHEATERS] += @meter_collection.storage_heater_meter.amr_data.one_day_kwh(date, kwh_cost_or_co2) if has_storage_heaters fuel_data[SeriesNames::SOLARPV] += -1.0 * @meter_collection.solar_pv_meter.amr_data.one_day_kwh(date, kwh_cost_or_co2) if has_solar_pv_panels && !REMOVE_SOLAR_PV_FROM_FUEL_BREAKDOWN_CHARTS rescue Exception => e logger.error "Missing or nil data on #{date}" logger.error e end end fuel_data end def fuel_breakdown_halfhour(date, halfhour_index, electricity_meter, gas_meter) electric_val = electricity_meter.nil? ? 0.0 : amr_data_by_half_hour(electricity_meter, date, halfhour_index, kwh_cost_or_co2) gas_val = gas_meter.nil? ? 0.0 : amr_data_by_half_hour(gas_meter, date, halfhour_index, kwh_cost_or_co2) fuel_data = { 'electricity' => electric_val, 'gas' => gas_val } fuel_data[SeriesNames::STORAGEHEATERS] = @meter_collection.storage_heater_meter.amr_data.kwh(date, halfhour_index, kwh_cost_or_co2) if @meter_collection.storage_heaters? fuel_data[SeriesNames::SOLARPV] += -1.0 * @meter_collection.solar_pv_meter.amr_data.kwh(date, halfhour_index, kwh_cost_or_co2) if @meter_collection.solar_pv_panels? && !REMOVE_SOLAR_PV_FROM_FUEL_BREAKDOWN_CHARTS fuel_data end def heating_breakdown(date_range, electricity_meter, heat_meter) meter = (!electricity_meter.nil? && electricity_meter.storage_heater?) ? electricity_meter : heat_meter heating_data = { SeriesNames::HEATINGDAY => 0.0, SeriesNames::NONHEATINGDAY => 0.0 } (date_range[0]..date_range[1]).each do |date| begin type = heating_model.heating_on?(date) ? SeriesNames::HEATINGDAY : SeriesNames::NONHEATINGDAY heating_data[type] += amr_data_one_day(meter, date, kwh_cost_or_co2) rescue StandardError => e logger.error e logger.error "Warning: unable to calculate heating breakdown on #{date}" end end heating_data end def heating_daytype_breakdown(date_range, electricity_meter, heat_meter) meter = (!electricity_meter.nil? && electricity_meter.storage_heater?) ? electricity_meter : heat_meter heating_data = SeriesNames::HEATINGDAYTYPESERIESNAMES.map { |heating_daytype| [heating_daytype, 0.0] }.to_h (date_range[0]..date_range[1]).each do |date| begin type = convert_model_name_to_heating_daytype(date) one_day_value = amr_data_one_day(meter, date, kwh_cost_or_co2) # this is a fudge, to avoid restructuring of aggregation/series data manager interface # based back to allow count to work for adding 'XXX days' to legend # the modelling of 'BOILEROFF' allows days with small kWh, assuming its meter noise one_day_value = Float::MIN if one_day_value == 0.0 && type == SeriesNames::BOILEROFF heating_data[type] += one_day_value rescue StandardError => e logger.error e logger.error "Warning: unable to calculate heating breakdown on #{date}" end end heating_data end public def convert_model_name_to_heating_daytype(date) # use daytype logic here, rather than switching on model types # which have also had daytype logic applied to them # small risk of inconsistancy, but reduces dependancy between # this code and the regression models return SeriesNames::BOILEROFF if heating_model.boiler_off?(date) heating_on = heating_model.heating_on?(date) if @meter_collection.holidays.holiday?(date) heating_on ? SeriesNames::HOLIDAYHEATING : SeriesNames::HOLIDAYHOTWATER elsif DateTimeHelper.weekend?(date) heating_on ? SeriesNames::WEEKENDHEATING : SeriesNames::WEEKENDHOTWATER else heating_on ? SeriesNames::SCHOOLDAYHEATING : SeriesNames::SCHOOLDAYHOTWATER end end # this breakdown uses NaN to indicate missing data, so Excel doesn't plot it def heating_model_breakdown(date_range, electricity_meter, heat_meter) # puts "non heat meter #{electricity_meter} #{electricity_meter.storage_heater?}" meter = (!electricity_meter.nil? && electricity_meter.storage_heater?) ? electricity_meter : heat_meter breakdown = {} regression_regimes = heating_model_types regression_regimes.each do |regime| breakdown[regime] = Float::NAN end (date_range[0]..date_range[1]).each do |date| begin type = heating_model.model_type?(date) if breakdown[type].nil? || breakdown[type].nan? breakdown[type] = amr_data_one_day(meter, date, kwh_cost_or_co2) else breakdown[type] += amr_data_one_day(meter, date, kwh_cost_or_co2) end rescue StandardError => e logger.error e logger.error "Warning: unable to calculate heating model type breakdown on #{date}" end end breakdown end def predicted_heating_breakdown(date_range, _electricity_meter, heat_meter) heating_data = { SeriesNames::HEATINGDAYMODEL => 0.0, SeriesNames::NONHEATINGDAYMODEL => 0.0 } (date_range[0]..date_range[1]).each do |date| begin type = heating_model.heating_on?(date) ? SeriesNames::HEATINGDAYMODEL : SeriesNames::NONHEATINGDAYMODEL avg_temp = @meter_collection.temperatures.average_temperature(date) heating_data[type] += heating_model.predicted_kwh(date, avg_temp, kwh_cost_or_co2) rescue StandardError => e logger.error "Missing or nil predicted heating data on #{date}" logger.error e end end heating_data end def configure_manager configure_meters @first_meter_date = calculate_first_meter_date @last_meter_date = calculate_last_meter_date calculate_periods calculate_first_chart_date calculate_last_chart_date end def calculate_periods period_calc = PeriodsBase.period_factory(@chart_configuration, @meter_collection, @first_meter_date, @last_meter_date) @periods = period_calc.periods end def calculate_first_chart_date nil_period_count = periods.count(&:nil?) raise EnergySparksNotEnoughDataException, "Not enough data for chart (nil period x#{nil_period_count})" if nil_period_count > 0 || periods.length == 0 @first_chart_date = periods.last.start_date # years in reverse chronological order end def calculate_last_chart_date @last_chart_date = periods.first.end_date # years in reverse chronological order end def y2_axis_uses_temperatures @chart_configuration.key?(:y2_axis) && (@chart_configuration[:y2_axis] == :degreedays || @chart_configuration[:y2_axis] == :temperature) end def y2_axis_uses_solar_irradiance? @chart_configuration.key?(:y2_axis) && @chart_configuration[:y2_axis] == :irradiance end def calculate_first_meter_date meter_date = Date.new(1995, 1, 1) unless @meters[0].nil? meter_date = @meters[0].amr_data.start_date end if !@meters[1].nil? && @meters[1].amr_data.start_date > meter_date meter_date = @meters[1].amr_data.start_date end if y2_axis_uses_temperatures && @meter_collection.temperatures.start_date > meter_date logger.info "Reducing meter range because temperature axis with less data on chart #{meter_date} versus #{@meter_collection.temperatures.start_date}" meter_date = @meter_collection.temperatures.start_date # this may not be strict enough? end if y2_axis_uses_solar_irradiance? && @meter_collection.solar_irradiation.start_date > meter_date logger.info "Reducing meter range because irradiance axis with less data on chart #{meter_date} versus #{@meter_collection.solar_irradiation.start_date}" meter_date = @meter_collection.solar_irradiation.start_date end meter_date = @chart_configuration[:min_combined_school_date] if @chart_configuration.key?(:min_combined_school_date) meter_date end def calculate_last_meter_date meter_date = [Date.new(2040, 1, 1), @meters.compact.map { |meter| meter.amr_data.end_date }].flatten.min if y2_axis_uses_temperatures && @meter_collection.temperatures.end_date < meter_date logger.info "Reducing meter range because temperature axis with less data on chart #{meter_date} versus #{@meter_collection.temperatures.end_date}" meter_date = @meter_collection.temperatures.end_date # this may not be strict enough? end if y2_axis_uses_solar_irradiance? && @meter_collection.solar_irradiation.end_date < meter_date logger.info "Reducing meter range because irradiance axis with less data on chart #{meter_date} versus #{@meter_collection.solar_irradiation.end_date}" meter_date = @meter_collection.solar_irradiation.end_date # this may not be strict enough? end meter_date = @chart_configuration[:max_combined_school_date] if @chart_configuration.key?(:max_combined_school_date) meter_date = @chart_configuration[:asof_date] if @chart_configuration.key?(:asof_date) meter_date end def configure_meters logger.info "Configuring meter #{@meter_definition}" # typically meter[0] is an electricity meter (electricity, solar_pv), and meter[1] is a heating meter (gas, storage) if @meter_definition.is_a?(Symbol) case @meter_definition when :all # treat all meters as being the same, needs to be processed at final stage as kWh addition different from CO2 addition @meters = [@meter_collection.aggregated_electricity_meters, @meter_collection.aggregated_heat_meters] when :allheat # aggregate all heat meters @meters = [nil, @meter_collection.aggregated_heat_meters] when :allelectricity # aggregate all electricity meters @meters = [@meter_collection.aggregated_electricity_meters, nil] when :allelectricity_unmodified @meters = [@meter_collection.aggregated_electricity_meters&.original_meter, nil] when :electricity_simulator @meters = [@meter_collection.electricity_simulation_meter, nil] when :storage_heater_meter @meters = [@meter_collection.storage_heater_meter, nil] when :solar_pv_meter, :solar_pv @meters = [@meter_collection.aggregated_electricity_meters.sub_meters[:generation], nil] when :unscaled_aggregate_target_electricity @meters = [@meter_collection.unscaled_target_meters[:electricity], nil] when :unscaled_aggregate_target_gas @meters = [@meter_collection.unscaled_target_meters[:gas], nil] when :unscaled_aggregate_target_storage_heater @meters = [@meter_collection.unscaled_target_meters[:storage_heater], nil] when :synthetic_aggregate_target_electricity @meters = [@meter_collection.synthetic_target_meters[:electricity], nil] when :synthetic_aggregate_target_gas @meters = [@meter_collection.synthetic_target_meters[:gas], nil] when :synthetic_aggregate_target_storage_heater @meters = [@meter_collection.synthetic_target_meters[:storage_heater], nil] end elsif @meter_definition.is_a?(String) || @meter_definition.is_a?(Integer) # specified meter - typically by mpan or mprn meter = @meter_collection.meter?(@meter_definition, true) @meters = meter.heat_meter? ? [nil, meter] : [meter, nil] end end end
43.260081
218
0.728783
348f767f6ed7c81811f9c446e43a8e352713b4b5
86
asm
Assembly
avrsh/bin/Release/test7.asm
andresarmento/avrsim
b66b8e45c69fa3a120462e14b0924923675c9368
[ "BSD-3-Clause" ]
1
2019-04-30T15:06:04.000Z
2019-04-30T15:06:04.000Z
avrsh/bin/Release/test7.asm
andresarmento/avrsim
b66b8e45c69fa3a120462e14b0924923675c9368
[ "BSD-3-Clause" ]
null
null
null
avrsh/bin/Release/test7.asm
andresarmento/avrsim
b66b8e45c69fa3a120462e14b0924923675c9368
[ "BSD-3-Clause" ]
null
null
null
.org 0x2000 SBI 0x04, 0 ;DDR4 - 0x04 SBI 0x04, 1 SBI 0x05, 0 ;PORTB - 0x05
17.2
29
0.581395
0a06d65ba3b7b0b5c0d8606ec438a360434d3a1f
1,375
tsx
TypeScript
src/style-functions/addStyleContent.tsx
aadityarajkumawat/draftjs-raw-parser
268c53e91dd0b168bfef0c9a2d86c83c00a84678
[ "MIT" ]
1
2020-12-04T15:20:00.000Z
2020-12-04T15:20:00.000Z
src/style-functions/addStyleContent.tsx
aadityarajkumawat/draftjs-raw-parser
268c53e91dd0b168bfef0c9a2d86c83c00a84678
[ "MIT" ]
null
null
null
src/style-functions/addStyleContent.tsx
aadityarajkumawat/draftjs-raw-parser
268c53e91dd0b168bfef0c9a2d86c83c00a84678
[ "MIT" ]
null
null
null
import React from 'react' import { v4 as uid } from 'uuid' import { BOLD_ITALIC, FinalStylesArrayI, ITALIC, RichStyle, STRONG, } from '../constants' export const addStyleContent = ( finalStylesArray: Array<FinalStylesArrayI>, text: string, j: number, type: RichStyle, ) => { switch (type) { case STRONG: return ( <strong key={uid()} className={uid()}> {text.substring( finalStylesArray[j].originalStyles.offset, finalStylesArray[j].originalStyles.offset + finalStylesArray[j].originalStyles.length, )} </strong> ) case ITALIC: return ( <i key={uid()} className={uid()}> {text.substring( finalStylesArray[j].originalStyles.offset, finalStylesArray[j].originalStyles.offset + finalStylesArray[j].originalStyles.length, )} </i> ) case BOLD_ITALIC: return ( <strong key={uid()} className={uid()}> <i key={uid()} className={uid()}> {text.substring( finalStylesArray[j].originalStyles.offset, finalStylesArray[j].originalStyles.offset + finalStylesArray[j].originalStyles.length, )} </i> </strong> ) default: return <span key={uid()}></span> } }
24.553571
58
0.556364
f77c77665d322f8210e512897c1cfb9b3144cf26
10,517
h
C
tweak-pickle/src/autogen/tweak.pb.h
CogentEmbedded/tweaktool
e790ec63f649304f1f6db6a003e0b4ffcea5456e
[ "MIT" ]
null
null
null
tweak-pickle/src/autogen/tweak.pb.h
CogentEmbedded/tweaktool
e790ec63f649304f1f6db6a003e0b4ffcea5456e
[ "MIT" ]
null
null
null
tweak-pickle/src/autogen/tweak.pb.h
CogentEmbedded/tweaktool
e790ec63f649304f1f6db6a003e0b4ffcea5456e
[ "MIT" ]
1
2021-04-28T14:21:12.000Z
2021-04-28T14:21:12.000Z
/* Automatically generated nanopb header */ /* Generated by nanopb-0.4.5 */ #ifndef PB_TWEAK_PB_TWEAK_PB_H_INCLUDED #define PB_TWEAK_PB_TWEAK_PB_H_INCLUDED #include <pb.h> #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. #endif /* Struct definitions */ /* Body of "subscribe" request. */ typedef struct _tweak_pb_subscribe { pb_callback_t uri_patterns; } tweak_pb_subscribe; /* Body of "remove item" request. */ typedef struct _tweak_pb_remove_item { /* Tweak id */ uint64_t tweak_id; } tweak_pb_remove_item; /* Variant value for transmission. */ typedef struct _tweak_pb_value { pb_size_t which_values; union { bool is_null; bool scalar_bool; int32_t scalar_sint8; int32_t scalar_sint16; int32_t scalar_sint32; int64_t scalar_sint64; uint32_t scalar_uint8; uint32_t scalar_uint16; uint32_t scalar_uint32; uint64_t scalar_uint64; float scalar_float; double scalar_double; } values; } tweak_pb_value; /* A model is a flat list of these items. */ typedef struct _tweak_pb_add_item { /* Tweak id */ uint64_t tweak_id; /* API references tweaks by this name */ pb_callback_t uri; /* Tweak current value */ bool has_current_value; tweak_pb_value current_value; /* Detailed description */ pb_callback_t description; /* Representation details recognizable by GUI. */ pb_callback_t meta; /* Tweak default value */ bool has_default_value; tweak_pb_value default_value; } tweak_pb_add_item; /* Body of singular change of tweak's current value. Can go from server endpoint to client or vice versa. */ typedef struct _tweak_pb_change_item { /* id provided by model. */ uint64_t tweak_id; /* new value. */ bool has_value; tweak_pb_value value; } tweak_pb_change_item; /* Envelope for messages being sent by client endpoint to server endpoint. */ typedef struct _tweak_pb_client_node_message { pb_callback_t cb_request; pb_size_t which_request; union { tweak_pb_subscribe subscribe; tweak_pb_change_item change_item; } request; } tweak_pb_client_node_message; /* Envelope for messages being sent by server endpoint to client endpoint. */ typedef struct _tweak_pb_server_node_message { pb_callback_t cb_request; pb_size_t which_request; union { tweak_pb_add_item add_item; tweak_pb_change_item change_item; tweak_pb_remove_item remove_item; } request; } tweak_pb_server_node_message; #ifdef __cplusplus extern "C" { #endif /* Initializer values for message structs */ #define tweak_pb_value_init_default {0, {0}} #define tweak_pb_add_item_init_default {0, {{NULL}, NULL}, false, tweak_pb_value_init_default, {{NULL}, NULL}, {{NULL}, NULL}, false, tweak_pb_value_init_default} #define tweak_pb_subscribe_init_default {{{NULL}, NULL}} #define tweak_pb_change_item_init_default {0, false, tweak_pb_value_init_default} #define tweak_pb_remove_item_init_default {0} #define tweak_pb_client_node_message_init_default {{{NULL}, NULL}, 0, {tweak_pb_subscribe_init_default}} #define tweak_pb_server_node_message_init_default {{{NULL}, NULL}, 0, {tweak_pb_add_item_init_default}} #define tweak_pb_value_init_zero {0, {0}} #define tweak_pb_add_item_init_zero {0, {{NULL}, NULL}, false, tweak_pb_value_init_zero, {{NULL}, NULL}, {{NULL}, NULL}, false, tweak_pb_value_init_zero} #define tweak_pb_subscribe_init_zero {{{NULL}, NULL}} #define tweak_pb_change_item_init_zero {0, false, tweak_pb_value_init_zero} #define tweak_pb_remove_item_init_zero {0} #define tweak_pb_client_node_message_init_zero {{{NULL}, NULL}, 0, {tweak_pb_subscribe_init_zero}} #define tweak_pb_server_node_message_init_zero {{{NULL}, NULL}, 0, {tweak_pb_add_item_init_zero}} /* Field tags (for use in manual encoding/decoding) */ #define tweak_pb_subscribe_uri_patterns_tag 1 #define tweak_pb_remove_item_tweak_id_tag 1 #define tweak_pb_value_is_null_tag 1 #define tweak_pb_value_scalar_bool_tag 2 #define tweak_pb_value_scalar_sint8_tag 3 #define tweak_pb_value_scalar_sint16_tag 4 #define tweak_pb_value_scalar_sint32_tag 5 #define tweak_pb_value_scalar_sint64_tag 6 #define tweak_pb_value_scalar_uint8_tag 7 #define tweak_pb_value_scalar_uint16_tag 8 #define tweak_pb_value_scalar_uint32_tag 9 #define tweak_pb_value_scalar_uint64_tag 10 #define tweak_pb_value_scalar_float_tag 11 #define tweak_pb_value_scalar_double_tag 12 #define tweak_pb_add_item_tweak_id_tag 1 #define tweak_pb_add_item_uri_tag 2 #define tweak_pb_add_item_current_value_tag 3 #define tweak_pb_add_item_description_tag 4 #define tweak_pb_add_item_meta_tag 5 #define tweak_pb_add_item_default_value_tag 6 #define tweak_pb_change_item_tweak_id_tag 1 #define tweak_pb_change_item_value_tag 2 #define tweak_pb_client_node_message_subscribe_tag 1 #define tweak_pb_client_node_message_change_item_tag 2 #define tweak_pb_server_node_message_add_item_tag 1 #define tweak_pb_server_node_message_change_item_tag 2 #define tweak_pb_server_node_message_remove_item_tag 3 /* Struct field encoding specification for nanopb */ #define tweak_pb_value_FIELDLIST(X, a) \ X(a, STATIC, ONEOF, BOOL, (values,is_null,values.is_null), 1) \ X(a, STATIC, ONEOF, BOOL, (values,scalar_bool,values.scalar_bool), 2) \ X(a, STATIC, ONEOF, SINT32, (values,scalar_sint8,values.scalar_sint8), 3) \ X(a, STATIC, ONEOF, SINT32, (values,scalar_sint16,values.scalar_sint16), 4) \ X(a, STATIC, ONEOF, SINT32, (values,scalar_sint32,values.scalar_sint32), 5) \ X(a, STATIC, ONEOF, SINT64, (values,scalar_sint64,values.scalar_sint64), 6) \ X(a, STATIC, ONEOF, UINT32, (values,scalar_uint8,values.scalar_uint8), 7) \ X(a, STATIC, ONEOF, UINT32, (values,scalar_uint16,values.scalar_uint16), 8) \ X(a, STATIC, ONEOF, UINT32, (values,scalar_uint32,values.scalar_uint32), 9) \ X(a, STATIC, ONEOF, UINT64, (values,scalar_uint64,values.scalar_uint64), 10) \ X(a, STATIC, ONEOF, FLOAT, (values,scalar_float,values.scalar_float), 11) \ X(a, STATIC, ONEOF, DOUBLE, (values,scalar_double,values.scalar_double), 12) #define tweak_pb_value_CALLBACK NULL #define tweak_pb_value_DEFAULT NULL #define tweak_pb_add_item_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT64, tweak_id, 1) \ X(a, CALLBACK, SINGULAR, STRING, uri, 2) \ X(a, STATIC, OPTIONAL, MESSAGE, current_value, 3) \ X(a, CALLBACK, SINGULAR, STRING, description, 4) \ X(a, CALLBACK, SINGULAR, STRING, meta, 5) \ X(a, STATIC, OPTIONAL, MESSAGE, default_value, 6) #define tweak_pb_add_item_CALLBACK pb_default_field_callback #define tweak_pb_add_item_DEFAULT NULL #define tweak_pb_add_item_current_value_MSGTYPE tweak_pb_value #define tweak_pb_add_item_default_value_MSGTYPE tweak_pb_value #define tweak_pb_subscribe_FIELDLIST(X, a) \ X(a, CALLBACK, SINGULAR, STRING, uri_patterns, 1) #define tweak_pb_subscribe_CALLBACK pb_default_field_callback #define tweak_pb_subscribe_DEFAULT NULL #define tweak_pb_change_item_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT64, tweak_id, 1) \ X(a, STATIC, OPTIONAL, MESSAGE, value, 2) #define tweak_pb_change_item_CALLBACK NULL #define tweak_pb_change_item_DEFAULT NULL #define tweak_pb_change_item_value_MSGTYPE tweak_pb_value #define tweak_pb_remove_item_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT64, tweak_id, 1) #define tweak_pb_remove_item_CALLBACK NULL #define tweak_pb_remove_item_DEFAULT NULL #define tweak_pb_client_node_message_FIELDLIST(X, a) \ X(a, STATIC, ONEOF, MSG_W_CB, (request,subscribe,request.subscribe), 1) \ X(a, STATIC, ONEOF, MSG_W_CB, (request,change_item,request.change_item), 2) #define tweak_pb_client_node_message_CALLBACK NULL #define tweak_pb_client_node_message_DEFAULT NULL #define tweak_pb_client_node_message_request_subscribe_MSGTYPE tweak_pb_subscribe #define tweak_pb_client_node_message_request_change_item_MSGTYPE tweak_pb_change_item #define tweak_pb_server_node_message_FIELDLIST(X, a) \ X(a, STATIC, ONEOF, MSG_W_CB, (request,add_item,request.add_item), 1) \ X(a, STATIC, ONEOF, MSG_W_CB, (request,change_item,request.change_item), 2) \ X(a, STATIC, ONEOF, MSG_W_CB, (request,remove_item,request.remove_item), 3) #define tweak_pb_server_node_message_CALLBACK NULL #define tweak_pb_server_node_message_DEFAULT NULL #define tweak_pb_server_node_message_request_add_item_MSGTYPE tweak_pb_add_item #define tweak_pb_server_node_message_request_change_item_MSGTYPE tweak_pb_change_item #define tweak_pb_server_node_message_request_remove_item_MSGTYPE tweak_pb_remove_item extern const pb_msgdesc_t tweak_pb_value_msg; extern const pb_msgdesc_t tweak_pb_add_item_msg; extern const pb_msgdesc_t tweak_pb_subscribe_msg; extern const pb_msgdesc_t tweak_pb_change_item_msg; extern const pb_msgdesc_t tweak_pb_remove_item_msg; extern const pb_msgdesc_t tweak_pb_client_node_message_msg; extern const pb_msgdesc_t tweak_pb_server_node_message_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ #define tweak_pb_value_fields &tweak_pb_value_msg #define tweak_pb_add_item_fields &tweak_pb_add_item_msg #define tweak_pb_subscribe_fields &tweak_pb_subscribe_msg #define tweak_pb_change_item_fields &tweak_pb_change_item_msg #define tweak_pb_remove_item_fields &tweak_pb_remove_item_msg #define tweak_pb_client_node_message_fields &tweak_pb_client_node_message_msg #define tweak_pb_server_node_message_fields &tweak_pb_server_node_message_msg /* Maximum encoded size of messages (where known) */ /* tweak_pb_add_item_size depends on runtime parameters */ /* tweak_pb_subscribe_size depends on runtime parameters */ /* tweak_pb_client_node_message_size depends on runtime parameters */ /* tweak_pb_server_node_message_size depends on runtime parameters */ #define tweak_pb_change_item_size 24 #define tweak_pb_remove_item_size 11 #define tweak_pb_value_size 11 #ifdef __cplusplus } /* extern "C" */ #endif #endif
43.820833
172
0.755729
0cc6417c3e829823797e9f3e6ad674ead279d5e9
2,657
py
Python
src/data_analysis_util.py
vikramnayyar/Customer-Identification-for-Bank-Marketing
4727f6d8997d26836ad167616a8edb4898623c39
[ "Apache-2.0" ]
null
null
null
src/data_analysis_util.py
vikramnayyar/Customer-Identification-for-Bank-Marketing
4727f6d8997d26836ad167616a8edb4898623c39
[ "Apache-2.0" ]
null
null
null
src/data_analysis_util.py
vikramnayyar/Customer-Identification-for-Bank-Marketing
4727f6d8997d26836ad167616a8edb4898623c39
[ "Apache-2.0" ]
null
null
null
""" The script declares functions used in 'data_analysis.py' """ import os import yaml from logzero import logger import matplotlib.pyplot as plt import seaborn as sns from matplotlib.patches import Patch import plotly.graph_objects as go from utility import parse_config config_path = "config/config.yaml" config = parse_config(config_path) # read config file def dataset_balance(df_clean, col): fig, ax = plt.subplots() sns.countplot(x = col, data = df_clean, palette = 'viridis') plt.title('Deposit Distribution of Bank Customers', fontsize = 16) plt.xlabel('Deposit', fontsize = 14) plt.ylabel('Total Customers', fontsize = 14) plt.xticks(fontsize = 12) plt.savefig("dataset_balance.png") def box_plot(df_clean, col, plot_type): fig, ax = plt.subplots(1, 2, figsize=(15, 5)) fig.suptitle(config["data_analysis"][plot_type]["title"], size = 18, y=1.08) # Subplot 1 ax[0].hist(df_clean[df_clean["deposit"]=='no'][col], bins=30, alpha=0.5, color="green", label="Non-Depositors") ax[0].hist(df_clean[df_clean["deposit"]=='yes'][col], bins=30, alpha=0.5, color="blue", label="Depositors") ax[0].set_xlabel(config["data_analysis"][plot_type]["xlabel"], size = 14) ax[0].set_ylabel(config["data_analysis"][plot_type]["ylabel"], size = 14) ax[0].legend(fontsize = 11); # Subplot 2 sns.boxplot(x=col, y="deposit", data=df_clean, orient="h", palette={ 'no':"#80e880", 'yes':"#2626ff"}, ax = ax[1]) ax[1].get_yaxis().set_visible(False) ax[1].set_xlabel(config["data_analysis"][plot_type]["xlabel"], size = 14) color_patches = [ Patch(facecolor="#80e880", label="Non-Depositors"), Patch(facecolor="#2626ff", label="Depositors") ] ax[1].legend(handles=color_patches, fontsize=11); plt.savefig(plot_type) # saving figure def grouped_bar_plot(df_clean, col, plot_type): fig, ax = plt.subplots() sns.catplot(col, hue = 'deposit', data=df_clean, kind="count", palette={'no':"#80e880", 'yes':"#2626ff"}, legend = False) color_patches = [ Patch(facecolor="#80e880", label="Non-Depositors"), Patch(facecolor="#2626ff", label="Depositors") ] plt.title(config["data_analysis"][plot_type]["title"], size = 18, y=1.08) plt.xlabel(config["data_analysis"][plot_type]["xlabel"], size = 14) plt.ylabel(config["data_analysis"][plot_type]["ylabel"], size = 14) plt.xticks(size = 12, rotation = 'vertical') plt.legend(handles = color_patches, fontsize = 12, bbox_to_anchor=(1.4,1.05)) plt.savefig(plot_type) # saving figure plt.close(1)
34.064103
125
0.657132
1f4a39563f4f01751261a79c11058242d3a39f55
1,095
css
CSS
web-ui/src/pages/DirectoryPage.css
Maroju100/check-ins
7fca1930767c6d3854eb9a7f2b2e57cc2b0f4b73
[ "Apache-2.0" ]
null
null
null
web-ui/src/pages/DirectoryPage.css
Maroju100/check-ins
7fca1930767c6d3854eb9a7f2b2e57cc2b0f4b73
[ "Apache-2.0" ]
null
null
null
web-ui/src/pages/DirectoryPage.css
Maroju100/check-ins
7fca1930767c6d3854eb9a7f2b2e57cc2b0f4b73
[ "Apache-2.0" ]
null
null
null
.add-member { align-items: center; display: flex; } .add-member-modal { position: absolute; min-width: 400px; max-width: 600px; background-color: #fff; top: 50%; left: 50%; padding: 0.5rem; transform: translate(-50%, -50%); border: 2px solid #fff; } .add-member-modal h2 { margin-block-end: 0rem; margin-left: 0.5rem; } .add-member-modal-actions { margin-top: 1rem; width: calc(100% - 1rem); display: flex; flex-direction: row; justify-content: flex-end; } .add-member-modal .MuiTextField-root.fullWidth { width: calc(100% - 1rem); } .add-member-modal .MuiTextField-root.halfWidth { width: calc(50% - 0.5rem); } .add-member-modal .MuiTextField-root { margin: 0.5rem; width: 25ch; } .directory-page .members { display: flex; flex-wrap: wrap; justify-content: space-evenly; } .directory-page .search { display: flex; justify-content: space-between; align-items: center; margin-left: 1rem; margin-right: 1rem; } .directory-page .MuiContainer-root { margin: 0px; max-width: 420px; padding-right: 0px; padding-left: 6px; }
17.109375
48
0.66484
c5b15e6a18fc79005635e40489142728696e9055
29,301
sql
SQL
maindb.sql
giovanyrosales/mainadmin
5ce888b4ee075d8729787b7a2e21eb1851c03e57
[ "MIT" ]
1
2022-02-08T14:38:23.000Z
2022-02-08T14:38:23.000Z
maindb.sql
giovanyrosales/mainadmin
5ce888b4ee075d8729787b7a2e21eb1851c03e57
[ "MIT" ]
null
null
null
maindb.sql
giovanyrosales/mainadmin
5ce888b4ee075d8729787b7a2e21eb1851c03e57
[ "MIT" ]
null
null
null
CREATE DATABASE IF NOT EXISTS `maindb` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `maindb`; -- MySQL dump 10.13 Distrib 5.7.12, for Win64 (x86_64) -- -- Host: 127.0.0.1 Database: maindb -- ------------------------------------------------------ -- Server version 5.7.24 /*!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 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `areagestion` -- DROP TABLE IF EXISTS `areagestion`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `areagestion` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `linea_id` bigint(20) unsigned NOT NULL, `codigo` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `nombre` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `areagestion_linea_id_foreign` (`linea_id`), CONSTRAINT `areagestion_linea_id_foreign` FOREIGN KEY (`linea_id`) REFERENCES `linea` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `areagestion` -- LOCK TABLES `areagestion` WRITE; /*!40000 ALTER TABLE `areagestion` DISABLE KEYS */; /*!40000 ALTER TABLE `areagestion` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `bitacora` -- DROP TABLE IF EXISTS `bitacora`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `bitacora` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `proyecto_id` bigint(20) unsigned NOT NULL, `num` int(11) NOT NULL, `fecha` date NOT NULL, `observaciones` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `bitacora_proyecto_id_foreign` (`proyecto_id`), CONSTRAINT `bitacora_proyecto_id_foreign` FOREIGN KEY (`proyecto_id`) REFERENCES `proyecto` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `bitacora` -- LOCK TABLES `bitacora` WRITE; /*!40000 ALTER TABLE `bitacora` DISABLE KEYS */; INSERT INTO `bitacora` VALUES (24,1,24,'2020-12-01','dsdasdsadasd'),(25,1,25,'2020-11-09','Bitacora con foto prueba final'),(26,1,26,'2020-11-21','Prueba de bitacora con mas de una foto'),(27,2,1,'2021-01-12','Observaciones de Bitacora 1'); /*!40000 ALTER TABLE `bitacora` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `bitfotos` -- DROP TABLE IF EXISTS `bitfotos`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `bitfotos` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bitacora_id` bigint(20) unsigned NOT NULL, `nombre` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `dir` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `bitfotos_bitacora_id_foreign` (`bitacora_id`), CONSTRAINT `bitfotos_bitacora_id_foreign` FOREIGN KEY (`bitacora_id`) REFERENCES `bitacora` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `bitfotos` -- LOCK TABLES `bitfotos` WRITE; /*!40000 ALTER TABLE `bitfotos` DISABLE KEYS */; INSERT INTO `bitfotos` VALUES (3,24,'asda','z0suxO5pczYFUTV7k8Re0.29738600_1604944450.JPG'),(4,25,'titulofoto','ddnwqsGN.jpg'),(5,26,'foto 1','W3Y3UuUn.JPG'),(6,26,'foto 2','V62fsEIg.jpg'),(7,26,'foto 3','Km9ziTYh.jpg'),(8,27,'Titulo Bitacora 1','gepkJLuA.jpg'); /*!40000 ALTER TABLE `bitfotos` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `bolson` -- DROP TABLE IF EXISTS `bolson`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `bolson` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `nombre` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `fecha` date NOT NULL, `montoini` decimal(8,2) NOT NULL, `saldo` decimal(8,2) NOT NULL, `cuenta_id` bigint(20) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `bolson_cuenta_id_foreign` (`cuenta_id`), CONSTRAINT `bolson_cuenta_id_foreign` FOREIGN KEY (`cuenta_id`) REFERENCES `cuenta` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `bolson` -- LOCK TABLES `bolson` WRITE; /*!40000 ALTER TABLE `bolson` DISABLE KEYS */; INSERT INTO `bolson` VALUES (1,'Cuenta Bolson de Prueba 2021','2021-01-12',255000.00,250000.00,1); /*!40000 ALTER TABLE `bolson` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `cuenta` -- DROP TABLE IF EXISTS `cuenta`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cuenta` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `nombre` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `codigo` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `cuenta` -- LOCK TABLES `cuenta` WRITE; /*!40000 ALTER TABLE `cuenta` DISABLE KEYS */; INSERT INTO `cuenta` VALUES (1,'Cuenta de Prueba 541','54110'),(2,'codigo esp. 2','54578'); /*!40000 ALTER TABLE `cuenta` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `cuentaproy` -- DROP TABLE IF EXISTS `cuentaproy`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cuentaproy` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `proyecto_id` bigint(20) unsigned NOT NULL, `cuenta_id` bigint(20) unsigned NOT NULL, `montoini` decimal(8,2) NOT NULL, `saldo` decimal(8,2) DEFAULT NULL, PRIMARY KEY (`id`), KEY `cuentaproy_proyecto_id_foreign` (`proyecto_id`), KEY `cuentaproy_cuenta_id_foreign` (`cuenta_id`), CONSTRAINT `cuentaproy_cuenta_id_foreign` FOREIGN KEY (`cuenta_id`) REFERENCES `cuenta` (`id`), CONSTRAINT `cuentaproy_proyecto_id_foreign` FOREIGN KEY (`proyecto_id`) REFERENCES `proyecto` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `cuentaproy` -- LOCK TABLES `cuentaproy` WRITE; /*!40000 ALTER TABLE `cuentaproy` DISABLE KEYS */; /*!40000 ALTER TABLE `cuentaproy` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `detalle_partida` -- DROP TABLE IF EXISTS `detalle_partida`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `detalle_partida` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `cantidad` decimal(8,2) NOT NULL, `material_id` bigint(20) unsigned NOT NULL, `unidad` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `partida_id` bigint(20) unsigned NOT NULL, `estado` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `detalle_partida_partida_id_foreign` (`partida_id`), KEY `detalle_partida_material_id_foreign` (`material_id`), CONSTRAINT `detalle_partida_material_id_foreign` FOREIGN KEY (`material_id`) REFERENCES `materiales` (`id`), CONSTRAINT `detalle_partida_partida_id_foreign` FOREIGN KEY (`partida_id`) REFERENCES `partida` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `detalle_partida` -- LOCK TABLES `detalle_partida` WRITE; /*!40000 ALTER TABLE `detalle_partida` DISABLE KEYS */; INSERT INTO `detalle_partida` VALUES (3,4.00,1,'plg',3,NULL),(4,3.00,1,'plg',3,NULL),(5,9.00,10,'mts',3,NULL),(6,8.00,9,'mts',3,NULL),(7,1.00,2,'plg',3,NULL),(8,5.00,4,'qq',3,NULL),(9,4.00,11,'pliego',4,NULL),(10,14.00,9,'mts',5,NULL),(11,223.00,9,'mts',4,NULL),(12,12.00,7,'mts',4,NULL),(13,1.00,2,'plg',6,NULL),(14,3.00,3,'plg',6,NULL),(15,100.00,2,'plg',7,NULL),(16,45.00,3,'plg',7,NULL),(17,5.00,3,'plg',8,NULL),(18,200.00,9,'mts',8,NULL),(19,45.00,11,'pliego',9,NULL),(20,35.00,10,'mts',9,NULL),(21,45.00,2,'plg',10,NULL),(22,67.00,8,'mts',10,NULL),(23,60.00,7,'mts',10,NULL),(24,90.00,12,'pliego',11,NULL); /*!40000 ALTER TABLE `detalle_partida` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `fuentef` -- DROP TABLE IF EXISTS `fuentef`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `fuentef` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `codigo` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `nombre` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `fuentef` -- LOCK TABLES `fuentef` WRITE; /*!40000 ALTER TABLE `fuentef` DISABLE KEYS */; INSERT INTO `fuentef` VALUES (1,'88','Fuente de Financiamiento prueba 1'); /*!40000 ALTER TABLE `fuentef` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `fuenter` -- DROP TABLE IF EXISTS `fuenter`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `fuenter` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `fuentef_id` bigint(20) unsigned NOT NULL, `codigo` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `nombre` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`), KEY `fuenter_fuentef_id_foreign` (`fuentef_id`), CONSTRAINT `fuenter_fuentef_id_foreign` FOREIGN KEY (`fuentef_id`) REFERENCES `fuentef` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `fuenter` -- LOCK TABLES `fuenter` WRITE; /*!40000 ALTER TABLE `fuenter` DISABLE KEYS */; INSERT INTO `fuenter` VALUES (1,1,'565','Fuente de Recursos prueba 1'); /*!40000 ALTER TABLE `fuenter` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `linea` -- DROP TABLE IF EXISTS `linea`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `linea` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `codigo` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `nombre` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `linea` -- LOCK TABLES `linea` WRITE; /*!40000 ALTER TABLE `linea` DISABLE KEYS */; INSERT INTO `linea` VALUES (1,'11','Linea de trabajo prueba 1'),(2,'22','Linea de Trabajo prueba 2'); /*!40000 ALTER TABLE `linea` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `materiales` -- DROP TABLE IF EXISTS `materiales`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `materiales` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `cod` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `nombre` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `unidad` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `pu` decimal(8,2) NOT NULL, `clasificacion` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `materiales` -- LOCK TABLES `materiales` WRITE; /*!40000 ALTER TABLE `materiales` DISABLE KEYS */; INSERT INTO `materiales` VALUES (1,'1','Material de prueba','plg',65.50,'materiales'),(2,'1','material 1','plg',6.00,'materiales'),(3,'1','material 2','plg',9.00,'materiales'),(4,'1','material 3','qq',5.00,'materiales'),(5,'1','material 4','plg',8.00,'materiales'),(6,'1','material 5','plg',7.00,'mano_de_obra'),(7,'1','material 6','mts',8.00,'materiales'),(8,'1','material 7','mts',4.00,'materiales'),(9,'1','material 8','mts',75.00,'materiales'),(10,'1','material 9','mts',1.00,'materiales'),(11,'1','material 10','pliego',45.00,'materiales'),(12,'2','Material 11','pliego',25.50,'materiales'); /*!40000 ALTER TABLE `materiales` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `materiales_proyecto` -- DROP TABLE IF EXISTS `materiales_proyecto`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `materiales_proyecto` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `cantidad` decimal(8,2) NOT NULL, `material_id` bigint(20) unsigned NOT NULL, `proyecto_id` bigint(20) unsigned NOT NULL, `estado` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `materiales_proyecto_proyecto_id_foreign` (`proyecto_id`), KEY `materiales_proyecto_material_id_foreign` (`material_id`), CONSTRAINT `materiales_proyecto_material_id_foreign` FOREIGN KEY (`material_id`) REFERENCES `materiales` (`id`), CONSTRAINT `materiales_proyecto_proyecto_id_foreign` FOREIGN KEY (`proyecto_id`) REFERENCES `proyecto` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `materiales_proyecto` -- LOCK TABLES `materiales_proyecto` WRITE; /*!40000 ALTER TABLE `materiales_proyecto` DISABLE KEYS */; INSERT INTO `materiales_proyecto` VALUES (1,5.00,3,2,'1'),(2,45.00,11,2,'1'),(3,35.00,10,2,'1'),(4,45.00,2,3,'1'),(5,67.00,8,3,'1'),(6,60.00,7,3,'1'),(7,90.00,12,2,'1'); /*!40000 ALTER TABLE `materiales_proyecto` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `migrations` -- DROP TABLE IF EXISTS `migrations`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `migrations` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `migrations` -- LOCK TABLES `migrations` WRITE; /*!40000 ALTER TABLE `migrations` DISABLE KEYS */; INSERT INTO `migrations` VALUES (1,'2014_10_12_000000_create_users_table',1),(2,'2020_09_28_195836_create_proyecto_table',1),(3,'2020_09_28_202833_create_materiales_table',1),(4,'2020_09_29_160516_create_cuenta_table',1),(5,'2020_09_29_160609_create_bolson_table',1),(6,'2020_09_29_160610_create_tipomovi_table',1),(7,'2020_09_29_160838_create_movibolson_table',1),(8,'2020_10_05_181059_create_cuentaproy_table',1),(9,'2020_10_12_214015_create_permission_tables',1),(10,'2020_10_13_160933_create_materiales_proyecto_table',1),(11,'2020_10_13_162330_create_partida_table',1),(12,'2020_10_13_170424_create_detalle_partida_table',1),(13,'2020_10_23_200456_create_fuentef_table',1),(14,'2020_10_23_203521_create_fuenter_table',1),(15,'2020_10_23_214051_create_linea_table',1),(16,'2020_10_23_214106_create_areagestion_table',1),(17,'2020_11_04_170057_create_bitacora_table',2),(18,'2020_11_04_170344_create_bitfotos_table',2); /*!40000 ALTER TABLE `migrations` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `model_has_permissions` -- DROP TABLE IF EXISTS `model_has_permissions`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `model_has_permissions` ( `permission_id` bigint(20) unsigned NOT NULL, `model_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `model_id` bigint(20) unsigned NOT NULL, PRIMARY KEY (`permission_id`,`model_id`,`model_type`), KEY `model_has_permissions_model_id_model_type_index` (`model_id`,`model_type`), CONSTRAINT `model_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `model_has_permissions` -- LOCK TABLES `model_has_permissions` WRITE; /*!40000 ALTER TABLE `model_has_permissions` DISABLE KEYS */; /*!40000 ALTER TABLE `model_has_permissions` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `model_has_roles` -- DROP TABLE IF EXISTS `model_has_roles`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `model_has_roles` ( `role_id` bigint(20) unsigned NOT NULL, `model_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `model_id` bigint(20) unsigned NOT NULL, PRIMARY KEY (`role_id`,`model_id`,`model_type`), KEY `model_has_roles_model_id_model_type_index` (`model_id`,`model_type`), CONSTRAINT `model_has_roles_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `model_has_roles` -- LOCK TABLES `model_has_roles` WRITE; /*!40000 ALTER TABLE `model_has_roles` DISABLE KEYS */; INSERT INTO `model_has_roles` VALUES (1,'App\\User',1),(2,'App\\User',2),(3,'App\\User',3); /*!40000 ALTER TABLE `model_has_roles` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `movibolson` -- DROP TABLE IF EXISTS `movibolson`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `movibolson` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bolson_id` bigint(20) unsigned NOT NULL, `cuenta_id` bigint(20) unsigned NOT NULL, `aumenta` decimal(8,2) DEFAULT NULL, `disminuye` decimal(8,2) DEFAULT NULL, `fecha` date NOT NULL, `tipomovi_id` bigint(20) unsigned NOT NULL, `proyecto_id` bigint(20) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `movibolson_proyecto_id_foreign` (`proyecto_id`), KEY `movibolson_bolson_id_foreign` (`bolson_id`), KEY `movibolson_cuenta_id_foreign` (`cuenta_id`), KEY `movibolson_tipomovi_id_foreign` (`tipomovi_id`), CONSTRAINT `movibolson_bolson_id_foreign` FOREIGN KEY (`bolson_id`) REFERENCES `bolson` (`id`), CONSTRAINT `movibolson_cuenta_id_foreign` FOREIGN KEY (`cuenta_id`) REFERENCES `cuenta` (`id`), CONSTRAINT `movibolson_proyecto_id_foreign` FOREIGN KEY (`proyecto_id`) REFERENCES `proyecto` (`id`), CONSTRAINT `movibolson_tipomovi_id_foreign` FOREIGN KEY (`tipomovi_id`) REFERENCES `tipomovi` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `movibolson` -- LOCK TABLES `movibolson` WRITE; /*!40000 ALTER TABLE `movibolson` DISABLE KEYS */; /*!40000 ALTER TABLE `movibolson` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `partida` -- DROP TABLE IF EXISTS `partida`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `partida` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `item` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `nombre` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `cantidadp` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `proyecto_id` bigint(20) unsigned NOT NULL, `estado` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `partida_proyecto_id_foreign` (`proyecto_id`), CONSTRAINT `partida_proyecto_id_foreign` FOREIGN KEY (`proyecto_id`) REFERENCES `proyecto` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `partida` -- LOCK TABLES `partida` WRITE; /*!40000 ALTER TABLE `partida` DISABLE KEYS */; INSERT INTO `partida` VALUES (3,'3','partida de pruebaSS','7 mts2',1,NULL),(4,'4','Partida Prueba 2','5 pies3',1,NULL),(5,'5','partida de prueba 3333','10 mts',1,NULL),(6,'1','Muro de partida 1','1',2,NULL),(7,'2','muro prueba','1',2,NULL),(8,'3','Partida 2 de prueba','1',2,NULL),(9,'4','partida de prueba 3','1',2,NULL),(10,'1','muro','1',3,NULL),(11,'5','pared','1',2,NULL); /*!40000 ALTER TABLE `partida` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `permissions` -- DROP TABLE IF EXISTS `permissions`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `permissions` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `guard_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `permissions` -- LOCK TABLES `permissions` WRITE; /*!40000 ALTER TABLE `permissions` DISABLE KEYS */; INSERT INTO `permissions` VALUES (1,'todos','web','2020-10-28 02:42:44','2020-10-28 02:42:44'); /*!40000 ALTER TABLE `permissions` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `proyecto` -- DROP TABLE IF EXISTS `proyecto`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `proyecto` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `codigo` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `nombre` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `ubicacion` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `fuentef` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `contraparte` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `fechaini` date DEFAULT NULL, `fechafin` date DEFAULT NULL, `fecha` date NOT NULL, `areagestion` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `linea` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `fuenter` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `naturaleza` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `ejecutor` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `formulador` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `supervisor` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `encargado` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `codcontable` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `acuerdoapertura` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `acuerdocierre` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `estado` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `proyecto_codigo_unique` (`codigo`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `proyecto` -- LOCK TABLES `proyecto` WRITE; /*!40000 ALTER TABLE `proyecto` DISABLE KEYS */; INSERT INTO `proyecto` VALUES (1,NULL,'Proyecto de prueba 1','Col. Guadalupe, Metapan','1',NULL,'2020-10-28',NULL,'2020-10-27','1','1','1','privativo',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(2,NULL,'Proyecto de prueba 2021','Metapan','1','no','2021-01-12',NULL,'2021-01-12','1','2','1','desarrollosocial','Ejecutor 1','Formulador 1','Supervisor 1','Encargado 1','45434544',NULL,NULL,NULL),(3,NULL,'Proyecto de prueba 3 2021','Metapan','1','no','2021-01-14',NULL,'2021-01-13','1','1','1','desarrollosocial','ej','fr','sr','en',NULL,NULL,NULL,NULL); /*!40000 ALTER TABLE `proyecto` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `role_has_permissions` -- DROP TABLE IF EXISTS `role_has_permissions`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `role_has_permissions` ( `permission_id` bigint(20) unsigned NOT NULL, `role_id` bigint(20) unsigned NOT NULL, PRIMARY KEY (`permission_id`,`role_id`), KEY `role_has_permissions_role_id_foreign` (`role_id`), CONSTRAINT `role_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE, CONSTRAINT `role_has_permissions_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `role_has_permissions` -- LOCK TABLES `role_has_permissions` WRITE; /*!40000 ALTER TABLE `role_has_permissions` DISABLE KEYS */; INSERT INTO `role_has_permissions` VALUES (1,1),(1,2),(1,3); /*!40000 ALTER TABLE `role_has_permissions` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `roles` -- DROP TABLE IF EXISTS `roles`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `roles` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `guard_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `roles` -- LOCK TABLES `roles` WRITE; /*!40000 ALTER TABLE `roles` DISABLE KEYS */; INSERT INTO `roles` VALUES (1,'uaci','web','2020-10-28 02:42:44','2020-10-28 02:42:44'),(2,'presupuesto','web','2020-10-28 02:42:44','2020-10-28 02:42:44'),(3,'Formulador','web','2020-10-28 02:42:44','2020-10-28 02:42:44'); /*!40000 ALTER TABLE `roles` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tipomovi` -- DROP TABLE IF EXISTS `tipomovi`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tipomovi` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `nombre` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `tipomovi` -- LOCK TABLES `tipomovi` WRITE; /*!40000 ALTER TABLE `tipomovi` DISABLE KEYS */; /*!40000 ALTER TABLE `tipomovi` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `users` -- DROP TABLE IF EXISTS `users`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `users` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `nombre` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `apellido` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `usuario` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `telefono` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `users_usuario_unique` (`usuario`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `users` -- LOCK TABLES `users` WRITE; /*!40000 ALTER TABLE `users` DISABLE KEYS */; INSERT INTO `users` VALUES (1,'Giovany','Rosales','uaci','$2y$10$T3klfgaf6lJcIz77jN7Dx.veXZ7Z2z256WuHDr7zNg0R2qYDBpn6m','75335897'),(2,'Giovany','Rosales','presupuesto','$2y$10$XV.ULexhmx8s3bN1PdBvuesZtocO/p9CROMQu8CbHI1truiD3i9py','75335897'),(3,'Giovany','Rosales','ingenieria','$2y$10$DXOA8getIAldj0BTprArtetPV2NJLiYL2ekKRWdMtl9jgYFN33wr.','75335897'); /*!40000 ALTER TABLE `users` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!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 */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2021-01-15 10:38:22
42.465217
922
0.734241
c37917091522a5ed67deb4ece5119312bd0372ea
2,449
go
Go
cmd/root.go
CloudAutomationSolutions/invoicerender
c24a60d89a6b98c712a3b22c3b472489f059ee58
[ "Apache-2.0" ]
3
2019-11-01T10:21:43.000Z
2021-03-19T13:16:38.000Z
cmd/root.go
CloudAutomationSolutions/invoicerender
c24a60d89a6b98c712a3b22c3b472489f059ee58
[ "Apache-2.0" ]
null
null
null
cmd/root.go
CloudAutomationSolutions/invoicerender
c24a60d89a6b98c712a3b22c3b472489f059ee58
[ "Apache-2.0" ]
null
null
null
/* Copyright © 2019 NAME HERE <EMAIL ADDRESS> 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 cmd import ( "fmt" "github.com/spf13/cobra" "os" "os/user" "path/filepath" "github.com/spf13/viper" ) var ( cfgFile string configDir string ) // rootCmd represents the base command when called without any subcommands var rootCmd = &cobra.Command{ Use: "invoicerender", Short: "A generator of PDF invoices", Long: `Application for generating PDF invoices based on stored configuration about the issuer and the clients Define multiple clients and keep track of the invoice IDs automatically.`, } // Execute adds all child commands to the root command and sets flags appropriately. // This is called by main.main(). It only needs to happen once to the rootCmd. func Execute() { if err := rootCmd.Execute(); err != nil { fmt.Println(err) os.Exit(1) } } func init() { cobra.OnInitialize(initConfig) rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.invoicerender.yaml)") } // initConfig reads in config file and ENV variables if set. func initConfig() { if cfgFile != "" { // Use config file from the flag. viper.SetConfigFile(cfgFile) } else { // Find home directory by finding current user. usr, err := user.Current() if err != nil { fmt.Printf("Could not get user home directory: %s", err) os.Exit(1) } configDir = filepath.Join(usr.HomeDir, ".config", "invoicerender") cfgFile = filepath.Join(configDir, ".invoicerender.yaml") // Search config in .config directory with name ".invoicerender" (without extension). viper.AddConfigPath(configDir) viper.SetConfigName(".invoicerender") } viper.AutomaticEnv() // read in environment variables that match // If a config file is found, read it in. // TODO: Print the opposite when we have an error. if err := viper.ReadInConfig(); err == nil { fmt.Println("Using config file:", viper.ConfigFileUsed()) } }
28.811765
114
0.726419
584a90d4fd191bd15b29917784024f34e8ebffe9
647
h
C
Network/serial_AT.h
byxlk/cherryFly
388dee9e752b4cc17aeeedb9f6a4b58588a3859d
[ "MIT" ]
null
null
null
Network/serial_AT.h
byxlk/cherryFly
388dee9e752b4cc17aeeedb9f6a4b58588a3859d
[ "MIT" ]
null
null
null
Network/serial_AT.h
byxlk/cherryFly
388dee9e752b4cc17aeeedb9f6a4b58588a3859d
[ "MIT" ]
1
2021-07-01T11:47:17.000Z
2021-07-01T11:47:17.000Z
#ifndef __SERIAL_AT_H #define __SERIAL_AT_H #include "stm32f4xx.h" /* Kernel includes. */ #include "FreeRTOS.h" #include "task.h" #include "timers.h" #include "semphr.h" #define Normal (0x00) #define ExecFail (1<<0) #define SendTimeOut (1<<1) #define ReceTimeOut (1<<2) #define ParaErr (1<<3) #define Overflow (1<<4) /* 定义AT接收缓冲区的大小 */ #define __AT_SIZE (1024U) const char *pcSerialAT_GetCachePoint(void); uint8_t ucSerialAT_SendCmd(const char *pcCmd2Send, TickType_t xTicksToWait); uint8_t ucSerialAT_WaitRes(const char **ppcSucBuf, const char **ppcErrBuf, TickType_t xTicksToWait); #endif
19.606061
101
0.693972
189d713d88a3bf5bea07658c9fd8e343b9fbcc40
11,560
sql
SQL
sql/dataManipulation.sql
llanesm/EHR-Lite
91d5aeb2a27c997fc44ed60adadffc104985798c
[ "Apache-2.0" ]
null
null
null
sql/dataManipulation.sql
llanesm/EHR-Lite
91d5aeb2a27c997fc44ed60adadffc104985798c
[ "Apache-2.0" ]
null
null
null
sql/dataManipulation.sql
llanesm/EHR-Lite
91d5aeb2a27c997fc44ed60adadffc104985798c
[ "Apache-2.0" ]
null
null
null
-- Inserts -- --paitents --Query for adding a new patient into the system. '$' used to denote variables -- that will be data from backend Python INSERT INTO patients (fname, lname, birthdate, preferredPharmacy, primaryCarePhysician) VALUES ($fname, $lname, $birthdate, $preferredPharmacy, $providerIdNumber); --providers --Query for adding a new provider into the system. '$' used to denote variables -- that will be data from backend Python INSERT INTO providers (fname, lname, licenseType, licenseNumber, specialty, primaryCare) VALUES ($fname, $lname, $licenseType, $licenseNumber, $specialty, $primaryCare); --clinics --Query for adding a new clinic into the system. '$' used to denote variables -- that will be data from backend Python INSERT INTO clinics (clinicName, specialty, providerCapacity, examRooms, primaryCare) VALUES ($clinicName, $specialty, $providerCapacity, $examRooms, $primaryCare); --visits --Query for adding a new visit into the system. '$' used to denote variables -- that will be data from backend Python INSERT INTO visits (visitDate, chiefComplaint, diagnosisCode, procedureCode, patientID, providerID, clinicID, providerNotes) VALUES ($visitDate, $chiefComplaint, $diagnosisCode, $procedureCode, $patientID, $providerID, $clinicID, $providerNotes); -------------------------------------------------------------------------------- -- Selects -- --patients, Select by medicalRecordNumber, Updated (v2) --Query for selecting the medical history of the current patient based on their -- medicalRecordNumber(PK). '$medicalRecordNumber' used to denote passed variable -- from backend Python code representing medicalRecordNumber from patient portal -- Example: $medicalRecordNumber = 1 SELECT patients.medicalRecordNumber, visits.visitDate, visits.chiefComplaint, CONCAT(providers.fname, ' ', providers.lname) AS 'PCP', diagnoses.diagnosisName, procedures.procedureName, clinics.clinicName, visits.providerNotes FROM visits JOIN patients ON patients.medicalRecordNumber = visits.patient JOIN clinics ON clinics.clinicID = visits.clinic JOIN providers ON providers.providerID = visits.provider JOIN diagnoses ON diagnoses.diagnosisCode = visits.diagnosisCode JOIN procedures ON procedures.procedureCode = visits.procedureCode WHERE patients.medicalRecordNumber = $medicalRecordNumber; --providers version, select by visit date, view medical history of a patient SELECT visits.accountNumber, CONCAT(patients.fname, ' ', patients.lname) AS patient, visits.chiefComplaint, clinics.clinicName, diagnoses.diagnosisName, procedures.procedureName, CONCAT(providers.fname, ' ', providers.lname) AS 'PCP', visits.providerNotes FROM visits JOIN patients ON patients.medicalRecordNumber = visits.patient JOIN clinics ON clinics.clinicID = visits.clinic LEFT JOIN diagnoses ON diagnoses.diagnosisCode = visits.diagnosisCode JOIN procedures ON procedures.procedureCode = visits.procedureCode JOIN providers ON providers.providerID = visits.provider WHERE visits.visitDate = $visitDate; --visit, Select by date --Query for selecting all visits in the system based on the date given. $visitDate used -- to denote passed variable from backend Python code representing date from provider portal -- Example: $visitDate = '2020-03-20' SELECT visits.accountNumber, CONCAT(patients.fname, ' ', patients.lname), visits.chiefComplaint, clinics.clinicName, diagnoses.diagnosisName, procedures.procedureName, CONCAT(providers.fname, ' ', providers.lname) AS 'PCP', visits.providerNotes FROM visits JOIN patients ON patients.medicalRecordNumber = visits.patient JOIN clinics ON clinics.clinicID = visits.clinic JOIN diagnoses ON diagnoses.diagnosisCode = visits.diagnosisCode JOIN procedures ON procedures.procedureCode = visits.procedureCode JOIN providers ON providers.providerID = visits.provider WHERE visits.visitDate = $visitDate; --providers' paitents, Select by providerID --Query for selecting all patients of a chosen provider based on the provider's id number. -- $providerID used to denote passed variable from backend Python code representing the -- provider's unique id from provider portal -- Example: $providerID = 1 SELECT patients.medicalRecordNumber, patients.fname, patients.lname, patients.birthdate, CONCAT(providers.fname, ' ', providers.lname) AS 'PCP', patients.preferredPharmacy FROM patients JOIN providers ON providers.providerID = patients.primaryCarePhysician WHERE providers.providerID = $providerID; --clinics, Select by clinicID and MedicalRecordNumber --Query (Using M:M patientsClinics) for selecting all patients of a chosen clinic based on the clinic's id number. -- $clinicID used to denote passed variable from backend Python code representing the -- clinic's unique id from admin portal -- Example: $clinicID = 1 SELECT patients.medicalRecordNumber, patients.fname, patients.lname, patients.birthdate FROM patients JOIN patientsClinics ON patientsClinics.patientID = patients.medicalRecordNumber JOIN clinics ON clinics.clinicID = patientsClinics.clinicID WHERE clinics.clinicID = $clinicID; --providers, Select by Clinic ID --Query for selecting all providers of a chosen clinic based on the clinic's id number. -- $clinicID used to denote passed variable from backend Python code representing the -- clinic's unique id from admin portal -- Example: $clinicID = 1 SELECT providers.providerID, providers.fname, providers.lname, providers.licenseType, providers.licenseNumber, providers.specialty, providers.primaryCare FROM providers JOIN providersClinics ON providersClinics.providerID = providers.providerID WHERE providersClinics.clinicID = $clinicID; --Query for selecting all clinic ID's to populate dropdown boxes SELECT clinicID, clinicName FROM clinics --Query for selecting all provider ID's to populate dropdown boxes SELECT providerID, CONCAT(fname, ' ', lname) AS 'providerName' FROM providers --Query for selecting all procedureOptions to populate dropdown boxes SELECT procedureCode FROM procedures --Query for selecting all diagnosisCodes to populate dropdown boxes SELECT diagnosisCode FROM diagnoses --providers --Query for selecting a patients records for the providers page SELECT medicalRecordNumber, fname, lname, birthdate, primaryCarePhysician, preferredPharmacy FROM patients WHERE medicalRecordNumber = $medicalRecordNumber --patients --Query for patients to see all clinics that they are assigned to based on their unique medicalRecordNumber SELECT patients.medicalRecordNumber, CONCAT(patients.fname, ' ', patients.lname) AS 'patientName', clinics.clinicID, clinics.clinicName FROM patients JOIN patientsClinics ON patientsClinics.patientID = patients.medicalRecordNumber JOIN clinics ON clinics.clinicID = patientsClinics.clinicID WHERE patients.medicalRecordNumber = $medicalRecordNumber --providers --Query for selecting visit information based on its unique accountNumber, from the providers page SELECT visitDate, chiefComplaint, diagnosisCode, procedureCode, patient, clinic, provider, providerNotes FROM visits WHERE accountNumber = $accountNumber -------------------------------------------------------------------------------- -- Deletes -- --patients, Select by medicalRecordNumber ***NOTE: this table needs ON DELETE CASCADE <------ --Query for deleting a patient from the system based on their unique medicalRecordNumber. -- Will follow ON DELETE CASCADE referential action. $medicalRecordNumber used to -- denote passed from backend Python representing user input from provider portal. -- Example: $medicalRecordNumber = 1 DELETE FROM patients WHERE medicalRecordNumber = $medicalRecordNumber; --visit, Select by accountNumber --Query for deleting a visit from the system based on its unique accountNumber. -- Will follow ON DELETE CASCADE referential action. $accountNumber used to -- denote passed from backend Python representing user input from provider portal. -- Example: $accountNumber = 1 DELETE FROM visits WHERE accountNumber = $accountNumber; --providers, Select by providerID ***NOTE: this table needs ON DELETE CASCADE <------- --Query for deleting a provider from the system based on their unique providerID. -- Will follow ON DELETE CASCADE referential action. $providerID used to -- denote passed from backend Python representing user input from admin portal. -- Example: $providerID = 1 DELETE FROM providers WHERE fname = $fname AND lname = $lname; --clinics, Select by clinicID --Query for deleting a clinic from the system based on its unique clinicID. -- Will follow ON DELETE CASCADE referential action. $clinicID used to -- denote passed from backend Python representing user input from admin portal. -- Example: $providerID = 1 DELETE FROM clinics WHERE clinicName = $clinicName; --M:M relationship Delete --Query for disassociating a patient from a clinic (relationshipo) DELETE FROM patientsClinics WHERE patientsClinics.patientID=$patientID AND patientsClinics.clinicID=$clinicID -------------------------------------------------------------------------------- -- Updates -- --patients, Select by patientID --Query for updating a patient's information based on their unique medicalRecordNumber. -- '$' used to denote variables that are passed from backend Python representing user -- input in the relavent fields. UPDATE patients SET fname = $fname, lname = $lname, birthdate = $birthdate, primaryCarePhysician = $primaryCarePhysician, preferredPharmacy = $preferredPharmacy WHERE medicalRecordNumber = $medicalRecordNumber; --visit, Select by accountNumber --Query for updating a visit's information based on their unique accountNumber. -- '$' used to denote variables that are passed from backend Python representing user -- input in the relavent fields. UPDATE visits SET visitDate = $visitDate, chiefComplaint = $chiefComplaint, diagnosisCode = $diagnosisCode, procedureCode = $procedureCode, patient = $patientID, clinic = $clinicID, provider = $providerID, providerNotes = $providerNotes WHERE accountNumber = $accountNumber; --providers, Select by providerID *****NOTE: Add fname to this query and html form? <----- --Query for updating a provider's information based on their unique providerID. -- '$' used to denote variables that are passed from backend Python representing user -- input in the relavent fields. UPDATE providers SET lname = $fname, licenseType = $licenseType, licenseNumber = $licenseNumber, specialty = $specialty, primaryCare = $primaryCare WHERE providerID = $providerID; --clinics, Select by clinicID *****NOTE: Add clinicName to this query and html form? <----- --Query for updating a clinics's information based on their unique clinicID. -- '$' used to denote variables that are passed from backend Python representing user -- input in the relavent fields. UPDATE clinics SET clinicName = $clinicName, specialty = $specialty, providerCapacity = $providerCapacity, examRooms = $examRooms, primaryCare = $primaryCare WHERE clinicID = $clinicID; --M:M relationship query, updates a patients relationship with a clinic with a different clinic -- $clinicID1 = new clinic relation -- $clinicID2 = old clinic relation UPDATE patientsClinics SET clinicID = $clinicID1 WHERE patientsClinics.patientID= $patientID AND patientsClinics.clinicID= $clinicID2
60.52356
267
0.759775
edffaf9550da14a6a1c29cbcf74d336c72175f43
413
asm
Assembly
oeis/051/A051792.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/051/A051792.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/051/A051792.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A051792: a(n) = (-1)^(n-1)*a(n-1)+(-1)^(n-2)*a(n-2), a(1)=1, a(2)=1. ; Submitted by Jon Maiga ; 1,1,0,1,1,0,-1,1,2,-1,-3,2,5,-3,-8,5,13,-8,-21,13,34,-21,-55,34,89,-55,-144,89,233,-144,-377,233,610,-377,-987,610,1597,-987,-2584,1597,4181,-2584,-6765,4181,10946,-6765,-17711,10946,28657,-17711,-46368 mov $2,1 lpb $0 sub $0,2 sub $1,$2 add $2,$1 mul $1,-1 lpe lpb $0 bin $0,3 add $2,$1 lpe mov $0,$2
24.294118
204
0.554479
963e46f4cf7badb8d947a816084fb8fef9285eff
103
php
PHP
vendor/get-stream/stream-laravel/src/GetStream/StreamLaravel/Exceptions/MissingDataException.php
RazzaFrazza/pokeGoApiTest
09ddd553c5c38326db8fa1dfbf64e86dd37f74d3
[ "MIT" ]
null
null
null
vendor/get-stream/stream-laravel/src/GetStream/StreamLaravel/Exceptions/MissingDataException.php
RazzaFrazza/pokeGoApiTest
09ddd553c5c38326db8fa1dfbf64e86dd37f74d3
[ "MIT" ]
null
null
null
vendor/get-stream/stream-laravel/src/GetStream/StreamLaravel/Exceptions/MissingDataException.php
RazzaFrazza/pokeGoApiTest
09ddd553c5c38326db8fa1dfbf64e86dd37f74d3
[ "MIT" ]
null
null
null
<?php namespace GetStream\StreamLaravel\Exceptions; class MissingDataException extends \Exception { }
20.6
51
0.825243
edc514ffdf6a1bd040bf3979db176430891ff8da
1,059
lua
Lua
deep_manipulation/common/curve_plot.lua
Fanleyrobot/ADT
d4d7693e7df971249d68bb75b78ed5d53cb21986
[ "BSD-3-Clause" ]
7
2019-07-29T09:50:31.000Z
2021-12-22T11:37:52.000Z
deep_manipulation/common/curve_plot.lua
Fanleyrobot/ADT
d4d7693e7df971249d68bb75b78ed5d53cb21986
[ "BSD-3-Clause" ]
null
null
null
deep_manipulation/common/curve_plot.lua
Fanleyrobot/ADT
d4d7693e7df971249d68bb75b78ed5d53cb21986
[ "BSD-3-Clause" ]
null
null
null
--[[ File @description: The functions included in this file are for ploting curves. @version: V0.10 @author: Fangyi Zhang email:gzzhangfangyi@gmail.com @acknowledgement: ARC Centre of Excellence for Robotic Vision (ACRV) Queensland Univsersity of Technology (QUT) @history: V0.00 23/06/2015 developed the first version V0.10 26/07/2018 minor updates for code re-organization ]] require "torch" require "gnuplot" -- Visualize a tensor into a line and save as a png file function plotTensorToFile(tensor, tensor_name, x_label, y_label, file_name) gnuplot.pngfigure(file_name) gnuplot.plot( {tensor_name, tensor, '-'} ) gnuplot.xlabel(x_label) gnuplot.ylabel(y_label) end -- Visualize a tensor into a line and display in a window numberred as figure_number function plotTensorToDisplay(tensor, tensor_name, x_label, y_label, figure_number) gnuplot.figure(figure_number) gnuplot.plot( {tensor_name, tensor, '-'} ) gnuplot.xlabel(x_label) gnuplot.ylabel(y_label) end
27.868421
84
0.719547
c6db00f048f0b0d79e614416faaebf6b7e2c289b
770
kt
Kotlin
testlib/src/commonMain/kotlin/maryk/test/ByteCollector.kt
marykdb/maryk
2fa9601d42cd0eae5c3672b1c23b1777856dc5fa
[ "Apache-2.0" ]
4
2020-08-26T10:38:21.000Z
2021-11-02T05:31:05.000Z
testlib/src/commonMain/kotlin/maryk/test/ByteCollector.kt
marykdb/maryk
2fa9601d42cd0eae5c3672b1c23b1777856dc5fa
[ "Apache-2.0" ]
null
null
null
testlib/src/commonMain/kotlin/maryk/test/ByteCollector.kt
marykdb/maryk
2fa9601d42cd0eae5c3672b1c23b1777856dc5fa
[ "Apache-2.0" ]
null
null
null
package maryk.test /** Collects bytes into a byteArray and enables to read them afterwards*/ open class ByteCollector { var bytes: ByteArray? = null private var writeIndex = 0 var readIndex = 0 val size: Int get() = bytes!!.size fun reserve(count: Int) { bytes.apply { if (this != null && this.size == count) { // recycle for (it in 0..this.lastIndex) { this[it] = 0 } } else { bytes = ByteArray(count) } } } fun write(byte: Byte) { bytes!![writeIndex++] = byte } fun read() = this.bytes!![this.readIndex++] open fun reset() { writeIndex = 0 readIndex = 0 } }
22
73
0.490909
cbab1b8439bb495dfa7d58d46c26a07f08b38908
5,192
go
Go
pkg/monitor/metrics/application.go
Nicola115/kubevela
9d93b990841c6f940065c03876560b04c16ff597
[ "Apache-2.0" ]
3
2022-02-21T04:42:37.000Z
2022-02-26T23:21:03.000Z
pkg/monitor/metrics/application.go
Nicola115/kubevela
9d93b990841c6f940065c03876560b04c16ff597
[ "Apache-2.0" ]
null
null
null
pkg/monitor/metrics/application.go
Nicola115/kubevela
9d93b990841c6f940065c03876560b04c16ff597
[ "Apache-2.0" ]
null
null
null
/* Copyright 2021. The KubeVela Authors. 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 metrics import ( "github.com/prometheus/client_golang/prometheus" ) var ( // CreateAppHandlerDurationHistogram report the create appHandler execution duration. CreateAppHandlerDurationHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{ Name: "create_app_handler_time_seconds", Help: "create appHandler duration distributions, this operate will list ResourceTrackers.", Buckets: histogramBuckets, ConstLabels: prometheus.Labels{}, }, []string{"controller"}) // HandleFinalizersDurationHistogram report the handle finalizers execution duration. HandleFinalizersDurationHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{ Name: "handle_finalizers_time_seconds", Help: "handle finalizers duration distributions.", Buckets: histogramBuckets, ConstLabels: prometheus.Labels{}, }, []string{"controller", "type"}) // ParseAppFileDurationHistogram report the parse appFile execution duration. ParseAppFileDurationHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{ Name: "parse_appFile_time_seconds", Help: "parse appFile duration distributions.", Buckets: histogramBuckets, ConstLabels: prometheus.Labels{}, }, []string{"controller"}) // PrepareCurrentAppRevisionDurationHistogram report the parse current appRevision execution duration. PrepareCurrentAppRevisionDurationHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{ Name: "prepare_current_appRevision_time_seconds", Help: "parse current appRevision duration distributions.", Buckets: histogramBuckets, ConstLabels: prometheus.Labels{}, }, []string{"controller"}) // ApplyAppRevisionDurationHistogram report the apply appRevision execution duration. ApplyAppRevisionDurationHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{ Name: "apply_appRevision_time_seconds", Help: "apply appRevision duration distributions.", Buckets: histogramBuckets, ConstLabels: prometheus.Labels{}, }, []string{"controller"}) // PrepareWorkflowAndPolicyDurationHistogram report the prepare workflow and policy execution duration. PrepareWorkflowAndPolicyDurationHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{ Name: "prepare_workflow_and_policy_time_seconds", Help: "prepare workflow and policy duration distributions.", Buckets: histogramBuckets, ConstLabels: prometheus.Labels{}, }, []string{"controller"}) // GCResourceTrackersDurationHistogram report the gc resourceTrackers execution duration. GCResourceTrackersDurationHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{ Name: "gc_resourceTrackers_time_seconds", Help: "gc resourceTrackers duration distributions.", Buckets: histogramBuckets, ConstLabels: prometheus.Labels{}, }, []string{"stage"}) // ClientRequestHistogram report the client request execution duration. ClientRequestHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{ Name: "client_request_time_seconds", Help: "client request duration distributions.", Buckets: histogramBuckets, ConstLabels: prometheus.Labels{}, }, []string{"verb", "Kind", "apiVersion", "unstructured", "cluster"}) // ApplicationReconcileTimeHistogram report the reconciling time cost of application controller with state transition recorded ApplicationReconcileTimeHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{ Name: "application_reconcile_time_seconds", Help: "application reconcile duration distributions.", Buckets: histogramBuckets, ConstLabels: prometheus.Labels{}, }, []string{"begin_phase", "end_phase"}) // ApplyComponentTimeHistogram report the time cost of applyComponentFunc ApplyComponentTimeHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{ Name: "apply_component_time_seconds", Help: "apply component duration distributions.", Buckets: histogramBuckets, ConstLabels: prometheus.Labels{}, }, []string{"stage"}) ) var ( // ListResourceTrackerCounter report the list resource tracker number. ListResourceTrackerCounter = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "list_resourcetracker_num", Help: "list resourceTrackers times.", }, []string{"controller"}) ) var ( // ResourceTrackerNumberGauge report the number of resourceTracker ResourceTrackerNumberGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Name: "resourcetracker_number", Help: "resourceTracker number.", }, []string{"controller"}) )
43.266667
127
0.773305
d4f33103f4cc066b892a11661cba6688904a1743
1,041
rs
Rust
popstcl-core/src/vm/module.rs
InnPatron/Popstcl
cb1e1f8d71b64fd94964657d61eb7ce26ffc7d21
[ "MIT" ]
null
null
null
popstcl-core/src/vm/module.rs
InnPatron/Popstcl
cb1e1f8d71b64fd94964657d61eb7ce26ffc7d21
[ "MIT" ]
null
null
null
popstcl-core/src/vm/module.rs
InnPatron/Popstcl
cb1e1f8d71b64fd94964657d61eb7ce26ffc7d21
[ "MIT" ]
null
null
null
use super::internal::*; use std::rc::Rc; use std::cell::{RefCell, Ref}; use ccrc::{Collectable, Tracer}; use std::fmt; pub trait Module: Object {} /// Interface to an Env for modules loaded by popstcl commands #[derive(Clone, Debug, PartialEq)] pub struct StdModule(Env); impl StdModule { pub fn new(env: Env) -> StdModule { StdModule(env) } } impl Module for StdModule {} impl Object for StdModule { fn env(&self) -> &Env { &self.0 } fn env_mut(&mut self) -> &mut Env { &mut self.0 } } impl Collectable for StdModule { fn trace(&self, tracer: &Tracer) { Collectable::trace(&self.0, tracer); } } impl DeepClone for StdModule { fn deep_clone(&self) -> Self { StdModule::new(self.0.deep_clone()) } } impl fmt::Display for StdModule { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Module[{}]", ToString::to_string(&self.0)) } } impl IntoValue for StdModule { fn into_value(self) -> Value { Value::Module(self) } }
19.277778
62
0.611912
5c833cd123d46efe54ac23b8849a4c729699a47f
390
asm
Assembly
_anim/obj43.asm
vladjester2020/Sonic1TMR
22e749a2aab74cc725729e476d6252b071c12e42
[ "Apache-2.0" ]
null
null
null
_anim/obj43.asm
vladjester2020/Sonic1TMR
22e749a2aab74cc725729e476d6252b071c12e42
[ "Apache-2.0" ]
2
2019-06-13T14:26:59.000Z
2019-10-10T13:15:14.000Z
_anim/obj43.asm
vladjester2020/Sonic1TMR
22e749a2aab74cc725729e476d6252b071c12e42
[ "Apache-2.0" ]
null
null
null
; --------------------------------------------------------------------------- ; Animation script - Roller enemy ; --------------------------------------------------------------------------- dc.w byte_E190-Ani_obj43 dc.w byte_E196-Ani_obj43 dc.w byte_E19C-Ani_obj43 byte_E190: dc.b $F, 2, 1, 0, $FE, 1 byte_E196: dc.b $F, 1, 2, $FD, 2, 0 byte_E19C: dc.b 3, 3, 4, 2, $FF even
39
78
0.382051
755d2297789780b296868ad03108d1b89dd09ff7
3,427
h
C
networkit/cpp/graph/RandomMaximumSpanningForest.h
maxvogel/NetworKit-mirror2
02a1805a4eda56fbdd647852afcfac26bcb77099
[ "MIT" ]
null
null
null
networkit/cpp/graph/RandomMaximumSpanningForest.h
maxvogel/NetworKit-mirror2
02a1805a4eda56fbdd647852afcfac26bcb77099
[ "MIT" ]
null
null
null
networkit/cpp/graph/RandomMaximumSpanningForest.h
maxvogel/NetworKit-mirror2
02a1805a4eda56fbdd647852afcfac26bcb77099
[ "MIT" ]
null
null
null
#ifndef RANDOMMAXIMUMSPANNINGFOREST_H #define RANDOMMAXIMUMSPANNINGFOREST_H #include "Graph.h" #include <limits> #include "../structures/UnionFind.h" #include "../auxiliary/Log.h" #include "../auxiliary/Random.h" #include "../base/Algorithm.h" namespace NetworKit { /** * Computes a random maximum-weight spanning forest using Kruskal's algorithm by randomizing the order of edges of the same weight. */ class RandomMaximumSpanningForest : public Algorithm { public: /** * Initialize the random maximum-weight spanning forest algorithm, uses edge weights. * * @param G The input graph. */ RandomMaximumSpanningForest(const Graph &G); /** * Initialize the random maximum-weight spanning forest algorithm using an attribute as edge weight. * * This copies the attribute values, the supplied attribute vector is not stored. * * @param G The input graph. * @param attribute The attribute to use, can be either of type edgeweight (double) or count (uint64), internally all values are handled as double. */ template <typename A> RandomMaximumSpanningForest(const Graph &G, const std::vector<A> &attribute); /** * Execute the algorithm. */ virtual void run() override; /** * Get a boolean attribute that indicates for each edge if it is part of the calculated maximum-weight spanning forest. * * This attribute is only calculated and can thus only be request if the supplied graph has edge ids. * * @param move If the attribute shall be moved out of the algorithm instance. * @return The vector with the boolean attribute for each edge. */ std::vector<bool> getAttribute(bool move = false); /** * Checks if the edge (@a u, @a v) is part of the calculated maximum-weight spanning forest. * * @param u The first node of the edge to check * @param v The second node of the edge to check * @return If the edge is part of the calculated maximum-weight spanning forest. */ bool inMSF(node u, node v) const; /** * Checks if the edge with the id @a eid is part of the calculated maximum-weight spanning forest. * * @param eid The id of the edge to check. * @return If the edge is part of the calculated maximum-weight spanning forest. */ bool inMSF(edgeid eid) const; /** * Gets the calculated maximum-weight spanning forest as graph. * * @param move If the graph shall be moved out of the algorithm instance. * @return The calculated maximum-weight spanning forest. */ Graph getMSF(bool move = false); /** * @return false - this algorithm is not parallelized */ virtual bool isParallel() const override; /** * @return The name of this algorithm. */ virtual std::string toString() const override; private: struct weightedEdge { double attribute; node u; node v; edgeid eid; index rand; bool operator>(const weightedEdge &other) const { return (attribute > other.attribute) || (attribute == other.attribute && (rand > other.rand || (rand == other.rand && (u > other.u || (u == other.u && v > other.v))))); }; weightedEdge(node u, node v, double attribute, edgeid eid = 0) : attribute(attribute), u(u), v(v), eid(eid), rand(Aux::Random::integer()) {}; }; const Graph &G; std::vector<weightedEdge> weightedEdges; Graph msf; std::vector<bool> msfAttribute; bool hasWeightedEdges; bool hasMSF; bool hasAttribute; }; } // namespace NetworKit #endif // RANDOMMAXIMUMSPANNINGFOREST_H
28.322314
148
0.707324
1106fafd7eb553324bfcb81666a5fbdb6322ac84
244
sql
SQL
query4.sql
julms/mta.SQL
fed73e301cfa19d6799b5ba06368911b979a93ee
[ "MIT" ]
null
null
null
query4.sql
julms/mta.SQL
fed73e301cfa19d6799b5ba06368911b979a93ee
[ "MIT" ]
null
null
null
query4.sql
julms/mta.SQL
fed73e301cfa19d6799b5ba06368911b979a93ee
[ "MIT" ]
null
null
null
SELECT st.name AS name, sum(feb.ff) - sum(jan.ff) AS diff_feb1_jan18 FROM stations AS st INNER JOIN fares_jan18 AS jan INNER JOIN fares_feb1 AS feb ON st.name = jan.station and jan.remote = feb.remote WHERE line = "Broadway" GROUP BY st.name
34.857143
68
0.758197
9ba03ca5c48e8a2fb6935587cafad903f4934cd7
173
js
JavaScript
src/modules/preference/sdk/createPreference.js
brianneisler/moltres-template
d27a05abc0079e9c316e2eca869990b66501afa0
[ "Apache-2.0" ]
3
2020-07-31T12:21:26.000Z
2021-11-01T22:16:16.000Z
src/modules/preference/sdk/createPreference.js
brianneisler/moltres-template
d27a05abc0079e9c316e2eca869990b66501afa0
[ "Apache-2.0" ]
1
2021-02-23T05:24:21.000Z
2021-02-23T05:24:21.000Z
src/modules/preference/sdk/createPreference.js
brianneisler/moltres-template
d27a05abc0079e9c316e2eca869990b66501afa0
[ "Apache-2.0" ]
null
null
null
import { createEntity } from '../../../core/sdk' import { Preference } from '../schemas' const createPreference = createEntity(Preference) export default createPreference
24.714286
49
0.739884
2c24ab201cdbdd8d96c911e1a619660dc454a6b1
5,498
kt
Kotlin
src/main/kotlin/org/jetbrains/numkt/math/SumsProductsDifferences.kt
devcrocod/kotlin-numpy
1e755cfdb6c162e4ab071453791f70b029d6d2a5
[ "Apache-2.0" ]
311
2019-12-05T14:44:11.000Z
2022-03-23T09:32:46.000Z
src/main/kotlin/org/jetbrains/numkt/math/SumsProductsDifferences.kt
devcrocod/kotlin-numpy
1e755cfdb6c162e4ab071453791f70b029d6d2a5
[ "Apache-2.0" ]
22
2019-12-24T15:47:15.000Z
2021-11-23T18:29:16.000Z
src/main/kotlin/org/jetbrains/numkt/math/SumsProductsDifferences.kt
devcrocod/kotlin-numpy
1e755cfdb6c162e4ab071453791f70b029d6d2a5
[ "Apache-2.0" ]
13
2020-01-28T20:36:04.000Z
2021-12-12T17:19:04.000Z
/* * Copyright 2019 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jetbrains.numkt.math import org.jetbrains.numkt.append import org.jetbrains.numkt.callFunc import org.jetbrains.numkt.core.KtNDArray import org.jetbrains.numkt.core.None import org.jetbrains.numkt.emptyLike /** * Return the product of array elements over a given axis. */ inline fun <reified T : Number> prod(a: KtNDArray<T>): T = callFunc(nameMethod = arrayOf("prod"), args = arrayOf(a, None.none, a.dtype), kClass = T::class) fun <T : Number> prod(a: KtNDArray<T>, axis: Int): KtNDArray<T> = callFunc(nameMethod = arrayOf("prod"), args = arrayOf(a, axis, a.dtype)) /** * Sum of array elements over a given axis. */ inline fun <reified T : Number> sum(a: KtNDArray<T>): T = callFunc(nameMethod = arrayOf("sum"), args = arrayOf(a, None.none, a.dtype), kClass = T::class) fun <T : Number> sum(a: KtNDArray<T>, axis: Int): KtNDArray<T> = callFunc(nameMethod = arrayOf("sum"), args = arrayOf(a, axis, a.dtype)) /** * Return the product of array elements over a given axis treating Not a Numbers (NaNs) as ones. */ inline fun <reified T : Number> nanprod(a: KtNDArray<T>): T = callFunc(nameMethod = arrayOf("nanprod"), args = arrayOf(a, a.dtype), kClass = T::class) fun <T : Number> nanprod(a: KtNDArray<T>, axis: Int): KtNDArray<T> = callFunc(nameMethod = arrayOf("nanprod"), args = arrayOf(a, axis, a.dtype)) /** * Return the sum of array elements over a given axis treating Not a Numbers (NaNs) as zero. */ inline fun <reified T : Number> nansum(a: KtNDArray<T>): T = callFunc(nameMethod = arrayOf("nanprod"), args = arrayOf(a, a.dtype), kClass = T::class) fun <T : Number> nansum(a: KtNDArray<T>, axis: Int): KtNDArray<T> = callFunc(nameMethod = arrayOf("nansum"), args = arrayOf(a, axis, a.dtype)) /** * Return the cumulative product of elements along a given axis. */ fun <T : Any> cumprod(a: KtNDArray<T>, axis: Int? = null): KtNDArray<T> = callFunc(nameMethod = arrayOf("cumprod"), args = arrayOf(a, axis ?: None.none, a.dtype)) /** * Return the cumulative sum of the elements along a given axis. */ @JvmName("cumsumNumber") fun <T : Number> cumsum(a: KtNDArray<T>, axis: Int? = null): KtNDArray<T> = callFunc(nameMethod = arrayOf("cumsum"), args = arrayOf(a, axis ?: None.none, a.dtype)) @JvmName("cumsumBoolean") fun cumsum(a: KtNDArray<Boolean>, axis: Int? = null): KtNDArray<Int> = callFunc(nameMethod = arrayOf("cumsum"), args = arrayOf(a, axis ?: None.none)) /** * Return the cumulative product of array elements over a given axis treating Not a Numbers (NaNs) as one. */ fun <T : Number> nancumprod(a: KtNDArray<T>, axis: Int? = null): KtNDArray<T> = callFunc(nameMethod = arrayOf("nancumprod"), args = arrayOf(a, axis ?: None.none, a.dtype)) /** * Return the cumulative sum of array elements over a given axis treating Not a Numbers (NaNs) as zero. */ fun <T : Number> nancumsum(a: KtNDArray<T>, axis: Int? = null): KtNDArray<T> = callFunc(nameMethod = arrayOf("nancumsum"), args = arrayOf(a, axis ?: None.none, a.dtype)) /** * Calculate the n-th discrete difference along the given axis. */ fun <T : Number> diff(a: KtNDArray<T>, n: Int = 1, axis: Int = -1): KtNDArray<T> = callFunc(nameMethod = arrayOf("diff"), args = arrayOf(a, n, axis)) /** * The differences between consecutive elements of an array. */ fun <T : Number> ediff1d( ary: KtNDArray<T>, toEnd: KtNDArray<T>? = null, toStart: KtNDArray<T>? = null ): KtNDArray<T> = callFunc(nameMethod = arrayOf("ediff1d"), args = arrayOf(ary, toEnd ?: None.none, toStart ?: None.none)) /** * Return the gradient of an one-dimensional array. */ fun <T : Any> gradient1D(f: KtNDArray<T>): KtNDArray<Double> = callFunc(nameMethod = arrayOf("gradient"), args = arrayOf(f)) /** * Return the gradient of an N-dimensional array. */ fun <T : Any> gradientND(f: KtNDArray<T>): List<KtNDArray<Double>> = callFunc(nameMethod = arrayOf("gradient"), args = arrayOf(f), kClass = List::class) as List<KtNDArray<Double>> /** * Return the cross product of two (arrays of) vectors. */ fun <T : Number, E : Number> cross( a: KtNDArray<T>, b: KtNDArray<E>, axisa: Int = -1, axisb: Int = -1, axisc: Int = -1, axis: Int? = null ): KtNDArray<Double> = callFunc(nameMethod = arrayOf("cross"), args = arrayOf(a, b, axisa, axisb, axisc, axis ?: None.none)) /** * Integrate along the given axis using the composite trapezoidal rule. */ fun <T : Number> trapz( y: KtNDArray<T>, x: KtNDArray<out Number>? = null, dx: Double = 1.0 ): Double = callFunc(nameMethod = arrayOf("trapz"), args = arrayOf(y, x ?: None.none, dx), kClass = Double::class) fun <T : Number> trapz( y: KtNDArray<T>, x: KtNDArray<out Number>? = null, dx: Double = 1.0, axis: Int = -1 ): KtNDArray<Double> = callFunc(nameMethod = arrayOf("trapz"), args = arrayOf(y, x ?: None.none, dx, axis))
37.148649
114
0.66988
27d40b9dbc455757a234bbd7405e3f225d36d254
1,130
sql
SQL
hasura/migrations/default/1631649292980_create_table_video_EventRtmpOutput/up.sql
VictorGMBraga/clowdr
e7ade2c742524f9a4006b7565ee9424fa4354acd
[ "BSD-3-Clause" ]
49
2021-01-09T07:09:08.000Z
2022-03-27T05:16:46.000Z
hasura/migrations/default/1631649292980_create_table_video_EventRtmpOutput/up.sql
VictorGMBraga/clowdr
e7ade2c742524f9a4006b7565ee9424fa4354acd
[ "BSD-3-Clause" ]
333
2021-01-17T14:52:22.000Z
2022-03-10T02:38:53.000Z
hasura/migrations/default/1631649292980_create_table_video_EventRtmpOutput/up.sql
VictorGMBraga/clowdr
e7ade2c742524f9a4006b7565ee9424fa4354acd
[ "BSD-3-Clause" ]
15
2021-01-29T14:17:38.000Z
2022-02-14T22:13:48.000Z
CREATE TABLE "video"."EventRtmpOutput" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), "url" text NOT NULL, "streamKey" text NOT NULL, "eventId" uuid NOT NULL, PRIMARY KEY ("id") , FOREIGN KEY ("eventId") REFERENCES "schedule"."Event"("id") ON UPDATE cascade ON DELETE cascade, UNIQUE ("eventId"));COMMENT ON TABLE "video"."EventRtmpOutput" IS E'Enables broadcasting of a live-stream event to an RTMP-capable service, such as YouTube.'; CREATE OR REPLACE FUNCTION "video"."set_current_timestamp_updated_at"() RETURNS TRIGGER AS $$ DECLARE _new record; BEGIN _new := NEW; _new."updated_at" = NOW(); RETURN _new; END; $$ LANGUAGE plpgsql; CREATE TRIGGER "set_video_EventRtmpOutput_updated_at" BEFORE UPDATE ON "video"."EventRtmpOutput" FOR EACH ROW EXECUTE PROCEDURE "video"."set_current_timestamp_updated_at"(); COMMENT ON TRIGGER "set_video_EventRtmpOutput_updated_at" ON "video"."EventRtmpOutput" IS 'trigger to set value of column "updated_at" to current timestamp on row update'; CREATE EXTENSION IF NOT EXISTS pgcrypto;
59.473684
533
0.769912
3eb47e260f81b3fe4e654c06299cda1266b46880
10,866
h
C
headers/private/kernel/util/MinMaxHeap.h
Kirishikesan/haiku
835565c55830f2dab01e6e332cc7e2d9c015b51e
[ "MIT" ]
1,338
2015-01-03T20:06:56.000Z
2022-03-26T13:49:54.000Z
headers/private/kernel/util/MinMaxHeap.h
Kirishikesan/haiku
835565c55830f2dab01e6e332cc7e2d9c015b51e
[ "MIT" ]
15
2015-01-17T22:19:32.000Z
2021-12-20T12:35:00.000Z
headers/private/kernel/util/MinMaxHeap.h
Kirishikesan/haiku
835565c55830f2dab01e6e332cc7e2d9c015b51e
[ "MIT" ]
350
2015-01-08T14:15:27.000Z
2022-03-21T18:14:35.000Z
/* * Copyright 2013 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * Paweł Dziepak, pdziepak@quarnos.org */ #ifndef KERNEL_UTIL_MIN_MAX_HEAP_H #define KERNEL_UTIL_MIN_MAX_HEAP_H #include <debug.h> #include <SupportDefs.h> template<typename Element, typename Key> struct MinMaxHeapLink { MinMaxHeapLink(); bool fMinTree; int fIndex; Key fKey; }; template<typename Element, typename Key> class MinMaxHeapLinkImpl { private: typedef MinMaxHeapLink<Element, Key> Link; public: inline Link* GetMinMaxHeapLink(); private: Link fMinMaxHeapLink; }; template<typename Element, typename Key> class MinMaxHeapStandardGetLink { private: typedef MinMaxHeapLink<Element, Key> Link; public: inline Link* operator()(Element* element) const; }; template<typename Element, typename Key, MinMaxHeapLink<Element, Key> Element::*LinkMember> class MinMaxHeapMemberGetLink { private: typedef MinMaxHeapLink<Element, Key> Link; public: inline Link* operator()(Element* element) const; }; template<typename Key> class MinMaxHeapCompare { public: inline bool operator()(Key a, Key b); }; #define MIN_MAX_HEAP_TEMPLATE_LIST \ template<typename Element, typename Key, typename Compare, typename GetLink> #define MIN_MAX_HEAP_CLASS_NAME MinMaxHeap<Element, Key, Compare, GetLink> template<typename Element, typename Key, typename Compare = MinMaxHeapCompare<Key>, typename GetLink = MinMaxHeapStandardGetLink<Element, Key> > class MinMaxHeap { public: MinMaxHeap(); MinMaxHeap(int initialSize); ~MinMaxHeap(); inline Element* PeekMinimum() const; inline Element* PeekMaximum() const; static const Key& GetKey(Element* element); inline void ModifyKey(Element* element, Key newKey); inline void RemoveMinimum(); inline void RemoveMaximum(); inline status_t Insert(Element* element, Key key); private: status_t _GrowHeap(int minimalSize = 0); void _MoveUp(MinMaxHeapLink<Element, Key>* link); void _MoveDown(MinMaxHeapLink<Element, Key>* link); bool _ChangeTree(MinMaxHeapLink<Element, Key>* link); void _RemoveLast(bool minTree); Element** fMinElements; int fMinLastElement; Element** fMaxElements; int fMaxLastElement; int fSize; static Compare sCompare; static GetLink sGetLink; }; #if KDEBUG template<typename Element, typename Key> MinMaxHeapLink<Element, Key>::MinMaxHeapLink() : fIndex(-1) { } #else template<typename Element, typename Key> MinMaxHeapLink<Element, Key>::MinMaxHeapLink() { } #endif template<typename Element, typename Key> MinMaxHeapLink<Element, Key>* MinMaxHeapLinkImpl<Element, Key>::GetMinMaxHeapLink() { return &fMinMaxHeapLink; } template<typename Element, typename Key> MinMaxHeapLink<Element, Key>* MinMaxHeapStandardGetLink<Element, Key>::operator()(Element* element) const { return element->GetMinMaxHeapLink(); } template<typename Element, typename Key, MinMaxHeapLink<Element, Key> Element::*LinkMember> MinMaxHeapLink<Element, Key>* MinMaxHeapMemberGetLink<Element, Key, LinkMember>::operator()( Element* element) const { return &(element->*LinkMember); } template<typename Key> bool MinMaxHeapCompare<Key>::operator()(Key a, Key b) { return a < b; } MIN_MAX_HEAP_TEMPLATE_LIST MIN_MAX_HEAP_CLASS_NAME::MinMaxHeap() : fMinElements(NULL), fMinLastElement(0), fMaxElements(NULL), fMaxLastElement(0), fSize(0) { } MIN_MAX_HEAP_TEMPLATE_LIST MIN_MAX_HEAP_CLASS_NAME::MinMaxHeap(int initialSize) : fMinElements(NULL), fMinLastElement(0), fMaxElements(NULL), fMaxLastElement(0), fSize(0) { _GrowHeap(initialSize); } MIN_MAX_HEAP_TEMPLATE_LIST MIN_MAX_HEAP_CLASS_NAME::~MinMaxHeap() { free(fMinElements); } MIN_MAX_HEAP_TEMPLATE_LIST Element* MIN_MAX_HEAP_CLASS_NAME::PeekMinimum() const { if (fMinLastElement > 0) return fMinElements[0]; else if (fMaxLastElement > 0) { ASSERT(fMaxLastElement == 1); return fMaxElements[0]; } return NULL; } MIN_MAX_HEAP_TEMPLATE_LIST Element* MIN_MAX_HEAP_CLASS_NAME::PeekMaximum() const { if (fMaxLastElement > 0) return fMaxElements[0]; else if (fMinLastElement > 0) { ASSERT(fMinLastElement == 1); return fMinElements[0]; } return NULL; } MIN_MAX_HEAP_TEMPLATE_LIST const Key& MIN_MAX_HEAP_CLASS_NAME::GetKey(Element* element) { return sGetLink(element)->fKey; } MIN_MAX_HEAP_TEMPLATE_LIST void MIN_MAX_HEAP_CLASS_NAME::ModifyKey(Element* element, Key newKey) { MinMaxHeapLink<Element, Key>* link = sGetLink(element); Key oldKey = link->fKey; link->fKey = newKey; if (!sCompare(newKey, oldKey) && !sCompare(oldKey, newKey)) return; if (sCompare(newKey, oldKey) ^ !link->fMinTree) _MoveUp(link); else _MoveDown(link); } MIN_MAX_HEAP_TEMPLATE_LIST void MIN_MAX_HEAP_CLASS_NAME::RemoveMinimum() { if (fMinLastElement == 0) { ASSERT(fMaxLastElement == 1); RemoveMaximum(); return; } #if KDEBUG Element* element = PeekMinimum(); MinMaxHeapLink<Element, Key>* link = sGetLink(element); ASSERT(link->fIndex != -1); link->fIndex = -1; #endif _RemoveLast(true); } MIN_MAX_HEAP_TEMPLATE_LIST void MIN_MAX_HEAP_CLASS_NAME::RemoveMaximum() { if (fMaxLastElement == 0) { ASSERT(fMinLastElement == 1); RemoveMinimum(); return; } #if KDEBUG Element* element = PeekMaximum(); MinMaxHeapLink<Element, Key>* link = sGetLink(element); ASSERT(link->fIndex != -1); link->fIndex = -1; #endif _RemoveLast(false); } MIN_MAX_HEAP_TEMPLATE_LIST status_t MIN_MAX_HEAP_CLASS_NAME::Insert(Element* element, Key key) { if (min_c(fMinLastElement, fMaxLastElement) == fSize) { ASSERT(max_c(fMinLastElement, fMaxLastElement) == fSize); status_t result = _GrowHeap(); if (result != B_OK) return result; } ASSERT(fMinLastElement < fSize || fMaxLastElement < fSize); MinMaxHeapLink<Element, Key>* link = sGetLink(element); ASSERT(link->fIndex == -1); link->fMinTree = fMinLastElement < fMaxLastElement; int& lastElement = link->fMinTree ? fMinLastElement : fMaxLastElement; Element** tree = link->fMinTree ? fMinElements : fMaxElements; tree[lastElement] = element; link->fIndex = lastElement++; link->fKey = key; if (!_ChangeTree(link)) _MoveUp(link); return B_OK; } MIN_MAX_HEAP_TEMPLATE_LIST status_t MIN_MAX_HEAP_CLASS_NAME::_GrowHeap(int minimalSize) { minimalSize = minimalSize % 2 == 0 ? minimalSize : minimalSize + 1; int newSize = max_c(max_c(fSize * 4, 4), minimalSize); size_t arraySize = newSize * sizeof(Element*); Element** newBuffer = reinterpret_cast<Element**>(realloc(fMinElements, arraySize)); if (newBuffer == NULL) return B_NO_MEMORY; fMinElements = newBuffer; newBuffer += newSize / 2; if (fMaxLastElement > 0) memcpy(newBuffer, fMinElements + fSize, fSize * sizeof(Element*)); fMaxElements = newBuffer; fSize = newSize / 2; return B_OK; } MIN_MAX_HEAP_TEMPLATE_LIST void MIN_MAX_HEAP_CLASS_NAME::_MoveUp(MinMaxHeapLink<Element, Key>* link) { Element** tree = link->fMinTree ? fMinElements : fMaxElements; while (true) { if (link->fIndex <= 0) break; int parent = (link->fIndex - 1) / 2; bool isSmaller = sCompare(link->fKey, sGetLink(tree[parent])->fKey); if (isSmaller ^ !link->fMinTree) { ASSERT(sGetLink(tree[parent])->fIndex == parent); sGetLink(tree[parent])->fIndex = link->fIndex; Element* element = tree[link->fIndex]; tree[link->fIndex] = tree[parent]; tree[parent] = element; link->fIndex = parent; } else break; } } MIN_MAX_HEAP_TEMPLATE_LIST void MIN_MAX_HEAP_CLASS_NAME::_MoveDown(MinMaxHeapLink<Element, Key>* link) { int current; int lastElement = link->fMinTree ? fMinLastElement : fMaxLastElement; Element** tree = link->fMinTree ? fMinElements : fMaxElements; while (true) { current = link->fIndex; int child = 2 * link->fIndex + 1; if (child < lastElement) { bool isSmaller = sCompare(sGetLink(tree[child])->fKey, link->fKey); if (isSmaller ^ !link->fMinTree) current = child; } child = 2 * link->fIndex + 2; if (child < lastElement) { bool isSmaller = sCompare(sGetLink(tree[child])->fKey, sGetLink(tree[current])->fKey); if (isSmaller ^ !link->fMinTree) current = child; } if (link->fIndex == current) break; ASSERT(sGetLink(tree[current])->fIndex == current); sGetLink(tree[current])->fIndex = link->fIndex; Element* element = tree[link->fIndex]; tree[link->fIndex] = tree[current]; tree[current] = element; link->fIndex = current; } if (2 * link->fIndex + 1 >= lastElement) _ChangeTree(link); } MIN_MAX_HEAP_TEMPLATE_LIST bool MIN_MAX_HEAP_CLASS_NAME::_ChangeTree(MinMaxHeapLink<Element, Key>* link) { int otherLastElement = link->fMinTree ? fMaxLastElement : fMinLastElement; Element** currentTree = link->fMinTree ? fMinElements : fMaxElements; Element** otherTree = link->fMinTree ? fMaxElements : fMinElements; if (otherLastElement <= 0) { ASSERT(link->fMinTree ? fMinLastElement : fMaxLastElement == 1); return false; } ASSERT((link->fIndex - 1) / 2 < otherLastElement); Element* predecessor; if (2 * link->fIndex + 1 < otherLastElement) { predecessor = otherTree[2 * link->fIndex + 1]; ASSERT(sGetLink(predecessor)->fIndex == 2 * link->fIndex + 1); } else if (link->fIndex < otherLastElement) { predecessor = otherTree[link->fIndex]; ASSERT(sGetLink(predecessor)->fIndex == link->fIndex); } else { predecessor = otherTree[(link->fIndex - 1) / 2]; ASSERT(sGetLink(predecessor)->fIndex == (link->fIndex - 1) / 2); } MinMaxHeapLink<Element, Key>* predecessorLink = sGetLink(predecessor); bool isSmaller = sCompare(predecessorLink->fKey, link->fKey); if (isSmaller ^ !link->fMinTree) { Element* element = currentTree[link->fIndex]; currentTree[link->fIndex] = otherTree[predecessorLink->fIndex]; otherTree[predecessorLink->fIndex] = element; int index = link->fIndex; link->fIndex = predecessorLink->fIndex; predecessorLink->fIndex = index; predecessorLink->fMinTree = !predecessorLink->fMinTree; link->fMinTree = !link->fMinTree; _MoveUp(link); return true; } return false; } MIN_MAX_HEAP_TEMPLATE_LIST void MIN_MAX_HEAP_CLASS_NAME::_RemoveLast(bool minTree) { bool deleteMin = fMaxLastElement < fMinLastElement; Element** tree = deleteMin ? fMinElements : fMaxElements; int& lastElement = deleteMin ? fMinLastElement : fMaxLastElement; ASSERT(lastElement > 0); lastElement--; if (lastElement == 0 && deleteMin == minTree) return; Element* element = tree[lastElement]; if (minTree) fMinElements[0] = element; else fMaxElements[0] = element; MinMaxHeapLink<Element, Key>* link = sGetLink(element); link->fIndex = 0; link->fMinTree = minTree; _MoveDown(link); } MIN_MAX_HEAP_TEMPLATE_LIST Compare MIN_MAX_HEAP_CLASS_NAME::sCompare; MIN_MAX_HEAP_TEMPLATE_LIST GetLink MIN_MAX_HEAP_CLASS_NAME::sGetLink; #endif // KERNEL_UTIL_MIN_MAX_HEAP_H
21.559524
77
0.727683
cb1dd1bd2d303d8c00d924149d9ba614596f6bf2
7,027
h
C
ext/phalcon/datamapper/pdo/connection/pdointerface.zep.h
chipco/cphalcon
1f4c94f9f99c401137b003c28fcffc128d5de16d
[ "BSD-3-Clause" ]
1
2020-08-02T04:34:16.000Z
2020-08-02T04:34:16.000Z
ext/phalcon/datamapper/pdo/connection/pdointerface.zep.h
chipco/cphalcon
1f4c94f9f99c401137b003c28fcffc128d5de16d
[ "BSD-3-Clause" ]
null
null
null
ext/phalcon/datamapper/pdo/connection/pdointerface.zep.h
chipco/cphalcon
1f4c94f9f99c401137b003c28fcffc128d5de16d
[ "BSD-3-Clause" ]
1
2020-08-02T04:34:16.000Z
2020-08-02T04:34:16.000Z
extern zend_class_entry *phalcon_datamapper_pdo_connection_pdointerface_ce; ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Connection_PdoInterface); #if PHP_VERSION_ID >= 70200 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_begintransaction, 0, 0, _IS_BOOL, 0) #else ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_begintransaction, 0, 0, _IS_BOOL, NULL, 0) #endif ZEND_END_ARG_INFO() #if PHP_VERSION_ID >= 70200 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_commit, 0, 0, _IS_BOOL, 0) #else ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_commit, 0, 0, _IS_BOOL, NULL, 0) #endif ZEND_END_ARG_INFO() #if PHP_VERSION_ID >= 70200 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_errorcode, 0, 0, IS_STRING, 1) #else ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_errorcode, 0, 0, IS_STRING, NULL, 1) #endif ZEND_END_ARG_INFO() #if PHP_VERSION_ID >= 70200 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_errorinfo, 0, 0, IS_ARRAY, 0) #else ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_errorinfo, 0, 0, IS_ARRAY, NULL, 0) #endif ZEND_END_ARG_INFO() #if PHP_VERSION_ID >= 70200 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_exec, 0, 1, IS_LONG, 0) #else ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_exec, 0, 1, IS_LONG, NULL, 0) #endif #if PHP_VERSION_ID >= 70200 ZEND_ARG_TYPE_INFO(0, statement, IS_STRING, 0) #else ZEND_ARG_INFO(0, statement) #endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_getattribute, 0, 0, 1) #if PHP_VERSION_ID >= 70200 ZEND_ARG_TYPE_INFO(0, attribute, IS_LONG, 0) #else ZEND_ARG_INFO(0, attribute) #endif ZEND_END_ARG_INFO() #if PHP_VERSION_ID >= 70200 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_getavailabledrivers, 0, 0, IS_ARRAY, 0) #else ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_getavailabledrivers, 0, 0, IS_ARRAY, NULL, 0) #endif ZEND_END_ARG_INFO() #if PHP_VERSION_ID >= 70200 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_intransaction, 0, 0, _IS_BOOL, 0) #else ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_intransaction, 0, 0, _IS_BOOL, NULL, 0) #endif ZEND_END_ARG_INFO() #if PHP_VERSION_ID >= 70200 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_lastinsertid, 0, 0, IS_STRING, 0) #else ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_lastinsertid, 0, 0, IS_STRING, NULL, 0) #endif #if PHP_VERSION_ID >= 70200 ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 1) #else ZEND_ARG_INFO(0, name) #endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_prepare, 0, 0, 1) #if PHP_VERSION_ID >= 70200 ZEND_ARG_TYPE_INFO(0, statement, IS_STRING, 0) #else ZEND_ARG_INFO(0, statement) #endif ZEND_ARG_ARRAY_INFO(0, options, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_query, 0, 0, 1) #if PHP_VERSION_ID >= 70200 ZEND_ARG_TYPE_INFO(0, statement, IS_STRING, 0) #else ZEND_ARG_INFO(0, statement) #endif ZEND_END_ARG_INFO() #if PHP_VERSION_ID >= 70200 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_quote, 0, 1, IS_STRING, 0) #else ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_quote, 0, 1, IS_STRING, NULL, 0) #endif ZEND_ARG_INFO(0, value) #if PHP_VERSION_ID >= 70200 ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0) #else ZEND_ARG_INFO(0, type) #endif ZEND_END_ARG_INFO() #if PHP_VERSION_ID >= 70200 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_rollback, 0, 0, _IS_BOOL, 0) #else ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_rollback, 0, 0, _IS_BOOL, NULL, 0) #endif ZEND_END_ARG_INFO() #if PHP_VERSION_ID >= 70200 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_setattribute, 0, 2, _IS_BOOL, 0) #else ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_pdointerface_setattribute, 0, 2, _IS_BOOL, NULL, 0) #endif #if PHP_VERSION_ID >= 70200 ZEND_ARG_TYPE_INFO(0, attribute, IS_LONG, 0) #else ZEND_ARG_INFO(0, attribute) #endif ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(phalcon_datamapper_pdo_connection_pdointerface_method_entry) { PHP_ABSTRACT_ME(Phalcon_DataMapper_Pdo_Connection_PdoInterface, beginTransaction, arginfo_phalcon_datamapper_pdo_connection_pdointerface_begintransaction) PHP_ABSTRACT_ME(Phalcon_DataMapper_Pdo_Connection_PdoInterface, commit, arginfo_phalcon_datamapper_pdo_connection_pdointerface_commit) PHP_ABSTRACT_ME(Phalcon_DataMapper_Pdo_Connection_PdoInterface, errorCode, arginfo_phalcon_datamapper_pdo_connection_pdointerface_errorcode) PHP_ABSTRACT_ME(Phalcon_DataMapper_Pdo_Connection_PdoInterface, errorInfo, arginfo_phalcon_datamapper_pdo_connection_pdointerface_errorinfo) PHP_ABSTRACT_ME(Phalcon_DataMapper_Pdo_Connection_PdoInterface, exec, arginfo_phalcon_datamapper_pdo_connection_pdointerface_exec) PHP_ABSTRACT_ME(Phalcon_DataMapper_Pdo_Connection_PdoInterface, getAttribute, arginfo_phalcon_datamapper_pdo_connection_pdointerface_getattribute) ZEND_FENTRY(getAvailableDrivers, NULL, arginfo_phalcon_datamapper_pdo_connection_pdointerface_getavailabledrivers, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) PHP_ABSTRACT_ME(Phalcon_DataMapper_Pdo_Connection_PdoInterface, inTransaction, arginfo_phalcon_datamapper_pdo_connection_pdointerface_intransaction) PHP_ABSTRACT_ME(Phalcon_DataMapper_Pdo_Connection_PdoInterface, lastInsertId, arginfo_phalcon_datamapper_pdo_connection_pdointerface_lastinsertid) PHP_ABSTRACT_ME(Phalcon_DataMapper_Pdo_Connection_PdoInterface, prepare, arginfo_phalcon_datamapper_pdo_connection_pdointerface_prepare) PHP_ABSTRACT_ME(Phalcon_DataMapper_Pdo_Connection_PdoInterface, query, arginfo_phalcon_datamapper_pdo_connection_pdointerface_query) PHP_ABSTRACT_ME(Phalcon_DataMapper_Pdo_Connection_PdoInterface, quote, arginfo_phalcon_datamapper_pdo_connection_pdointerface_quote) PHP_ABSTRACT_ME(Phalcon_DataMapper_Pdo_Connection_PdoInterface, rollBack, arginfo_phalcon_datamapper_pdo_connection_pdointerface_rollback) PHP_ABSTRACT_ME(Phalcon_DataMapper_Pdo_Connection_PdoInterface, setAttribute, arginfo_phalcon_datamapper_pdo_connection_pdointerface_setattribute) PHP_FE_END };
47.802721
166
0.884019
defc19c31726c6989c32ef1cbc5381fc189b36f0
8,114
rs
Rust
aws/sdk/integration-tests/lambda/tests/naughty-strings-client-context.rs
LMJW/smithy-rs
841f51113fb14e2922793951ce16bda3e16cb51f
[ "Apache-2.0" ]
null
null
null
aws/sdk/integration-tests/lambda/tests/naughty-strings-client-context.rs
LMJW/smithy-rs
841f51113fb14e2922793951ce16bda3e16cb51f
[ "Apache-2.0" ]
null
null
null
aws/sdk/integration-tests/lambda/tests/naughty-strings-client-context.rs
LMJW/smithy-rs
841f51113fb14e2922793951ce16bda3e16cb51f
[ "Apache-2.0" ]
null
null
null
#![allow(dead_code)] /* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ // use http::HeaderValue; const NAUGHTY_STRINGS: &str = include_str!("blns/blns.txt"); /// A list of lines to skipped when iterating over the blns. These lines should all fail when /// entered into the AWS CLI too. In the below test, every one of these lines will produce an /// `InvalidSignatureException` error with the message: /// > The request signature we calculated does not match the signature you provided. Check your AWS /// > Secret Access Key and signing method. Consult the service documentation for details. const SKIPPED_LINES: &[usize] = &[ 124, // '€‚ƒ„†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ' 139, // '𝅳𝅴𝅵𝅶𝅷𝅸𝅹𝅺󠀁󠀠󠀡󠀢󠀣󠀤󠀥󠀦󠀧󠀨󠀩󠀪󠀫󠀬󠀭󠀮󠀯󠀰󠀱󠀲󠀳󠀴󠀵󠀶󠀷󠀸󠀹󠀺󠀻󠀼󠀽󠀾󠀿󠁀󠁁󠁂󠁃󠁄󠁅󠁆󠁇󠁈󠁉󠁊󠁋󠁌󠁍󠁎󠁏󠁐󠁑󠁒󠁓󠁔󠁕󠁖󠁗󠁘󠁙󠁚󠁛󠁜󠁝󠁞󠁟󠁠󠁡󠁢󠁣󠁤󠁥󠁦󠁧󠁨󠁩󠁪󠁫󠁬󠁭󠁮󠁯󠁰󠁱󠁲󠁳󠁴󠁵󠁶󠁷󠁸󠁹󠁺󠁻󠁼󠁽󠁾­؀؁؂؃؄؅؜۝܏᠎​‌‍‎‏‪‫‬‭‮⁠⁡⁢⁣⁤⁦⁧⁨⁩𑂽𛲠𛲡𛲢𛲣𝅳𝅴𝅵𝅶𝅷𝅸𝅹𝅺󠀁󠀠󠀡󠀢󠀣󠀤󠀥󠀦󠀧󠀨󠀩󠀪󠀫󠀬󠀭󠀮󠀯󠀰󠀱󠀲󠀳󠀴󠀵󠀶󠀷󠀸󠀹󠀺󠀻󠀼󠀽󠀾󠀿󠁀󠁁󠁂󠁃󠁄󠁅󠁆󠁇󠁈󠁉󠁊󠁋󠁌󠁍󠁎󠁏󠁐󠁑󠁒󠁓󠁔󠁕󠁖󠁗󠁘󠁙󠁚󠁛󠁜󠁝󠁞󠁟󠁠󠁡󠁢󠁣󠁤󠁥󠁦󠁧󠁨󠁩󠁪󠁫󠁬󠁭󠁮󠁯󠁰󠁱󠁲󠁳󠁴󠁵󠁶󠁷󠁸󠁹󠁺󠁻󠁼󠁽󠁾󠁿' 143, // '' 144, // '￾' 150, // 'Ω≈ç√∫˜µ≤≥÷' 151, // 'åß∂ƒ©˙∆˚¬…æ' 152, // 'œ∑´®†¥¨ˆøπ“‘' 153, // '¡™£¢∞§¶•ªº–≠' 154, // '¸˛Ç◊ı˜Â¯˘¿' 155, // 'ÅÍÎÏ˝ÓÔÒÚÆ☃' 156, // 'Œ„´‰ˇÁ¨ˆØ∏”’' 157, // '`⁄€‹›fifl‡°·‚—±' 158, // '⅛⅜⅝⅞' 159, // 'ЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя' 160, // '٠١٢٣٤٥٦٧٨٩' 166, // '⁰⁴⁵' 167, // '₀₁₂' 168, // '⁰⁴⁵₀₁₂' 169, // 'ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็ ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็ ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็' 182, // '<foo val=“bar” />' 183, // '<foo val=“bar” />' 184, // '<foo val=”bar“ />' 191, // '田中さんにあげて下さい' 192, // 'パーティーへ行かないか' 193, // '和製漢語' 194, // '部落格' 195, // '사회과학원 어학연구소' 196, // '찦차를 타고 온 펲시맨과 쑛다리 똠방각하' 197, // '社會科學院語學研究所' 198, // '울란바토르' 199, // '𠜎𠜱𠝹𠱓𠱸𠲖𠳏' 203, // '𐐜 𐐔𐐇𐐝𐐀𐐡𐐇𐐓 𐐙𐐊𐐡𐐝𐐓/𐐝𐐇𐐗𐐊𐐤𐐔 𐐒𐐋𐐗 𐐒𐐌 𐐜 𐐡𐐀𐐖𐐇𐐤𐐓𐐝 𐐱𐑂 𐑄 𐐔𐐇𐐝𐐀𐐡𐐇𐐓 𐐏𐐆𐐅𐐤𐐆𐐚𐐊𐐡𐐝𐐆𐐓𐐆' 227, // '表ポあA鷗ŒéB逍Üߪąñ丂㐀𠀀' 234, // 'Ⱥ' 235, // 'Ⱦ' 241, // 'ヽ༼ຈل͜ຈ༽ノ ヽ༼ຈل͜ຈ༽ノ' 242, // '(。◕ ∀ ◕。)' 243, // '`ィ(´∀`∩' 244, // '__ロ(,_,*)' 245, // '・( ̄∀ ̄)・:*:' 246, // '゚・✿ヾ╲(。◕‿◕。)╱✿・゚' 247, // ',。・:*:・゜’( ☻ ω ☻ )。・:*:・゜’' 248, // '(╯°□°)╯︵ ┻━┻)' 249, // '(ノಥ益ಥ)ノ ┻━┻' 250, // '┬─┬ノ( º _ ºノ)' 251, // '( ͡° ͜ʖ ͡°)' 252, // '¯\_(ツ)_/¯' 258, // '😍' 259, // '👩🏽' 260, // '👨‍🦰 👨🏿‍🦰 👨‍🦱 👨🏿‍🦱 🦹🏿‍♂️' 261, // '👾 🙇 💁 🙅 🙆 🙋 🙎 🙍' 262, // '🐵 🙈 🙉 🙊' 263, // '❤️ 💔 💌 💕 💞 💓 💗 💖 💘 💝 💟 💜 💛 💚 💙' 264, // '✋🏿 💪🏿 👐🏿 🙌🏿 👏🏿 🙏🏿' 265, // '👨‍👩‍👦 👨‍👩‍👧‍👦 👨‍👨‍👦 👩‍👩‍👧 👨‍👦 👨‍👧‍👦 👩‍👦 👩‍👧‍👦' 266, // '🚾 🆒 🆓 🆕 🆖 🆗 🆙 🏧' 267, // '0️⃣ 1️⃣ 2️⃣ 3️⃣ 4️⃣ 5️⃣ 6️⃣ 7️⃣ 8️⃣ 9️⃣ 🔟' 274, // '🇺🇸🇷🇺🇸 🇦🇫🇦🇲🇸' 275, // '🇺🇸🇷🇺🇸🇦🇫🇦🇲' 276, // '🇺🇸🇷🇺🇸🇦' 282, // '123' 283, // '١٢٣' 289, // 'ثم نفس سقطت وبالتحديد،, جزيرتي باستخدام أن دنو. إذ هنا؟ الستار وتنصيب كان. أهّل ايطاليا، بريطانيا-فرنسا قد أخذ. سليمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو.' 290, // 'בְּרֵאשִׁית, בָּרָא אֱלֹהִים, אֵת הַשָּׁמַיִם, וְאֵת הָאָרֶץ' 291, // 'הָיְתָהtestالصفحات التّحول' 292, // '﷽' 293, // 'ﷺ' 294, // 'مُنَاقَشَةُ سُبُلِ اِسْتِخْدَامِ اللُّغَةِ فِي النُّظُمِ الْقَائِمَةِ وَفِيم يَخُصَّ التَّطْبِيقَاتُ الْحاسُوبِيَّةُ،' 295, // 'الكل في المجمو عة (5)' 301, // '᚛ᚄᚓᚐᚋᚒᚄ ᚑᚄᚂᚑᚏᚅ᚜' 302, // '᚛                 ᚜' 308, // '‪‪test‪' 309, // '‫test‫' 310, // I couldn't paste this one because my IDE parsed it as a syntax error 311, // 'test⁠test‫' 312, // '⁦test⁧' 318, // 'Ṱ̺̺̕o͞ ̷i̲̬͇̪͙n̝̗͕v̟̜̘̦͟o̶̙̰̠kè͚̮̺̪̹̱̤ ̖t̝͕̳̣̻̪͞h̼͓̲̦̳̘̲e͇̣̰̦̬͎ ̢̼̻̱̘h͚͎͙̜̣̲ͅi̦̲̣̰̤v̻͍e̺̭̳̪̰-m̢iͅn̖̺̞̲̯̰d̵̼̟͙̩̼̘̳ ̞̥̱̳̭r̛̗̘e͙p͠r̼̞̻̭̗e̺̠̣͟s̘͇̳͍̝͉e͉̥̯̞̲͚̬͜ǹ̬͎͎̟̖͇̤t͍̬̤͓̼̭͘ͅi̪̱n͠g̴͉ ͏͉ͅc̬̟h͡a̫̻̯͘o̫̟̖͍̙̝͉s̗̦̲.̨̹͈̣' 319, // '̡͓̞ͅI̗̘̦͝n͇͇͙v̮̫ok̲̫̙͈i̖͙̭̹̠̞n̡̻̮̣̺g̲͈͙̭͙̬͎ ̰t͔̦h̞̲e̢̤ ͍̬̲͖f̴̘͕̣è͖ẹ̥̩l͖͔͚i͓͚̦͠n͖͍̗͓̳̮g͍ ̨o͚̪͡f̘̣̬ ̖̘͖̟͙̮c҉͔̫͖͓͇͖ͅh̵̤̣͚͔á̗̼͕ͅo̼̣̥s̱͈̺̖̦̻͢.̛̖̞̠̫̰' 320, // '̗̺͖̹̯͓Ṯ̤͍̥͇͈h̲́e͏͓̼̗̙̼̣͔ ͇̜̱̠͓͍ͅN͕͠e̗̱z̘̝̜̺͙p̤̺̹͍̯͚e̠̻̠͜r̨̤͍̺̖͔̖̖d̠̟̭̬̝͟i̦͖̩͓͔̤a̠̗̬͉̙n͚͜ ̻̞̰͚ͅh̵͉i̳̞v̢͇ḙ͎͟-҉̭̩̼͔m̤̭̫i͕͇̝̦n̗͙ḍ̟ ̯̲͕͞ǫ̟̯̰̲͙̻̝f ̪̰̰̗̖̭̘͘c̦͍̲̞͍̩̙ḥ͚a̮͎̟̙͜ơ̩̹͎s̤.̝̝ ҉Z̡̖̜͖̰̣͉̜a͖̰͙̬͡l̲̫̳͍̩g̡̟̼̱͚̞̬ͅo̗͜.̟' 321, // '̦H̬̤̗̤͝e͜ ̜̥̝̻͍̟́w̕h̖̯͓o̝͙̖͎̱̮ ҉̺̙̞̟͈W̷̼̭a̺̪͍į͈͕̭͙̯̜t̶̼̮s̘͙͖̕ ̠̫̠B̻͍͙͉̳ͅe̵h̵̬͇̫͙i̹͓̳̳̮͎̫̕n͟d̴̪̜̖ ̰͉̩͇͙̲͞ͅT͖̼͓̪͢h͏͓̮̻e̬̝̟ͅ ̤̹̝W͙̞̝͔͇͝ͅa͏͓͔̹̼̣l̴͔̰̤̟͔ḽ̫.͕' 322, // 'Z̮̞̠͙͔ͅḀ̗̞͈̻̗Ḷ͙͎̯̹̞͓G̻O̭̗̮' 328, // '˙ɐnbᴉlɐ ɐuƃɐɯ ǝɹolop ʇǝ ǝɹoqɐl ʇn ʇunpᴉpᴉɔuᴉ ɹodɯǝʇ poɯsnᴉǝ op pǝs 'ʇᴉlǝ ƃuᴉɔsᴉdᴉpɐ ɹnʇǝʇɔǝsuoɔ 'ʇǝɯɐ ʇᴉs ɹolop ɯnsdᴉ ɯǝɹo˥' 329, // '00˙Ɩ$-' 335, // 'The quick brown fox jumps over the lazy dog' 336, // '𝐓𝐡𝐞 𝐪𝐮𝐢𝐜𝐤 𝐛𝐫𝐨𝐰𝐧 𝐟𝐨𝐱 𝐣𝐮𝐦𝐩𝐬 𝐨𝐯𝐞𝐫 𝐭𝐡𝐞 𝐥𝐚𝐳𝐲 𝐝𝐨𝐠' 337, // '𝕿𝖍𝖊 𝖖𝖚𝖎𝖈𝖐 𝖇𝖗𝖔𝖜𝖓 𝖋𝖔𝖝 𝖏𝖚𝖒𝖕𝖘 𝖔𝖛𝖊𝖗 𝖙𝖍𝖊 𝖑𝖆𝖟𝖞 𝖉𝖔𝖌' 338, // '𝑻𝒉𝒆 𝒒𝒖𝒊𝒄𝒌 𝒃𝒓𝒐𝒘𝒏 𝒇𝒐𝒙 𝒋𝒖𝒎𝒑𝒔 𝒐𝒗𝒆𝒓 𝒕𝒉𝒆 𝒍𝒂𝒛𝒚 𝒅𝒐𝒈' 339, // '𝓣𝓱𝓮 𝓺𝓾𝓲𝓬𝓴 𝓫𝓻𝓸𝔀𝓷 𝓯𝓸𝔁 𝓳𝓾𝓶𝓹𝓼 𝓸𝓿𝓮𝓻 𝓽𝓱𝓮 𝓵𝓪𝔃𝔂 𝓭𝓸𝓰' 340, // '𝕋𝕙𝕖 𝕢𝕦𝕚𝕔𝕜 𝕓𝕣𝕠𝕨𝕟 𝕗𝕠𝕩 𝕛𝕦𝕞𝕡𝕤 𝕠𝕧𝕖𝕣 𝕥𝕙𝕖 𝕝𝕒𝕫𝕪 𝕕𝕠𝕘' 341, // '𝚃𝚑𝚎 𝚚𝚞𝚒𝚌𝚔 𝚋𝚛𝚘𝚠𝚗 𝚏𝚘𝚡 𝚓𝚞𝚖𝚙𝚜 𝚘𝚟𝚎𝚛 𝚝𝚑𝚎 𝚕𝚊𝚣𝚢 𝚍𝚘𝚐' 342, // '⒯⒣⒠ ⒬⒰⒤⒞⒦ ⒝⒭⒪⒲⒩ ⒡⒪⒳ ⒥⒰⒨⒫⒮ ⒪⒱⒠⒭ ⒯⒣⒠ ⒧⒜⒵⒴ ⒟⒪⒢' 357, // ' onfocus=JaVaSCript:alert(9) autofocus' 360, // '<script>alert(12)</script>' 564, // '<IMG SRC="jav   ascript:alert('214');">' 569, // '<IMG SRC=" &#14;  javascript:alert('219');">' 729, // 'Powerلُلُصّبُلُلصّبُررً ॣ ॣh ॣ ॣ冗' 730, // '🏳0🌈️' 731, // 'జ్ఞ‌ా' 737, // 'گچپژ' ]; // #[tokio::test] // async fn test_client_context_field_against_naughty_strings_list() { // tracing_subscriber::fmt::init(); // // // re-add `aws-config = { path = "../../build/aws-sdk/aws-config" }` to this project's Cargo.toml // let config = aws_config::load_from_env().await; // let client = aws_sdk_lambda::Client::new(&config); // let invalid_request_content_exception = "InvalidRequestContentException: Client context must be a valid Base64-encoded JSON object."; // let unrecognized_client_exception = // "UnrecognizedClientException: The security token included in the request is invalid."; // // let mut encountered_errors = false; // // for (idx, line) in NAUGHTY_STRINGS.split('\n').enumerate() { // // Some lines in blns aren't even accepted by the AWS CLI so it's reasonable to skip them // if SKIPPED_LINES.contains(&(idx + 1)) { // continue; // } // // // add lines to metadata unless they're a comment or empty // // Some naughty strings aren't valid HeaderValues so we skip those too // if !line.starts_with("#") && !line.is_empty() && HeaderValue::from_str(line).is_ok() { // let err = client // .invoke() // .function_name("testFunctionThatDoesNothing") // .client_context(line) // .send() // .await // .unwrap_err(); // // match err.to_string() { // // If this happens, it means that someone tried to run the test without valid creds // err if err == unrecognized_client_exception => { // panic!("Set valid credentials before running this test."); // } // // This is the expected error so we ignore it and continue // err if err == invalid_request_content_exception => continue, // // Other errors are bad and so we bring attention to them // err => { // encountered_errors = true; // // 1 is added to idx because line numbers start at one // eprintln!( // "line {} '{}' caused unexpected error: {}", // idx + 1, // line, // err // ); // } // } // } // } // // if encountered_errors { // panic!( // "one or more errors were encountered while testing lambda invoke with naughty strings" // ); // } // }
46.102273
283
0.433202
d009e0f5fe6d120c3e18a7b75328c5facebf3d73
294
rb
Ruby
starfiles/testcallback.rb
harunlakodla/Flutter_Python-flutter_python
9dfa020fd73bff3bcf965476060ca441349ba96b
[ "Apache-2.0" ]
10
2020-02-02T21:47:34.000Z
2022-02-05T23:55:15.000Z
starfiles/testcallback.rb
harunlakodla/Flutter_Python-flutter_python
9dfa020fd73bff3bcf965476060ca441349ba96b
[ "Apache-2.0" ]
1
2021-11-02T10:43:48.000Z
2021-11-02T10:43:48.000Z
starfiles/testcallback.rb
harunlakodla/Flutter_Python-flutter_python
9dfa020fd73bff3bcf965476060ca441349ba96b
[ "Apache-2.0" ]
null
null
null
def tt(a,b) puts(a,b) paraPkg = $CallBackObj.PrintHello("---------------",{'Name'=>'Zara', 'Age'=>7, 'Class'=>true},1234) puts(paraPkg) puts(paraPkg._Get(0)) puts(paraPkg._Get(1)) puts(paraPkg._Get(1)._ToTuple()) puts(paraPkg._Get(2)) return a,b end $g1 = 123
24.5
103
0.561224
2f4815f4b46159628d67af9b73d7263437c524ad
402
php
PHP
resources/views/albums/create.blade.php
hrarnob07/PhotoGallery-laravel5.5
3b1d8dea592a80be44864c4284e519f352faca99
[ "MIT" ]
null
null
null
resources/views/albums/create.blade.php
hrarnob07/PhotoGallery-laravel5.5
3b1d8dea592a80be44864c4284e519f352faca99
[ "MIT" ]
null
null
null
resources/views/albums/create.blade.php
hrarnob07/PhotoGallery-laravel5.5
3b1d8dea592a80be44864c4284e519f352faca99
[ "MIT" ]
null
null
null
@extends('layouts.app') @section('content') <h2>Create Form</h2> {!! Form::open(['action' => 'AlbumsController@store','method'=>'POST','enctype'=>'multipart/form-data']) !!} {{Form::text('name', '',['placeholder'=>'album name'])}} {{Form::textarea('description', '',['placeholder'=>'album description'])}} {{Form::file('cover_img')}} {{Form::submit('submit')}} {!! Form::close() !!} @endsection
30.923077
109
0.616915
966de020efa69ac48595f7ce19ca216c1b22e7ca
7,008
php
PHP
application/views/operasional/subrogasi.php
XanaduNET/SPenjaminan
2ced374f60d6714d4dab0a94a5428a7eb4d9a4d3
[ "MIT" ]
null
null
null
application/views/operasional/subrogasi.php
XanaduNET/SPenjaminan
2ced374f60d6714d4dab0a94a5428a7eb4d9a4d3
[ "MIT" ]
null
null
null
application/views/operasional/subrogasi.php
XanaduNET/SPenjaminan
2ced374f60d6714d4dab0a94a5428a7eb4d9a4d3
[ "MIT" ]
null
null
null
<div class="mobile-menu-overlay"></div> <div class="container-fluid"> <div class="main-container"> <h1 class="h3 mb-4 text-gray-800"><?=$title;?></h1> <div> <!-- <div><?=validation_errors()?></div> <?=form_open('Nasabah/input', ['class' => 'form-horizontal'])?> <form role="form" class="form-horizontal"> --> <div class="card-body"> <div class="form-group"> <input type="date" name="DJPnoreg" class="form-control" value="<?=date('Y-m-d')?>" readonly> </div> <input style="width: 100%;" type="hidden" name="DJPid" class="form-control" value="<?php echo $this->uri->segment(2) ?> " readonly> <div class="container-fluid"> <div class="card-body"> <div class="table-responsive"> <div class="col-lg"> <div class="card"> <h5 class="card-header">DATA SUBROGASI</h5> <br> <br> <form action="<?php echo site_url('data_klaim/index'); ?>" method="post"> <div class="col-lg "> <label class="col-sm-1 col-form-label">Tanggal Masuk</label> <input type="date" class="" name="keyword" placeholder=""> <input type="submit" value="Cari" /> </div> </form> <br> <div class="col-lg"> <label class="col-sm-1"></label> <?php if (empty($flag)) { ?> <td> <a href="<?=base_url('data_klaim/cetak');?>" class="btn btn-primary">EXPORT</a></td> <?php } else {}?> </div> <br> <div class="card-body"> <div class="table-responsive"> <table class="table table-bordered" id="dataTable" width="150%" cellspacing="0"> <thead> <tr> <th class="header">No.</th> <th class="header">Tgl Bayar Klaim</th> <th class="header">Cabang/Capem/Kedai</th> <th class="header">Produk</th> <th class="header">Terjamin</th> <th class="header">Plafond</th> <th class="header">Nilai Jaminan</th> <th class="header">Coverage</th> <th class="header"> Nominal Klaim</th> <th class="header">Status</th> </tr> </thead> <tbody> <?php $no = 1; foreach ($table as $u) { ?> <tr> <td><?php echo $no ?></td> <td><?php echo $u->sub_tglbayarklaim ?></td> <td><?php echo $u->subPPnama ?></td> <td><?php echo $u->subproduk ?></td> <td><?php echo $u->subnmterjamin ?></td> <td><?php echo $u->subplafond ?></td> <td><?php echo $u->subnilai_jaminan ?></td> <td><?php echo $u->subcoverage ?></td> <td><?php echo $u->subnominal_klaim ?></td> <td><?php echo $u->sub_status ?></td> <!-- <td> <?php if ($u->status == 0) { echo "Pending"; } else { echo "Sudah Cetak"; } ?> </td> --> <?php if (!empty($flag)) { ?> <td> <a href="<?=base_url('data_klaim/cetak/' . $u->tglmasuk);?>" class="btn btn-primary">EXPORT</a></td> <?php } else {}?> </tr> <?php $no++; }?> </tbody> </table> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> <!-- </form> --> <!-- BATAS KONTEN --> <!-- Bootstrap core JavaScript--> <script type=""> function sum() { var x = document.getElementById('num1').value; /// x = parseFloat(x); var result = new Date(new Date().getTime('num2')+(x*24*60*60*1000)); /* var y = document.getElementById('num2').value; y = parseFloat(y); */ document.getElementById('result').value = result; } </script> <script> function myFunction() { var x = document.getElementById("myText").value; document.getElementById("demo").innerHTML = x; } </script> <script type="text/javascript"> function HitungPersen() { plafond = document.getElementById("getplafond").value; coverage = document.getElementById("getcoverage").value; plafond2 = parseInt(plafond); coverage2 = parseInt(coverage); nilaipnjm = (coverage2 / 100) * plafond2; document.getElementById("nlipnjm").value = nilaipnjm; } </script> </div> </div> </div> </div>
41.467456
116
0.315782
06ae285cede0ae3a914a86e163592f354d252a3a
738
asm
Assembly
oeis/175/A175322.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/175/A175322.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/175/A175322.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A175322: a(n) = A053141(n)*A001109(n+1) = Sum_{k=A053141(n)+1..A001109(n+1)-1} k. ; Submitted by Jamie Morken(s1) ; 12,490,17136,584988,19889100,675741430,22955884992,779827644120,26491203224556,899921193951778,30570830043692400,1038508304094967860,35278711531352926572,1198437683891107427950,40711602541519349266176,1382996048732155862584368,46981154054377361498733900,1595976241800247235120195290,54216211067154897651222736752,1841755200041471337918236011980,62565460590342900112620865785996,2125383904871617304552491802246758,72200487305044646457518851955697600,2452691184466646368096107683360499720 add $0,2 mov $3,1 lpb $0 sub $0,$3 add $4,$2 mov $1,$4 add $2,$4 add $2,1 add $2,$4 add $4,$2 lpe mul $2,$1 mov $0,$2
41
488
0.813008
b1972f968a7ac83725a31a13a70cf99f8832b989
2,625
c
C
hcash.c
SpiritedAwayLab/node-multi-hashing-lux
0028e397759ccdb061f860b607148c055879c7ad
[ "MIT" ]
null
null
null
hcash.c
SpiritedAwayLab/node-multi-hashing-lux
0028e397759ccdb061f860b607148c055879c7ad
[ "MIT" ]
null
null
null
hcash.c
SpiritedAwayLab/node-multi-hashing-lux
0028e397759ccdb061f860b607148c055879c7ad
[ "MIT" ]
null
null
null
#include "hcash.h" void hcash_hash(const char* input, char* output) { sph_blake512_context ctx_blake; sph_bmw512_context ctx_bmw; sph_groestl512_context ctx_groestl; sph_jh512_context ctx_jh; sph_keccak512_context ctx_keccak; sph_skein512_context ctx_skein; sph_luffa512_context ctx_luffa; sph_cubehash512_context ctx_cubehash; sph_shavite512_context ctx_shavite; sph_simd512_context ctx_simd; sph_echo512_context ctx_echo; sm3_ctx_t ctx_sm3; sph_hamsi512_context ctx_hamsi; sph_fugue512_context ctx_fugue; uint32_t hash[32]; memset(hash, 0, sizeof hash); sph_blake512_init(&ctx_blake); sph_blake512(&ctx_blake, input, 80); sph_blake512_close(&ctx_blake, (void*) hash); sph_bmw512_init(&ctx_bmw); sph_bmw512(&ctx_bmw, (const void*) hash, 64); sph_bmw512_close(&ctx_bmw, (void*) hash); sph_groestl512_init(&ctx_groestl); sph_groestl512(&ctx_groestl, (const void*) hash, 64); sph_groestl512_close(&ctx_groestl, (void*) hash); sph_skein512_init(&ctx_skein); sph_skein512(&ctx_skein, (const void*) hash, 64); sph_skein512_close(&ctx_skein, (void*) hash); sph_jh512_init(&ctx_jh); sph_jh512(&ctx_jh, (const void*) hash, 64); sph_jh512_close(&ctx_jh, (void*) hash); sph_keccak512_init(&ctx_keccak); sph_keccak512(&ctx_keccak, (const void*) hash, 64); sph_keccak512_close(&ctx_keccak, (void*) hash); sph_luffa512_init(&ctx_luffa); sph_luffa512(&ctx_luffa, (const void*) hash, 64); sph_luffa512_close (&ctx_luffa, (void*) hash); sph_cubehash512_init(&ctx_cubehash); sph_cubehash512(&ctx_cubehash, (const void*) hash, 64); sph_cubehash512_close(&ctx_cubehash, (void*) hash); sph_shavite512_init(&ctx_shavite); sph_shavite512(&ctx_shavite, (const void*) hash, 64); sph_shavite512_close(&ctx_shavite, (void*) hash); sph_simd512_init(&ctx_simd); sph_simd512(&ctx_simd, (const void*) hash, 64); sph_simd512_close(&ctx_simd, (void*) hash); sph_echo512_init(&ctx_echo); sph_echo512(&ctx_echo, (const void*) hash, 64); sph_echo512_close(&ctx_echo, (void*) hash); sm3_init(&ctx_sm3); sm3_update(&ctx_sm3, (const unsigned char*) hash, 64); memset(hash, 0, sizeof hash); sm3_close(&ctx_sm3, (void*) hash); sph_hamsi512_init(&ctx_hamsi); sph_hamsi512(&ctx_hamsi, (const void*) hash, 64); sph_hamsi512_close(&ctx_hamsi, (void*) hash); sph_fugue512_init(&ctx_fugue); sph_fugue512(&ctx_fugue, (const void*) hash, 64); sph_fugue512_close(&ctx_fugue, (void*) hash); memcpy(output, hash, 32); }
32.407407
59
0.70781
daa63810ebe3ff50f3c55c43674a003ea0ecf968
344
swift
Swift
SwiftOTP/Application/Constants.swift
brunophilipe/SwiftOTP
ce2c19ce835acbc18e4544f6024a847e0b0022f6
[ "Apache-2.0" ]
6
2018-10-29T18:34:14.000Z
2021-06-14T09:30:02.000Z
SwiftOTP/Application/Constants.swift
brunophilipe/SwiftOTP
ce2c19ce835acbc18e4544f6024a847e0b0022f6
[ "Apache-2.0" ]
null
null
null
SwiftOTP/Application/Constants.swift
brunophilipe/SwiftOTP
ce2c19ce835acbc18e4544f6024a847e0b0022f6
[ "Apache-2.0" ]
1
2019-10-30T08:46:03.000Z
2019-10-30T08:46:03.000Z
// // Constants.swift // SwiftOTP // // Created by Bruno Philipe on 9/7/18. // Copyright © 2018 Bruno Philipe. All rights reserved. // import Foundation struct Constants { static let tokenStoreUUID = UUID(uuidString: "362AC457-297F-4F6C-8B13-34F6721E9D41")! static let keychainGroupIdentifier = "R85D3K8ATT.com.brunophilipe.SwiftOTP" }
21.5
86
0.744186
ddf4c5e584b013355f49f6671a07671377687302
6,660
php
PHP
app/Http/Controllers/Api/QuestionController.php
saif22nemr/doctor_appointment
7136714b9778cae821488893ad281657663f636a
[ "MIT" ]
null
null
null
app/Http/Controllers/Api/QuestionController.php
saif22nemr/doctor_appointment
7136714b9778cae821488893ad281657663f636a
[ "MIT" ]
null
null
null
app/Http/Controllers/Api/QuestionController.php
saif22nemr/doctor_appointment
7136714b9778cae821488893ad281657663f636a
[ "MIT" ]
null
null
null
<?php namespace App\Http\Controllers\Api; use App\Http\Controllers\Controller; use App\Models\Activity; use App\Models\Choose; use App\Models\Question; use Illuminate\Http\Request; class QuestionController extends ApiController { /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(Request $request) { $request->validate([ 'question' => 'min:1', ]); if($request->has('question')){ $questions = Question::where('question' , 'LIKE' ,'%'.$request->question.'%'); } else{ $questions = Question::where('id' , '!=' , 0); } $questions = $questions->orderBy('created_at' , 'asc')->with('chooses')->get(); return $this->showAll($questions); } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $request->validate([ 'question' => 'required|min:1|max:1000', 'reason' => 'min:1,0', 'is_many' => 'min:1,0', 'answer_type' => 'required|in:checkbox,selectbox,text,textarea', ]); $type = ['checkbox' => 2, 'text' => 1 , 'selectbox' => 3 , 'textarea' => 4]; // validate data; if($request->answer_type == 'checkbox' or $request->answer_type == 'selectbox'){ $request->validate([ 'chooses' => 'required|array|min:2' ]); $reason = $request->has('reason') ? $request->reason : 0; $isMany = $request->has('is_many') ? $request->is_many : 0; if(!$request->has('chooses')){ foreach($request->chooses as $choose){ if(mb_strlen($choose , 'utf8') < 2){ return $this->errorResponse(trans('application.error_choose')); } } } }else{ $reason = 0; $isMany = 0; } // store $data = $request->only([ 'question' ]); $data['answer_type'] = $type[$request->answer_type]; $data['reason'] = $reason ; $data['is_many'] = $isMany; $question = Question::create($data); if($request->answer_type == 'checkbox' or $request->answer_type == 'selectbox'){ foreach($request->chooses as $value){ Choose::create([ 'question_id' =>$question->id, 'choose' => $value ]); } } $activity = new Activity([ 'type' => 'create', 'description' => trans('activity.create_question'), 'user_id' => $this->user->id, 'related_id' => $question->id ]); $question->chooses ; $question->activities()->save($activity); return $this->successResponse([ 'success' => true, 'message' => trans('app.create_successfully'), 'data' => $question ]); } /** * Display the specified resource. * * @param \App\Models\Question $question * @return \Illuminate\Http\Response */ public function show(Question $question) { $question->chooses; return $this->showOne($question); } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param \App\Models\Question $question * @return \Illuminate\Http\Response */ public function update(Request $request, Question $question) { $request->validate([ 'question' => 'min:1|max:1000', 'reason' => 'min:1,0', 'is_many' => 'min:1,0', 'chooses' => 'array|min:2' ]); if($request->has('question')){ $question->question = $request->question; } $type = ['checkbox' => 2, 'text' => 1 , 'selectbox' => 3 , 'textarea' => 4]; // validate data; if($request->answer_type == 'checkbox' or $request->answer_type == 'selectbox'){ if($request->has('reason')) $question->reason = $request->reason; if($request->has('is_many')) $question->is_many = $request->is_many; if($request->has('chooses')){ foreach($request->chooses as $choose){ if(mb_strlen($choose , 'utf8') < 2){ return $this->errorResponse(trans('application.error_choose')); } } }else{ return $this->errorResponse(trans('application.error_choose')); } } // store $question->save(); if($request->has('chooses')){ $question->chooses()->delete(); if($request->answer_type == 'checkbox' or $request->answer_type == 'selectbox'){ foreach($request->chooses as $value){ Choose::create([ 'question_id' =>$question->id, 'choose' => $value ]); } } } $activity = new Activity([ 'type' => 'edit', 'description' => trans('activity.edit_question'), 'user_id' => $this->user->id, 'related_id' => $question->id ]); $question->chooses ; $question->activities()->save($activity); return $this->successResponse([ 'success' => true, 'message' => trans('app.edit_successfully'), 'data' => $question ]); } /** * Remove the specified resource from storage. * * @param \App\Models\Question $question * @return \Illuminate\Http\Response */ public function destroy(Question $question) { $question->delete(); $activity = new Activity([ 'type' => 'delete', 'description' => trans('activity.delete_question'), 'user_id' => $this->user->id, 'related_id' => $question->id ]); $question->chooses ; $question->activities()->save($activity); return $this->successResponse([ 'success' => true, 'message' => trans('app.delete_successfully'), 'data' => $question ]); } }
32.019231
92
0.479279
3b925884d06fea95bcb18bd0186b434644f66bb4
2,331
h
C
usr/src/uts/common/sys/waitq.h
AsahiOS/gate
283d47da4e17a5871d9d575e7ffb81e8f6c52e51
[ "MIT" ]
null
null
null
usr/src/uts/common/sys/waitq.h
AsahiOS/gate
283d47da4e17a5871d9d575e7ffb81e8f6c52e51
[ "MIT" ]
null
null
null
usr/src/uts/common/sys/waitq.h
AsahiOS/gate
283d47da4e17a5871d9d575e7ffb81e8f6c52e51
[ "MIT" ]
1
2020-12-30T00:04:16.000Z
2020-12-30T00:04:16.000Z
/* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SYS_WAITQ_H #define _SYS_WAITQ_H #pragma ident "%Z%%M% %I% %E% SMI" #ifdef __cplusplus extern "C" { #endif #ifdef _KERNEL #include <sys/types.h> #include <sys/machlock.h> #include <sys/thread.h> typedef struct waitq { disp_lock_t wq_lock; /* protects all fields */ kthread_t *wq_first; /* first thread on the queue */ int wq_count; /* number of threads on the queue */ boolean_t wq_blocked; /* True if threads can't be enqueued */ } waitq_t; extern void waitq_init(waitq_t *); extern void waitq_fini(waitq_t *); /* * Place the thread on the wait queue. An attempt to enqueue a thread onto a * blocked queue fails and returns zero. Successful enqueue returns non-zero * value. */ extern int waitq_enqueue(waitq_t *, kthread_t *); /* * Take thread off its wait queue and make it runnable. */ extern void waitq_setrun(kthread_t *t); /* * Change priority for the thread on wait queue. */ extern void waitq_change_pri(kthread_t *, pri_t); /* * Take the first thread off the wait queue and make it runnable. */ extern void waitq_runone(waitq_t *); /* * Return True if there are no threads on the queue. */ extern boolean_t waitq_isempty(waitq_t *); /* * Prevent and allow placing new threads on wait queue. */ extern void waitq_block(waitq_t *); extern void waitq_unblock(waitq_t *); #endif /* _KERNEL */ #ifdef __cplusplus } #endif #endif /* _SYS_WAITQ_H */
25.615385
76
0.723724
fd9496fc516026e923e94e90950c9d443b5a5793
16,843
c
C
sys/page.c
madiraju/xv6-soln
c802545c2d0f2c1b90a16a1ef8a09c599ba80fbf
[ "MIT" ]
4
2016-01-17T20:01:04.000Z
2017-11-03T20:51:36.000Z
sys/page.c
madiraju/xv6-soln
c802545c2d0f2c1b90a16a1ef8a09c599ba80fbf
[ "MIT" ]
null
null
null
sys/page.c
madiraju/xv6-soln
c802545c2d0f2c1b90a16a1ef8a09c599ba80fbf
[ "MIT" ]
null
null
null
#include<sys/page.h> #include<sys/pmmgr.h> #include<sys/utility.h> #include<sys/sbunix.h> #include<sys/process.h> inline uint64_t pml4_index(uint64_t x){ return ((x>>39) & 0x1fful); } inline uint64_t pdp_index(uint64_t x){ return ((x>>30) & 0x1fful); } inline uint64_t pd_index(uint64_t x){ return ((x>>21) & 0x1fful); } inline uint64_t pt_index(uint64_t x){ return ((x>>12) & 0x1fful); } inline uint64_t lower_offset(uint64_t x){ return ( x & 0x0ffful); } inline int pd_entry_present(pd_entry e){ return (e & PD_PRESENT); /* returns 1 if P is set, otherwise 0 */ } inline int pd_entry_cow(pd_entry e){ return (e & PD_COW); } inline int pd_entry_writable(pd_entry e){ return (e & PD_WRITABLE); } inline void pd_set_writable(pd_entry *e){ *e = *e | PD_WRITABLE; } inline void pd_set_cow(pd_entry *e){ *e = *e | PD_COW; } inline uint64_t pd_entry_get_frame(pd_entry e){ return (e & PD_FRAME); } inline void pd_entry_set_frame(pd_entry *e,uint64_t addr){ *e = addr | (*e & 0xffful); /* the first 12 bits of addr will be 0 since addr is 4KB aligned */ } inline void pd_entry_add_attrib(pd_entry *e,uint64_t attrib){ *e=*e|attrib; } inline void pd_entry_del_attrib(pd_entry *e,uint64_t attrib){ *e=*e&(~(attrib)); } inline uint64_t pd_get_flags(pd_entry e){ return (e & 0xffful); } inline void pd_set_flags(pd_entry *e,uint64_t flags){ *e=*e | flags; } inline void pt_entry_add_attrib(pt_entry *e,uint64_t attrib){ *e=*e|attrib; } inline void pt_entry_del_attrib(pt_entry *e,uint64_t attrib){ *e=*e&(~(attrib)); } inline int pt_entry_present(pt_entry e){ return (e & PT_PRESENT); /* returns 1 if P is set, otherwise 0 */ } inline int pt_entry_cow(pt_entry e){ return (e & PT_COW); } inline int pt_entry_writable(pt_entry e){ return (e & PT_WRITABLE); } inline void pt_set_writable(pt_entry *e){ *e = *e | PT_WRITABLE; } inline void pt_set_cow(pt_entry *e){ *e = *e | PT_COW; } inline uint64_t pt_entry_get_frame(pt_entry e){ return (e & PT_FRAME); } inline void pt_entry_set_frame(pt_entry *e,uint64_t addr){ *e = addr | (*e & 0xffful); /* the first 12 bits of addr will be 0 since addr is 4KB aligned */ } int check_alloc(pml4 *base,uint64_t offset,uint64_t flags){ /* returns 0, if failed */ /* returns 1 if success */ pd_entry ptr; if(!pd_entry_present(base->m_entries[offset])){ /* pdp entry not present */ ptr=(pd_entry)alloc_frame(PAGE_SIZE); if(!ptr) return 0; memset1((char *)ptr,0,0x1000); pd_entry_set_frame(&base->m_entries[offset],ptr); pd_entry_add_attrib(&base->m_entries[offset],PT_PRESENT); pd_entry_add_attrib(&base->m_entries[offset],flags); } return 1; } int vm_page_map(uint64_t phys_addr,uint64_t virt_addr,uint64_t flags){ /* maps phys_addr to virt_addr */ /* phys_addr will be base addr of frame */ /* rx_bit is 1, so that page can be RW */ /* returns 0, if failed */ /* returns 1 if success */ /* giving write and user permission to pml4, pdp,pd entries of kernel page table */ /* ASSUME THAT ENTIRE 511 ENTRY OF PML4 IS OFF LIMITS TO USERLAND */ /* uint64_t temp_flags=PD_WRITABLE|PD_USER; */ uint64_t temp_flags=PD_WRITABLE; /* extract pdp entry from pml4 */ uint64_t offset=pml4_index(virt_addr); /* offset of pdp in pml4 */ pml4 *base =(pml4 *)pml4_base; /* base of pml4 */ if(!check_alloc(base,offset,temp_flags)) /* allocs pdp and points pml4+offset to the new pdp frame */ return 0; /* extract pd entry from pdp */ base=(pml4 *)pd_entry_get_frame(base->m_entries[offset]); /* base of pdp */ offset=pdp_index(virt_addr); /* offset of pd in pdp */ if(!check_alloc(base,offset,temp_flags)) /* allocs pd and points pdp+offset to new pd */ return 0; /* extract pt entry from pd */ base=(pml4 *)pd_entry_get_frame(base->m_entries[offset]); /* base of pd */ offset=pd_index(virt_addr); /* offset of pt in pd */ if(!check_alloc(base,offset,temp_flags)) /* allocs pt and points pd+offset to new pt */ return 0; /* extract page entry from pt */ base=(pml4 *)pd_entry_get_frame(base->m_entries[offset]); /* base of pt */ offset=pt_index(virt_addr); /* offset of page in pt */ /* put frame address of phys_addr into the frame of page table entry */ pd_entry ptr=phys_addr; pd_entry_set_frame(&base->m_entries[offset],ptr); pd_entry_add_attrib(&base->m_entries[offset],PT_PRESENT); pd_entry_add_attrib(&base->m_entries[offset],flags); //printf("%p\n",base->m_entries[offset]); /* success */ return 1; } void load_base(uint64_t addr){ __asm volatile( "movq %0,%%cr3" : : "r"(addr) ); } int vm_init(void* physbase,void* physfree){ /* alloc 1 frame and clear it for pml4 */ pml4_base=alloc_frame(PAGE_SIZE); if(!pml4_base){ printf("kernel panic vm_init: unable to allocate frame\n"); return 0; } memset1((char *)pml4_base,0,FRAME_SIZE); /* 511 entry of pml4 of any user table is of limits to user */ /* pml4 pdp, pd and pt of kernel space all have write and supervisor perms */ uint64_t flags=PT_WRITABLE; /* for page from 0 to 4KB map each page identically*/ uint64_t i=0; for(i=0;i<0x100000ul;i+=0x1000ul){ /* for every page till 1MB */ //printf("%p maps to ",i); if(!vm_page_map(i,i,flags)){ /* identity map */ printf("kernel panic unable to map\n"); return 0; } } /* kernmem = 0xffffffff80000000 + physbase */ /* for each page from kernmem to kernfree-1 */ /* map page to range physbase, physfree-1 */ /* physbase if */ for(i=(uint64_t)0x000000ul;i<(uint64_t)0x7ffe000ul;i+=0x1000ul){ if(!vm_page_map(i,0xffffffff80000000ul+i,flags)){ /* physical addr, virt addr */ printf("kernel panic: unable to map\n"); return 0; } } /* load pml4_base into crx register. */ /* this will also invalidate tlb */ load_base((uint64_t)pml4_base); return 1; } int u_check_alloc(pml4 *base,uint64_t offset,uint64_t flags){ /* returns 0, if failed */ /* returns 1 if success */ pd_entry ptr; if(!pd_entry_present(base->m_entries[offset])){ /* pdp entry not present */ ptr=(pd_entry)kmalloc(FRAME_SIZE); /* kernel VA */ if(!ptr) return 0; memset1((char *)ptr,0,0x1000); /* clear contents */ /* convert KVA to physical addr */ /* */ pd_entry_set_frame(&base->m_entries[offset],get_phys_addr((uint64_t)ptr)); pd_entry_add_attrib(&base->m_entries[offset],PT_PRESENT); pd_entry_add_attrib(&base->m_entries[offset],flags); } return 1; } int u_alloc_frame_for_va(pml4 *pml4_t,uint64_t virt_addr,uint64_t flags){ /* return 0 on failure */ /* return 1 on success */ /* returns 1 if, a physical frame was already alloc'd for this VA */ /* if not alloc'd, creates a frame for this VA and then returns 1 */ uint64_t offset=pml4_index(virt_addr); /* offset for pml4 entry */ pml4 *base=pml4_t; /* pml4, pdp, pd entries should have writable, user bits set */ /* pml4's 511 entry is already set as supervisor and writable */ uint64_t temp_flags=PD_WRITABLE|PD_USER; /* PML4 falgs set as writable, user */ if(!u_check_alloc(base,offset,temp_flags)){ /* u_check_failed */ return 0; } /* now a pdp frame was allocated and stitched into pml4 */ /* get addr of pdp */ /* offset is still offset into pml4 */ /* pd_entry_get_frame returns phys addr. convert it into virt addr */ base=(pml4 *)get_virt_addr(pd_entry_get_frame(base->m_entries[offset])); /* get new offset in pdp table */ offset=pdp_index(virt_addr); if(!u_check_alloc(base,offset,temp_flags)){ /* u_check failed */ return 0; } /* now pd frame was allocated and stitched into pdp */ /* get virt addr of pd */ base=(pml4 *)get_virt_addr(pd_entry_get_frame(base->m_entries[offset])); /* get pd offset */ offset=pd_index(virt_addr); if(!u_check_alloc(base,offset,temp_flags)){ /* u_check failed */ return 0; } /* now pt frame was alloc'd and stitched into pd */ /* get virt adr of pt */ base=(pml4 *)get_virt_addr(pd_entry_get_frame(base->m_entries[offset])); /* get pt offset */ offset=pt_index(virt_addr); if(!u_check_alloc(base,offset,flags)){ /* u_check failed */ return 0; } /* now a frame was allocated and stitched into pt as en entry */ /* this was the last level */ /* we already cleared the physical frame */ return 1; } int allocuvm(pml4 *pml4_t,uint64_t virt_addr,uint64_t sz,uint64_t flags){ /* return 0 on failure */ /* return sz on success */ /* allocates physical frames for the VA range virt_addr to (virt_addr+sz) */ uint64_t i=0; for(i=virt_addr;i<virt_addr+sz;i++){ /* alloc a frame for this addr i*/ if(!u_alloc_frame_for_va(pml4_t,i,flags)){ /* alloc_frame_for_va failed */ /* printf("kernel panic: allocuvm: alloc_frame_for_va failed\n"); */ return 0; } } return sz; /* success. all of range got alloc'd phys frames */ } void free_uvm(pml4 *pml4_t){ /* deallocates the pml4 entries except fpr 511 entry recursively */ /* finally frees up pml4 table memory */ /* all pml4/pd pointers passed to this function are virt addrs */ int i=0; for(;i<511;i++){ /* if an entry of pml4 is present */ if(pd_entry_present(pml4_t->m_entries[i])){ /* then free it's pdp table */ free_pdp((pdp *)(get_virt_addr(pd_entry_get_frame(pml4_t->m_entries[i])))); /* pdp table was freed withing free_pdp */ } /* else continue */ } /* kfree pml4 table */ kfree(pml4_t); } void free_pdp(pdp *pdp_t){ /* call free_pd on each entry of pdp */ int i=0; for(;i<512;i++){ /* if an entry of pml4 is present */ if(pd_entry_present(pdp_t->m_entries[i])){ /* then free it's pdp table */ free_pd((pd *)(get_virt_addr(pd_entry_get_frame(pdp_t->m_entries[i])))); /* pdp table was freed */ } /* else continue */ } /* finally free the pdp table */ kfree(pdp_t); } void free_pd(pd *pd_t){ /* call free_pd on each entry of pd */ int i=0; for(;i<512;i++){ /* if an entry of pd is present */ if(pd_entry_present(pd_t->m_entries[i])){ /* then free it's pt table */ free_pt((pt *)(get_virt_addr(pd_entry_get_frame(pd_t->m_entries[i])))); /* pd table was freed */ } /* else continue */ } /* finally free the pd table */ kfree(pd_t); } void free_pt(pt *pt_t){ /* call free_pd on each entry of pd */ int i=0; for(;i<512;i++){ /* if an entry of pd is present */ if(pt_entry_present(pt_t->m_entries[i])){ int c=0; if((c=get_ref_count(pt_entry_get_frame(pt_t->m_entries[i]))) ==0){ /* free only when */ /* ref count of frame reaches 0 */ /* then kfree it's physical frame */ kfree((void *)get_virt_addr(pt_entry_get_frame(pt_t->m_entries[i]))); } else if(c >0){ /* when ref count is >0, just decrease refcount */ decr_ref_count(pt_entry_get_frame(pt_t->m_entries[i])); } else{ /* printf("ref count is negative...should never happen\n"); */ ; } } /* else continue */ } /* finally free the pd table */ kfree(pt_t); } pml4 * copyuvm(pml4 *parent_pml4_t){ /* return NULL if fail */ /* return address of pml4 if success */ pml4 *child_pml4; if(!(child_pml4=load_kern_vm())){ return NULL; } for(int i=0;i<=510;i++){ if(pd_entry_present((uint64_t)parent_pml4_t->m_entries[i])){ /* allocate a pdp frame */ pd_entry *child_pdp=(pd_entry *)kmalloc(FRAME_SIZE); //confirm conversion if(child_pdp==NULL){ /* printf("out of memory. unable to allocate page tables\n"); */ /* free all the pages assigned to this new process pml4 */ free_uvm(child_pml4); /* break */ return NULL; } /* clear the contents of child pdp */ memset1((char *)child_pdp,0,FRAME_SIZE); /* getting new pdp frame and adding to child pml4 */ pd_entry_set_frame(&child_pml4->m_entries[i],get_phys_addr((uint64_t)child_pdp)); /* give the child pdp same falgs as parent */ pd_set_flags(&child_pml4->m_entries[i],pd_get_flags(parent_pml4_t->m_entries[i])); /* all parent pml4, pdp, pd entries are USER|WRITABLE */ /* allocated 1 pdp */ pdp *pdp_p= (pdp *)get_virt_addr(pd_entry_get_frame((uint64_t)(parent_pml4_t->m_entries[i]))); if(copy_pdp((pdp *)child_pdp,pdp_p)==0){ /* copy_pdp failed */ /* free all the pages assigned to this new process pml4 */ free_uvm(child_pml4); /* break */ return NULL; } } } return child_pml4; } int copy_pdp(pdp *pdp_c,pdp *pdp_p) { /* returns 0 on failure, 1 on success */ /* iterate over 512 entries of parent pdp */ int i; for(i=0;i<512;i++){ /* if present */ if(pd_entry_present((uint64_t)pdp_p->m_entries[i])){ /* get a new pd frame */ pd_entry *pd_c=(pd_entry *)kmalloc(FRAME_SIZE); if(pd_c==NULL){ return 0; } memset1((char *)pd_c,0,FRAME_SIZE); /* put the physical addr of new pd frame into child pdp entry */ pd_entry_set_frame(&pdp_c->m_entries[i],get_phys_addr((uint64_t)pd_c)); /* give child pd same flags as parent pd */ pd_set_flags(&pdp_c->m_entries[i],pd_get_flags((uint64_t)pdp_p->m_entries[i])); /* get virt address of parent pd */ pd *pd_p= (pd *)get_virt_addr(pd_entry_get_frame((uint64_t)(pdp_p->m_entries[i]))); /* goto pd level */ if(copy_pd((pd *)pd_c,pd_p) == 0){ /* copy pd failed, return 0 */ return 0; } } } /* return success */ return 1; } int copy_pd(pd *pd_c,pd *pd_p){ /* iterate over entries */ int i=0; for(i=0;i<512;i++){ /* if present */ if(pd_entry_present((uint64_t)pd_p->m_entries[i])){ /* get a new frame */ pd_entry *pt_c=(pd_entry *)kmalloc(FRAME_SIZE); if(pt_c==NULL) return 0; memset1((char *)pt_c,0,FRAME_SIZE); /* put the physical addr of pt_c in child pd entry */ pd_entry_set_frame(&pd_c->m_entries[i],get_phys_addr((uint64_t)pt_c)); /* set flags of parent */ pd_set_flags(&pd_c->m_entries[i],pd_get_flags((uint64_t)pd_p->m_entries[i])); /* get virt address of parent pt */ pt *pt_p=(pt *)get_virt_addr(pd_entry_get_frame((uint64_t)pd_p->m_entries[i])); /* goto pt level*/ if(copy_pt((pt *)pt_c,pt_p)==0) { /* copy pt failed, return 0 */ return 0; } } } return 1; } int copy_pt(pt *pt_c,pt *pt_p){ /* iterate over all pt entries */ int i; for(i=0;i<512;i++){ /* if present bit is set */ if(pt_entry_present((uint64_t)pt_p->m_entries[i])){ /* if pt_entry of parent is writable */ if(pt_entry_writable(pt_p->m_entries[i])){ /* set COW and clear write bit of parent pt_entry */ pt_entry_add_attrib(&pt_p->m_entries[i],PT_COW); pt_entry_del_attrib(&pt_p->m_entries[i],PT_WRITABLE); } /* if pt_entry of parent is READ_ONLY */ /* child pt_entry is exactly the same as parent pt_entry */ /* copy the pt_entry of parent into the child */ pt_c->m_entries[i]=pt_p->m_entries[i]; /* increase the ref_count of the page frame */ uint64_t phys_addr=pt_entry_get_frame(pt_p->m_entries[i]); incr_ref_count(phys_addr); } } /* by default */ return 1; } struct vma * copyvma(struct vma *p_head){ /* returns NULL on failure(cleans up too), new head on success */ struct vma *c_head=NULL, *c_tail=NULL; struct vma *t=p_head; while(t!=NULL){ /* allocate new vma for child */ struct vma *ptr=(struct vma *)kmalloc(sizeof(struct vma)); if(ptr==NULL){ /* printf("unable to clone vmas...no memory\n"); */ free_vma_list(&c_head); /* frees new vma list */ return NULL; } ptr->start=t->start; ptr->end=t->end; ptr->flags=t->flags; ptr->next=NULL; add_tail(&c_head,&c_tail,ptr); t=t->next; } return c_head; } pt_entry * get_pt_entry_for_virt(uint64_t virt_addr ){ /* pt entry for this va should exist, since error was 111 */ /* get the offset */ uint64_t offset=pml4_index(virt_addr); /* get current proc's pml4 */ pml4 *pml4_t=proc->pml4_t; /* get virtual addr of pdp table */ if(pd_entry_present(pml4_t->m_entries[offset])==0){ /* sanity check */ /* printf("pml4 entry not present, bt should be\n"); */ return NULL; } pdp *pdp_t=(pdp *)get_virt_addr(pd_entry_get_frame(pml4_t->m_entries[offset])); /* get pdp offset */ offset=pdp_index(virt_addr); /* get virtual addr of pd table */ if(pd_entry_present(pdp_t->m_entries[offset])==0){ /* sanity check */ /* printf("pdp entry not present, but should be\n"); */ return NULL; } pd *pd_t=(pd *)get_virt_addr(pd_entry_get_frame(pdp_t->m_entries[offset])); /* get pd offset */ offset=pd_index(virt_addr); /* get virtual addr of pt table */ if(pd_entry_present(pd_t->m_entries[offset])==0){ /* sanity check */ /* printf("pd entry not present, bt should be\n"); */ return NULL; } pt *pt_t=(pt *)get_virt_addr(pd_entry_get_frame(pd_t->m_entries[offset])); /* get pt offset */ offset=pt_index(virt_addr); /* get value of pt_entry at this offset in pt table */ if(pt_entry_present(pt_t->m_entries[offset])==0){ /* sanity check */ /* printf("pt entry not present, bt should be\n"); */ return NULL; } return &pt_t->m_entries[offset]; }
28.118531
104
0.67108
b53bbda1f674a95e5d0a6957976d75f5938d1fdd
3,746
rs
Rust
core/storage/src/chain/mempool/mod.rs
cyberliem/zksync
fe774e147a6cd20213fbd438c840c5ecf3e76258
[ "Apache-2.0", "MIT" ]
1
2020-09-14T07:08:56.000Z
2020-09-14T07:08:56.000Z
core/storage/src/chain/mempool/mod.rs
cyberliem/zksync
fe774e147a6cd20213fbd438c840c5ecf3e76258
[ "Apache-2.0", "MIT" ]
null
null
null
core/storage/src/chain/mempool/mod.rs
cyberliem/zksync
fe774e147a6cd20213fbd438c840c5ecf3e76258
[ "Apache-2.0", "MIT" ]
null
null
null
// Built-in deps use std::collections::VecDeque; // External imports use diesel::prelude::*; // Workspace imports use models::node::{tx::TxHash, SignedFranklinTx}; // Local imports use self::records::{MempoolTx, NewMempoolTx}; use crate::{schema::*, StorageProcessor}; pub mod records; /// Schema for TODO #[derive(Debug)] pub struct MempoolSchema<'a>(pub &'a StorageProcessor); impl<'a> MempoolSchema<'a> { /// Loads all the transactions stored in the mempool schema. pub fn load_txs(&self) -> Result<VecDeque<SignedFranklinTx>, failure::Error> { let txs: Vec<MempoolTx> = mempool_txs::table.load(self.0.conn())?; let txs = txs .into_iter() .map(|tx_object| -> Result<SignedFranklinTx, failure::Error> { let tx = serde_json::from_value(tx_object.tx)?; let sign_data = match tx_object.eth_sign_data { None => None, Some(sign_data_value) => serde_json::from_value(sign_data_value)?, }; Ok(SignedFranklinTx { tx, eth_sign_data: sign_data, }) }) .collect::<Result<VecDeque<SignedFranklinTx>, _>>()?; Ok(txs) } /// Adds a new transaction to the mempool schema. pub fn insert_tx(&self, tx_data: &SignedFranklinTx) -> Result<(), failure::Error> { let tx_hash = hex::encode(tx_data.tx.hash().as_ref()); let tx = serde_json::to_value(&tx_data.tx)?; let db_entry = NewMempoolTx { tx_hash, tx, created_at: chrono::Utc::now(), eth_sign_data: tx_data .eth_sign_data .as_ref() .map(|sd| serde_json::to_value(sd).expect("failed to encode EthSignData")), }; diesel::insert_into(mempool_txs::table) .values(db_entry) .execute(self.0.conn())?; Ok(()) } pub fn remove_tx(&self, tx: &[u8]) -> QueryResult<()> { let tx_hash = hex::encode(tx); diesel::delete(mempool_txs::table.filter(mempool_txs::tx_hash.eq(&tx_hash))) .execute(self.0.conn())?; Ok(()) } fn remove_txs(&self, txs: &[TxHash]) -> Result<(), failure::Error> { let tx_hashes: Vec<_> = txs.iter().map(hex::encode).collect(); diesel::delete(mempool_txs::table.filter(mempool_txs::tx_hash.eq_any(&tx_hashes))) .execute(self.0.conn())?; Ok(()) } /// Removes transactions that are already committed. /// Though it's unlikely that mempool schema will ever contain a committed /// transaction, it's better to ensure that we won't process the same transaction /// again. One possible scenario for having already-processed txs in the database /// is a failure of `remove_txs` method, which won't cause a panic on server, but will /// left txs in the database. /// /// This method is expected to be initially invoked on the server start, and then /// invoked periodically with a big interval (to prevent possible database bloating). pub fn collect_garbage(&self) -> Result<(), failure::Error> { let mut txs_to_remove: Vec<_> = self.load_txs()?.into_iter().collect(); txs_to_remove.retain(|tx| { let tx_hash = tx.hash(); self.0 .chain() .operations_ext_schema() .get_tx_by_hash(tx_hash.as_ref()) .expect("DB issue while restoring the mempool state") .is_some() }); let tx_hashes: Vec<_> = txs_to_remove.into_iter().map(|tx| tx.hash()).collect(); self.remove_txs(&tx_hashes)?; Ok(()) } }
34.685185
91
0.581687
d1969331a316ddb16ccb14cd98b777ae1418e24e
2,430
lua
Lua
prototypes/betterlights.lua
krissi/PickerVehicles
6e0243c458265017e89b5bdc523ea95249a768bd
[ "MIT" ]
null
null
null
prototypes/betterlights.lua
krissi/PickerVehicles
6e0243c458265017e89b5bdc523ea95249a768bd
[ "MIT" ]
null
null
null
prototypes/betterlights.lua
krissi/PickerVehicles
6e0243c458265017e89b5bdc523ea95249a768bd
[ "MIT" ]
null
null
null
if settings.startup['picker-better-lights-cars'].value then for _, vehicle in pairs(data.raw['car']) do vehicle.light = { { minimum_darkness = 0.1, intensity = 0.2, size = 30 }, { type = 'oriented', minimum_darkness = 0.1, picture = { filename = '__PickerVehicles__/graphics/lightcone-enhanced-vehicle.png', priority = 'extra-high', flags = {'light'}, scale = 2, width = 350, height = 370 }, shift = {0, -25}, size = 2, intensity = 1.0, color = {r = 1.0, g = 1.0, b = 1.0} } } end end if settings.startup['picker-better-lights-trains'].value then for _, loco in pairs(data.raw['locomotive']) do loco.front_light = { { shift = {0, -3.5}, intensity = 0.2, minimum_darkness = 0.1, size = 30 }, { type = 'oriented', minimum_darkness = 0.3, picture = { filename = '__PickerVehicles__/graphics/lightcone-enhanced-vehicle.png', priority = 'extra-high', flags = {'light'}, scale = 2, width = 350, height = 370 }, shift = {0, -27}, size = 2, intensity = 1.0, color = {r = 1.0, g = 1.0, b = 1.0} } } loco.stand_by_light = { { add_perspective = true, color = {b = 1}, shift = {-0.6, -3.5}, size = 2, intensity = 0.3, minimum_darkness = 0.3 }, { add_perspective = true, color = {b = 1}, shift = {0.6, -3.5}, size = 2, intensity = 0.3, minimum_darkness = 0.3 }, { shift = {0, -3.5}, intensity = 0.2, minimum_darkness = 0.1, size = 30 } } end end
30
92
0.349794
d2724241ef6c67ac8a10878e367394d67ec6222e
1,984
php
PHP
src/Entity/QuestionCategory.php
WildCodeSchool/ambassadeurs-de-createurs
e49420714fbff47efe5783430dcd486a1b33ad4b
[ "Unlicense" ]
null
null
null
src/Entity/QuestionCategory.php
WildCodeSchool/ambassadeurs-de-createurs
e49420714fbff47efe5783430dcd486a1b33ad4b
[ "Unlicense" ]
null
null
null
src/Entity/QuestionCategory.php
WildCodeSchool/ambassadeurs-de-createurs
e49420714fbff47efe5783430dcd486a1b33ad4b
[ "Unlicense" ]
null
null
null
<?php namespace App\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; /** * @ORM\Entity(repositoryClass="App\Repository\QuestionCategoryRepository") */ class QuestionCategory { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) * @Assert\NotBlank() * @Assert\Length( * max = 255, * maxMessage = "Votre catégotie doit être au plus {{ limit }} caractères de long") */ private $category; /** * @ORM\OneToMany(targetEntity="App\Entity\Question", mappedBy="category") */ private $questions; public function __construct() { $this->questions = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getCategory(): ?string { return $this->category; } public function setCategory(string $category): self { $this->category = $category; return $this; } /** * @return Collection|Question[] */ public function getQuestions(): Collection { return $this->questions; } public function addQuestion(Question $question): self { if (!$this->questions->contains($question)) { $this->questions[] = $question; $question->setCategory($this); } return $this; } public function removeQuestion(Question $question): self { if ($this->questions->contains($question)) { $this->questions->removeElement($question); // set the owning side to null (unless already changed) if ($question->getCategory() === $this) { $question->setCategory(null); } } return $this; } }
22.292135
92
0.580141
969d76b71dbbe9e32e89379b4d735ae3129634cc
40,416
html
HTML
images/2020-01-10/https_www.stratford.gov.uk_planning-regeneration_brownfield-land-register.cfm.png.html
digital-land/brownfield-land-screenshots
97de203a6bc91a9d915f21bbcdd741fe30705e45
[ "MIT" ]
null
null
null
images/2020-01-10/https_www.stratford.gov.uk_planning-regeneration_brownfield-land-register.cfm.png.html
digital-land/brownfield-land-screenshots
97de203a6bc91a9d915f21bbcdd741fe30705e45
[ "MIT" ]
null
null
null
images/2020-01-10/https_www.stratford.gov.uk_planning-regeneration_brownfield-land-register.cfm.png.html
digital-land/brownfield-land-screenshots
97de203a6bc91a9d915f21bbcdd741fe30705e45
[ "MIT" ]
null
null
null
<!DOCTYPE html><html lang="en" prefix="fb: http://ogp.me/ns/fb#"><head> <!-- Global site tag (gtag.js) - Google Analytics --> <script type="text/javascript" async="" src="https://www.google-analytics.com/analytics.js"></script><script async="" src="https://www.googletagmanager.com/gtag/js?id=UA-2334822-1"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-2334822-1', { 'anonymize_ip': true } ); </script> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Brownfield Land Register | Stratford-on-Avon District Council</title> <link type="text/plain" rel="author" href="/humans.txt"> <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"> <link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32"> <link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16"> <meta name="theme-color" content="#009390"> <meta content="origin" name="referrer"> <meta name="Description" content="The Brownfield Land Register is a list of previously developed sites in the district that may be suitable for potential..."> <link href="https://fonts.googleapis.com/css?family=Yantramanav:100,300,400" rel="stylesheet"> <link href="/css/bootstrap.css" rel="stylesheet"> <link href="/css/fa/css/all.min.css" rel="stylesheet"> <link href="/css/main.css" rel="stylesheet"> <link href="/css/accessibility-modal.css" rel="stylesheet"> <link href="/css/print.css" rel="stylesheet"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <meta property="og:title" content="Brownfield Land Register | Stratford-on-Avon District Council"> <meta property="og:description" content="The Brownfield Land Register is a list of previously developed sites in the district that may be suitable for potential..."> <meta property="og:image" content="https://www.stratford.gov.uk/img/fb-share-image.png"> <meta property="fb:app_id" content="124902551396119"> <meta property="og:type" content="business.business"> <meta property="og:locale" content="en_GB"> <meta property="business:contact_data:street_address" content="Elizabeth House, Church Street"> <meta property="business:contact_data:locality" content="Stratford-upon-Avon"> <meta property="business:contact_data:postal_code" content="CV37 6HX"> <meta property="business:contact_data:country_name" content="England"> <meta property="business:hours:day" content="Monday"> <meta property="business:hours:start" content="08:45"> <meta property="business:hours:end" content="17:15"> <meta property="place:location:latitude" content="52.190117"> <meta property="place:location:longitude" content="-1.7109887"> <link type="application/opensearchdescription+xml" rel="search" href="/opensearchsdc.xml"> <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "WebSite", "url": "https://www.stratford.gov.uk", "name": "Brownfield Land Register | Stratford-on-Avon District Council", "author": "Stratford-on-Avon District Council", "description": "The Brownfield Land Register is a list of previously developed sites in the district that may be suitable for potential...", "publisher": { "@type": "GovernmentOrganization", "name": "Stratford-on-Avon District Council", "url": "https://www.stratford.gov.uk", "contactPoint" : [ { "@type" : "ContactPoint", "telephone" : "+4401789 267575", "contactType" : "customer service", "email" : "info@stratford-dc.gov.uk" } ], "logo": "https://www.stratford.gov.uk/img/logo-250h.png", "address": { "@type" : "PostalAddress", "streetAddress": "Elizabeth House, Church Street", "addressLocality": "Stratford-upon-Avon", "addressRegion": "Warwickshire", "postalCode": "CV37 6HX", "addressCountry": "UK", "telephone" : "+4401789 267575", "email" : "info@stratford-dc.gov.uk" } }, "potentialAction": { "@type": "SearchAction", "target": "https://www.stratford.gov.uk/search/?q={search_term}", "query-input": "required name=search_term" } } </script> </head> <body class="content" bgcolor="white"> <a id="topofpage"></a> <div class="mobile-top-bar stick stick-top"> <h6 class="site-cookie-alert text-center"> We use cookies to enhance user experience. <br class="visible-xs"><a href="/toolkit/cookies.cfm">Read more about cookies</a> <i class="pull-right fa fa-times-circle btn-cookie-close"></i> </h6> <nav class="navbar-default visible-xs hidden-sm hidden-md hidden-lg"> <div class="container-fluid"> <ul class="navbar-header no-bullets"> <li class="logo"> <a class="" href="/index.cfm" title="Home"> <img src="/img/sdc-round-logo-white-small.png" alt="SDC logo"> </a> </li> <li> <a href="/index.cfm" title="Home"> <h4 class="top-bar-title">Stratford-on-Avon<br>District Council</h4> </a> </li> </ul> </div> </nav> <div class="service-nav container-fluid sdc-page-header hidden-xs text-center"> <a class="" href="/index.cfm" title="Home"> <img src="/img/sdc-round-logo-white-small.png" alt="SDC logo"> </a> <div class="navbar-inline no-bullets active"> <ul> <li> <div class="search"> <div class="plate plate-dark text-center"> <form name="search" action="/search/index.cfm" method="post"> <label class="sr-only" for="frmSearchTerm1" aria-labelledby="frmSearchTerm1">Enter search term</label> <div class="group-input"> <input type="hidden" name="searchtype" value="1"> <input type="hidden" name="frmType" value="phrase"> <input type="hidden" name="frmContent" value="1"> <input type="text" class="search-bar ui-autocomplete-input" name="frmSearchTerm" id="frmSearchTerm1" placeholder="Search..." autocomplete="off"> <button type="submit" class="btn-icon" title="search"> <i class="fa fa-search fa-2x"></i><span class="sr-only">Search</span> </button> </div> </form> </div> </div> </li> <li> <a href="/#services"><i class="far fa-th-large"></i>Services</a> </li> <li> <a href="/news/"><i class="far fa-newspaper"></i>News</a> </li> <li> <a href="/#contact"><i class="far fa-envelope"></i>Contact</a> </li> <li> <a href="#" data-toggle="modal" data-target="#accessibility-settings"><i class="fa fa-wheelchair"></i>Access<span class="hidden-sm">ibility</span></a> </li> <li class="text-center hidden-xs"> <a href="/mydistrict" class="has-icon btn-my-account"> <i class="far fa-user-circle"></i> <span class="btn-my-account-text">MyDistrict</span> </a> </li> </ul> </div> </div> </div> <div class="main-navigation visible-xs stick stick-bottom"> <nav class="navbar navbar-default"> <div class="container"> <ul class="nav navbar-nav"> <li class="text-center"> <a href="#" class="has-xs-icon" data-toggle="modal" data-target="#pop-search"><i class="visible-xs fa fa-search"></i>Search</a> </li> <li class="text-center"><a href="#" class="has-xs-icon" data-toggle="modal" data-target="#rpi"><i class="visible-xs far fa-newspaper"></i>Docs &amp; Links</a></li> <li class="text-center"><a href="#" class="has-xs-icon" data-toggle="modal" data-target="#quick-links"><i class="visible-xs fa fa-th-large"></i>More Pages</a></li> <li class="text-center"><a href="#more" class="has-xs-icon show-more-links" data-toggle="modal"><i class="visible-xs fa fa-tasks"></i>More...</a></li> </ul> </div> </nav> <div class="icon-bar"> <ul class="nav no-bullets"> <li> <a href="/mydistrict"> <i class="far fa-user-circle"></i> <span class="btn-my-account-text">MyDistrict</span> </a> </li> <li><a href="/news"><i class="far fa-newspaper"></i>News</a></li> <li><a href="/#contact"><i class="far fa-envelope"></i>Contact</a></li> <li><a href="#" data-toggle="modal" data-target="#accessibility-settings"><i class="fa fa-wheelchair"></i>Accessibility</a></li> </ul> </div> </div> <div class="container-fluid"> <div class="row"> <div class="col-xs-22 col-xs-offset-1"> <div class="header" id="service-header"> <div class="sdc-page-title"> <ol class="breadcrumb"> <li><a href="/index.cfm" title="Home">Home</a></li> <li><a href="/planning-building/index.cfm" title="Planning &amp; Building">Planning &amp; Building</a></li> <li><a href="/planning-building/planning-policy.cfm" title="Planning Policy">Planning Policy</a></li> <li></li> </ol> <h1>Brownfield Land Register</h1> </div> </div> </div> </div> <div class="row"> <div class="col-xs-24 col-xs-offset-0 col-sm-15 col-sm-offset-1"> <div class="row"> <div class="col-xs-24 col-sm-12"> </div> <div class="col-xs-24 col-sm-12 text-right"> </div> </div> </div> </div> <div class="row"> <div class="col-xs-24 col-xs-offset-0 col-sm-15 col-sm-offset-1"> <div class="sdc-panel content-panel"><div class="page-legend" id="page-legend"><strong>Information covered on this page</strong><hr><ul class="page-legend-list"><li class=""><a title="What is the purpose of the Register?" class="legend-link" href="#h21">What is the purpose of the Register?</a></li><li class=""><a title="How are brownfield sites identified?" class="legend-link" href="#h22">How are brownfield sites identified?</a></li><li class=""><a title="View the Register" class="legend-link" href="#h23">View the Register</a></li><li class=""><a title="Suggest sites for inclusion" class="legend-link" href="#h24">Suggest sites for inclusion</a></li><li class=""><a title="Find out more" class="legend-link" href="#h25">Find out more</a></li></ul></div> <!-- Page content start --> <h2 id="h21" class="page-legend-target">What is the purpose of the Register?</h2> <p id="toppara">The Brownfield Land Register is a list of previously developed sites that may be suitable for potential future development. We publish the register online and update it regularly to include new sites or amendments to previously identified sites.</p> <h2 id="h22" class="page-legend-target">How are brownfield sites identified?</h2> <p>"Brownfield land" refers to sites that have been previously built on with a permanent structure. This excludes land in agricultural or forestry use. You can find the full official definition in the <a class="lext" title="External link: National Planning Policy Framework (NPPF) - glossary" href="https://www.gov.uk/government/publications/national-planning-policy-framework--2" target="_blank" rel="noopener noreferrer" data-id="136888">glossary to the National Planning Policy Framework (NPPF) <i class="fad fa-fw fa-external-link text-warning"></i></a>.</p> <p>For a site to be included on the register it must be at least 0.25ha in size or capable of providing at least five homes, it must be suitable for residential development, it must be available for residential development, and such development should be achievable within fifteen years. You can find the full criteria in the <a class="lext" title="External link: Brownfield Land Regulations 2017" href="http://legislation.data.gov.uk/uksi/2017/403/made/data.pdf" target="_blank" rel="noopener noreferrer" data-id="136889">Brownfield Land Regulations 2017. <i class="fad fa-fw fa-external-link text-warning"></i></a></p> <h2 id="h23" class="page-legend-target">View the Register</h2> <p>The latest version of our Brownfield Land Register can be downloaded below. We have provided the file both as a PDF for easy reading and as a CSV file (a format supported by all the most common spreadsheet software).</p> <ul> <li><a class="ldoc" href="/doc/206644/name/Brownfield Land Register December 2018.pdf" target="_blank" title="Document: Brownfield Land Register - December 2018 (PDF version)" rel="noopener noreferrer" data-doctype="1" data-docid="206644">Brownfield Land Register (PDF version) <i class="fad fa-fw fa-file-pdf text-danger"></i></a> - December 2018</li> <li><a class="ldoc" href="/doc/206607/name/BrownfieldLandRegistercsv.csv" target="_blank" rel="noopener noreferrer" data-docid="206607" data-doctype="6" title="Document: ">Brownfield Land Register (CSV version) <i class="fad fa-fw fa-file-csv text-csv"></i></a> - December 2018</li> </ul> <h2 id="h24" class="page-legend-target">Suggest sites for inclusion</h2> <p>If you would like to suggest sites to be included on the Brownfield Land Register please complete our <a class="ldoc" href="/doc/175507/name/SHLAA Call for Sites Pro forma 2018.pdf" target="_blank" title="Document: Call for Sites Pro-forma" rel="noopener noreferrer" data-doctype="1" data-docid="175507">Call for Sites form <i class="fad fa-fw fa-file-pdf text-danger"></i></a>.</p> <h2 id="h25" class="page-legend-target">Find out more</h2> <ul> <li><a class="lint" title="Website Page: Call for Sites" href="/planning-regeneration/call-for-sites.cfm" data-id="139798">Call for Sites <i class="fad fa-fw fa-link "></i></a></li> <li><a class="lint" title="Website Page: Custom and Self-Build Register of Interest" href="/planning-regeneration/self-build-register-of-interest.cfm" data-id="139513">Custom and Self-build Register of Interest <i class="fad fa-fw fa-link "></i></a></li> <li><a class="lint" title="Website Page: Site Allocations Plan" href="/planning-regeneration/site-allocations-plan.cfm" data-id="139281">Site Allocations Plan <i class="fad fa-fw fa-link "></i></a></li> </ul> <p>You can also find more information about Brownfield Land Registers on the <a class="lext" title="External link: Brownfield Land Registers and permission in principle" href="https://www.gov.uk/government/publications/brownfield-registers-and-permission-in-principle" target="_blank" rel="noopener noreferrer" data-id="136890">Department for Communities and Local Government website <i class="fad fa-fw fa-external-link text-warning"></i></a>.</p> <p><strong>For further information:</strong> please contact the Planning Policy team on <strong>01789 260399</strong> or email <a class="lmail" href="mailto:planning.policy@stratford-dc.gov.uk" title="Send Email: ">planning.policy@stratford-dc.gov.uk <i class="fad fa-fw fa-envelope text-primary"></i></a>.</p> <p>This page can be viewed directly via www.stratford.gov.uk/brownfieldland</p> <!-- Page content end --> <div class="author-info"> Last updated on 05/03/2019 <p> Contact <a id="page-contact" href="mailto:planning.policy@stratford-dc.gov.uk">the Planning Policy team</a> </p> </div> </div> </div> <div class="col-xs-24 col-xs-offset-0 col-sm-6 col-sm-offset-1 hidden-xs"> <div class="sdc-panel sidebar-panel right-nav"> <div class="sdc-panel-heading sdc-heading-active"> <h3>In this section</h3> </div> <div class="sdc-panel-body"> <h4 class="parent-page"> <a href="/planning-building/planning-policy.cfm">Planning Policy</a> </h4> <ul class="section-pages no-bullets"> <li> <a href="/planning-building/affordable-housing.cfm">Affordable Housing</a> </li> <li class="current-page"> Brownfield Land Register </li> <li> <a href="/planning-building/call-for-sites.cfm">Call for Sites</a> </li> <li> <a href="/planning-building/community-infrastructure-levy.cfm">Community Infrastructure Levy (CIL)</a> </li> <li> <a href="/planning-building/community-infrastructure-levy-examination.cfm">Community Infrastructure Levy Adoption</a> </li> <li> <a href="/planning-building/planning-policy-consultation-viewer.cfm">Consultation Viewer</a> </li> <li> <a href="/planning-building/core-strategy.cfm">Core Strategy</a> </li> <li> <a href="/planning-building/enterprise-planning.cfm">Enterprise Planning</a> </li> <li> <a href="/planning-building/five-year-housing-supply.cfm">Five Year Housing Supply</a> </li> <li> <a href="/planning-building/gypsy-and-traveller-local-plan.cfm">Gypsy and Traveller Local Plan</a> </li> <li> <a href="/planning-building/local-development-scheme.cfm">Local Development Scheme</a> </li> <li> <a href="/planning-building/monitoring-information.cfm">Monitoring Information and Reports</a> </li> <li> <a href="/planning-building/neighbourhood-plans.cfm">Neighbourhood Plans</a> </li> <li> <a href="/planning-building/parish-plans.cfm">Parish Plans</a> </li> <li> <a href="/planning-building/privacy-notice.cfm">Privacy Notice</a> </li> <li> <a href="/planning-building/self-build-register-of-interest.cfm">Self Build and Custom Housebuilding</a> </li> <li> <a href="/planning-building/site-allocations-plan.cfm">Site Allocations Plan</a> </li> <li> <a href="/planning-building/statement-of-community-involvement.cfm">Statement of Community Involvement</a> </li> <li> <a href="/planning-building/shlaa.cfm">Strategic Housing Land Availability Assessment</a> </li> <li> <a href="/planning-building/strategic-planning.cfm">Strategic Planning</a> </li> <li> <a href="/planning-building/supplementary-planning-documents-spds.cfm">Supplementary Planning Documents (SPDs)</a> </li> <li> <a href="/planning-building/technical-evidence.cfm">Technical Evidence</a> </li> <li> <a href="/planning-building/transport-and-infrastructure-planning.cfm">Transport and Infrastructure Planning</a> </li> <li> <a href="/planning-building/village-design-statements.cfm">Village Design Statements</a> </li> <li> <a href="/planning-building/wellesbourne-airfield.cfm">Wellesbourne Airfield</a> </li> </ul> </div> </div> </div> </div> <div class="row"> <div class="col-xs-22 col-xs-offset-1 col-sm-22 col-sm-offset-1 hidden-xs"> <div class="sdc-panel content-panel container-fluid related-page-items"> <div class="row tab-row"> <div class="col-xs-8 col-sm-8 col-md-6"> <div class="sdc-panel-heading tab-heading sdc-heading-active tab-heading-active"> <h4 data-target="#rpi-documents" aria-controls="rpi-documents" data-toggle="tab">Documents</h4> </div> </div> <div class="col-xs-8 col-sm-8 col-md-6"> <div class="sdc-panel-heading tab-heading sdc-heading-default"> <h4 data-target="#rpi-links" aria-controls="rpi-links" data-toggle="tab"><span class="hidden-xs">External </span>Links</h4> </div> </div> <div class="col-xs-8 col-sm-8 col-md-6"> <div class="sdc-panel-heading tab-heading sdc-heading-default"> <h4 data-target="#rpi-pages" aria-controls="rpi-pages" data-toggle="tab"><span class="hidden-xs">Related </span>Pages</h4> </div> </div> </div> <div class="row sdc-panel-body"> <div class="col-xs-24"> <div class="tab-content"> <div id="rpi-documents" class="tab-pane active"> <ul class="rpi-document-list no-bullets fa-ul"> <li> <a href="/doc/206644/name/Brownfield%20Land%20Register%20December%202018.pdf/" title="Brownfield Land Register - December 2018 (PDF version) - opens in new browser window" target="_blank"> <i class="fad fa-li fa-file-pdf" data-file-type="PDF"></i> Brownfield Land Register - December 2018 (PDF version) </a> (346 KB) <span class="text-muted">- <span class="rpi-document-description">PDF version of the Brownfield Land Register</span></span> </li> <li> <a href="/doc/206607/name/stratford%20brownfieldregister%202018%2012%2031%20rev1%20RB%20new.csv/" title="Brownfield Land Register - December 2018 (CSV version) - opens in new browser window" target="_blank"> <i class="fad fa-li fa-file-csv" data-file-type="CSV"></i> Brownfield Land Register - December 2018 (CSV version) </a> (48 KB) <span class="text-muted">- <span class="rpi-document-description">Spreadsheet version of Brownfield Land Register</span></span> </li> <li> <a href="/doc/175507/name/SHLAA%20Call%20for%20Sites%20Pro%20forma%202018.pdf/" title="Call for Sites Pro-forma - opens in new browser window" target="_blank"> <i class="fad fa-li fa-file-pdf" data-file-type="PDF"></i> Call for Sites Pro-forma </a> (126 KB) <span class="text-muted">- <span class="rpi-document-description">Suggest sites within the district for future development</span></span> </li> </ul> <p class="pdf-help"> <i class="fad fa-question-circle text-success"></i> <a href="/help-info/help-with-pdf-files.cfm" title="Help with PDFs" class="contentlink">Help with PDFs</a></p> </div> <div id="rpi-links" class="tab-pane "> <ul class="rpi-link-list no-bullets fa-ul"> <li> <a href="https://www.gov.uk/government/publications/national-planning-policy-framework--2" title="National Planning Policy Framework (NPPF) - glossary - opens in new browser window" target="_blank"> <i class="fa-li fad fa-external-link" data-file-type="lext"></i> National Planning Policy Framework (NPPF) - glossary </a> <span class="text-muted"> - Official definition of brownfield land</span> </li> <li> <a href="http://legislation.data.gov.uk/uksi/2017/403/made/data.pdf" title="Brownfield Land Regulations 2017 - opens in new browser window" target="_blank"> <i class="fa-li fad fa-external-link" data-file-type="lext"></i> Brownfield Land Regulations 2017 </a> <span class="text-muted"> - Criteria for inclusion of sites on brownfield land register</span> </li> <li> <a href="https://www.gov.uk/government/publications/brownfield-registers-and-permission-in-principle" title="Brownfield Land Registers and permission in principle - opens in new browser window" target="_blank"> <i class="fa-li fad fa-external-link" data-file-type="lext"></i> Brownfield Land Registers and permission in principle </a> <span class="text-muted"> - More information from central government about Brownfield Land Registers</span> </li> </ul> </div> <div id="rpi-pages" class="tab-pane "> <ul class="rpi-page-list no-bullets fa-ul"> <li> <a href="/planning-building/call-for-sites.cfm" title="Call for Sites" class="has-caret"> <i class="fa-li fad fa-link" data-file-type="lint"></i> Call for Sites </a> </li> <li> <a href="/planning-building/self-build-register-of-interest.cfm" title="Self Build and Custom Housebuilding" class="has-caret"> <i class="fa-li fad fa-link" data-file-type="lint"></i> Self Build and Custom Housebuilding </a> </li> <li> <a href="/planning-building/site-allocations-plan.cfm" title="Site Allocations Plan" class="has-caret"> <i class="fa-li fad fa-link" data-file-type="lint"></i> Site Allocations Plan </a> </li> </ul> </div> </div> </div> </div> </div> </div> </div> </div> <section id="feedback" aria-labelledby="feedback"> <div class="container"> <div class="row"> <div class="sdc-panel panel-primary feedback-panel col-xs-22 col-xs-offset-1 col-sm-24 col-sm-offset-0"> <div class="panel-heading"> <h4> <i class="fa fa-question-circle"></i> Is this information helpful? <i class="js-chevron fa fa-chevron-down pull-right"></i> </h4> </div> <div class="panel-body"> <input type="hidden" class="form-control" value="/planning-building/brownfield-land-register.cfm" data-name="Page"> <div class="row feedback-column"> <div class="col-xs-8 col-sm-4 check-column"> <input class="form-control" type="radio" id="checkYes" name="radFeedback" data-name="Information Helpful" value="yes" aria-labelledby="checkYes"> <label for="checkYes" aria-labelledby="checkYes"><span class="sr-only">Yes</span></label> <label>Yes</label> </div> <div class="col-xs-8 col-sm-4 check-column"> <input class="form-control" type="radio" id="checkNo" name="radFeedback" data-name="Information Helpful" value="no" aria-labelledby="checkNo"> <label for="checkNo" aria-labelledby="checkNo"><span class="sr-only">No</span></label> <label>No</label> </div> </div> <div class="row row-no"> <div class="col-xs-24 feedback-column"> <label>Reason:</label> <select class="form-control" name="selReason" id="selReason" data-name="Reason" aria-labelledby="selReason"> <option value="">Please Select Reason</option> <option value="1">There is a problem with the content / Information is missing / The page has broken links</option> <option value="2">I am seeing an error message</option> <option value="99">Other</option> </select> </div> <div class="col-xs-24 feedback-column column-reason"> <label class="sr-only">Specify the other reason</label> <input type="text" class="form-control" name="txtReason" id="txtReason" data-name="Other Reason" placeholder="Specify a Reason" aria-labelledby="txtReason"> </div> <div class="col-xs-24 feedback-column column-email"> <label>Email:</label> <input type="text" class="form-control" id="txtEmail" name="txtEmail" data-name="Email" placeholder="Email" aria-labelledby="txtEmail"> <span class="helper-text">See our <a href="/privacystatement" title="SDC Privacy Statement">Privacy Statement</a> for how and why we use this</span> </div> </div> <div class="row"> <div class="col-xs-24 feedback-column column-suggest"> <label>Comments / How can we make this page better?</label> <textarea class="form-control" id="txtSuggest" name="txtSuggest" data-name="Suggestions" aria-labelledby="txtSuggest"></textarea> </div> </div> <input type="hidden" id="frmPageContact" name="frmPageContact" value="planning.policy@stratford-dc.gov.uk"> <div class="row"> <div class="col-xs-24 text-right feedback-column column-submit"> <button class="btn btn-primary btn-submit-feedback">Submit Feedback</button> </div> </div> </div> </div> </div> </div> </section> <section id="footer" class="footer" aria-labelledby="footer"> <h2 class="sr-only">Footer of the website</h2> <div class="container"> <div class="row"> <div class="col-sm-24 col-md-12"> <ul class="footer-links no-bullets"> <li> <a href="/help-info/sitemap.cfm">Sitemap</a> </li> <li> <a href="/privacy">Privacy</a> </li> <li> <a href="/constitution">Constitution</a> </li> <li> <a href="/help-info/disclaimer.cfm">Disclaimer</a> </li> <li> <a href="/council-democracy/contact-the-council.cfm">Contact us</a> </li> </ul> </div> <div class="col-sm-24 col-md-12 text-right social-links"> <a class="social-icon" target="_blank" rel="noopener noreferrer" href="https://www.facebook.com/StratfordDC"> <i class="fab fa-facebook-square fa-3x"></i><span class="sr-only">SDC Facebook page</span> </a> <a class="social-icon" target="_blank" rel="noopener noreferrer" href="https://twitter.com/StratfordDC"> <i class="fab fa-twitter-square fa-3x"></i><span class="sr-only">SDC Twitter page</span> </a> <a class="social-icon" target="_blank" rel="noopener noreferrer" href="https://www.flickr.com/photos/stratford-dc/"> <i class="fab fa-flickr fa-3x"></i><span class="sr-only">SDC Flickr page</span> </a> <a class="social-icon" target="_blank" rel="noopener noreferrer" href="https://www.youtube.com/user/StratfordDC"> <i class="fab fa-youtube-square fa-3x"></i><span class="sr-only">SDC Youtube page</span> </a> </div> </div> <div class="row copyright-info"> <div class="col-sm-12 col-sm-offset-6 text-center"> <img src="/img/sdc-round-logo-white-small.png" alt="SDC-Logo"> <p>© 2016 Stratford-on-Avon District Council</p> </div> </div> </div> </section> <script src="/js/jquery-ui.min.js"></script> <script src="/js/bootstrap.js"></script> <script src="/js/main.js"></script> <script src="/js/search.js"></script> <script src="/js/address-lookup.js"></script> <script src="/js/content.js"></script> <div id="accessibility-settings" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="accessibility-settings-title"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Closes the modal"><span aria-hidden="true">×</span></button> <h4 id="accessibility-settings-title" class="modal-title"><i class="fa fa-wheelchair"></i> Accessibility Settings</h4> </div> <div class="modal-body"> <div class="panel panel-default"> <div class="panel-body setting-preview"> <h4 class="settings-text">Preview</h4> <p class="settings-text"> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's <a href="#">standard dummy text</a> ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. </p> </div> </div> <div class="panel panel-default setting"> <div class="row setting-row"> <div class="col-xs-24"> <strong>Color</strong> </div> </div> <div class="row setting-row"> <div class="col-xs-11 col-sm-10 col-xs-offset-1 setting-column" data-setting="colour" data-value="blue" title="Click to preview"> <p>Blue</p> </div> <div class="col-xs-10 col-sm-10 col-xs-offset-1 setting-column" data-setting="colour" data-value="cream" title="Click to preview"> <p>Cream</p> </div> <div class="col-xs-11 col-sm-10 col-xs-offset-1 setting-column" data-setting="colour" data-value="contrast" title="Click to preview"> <p>Contrast</p> </div> <div class="col-xs-10 col-sm-10 col-xs-offset-1 setting-column" data-setting="colour" data-value="reverse" title="Click to preview"> <p>Reverse Contrast</p> </div> </div> <div class="row setting-row"> <div class="col-xs-24"> <strong>Font</strong> </div> </div> <div class="row setting-row"> <div class="col-xs-7 col-xs-offset-1 setting-column" data-setting="font" data-value="default" title="Click to preview"> <p>Default</p> </div> <div class="col-xs-7 col-xs-offset-1 setting-column" data-setting="font" data-value="Times New Roman" title="Click to preview" style="font-family:'Times New Roman';"> <p>Times New Roman</p> </div> <div class="col-xs-6 col-xs-offset-1 setting-column" data-setting="font" data-value="Arial, Helvetica, sans-serif" title="Click to preview" style="font-family:Arial, Helvetica, sans-serif;"> <p>Arial</p> </div> </div> <div class="row setting-row"> <div class="col-xs-24"> <strong>Font Size</strong> </div> </div> <div class="row setting-row"> <div class="col-xs-7 col-xs-offset-1 setting-column" data-setting="size" data-value="0" title="Click to preview"> <p>Default</p> </div> <div class="col-xs-7 col-xs-offset-1 setting-column" data-setting="size" data-value="1.1" title="Click to preview"> <p>Large</p> </div> <div class="col-xs-6 col-xs-offset-1 setting-column" data-setting="size" data-value="1.3" title="Click to preview"> <p>Larger</p> </div> </div> <div class="row setting-row"> <div class="col-xs-24"> <strong>Letter Spacing</strong> </div> </div> <div class="row setting-row"> <div class="col-xs-7 col-xs-offset-1 setting-column" data-setting="spacing" data-value="0" title="Click to preview"> <p>Default</p> </div> <div class="col-xs-7 col-xs-offset-1 setting-column" data-setting="spacing" data-value="1.5" title="Click to preview" style="letter-spacing: 1.5px"> <p>Wide</p> </div> <div class="col-xs-6 col-xs-offset-1 setting-column" data-setting="spacing" data-value="2" title="Click to preview" style="letter-spacing: 2px"> <p>Wider</p> </div> </div> </div> </div> <div class="modal-footer"> <div class="row"> <div class="col-xs-8"> <button class="btn btn-block btn-accessibility btn-danger btn-cancel">Cancel</button> </div> <div class="col-xs-8"> <button class="btn btn-block btn-accessibility btn-info btn-reset">Reset</button> </div> <div class="col-xs-8"> <button class="btn btn-block btn-accessibility btn-primary btn-apply">Apply</button> </div> </div> </div> </div> </div> </div> <div id="pop-search" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="pop-search"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Closes the modal"><span aria-hidden="true">×</span></button> </div> <div class="modal-body"> <div class="row search"> <div class="col-xs-20 col-xs-offset-2"> <div class="plate plate-light text-center"> <h3>What can we help you find?</h3> <form name="search" action="/search/index.cfm" method="post"> <label class="sr-only" for="frmSearchTerm2" aria-labelledby="frmSearchTerm2">Enter search term</label> <div class="group-input"> <input type="hidden" name="searchtype" value="1"> <input type="text" class="search-bar" name="frmSearchTerm" id="frmSearchTerm2" placeholder="Search..."> <button type="submit" class="btn-icon" title="search"> <i class="fa fa-search fa-2x"></i><span class="sr-only">Search</span> </button> </div> </form> </div> </div> </div> </div> </div> </div> </div> <div id="quick-links" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="quick-links"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Closes the modal"><span aria-hidden="true">×</span></button> </div> <div class="modal-body"> <div class="row visible-xs hidden-lg hidden-md hidden-sm"> <div class="page-nav col-xs-22 col-xs-offset-1 col-sm-7 col-sm-offset-1"> <div class="alert alert-info">No other pages in this section</div> </div> </div> </div> </div> </div> </div> <div id="rpi" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="rpi"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Closes the modal"><span aria-hidden="true">×</span></button> </div> <div class="modal-body"> </div> </div> </div> </div> <ul id="ui-id-1" tabindex="0" class="ui-menu ui-widget ui-widget-content ui-autocomplete ui-front" style="display: none; position: relative; top: 196px; left: 423.125px; width: 384px;"></ul><div role="status" aria-live="assertive" aria-relevant="additions" class="ui-helper-hidden-accessible"></div></body></html>
42.858961
765
0.579919
cba880dede7e690e1f6ada77cfc0ef3816f44147
1,462
go
Go
scanner/licenses_scanner.go
tmaczukin/goliscan
ffd3a8305182d83baa66de5d8993f775b32dd4de
[ "MIT" ]
1
2018-09-30T23:03:31.000Z
2018-09-30T23:03:31.000Z
scanner/licenses_scanner.go
tmaczukin/goliscan
ffd3a8305182d83baa66de5d8993f775b32dd4de
[ "MIT" ]
null
null
null
scanner/licenses_scanner.go
tmaczukin/goliscan
ffd3a8305182d83baa66de5d8993f775b32dd4de
[ "MIT" ]
null
null
null
package scanner import ( "os" "path/filepath" "strings" "github.com/ryanuber/go-license" ) type LicensesScanner struct{} func (l *LicensesScanner) GetLicenses(root string) (licenses map[string]*license.License, err error) { pkgScanner := NewPackagesScanner() pkgNames, err := pkgScanner.GetPackages(root) if err != nil { return } licenses = make(map[string]*license.License) for pkgName := range pkgNames { finalPkgName, lic, err := l.getPkgLicense(root, pkgName) if err != nil || lic == nil { continue } licenses[finalPkgName] = lic } return } func (l *LicensesScanner) getPkgLicense(root, pkgName string) (finalPkgName string, lic *license.License, err error) { finalPkgName = pkgName path := filepath.Join(root, "vendor", pkgName) pkgPath, err := os.Stat(path) if err != nil { return } if pkgPath.IsDir() { lic, err = license.NewFromDir(path) if err != nil { if err.Error() == license.ErrNoLicenseFile { return l.lookupPkgParentDir(root, pkgName) } return } } return } func (l *LicensesScanner) lookupPkgParentDir(root, pkgName string) (FinalPkgName string, lic *license.License, err error) { FinalPkgName = pkgName parts := strings.Split(pkgName, "/") partsCount := len(parts) if partsCount < 2 { return } FinalPkgName = strings.Join(parts[:partsCount-1], "/") return l.getPkgLicense(root, FinalPkgName) } func NewLicenseScanner() *LicensesScanner { return &LicensesScanner{} }
20.305556
123
0.698358
a1c307059c3ee5993630eca3fb446c246ebdb584
4,555
c
C
drivers/spi/kirkwood_spi.c
WA2301/uboot-2011.06
0afa645d678b19206669ef606884bce5e3332077
[ "Intel", "Unlicense" ]
10
2015-02-28T21:05:37.000Z
2021-09-16T04:57:27.000Z
drivers/spi/kirkwood_spi.c
WA2301/uboot-2011.06
0afa645d678b19206669ef606884bce5e3332077
[ "Intel", "Unlicense" ]
1
2021-02-24T05:16:58.000Z
2021-02-24T05:16:58.000Z
drivers/spi/kirkwood_spi.c
WA2301/uboot-2011.06
0afa645d678b19206669ef606884bce5e3332077
[ "Intel", "Unlicense" ]
7
2020-09-08T15:14:34.000Z
2021-06-24T18:03:49.000Z
/* * (C) Copyright 2009 * Marvell Semiconductor <www.marvell.com> * Written-by: Prafulla Wadaskar <prafulla@marvell.com> * * Derived from drivers/spi/mpc8xxx_spi.c * * See file CREDITS for list of people who contributed to this * project. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA */ #include <common.h> #include <malloc.h> #include <spi.h> #include <asm/arch/kirkwood.h> #include <asm/arch/spi.h> #include <asm/arch/mpp.h> static struct kwspi_registers *spireg = (struct kwspi_registers *)KW_SPI_BASE; struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, unsigned int max_hz, unsigned int mode) { struct spi_slave *slave; u32 data; u32 kwspi_mpp_config[] = { MPP0_GPIO, MPP7_SPI_SCn, 0 }; if (!spi_cs_is_valid(bus, cs)) return NULL; slave = malloc(sizeof(struct spi_slave)); if (!slave) return NULL; slave->bus = bus; slave->cs = cs; writel(~KWSPI_CSN_ACT | KWSPI_SMEMRDY, &spireg->ctrl); /* calculate spi clock prescaller using max_hz */ data = ((CONFIG_SYS_TCLK / 2) / max_hz) & KWSPI_CLKPRESCL_MASK; data |= 0x10; /* program spi clock prescaller using max_hz */ writel(KWSPI_ADRLEN_3BYTE | data, &spireg->cfg); debug("data = 0x%08x \n", data); writel(KWSPI_SMEMRDIRQ, &spireg->irq_cause); writel(KWSPI_IRQMASK, spireg->irq_mask); /* program mpp registers to select SPI_CSn */ if (cs) { kwspi_mpp_config[0] = MPP0_GPIO; kwspi_mpp_config[1] = MPP7_SPI_SCn; } else { kwspi_mpp_config[0] = MPP0_SPI_SCn; kwspi_mpp_config[1] = MPP7_GPO; } kirkwood_mpp_conf(kwspi_mpp_config); return slave; } void spi_free_slave(struct spi_slave *slave) { free(slave); } int spi_claim_bus(struct spi_slave *slave) { return 0; } void spi_release_bus(struct spi_slave *slave) { } #ifndef CONFIG_SPI_CS_IS_VALID /* * you can define this function board specific * define above CONFIG in board specific config file and * provide the function in board specific src file */ int spi_cs_is_valid(unsigned int bus, unsigned int cs) { return (bus == 0 && (cs == 0 || cs == 1)); } #endif void spi_cs_activate(struct spi_slave *slave) { writel(readl(&spireg->ctrl) | KWSPI_IRQUNMASK, &spireg->ctrl); } void spi_cs_deactivate(struct spi_slave *slave) { writel(readl(&spireg->ctrl) & KWSPI_IRQMASK, &spireg->ctrl); } int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { unsigned int tmpdout, tmpdin; int tm, isread = 0; debug("spi_xfer: slave %u:%u dout %08X din %08X bitlen %u\n", slave->bus, slave->cs, dout, din, bitlen); if (flags & SPI_XFER_BEGIN) spi_cs_activate(slave); /* * handle data in 8-bit chunks * TBD: 2byte xfer mode to be enabled */ writel(((readl(&spireg->cfg) & ~KWSPI_XFERLEN_MASK) | KWSPI_XFERLEN_1BYTE), &spireg->cfg); while (bitlen > 4) { debug("loopstart bitlen %d\n", bitlen); tmpdout = 0; /* Shift data so it's msb-justified */ if (dout) tmpdout = *(u32 *) dout & 0x0ff; writel(~KWSPI_SMEMRDIRQ, &spireg->irq_cause); writel(tmpdout, &spireg->dout); /* Write the data out */ debug("*** spi_xfer: ... %08x written, bitlen %d\n", tmpdout, bitlen); /* * Wait for SPI transmit to get out * or time out (1 second = 1000 ms) * The NE event must be read and cleared first */ for (tm = 0, isread = 0; tm < KWSPI_TIMEOUT; ++tm) { if (readl(&spireg->irq_cause) & KWSPI_SMEMRDIRQ) { isread = 1; tmpdin = readl(&spireg->din); debug ("spi_xfer: din %08x..%08x read\n", din, tmpdin); if (din) { *((u8 *) din) = (u8) tmpdin; din += 1; } if (dout) dout += 1; bitlen -= 8; } if (isread) break; } if (tm >= KWSPI_TIMEOUT) printf("*** spi_xfer: Time out during SPI transfer\n"); debug("loopend bitlen %d\n", bitlen); } if (flags & SPI_XFER_END) spi_cs_deactivate(slave); return 0; }
24.489247
78
0.682108
60fea0782b8accea07651cc8276186e6e3257f1d
452
kt
Kotlin
app/src/main/java/uk/nhs/nhsx/sonar/android/app/registration/ActivationCodeProvider.kt
wardog1uk/COVID-19-app-Android-BETA
ebcb3221b89333d9f555592aebc934d06608d784
[ "MIT" ]
864
2020-05-07T17:48:19.000Z
2021-02-10T23:46:34.000Z
app/src/main/java/uk/nhs/nhsx/sonar/android/app/registration/ActivationCodeProvider.kt
wardog1uk/COVID-19-app-Android-BETA
ebcb3221b89333d9f555592aebc934d06608d784
[ "MIT" ]
50
2020-05-07T18:55:17.000Z
2020-06-26T12:19:41.000Z
app/src/main/java/uk/nhs/nhsx/sonar/android/app/registration/ActivationCodeProvider.kt
wardog1uk/COVID-19-app-Android-BETA
ebcb3221b89333d9f555592aebc934d06608d784
[ "MIT" ]
184
2020-05-07T17:48:24.000Z
2021-03-15T05:47:47.000Z
/* * Copyright © 2020 NHSX. All rights reserved. */ package uk.nhs.nhsx.sonar.android.app.registration import android.content.Context import uk.nhs.nhsx.sonar.android.app.util.SharedPreferenceStringProvider import javax.inject.Inject class ActivationCodeProvider @Inject constructor(context: Context) : SharedPreferenceStringProvider( context, preferenceName = "activationCode", preferenceKey = "ACTIVATION_CODE" )
26.588235
72
0.756637
0acd874001e7ba384d314f53dc083023f4894f7e
1,368
asm
Assembly
programs/oeis/037/A037251.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/037/A037251.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/037/A037251.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A037251: a(n) = n^3*(n^3 + 1)*(n-1). ; 0,0,72,1512,12480,63000,234360,707952,1838592,4257360,9009000,17728920,32864832,57948072,97919640,159516000,251719680,386279712,578306952,846949320,1216152000,1715507640,2381201592,3257057232,4395686400,5859750000,7723333800,10073444472,13011630912,16655735880,21141783000,26626004160,33287012352,41328124992,50979842760,62502489000,76189014720,92367974232,111406676472,133714517040,159746496000,190006926480,225053339112,265500587352,312025158720,365369697000,426347740440,495848680992,574842949632,664387432800,765631125000,879821022600,1008308263872,1152554520312,1314138644280,1494763578000,1696263528960,1920611416752,2169926596392,2446482863160,2752716744000,3091236080520,3464828908632,3876472639872,4329343549440,4826826576000,5372525438280,5970273073512,6624142402752,7338457428120,8117804667000,8967044928240,9891325435392,10896092302032,11987103364200,13170441375000,14452527566400,15840135583272,17340405794712,18960859987680,20709416448000,22594405433760,24624585046152,26809157502792,29157785818560,31680610899000,34388269051320,37291909918032,40403214838272,43734415641840,47298313881000,51108300505080,55178375982912,59523170878152,64157966882520,69098718312000,74362074071040,79965400089792,85926802239432,92265149730600 mov $1,$0 sub $0,1 mov $3,$1 mul $3,$1 mov $2,$3 pow $2,2 add $2,$1 mul $2,$3 mul $0,$2
105.230769
1,239
0.876462
4a66e1d4dcdfe84bc5f51787550ea4f3ba4c1128
4,492
js
JavaScript
static/jscript/player/flowplayer/core.js
Elshara/PHPFox-Legacy
df0cbf2be0b807d17f3c9fca8cde0ed03492e563
[ "MIT" ]
null
null
null
static/jscript/player/flowplayer/core.js
Elshara/PHPFox-Legacy
df0cbf2be0b807d17f3c9fca8cde0ed03492e563
[ "MIT" ]
null
null
null
static/jscript/player/flowplayer/core.js
Elshara/PHPFox-Legacy
df0cbf2be0b807d17f3c9fca8cde0ed03492e563
[ "MIT" ]
null
null
null
$Core.player = { aParams: {}, supportsVideo: function(){ return !!document.createElement('video').canPlayType; }, canPlayVideo: function(){ var bCanPlay = false; if (this.supportsVideo()){ var v = document.createElement('video'); if (v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')){ bCanPlay = true; p('Supports: video/mp4'); } else if (v.canPlayType('video/ogg; codecs="theora, vorbis"')){ bCanPlay = true; p('Supports: video/ogg'); } else if (v.canPlayType('video/webm; codecs="vp8, vorbis"')){ bCanPlay = true; p('Supports: video/webm'); } } return bCanPlay; }, load: function(aParams) { if (document.getElementById(aParams['id']) === null) { return false; } this.aParams = aParams; if (getParam('bUseHTML5Video') && this.aParams['type'] == 'video' && this.canPlayVideo()){ var sHtml = ''; sHtml += '<video width="600" height="366" preload="auto" controls autoplay>'; sHtml += '<source type="video/webm" src="' + aParams['play'].replace('.flv', '.webm') + '">'; sHtml += '<source type="video/mp4" src="' + aParams['play'].replace('.flv', '.mp4') + '">'; sHtml += '<source type="video/ogg" src="' + aParams['play'].replace('.flv', '.ogg') + '">'; sHtml += '</video>'; $('#' + this.aParams['id'] + '').html(sHtml); return this; } var sCall = '$f(\'' + this.aParams['id'] + '\', {src: \'' + getParam('sJsStatic') + 'jscript/player/flowplayer/flowplayer.swf\', wmode: \'transparent\', zIndex: -1},{'; switch (this.aParams['type']) { case 'video': sCall += 'clip: {'; sCall += 'url: \'' + (getParam('bUseHTML5Video') ? this.aParams['play'].replace('.flv', '.mp4') : this.aParams['play']) + '\','; sCall += 'autoBuffering: true,'; if (isset(this.aParams['auto'])) { sCall += 'autoPlay: ' + this.aParams['auto']; } sCall = rtrim(sCall, ','); sCall += '}'; break; case 'music': sCall += 'clip: {'; if (!empty(this.aParams['play'])) { sCall += 'url: \'' + this.aParams['play'] + '\','; } if (isset(this.aParams['on_finish'])) { sCall += 'onFinish: ' + this.aParams['on_finish'] + ','; } else { if (this.aParams['playlist'] != undefined) { sCall += 'onFinish: function(clip){\n'; sCall += 'debug("Event onFinish triggered");'; sCall += 'var aPlaylist = {\n'; for (oPlay in this.aParams['playlist']) { sCall += '"' + this.aParams['playlist'][oPlay] + '" : \n{"iNext" : ' + this.aParams['aNextSong'][oPlay] +', "sNextPath" : "' + this.aParams['playlist'][this.aParams['aNextSong'][oPlay]] + '"},'; } sCall = rtrim( sCall, ','); sCall += '};'; sCall += '\n$(".isSelected").removeClass("isSelected");'; sCall += '\n$("#js_music_track_" + aPlaylist[clip.originalUrl]["iNext"]).addClass("isSelected");'; sCall += '$f().unload();'; sCall += '\n$Core.player.play("'+this.aParams['id']+'",aPlaylist[clip.originalUrl]["sNextPath"]);'; sCall += '$.ajaxCall(\'music.play\', \'id=\' + aPlaylist[clip.originalUrl]["iNext"], \'GET\');'; sCall += '},'; } } if (isset(this.aParams['on_start'])) { sCall += 'onStart: ' + this.aParams['on_start'] + ',' } sCall = rtrim(sCall, ','); sCall += '},'; sCall += 'plugins: {'; sCall += 'controls: {fullscreen: false, height: 30, autoHide: false},'; sCall += 'audio: {'; sCall += 'url: \'' + getParam('sJsStatic') + 'jscript/player/flowplayer/flowplayer.audio.swf\''; sCall += '}'; sCall += '}'; break; default: p('Not a valid call.'); break; } sCall += '});'; if (this.aParams['playlist'] != undefined) { // Lets play the first item for (var iSong in this.aParams['playlist']) { if (iSong != undefined) { sCall +='\n $Core.player.play("'+this.aParams['id']+'","'+this.aParams['playlist'][iSong]+'");'; sCall += '\n$.ajaxCall(\'music.play\',"id='+iSong +'", "GET");'; break; } } } //debug(sCall); eval(sCall); return this; }, play: function(sId, sPath) { p('#' + sId + ' Playing song: ' + sPath); $('#' + sId).show(); $f(sId).play(sPath); return false; } };
29.552632
204
0.512467
477bc1a4b7f52dc6519760bd86474df0cb4a7a6e
19,286
html
HTML
original_views/terms.html
sarriaroman/Coolpa
bdf3a287de29539f5d4e905475c7c603a3c613dd
[ "Apache-2.0" ]
2
2016-10-16T15:04:48.000Z
2017-03-21T15:23:51.000Z
original_views/terms.html
sarriaroman/Coolpa
bdf3a287de29539f5d4e905475c7c603a3c613dd
[ "Apache-2.0" ]
null
null
null
original_views/terms.html
sarriaroman/Coolpa
bdf3a287de29539f5d4e905475c7c603a3c613dd
[ "Apache-2.0" ]
null
null
null
<% include header.html %> <section id="slider-wrapper"> <div class="flexslider"> <ul class="slides"> <li> <% if( user == undefined ) { %> <img src="/images/top-header.jpg" alt="" /> <% } else { %> <img src="/avatars/<%= user %>/top.jpg" alt="" /> <% } %> <div id="main-description"> <h1>Welcome to Coolpa!</h1> <span>Find out what's up with your family and friends.</span> </div> </li> </ul> </div> </section> <section id="content-wrapper"> <div id="content"> <div id="timeline"> <div id="time-line"> </div> <div id="picture-profile"> <a href="/"> <% if( user == undefined ) { %> <img src="/avatars/avatar.jpg" /> <% } else { %> <img src="/avatars/<%= user %>/avatar.square.jpg" alt="" /> <% } %> </a> </div> <div id="profile-description"> <div class="timeline-preview"> <div class="timeline-icon-pp"><a href="/" class="icon-answer"></a></div> <div class="timeline-pointer-pp"><span class="tl-pointer"></span></div> <div class="timeline-content"> <p class="description"> <div class="textpost"> <h2 class="post-title">Terms of Services</h2> <span class="post-divider"></span> <p> 1. Basic Terms<br/><br/> You are responsible for your use of the Services, for any Content you post to the Services, and for any consequences thereof. The Content you submit, post, or display will be able to be viewed by other users of the Services and through third party services and websites. You should only provide Content that you are comfortable sharing with others under these Terms.<br/><br/> You may use the Services only if you can form a binding contract with Coolpa and are not a person barred from receiving services under the laws of the United States or other applicable jurisdiction. If you are accepting these Terms and using the Services on behalf of a company, organization, government, or other legal entity, you represent and warrant that you are authorized to do so. You may use the Services only in compliance with these Terms and all applicable local, state, national, and international laws, rules and regulations.<br/><br/> The Services that Coolpa provides are always evolving and the form and nature of the Services that Coolpa provides may change from time to time without prior notice to you. In addition, Coolpa may stop (permanently or temporarily) providing the Services (or any features within the Services) to you or to users generally and may not be able to provide you with prior notice. We also retain the right to create limits on use and storage at our sole discretion at any time without prior notice to you.<br/><br/> 2. Privacy<br/><br/> Any information that you provide to Coolpa is subject to our Privacy Policy, which governs our collection and use of your information. You understand that through your use of the Services you consent to the collection and use of this information, including the transfer of this information to the United States and/or other countries for storage, processing and use by Coolpa. As part of providing you the Services, we may need to provide you with certain communications, such as service announcements and administrative messages. These communications are considered part of the Services and your account, which you may not be able to opt-out from receiving.<br/><br/> 3. Content on the Services<br/><br/> All Content, whether publicly posted or privately transmitted, is the sole responsibility of the person who originated such Content. We may not monitor or control the Content posted via the Services and, we cannot take responsibility for such Content. Any use or reliance on any Content or materials posted via the Services or obtained by you through the Services is at your own risk. We do not endorse, support, represent or guarantee the completeness, truthfulness, accuracy, or reliability of any Content or communications posted via the Services or endorse any opinions expressed via the Services. You understand that by using the Services, you may be exposed to Content that might be offensive, harmful, inaccurate or otherwise inappropriate, or in some cases, postings that have been mislabeled or are otherwise deceptive. Under no circumstances will Coolpa be liable in any way for any Content, including, but not limited to, any errors or omissions in any Content, or any loss or damage of any kind incurred as a result of the use of any Content posted, emailed, transmitted or otherwise made available via the Services or broadcast elsewhere.<br/><br/> 4. Your Rights<br/><br/> You retain your rights to any Content you submit, post or display on or through the Services. By submitting, posting or displaying Content on or through the Services, you grant us a worldwide, non-exclusive, royalty-free license (with the right to sublicense) to use, copy, reproduce, process, adapt, modify, publish, transmit, display and distribute such Content in any and all media or distribution methods (now known or later developed). You agree that this license includes the right for the Service to provide, promote, and improve the Services and to make Content submitted to or through the Services available to other companies, organizations or individuals who partner with Coolpa for the syndication, broadcast, distribution or publication of such Content on other media and services, subject to our terms and conditions for such Content use.<br/> We may modify or adapt your Content in order to transmit, display or distribute it over computer networks and in various media and/or make changes to your Content as are necessary to conform and adapt that Content to any requirements or limitations of any networks, devices, services or media.<br/> You are responsible for your use of the Services, for any Content you provide, and for any consequences thereof, including the use of your Content by other users and our third party partners. You understand that your Content may be syndicated, broadcast, distributed, or published by our partners and if you do not have the right to submit Content for such use, it may subject you to liability. Coolpa will not be responsible or liable for any use of your Content by Coolpa in accordance with these Terms. You represent and warrant that you have all the rights, power and authority necessary to grant the rights granted herein to any Content that you submit.<br/><br/> 5. Your License To Use the Services<br/><br/> Coolpa gives you a personal, worldwide, royalty-free, non-assignable and non-exclusive license to use the software that is provided to you by Coolpa as part of the Services. This license is for the sole purpose of enabling you to use and enjoy the benefit of the Services as provided by Coolpa, in the manner permitted by these Terms.<br/><br/> 6. Our Rights<br/><br/> All right, title, and interest in and to the Services (excluding Content provided by users) are and will remain the exclusive property of Coolpa and its licensors. The Services are protected by copyright, trademark, and other laws of both the United States and foreign countries. Any feedback, comments, or suggestions you may provide regarding Coolpa, or the Services is entirely voluntary and we will be free to use such feedback, comments or suggestions as we see fit and without any obligation to you.<br/><br/> 7. Restrictions on Content and Use of the Services<br/><br/> Please review the Rules (which are part of these Terms) to better understand what is prohibited on the Service. We reserve the right at all times (but will not have an obligation) to remove or refuse to distribute any Content on the Services, to suspend or terminate users, and to reclaim usernames without liability to you. We also reserve the right to access, read, preserve, and disclose any information as we reasonably believe is necessary to (i) satisfy any applicable law, regulation, legal process or governmental request, (ii) enforce the Terms, including investigation of potential violations hereof, (iii) detect, prevent, or otherwise address fraud, security or technical issues, (iv) respond to user support requests, or (v) protect the rights, property or safety of Coolpa, its users and the public.<br/><br/> You may not do any of the following while accessing or using the Services: (i) access, tamper with, or use non-public areas of the Services, Coolpa’s computer systems, or the technical delivery systems of Coolpa’s providers; (ii) probe, scan, or test the vulnerability of any system or network or breach or circumvent any security or authentication measures; (iii) access or search or attempt to access or search the Services by any means (automated or otherwise) other than through our currently available, published interfaces that are provided by Coolpa (and only pursuant to those terms and conditions), unless you have been specifically allowed to do so in a separate agreement with Coolpa (NOTE: crawling the Services is permissible if done in accordance with the provisions of the robots.txt file, however, scraping the Services without the prior consent of Coolpa is expressly prohibited); (iv) forge any TCP/IP packet header or any part of the header information in any email or posting, or in any way use the Services to send altered, deceptive or false source-identifying information; or (v) interfere with, or disrupt, (or attempt to do so), the access of any user, host or network, including, without limitation, sending a virus, overloading, flooding, spamming, mail-bombing the Services, or by scripting the creation of Content in such a manner as to interfere with or create an undue burden on the Services.<br/><br/> 8. Copyright Policy<br/><br/> Coolpa respects the intellectual property rights of others and expects users of the Services to do the same. We will respond to notices of alleged copyright infringement that comply with applicable law and are properly provided to us. If you believe that your Content has been copied in a way that constitutes copyright infringement, please provide us with the following information: (i) a physical or electronic signature of the copyright owner or a person authorized to act on their behalf; (ii) identification of the copyrighted work claimed to have been infringed; (iii) identification of the material that is claimed to be infringing or to be the subject of infringing activity and that is to be removed or access to which is to be disabled, and information reasonably sufficient to permit us to locate the material; (iv) your contact information, including your address, telephone number, and an email address; (v) a statement by you that you have a good faith belief that use of the material in the manner complained of is not authorized by the copyright owner, its agent, or the law; and (vi) a statement that the information in the notification is accurate, and, under penalty of perjury, that you are authorized to act on behalf of the copyright owner.<br/><br/> We reserve the right to remove Content alleged to be infringing without prior notice, at our sole discretion, and without liability to you. In appropriate circumstances, Coolpa will also terminate a user’s account if the user is determined to be a repeat infringer.<br/><br/> 9. Ending These Terms<br/><br/> The Terms will continue to apply until terminated by either you or Coolpa as follows.<br/><br/> You may end your legal agreement with Coolpa at any time for any reason by deactivating your accounts and discontinuing your use of the Services. You do not need to specifically inform Coolpa when you stop using the Services. If you stop using the Services without deactivating your accounts, your accounts may be deactivated due to prolonged inactivity.<br/><br/> We may suspend or terminate your accounts or cease providing you with all or part of the Services at any time for any reason, including, but not limited to, if we reasonably believe: (i) you have violated these Terms or the Rules, (ii) you create risk or possible legal exposure for us; or (iii) our provision of the Services to you is no longer commercially viable. We will make reasonable efforts to notify you by the email address associated with your account or the next time you attempt to access your account.<br/> In all such cases, the Terms shall terminate, including, without limitation, your license to use the Services, except that sections shall continue to apply.<br/> Nothing in this section shall affect Coolpa’s rights to change, limit or stop the provision of the Services without prior notice, as provided above in section 1.<br/><br/> 10.Disclaimers and Limitations of Liability<br/><br/> Please read this section carefully since it limits the liability of Coolpa and its parents, subsidiaries, affiliates, related companies, officers, directors, employees, agents, representatives, partners, and licensors (collectively, the “Coolpa Entities”). Each of the subsections below only applies up to the maximum extent permitted under applicable law. Some jurisdictions do not allow the disclaimer of implied warranties or the limitation of liability in contracts, and as a result the contents of this section may not apply to you. Nothing in this section is intended to limit any rights you may have which may not be lawfully limited.<br/><br/> A. The Services are Available "AS-IS"<br/><br/> Your access to and use of the Services or any Content are at your own risk. You understand and agree that the Services are provided to you on an "AS IS" and "AS AVAILABLE" basis. Without limiting the foregoing, to the maximum extent permitted under applicable law, THE COOLPA ENTITIES DISCLAIM ALL WARRANTIES AND CONDITIONS, WHETHER EXPRESS OR IMPLIED, OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.<br/> The Coolpa Entities make no warranty and disclaim all responsibility and liability for: (i) the completeness, accuracy, availability, timeliness, security or reliability of the Services or any Content; (ii) any harm to your computer system, loss of data, or other harm that results from your access to or use of the Services or any Content; (iii) the deletion of, or the failure to store or to transmit, any Content and other communications maintained by the Services; and (iv) whether the Services will meet your requirements or be available on an uninterrupted, secure, or error-free basis. No advice or information, whether oral or written, obtained from the Coolpa Entities or through the Services, will create any warranty not expressly made herein.<br/><br/> B. Links<br/><br/> The Services may contain links to third-party websites or resources. You acknowledge and agree that the Coolpa Entities are not responsible or liable for: (i) the availability or accuracy of such websites or resources; or (ii) the content, products, or services on or available from such websites or resources. Links to such websites or resources do not imply any endorsement by the Coolpa Entities of such websites or resources or the content, products, or services available from such websites or resources. You acknowledge sole responsibility for and assume all risk arising from your use of any such websites or resources.<br/><br/> C. Limitation of Liability<br/><br/> TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE COOLPA ENTITIES SHALL NOT BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL OR PUNITIVE DAMAGES, OR ANY LOSS OF PROFITS OR REVENUES, WHETHER INCURRED DIRECTLY OR INDIRECTLY, OR ANY LOSS OF DATA, USE, GOOD-WILL, OR OTHER INTANGIBLE LOSSES, RESULTING FROM (i) YOUR ACCESS TO OR USE OF OR INABILITY TO ACCESS OR USE THE SERVICES; (ii) ANY CONDUCT OR CONTENT OF ANY THIRD PARTY ON THE SERVICES, INCLUDING WITHOUT LIMITATION, ANY DEFAMATORY, OFFENSIVE OR ILLEGAL CONDUCT OF OTHER USERS OR THIRD PARTIES; (iii) ANY CONTENT OBTAINED FROM THE SERVICES; OR (iv) UNAUTHORIZED ACCESS, USE OR ALTERATION OF YOUR TRANSMISSIONS OR CONTENT.<br/> IN NO EVENT SHALL THE AGGREGATE LIABILITY OF THE COOLPA ENTITIES EXCEED THE GREATER OF ONE HUNDRED U.S. DOLLARS (U.S. $100.00) OR THE AMOUNT YOU PAID COOLPA, IF ANY, IN THE PAST SIX MONTHS FOR THE SERVICES GIVING RISE TO THE CLAIM.<br/> THE LIMITATIONS OF THIS SUBSECTION SHALL APPLY TO ANY THEORY OF LIABILITY, WHETHER BASED ON WARRANTY, CONTRACT, STATUTE, TORT (INCLUDING NEGLIGENCE) OR OTHERWISE, AND WHETHER OR NOT THE COOLPA ENTITIES HAVE BEEN INFORMED OF THE POSSIBILITY OF ANY SUCH DAMAGE, AND EVEN IF A REMEDY SET FORTH HEREIN IS FOUND TO HAVE FAILED OF ITS ESSENTIAL PURPOSE.<br/><br/> 11. General Terms<br/><br/> A. Waiver and Severability<br/><br/> The failure of Coolpa to enforce any right or provision of these Terms will not be deemed a waiver of such right or provision. In the event that any provision of these Terms is held to be invalid or unenforceable, then that provision will be limited or eliminated to the minimum extent necessary, and the remaining provisions of these Terms will remain in full force and effect.<br/><br/> B. Entire Agreement<br/><br/> These Terms, the Rules and our Privacy Policy are the entire and exclusive agreement between Coolpa and you regarding the Services (excluding any services for which you have a separate agreement with Coolpa that is explicitly in addition or in place of these Terms), and these Terms supersede and replace any prior agreements between Coolpa and you regarding the Services. Other than members of the group of companies of which Coolpa is the parent, no other person or company will be third party beneficiaries to the Terms.<br/> We may revise these Terms from time to time, the most current version will always be at http://coolpa.net/terms. If the revision, in our sole discretion, is material we will notify you via an “<a href="/users/coolpa">:coolpa</a>” update or e-mail to the email associated with your account. By continuing to access or use the Services after those revisions become effective, you agree to be bound by the revised Terms. </p> </div> </p> </div> <div class="timeline-bar"> <div> <a class="btn" href="/">Back to Coolpa</a> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </section> <% include footer.html %>
160.716667
1,433
0.733641
07f205af7cfcd1928466f554bc025d226ccbdfdc
5,338
rs
Rust
readerwriter/src/reader.rs
zaimusho/slingshot-pipeline
3aac9c7962ce6e07d2efbea788ed118a62eff947
[ "Apache-2.0" ]
351
2019-05-06T20:30:37.000Z
2022-03-05T17:26:20.000Z
readerwriter/src/reader.rs
zaimusho/slingshot-pipeline
3aac9c7962ce6e07d2efbea788ed118a62eff947
[ "Apache-2.0" ]
141
2019-02-07T19:46:07.000Z
2019-04-29T18:38:32.000Z
readerwriter/src/reader.rs
zaimusho/slingshot-pipeline
3aac9c7962ce6e07d2efbea788ed118a62eff947
[ "Apache-2.0" ]
59
2019-05-09T23:49:50.000Z
2022-03-21T05:20:35.000Z
use std::error::Error; use std::fmt::{Display, Formatter}; /// Error kinds returns by the reader. #[derive(Debug)] pub enum ReadError { InsufficientBytes, TrailingBytes, InvalidFormat, Custom(Box<dyn Error + Send + Sync>), } impl Display for ReadError { fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> { match self { ReadError::InsufficientBytes => write!(f, "insufficient bytes"), ReadError::TrailingBytes => write!(f, "trailing bytes"), ReadError::InvalidFormat => write!(f, "invalid format"), ReadError::Custom(d) => d.fmt(f), } } } impl std::error::Error for ReadError {} /// An interface for reading binary data. pub trait Reader { /// Copies bytes into a slice. If there is not enough bytes available, /// does not consume any byte and returns ReadError::InsufficientBytes. fn read(&mut self, dst: &mut [u8]) -> Result<(), ReadError>; /// Advances the internal cursor by the number of bytes. /// If there is not enough bytes, does nothing and returns ReadError::InsufficientBytes. fn advance(&mut self, cnt: usize) -> Result<(), ReadError>; /// Returns remaining number of bytes available for reading. fn remaining_bytes(&self) -> usize; /// Wraps the reading logic in a block that checks that all bytes have been read. /// If some are left unread, returns `Err(From<ReadError::TrailingBytes>)`. /// Use method `skip_trailing_bytes` to ignore trailing bytes. #[inline] fn read_all<F, T, E>(&mut self, closure: F) -> Result<T, E> where F: FnOnce(&mut Self) -> Result<T, E>, E: From<ReadError>, { let result = closure(self)?; if self.remaining_bytes() != 0 { return Err(ReadError::TrailingBytes.into()); } Ok(result) } /// Marks remaining unread bytes as read so that `read_all` does not fail. /// After calling this method, no more bytes can be read. #[inline] fn skip_trailing_bytes(&mut self) -> usize { let rem = self.remaining_bytes(); self.advance(rem) .expect("Reader::advance(remaining()) should never fail"); rem } /// Reads a single byte. #[inline] fn read_u8(&mut self) -> Result<u8, ReadError> { let mut buf = [0u8; 1]; self.read(&mut buf)?; Ok(buf[0]) } /// Reads a 4-byte LE32 integer. #[inline] fn read_u32(&mut self) -> Result<u32, ReadError> { let mut buf = [0u8; 4]; self.read(&mut buf)?; Ok(u32::from_le_bytes(buf)) } /// Reads an 8-byte LE64 integer. #[inline] fn read_u64(&mut self) -> Result<u64, ReadError> { let mut buf = [0u8; 8]; self.read(&mut buf)?; Ok(u64::from_le_bytes(buf)) } /// Reads a 32-byte string. #[inline] fn read_u8x32(&mut self) -> Result<[u8; 32], ReadError> { let mut buf = [0u8; 32]; self.read(&mut buf)?; Ok(buf) } /// Reads a 64-byte string. #[inline] fn read_u8x64(&mut self) -> Result<[u8; 64], ReadError> { let mut buf = [0u8; 64]; self.read(&mut buf)?; Ok(buf) } /// Reads a vector of bytes with the required length. #[inline] fn read_bytes(&mut self, len: usize) -> Result<Vec<u8>, ReadError> { if self.remaining_bytes() < len { // this early check is to avoid allocating a vector // if we don't have enough data. return Err(ReadError::InsufficientBytes); } let mut vec = Vec::with_capacity(len); vec.resize(len, 0u8); self.read(&mut vec)?; Ok(vec) } /// Reads a vector of items with the required count and a minimum item size. #[inline] fn read_vec<T, E>( &mut self, len: usize, closure: impl Fn(&mut Self) -> Result<T, E>, ) -> Result<Vec<T>, E> where E: From<ReadError>, { if len > self.remaining_bytes() { return Err(ReadError::InsufficientBytes.into()); } let mut vec = Vec::new(); for _ in 0..len { vec.push(closure(self)?); } Ok(vec) } } impl Reader for &[u8] { #[inline] fn read(&mut self, dst: &mut [u8]) -> Result<(), ReadError> { let n = dst.len(); if n <= self.len() { let (a, b) = self.split_at(n); if n == 1 { dst[0] = a[0]; } else { dst.copy_from_slice(a); } *self = b; Ok(()) } else { Err(ReadError::InsufficientBytes) } } #[inline] fn read_u8(&mut self) -> Result<u8, ReadError> { if self.len() > 0 { let x = self[0]; let (_, rest) = self.split_at(1); *self = rest; Ok(x) } else { Err(ReadError::InsufficientBytes) } } #[inline] fn advance(&mut self, n: usize) -> Result<(), ReadError> { if n <= self.len() { let (_, b) = self.split_at(n); *self = b; Ok(()) } else { Err(ReadError::InsufficientBytes) } } #[inline] fn remaining_bytes(&self) -> usize { self.len() } }
28.854054
92
0.53728
21fc29ab02254584911b0b477d2a49f5d34b735c
569
html
HTML
ietf/templates/doc/drafts_for_ad.html
ekr/ietfdb
8d936836b0b9ff31cda415b0a423e3f5b33ab695
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
2
2021-11-20T03:40:56.000Z
2021-11-20T03:40:59.000Z
ietf/templates/doc/drafts_for_ad.html
ekr/ietfdb
8d936836b0b9ff31cda415b0a423e3f5b33ab695
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
ietf/templates/doc/drafts_for_ad.html
ekr/ietfdb
8d936836b0b9ff31cda415b0a423e3f5b33ab695
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
{% extends "base.html" %} {# Copyright The IETF Trust 2015, All Rights Reserved #} {% load origin staticfiles %} {% block pagehead %} <link rel="stylesheet" href="{% static "jquery.tablesorter/css/theme.bootstrap.min.css" %}"> {% endblock %} {% block title %}Documents for {{ ad_name }}{% endblock %} {% block content %} {% origin %} <h1>Documents for {{ ad_name }}</h1> {% include "doc/search/search_results.html" %} {% endblock %} {% block js %} <script src="{% static "jquery.tablesorter/js/jquery.tablesorter.combined.min.js" %}"></script> {% endblock %}
28.45
95
0.652021
9bb158a1190b5261349012c4855a7b08bb6b2efb
523
js
JavaScript
xxc/app/utils/limit-time-promise.js
lizhongyi1992/xuanxuan
1db9353bdef379ee986418739785a2cd6fa39b5f
[ "ZPL-1.1" ]
1
2017-07-16T11:04:07.000Z
2017-07-16T11:04:07.000Z
xxc/app/utils/limit-time-promise.js
CoffeeDi/xuanxuan
1db9353bdef379ee986418739785a2cd6fa39b5f
[ "ZPL-1.1" ]
2
2017-11-13T01:34:49.000Z
2019-07-28T07:49:51.000Z
xxc/app/utils/limit-time-promise.js
CoffeeDi/xuanxuan
1db9353bdef379ee986418739785a2cd6fa39b5f
[ "ZPL-1.1" ]
4
2019-11-05T09:17:25.000Z
2021-03-31T09:10:27.000Z
/** * 创建一个限时 Promise,超过一定的时间,如果传入的 Promise 仍然未能执行成功则返回的 Promise 直接失败 * * @param {Promise} promise 要执行的 Promise * @param {number} [timeout=15000] 限时,单位毫秒 * @param {string|Error} timeoutError 超时出错信息 * @return {Promise} 返回一个新的 Promise */ export default (promise, timeout = 15000, timeoutError = 'TIMEOUT') => { const timeoutPromise = new Promise((resolve, reject) => { setTimeout(() => { reject(timeoutError); }, timeout); }); return Promise.race([promise, timeoutPromise]); };
29.055556
72
0.650096
d2d370a4a8ed6410d36a51118725e1a8d066fd9f
2,342
php
PHP
config/assets.config.php
agerecompany/zfc-communicator
80071a77bdb6d2bc83457cc94ef6ef3432c38ce2
[ "MIT" ]
null
null
null
config/assets.config.php
agerecompany/zfc-communicator
80071a77bdb6d2bc83457cc94ef6ef3432c38ce2
[ "MIT" ]
null
null
null
config/assets.config.php
agerecompany/zfc-communicator
80071a77bdb6d2bc83457cc94ef6ef3432c38ce2
[ "MIT" ]
null
null
null
<?php namespace Agere\Communicator; return [ /*'default' => [ 'assets' => [ //'@cartDefault_css', '@scheduler_js', '@scheduler_css', ], 'options' => [ 'mixin' => true, ], ],*/ 'controllers' => [ 'communicator' => [ '@communicator_css', '@communicator_js', ], ], 'modules' => [ __NAMESPACE__ => [ 'root_path' => __DIR__ . '/../view/assets', 'collections' => [ 'communicator_css' => [ 'assets' => [ 'css/dhtmlx/dhtmlxscheduler_flat.css', //'css/dhtmlx/dhtmlxscheduler.css', 'css/agere.scheduler.css' ], ], 'communicator_js' => [ 'assets' => [ 'js/dhtmlx/dhtmlxscheduler.js', 'js/dhtmlx/dhtmlxscheduler_readonly.js', 'js/dhtmlx/dhtmlxscheduler_minical.js', 'js/dhtmlx/dhtmlxscheduler_pdf.js', 'js/dhtmlx/locale/locale_ru.js', 'js/dhtmlx/dhtmlxscheduler_active_links.js', 'js/dhtmlx/dhtmlxscheduler_limit.js', 'js/agere.scheduler.js', /*'js/dhtmlx/dhtmlxscheduler_readonly.js', 'js/dhtmlx/dhtmlxscheduler_agenda_view.js', 'js/dhtmlx/dhtmlxscheduler_minical.js', 'js/dhtmlx/dhtmlxscheduler_pdf.js', 'js/dhtmlx/dhtmlxscheduler.js', 'js/dhtmlx/dhtmlxscheduler_limit.js', 'js/dhtmlx/dhtmlxscheduler_quick_info.js', 'js/dhtmlx/dhtmlxscheduler_year_view.js', 'js/dhtmlx/dhtmlxscheduler_active_links.js', 'js/agere.scheduler.js', 'js/dhtmlx/locale/locale_ru.js',*/ ], ], 'communicator_images' => [ 'assets' => [ 'images/*.gif', 'images/*.png', ], ], ], ], ], ];
34.955224
68
0.407344
1f89c02ce2edd79fe93f7058111ebec7bdc04be8
1,682
css
CSS
style2.css
mohammadhessami/portfolie
d457fc9d7ad6ab5612ea4d82992789a7b328340b
[ "MIT" ]
null
null
null
style2.css
mohammadhessami/portfolie
d457fc9d7ad6ab5612ea4d82992789a7b328340b
[ "MIT" ]
null
null
null
style2.css
mohammadhessami/portfolie
d457fc9d7ad6ab5612ea4d82992789a7b328340b
[ "MIT" ]
null
null
null
@import url("https://fonts.googleapis.com/css?family=Montserrat|Playfair+Display+SC"); @import url("https://fonts.googleapis.com/css?family=Amatic+SC"); .main { background-image: url(w.jpg); background-position: center; background-size: cover; background-repeat: no-repeat; } #font h1 { color: #dd4b39; font-family: "Amatic SC", cursive; } #font p { font-family: "Cormorant Garamond", serif; } strong { font-size: 80px; } #list a { color: black; } #logo { color: blueviolet; text-decoration: none; text-shadow: 1px 1px 5px; } .main { text-shadow: 2px 2px 10px black; margin-top: -50px; height: 600px; } .main p { font-size: 25px; } #about3 div { font-size: 200px; } #about3 { background-color: rgb(224, 213, 213); } .jumbotron { position: relative; height: 20%; width: 100%; background: #358cce; color: #fff; border-radius: 0px; } .jumbotron-sm { padding-top: 24px; padding-bottom: 24px; } .h1 small { font-size: 24px; } .fa { padding: 20px; font-size: 15px; width: 50px; text-align: center; text-decoration: none; margin: 5px 2px; } .fa:hover { opacity: 0.7; } .fa-facebook { background: #3b5998; color: white; } .fa-twitter { background: #55acee; color: white; } .fa-google { background: #dd4b39; color: white; } .fa-linkedin { background: #007bb5; color: white; } .fa-youtube { background: #bb0000; color: white; } .fa-instagram { background: #125688; color: white; } .back-to-top { cursor: pointer; position: fixed; bottom: 20px; right: 20px; display: none; } @media (max-width: 600px) { .jumbotron2 { margin-left: 0; } .icon { margin-left: 0; } }
14.254237
86
0.636742
dde0fd8d453756154cf7ebb7976b53431b94c50c
1,907
php
PHP
app/Http/Controllers/Admin/CategoriesController.php
hoanglee217/laravel-shop-gundam
a00c837ac20b724e107521b6f8747ef87fd62eaf
[ "MIT" ]
null
null
null
app/Http/Controllers/Admin/CategoriesController.php
hoanglee217/laravel-shop-gundam
a00c837ac20b724e107521b6f8747ef87fd62eaf
[ "MIT" ]
null
null
null
app/Http/Controllers/Admin/CategoriesController.php
hoanglee217/laravel-shop-gundam
a00c837ac20b724e107521b6f8747ef87fd62eaf
[ "MIT" ]
null
null
null
<?php namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; class CategoriesController extends Controller { /** * Create a new controller instance. * * @return void */ public function __construct() { } /** * Show the application dashboard. * * @return \Illuminate\Contracts\Support\Renderable */ public function Category() { $data = DB::table('Categories')->select('id', 'name', 'created_at')->get(); return view('admin.categories.categories', ['data' => $data]); } public function add_form() { return view('admin.categories.new'); } public function add_action(Request $request) { $name = $request->input('name'); $created_at = date('Y-m-d H:i:s'); $data = array('name' => $name, "created_at" => $created_at); DB::table('Categories')->insert($data); return redirect('category_Admin')->with('message', 'Add new sucess'); } public function edit_form($id) { $data = DB::table('Categories')->where('id', $id)->select('id', 'name', 'created_at')->get(); return view('admin.categories.edit', ['id' => $id, 'data' => $data]); } public function edit_action(Request $request) { $id = $request->input('id'); $name = $request->input('name'); $updated_at = date('Y-m-d H:i:s'); $data = array('name' => $name, "updated_at" => $updated_at); DB::table('Categories')->where('id', $id)->update($data);; return redirect('category_Admin')->with('Update', 'Delete sucess'); } public function delete_action($id) { DB::table('Categories')->delete($id); return redirect('category_Admin')->with('message', 'Delete sucess'); } }
30.269841
101
0.588359
f79a03550a14c92406c4fed92a98bef3da395d42
662
asm
Assembly
granary/x86/init.asm
Granary/granary
f9ac2b6af0864f420b93917dc21a38041905b3aa
[ "BSD-3-Clause" ]
37
2015-03-13T08:29:46.000Z
2022-03-04T06:54:29.000Z
granary/x86/init.asm
Granary/granary
f9ac2b6af0864f420b93917dc21a38041905b3aa
[ "BSD-3-Clause" ]
null
null
null
granary/x86/init.asm
Granary/granary
f9ac2b6af0864f420b93917dc21a38041905b3aa
[ "BSD-3-Clause" ]
3
2015-10-16T21:18:01.000Z
2022-03-04T06:54:31.000Z
/* Copyright 2012-2013 Peter Goodman, all rights reserved. */ #include "granary/x86/asm_defines.asm" #include "granary/x86/asm_helpers.asm" #include "granary/pp.h" #if CONFIG_ENV_KERNEL START_FILE DECLARE_FUNC(granary_run_initialisers) GLOBAL_LABEL(granary_run_initialisers:) .cfi_startproc push %rbp; mov %rsp, %rbp; // This is an automatically generated file, that is generated when Granary // is built. // the implication is that this particular file must be compiled *after* // all others. # include "granary/gen/kernel_init.S" pop %rbp; ret; .cfi_endproc END_FUNC(granary_run_initialisers) END_FILE #endif
20.6875
78
0.728097
b8bf35ca7b6ea46f2242e4f84155d0467f04b305
2,316
kt
Kotlin
font-awesome/src/commonMain/kotlin/compose/icons/fontawesomeicons/solid/Box.kt
ravitejasc/compose-icons
09f752ef051b1c47e60554f3893bbed5ddd8bc1f
[ "MIT" ]
230
2020-11-11T14:52:11.000Z
2022-03-31T05:04:52.000Z
font-awesome/src/commonMain/kotlin/compose/icons/fontawesomeicons/solid/Box.kt
ravitejasc/compose-icons
09f752ef051b1c47e60554f3893bbed5ddd8bc1f
[ "MIT" ]
17
2021-03-02T00:00:32.000Z
2022-03-02T16:01:03.000Z
font-awesome/src/commonMain/kotlin/compose/icons/fontawesomeicons/solid/Box.kt
ravitejasc/compose-icons
09f752ef051b1c47e60554f3893bbed5ddd8bc1f
[ "MIT" ]
18
2021-02-08T06:18:41.000Z
2022-03-22T21:48:23.000Z
package compose.icons.fontawesomeicons.solid import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.PathFillType.Companion.NonZero import androidx.compose.ui.graphics.SolidColor import androidx.compose.ui.graphics.StrokeCap.Companion.Butt import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector.Builder import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.unit.dp import compose.icons.fontawesomeicons.SolidGroup public val SolidGroup.Box: ImageVector get() { if (_box != null) { return _box!! } _box = Builder(name = "Box", defaultWidth = 512.0.dp, defaultHeight = 512.0.dp, viewportWidth = 512.0f, viewportHeight = 512.0f).apply { path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f, pathFillType = NonZero) { moveTo(509.5f, 184.6f) lineTo(458.9f, 32.8f) curveTo(452.4f, 13.2f, 434.1f, 0.0f, 413.4f, 0.0f) horizontalLineTo(272.0f) verticalLineToRelative(192.0f) horizontalLineToRelative(238.7f) curveToRelative(-0.4f, -2.5f, -0.4f, -5.0f, -1.2f, -7.4f) close() moveTo(240.0f, 0.0f) horizontalLineTo(98.6f) curveToRelative(-20.7f, 0.0f, -39.0f, 13.2f, -45.5f, 32.8f) lineTo(2.5f, 184.6f) curveToRelative(-0.8f, 2.4f, -0.8f, 4.9f, -1.2f, 7.4f) horizontalLineTo(240.0f) verticalLineTo(0.0f) close() moveTo(0.0f, 224.0f) verticalLineToRelative(240.0f) curveToRelative(0.0f, 26.5f, 21.5f, 48.0f, 48.0f, 48.0f) horizontalLineToRelative(416.0f) curveToRelative(26.5f, 0.0f, 48.0f, -21.5f, 48.0f, -48.0f) verticalLineTo(224.0f) horizontalLineTo(0.0f) close() } } .build() return _box!! } private var _box: ImageVector? = null
42.109091
93
0.587651
ca3a1edb565fdea79bb3b2b1cc44ed91435980f3
694
sql
SQL
SqlScripts/PickUp.sql
wiredmartian/feedcity
c24a78dbcd8b5a6ef4c176a198c714a0f22b3154
[ "MIT" ]
null
null
null
SqlScripts/PickUp.sql
wiredmartian/feedcity
c24a78dbcd8b5a6ef4c176a198c714a0f22b3154
[ "MIT" ]
null
null
null
SqlScripts/PickUp.sql
wiredmartian/feedcity
c24a78dbcd8b5a6ef4c176a198c714a0f22b3154
[ "MIT" ]
null
null
null
CREATE TABLE PickupRequests ( Id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, UserId INT(6) UNSIGNED, AcceptedBy INT(6) UNSIGNED, DropOffZoneId INT(6) UNSIGNED, Location VARCHAR(255) NOT NULL, Latitude VARCHAR(50) NOT NULL, Longitude VARCHAR(50) NOT NULL, ContactName VARCHAR(255) NOT NULL, ContactNumber VARCHAR(50) NOT NULL, Status VARCHAR(50) NOT NULL, Notes VARCHAR(1000) NOT NULL, RequestedOn TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, ClosedOn TIMESTAMP, FOREIGN KEY (UserId) REFERENCES Users(Id), FOREIGN KEY (AcceptedBy) REFERENCES Users(Id), FOREIGN KEY (DropOffZoneId) REFERENCES DropOffZones(Id), )
38.555556
80
0.730548
0b76fafcb456f46600cad89fe0e69cc5863c133f
799
sql
SQL
medium/_02_xtests/cases/seq1.sql
Zhaojia2019/cubrid-testcases
475a828e4d7cf74aaf2611fcf791a6028ddd107d
[ "BSD-3-Clause" ]
9
2016-03-24T09:51:52.000Z
2022-03-23T10:49:47.000Z
medium/_02_xtests/cases/seq1.sql
Zhaojia2019/cubrid-testcases
475a828e4d7cf74aaf2611fcf791a6028ddd107d
[ "BSD-3-Clause" ]
173
2016-04-13T01:16:54.000Z
2022-03-16T07:50:58.000Z
medium/_02_xtests/cases/seq1.sql
Zhaojia2019/cubrid-testcases
475a828e4d7cf74aaf2611fcf791a6028ddd107d
[ "BSD-3-Clause" ]
38
2016-03-24T17:10:31.000Z
2021-10-30T22:55:45.000Z
autocommit off; create class foo (id int, sq sequence(int, string)); insert into foo values (-1, NULL); insert into foo values (0, {}); insert into foo values (2, {1}); insert into foo values (3, {2}); insert into foo values (7, {0, 1}); insert into foo values (8, {0, 2}); insert into foo values (9, {1, 1}); insert into foo values (15, {1, 1, 1}); insert into foo values (5, {'a'}); insert into foo values (1, {NULL}); insert into foo values (6, {'b'}); insert into foo values (13, {'a', 'b'}); insert into foo values (12, {'a', 'a'}); insert into foo values (11, {'a', 1}); insert into foo values (10, {1, 'a'}); insert into foo values (14, {NULL, NULL, NULL}); insert into foo values (4, {'A'}); select * from foo order by sq; select * from foo where sq <> sequence{1, 1} order by id; rollback;
34.73913
57
0.635795
84f595bd18372ca0d0e62eed3d6a7dc80dba192a
3,474
h
C
source/vxRenderAspectDX12/LightManager.h
DennisWandschura/vxEngine
1396a65f7328aaed50dd34634c65cac561271b9e
[ "MIT" ]
1
2015-11-29T11:38:04.000Z
2015-11-29T11:38:04.000Z
source/vxRenderAspectDX12/LightManager.h
DennisWandschura/vxEngine
1396a65f7328aaed50dd34634c65cac561271b9e
[ "MIT" ]
null
null
null
source/vxRenderAspectDX12/LightManager.h
DennisWandschura/vxEngine
1396a65f7328aaed50dd34634c65cac561271b9e
[ "MIT" ]
null
null
null
#pragma once /* The MIT License (MIT) Copyright (c) 2015 Dennis Wandschura 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. */ struct GpuShadowTransformReverse; struct GpuLight; class Frustum; struct GpuShadowTransform; struct D3D12_DRAW_INDEXED_ARGUMENTS; struct AABB; struct RenderSettings; class RenderPassLight; class RenderAspect; namespace Graphics { struct Light; struct LightGeometryProxy; } namespace d3d { class ResourceManager; } #include <vxLib/math/Vector.h> #include <vxLib/Allocator/StackAllocator.h> #include "DrawIndexedIndirectCommand.h" #include <vxEngineLib/Event.h> #include <memory> class LightManager { GpuLight* m_sceneLights; GpuShadowTransform* m_sceneShadowTransforms; GpuShadowTransformReverse* m_sceneShadowReverseTransforms; __m128* m_sceneLightBounds; std::unique_ptr<Graphics::LightGeometryProxy[]> m_proxies; GpuLight* m_gpuLights; GpuShadowTransform* m_gpuShadowTransforms; GpuShadowTransformReverse* m_gpuShadowReverseTransforms; u32 m_proxyCount; u32 m_visibleLightCount; u32 m_sceneLightCount; u32 m_maxSceneLightCount; u32 m_maxShadowCastingLights; u32 m_resultBufferCount; u32* m_visibleLightsResult; Event m_downloadEvent; Event m_checkLightsEvent; std::vector<RenderPassLight*> m_renderPasses; vx::StackAllocator m_scratchAllocator; void createSrvLights(u32 maxCount, d3d::ResourceManager* resourceManager); void createSrvShadowCastingLights(u32 maxCount, d3d::ResourceManager* resourceManager); public: LightManager(); LightManager(const LightManager&) = delete; LightManager(LightManager &&rhs); ~LightManager(); void getRequiredMemory(u64* heapSizeBuffere, u32* bufferCount, u32 maxSceneLightCount, u32 maxShadowCastingLights); bool initialize(const RenderSettings &settings, vx::StackAllocator* allocator, u32 maxSceneLightCount, d3d::ResourceManager* resourceManager, UploadManager* uploadManager); bool loadSceneLights(const Graphics::Light* lights, u32 lightCount, Graphics::LightGeometryProxy* proxies, u32 proxyCount, ID3D12Device* device, d3d::ResourceManager* resourceManager, UploadManager* uploadManager); void __vectorcall update(__m128 cameraPosition, __m128 cameraDirection, const Frustum &frustum, d3d::ResourceManager* resourceManager, UploadManager* uploadManager, RenderAspect* renderAspect); void addStaticMeshInstance(const D3D12_DRAW_INDEXED_ARGUMENTS &cmd, const AABB &bounds, UploadManager* uploadManager); void addRenderPass(RenderPassLight* rp) { m_renderPasses.push_back(rp); } };
36.1875
215
0.818653
3fd6c185a0bbb9b6392ae7672df13290c860f26b
854
h
C
samples/Common/SampleFramework_Linux.h
SoulForMachine/GLSlayer
37a0fab90c4e2c3a22279cc93d39e8f3091b5e12
[ "MIT" ]
null
null
null
samples/Common/SampleFramework_Linux.h
SoulForMachine/GLSlayer
37a0fab90c4e2c3a22279cc93d39e8f3091b5e12
[ "MIT" ]
1
2017-10-24T12:19:52.000Z
2017-10-24T12:19:52.000Z
samples/Common/SampleFramework_Linux.h
SoulForMachine/GLSlayer
37a0fab90c4e2c3a22279cc93d39e8f3091b5e12
[ "MIT" ]
null
null
null
#ifndef _SAMPLES_COMMON_SAMPLE_FRAMEWORK_LINUX_H_ #define _SAMPLES_COMMON_SAMPLE_FRAMEWORK_LINUX_H_ #include <string> #include <X11/Xlib.h> #include <GLSlayer/FixXlibMacros.h> class ISample; class SampleFramework { public: SampleFramework(const wchar_t* name, int wndWidth, int wndHeight); ~SampleFramework(); int Run(ISample* sample); private: void OnKeyPress(XKeyEvent* event); void OnKeyRelease(XKeyEvent* event); void OnMotionNotify(XMotionEvent* event); void OnButtonPress(XButtonEvent* event); void OnButtonRelease(XButtonEvent* event); void ProcessEvent(XEvent* event); Display* _display; Atom _wmDeleteMessage; int _wndWidth; int _wndHeight; std::wstring _appName; int _prevMouseX, _prevMouseY; bool _lbtnDown, _rbtnDown, _mbtnDown; ISample* _sample; bool _quit; }; #endif // _SAMPLES_COMMON_SAMPLE_FRAMEWORK_LINUX_H_
20.829268
67
0.79274
f086a67ce99ae006dd44a658e09c39278e62732c
542
js
JavaScript
Fx/Dim.js
georgski/Dissertation
c11fc82b1d17564c641d042bda4f406b64c43296
[ "CC-BY-3.0" ]
1
2018-09-14T13:13:20.000Z
2018-09-14T13:13:20.000Z
Fx/Dim.js
georgski/Dissertation
c11fc82b1d17564c641d042bda4f406b64c43296
[ "CC-BY-3.0" ]
null
null
null
Fx/Dim.js
georgski/Dissertation
c11fc82b1d17564c641d042bda4f406b64c43296
[ "CC-BY-3.0" ]
null
null
null
/* A script fading out a scene */ public var dimmingTexture : Texture2D; public var dimSpeed = 0.2; private var transparency = 0.0; function OnGUI(){ //calculate transparency of the image covering screen transparency += dimSpeed * Time.deltaTime; transparency = Mathf.Clamp01(transparency); GUI.color.a = transparency; //draw the image GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height), dimmingTexture); //end game if dimming complete if (transparency == 1) Application.Quit(); }
21.68
77
0.678967
9c035bcf3882962e92beac96b7a75966cc050698
578
js
JavaScript
src/events/guild/roleDelete.js
jesandand/Musicv13
d1ee4c76ddea83dadf7fa92532ce6642d32d47dc
[ "MIT" ]
36
2021-12-05T22:01:56.000Z
2022-03-29T18:52:13.000Z
src/events/guild/roleDelete.js
jesandand/Musicv13
d1ee4c76ddea83dadf7fa92532ce6642d32d47dc
[ "MIT" ]
31
2021-12-10T07:24:08.000Z
2022-03-29T07:25:33.000Z
src/events/guild/roleDelete.js
jesandand/Musicv13
d1ee4c76ddea83dadf7fa92532ce6642d32d47dc
[ "MIT" ]
12
2021-12-12T09:47:30.000Z
2022-02-18T00:31:09.000Z
module.exports = class RoleDelete extends Event { constructor() { super({ name: "roleDelete", once: false, }); } async exec(role) { const data = await this.client.getGuild({ guildID: role.guild.id }); let isDJ = data.djRoles.find((r) => r === role.id); if (isDJ) { let index = data.djRoles.indexOf(role.id); data.djRoles.splice(index, 1); await data.save().then(() => { this.client.logger.warn(`Role ${role.name} (${role.id}) removed from ${role.guild.name} DJ roles`, {tag: "roleDelete"}); }) } } };
27.52381
128
0.574394
9639500fc026beeb2a42734be89392861549cc9e
1,324
php
PHP
src/Helpers/PdfHelper.php
pereterradas/laravel-general-helper
fcab61e7613ba51dd637cadc51ba6655e1cb11f2
[ "MIT" ]
1
2022-02-25T06:37:27.000Z
2022-02-25T06:37:27.000Z
src/Helpers/PdfHelper.php
pereterradas/laravel-general-helper
fcab61e7613ba51dd637cadc51ba6655e1cb11f2
[ "MIT" ]
1
2022-03-16T11:29:27.000Z
2022-03-16T11:33:19.000Z
src/Helpers/PdfHelper.php
pereterradas/laravel-general-helper
fcab61e7613ba51dd637cadc51ba6655e1cb11f2
[ "MIT" ]
1
2022-03-16T11:28:22.000Z
2022-03-16T11:28:22.000Z
<?php namespace Sefirosweb\LaravelGeneralHelper\Helpers; use Exception; use Sefirosweb\LaravelGeneralHelper\Http\Models\SavedFile; use Illuminate\Support\Facades\Auth; class PdfHelper { public function __construct() { $this->pdf = app('dompdf.wrapper'); $this->set_option("enable_php", true); } public function loadView($view, $data = []) { $this->pdf->loadView($view, $data); } public function set_option($option, $value) { $this->pdf->getDomPDF()->set_option($option, $value); } public function setPaper($type, $direction) { $this->pdf->setPaper($type, $direction); } public function download($filename) { return $this->pdf->download($filename . '.pdf'); } public function showFile($name = '') { return $this->pdf->stream($name); } public function save($filename, $path = null) { $path = $path ? $path : pathTemp() . '/' . $filename . '_' . date('YmdHis') . '.pdf'; $this->pdf->save($path); $savedFile = new SavedFile; $savedFile->user()->associate(Auth::user()); $savedFile->file_name = $filename; $savedFile->extension = 'pdf'; $savedFile->path = $path; $savedFile->save(); return $savedFile; } }
23.22807
93
0.579305
928900ad978cd8a233b6deb960fdb41c04d1d237
29,451
c
C
hihope_neptune-oh_hid/00_src/v0.1/device/winnermicro/neptune/sdk_liteos/src/bt/host/btif/src/btif_sdp_server.c
dawmlight/vendor_oh_fun
bc9fb50920f06cd4c27399f60076f5793043c77d
[ "Apache-2.0" ]
1
2022-02-15T08:51:55.000Z
2022-02-15T08:51:55.000Z
hihope_neptune-oh_hid/00_src/v0.3/device/winnermicro/neptune/sdk_liteos/src/bt/host/btif/src/btif_sdp_server.c
dawmlight/vendor_oh_fun
bc9fb50920f06cd4c27399f60076f5793043c77d
[ "Apache-2.0" ]
null
null
null
hihope_neptune-oh_hid/00_src/v0.3/device/winnermicro/neptune/sdk_liteos/src/bt/host/btif/src/btif_sdp_server.c
dawmlight/vendor_oh_fun
bc9fb50920f06cd4c27399f60076f5793043c77d
[ "Apache-2.0" ]
null
null
null
/****************************************************************************** * * Copyright (C) 2014 Samsung System LSI * * 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. * ******************************************************************************/ /************************************************************************************ * * Filename: btif_sdp_server.c * Description: SDP server Bluetooth Interface to create and remove SDP records. * To be used in combination with the RFCOMM/L2CAP(LE) sockets. * * ***********************************************************************************/ #define LOG_TAG "bt_btif_sdp_server" #include "bt_target.h" #if defined(BTA_SDP_SERVER_INCLUDED) && (BTA_SDP_SERVER_INCLUDED == TRUE) #include <pthread.h> #include <stdlib.h> #include <string.h> #include <hardware/bluetooth.h> #include <hardware/bt_sdp.h> #include "bta_sdp_api.h" #include "bta_sys.h" #include "btif_common.h" #include "btif_sock_util.h" #include "btif_util.h" #include "osi/include/allocator.h" #include "utl.h" static pthread_mutex_t sdp_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; /** * The need for a state variable have been reduced to two states. * The remaining state control is handled by program flow */ typedef enum { SDP_RECORD_FREE = 0, SDP_RECORD_ALLOCED, } sdp_state_t; typedef struct { sdp_state_t state; int sdp_handle; bluetooth_sdp_record *record_data; } sdp_slot_t; #define MAX_SDP_SLOTS 128 static sdp_slot_t sdp_slots[MAX_SDP_SLOTS]; /***************************************************************************** * LOCAL Functions *****************************************************************************/ static int add_maps_sdp(const bluetooth_sdp_mas_record *rec); static int add_mapc_sdp(const bluetooth_sdp_mns_record *rec); static int add_pbaps_sdp(const bluetooth_sdp_pse_record *rec); static int add_opps_sdp(const bluetooth_sdp_ops_record *rec); static int add_saps_sdp(const bluetooth_sdp_sap_record *rec); tls_bt_status_t remove_sdp_record(int record_id); static int free_sdp_slot(int id); /****************************************************************************** * WARNING: Functions below are not called in BTU context. * Introduced to make it possible to create SDP records from JAVA with both a * RFCOMM channel and a L2CAP PSM. * Overall architecture: * 1) JAVA calls createRecord() which returns a pseudo ID which at a later * point will be linked to a specific SDP handle. * 2) createRecord() requests the BTU task(thread) to call a callback in SDP * which creates the actual record, and updates the ID<->SDPHandle map * based on the ID beeing passed to BTA as user_data. *****************************************************************************/ static void init_sdp_slots() { int i; wm_memset(sdp_slots, 0, sizeof(sdp_slot_t)*MAX_SDP_SLOTS); /* if SDP_RECORD_FREE is zero - no need to set the value */ if(SDP_RECORD_FREE != 0) { for(i = 0; i < MAX_SDP_SLOTS; i++) { sdp_slots[i].state = SDP_RECORD_FREE; } } } tls_bt_status_t sdp_server_init() { BTIF_TRACE_DEBUG("Sdp Server %s", __FUNCTION__); init_sdp_slots(); return TLS_BT_STATUS_SUCCESS; } void sdp_server_cleanup() { BTIF_TRACE_DEBUG("Sdp Server %s", __FUNCTION__); pthread_mutex_lock(&sdp_lock); int i; for(i = 0; i < MAX_SDP_SLOTS; i++) { /*remove_sdp_record(i); we cannot send messages to the other threads, since they might * have been shut down already. Just do local cleanup. */ free_sdp_slot(i); } pthread_mutex_unlock(&sdp_lock); } int get_sdp_records_size(bluetooth_sdp_record *in_record, int count) { bluetooth_sdp_record *record = in_record; int records_size = 0; int i; for(i = 0; i < count; i++) { record = &in_record[i]; records_size += sizeof(bluetooth_sdp_record); records_size += record->hdr.service_name_length; if(record->hdr.service_name_length > 0) { records_size++; /* + '\0' termination of string */ } records_size += record->hdr.user1_ptr_len; records_size += record->hdr.user2_ptr_len; } return records_size; } /* Deep copy all content of in_records into out_records. * out_records must point to a chunk of memory large enough to contain all * the data. Use getSdpRecordsSize() to calculate the needed size. */ void copy_sdp_records(bluetooth_sdp_record *in_records, bluetooth_sdp_record *out_records, int count) { int i; bluetooth_sdp_record *in_record; bluetooth_sdp_record *out_record; char *free_ptr = (char *)(&out_records[count]); /* set pointer to after the last entry */ for(i = 0; i < count; i++) { in_record = &in_records[i]; out_record = &out_records[i]; *out_record = *in_record; if(in_record->hdr.service_name == NULL || in_record->hdr.service_name_length == 0) { out_record->hdr.service_name = NULL; out_record->hdr.service_name_length = 0; } else { out_record->hdr.service_name = free_ptr; // Update service_name pointer // Copy string wm_memcpy(free_ptr, in_record->hdr.service_name, in_record->hdr.service_name_length); free_ptr += in_record->hdr.service_name_length; *(free_ptr) = '\0'; // Set '\0' termination of string free_ptr++; } if(in_record->hdr.user1_ptr != NULL) { out_record->hdr.user1_ptr = (uint8_t *)free_ptr; // Update pointer wm_memcpy(free_ptr, in_record->hdr.user1_ptr, in_record->hdr.user1_ptr_len); // Copy content free_ptr += in_record->hdr.user1_ptr_len; } if(in_record->hdr.user2_ptr != NULL) { out_record->hdr.user2_ptr = (uint8_t *)free_ptr; // Update pointer wm_memcpy(free_ptr, in_record->hdr.user2_ptr, in_record->hdr.user2_ptr_len); // Copy content free_ptr += in_record->hdr.user2_ptr_len; } } return; } /* Reserve a slot in sdp_slots, copy data and set a reference to the copy. * The record_data will contain both the record and any data pointed to by * the record. * Currently this covers: * service_name string, * user1_ptr and * user2_ptr. */ static int alloc_sdp_slot(bluetooth_sdp_record *in_record) { int i; int record_size = get_sdp_records_size(in_record, 1); bluetooth_sdp_record *record = GKI_getbuf(record_size); copy_sdp_records(in_record, record, 1); /* We are optimists here, and preallocate the record. * This is to reduce the time we hold the sdp_lock. */ pthread_mutex_lock(&sdp_lock); for(i = 0; i < MAX_SDP_SLOTS; i++) { if(sdp_slots[i].state == SDP_RECORD_FREE) { sdp_slots[i].state = SDP_RECORD_ALLOCED; sdp_slots[i].record_data = record; break; } } pthread_mutex_unlock(&sdp_lock); if(i >= MAX_SDP_SLOTS) { APPL_TRACE_ERROR("%s() failed - no more free slots!", __func__); /* Rearly the optimist is too optimistic, and cleanup is needed...*/ GKI_freebuf(record); return -1; } return i; } static int free_sdp_slot(int id) { int handle = -1; bluetooth_sdp_record *record = NULL; if(id >= MAX_SDP_SLOTS) { APPL_TRACE_ERROR("%s() failed - id %d is invalid", __func__, id); return handle; } pthread_mutex_lock(&sdp_lock); handle = sdp_slots[id].sdp_handle; sdp_slots[id].sdp_handle = 0; if(sdp_slots[id].state != SDP_RECORD_FREE) { /* safe a copy of the pointer, and free after unlock() */ record = sdp_slots[id].record_data; } sdp_slots[id].state = SDP_RECORD_FREE; pthread_mutex_unlock(&sdp_lock); if(record != NULL) { GKI_freebuf(record); } else { // Record have already been freed handle = -1; } return handle; } /*** * Use this to get a reference to a SDP slot AND change the state to * SDP_RECORD_CREATE_INITIATED. */ static const sdp_slot_t *start_create_sdp(int id) { sdp_slot_t *sdp_slot; if(id >= MAX_SDP_SLOTS) { APPL_TRACE_ERROR("%s() failed - id %d is invalid", __func__, id); return NULL; } pthread_mutex_lock(&sdp_lock); if(sdp_slots[id].state == SDP_RECORD_ALLOCED) { sdp_slot = &(sdp_slots[id]); } else { /* The record have been removed before this event occurred - e.g. deinit */ sdp_slot = NULL; } pthread_mutex_unlock(&sdp_lock); if(sdp_slot == NULL) { APPL_TRACE_ERROR("%s() failed - state for id %d is " "sdp_slots[id].state = %d expected %d", __func__, id, sdp_slots[id].state, SDP_RECORD_ALLOCED); } return sdp_slot; } static void set_sdp_handle(int id, int handle) { pthread_mutex_lock(&sdp_lock); sdp_slots[id].sdp_handle = handle; pthread_mutex_unlock(&sdp_lock); BTIF_TRACE_DEBUG("%s() id=%d to handle=0x%08x", __FUNCTION__, id, handle); } tls_bt_status_t create_sdp_record(bluetooth_sdp_record *record, int *record_handle) { int handle; handle = alloc_sdp_slot(record); BTIF_TRACE_DEBUG("%s() handle = 0x%08x", __FUNCTION__, handle); if(handle < 0) { return TLS_BT_STATUS_FAIL; } BTA_SdpCreateRecordByUser(INT_TO_PTR(handle)); *record_handle = handle; return TLS_BT_STATUS_SUCCESS; } tls_bt_status_t remove_sdp_record(int record_id) { int handle; /* Get the Record handle, and free the slot */ handle = free_sdp_slot(record_id); BTIF_TRACE_DEBUG("Sdp Server %s id=%d to handle=0x%08x", __FUNCTION__, record_id, handle); /* Pass the actual record handle */ if(handle > 0) { BTA_SdpRemoveRecordByUser(INT_TO_PTR(handle)); return TLS_BT_STATUS_SUCCESS; } BTIF_TRACE_DEBUG("Sdp Server %s - record already removed - or never created", __FUNCTION__); return TLS_BT_STATUS_FAIL; } /****************************************************************************** * CALLBACK FUNCTIONS * Called in BTA context to create/remove SDP records. ******************************************************************************/ void on_create_record_event(int id) { /* * 1) Fetch the record pointer, and change its state? * 2) switch on the type to create the correct record * 3) Update state on completion * 4) What to do at fail? * */ BTIF_TRACE_DEBUG("Sdp Server %s", __FUNCTION__); const sdp_slot_t *sdp_slot = start_create_sdp(id); /* In the case we are shutting down, sdp_slot is NULL */ if(sdp_slot != NULL) { bluetooth_sdp_record *record = sdp_slot->record_data; int handle = -1; switch(record->hdr.type) { case SDP_TYPE_MAP_MAS: handle = add_maps_sdp(&record->mas); break; case SDP_TYPE_MAP_MNS: handle = add_mapc_sdp(&record->mns); break; case SDP_TYPE_PBAP_PSE: handle = add_pbaps_sdp(&record->pse); break; case SDP_TYPE_OPP_SERVER: handle = add_opps_sdp(&record->ops); break; case SDP_TYPE_SAP_SERVER: handle = add_saps_sdp(&record->sap); break; case SDP_TYPE_PBAP_PCE: // break; not yet supported default: BTIF_TRACE_DEBUG("Record type %d is not supported", record->hdr.type); break; } if(handle != -1) { set_sdp_handle(id, handle); } } } void on_remove_record_event(int handle) { BTIF_TRACE_DEBUG("Sdp Server %s", __FUNCTION__); // User data carries the actual SDP handle, not the ID. if(handle != -1 && handle != 0) { uint8_t result; result = SDP_DeleteRecord(handle); if(result == FALSE) { BTIF_TRACE_ERROR(" Unable to remove handle 0x%08x", handle); } } } /**** * Below the actual functions accessing BTA context data - hence only call from BTA context! */ /* Create a MAP MAS SDP record based on information stored in a bluetooth_sdp_mas_record */ static int add_maps_sdp(const bluetooth_sdp_mas_record *rec) { tSDP_PROTOCOL_ELEM protoList [3]; uint16_t service = UUID_SERVCLASS_MESSAGE_ACCESS; uint16_t browse = UUID_SERVCLASS_PUBLIC_BROWSE_GROUP; uint8_t status = TRUE; uint32_t sdp_handle = 0; uint8_t temp[4]; uint8_t *p_temp = temp; APPL_TRACE_DEBUG("%s(): MASID = 0x%02x, scn 0x%02x, psm = 0x%04x\n service name %s", __func__, rec->mas_instance_id, rec->hdr.rfcomm_channel_number, rec->hdr.l2cap_psm, rec->hdr.service_name); APPL_TRACE_DEBUG(" msg_types: 0x%02x, feature_bits: 0x%08x", rec->supported_message_types, rec->supported_features); if((sdp_handle = SDP_CreateRecord()) == 0) { APPL_TRACE_ERROR("%s() - Unable to register MAPS Service", __func__); return sdp_handle; } /* add service class */ status &= SDP_AddServiceClassIdList(sdp_handle, 1, &service); wm_memset(protoList, 0, 3 * sizeof(tSDP_PROTOCOL_ELEM)); /* add protocol list, including RFCOMM scn */ protoList[0].protocol_uuid = UUID_PROTOCOL_L2CAP; protoList[0].num_params = 0; protoList[1].protocol_uuid = UUID_PROTOCOL_RFCOMM; protoList[1].num_params = 1; protoList[1].params[0] = rec->hdr.rfcomm_channel_number; protoList[2].protocol_uuid = UUID_PROTOCOL_OBEX; protoList[2].num_params = 0; status &= SDP_AddProtocolList(sdp_handle, 3, protoList); /* Add a name entry */ status &= SDP_AddAttribute(sdp_handle, (uint16_t)ATTR_ID_SERVICE_NAME, (uint8_t)TEXT_STR_DESC_TYPE, (uint32_t)(rec->hdr.service_name_length + 1), (uint8_t *)rec->hdr.service_name); /* Add in the Bluetooth Profile Descriptor List */ status &= SDP_AddProfileDescriptorList(sdp_handle, UUID_SERVCLASS_MAP_PROFILE, rec->hdr.profile_version); /* Add MAS instance ID */ status &= SDP_AddAttribute(sdp_handle, ATTR_ID_MAS_INSTANCE_ID, UINT_DESC_TYPE, (uint32_t)1, (uint8_t *)&rec->mas_instance_id); /* Add supported message types */ status &= SDP_AddAttribute(sdp_handle, ATTR_ID_SUPPORTED_MSG_TYPE, UINT_DESC_TYPE, (uint32_t)1, (uint8_t *)&rec->supported_message_types); /* Add supported feature */ UINT32_TO_BE_STREAM(p_temp, rec->supported_features); status &= SDP_AddAttribute(sdp_handle, ATTR_ID_MAP_SUPPORTED_FEATURES, UINT_DESC_TYPE, (uint32_t)4, temp); /* Add the L2CAP PSM if present */ if(rec->hdr.l2cap_psm != -1) { p_temp = temp;// The macro modifies p_temp, hence rewind. UINT16_TO_BE_STREAM(p_temp, rec->hdr.l2cap_psm); status &= SDP_AddAttribute(sdp_handle, ATTR_ID_GOEP_L2CAP_PSM, UINT_DESC_TYPE, (uint32_t)2, temp); } /* Make the service browseable */ status &= SDP_AddUuidSequence(sdp_handle, ATTR_ID_BROWSE_GROUP_LIST, 1, &browse); if(!status) { SDP_DeleteRecord(sdp_handle); sdp_handle = 0; APPL_TRACE_ERROR("%s() FAILED", __func__); } else { bta_sys_add_uuid(service); /* UUID_SERVCLASS_MESSAGE_ACCESS */ APPL_TRACE_DEBUG("%s(): SDP Registered (handle 0x%08x)", __func__, sdp_handle); } return sdp_handle; } /* Create a MAP MNS SDP record based on information stored in a bluetooth_sdp_mns_record */ static int add_mapc_sdp(const bluetooth_sdp_mns_record *rec) { tSDP_PROTOCOL_ELEM protoList [3]; uint16_t service = UUID_SERVCLASS_MESSAGE_NOTIFICATION; uint16_t browse = UUID_SERVCLASS_PUBLIC_BROWSE_GROUP; uint8_t status = TRUE; uint32_t sdp_handle = 0; uint8_t temp[4]; uint8_t *p_temp = temp; APPL_TRACE_DEBUG("%s(): scn 0x%02x, psm = 0x%04x\n service name %s", __func__, rec->hdr.rfcomm_channel_number, rec->hdr.l2cap_psm, rec->hdr.service_name); APPL_TRACE_DEBUG(" feature_bits: 0x%08x", rec->supported_features); if((sdp_handle = SDP_CreateRecord()) == 0) { APPL_TRACE_ERROR("%s(): Unable to register MAP Notification Service", __func__); return sdp_handle; } /* add service class */ status &= SDP_AddServiceClassIdList(sdp_handle, 1, &service); wm_memset(protoList, 0, 3 * sizeof(tSDP_PROTOCOL_ELEM)); /* add protocol list, including RFCOMM scn */ protoList[0].protocol_uuid = UUID_PROTOCOL_L2CAP; protoList[0].num_params = 0; protoList[1].protocol_uuid = UUID_PROTOCOL_RFCOMM; protoList[1].num_params = 1; protoList[1].params[0] = rec->hdr.rfcomm_channel_number; protoList[2].protocol_uuid = UUID_PROTOCOL_OBEX; protoList[2].num_params = 0; status &= SDP_AddProtocolList(sdp_handle, 3, protoList); /* Add a name entry */ status &= SDP_AddAttribute(sdp_handle, (uint16_t)ATTR_ID_SERVICE_NAME, (uint8_t)TEXT_STR_DESC_TYPE, (uint32_t)(rec->hdr.service_name_length + 1), (uint8_t *)rec->hdr.service_name); /* Add in the Bluetooth Profile Descriptor List */ status &= SDP_AddProfileDescriptorList(sdp_handle, UUID_SERVCLASS_MAP_PROFILE, rec->hdr.profile_version); /* Add supported feature */ UINT32_TO_BE_STREAM(p_temp, rec->supported_features); status &= SDP_AddAttribute(sdp_handle, ATTR_ID_MAP_SUPPORTED_FEATURES, UINT_DESC_TYPE, (uint32_t)4, temp); /* Add the L2CAP PSM if present */ if(rec->hdr.l2cap_psm != -1) { p_temp = temp;// The macro modifies p_temp, hence rewind. UINT16_TO_BE_STREAM(p_temp, rec->hdr.l2cap_psm); status &= SDP_AddAttribute(sdp_handle, ATTR_ID_GOEP_L2CAP_PSM, UINT_DESC_TYPE, (uint32_t)2, temp); } /* Make the service browseable */ status &= SDP_AddUuidSequence(sdp_handle, ATTR_ID_BROWSE_GROUP_LIST, 1, &browse); if(!status) { SDP_DeleteRecord(sdp_handle); sdp_handle = 0; APPL_TRACE_ERROR("%s() FAILED", __func__); } else { bta_sys_add_uuid(service); /* UUID_SERVCLASS_MESSAGE_ACCESS */ APPL_TRACE_DEBUG("%s(): SDP Registered (handle 0x%08x)", __func__, sdp_handle); } return sdp_handle; } /* Create a PBAP Server SDP record based on information stored in a bluetooth_sdp_pse_record */ static int add_pbaps_sdp(const bluetooth_sdp_pse_record *rec) { tSDP_PROTOCOL_ELEM protoList [3]; uint16_t service = UUID_SERVCLASS_PBAP_PSE; uint16_t browse = UUID_SERVCLASS_PUBLIC_BROWSE_GROUP; uint8_t status = TRUE; uint32_t sdp_handle = 0; uint8_t temp[4]; uint8_t *p_temp = temp; APPL_TRACE_DEBUG("%s(): scn 0x%02x, psm = 0x%04x\n service name %s", __func__, rec->hdr.rfcomm_channel_number, rec->hdr.l2cap_psm, rec->hdr.service_name); APPL_TRACE_DEBUG(" supported_repositories: 0x%08x, feature_bits: 0x%08x", rec->supported_repositories, rec->supported_features); if((sdp_handle = SDP_CreateRecord()) == 0) { APPL_TRACE_ERROR("%s(): Unable to register PBAP Server Service", __func__); return sdp_handle; } /* add service class */ status &= SDP_AddServiceClassIdList(sdp_handle, 1, &service); wm_memset(protoList, 0, 3 * sizeof(tSDP_PROTOCOL_ELEM)); /* add protocol list, including RFCOMM scn */ protoList[0].protocol_uuid = UUID_PROTOCOL_L2CAP; protoList[0].num_params = 0; protoList[1].protocol_uuid = UUID_PROTOCOL_RFCOMM; protoList[1].num_params = 1; protoList[1].params[0] = rec->hdr.rfcomm_channel_number; protoList[2].protocol_uuid = UUID_PROTOCOL_OBEX; protoList[2].num_params = 0; status &= SDP_AddProtocolList(sdp_handle, 3, protoList); /* Add a name entry */ status &= SDP_AddAttribute(sdp_handle, (uint16_t)ATTR_ID_SERVICE_NAME, (uint8_t)TEXT_STR_DESC_TYPE, (uint32_t)(rec->hdr.service_name_length + 1), (uint8_t *)rec->hdr.service_name); /* Add in the Bluetooth Profile Descriptor List */ status &= SDP_AddProfileDescriptorList(sdp_handle, UUID_SERVCLASS_PHONE_ACCESS, rec->hdr.profile_version); /* Add supported repositories 1 byte */ status &= SDP_AddAttribute(sdp_handle, ATTR_ID_SUPPORTED_REPOSITORIES, UINT_DESC_TYPE, (uint32_t)1, (uint8_t *)&rec->supported_repositories); /* Add supported feature 4 bytes*/ UINT32_TO_BE_STREAM(p_temp, rec->supported_features); status &= SDP_AddAttribute(sdp_handle, ATTR_ID_PBAP_SUPPORTED_FEATURES, UINT_DESC_TYPE, (uint32_t)4, temp); /* Add the L2CAP PSM if present */ if(rec->hdr.l2cap_psm != -1) { p_temp = temp;// The macro modifies p_temp, hence rewind. UINT16_TO_BE_STREAM(p_temp, rec->hdr.l2cap_psm); status &= SDP_AddAttribute(sdp_handle, ATTR_ID_GOEP_L2CAP_PSM, UINT_DESC_TYPE, (uint32_t)2, temp); } /* Make the service browseable */ status &= SDP_AddUuidSequence(sdp_handle, ATTR_ID_BROWSE_GROUP_LIST, 1, &browse); if(!status) { SDP_DeleteRecord(sdp_handle); sdp_handle = 0; APPL_TRACE_ERROR("%s() FAILED", __func__); } else { bta_sys_add_uuid(service); /* UUID_SERVCLASS_MESSAGE_ACCESS */ APPL_TRACE_DEBUG("%s(): SDP Registered (handle 0x%08x)", __func__, sdp_handle); } return sdp_handle; } /* Create a OPP Server SDP record based on information stored in a bluetooth_sdp_ops_record */ static int add_opps_sdp(const bluetooth_sdp_ops_record *rec) { tSDP_PROTOCOL_ELEM protoList [3]; uint16_t service = UUID_SERVCLASS_OBEX_OBJECT_PUSH; uint16_t browse = UUID_SERVCLASS_PUBLIC_BROWSE_GROUP; uint8_t type_len[rec->supported_formats_list_len]; uint8_t desc_type[rec->supported_formats_list_len]; uint8_t *type_value[rec->supported_formats_list_len]; uint8_t status = TRUE; uint32_t sdp_handle = 0; uint8_t temp[4]; uint8_t *p_temp = temp; tBTA_UTL_COD cod; int i, j; APPL_TRACE_DEBUG("%s(): scn 0x%02x, psm = 0x%04x\n service name %s", __func__, rec->hdr.rfcomm_channel_number, rec->hdr.l2cap_psm, rec->hdr.service_name); APPL_TRACE_DEBUG(" supported formats count: %d", rec->supported_formats_list_len); if((sdp_handle = SDP_CreateRecord()) == 0) { APPL_TRACE_ERROR("%s(): Unable to register Object Push Server Service", __func__); return sdp_handle; } /* add service class */ status &= SDP_AddServiceClassIdList(sdp_handle, 1, &service); wm_memset(protoList, 0, 3 * sizeof(tSDP_PROTOCOL_ELEM)); /* add protocol list, including RFCOMM scn */ protoList[0].protocol_uuid = UUID_PROTOCOL_L2CAP; protoList[0].num_params = 0; protoList[1].protocol_uuid = UUID_PROTOCOL_RFCOMM; protoList[1].num_params = 1; protoList[1].params[0] = rec->hdr.rfcomm_channel_number; protoList[2].protocol_uuid = UUID_PROTOCOL_OBEX; protoList[2].num_params = 0; status &= SDP_AddProtocolList(sdp_handle, 3, protoList); /* Add a name entry */ status &= SDP_AddAttribute(sdp_handle, (uint16_t)ATTR_ID_SERVICE_NAME, (uint8_t)TEXT_STR_DESC_TYPE, (uint32_t)(rec->hdr.service_name_length + 1), (uint8_t *)rec->hdr.service_name); /* Add in the Bluetooth Profile Descriptor List */ status &= SDP_AddProfileDescriptorList(sdp_handle, UUID_SERVCLASS_OBEX_OBJECT_PUSH, rec->hdr.profile_version); /* add sequence for supported types */ for(i = 0, j = 0; i < rec->supported_formats_list_len; i++) { type_value[j] = (uint8_t *) &rec->supported_formats_list[i]; desc_type[j] = UINT_DESC_TYPE; type_len[j++] = 1; } status &= SDP_AddSequence(sdp_handle, (uint16_t) ATTR_ID_SUPPORTED_FORMATS_LIST, (uint8_t) rec->supported_formats_list_len, desc_type, type_len, type_value); /* Add the L2CAP PSM if present */ if(rec->hdr.l2cap_psm != -1) { p_temp = temp;// The macro modifies p_temp, hence rewind. UINT16_TO_BE_STREAM(p_temp, rec->hdr.l2cap_psm); status &= SDP_AddAttribute(sdp_handle, ATTR_ID_GOEP_L2CAP_PSM, UINT_DESC_TYPE, (uint32_t)2, temp); } /* Make the service browseable */ status &= SDP_AddUuidSequence(sdp_handle, ATTR_ID_BROWSE_GROUP_LIST, 1, &browse); if(!status) { SDP_DeleteRecord(sdp_handle); sdp_handle = 0; APPL_TRACE_ERROR("%s() FAILED", __func__); } else { /* set class of device */ cod.service = BTM_COD_SERVICE_OBJ_TRANSFER; utl_set_device_class(&cod, BTA_UTL_SET_COD_SERVICE_CLASS); bta_sys_add_uuid(service); /* UUID_SERVCLASS_OBEX_OBJECT_PUSH */ APPL_TRACE_DEBUG("%s(): SDP Registered (handle 0x%08x)", __func__, sdp_handle); } return sdp_handle; } // Create a Sim Access Profile SDP record based on information stored in a bluetooth_sdp_sap_record. static int add_saps_sdp(const bluetooth_sdp_sap_record *rec) { tSDP_PROTOCOL_ELEM protoList [2]; uint16_t services[2]; uint16_t browse = UUID_SERVCLASS_PUBLIC_BROWSE_GROUP; uint8_t status = TRUE; uint32_t sdp_handle = 0; APPL_TRACE_DEBUG("%s(): scn 0x%02x, service name %s", __func__, rec->hdr.rfcomm_channel_number, rec->hdr.service_name); if((sdp_handle = SDP_CreateRecord()) == 0) { APPL_TRACE_ERROR("%s(): Unable to register SAPS Service", __func__); return sdp_handle; } services[0] = UUID_SERVCLASS_SAP; services[1] = UUID_SERVCLASS_GENERIC_TELEPHONY; // add service class status &= SDP_AddServiceClassIdList(sdp_handle, 2, services); wm_memset(protoList, 0, 2 * sizeof(tSDP_PROTOCOL_ELEM)); // add protocol list, including RFCOMM scn protoList[0].protocol_uuid = UUID_PROTOCOL_L2CAP; protoList[0].num_params = 0; protoList[1].protocol_uuid = UUID_PROTOCOL_RFCOMM; protoList[1].num_params = 1; protoList[1].params[0] = rec->hdr.rfcomm_channel_number; status &= SDP_AddProtocolList(sdp_handle, 2, protoList); // Add a name entry status &= SDP_AddAttribute(sdp_handle, (uint16_t)ATTR_ID_SERVICE_NAME, (uint8_t)TEXT_STR_DESC_TYPE, (uint32_t)(rec->hdr.service_name_length + 1), (uint8_t *)rec->hdr.service_name); // Add in the Bluetooth Profile Descriptor List status &= SDP_AddProfileDescriptorList(sdp_handle, UUID_SERVCLASS_SAP, rec->hdr.profile_version); // Make the service browseable status &= SDP_AddUuidSequence(sdp_handle, ATTR_ID_BROWSE_GROUP_LIST, 1, &browse); if(!status) { SDP_DeleteRecord(sdp_handle); sdp_handle = 0; APPL_TRACE_ERROR("%s(): FAILED deleting record", __func__); } else { bta_sys_add_uuid(UUID_SERVCLASS_SAP); APPL_TRACE_DEBUG("%s(): SDP Registered (handle 0x%08x)", __func__, sdp_handle); } return sdp_handle; } #endif
35.784933
106
0.610132
d962977825ee10116e04472c9f626db19148b35d
5,320
rs
Rust
src/sync/hmac_key.rs
sech9446/cloud-storage-rs
8a5e8a88c3dc9dbb8b48f392a5a8e8e2a4016f4c
[ "MIT" ]
null
null
null
src/sync/hmac_key.rs
sech9446/cloud-storage-rs
8a5e8a88c3dc9dbb8b48f392a5a8e8e2a4016f4c
[ "MIT" ]
null
null
null
src/sync/hmac_key.rs
sech9446/cloud-storage-rs
8a5e8a88c3dc9dbb8b48f392a5a8e8e2a4016f4c
[ "MIT" ]
null
null
null
use crate::hmac_key::{HmacKey, HmacMeta, HmacState}; /// Operations on [`HmacKey`](HmacKey)s. #[derive(Debug)] pub struct HmacKeyClient<'a>(pub(super) &'a super::Client); impl<'a> HmacKeyClient<'a> { /// Creates a new HMAC key for the specified service account. /// /// The authenticated user must have `storage.hmacKeys.create` permission for the project in /// which the key will be created. /// /// For general information about HMAC keys in Cloud Storage, see /// [HMAC Keys](https://cloud.google.com/storage/docs/authentication/hmackeys). /// ### Example /// ``` /// # fn main() -> Result<(), Box<dyn std::error::Error>> { /// use cloud_storage::sync::Client; /// use cloud_storage::hmac_key::HmacKey; /// /// let client = Client::new()?; /// let hmac_key = client.hmac_key().create()?; /// # use cloud_storage::hmac_key::HmacState; /// # client.hmac_key().update(&hmac_key.metadata.access_id, HmacState::Inactive)?; /// # client.hmac_key().delete(&hmac_key.metadata.access_id)?; /// # Ok(()) /// # } /// ``` pub fn create(&self) -> crate::Result<HmacKey> { self.0.runtime.block_on(self.0.client.hmac_key().create()) } /// Retrieves a list of HMAC keys matching the criteria. Since the HmacKey is secret, this does /// not return a `HmacKey`, but a `HmacMeta`. This is a redacted version of a `HmacKey`, but /// with the secret data omitted. /// /// The authenticated user must have `storage.hmacKeys.list` permission for the project in which /// the key exists. /// /// For general information about HMAC keys in Cloud Storage, see /// [HMAC Keys](https://cloud.google.com/storage/docs/authentication/hmackeys). /// ### Example /// ``` /// # fn main() -> Result<(), Box<dyn std::error::Error>> { /// use cloud_storage::sync::Client; /// use cloud_storage::hmac_key::HmacKey; /// /// let client = Client::new()?; /// let all_hmac_keys = client.hmac_key().list()?; /// # Ok(()) /// # } /// ``` pub fn list(&self) -> crate::Result<Vec<HmacMeta>> { self.0.runtime.block_on(self.0.client.hmac_key().list()) } /// Retrieves an HMAC key's metadata. Since the HmacKey is secret, this does not return a /// `HmacKey`, but a `HmacMeta`. This is a redacted version of a `HmacKey`, but with the secret /// data omitted. /// /// The authenticated user must have `storage.hmacKeys.get` permission for the project in which /// the key exists. /// /// For general information about HMAC keys in Cloud Storage, see /// [HMAC Keys](https://cloud.google.com/storage/docs/authentication/hmackeys). /// ### Example /// ```no_run /// # fn main() -> Result<(), Box<dyn std::error::Error>> { /// use cloud_storage::sync::Client; /// use cloud_storage::hmac_key::HmacKey; /// /// let client = Client::new()?; /// let key = client.hmac_key().read("some identifier")?; /// # Ok(()) /// # } pub fn read(&self, access_id: &str) -> crate::Result<HmacMeta> { self.0 .runtime .block_on(self.0.client.hmac_key().read(access_id)) } /// Updates the state of an HMAC key. See the HMAC Key resource descriptor for valid states. /// Since the HmacKey is secret, this does not return a `HmacKey`, but a `HmacMeta`. This is a /// redacted version of a `HmacKey`, but with the secret data omitted. /// /// The authenticated user must have `storage.hmacKeys.update` permission for the project in /// which the key exists. /// /// For general information about HMAC keys in Cloud Storage, see /// [HMAC Keys](https://cloud.google.com/storage/docs/authentication/hmackeys). /// ### Example /// ```no_run /// # fn main() -> Result<(), Box<dyn std::error::Error>> { /// use cloud_storage::sync::Client; /// use cloud_storage::hmac_key::{HmacKey, HmacState}; /// /// let client = Client::new()?; /// let key = client.hmac_key().update("your key", HmacState::Active)?; /// # Ok(()) /// # } pub fn update(&self, access_id: &str, state: HmacState) -> crate::Result<HmacMeta> { self.0 .runtime .block_on(self.0.client.hmac_key().update(access_id, state)) } /// Deletes an HMAC key. Note that a key must be set to `Inactive` first. /// /// The authenticated user must have storage.hmacKeys.delete permission for the project in which /// the key exists. /// /// For general information about HMAC keys in Cloud Storage, see /// [HMAC Keys](https://cloud.google.com/storage/docs/authentication/hmackeys). /// ### Example /// ```no_run /// # fn main() -> Result<(), Box<dyn std::error::Error>> { /// use cloud_storage::sync::Client; /// use cloud_storage::hmac_key::{HmacKey, HmacState}; /// /// let client = Client::new()?; /// let key = client.hmac_key().update("your key", HmacState::Inactive)?; // this is required. /// client.hmac_key().delete(&key.access_id)?; /// # Ok(()) /// # } pub fn delete(&self, access_id: &str) -> crate::Result<()> { self.0 .runtime .block_on(self.0.client.hmac_key().delete(access_id)) } }
40.610687
100
0.603383
1c4a03754e4b359ee17dfea20d652bf76038fa2f
10,921
css
CSS
ca.ets.sofeess.specml.style/resources/theme_specml.css
afpaz/specml
0d4510354f5753bcfef07aec0edcfbc71e221efa
[ "Apache-2.0" ]
null
null
null
ca.ets.sofeess.specml.style/resources/theme_specml.css
afpaz/specml
0d4510354f5753bcfef07aec0edcfbc71e221efa
[ "Apache-2.0" ]
null
null
null
ca.ets.sofeess.specml.style/resources/theme_specml.css
afpaz/specml
0d4510354f5753bcfef07aec0edcfbc71e221efa
[ "Apache-2.0" ]
null
null
null
/* Copyright (c) 2016-2019 ÉTS * * 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 * * https://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. */ * { svgCssFile: 'platform:/plugin/ca.ets.sofeess.specml.style/resources/theme_svg.css'; /* The stylesheet to apply to all SVG Images */ } /*********************************************************************************************/ /* SRATS */ /*********************************************************************************************/ [appliedStereotypes~=SystemRequirement] { svgFile: 'platform:/plugin/ca.ets.sofeess.specml.style/icons/srats.svg'; /*fillColor: #941100; /* RGB Function for Dim Grey */ /*svgCssClass: srats;*/ } Class[appliedStereotypes~=SystemRequirement] > Compartment { visible: false; } Class[appliedStereotypes~=SystemRequirement] > Compartment[kind=symbol] { visible: true; } Class[appliedStereotypes~=SystemRequirement] { transparency: 100; displayName: false; displayBorder: false; maintainSymbolRatio: true; elementIcon: false; isFloatingLabelConstrained: false; } Class[appliedStereotypes~=SystemRequirement] > Label[kind="FloatingLabel"] { visible: true; } Class[appliedStereotypes~=SystemRequirement] > Label[type=StereotypeLabel] { visible: true; } /*********************************************************************************************/ /* HLR */ /*********************************************************************************************/ [appliedStereotypes~=HighLevelRequirement] { svgFile: 'platform:/plugin/ca.ets.sofeess.specml.style/icons/hlr.svg'; /*fillColor: #005493; /* All CSS Color Names: http://www.w3schools.com/cssref/css_colornames.asp */ /*svgCssClass: hlr;*/ } Class[appliedStereotypes~=HighLevelRequirement] > Compartment { visible: false; } Class[appliedStereotypes~=HighLevelRequirement] > Compartment[kind=symbol] { visible: true; } Class[appliedStereotypes~=HighLevelRequirement] { transparency: 100; displayName: false; displayBorder: false; maintainSymbolRatio: true; elementIcon: false; isFloatingLabelConstrained: false; } Class[appliedStereotypes~=HighLevelRequirement] > Label[kind="FloatingLabel"] { visible: true; } Class[appliedStereotypes~=HighLevelRequirement] > Label[type=StereotypeLabel] { visible: true; } /*********************************************************************************************/ /* LLR */ /*********************************************************************************************/ [appliedStereotypes~=LowLevelRequirement] { svgFile: 'platform:/plugin/ca.ets.sofeess.specml.style/icons/llr.svg'; /*fillColor: #009051; /* HTML Code for Dark Green */ /*svgCssClass: llr;*/ } Class[appliedStereotypes~=LowLevelRequirement] > Compartment { visible: false; } Class[appliedStereotypes~=LowLevelRequirement] > Compartment[kind=symbol] { visible: true; } Class[appliedStereotypes~=LowLevelRequirement] { transparency: 100; displayName: false; displayBorder: false; maintainSymbolRatio: true; elementIcon: false; isFloatingLabelConstrained: false; } Class[appliedStereotypes~=LowLevelRequirement] > Label[kind="FloatingLabel"] { visible: true; } Class[appliedStereotypes~=LowLevelRequirement] > Label[type=StereotypeLabel] { visible: true; } /*********************************************************************************************/ /* Timed Instant Observation */ /*********************************************************************************************/ /*[appliedStereotypes~=TimedInstantObservation] { svgFile: 'platform:/plugin/ca.ets.sofeess.specml.style/icons/timed.svg'; } Class[appliedStereotypes~=TimedInstantObservation] > Compartment { visible: false; } Class[appliedStereotypes~=TimedInstantObservation] > Compartment[kind=symbol] { visible: true; } Class[appliedStereotypes~=TimedInstantObservation] > Comment { visible: true; } Class[appliedStereotypes~=TimedInstantObservation] { transparency: 100; displayName: false; displayBorder: false; maintainSymbolRatio: true; elementIcon: false; isFloatingLabelConstrained: true; } Class[appliedStereotypes~=TimedInstantObservation] > Label[kind="FloatingLabel"] { visible: true; } Class[appliedStereotypes~=TimedInstantObservation] > Label[type=StereotypeLabel] { visible: false; }*/ /*********************************************************************************************/ /* Timed Duration Constraint */ /*********************************************************************************************/ /*[appliedStereotypes~=TimedDurationConstraint] { elementIcon: false; shapeVisibility: true; svgFile: 'platform:/plugin/ca.ets.sofeess.specml.style/icons/timed.svg'; canonical: true; }*/ /*********************************************************************************************/ /* Timed Event */ /*********************************************************************************************/ /*[appliedStereotypes~=TimedEvent] { svgFile: 'platform:/plugin/ca.ets.sofeess.specml.style/icons/timed.svg'; } Class[appliedStereotypes~=TimedEvent] > Compartment { visible: false; } Class[appliedStereotypes~=TimedEvent] > Compartment[kind=symbol] { visible: true; } Class[appliedStereotypes~=TimedEvent] > Comment { visible: true; } Class[appliedStereotypes~=TimedEvent] { transparency: 100; displayName: false; displayBorder: false; maintainSymbolRatio: true; elementIcon: false; isFloatingLabelConstrained: true; } Class[appliedStereotypes~=TimedEvent] > Label[kind="FloatingLabel"] { visible: true; } Class[appliedStereotypes~=TimedEvent] > Label[type=StereotypeLabel] { visible: false; }*/ /*********************************************************************************************/ /* Timed Domain */ /*********************************************************************************************/ [appliedStereotypes~=TimedDomain] { elementIcon: false; shapeVisibility: true; svgFile: 'platform:/plugin/ca.ets.sofeess.specml.style/icons/timed.svg'; canonical: true; } /*********************************************************************************************/ /* Property-Based Statement */ /*********************************************************************************************/ [appliedStereotypes~=PropertyBasedStatement] { svgFile: 'platform:/plugin/ca.ets.sofeess.specml.style/icons/pbs.svg'; } Class[appliedStereotypes~=PropertyBasedStatement] > Compartment { visible: false; } Class[appliedStereotypes~=PropertyBasedStatement] > Compartment[kind=symbol] { visible: true; } Class[appliedStereotypes~=PropertyBasedStatement] { transparency: 100; displayName: false; displayBorder: false; maintainSymbolRatio: true; elementIcon: false; isFloatingLabelConstrained: false; } Class[appliedStereotypes~=PropertyBasedStatement] > Label[kind="FloatingLabel"] { visible: true; } Class[appliedStereotypes~=PropertyBasedStatement] > Label[type=StereotypeLabel] { visible: true; } /*********************************************************************************************/ /* Constraint Block */ /*********************************************************************************************/ [appliedStereotypes~=ConstraintBlock] { svgFile: 'platform:/plugin/ca.ets.sofeess.specml.style/icons/constraint.svg'; } Class[appliedStereotypes~=ConstraintBlock] > Compartment { visible: false; } Class[appliedStereotypes~=ConstraintBlock] > Compartment[kind=symbol] { visible: true; } Class[appliedStereotypes~=ConstraintBlock] { transparency: 100; displayName: false; displayBorder: false; maintainSymbolRatio: true; elementIcon: false; isFloatingLabelConstrained: false; } Class[appliedStereotypes~=ConstraintBlock] > Label[kind="FloatingLabel"] { visible: true; } Class[appliedStereotypes~=ConstraintBlock] > Label[type=StereotypeLabel] { visible: true; } /*********************************************************************************************/ /* Dependencies */ /*********************************************************************************************/ Dependency[appliedStereotypes~=Formalization] > Label:name { visible: false; } Dependency[appliedStereotypes~=Predicate] > Label:name { visible: false; } Dependency[appliedStereotypes~=Condition] > Label:name { visible: false; } Dependency[appliedStereotypes~=Copy] > Label:name { visible: false; } Dependency[appliedStereotypes~=Derive] > Label:name { visible: false; } Dependency[appliedStereotypes~=RefineReqt] > Label:name { visible: false; } Dependency[appliedStereotypes~=Coupled] > Label:name { visible: false; } /*********************************************************************************************/ /* Package */ /*********************************************************************************************/ [appliedStereotypes~=Spec] { svgFile: 'platform:/plugin/ca.ets.sofeess.specml.style/icons/package.svg'; } Package { shapeDirection: 2; /* Top-Right to avoid overlapping with Name */ } .showSymbol Compartment { visible: false; } .showSymbol Compartment[kind=symbol] { visible: true; } .showSymbol, .showSymbol * { transparency: 100; displayName: false; displayBorder: false; maintainSymbolRatio: false; followSVGSymbol: true; elementIcon: true; } /** Specific settings for Packages, because they should display their internal contents */ Package.showSymbol > Compartment[kind=symbol] { visible: false; } .showSymbol > Label[type=StereotypeLabel] { visible: true; } Package.showSymbol { displayBorder:true; transparency: 0; lineWidth:2; } .showSymbol > Label[kind="FloatingLabel"] { visible:true; }
29.757493
132
0.553338
0a3d82395a8eb81860b4a9746317b0a8a2d00274
8,090
kt
Kotlin
jetpack_compose/WhatsAppCompose/app/src/main/java/com/project/pradyotprakash/whatsappcompose/modules/status/viewModel/StatusViewModel.kt
pradyotprksh/development_learning
b6c5494196842f3c273965063815ad222a18b4da
[ "MIT" ]
9
2021-09-03T06:20:48.000Z
2022-03-19T12:43:30.000Z
jetpack_compose/WhatsAppCompose/app/src/main/java/com/project/pradyotprakash/whatsappcompose/modules/status/viewModel/StatusViewModel.kt
pradyotprksh/development_learning
b6c5494196842f3c273965063815ad222a18b4da
[ "MIT" ]
null
null
null
jetpack_compose/WhatsAppCompose/app/src/main/java/com/project/pradyotprakash/whatsappcompose/modules/status/viewModel/StatusViewModel.kt
pradyotprksh/development_learning
b6c5494196842f3c273965063815ad222a18b4da
[ "MIT" ]
6
2021-08-16T01:13:36.000Z
2022-03-19T12:44:10.000Z
/* * MIT License * * Copyright (c) 2021 Pradyot Prakash * * 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. */ package com.project.pradyotprakash.whatsappcompose.modules.status.viewModel import android.app.Activity import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import com.project.pradyotprakash.whatsappcompose.R import com.project.pradyotprakash.whatsappcompose.models.Status import com.project.pradyotprakash.whatsappcompose.models.StatusDivision import com.project.pradyotprakash.whatsappcompose.models.StatusFirestore import com.project.pradyotprakash.whatsappcompose.utils.FirestoreCallbacks import com.project.pradyotprakash.whatsappcompose.utils.FirestoreUtility import com.project.pradyotprakash.whatsappcompose.utils.Utility /** * A view model for the StatusView which will do all the business logic and update the * ui state as per the requirement. */ class StatusViewModel : ViewModel() { private val firestoreUtility: FirestoreUtility = FirestoreUtility() var firstCallDone: Boolean = false /** * Message to be shown to the user. */ private val _message = MutableLiveData("") val message: LiveData<String> = _message /** * Is there is message to be shown to the user. */ private val _showMessage = MutableLiveData(false) val showMessage: LiveData<Boolean> = _showMessage /** * Update show message and value when the snack bar is dismissed. * * This is required to let the compose know that the snackbar is being dismissed so when * next time the snackbar needs to be re-build it will do that instead of not re-building it * since the value has not changed. */ fun snackbarDismissed() { _showMessage.value = false _message.value = "" } /** * Is a loader need to be shown to the user. */ private val _loading = MutableLiveData(false) val loading: LiveData<Boolean> = _loading /** * Status entered by the user. */ private val _status = MutableLiveData("") val status: LiveData<String> = _status /** * Update status entered by the user */ fun updateStatus(value: String) { _status.value = value } /** * Status in the database */ val allStatus = MutableLiveData(listOf<StatusDivision>()) val currentUserStatus = MutableLiveData(listOf<StatusDivision>()) /** * Listen to status changes */ fun getStatus() { _loading.value = true firestoreUtility.allStatus( callbacks = object : FirestoreCallbacks { override fun status(newStatus: List<Status>) { val division: MutableList<StatusDivision> = mutableListOf() val userStatus: MutableList<StatusDivision> = mutableListOf() for (status in newStatus.indices) { val createdBy = newStatus[status].createdBy val statusDivision = StatusDivision() statusDivision.createdBy = createdBy statusDivision.userDetails = newStatus[status].userDetails if (firestoreUtility.currentUserReference() != createdBy) { statusDivision.status.add(newStatus[status]) if (division.isNotEmpty() && division.last().createdBy == newStatus[status].createdBy ) { division.last().status.add(newStatus[status]) } else { division.add(statusDivision) } } else { if (userStatus.isEmpty()) { statusDivision.status.add(newStatus[status]) userStatus.add(statusDivision) } else { userStatus.last().status.add(newStatus[status]) } } } division.forEach { it -> it.status.sortBy { it.createdOn } } userStatus.forEach { it -> it.status.sortBy { it.createdOn } } currentUserStatus.value = userStatus allStatus.value = division _loading.value = false } override fun onError(message: String) { _loading.value = false _showMessage.value = true _message.value = message } } ) } /** * Upload status on DB */ fun uploadStatus(currentActivity: Activity?) { if (loading.value == true) return try { startUploadStatus(currentActivity) } catch (exception: Exception) { Utility.showMessage(exception.localizedMessage ?: "") } } /** * Start uploading the status */ private fun startUploadStatus(currentActivity: Activity?) { val activity = getActivity(currentActivity) val statusMessage = getStatus(activity) _loading.value = true val status = StatusFirestore( statusMessage = statusMessage, createdBy = firestoreUtility.currentUserReference(), appVersion = Utility.applicationVersion(), deviceId = Utility.getDeviceId(), deviceModel = Utility.deviceModel(), deviceOs = Utility.systemOS(), createdOn = Utility.currentTimeStamp(), ) firestoreUtility.createStatus( statusFirestore = status, callbacks = object : FirestoreCallbacks { override fun isTrue() { _loading.value = false _status.value = "" } override fun onError(message: String) { _status.value = "" _loading.value = false Utility.showMessage(message = message) } } ) } /** * Returns a non-nullable activity * * Throws exception */ @kotlin.jvm.Throws(IllegalArgumentException::class) private fun getActivity(currentActivity: Activity?): Activity { return currentActivity ?: throw IllegalArgumentException() } /** * Get status value * * Throws exception */ @kotlin.jvm.Throws(IllegalArgumentException::class) private fun getStatus(activity: Activity): String { val status = _status.value ?: throw IllegalArgumentException(activity.getString(R.string.user_status_empty)) if (status.isEmpty()) { throw IllegalArgumentException(activity.getString(R.string.user_status_empty)) } return status } }
35.955556
96
0.6
7aa7ab1709bad54ae3b033ce712cb4504078a85a
223
swift
Swift
src/sqlite/SQLiteTableState.swift
siyuyue/dflat
d39e5299ee55590e08f524612f0402cc023dc47c
[ "BSD-3-Clause" ]
264
2020-06-29T23:15:53.000Z
2022-02-17T06:26:34.000Z
src/sqlite/SQLiteTableState.swift
siyuyue/dflat
d39e5299ee55590e08f524612f0402cc023dc47c
[ "BSD-3-Clause" ]
2
2020-11-04T18:18:40.000Z
2022-01-06T04:26:28.000Z
src/sqlite/SQLiteTableState.swift
siyuyue/dflat
d39e5299ee55590e08f524612f0402cc023dc47c
[ "BSD-3-Clause" ]
7
2020-07-02T09:50:20.000Z
2021-08-03T22:37:31.000Z
// This is state shared by one table. However, since we will have a pivotal table, // this state can end up be manipulated with multiple tables. final class SQLiteTableState { var tableCreated = Set<ObjectIdentifier>() }
37.166667
82
0.762332
f69515daa3e59fc4ebd920e11897ebe3a38a85ed
270
sql
SQL
resources/sql/autopatches/20190416.chart.01.storage.sql
Rob--W/phabricator
8272f3f7fa92179931a2fc7ca33909492cfc644d
[ "Apache-2.0" ]
8,840
2015-01-02T03:04:43.000Z
2022-03-29T05:24:18.000Z
resources/sql/autopatches/20190416.chart.01.storage.sql
Rob--W/phabricator
8272f3f7fa92179931a2fc7ca33909492cfc644d
[ "Apache-2.0" ]
73
2015-01-06T11:05:32.000Z
2021-12-02T17:50:10.000Z
resources/sql/autopatches/20190416.chart.01.storage.sql
Rob--W/phabricator
8272f3f7fa92179931a2fc7ca33909492cfc644d
[ "Apache-2.0" ]
1,335
2015-01-04T03:15:40.000Z
2022-03-30T23:34:27.000Z
CREATE TABLE {$NAMESPACE}_fact.fact_chart ( id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, chartKey BINARY(12) NOT NULL, chartParameters LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT}, UNIQUE KEY `key_chart` (chartKey) ) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
38.571429
60
0.77037
d27ff3f7511be9310aa7ccf33bf45cfea779cc07
6,548
php
PHP
src/Urbem/CoreBundle/Repository/Imobiliario/ConstrucaoRepository.php
evandojunior/urbem3.0
ba8d54109e51e82b689d1881e582fb0bce4375e0
[ "MIT" ]
null
null
null
src/Urbem/CoreBundle/Repository/Imobiliario/ConstrucaoRepository.php
evandojunior/urbem3.0
ba8d54109e51e82b689d1881e582fb0bce4375e0
[ "MIT" ]
null
null
null
src/Urbem/CoreBundle/Repository/Imobiliario/ConstrucaoRepository.php
evandojunior/urbem3.0
ba8d54109e51e82b689d1881e582fb0bce4375e0
[ "MIT" ]
1
2020-01-29T20:35:57.000Z
2020-01-29T20:35:57.000Z
<?php namespace Urbem\CoreBundle\Repository\Imobiliario; use Urbem\CoreBundle\Repository\AbstractRepository; class ConstrucaoRepository extends AbstractRepository { /** * @return int */ public function getNextVal() { return $this->nextVal("cod_construcao"); } /** * @param $inscricaoMunicipal * @return array */ public function cadastroImobiliario($inscricaoMunicipal) { $sql = sprintf(" select * from imobiliario.fn_rl_cadastro_imobiliario( ' AND I.inscricao_municipal = %s', '', 'TRUE', ' GROUP BY inscricao_municipal ', ' GROUP BY cod_lote ', ' GROUP BY cod_construcao, cod_tipo ' ) as retorno( inscricao_municipal integer, proprietario_cota text, cod_lote integer, dt_cadastro date, tipo_lote text, valor_lote varchar, endereco varchar, cep varchar, cod_localizacao integer, localizacao text, cod_condominio integer, creci varchar, nom_bairro varchar, logradouro text, situacao text ) order by inscricao_municipal ", $inscricaoMunicipal); $query = $this->_em->getConnection()->prepare($sql); $query->execute(); return $query->fetch(\PDO::FETCH_ASSOC); } /** * @param $inscricaoMunicipal * @return array */ public function areaImovel($inscricaoMunicipal) { $sql = " SELECT imobiliario.fn_calcula_area_imovel( inscricao_municipal ) AS area_imovel, imobiliario.fn_calcula_area_imovel_lote( inscricao_municipal ) AS area_imovel_lote, imobiliario.fn_calcula_area_imovel_construcao( inscricao_municipal ) AS area_total FROM imobiliario.imovel WHERE inscricao_municipal = :inscricaoMunicipal "; $query = $this->_em->getConnection()->prepare($sql); $query->bindValue('inscricaoMunicipal', $inscricaoMunicipal, \PDO::PARAM_INT); $query->execute(); return $query->fetch(\PDO::FETCH_ASSOC); } /** * @param $inscricaoMunicipal * @return array */ public function unidadeAutonoma($inscricaoMunicipal) { $sql = " SELECT UA.* FROM imobiliario.unidade_autonoma UA LEFT JOIN ( SELECT BAL.* FROM imobiliario.baixa_unidade_autonoma AS BAL, ( SELECT MAX (TIMESTAMP) AS TIMESTAMP, inscricao_municipal, cod_tipo, cod_construcao FROM imobiliario.baixa_unidade_autonoma GROUP BY inscricao_municipal, cod_tipo, cod_construcao ) AS BT WHERE BAL.inscricao_municipal = BT.inscricao_municipal AND BAL.cod_tipo = BT.cod_tipo AND BAL.cod_construcao = BT.cod_construcao AND BAL.timestamp = BT.timestamp ) bua ON bua.inscricao_municipal = ua.inscricao_municipal AND bua.cod_tipo= ua.cod_tipo AND bua.cod_construcao = ua.cod_construcao WHERE ((bua.dt_inicio IS NULL) OR (bua.dt_inicio IS NOT NULL AND bua.dt_termino IS NOT NULL) AND bua.inscricao_municipal = ua.inscricao_municipal AND bua.cod_tipo= ua.cod_tipo AND bua.cod_construcao = ua.cod_construcao) AND ua.inscricao_municipal = :inscricaoMunicipal ORDER BY cod_construcao "; $query = $this->_em->getConnection()->prepare($sql); $query->bindValue('inscricaoMunicipal', $inscricaoMunicipal, \PDO::PARAM_INT); $query->execute(); return $query->fetch(\PDO::FETCH_ASSOC); } }
44.243243
183
0.349572
9bdd67f2903880a811cd365e9de59c4a2efadce5
2,947
js
JavaScript
unpackage/dist/build/.tmp/app-plus/pages/ali/ali.js
simplett/lanzeapp
4e0d460d33cba54473f8b57f44ce6dac4b37f9db
[ "Apache-2.0" ]
2
2020-04-17T02:30:04.000Z
2020-04-17T02:30:06.000Z
unpackage/dist/build/.tmp/app-plus/pages/ali/ali.js
simplett/lanzeapp
4e0d460d33cba54473f8b57f44ce6dac4b37f9db
[ "Apache-2.0" ]
null
null
null
unpackage/dist/build/.tmp/app-plus/pages/ali/ali.js
simplett/lanzeapp
4e0d460d33cba54473f8b57f44ce6dac4b37f9db
[ "Apache-2.0" ]
null
null
null
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/ali/ali"],{3370:function(e,t,n){"use strict";n.r(t);var r=n("914f"),a=n.n(r);for(var o in r)"default"!==o&&function(e){n.d(t,e,function(){return r[e]})}(o);t["default"]=a.a},"6f81":function(e,t,n){"use strict";(function(e){n("590e"),n("921b");r(n("66fd"));var t=r(n("cdf2"));function r(e){return e&&e.__esModule?e:{default:e}}e(t.default)}).call(this,n("6e42")["createPage"])},"914f":function(e,t,n){"use strict";(function(e,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=o(n("a34a"));function o(e){return e&&e.__esModule?e:{default:e}}function u(e,t,n,r,a,o,u){try{var i=e[o](u),c=i.value}catch(s){return void n(s)}i.done?t(c):Promise.resolve(c).then(r,a)}function i(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){u(o,r,a,i,c,"next",e)}function c(e){u(o,r,a,i,c,"throw",e)}i(void 0)})}}var c={data:function(){return{oosArr:[],upImgOos:{aliConfig:{AccessKeySecret:"CbVR0tmpKXqAIEXxavJDqad3lcIIez",OSSAccessKeyId:"LTAIlbkoZl60gNWT",oosDirectory:"userimage",url:"https://simplett-img.oss-cn-beijing.aliyuncs.com/"},notli:!1,count:4,upBgColor:"#E8A400",upIconColor:"#eee",upSvgIconName:"icon-certificate"}}},methods:{uImageTap:function(){this.$refs.uImage.uploadimage(this.upImgOos)},delImgInfo:function(){var t=i(a.default.mark(function t(n){return a.default.wrap(function(t){while(1)switch(t.prev=t.next){case 0:console.log(e("你删除的图片地址为:",n,this.oosArr.splice(n.index,1)," at pages\\ali\\ali.vue:47"));case 1:case"end":return t.stop()}},t,this)}));function n(e){return t.apply(this,arguments)}return n}(),upOosData:function(){var t=i(a.default.mark(function t(n){var o,u,i;return a.default.wrap(function(t){while(1)switch(t.prev=t.next){case 0:o=[],u=0,i=n.length;case 2:if(!(u<i)){t.next=15;break}if(t.prev=3,""==n[u].path_server){t.next=7;break}return t.next=7,o.push(n[u].path_server.split(","));case 7:t.next=12;break;case 9:t.prev=9,t.t0=t["catch"](3),console.log(e("上传失败..."," at pages\\ali\\ali.vue:59"));case 12:u++,t.next=2;break;case 15:this.oosArr=o,o.length==this.upImgOos.count&&r.showToast({title:"上传成功",icon:"none"});case 17:case"end":return t.stop()}},t,this,[[3,9]])}));function n(e){return t.apply(this,arguments)}return n}(),getUpImgInfoOos:function(){console.log(e("阿里云转成一维数组:",this.oosArr.join().split(",")," at pages\\ali\\ali.vue:75"))}}};t.default=c}).call(this,n("0de9")["default"],n("6e42")["default"])},cd35:function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement;e._self._c},a=[];n.d(t,"a",function(){return r}),n.d(t,"b",function(){return a})},cdf2:function(e,t,n){"use strict";n.r(t);var r=n("cd35"),a=n("3370");for(var o in a)"default"!==o&&function(e){n.d(t,e,function(){return a[e]})}(o);var u=n("2877"),i=Object(u["a"])(a["default"],r["a"],r["b"],!1,null,null,null);t["default"]=i.exports}},[["6f81","common/runtime","common/vendor"]]]);
2,947
2,947
0.677978
50af85a810f547586153e70eeb5fb15ae84812f4
798
asm
Assembly
programs/oeis/205/A205185.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/205/A205185.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
programs/oeis/205/A205185.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
; A205185: Period 6: repeat [1, 8, 9, 8, 1, 0]. ; 1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8,1,0,1,8,9,8 mov $1,$0 mov $0,3 sub $1,1 mov $3,$1 mov $1,6 mov $2,9 add $3,5 lpb $0 add $2,5 add $3,$0 sub $0,1 gcd $3,6 sub $3,$0 add $3,$2 mov $1,$3 mov $4,1 add $4,$2 mov $2,1 sub $4,$3 mul $2,$4 mov $0,$2 sub $2,2 lpe sub $1,6
28.5
501
0.492481
c0551a10f0c35cf946c92016f9031bd345f1fc79
779
kt
Kotlin
src/main/kotlin/br/com/zup/felipe/gadelha/api/v1/dto/response/PixRs.kt
FelipeGadelha/orange-talents-06-template-pix-keymanager-rest
437df16c595bf76af516c293d2de43f32cb68a06
[ "Apache-2.0" ]
null
null
null
src/main/kotlin/br/com/zup/felipe/gadelha/api/v1/dto/response/PixRs.kt
FelipeGadelha/orange-talents-06-template-pix-keymanager-rest
437df16c595bf76af516c293d2de43f32cb68a06
[ "Apache-2.0" ]
null
null
null
src/main/kotlin/br/com/zup/felipe/gadelha/api/v1/dto/response/PixRs.kt
FelipeGadelha/orange-talents-06-template-pix-keymanager-rest
437df16c595bf76af516c293d2de43f32cb68a06
[ "Apache-2.0" ]
null
null
null
package br.com.zup.felipe.gadelha.api.v1.dto.response import br.com.zup.felipe.gadelha.AccountType import br.com.zup.felipe.gadelha.FindAllPixRs import br.com.zup.felipe.gadelha.PixKeyType import java.time.LocalDateTime import java.time.ZoneOffset data class PixRs( val pixId: String, val keyPix: String, val keyType: PixKeyType, val accountType: AccountType, val createdAt: String ) { constructor(result: FindAllPixRs.KeyRs): this ( pixId = result.pixId, keyPix = result.value, keyType = result.keyType, accountType = result.accountType, createdAt = LocalDateTime .ofEpochSecond(result.createdAt.seconds, result.createdAt.nanos, ZoneOffset.UTC).toString() ) }
29.961538
107
0.682927
24fac679f3f48bdb86d7fd0b7ade637490a449e3
12,695
go
Go
internal/reporter/msteams/reporter.go
jemueldalino/samsahai
85c77c327d591b1b0ec4408cf62e09559b05aef6
[ "Apache-2.0" ]
null
null
null
internal/reporter/msteams/reporter.go
jemueldalino/samsahai
85c77c327d591b1b0ec4408cf62e09559b05aef6
[ "Apache-2.0" ]
101
2020-05-06T08:47:50.000Z
2021-07-21T06:06:44.000Z
internal/reporter/msteams/reporter.go
jemueldalino/samsahai
85c77c327d591b1b0ec4408cf62e09559b05aef6
[ "Apache-2.0" ]
null
null
null
package msteams import ( "strings" s2hv1beta1 "github.com/agoda-com/samsahai/api/v1beta1" "github.com/agoda-com/samsahai/internal" s2herrors "github.com/agoda-com/samsahai/internal/errors" s2hlog "github.com/agoda-com/samsahai/internal/log" "github.com/agoda-com/samsahai/internal/util/msteams" "github.com/agoda-com/samsahai/internal/util/template" "github.com/agoda-com/samsahai/pkg/samsahai/rpc" ) var logger = s2hlog.Log.WithName(ReporterName) const ( ReporterName = "msteams" componentUpgradeInterval = s2hv1beta1.IntervalRetry componentUpgradeCriteria = s2hv1beta1.CriteriaFailure styleDanger = `style="color:#EE2828"` styleWarning = `style="color:#EEA328"` styleInfo = `style="color:#2EB44E"` ) type reporter struct { msTeams msteams.MSTeams } // NewOption allows specifying various configuration type NewOption func(*reporter) // WithMSTeamsClient specifies msteams client to override when creating Microsoft Teams reporter func WithMSTeamsClient(msTeams msteams.MSTeams) NewOption { if msTeams == nil { panic("Microsoft Teams client should not be nil") } return func(r *reporter) { r.msTeams = msTeams } } // New creates a new Microsoft Teams reporter func New(tenantID, clientID, clientSecret, username, password string, opts ...NewOption) internal.Reporter { r := &reporter{ msTeams: newMSTeams(tenantID, clientID, clientSecret, username, password), } // apply the new options for _, opt := range opts { opt(r) } return r } // newMSTeams returns reporter for sending report via Microsoft Teams into specific groups and channels func newMSTeams(tenantID, clientID, clientSecret, username, password string) msteams.MSTeams { return msteams.NewClient(tenantID, clientID, clientSecret, username, password) } // GetName returns msteams type func (r *reporter) GetName() string { return ReporterName } // SendComponentUpgrade implements the reporter SendComponentUpgrade function func (r *reporter) SendComponentUpgrade(configCtrl internal.ConfigController, comp *internal.ComponentUpgradeReporter) error { msTeamsConfig, err := r.getMSTeamsConfig(comp.TeamName, configCtrl) if err != nil { return nil } if err := r.checkMatchingInterval(msTeamsConfig, comp.IsReverify); err != nil { return nil } if err := r.checkMatchingCriteria(msTeamsConfig, comp.Status); err != nil { return nil } message := r.makeComponentUpgradeReport(comp) if len(comp.ImageMissingList) > 0 { message += "<hr/>" message += r.makeImageMissingListReport(comp.ImageMissingList) } return r.post(msTeamsConfig, message, internal.ComponentUpgradeType) } func (r *reporter) checkMatchingInterval(msTeamsConfig *s2hv1beta1.MSTeams, isReverify bool) error { interval := componentUpgradeInterval if msTeamsConfig.ComponentUpgrade != nil && msTeamsConfig.ComponentUpgrade.Interval != "" { interval = msTeamsConfig.ComponentUpgrade.Interval } switch interval { case s2hv1beta1.IntervalEveryTime: default: if !isReverify { return s2herrors.New("interval was not matched") } } return nil } func (r *reporter) checkMatchingCriteria(msTeamsConfig *s2hv1beta1.MSTeams, status rpc.ComponentUpgrade_UpgradeStatus) error { criteria := componentUpgradeCriteria if msTeamsConfig.ComponentUpgrade != nil && msTeamsConfig.ComponentUpgrade.Criteria != "" { criteria = msTeamsConfig.ComponentUpgrade.Criteria } switch criteria { case s2hv1beta1.CriteriaBoth: case s2hv1beta1.CriteriaSuccess: if status != rpc.ComponentUpgrade_UpgradeStatus_SUCCESS { return s2herrors.New("criteria was not matched") } default: if status != rpc.ComponentUpgrade_UpgradeStatus_FAILURE { return s2herrors.New("criteria was not matched") } } return nil } // SendActivePromotionStatus implements the reporter SendActivePromotionStatus function func (r *reporter) SendActivePromotionStatus(configCtrl internal.ConfigController, atpRpt *internal.ActivePromotionReporter) error { msTeamsConfig, err := r.getMSTeamsConfig(atpRpt.TeamName, configCtrl) if err != nil { return nil } message := r.makeActivePromotionStatusReport(atpRpt) imageMissingList := atpRpt.ActivePromotionStatus.PreActiveQueue.ImageMissingList if len(imageMissingList) > 0 { message += "<hr/>" message += r.makeImageMissingListReport(convertImageListToRPCImageList(imageMissingList)) } if atpRpt.HasOutdatedComponent { message += "<hr/>" message += r.makeOutdatedComponentsReport(atpRpt.OutdatedComponents) } else { message += "<br/>" message += r.makeNoOutdatedComponentsReport() } message += "<br/>" isDemotionFailed := atpRpt.DemotionStatus == s2hv1beta1.ActivePromotionDemotionFailure if isDemotionFailed { message += "<br/>" message += r.makeActiveDemotingFailureReport() } if atpRpt.RollbackStatus == s2hv1beta1.ActivePromotionRollbackFailure { message += "<br/>" message += r.makeActivePromotionRollbackFailureReport() } hasPreviousActiveNamespace := atpRpt.PreviousActiveNamespace != "" if atpRpt.Result == s2hv1beta1.ActivePromotionSuccess && hasPreviousActiveNamespace && !isDemotionFailed { message += "<br/>" message += r.makeDestroyedPreviousActiveTimeReport(&atpRpt.ActivePromotionStatus) } return r.post(msTeamsConfig, message, internal.ActivePromotionType) } func convertImageListToRPCImageList(images []s2hv1beta1.Image) []*rpc.Image { rpcImages := make([]*rpc.Image, 0) for _, img := range images { rpcImages = append(rpcImages, &rpc.Image{ Repository: img.Repository, Tag: img.Tag, }) } return rpcImages } // SendImageMissing implements the reporter SendImageMissing function func (r *reporter) SendImageMissing(teamName string, configCtrl internal.ConfigController, images *rpc.Image) error { msTeamsConfig, err := r.getMSTeamsConfig(teamName, configCtrl) if err != nil { return nil } message := r.makeImageMissingListReport([]*rpc.Image{images}) return r.post(msTeamsConfig, message, internal.ImageMissingType) } func (r *reporter) makeComponentUpgradeReport(comp *internal.ComponentUpgradeReporter) string { message := ` <b>Component Upgrade:</b><span {{ if eq .Status 1 }}` + styleInfo + `> Success {{ else }}` + styleDanger + `> Failure{{ end }}</span> {{- if eq .Status 0 }} <li><b>Issue type:</b> {{ .IssueTypeStr }}</li> {{- end }} <li><b>Run:</b>{{ if .IsReverify }} Reverify {{ else }} #{{ .Runs }} {{ end }}</li> <li><b>Component:</b> {{ .Name }}</li> <li><b>Version:</b> {{ .Image.Tag }}</li> <li><b>Repository:</b> {{ .Image.Repository }}</li> <li><b>Owner:</b> {{ .TeamName }}</li> <li><b>Namespace:</b> {{ .Namespace }}</li> {{- if eq .Status 0 }} {{- if .TestRunner.Teamcity.BuildURL }} <li><b>Teamcity URL:</b> <a href="{{ .TestRunner.Teamcity.BuildURL }}">Click here</a></li> {{- end }} <li><b>Deployment Logs:</b> <a href="{{ .SamsahaiExternalURL }}/teams/{{ .TeamName }}/queue/histories/{{ .QueueHistoryName }}/log">Download here</a></li> <li><b>Deployment History:</b> <a href="{{ .SamsahaiExternalURL }}/teams/{{ .TeamName }}/queue/histories/{{ .QueueHistoryName }}">Click here</a></li> {{- end}} ` return strings.TrimSpace(template.TextRender("MSTeamsComponentUpgradeFailure", message, comp)) } func (r *reporter) makeActivePromotionStatusReport(comp *internal.ActivePromotionReporter) string { var message = ` <b>Active Promotion:</b> <span {{ if eq .Result "Success" }}` + styleInfo + `{{ else if eq .Result "Failure" }}` + styleDanger + `{{ end }}>{{ .Result }}</span> {{- if ne .Result "Success" }} {{- range .Conditions }} {{- if eq .Type "` + string(s2hv1beta1.ActivePromotionCondActivePromoted) + `" }} <br/><b>Reason:</b> {{ .Message }} {{- end }} {{- end }} {{- end }} <li><b>Current Active Namespace:</b> {{ .CurrentActiveNamespace }}</li> <li><b>Owner:</b> {{ .TeamName }}</li> {{- if and .PreActiveQueue.TestRunner (and .PreActiveQueue.TestRunner.Teamcity .PreActiveQueue.TestRunner.Teamcity.BuildURL) }} <li><b>Teamcity URL:</b> <a href="{{ .PreActiveQueue.TestRunner.Teamcity.BuildURL }}">Click here</a></li> {{- end }} {{- if eq .Result "Failure" }} <li><b>Deployment Logs:</b> <a href="{{ .SamsahaiExternalURL }}/teams/{{ .TeamName }}/activepromotions/histories/{{ .ActivePromotionHistoryName }}/log">Download here</a></li> {{- end }} <li><b>Active Promotion History:</b> <a href="{{ .SamsahaiExternalURL }}/teams/{{ .TeamName }}/activepromotions/histories/{{ .ActivePromotionHistoryName }}">Click here</a></li> ` return strings.TrimSpace(template.TextRender("MSTeamsActivePromotionStatus", message, comp)) } func (r *reporter) makeOutdatedComponentsReport(comps map[string]s2hv1beta1.OutdatedComponent) string { var message = ` <b>Outdated Components:</b> {{- range $name, $component := .Components }} {{- if gt .OutdatedDuration 0 }} <br/> <b>{{ $name }}</b> <li>Not update for {{ .OutdatedDuration | FmtDurationToStr }}</li> <li>Current Version: <a href="{{ .CurrentImage.Repository | ConcatHTTPStr }}">{{ .CurrentImage.Tag }}</a></li> <li>Latest Version: <a href="{{ .DesiredImage.Repository | ConcatHTTPStr }}">{{ .DesiredImage.Tag }}</a></li> {{- end }} {{- end }} ` ocObj := struct { Components map[string]s2hv1beta1.OutdatedComponent }{Components: comps} return strings.TrimSpace(template.TextRender("MSTeamsOutdatedComponents", message, ocObj)) } func (r *reporter) makeNoOutdatedComponentsReport() string { var message = ` <li><b>All components are up to date!</b></li> ` return strings.TrimSpace(template.TextRender("MSTeamsNoOutdatedComponents", message, "")) } func (r *reporter) makeActivePromotionRollbackFailureReport() string { var message = "<b " + styleDanger + ">ERROR:</b> cannot rollback an active promotion process due to timeout" return strings.TrimSpace(template.TextRender("RollbackFailure", message, "")) } func (r *reporter) makeActiveDemotingFailureReport() string { var message = "<b " + styleWarning + ">WARNING:</b> cannot demote a previous active environment, previous active namespace has been destroyed immediately" return strings.TrimSpace(template.TextRender("DemotionFailure", message, "")) } func (r *reporter) makeDestroyedPreviousActiveTimeReport(status *s2hv1beta1.ActivePromotionStatus) string { var message = "<b " + styleWarning + ">NOTES:</b> previous active namespace <code>{{ .PreviousActiveNamespace }}</code> will be destroyed at <code>{{ .DestroyedTime | TimeFormat }}</code>" return strings.TrimSpace(template.TextRender("DestroyedTime", message, status)) } // makeImageMissingListReport implements the reporter makeImageMissingListReport function func (r *reporter) makeImageMissingListReport(images []*rpc.Image) string { var message = ` <b>Image Missing List</b> {{- range .Images }} <li>{{ .Repository }}:{{ .Tag }}</li> {{- end }} ` imagesObj := struct{ Images []*rpc.Image }{Images: images} return strings.TrimSpace(template.TextRender("MSTeamsImageMissingList", message, imagesObj)) } func (r *reporter) post(msTeamsConfig *s2hv1beta1.MSTeams, message string, event internal.EventType) error { logger.Debug("start sending message to Microsoft Teams groups and channels", "event", event, "groups", msTeamsConfig.Groups) accessToken, err := r.msTeams.GetAccessToken() if err != nil { logger.Error(err, "cannot get Microsoft access token", "event", event, "groups", msTeamsConfig.Groups) return err } var globalErr error for _, group := range msTeamsConfig.Groups { // get group id from group name groupID, err := r.msTeams.GetGroupID(group.GroupNameOrID, accessToken) if err != nil { logger.Error(err, "cannot get group id", "event", event, "group", group.GroupNameOrID) continue } for _, channelNameOrID := range group.ChannelNameOrIDs { // get channel id from channel name channelID, err := r.msTeams.GetChannelID(groupID, channelNameOrID, accessToken) if err != nil { logger.Error(err, "cannot get channel id", "event", event, "group", group.GroupNameOrID, "channel", channelNameOrID) continue } if err := r.msTeams.PostMessage(groupID, channelID, message, accessToken, msteams.WithContentType(msteams.HTML)); err != nil { logger.Error(err, "cannot post message to Microsoft Teams", "event", event, "group", group.GroupNameOrID, "channel", channelNameOrID) globalErr = err continue } } } return globalErr } func (r *reporter) getMSTeamsConfig(teamName string, configCtrl internal.ConfigController) (*s2hv1beta1.MSTeams, error) { config, err := configCtrl.Get(teamName) if err != nil { return nil, err } // no Microsoft Teams configuration if config.Spec.Reporter == nil || config.Spec.Reporter.MSTeams == nil { return nil, s2herrors.New("msTeams configuration not found") } return config.Spec.Reporter.MSTeams, nil }
35.166205
189
0.728318
04d3788bd9b821a3ab86a2b6400b2d25e1ff8d39
471
sql
SQL
SQL/AVDB/GENRE.sql
hanwhhanwh/avgrabber
cb0975011520becff7596b69b5345cdddf52c8fc
[ "MIT" ]
null
null
null
SQL/AVDB/GENRE.sql
hanwhhanwh/avgrabber
cb0975011520becff7596b69b5345cdddf52c8fc
[ "MIT" ]
null
null
null
SQL/AVDB/GENRE.sql
hanwhhanwh/avgrabber
cb0975011520becff7596b69b5345cdddf52c8fc
[ "MIT" ]
null
null
null
-- DROP TABLE IF EXISTS `GENRE` CREATE TABLE `GENRE` ( `genre_no` INT NOT NULL AUTO_INCREMENT COMMENT '장르 고유번호' , `genre_name` VARCHAR(100) NOT NULL COMMENT '장르 한글 이름' COLLATE 'utf8_general_ci' , `genre_descript` MEDIUMTEXT NULL COMMENT '장르에 대한 상세 설명' COLLATE 'utf8_general_ci' , `reg_date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP() COMMENT '언어 정보 등록시각' , PRIMARY KEY (`genre_no`) USING BTREE ) COMMENT='장르 정보 테이블' COLLATE='utf8_general_ci' ENGINE=InnoDB ;
31.4
84
0.740977
1ae7ef3c35c8d007d522d5bc924e209e0d3f42a8
394
asm
Assembly
oeis/266/A266912.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/266/A266912.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/266/A266912.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A266912: Numbers n which are anagrams of n+18. ; Submitted by Jamie Morken(s1) ; 13,24,35,46,57,68,79,102,113,124,135,146,157,168,179,202,213,224,235,246,257,268,279,302,313,324,335,346,357,368,379,402,413,424,435,446,457,468,479,502,513,524,535,546,557,568,579,602,613,624,635,646,657 add $0,1 mov $1,$0 mul $0,2 div $1,8 mul $1,2 add $0,$1 mul $0,11 add $0,$1 sub $0,22 div $0,2 add $0,13
24.625
206
0.685279
2a4d51ac3dcd350a634dcf21dfeabd2893b6d4a9
2,685
java
Java
openjdk11/test/jdk/java/awt/Headless/HeadlessBorderLayout.java
iootclab/openjdk
b01fc962705eadfa96def6ecff46c44d522e0055
[ "Apache-2.0" ]
2
2018-06-19T05:43:32.000Z
2018-06-23T10:04:56.000Z
openjdk11/test/jdk/java/awt/Headless/HeadlessBorderLayout.java
iootclab/openjdk
b01fc962705eadfa96def6ecff46c44d522e0055
[ "Apache-2.0" ]
null
null
null
openjdk11/test/jdk/java/awt/Headless/HeadlessBorderLayout.java
iootclab/openjdk
b01fc962705eadfa96def6ecff46c44d522e0055
[ "Apache-2.0" ]
null
null
null
/* * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ import java.awt.*; /* * @test * @summary Check BorderLayout constructors and methods working in headless mode * @run main/othervm -Djava.awt.headless=true HeadlessBorderLayout */ public class HeadlessBorderLayout { public static void main (String[] args) { BorderLayout bl; bl = new BorderLayout(); bl = new BorderLayout(10, 10); bl.getHgap(); bl.setHgap(10); bl.getVgap(); bl.setVgap(10); bl = new BorderLayout(); bl.setVgap(10); bl.addLayoutComponent(new Component(){}, BorderLayout.AFTER_LAST_LINE); bl.addLayoutComponent(new Component(){}, BorderLayout.AFTER_LINE_ENDS); bl.addLayoutComponent(new Component(){}, BorderLayout.BEFORE_FIRST_LINE); bl.addLayoutComponent(new Component(){}, BorderLayout.BEFORE_LINE_BEGINS); bl.addLayoutComponent(new Component(){}, BorderLayout.PAGE_START); bl.addLayoutComponent(new Component(){}, BorderLayout.PAGE_END); bl.addLayoutComponent(new Component(){}, BorderLayout.LINE_START); bl.addLayoutComponent(new Component(){}, BorderLayout.LINE_END); bl.addLayoutComponent(new Component(){}, BorderLayout.CENTER); bl.addLayoutComponent(new Component(){}, BorderLayout.EAST); bl.addLayoutComponent(new Component(){}, BorderLayout.NORTH); bl.addLayoutComponent(new Component(){}, BorderLayout.SOUTH); bl.addLayoutComponent(new Component(){}, BorderLayout.WEST); Component cb = new Component(){}; bl.addLayoutComponent(cb, BorderLayout.WEST); bl.removeLayoutComponent(cb); } }
42.619048
82
0.705028
56b98c995c1716dacc855bb5827a3a8fb8af95b9
1,331
ts
TypeScript
src/app/components/core/filter/filter-alert/filter-alert.component.ts
DDC-NDRS/fledge-iot_fledge-gui
8aaf1593ded35d7ddb10c8d292c4778c0c418d44
[ "Apache-2.0" ]
11
2020-05-02T06:40:01.000Z
2021-12-26T04:17:25.000Z
src/app/components/core/filter/filter-alert/filter-alert.component.ts
DDC-NDRS/fledge-iot_fledge-gui
8aaf1593ded35d7ddb10c8d292c4778c0c418d44
[ "Apache-2.0" ]
105
2018-01-03T12:47:50.000Z
2020-01-21T16:35:56.000Z
src/app/components/core/filter/filter-alert/filter-alert.component.ts
DDC-NDRS/fledge-iot_fledge-gui
8aaf1593ded35d7ddb10c8d292c4778c0c418d44
[ "Apache-2.0" ]
6
2020-03-30T02:45:36.000Z
2022-03-21T13:30:54.000Z
import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core'; @Component({ selector: 'app-filter-alert', templateUrl: './filter-alert.component.html', styleUrls: ['./filter-alert.component.css'] }) export class FilterAlertComponent implements OnInit, OnChanges { @Input() filerDialogData: { id: Number, name: any, key: any, message: any, actionButtonValue: any, headerTextValue: any }; @Output() discardChanges = new EventEmitter<Boolean>(); constructor() { } ngOnInit() { } ngOnChanges() { if (this.filerDialogData) { if (this.filerDialogData.key === 'unsavedConfirmation') { this.filerDialogData.actionButtonValue = 'Discard'; this.filerDialogData.headerTextValue = 'Discard Changes'; } } } public toggleModal(isOpen: Boolean) { const alertModal = <HTMLDivElement>document.getElementById('filter-dialog-box'); if (alertModal.classList.contains('is-active')) { isOpen = false; } if (isOpen) { alertModal.classList.add('is-active'); return; } alertModal.classList.remove('is-active'); } triggerAction() { if (this.filerDialogData) { if (this.filerDialogData.key === 'unsavedConfirmation') { this.discardChanges.emit(true); this.toggleModal(false); } } } }
28.934783
124
0.66266
74b735fb2fdda99786a34ab356a912752454eee4
800
js
JavaScript
test.js
grARM/arms-lib-eslint
19a7097832d488a2dd8a11e8be6e7e95224d2315
[ "MIT" ]
null
null
null
test.js
grARM/arms-lib-eslint
19a7097832d488a2dd8a11e8be6e7e95224d2315
[ "MIT" ]
null
null
null
test.js
grARM/arms-lib-eslint
19a7097832d488a2dd8a11e8be6e7e95224d2315
[ "MIT" ]
null
null
null
var qbLint = require('./tool.js'); var qbIndex = require('./index.js'); var qbNode = require('./node.js'); var testApiGetRules = function () { var rules = qbLint.getRules(); console.log('rules: ', rules, ' -- rules len: ', Object.keys(rules).length); }; var testApiGetConfig = function () { var config = qbLint.getConfig(); console.log('config: ', config, ' -- rules len: ', Object.keys(config.rules).length); }; var testApiGetRuleNames = function () { console.log('list: ', qbLint.getRuleNames()); } var testApiGetqbIndex = function () { console.log('qbIndex: ', qbIndex); } var testApiGetqbNode = function () { console.log('qbNode: ', qbNode); } // testApiGetRules(); // testApiGetConfig(); // testApiGetRuleNames(); // testApiGetqbIndex(); testApiGetqbNode();
22.857143
89
0.64875
3b8b108e2d8b2f63c1fffe690e1f75cdfac67f3a
4,833
h
C
src/heap.h
LLNL/gecko
490ab7d9b7b4e0f007e10d2af2b022b96d427fee
[ "BSD-3-Clause" ]
11
2020-01-21T15:31:16.000Z
2021-07-24T05:28:33.000Z
src/heap.h
LLNL/gecko
490ab7d9b7b4e0f007e10d2af2b022b96d427fee
[ "BSD-3-Clause" ]
null
null
null
src/heap.h
LLNL/gecko
490ab7d9b7b4e0f007e10d2af2b022b96d427fee
[ "BSD-3-Clause" ]
null
null
null
#ifndef DYNAMIC_HEAP_H #define DYNAMIC_HEAP_H #include <algorithm> #include <functional> #include <map> #include <vector> template < typename T, // data type typename P, // priority type class C = std::less<P>, // comparator for priorities class M = std::map<T, unsigned int> // maps type T to unsigned integer > class DynamicHeap { public: DynamicHeap(size_t count = 0); ~DynamicHeap() {} void insert(T data, P priority); void update(T data, P priority); bool top(T& data); bool top(T& data, P& priority); bool pop(); bool extract(T& data); bool extract(T& data, P& priority); bool erase(T data); bool find(T data) const; bool find(T data, P& priority) const; bool empty() const { return heap.empty(); } size_t size() const { return heap.size(); } private: struct HeapEntry { HeapEntry(P p, T d) : priority(p), data(d) {} P priority; T data; }; std::vector<HeapEntry> heap; M index; C lower; void ascend(unsigned int i); void descend(unsigned int i); void swap(unsigned int i, unsigned int j); bool ordered(unsigned int i, unsigned int j) const { return !lower(heap[i].priority, heap[j].priority); } unsigned int parent(unsigned int i) const { return (i - 1) / 2; } unsigned int left(unsigned int i) const { return 2 * i + 1; } unsigned int right(unsigned int i) const { return 2 * i + 2; } }; template < typename T, typename P, class C, class M > DynamicHeap<T, P, C, M>::DynamicHeap(size_t count) { heap.reserve(count); } template < typename T, typename P, class C, class M > void DynamicHeap<T, P, C, M>::insert(T data, P priority) { if (index.find(data) != index.end()) update(data, priority); else { unsigned int i = (unsigned int)heap.size(); heap.push_back(HeapEntry(priority, data)); ascend(i); } } template < typename T, typename P, class C, class M > void DynamicHeap<T, P, C, M>::update(T data, P priority) { unsigned int i = index[data]; heap[i].priority = priority; ascend(i); descend(i); } template < typename T, typename P, class C, class M > bool DynamicHeap<T, P, C, M>::top(T& data) { if (!heap.empty()) { data = heap[0].data; return true; } else return false; } template < typename T, typename P, class C, class M > bool DynamicHeap<T, P, C, M>::top(T& data, P& priority) { if (!heap.empty()) { data = heap[0].data; priority = heap[0].priority; return true; } else return false; } template < typename T, typename P, class C, class M > bool DynamicHeap<T, P, C, M>::pop() { if (!heap.empty()) { T data = heap[0].data; swap(0, (unsigned int)heap.size() - 1); index.erase(data); heap.pop_back(); if (!heap.empty()) descend(0); return true; } else return false; } template < typename T, typename P, class C, class M > bool DynamicHeap<T, P, C, M>::extract(T& data) { if (!heap.empty()) { data = heap[0].data; return pop(); } else return false; } template < typename T, typename P, class C, class M > bool DynamicHeap<T, P, C, M>::extract(T& data, P& priority) { if (!heap.empty()) { data = heap[0].data; priority = heap[0].priority; return pop(); } else return false; } template < typename T, typename P, class C, class M > bool DynamicHeap<T, P, C, M>::erase(T data) { if (index.find(data) == index.end()) return false; unsigned int i = index[data]; swap(i, heap.size() - 1); index.erase(data); heap.pop_back(); if (i < heap.size()) { ascend(i); descend(i); } return true; } template < typename T, typename P, class C, class M > bool DynamicHeap<T, P, C, M>::find(T data) const { return index.find(data) != index.end(); } template < typename T, typename P, class C, class M > bool DynamicHeap<T, P, C, M>::find(T data, P& priority) const { typename M::const_iterator p; if ((p = index.find(data)) == index.end()) return false; unsigned int i = p->second; priority = heap[i].priority; return true; } template < typename T, typename P, class C, class M > void DynamicHeap<T, P, C, M>::ascend(unsigned int i) { for (unsigned int j; i && !ordered(j = parent(i), i); i = j) swap(i, j); index[heap[i].data] = i; } template < typename T, typename P, class C, class M > void DynamicHeap<T, P, C, M>::descend(unsigned int i) { for (unsigned int j, k; (j = ((k = left(i)) < heap.size() && !ordered(i, k) ? k : i), j = ((k = right(i)) < heap.size() && !ordered(j, k) ? k : j)) != i; i = j) swap(i, j); index[heap[i].data] = i; } template < typename T, typename P, class C, class M > void DynamicHeap<T, P, C, M>::swap(unsigned int i, unsigned int j) { std::swap(heap[i], heap[j]); index[heap[i].data] = i; } #endif
22.584112
76
0.607283
85d3cd80b6ce2f0d4aa048730fff1790a86a4633
5,748
js
JavaScript
src/tunnel/udp/index.js
blackcoffeecat/ngc-tunnel
fe104928a48dcededaaf43b92e4aab4da2ea1553
[ "MIT" ]
null
null
null
src/tunnel/udp/index.js
blackcoffeecat/ngc-tunnel
fe104928a48dcededaaf43b92e4aab4da2ea1553
[ "MIT" ]
null
null
null
src/tunnel/udp/index.js
blackcoffeecat/ngc-tunnel
fe104928a48dcededaaf43b92e4aab4da2ea1553
[ "MIT" ]
null
null
null
import dgram from 'dgram'; import {EventEmitter} from 'events'; import tcp from 'net'; import pLimit from 'p-limit'; import {v4 as uuid} from 'uuid'; import Queue from 'yocto-queue'; import {closeCon, forClose, hasProp, onExit} from '../common.js'; EventEmitter.setMaxListeners(0); export function createUdpSender({ sender, port, address, receiver, key, timeout = 2e3, before, after, }) { let chunkSize = 0; let sendBuffer = Buffer.alloc(0); let limit = pLimit(1); let callback; let timer; function onReceiveMsg(msg) { msg = msg + ''; msg .split('\n') .filter(Boolean) .forEach(line => { let [type, rKey] = line.split(':'); if (type === 'receive' && rKey === key) callback?.(); }); } function nextChunk() { if (!sendBuffer.length) return null; let next = sendBuffer.slice(0, chunkSize); sendBuffer = sendBuffer.slice(chunkSize); return next; } function send(buf) { if (!chunkSize) chunkSize = sender.getSendBufferSize(); sendBuffer = Buffer.concat([sendBuffer, buf]); if (!callback) { before?.(); limit(sendNext).then(() => after?.()); } } function sendNext() { return new Promise(resolve => { const next = nextChunk(); const thisCallback = isFail => { if (isFail) { timer = setTimeout(thisCallback, timeout, true); sender.send(next, port, address); return; } callback = null; if (timer) { clearTimeout(timer); timer = null; } if (sendBuffer.length) return sendNext().then(resolve); resolve(); }; callback = thisCallback; timer = setTimeout(thisCallback, timeout, true); sender.send(next, port, address); }); } function end() { limit(() => { receiver.off('message', onReceiveMsg); sender.send(Buffer.alloc(0), port, address); }); } receiver.on('message', onReceiveMsg); return {send, end}; } export function serveUdp({port}) { const servMap = {}; const serv = dgram .createSocket('udp4') .bind(port, '0.0.0.0') .once('listening', () => console.log('UDP server listening on port', port)) .on('message', (msg, {port, address}) => { if (!msg?.length) return; msg = msg + ''; const {pull, close} = msg.split('\n').reduce((ret, line) => { const [type, port] = line.split(':'); ret[type] = port; return ret; }, {}); if (pull) handlePull(pull, handleCon(port, address)); if (close) servMap[close]?.close(); }); function handleCon(cliPort, cliAddress) { return function handle({con, key}) { let dataServ = dgram.createSocket('udp4'); dataServ.send(`ready:${key}\n`, cliPort, cliAddress); dataServ.once('message', (ready, {port, address}) => { const {send, end} = createUdpSender({ sender: dataServ, receiver: serv, port, address, key, timeout: 100, }); con.on('data', send).once('close', end); dataServ.on('message', buf => { serv.send(`receive:${key}\n`, cliPort, cliAddress); if (!buf.length) return con.end(); con.write(buf); }); con.resume(); }); }; } function handlePull(port, handler) { if (servMap[port]) { const {renew, que} = servMap[port]; renew(); while (que.size) handler(que.dequeue()); return; } console.log('udp createServer', port); let que = new Queue(); let server = tcp .createServer({allowHalfOpen: true, pauseOnConnect: true}, con => { let key = uuid(); que.enqueue({con, key}); }) .listen(port); let timer; let context = { que, renew() { if (timer) clearTimeout(timer); timer = setTimeout(() => { timer = null; context?.close(); }, 5e3); }, close() { server?.close(() => { console.log('udp closeServer', port); que = null; server = null; servMap[port] = null; context = null; }); }, }; servMap[port] = context; servMap[port].renew(); } } export function connectUdp({port, host, targetHost, serverPort, targetPort}) { let cliPort = port, cliAddress = host; const client = dgram.createSocket('udp4'); let interval = setInterval(() => { client.send(`pull:${serverPort}\n`, port, host); }, 1e3); client .on('message', (msg, {port, address}) => { if (!msg?.length) return; msg = msg + ''; msg .split('\n') .filter(Boolean) .forEach(line => { const [type, key] = line.split(':'); if (type !== 'ready') return; handleOpen(key, port, address); }); }) .once('close', () => { clearInterval(interval); }); forClose(client, callback => { const me = dgram.createSocket('udp4'); me.send(`close:${serverPort}\n`, port, host, callback); }); onExit(() => closeCon(client)); return client; function handleOpen(key, port, address) { let proxy = tcp.connect({allowHalfOpen: true, port: targetPort, host: targetHost}); let data = dgram.createSocket('udp4'); const {send, end} = createUdpSender({ sender: data, receiver: client, key, port, address, }); proxy.on('data', send).once('close', end); data .on('message', buf => { client.send(`receive:${key}\n`, cliPort, cliAddress); if (!buf.length) return proxy.end(); proxy.write(buf); }) .send('ready', port, address); } }
23.654321
87
0.543145
d2b3666c4781a97ce025e5c85529b17b858a4b3b
17,732
php
PHP
themes/default/views/reports/product_dailyinout.php
Nak-CloudNET/iCloudERP_v3.5_Kim_Gam
fdc4dd5e165f15c7f09fe3a66dc011459209ca56
[ "Apache-2.0" ]
null
null
null
themes/default/views/reports/product_dailyinout.php
Nak-CloudNET/iCloudERP_v3.5_Kim_Gam
fdc4dd5e165f15c7f09fe3a66dc011459209ca56
[ "Apache-2.0" ]
null
null
null
themes/default/views/reports/product_dailyinout.php
Nak-CloudNET/iCloudERP_v3.5_Kim_Gam
fdc4dd5e165f15c7f09fe3a66dc011459209ca56
[ "Apache-2.0" ]
null
null
null
<script type="text/javascript"> $(document).ready(function(){ $('body').on('click', '#excel', function(e) { e.preventDefault(); var k = false; $.each($("input[name='val[]']:checked"), function(){ k = true; }); $('#form_action').val($('#excel').attr('data-action')); $('#action-form-submit').trigger('click'); }); $('body').on('click', '#pdf', function(e) { e.preventDefault(); var k = false; $.each($("input[name='val[]']:checked"), function(){ k = true; }); $('#form_action').val($('#pdf').attr('data-action')); $('#action-form-submit').trigger('click'); }); $('body').on('click', '.p', function(e) { }); }); </script> <div class="box"> <div class="box-header"> <h2 class="blue"><i class="fa-fw fa fa-barcode"></i><?= lang('daily_products') ; ?> </h2> <div class="box-icon"> <ul class="btn-tasks"> <li class="dropdown"> <a href="javascript:void(0);" class="toggle_up tip" title="<?= lang('hide_form') ?>"> <i class="icon fa fa-toggle-up"></i> </a> </li> <li class="dropdown"> <a href="javascript:void(0);" class="toggle_down tip" title="<?= lang('show_form') ?>"> <i class="icon fa fa-toggle-down"></i> </a> </li> <li class="dropdown"> <a href="#" id="pdf" data-action="export_pdf" class="tip" title="<?= lang('download_pdf') ?>"> <i class="icon fa fa-file-pdf-o"></i> </a> </li> <li class="dropdown"> <a href="#" id="excel" data-action="export_excel" class="tip" title="<?= lang('download_xls') ?>"> <i class="icon fa fa-file-excel-o"></i> </a> </li> </ul> </div> </div> <div class="box-content"> <div class="row"> <div class="col-lg-12"> <p class="introtext"><?= lang('list_results'); ?></p> <div id="form"> <?php echo form_open('reports/product_dailyinout', 'id="action-form" method="GET"'); ?> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <label class="control-label" for="pro"><?= lang("products"); ?></label> <?php $pro[""] = "ALL"; foreach ($products as $product) { $pro[$product->id] = $product->code.' / '.$product->name; } echo form_dropdown('product', $pro, (isset($_GET['product']) ? $_GET['product'] : ''), 'class="form-control" id="product" data-placeholder="' . $this->lang->line("select") . " " . $this->lang->line("producte") . '"'); ?> </div> </div> <div class="col-sm-4"> <div class="form-group"> <?= lang("category", "category") ?> <?php $cat[''] = "ALL"; foreach ($categories as $category) { $cat[$category->id] = $category->name; } echo form_dropdown('category', $cat, (isset($_GET['category']) ? $_GET['category'] : ''), 'class="form-control select" id="category" placeholder="' . lang("select") . " " . lang("category") . '" style="width:100%"') ?> </div> </div> <div class="col-sm-4"> <div class="form-group"> <?= lang("warehouse", "warehouse") ?> <?php $waee[''] = "ALL"; foreach ($warefull as $wa) { $waee[$wa->id] = $wa->code.' / '.$wa->name; } echo form_dropdown('warehouse', $waee, (isset($_GET['warehouse']) ? $_GET['warehouse'] : ''), 'class="form-control select" id="warehouse" placeholder="' . lang("select") . " " . lang("warehouse") . '" style="width:100%"') ?> </div> </div> <div class="col-sm-4"> <div class="form-group"> <?= lang("in_out", "in_out") ?> <?php $in_out = array( 'all' => lang('all'), 'in' => lang('in'), 'out' => lang('out') ); echo form_dropdown('in_out', $in_out, (isset($_GET['in_out']) ? $_GET['in_out'] :''), 'class="form-control select" id="in_out" placeholder="' . lang("select") . " " . lang("in_out") . '" style="width:100%"') ?> </div> </div> <div class="col-sm-4"> <div class="form-group"> <?= lang("month", "month"); ?> <?php $months = array( '01' => 'January', '02' => 'February', '03' => 'March', '04' => 'April', '05' => 'May', '06' => 'June', '07' => 'July', '08' => 'August', '09' => 'September', '10' => 'October', '11' => 'November', '12' => 'December', ); echo form_dropdown('month', $months, (isset($_GET['month'])? $_GET['month'] : $month2), 'id="month" class="form-control"') ?> </div> </div> <div class="col-sm-4"> <div class="form-group"> <?= lang("year", "year"); ?> <?php echo form_input('year', (isset($_GET['year']) ? $_GET['year'] : $year2), 'class="form-control date-year" id="year"'); ?> </div> </div> <!--<div class="col-sm-4"> <div class="form-group"> <?= lang("day", "day"); ?> <?php $da = array(""=>"select a day"); $str = ""; for($i=1;$i<=$days;$i++){ if(strlen($i) == 1){ $str = "0$i"; }else{ $str = "$i"; } $da[$str] = $str; } echo form_dropdown('dayy', $da, ($_GET['dayy']? $_GET['dayy'] :$dayy2), 'id="dayy" class="form-control" placeholder="select a day"') ; ?> </div> </div>--> </div> <div class="form-group"> <div class="controls"> <?php echo form_submit('submit_report', $this->lang->line("submit"), 'class="btn btn-primary sub"'); ?> </div> </div> <?php echo form_close(); ?> </div> <div class="clearfix"></div> <div class="table-responsive" style="width:100%;overflow:auto;overflow-y: hidden;"> <table id="tbstock" class="table table-condensed table-bordered table-hover table-striped" > <thead> <tr> <th><?= lang("image") ?></th> <th><?= lang("product_code") ?></th> <th><?= lang("product_name") ?></th> <?php for($i=1;$i<=$days;$i++){ if(strlen($i) == 1){ echo "<th style='padding-right: 30px;padding-left: 30px;' id='0$i'>0$i</th>"; }else{ echo "<th style='padding-right: 30px;padding-left: 30px;' id='$i'>$i</th>"; } } ?> </tr> </thead> <tbody> <?php $total = array(); foreach($stocks as $row){ ?> <tr class="rows"> <!--<td class="name"><img src="<?= base_url()?>/assets/uploads/thumbs/<?=$row->image ?>" class="img-responsive"/></td> --> <td><ul class="enlarge"> <li> <img src="<?= base_url()?>/assets/uploads/thumbs/<?=$row->image ?>" class="img-responsive"/> <span> <a href="<?= base_url()?>/assets/uploads/thumbs/<?=$row->image ?>" data-toggle="lightbox"> <img src="<?= base_url()?>/assets/uploads/thumbs/<?=$row->image ?>" style="width:200px;z-index: 9999999999999;" class="img-thumbnail"/> </a> </span> </li> </ul> </td> <td class="code"><?=$row->code?$row->code:'ID:'.$row->product_id?></td> <td class="name"><?=$row->name?><?=" (".$row->name_unit.")"?></td> <?php $am = 0; for($i=1;$i<=$days;$i++){ $this->db->select("SUM(COALESCE((-1)*quantity_balance,0)) AS outt") ->join("products","products.id=purchase_items.product_id","LEFT") ->join("erp_purchases","erp_purchases.id=purchase_items.purchase_id","LEFT") ->where("DATE_FORMAT(erp_purchase_items.date, '%Y-%m')=",$row->dater) ->where("purchase_items.product_id",$row->product_id) ->where("quantity_balance<",0); if($biller2){ $this->db->where("erp_purchases.biller_id",$biller2); } if($warehouse2){ $this->db->where("erp_purchase_items.warehouse_id",$warehouse2); }else{ if($wid2){ $this->db->where("erp_purchase_items.warehouse_id IN ($wid2)"); } } $this->db->where("DATE_FORMAT(erp_purchase_items.date, '%d')=",$i); $q = $this->db->get("purchase_items")->row(); $this->db->select("SUM(COALESCE(quantity_balance,0)) AS inn") ->join("products","products.id=purchase_items.product_id","LEFT") ->join("erp_purchases","erp_purchases.id=purchase_items.purchase_id","LEFT") ->where("DATE_FORMAT(erp_purchase_items.date, '%Y-%m')=",$row->dater) ->where("purchase_items.product_id",$row->product_id) ->where("quantity_balance>",0) ->where("DATE_FORMAT(erp_purchase_items.date, '%d')=",$i); if($warehouse2){ $this->db->where("erp_purchase_items.warehouse_id",$warehouse2); }else{ if($wid2){ $this->db->where("erp_purchase_items.warehouse_id IN ($wid2)"); } } if($biller2){ $this->db->where("erp_purchases.biller_id",$biller2); } $q2 = $this->db->get("purchase_items")->row(); ///////////////////// $this->db->select("SUM(COALESCE((-1)*quantity_balance,0)) AS outt") ->join("products","products.id=purchase_items.product_id","LEFT") ->join("erp_purchases","erp_purchases.id=purchase_items.purchase_id","LEFT") ->where("DATE_FORMAT(erp_purchase_items.date, '%Y-%m')=",$row->dater) ->where("purchase_items.product_id",$row->product_id) ->where("quantity_balance<",0); if($warehouse2){ $this->db->where("erp_purchase_items.warehouse_id",$warehouse2); }else{ if($wid2){ $this->db->where("erp_purchase_items.warehouse_id IN ($wid2)"); } } if($biller2){ $this->db->where("erp_purchases.biller_id",$biller2); } $this->db->where("DATE_FORMAT(erp_purchase_items.date, '%d')=",$i); $q_unit = $this->db->get("purchase_items")->row(); ////////////////////// $this->db->select("SUM(COALESCE(quantity_balance,0)) AS inn") ->join("products","products.id=purchase_items.product_id","LEFT") ->join("erp_purchases","erp_purchases.id=purchase_items.purchase_id","LEFT") ->where("DATE_FORMAT(erp_purchase_items.date, '%Y-%m')=",$row->dater) ->where("purchase_items.product_id",$row->product_id) ->where("quantity_balance>",0); if($warehouse2){ $this->db->where("erp_purchase_items.warehouse_id",$warehouse2); }else{ if($wid2){ $this->db->where("erp_purchase_items.warehouse_id IN ($wid2)"); } } if($biller2){ $this->db->where("erp_purchases.biller_id",$biller2); } $this->db->where("DATE_FORMAT(erp_purchase_items.date, '%d')=",$i); $q_unit2 = $this->db->get("purchase_items")->row(); ///////////////////////// $this->db->select("SUM(COALESCE(quantity_balance,0)) AS inou") ->join("products","products.id=purchase_items.product_id","LEFT") ->where("DATE_FORMAT(erp_purchase_items.date, '%Y-%m')=",$row->dater) ->where("purchase_items.product_id",$row->product_id); if($warehouse2){ $this->db->where("erp_purchase_items.warehouse_id",$warehouse2); }else{ if($wid2){ $this->db->where("erp_purchase_items.warehouse_id IN ($wid2)"); } } $this->db->where("DATE_FORMAT(erp_purchase_items.date, '%d')=",$i); $q_unit3 = $this->db->get("purchase_items")->row(); ?> <?php $am = $q2->inn - $q->outt; if($in_out2 == "all"){ if($q2->inn || $q->outt){?> <td style='text-align:right; '> <?php if($am){?> <span style="color:blue;"><?=$this->erp->formatDecimal($am)?></span> <br> <?php if($q_unit3->inou){ echo $this->erp->convert_unit_2_string($row->product_id,$q_unit3->inou); } $total[$i] += $am; } ?> </td> <?php }else{ echo "<td></td>"; } }else if($in_out2 == "in"){ if($q2->inn){?> <td style='text-align:right; '> <?php if($q2->inn){?> <span style="color:blue;"><?=$this->erp->formatDecimal($q2->inn)?></span><br> <?php if($q_unit2->inn){ echo $this->erp->convert_unit_2_string($row->product_id,$q_unit2->inn); } $total[$i] += $q2->inn; } ?> </td> <?php }else{ echo "<td></td>"; } }else{ if($q->outt){?> <td style='text-align:right;'> <?php if($q->outt){?> <span style="color:blue;"><?=$this->erp->formatDecimal($q->outt)?></span><br> <?php if($q_unit->outt){ echo $this->erp->convert_unit_2_string($row->product_id,$q_unit->outt); } $total[$i] += $q->outt; } ?> </td> <?php }else{ echo "<td></td>"; } } ?> <?php } ?> </tr> <?php } ?> <tr> <td colspan="3" style="text-align:right; background-color: #428BCA;color:white;border-color: #357EBD;"><b>Total:</b></td> <?php for($i=1;$i<=$days;$i++){ ?> <td style='text-align:right; background-color: #428BCA;color:white;border-color: #357EBD;'> <?php if(isset($total[$i])){ ?> <b> <?=$this->erp->formatDecimal($total[$i])?> </b> <?php } ?> </td> <?php } ?> </tr> </tbody> </table> </div> <div class=" text-right"> <div class="dataTables_paginate paging_bootstrap"> <?= $pagination; ?> </div> </div> </div> </div> </div> </div> <script type="text/javascript"> $(document).ready(function () { $(document).on('focus','.date-year', function(t) { $(this).datetimepicker({ format: "yyyy", startView: 'decade', minView: 'decade', viewSelect: 'decade', autoclose: true, }); }); $('#form').hide(); $('.toggle_down').click(function () { $("#form").slideDown(); return false; }); $('.toggle_up').click(function () { $("#form").slideUp(); return false; }); $('#excel').on('click', function (e) { e.preventDefault(); if ($('.checkbox:checked').length <= 0) { window.location.href = "<?= site_url('reports/productDailyInOutReport/0/xls/'.$product1.'/'.$month2.'/'.$year2.'/'.$wid1.'/'.$warehouse1.'/'.$category1.'/'.$in_out2.'/'.$biller1) ?>"; return false; } }); $('#pdf').on('click', function (e) { e.preventDefault(); if ($('.checkbox:checked').length <= 0) { window.location.href = "<?= site_url('reports/productDailyInOutReport/pdf/0/'.$product1.'/'.$month2.'/'.$year2.'/'.$wid1.'/'.$warehouse1.'/'.$category1.'/'.$in_out2.'/'.$biller1) ?>"; return false; } }); }); </script>
38.885965
253
0.425953
d7cc5460f314a067cd31f82caea045aff046d3b9
244
sql
SQL
examples/pm-app/prisma/migrations/20211207153717_/migration.sql
mattstobbs/remix
86921285b078f52a9672107559b3dccbb8408c1d
[ "MIT" ]
14,966
2021-11-22T15:33:24.000Z
2022-03-31T23:43:47.000Z
examples/pm-app/prisma/migrations/20211207153717_/migration.sql
mattstobbs/remix
86921285b078f52a9672107559b3dccbb8408c1d
[ "MIT" ]
1,536
2021-11-22T15:47:43.000Z
2022-03-31T23:38:39.000Z
examples/pm-app/prisma/migrations/20211207153717_/migration.sql
mattstobbs/remix
86921285b078f52a9672107559b3dccbb8408c1d
[ "MIT" ]
1,290
2021-11-22T15:38:13.000Z
2022-03-31T12:38:56.000Z
-- DropForeignKey ALTER TABLE "Todo" DROP CONSTRAINT "Todo_todoListId_fkey"; -- AddForeignKey ALTER TABLE "Todo" ADD CONSTRAINT "Todo_todoListId_fkey" FOREIGN KEY ("todoListId") REFERENCES "TodoList"("id") ON DELETE CASCADE ON UPDATE CASCADE;
40.666667
148
0.786885
d18e553fe0cc476f9a1088587589556fc61c9397
11,151
rs
Rust
mini_template_macro/src/create_modifier.rs
Julian-Alberts/mini_template_rs
5638a13f6743ce80e0173dff9c933fd547bbd38d
[ "Apache-2.0", "MIT" ]
null
null
null
mini_template_macro/src/create_modifier.rs
Julian-Alberts/mini_template_rs
5638a13f6743ce80e0173dff9c933fd547bbd38d
[ "Apache-2.0", "MIT" ]
null
null
null
mini_template_macro/src/create_modifier.rs
Julian-Alberts/mini_template_rs
5638a13f6743ce80e0173dff9c933fd547bbd38d
[ "Apache-2.0", "MIT" ]
null
null
null
use std::collections::HashMap; use proc_macro2::TokenStream; use proc_macro_crate::{crate_name, FoundCrate}; use syn::spanned::Spanned; ///## With body /// ``` /// use mini_template::value::Value; /// use mini_template_derive::create_modifier; /// /// #[create_modifier] /// fn fizz_buzz(n: usize) -> String { /// match (n % 3, n % 5) { /// (0, 0) => String::from("FIZZBUZZ"), /// (0, _) => String::from("FIZZ"), /// (_, 0) => String::from("BUZZ"), /// _ => n.to_string() /// } /// } /// /// /// assert_eq!( /// fizz_buzz( /// &Value::Number(3.), /// Vec::default() /// ), /// Ok(Value::String(String::from("FIZZ"))) /// ); /// ``` /// ## Returns Result /// ``` /// use mini_template::value::Value; /// use mini_template_derive::create_modifier; /// /// #[create_modifier(returns_result = true)] /// fn as_usize(n: String) -> Result<usize, String> { /// match n.parse() { /// Ok(n) => Ok(n), /// Err(_) => Err(format!("Can not convert {n} to usize")) /// } /// } /// /// /// assert!(as_usize(&Value::String("17".to_owned()), Vec::default()).is_ok()); /// assert!(as_usize(&Value::String("Foo".to_owned()), Vec::default()).is_err()); /// ``` pub fn create_modifier(attrs: syn::AttributeArgs, item: syn::ItemFn) -> Result<TokenStream, syn::Error> { let inputs = Inputs::new(&item.sig.inputs)?; let attrs = Attrs::new(attrs, &inputs)?; let mini_template_crate_name = get_mini_template_crate_name(&attrs); if let syn::ReturnType::Default = item.sig.output { return Err(syn::Error::new(item.sig.span() ,"Modifier requires return type")) } let modifier_ident = if let Some(ident) = &attrs.modifier_ident { ident } else { &item.sig.ident }; let vars = create_var_init_code(&inputs, &attrs, &mini_template_crate_name)?; let inner_fn = &item; let modifier_code_call = modifier_code_call(&item.sig.ident, &inputs.inputs, &attrs, &mini_template_crate_name); if attrs.modifier_ident.is_some() { Ok(quote::quote! { pub fn #modifier_ident( value: &#mini_template_crate_name::value::Value, args: Vec<&#mini_template_crate_name::value::Value> ) -> #mini_template_crate_name::modifier::error::Result<#mini_template_crate_name::value::Value> { use #mini_template_crate_name::modifier::error::Error; #vars let result: #mini_template_crate_name::modifier::error::Result<_> = #modifier_code_call; result.map(#mini_template_crate_name::value::Value::from) } #inner_fn }) } else { Ok(quote::quote! { pub fn #modifier_ident( value: &#mini_template_crate_name::value::Value, args: Vec<&#mini_template_crate_name::value::Value> ) -> #mini_template_crate_name::modifier::error::Result<#mini_template_crate_name::value::Value> { use #mini_template_crate_name::modifier::error::Error; #vars #inner_fn let result: #mini_template_crate_name::modifier::error::Result<_> = #modifier_code_call; result.map(#mini_template_crate_name::value::Value::from) } }) } } fn get_mini_template_crate_name(attrs: &Attrs) -> syn::Ident { if let Some(mini_template_ident) = attrs.mini_template_crate.as_ref() { return mini_template_ident.clone() } let found_crate = crate_name("mini_template").expect("my-crate is present in `Cargo.toml`"); match found_crate { FoundCrate::Itself => syn::Ident::new("crate", proc_macro2::Span::call_site()), FoundCrate::Name(name) => { syn::Ident::new(&name, proc_macro2::Span::call_site()) } } } fn modifier_code_call<'a>(ident: &syn::Ident, inputs: &syn::punctuated::Punctuated<syn::FnArg, syn::token::Comma>, attrs: &Attrs, mini_template_crate_name: &syn::Ident) -> TokenStream { let inputs = inputs.iter().map(|i| { if let syn::FnArg::Typed(syn::PatType { pat, .. }) = i { if let syn::Pat::Ident(ident) = pat.as_ref() { ident } else { unreachable!() } } else { unreachable!() } }).collect::<syn::punctuated::Punctuated<_, syn::token::Comma>>(); if attrs.returns_result { quote::quote! { #ident(#inputs).or_else(|e| Err(#mini_template_crate_name::modifier::error::Error::Modifier(e))) } } else { quote::quote! { Ok(#ident(#inputs)) } } } fn create_var_init_code<'a>( inputs: &Inputs, attrs: &Attrs, mini_template_crate_name: &syn::Ident ) -> Result<TokenStream, syn::Error> { let mut inputs_iter = inputs.inputs.iter(); let value = { let value = inputs_iter.next().unwrap(); let value = if let syn::FnArg::Typed(typed) = value { typed } else { unreachable!() }; let ty = &value.ty; let ident = if let syn::Pat::Ident(ident) = &*value.pat { &ident.ident } else { return Err(syn::Error::new(value.span(), "Ident must be named")); }; let into = into_value(quote::quote! {value}, mini_template_crate_name); quote::quote! {let #ident: #ty = #into;} }; let args = if inputs.inputs.len() > 1 { let mut args = quote::quote! {let mut args = args.into_iter();}; let init = inputs_iter .map(|value| { let value = if let syn::FnArg::Typed(typed) = value { typed } else { unreachable!() }; let ty = &*value.ty; let ident = if let syn::Pat::Ident(ident) = &*value.pat { &ident.ident } else { return Err(syn::Error::new(value.span(), "Ident must be named")); }; let into = into_value(quote::quote! {v}, mini_template_crate_name); let default = var_init_default(ident, attrs.defaults.get(ident), mini_template_crate_name); Ok(quote::quote! { let #ident: #ty = match args.next() { Some(v) => #into, None => #default }; }) }).collect::<Result<TokenStream, _>>()?; args.extend(init); args } else { TokenStream::new() }; Ok(quote::quote! { #value #args }) } fn var_init_default(ident: &syn::Ident, default: Option<&syn::Lit>, mini_template_crate_name: &syn::Ident) -> TokenStream { match default { Some(d) => quote::quote! {#d}, None => { let ident = syn::LitStr::new(&ident.to_string(), ident.span()); quote::quote! {return Err(#mini_template_crate_name::modifier::error::Error::MissingArgument{argument_name: #ident})} } } } fn into_value(value: TokenStream, mini_template_crate_name: &syn::Ident) -> TokenStream { quote::quote! { match #value.try_into() { Ok(inner) => inner, Err(e) => return Err(#mini_template_crate_name::modifier::Error::Type{value: #value.to_string(), type_error: e}) } } } struct Attrs { defaults: HashMap<syn::Ident, syn::Lit>, modifier_ident: Option<syn::Ident>, returns_result: bool, mini_template_crate: Option<syn::Ident> } impl Attrs { fn new(args: syn::AttributeArgs, inputs: &Inputs) -> Result<Self, syn::Error> { let mut attrs = Attrs { defaults: HashMap::default(), modifier_ident: None, returns_result: false, mini_template_crate: None }; for arg in args { if let syn::NestedMeta::Meta(syn::Meta::NameValue(syn::MetaNameValue { path, lit, .. })) = arg { if path.is_ident("modifier_ident") { if let syn::Lit::Str(s_lit) = &lit { attrs.modifier_ident = Some(syn::Ident::new(&s_lit.value(), lit.span())); continue; } return Err(syn::Error::new(lit.span(), "modifier identifier needs to be string")); } if path.is_ident("mini_template_crate") { if let syn::Lit::Str(s_lit) = &lit { attrs.mini_template_crate = Some(syn::Ident::new(&s_lit.value(), lit.span())); continue; } return Err(syn::Error::new(lit.span(), "mini_template_crate needs to be string")); } if path.is_ident("returns_result") { if let syn::Lit::Bool(b_lit) = &lit { attrs.returns_result = b_lit.value; continue; } return Err(syn::Error::new(lit.span(), "returns_result needs to be boolean")); } let mut segments_iter = path.segments.iter(); if let Some(syn::PathSegment{ ident, .. }) = segments_iter.next() { if ident == &syn::Ident::new("defaults", proc_macro2::Span::call_site()) { if let Some(syn::PathSegment{ ident, .. }) = segments_iter.next() { if inputs.idents.iter().any(|ii| { ident == *ii }) { attrs.defaults.insert(ident.clone(), lit); continue; } } } } return Err(syn::Error::new(path.span(), "Unknown argument")) } return Err(syn::Error::new(arg.span(), "Unknown argument")) } Ok(attrs) } } struct Inputs<'a> { idents: Vec<&'a syn::Ident>, inputs: &'a syn::punctuated::Punctuated<syn::FnArg, syn::token::Comma> } impl <'a> Inputs<'a> { fn new(i: &'a syn::punctuated::Punctuated<syn::FnArg, syn::token::Comma>) -> Result<Self, syn::Error> { if i.is_empty() { return Err(syn::Error::new(Spanned::span(i), "Modifiers require at least one argument")); } Ok(Self { idents: i.iter().map(|i| { let typed = if let syn::FnArg::Typed(t) = i { t } else { return Err(syn::Error::new(i.span(), "All arguments need to be typed")) }; if let syn::Pat::Ident(pat_ident) = &*typed.pat { Ok(&pat_ident.ident) } else { return Err(syn::Error::new(i.span(), "All arguments need to be typed")) } }).collect::<Result<_, _>>()?, inputs: i }) } }
35.4
185
0.516904
dd997c459ebe8e138f52bbc826868381ea7312bd
14,106
php
PHP
application/views/front/listing/filter.php
web-dev11/varvadhu.net
3e92ac7f8d126150bc4fb07ef3eb0c7c1ddee76c
[ "Apache-2.0" ]
null
null
null
application/views/front/listing/filter.php
web-dev11/varvadhu.net
3e92ac7f8d126150bc4fb07ef3eb0c7c1ddee76c
[ "Apache-2.0" ]
null
null
null
application/views/front/listing/filter.php
web-dev11/varvadhu.net
3e92ac7f8d126150bc4fb07ef3eb0c7c1ddee76c
[ "Apache-2.0" ]
null
null
null
<script src="<?=base_url()?>template/front/js/jquery.inputmask.bundle.min.js"></script> <div class="col-lg-4 size-sm"> <div class="sidebar"> <div class=""> <div class="card"> <div class="card-title b-xs-bottom"> <h3 class="heading heading-sm text-uppercase"><?php echo translate('advanced_search')?></h3> </div> <div class="card-body"> <form class="form-default" id="filter_form" data-toggle="validator" role="form"> <?php if (!empty($this->session->userdata['member_id'])) { ?> <div class="row"> <div class="col-sm-12"> <div class="form-group has-feedback"> <label for="" class="text-uppercase"><?php echo translate('looking_for')?></label> <div class="radio radio-primary"> <?php $member_gender = $this->db->get_where('member',array('member_id'=>$this->session->userdata['member_id']))->row()->gender; ?> <?php if($member_gender == '2') { ?> <input type="radio" name="gender" id="groom" value="1" <?php if(!empty($home_gender==1)){ ?>checked<?php }?>> <label for="groom"><?=translate('groom')?></label> <?php } elseif ($member_gender == '1') { ?> <input type="radio" name="gender" id="bride" value="2" <?php if(!empty($home_gender==2)){ ?>checked<?php }?>> <label for="bride" class="pr-3"><?=translate('bride')?></label> <?php } ?> </div> </div> </div> </div> <?php } else { ?> <div class="row"> <div class="col-sm-12"> <div class="form-group has-feedback"> <label for="" class="text-uppercase"><?php echo translate('looking_for')?></label> <div class="radio radio-primary"> <input type="radio" name="gender" id="bride" value="2" <?php if(!empty($home_gender==2)){ ?>checked<?php }?>> <label for="bride" class="pr-3"><?=translate('bride')?></label> <input type="radio" name="gender" id="groom" value="1" <?php if(!empty($home_gender==1)){ ?>checked<?php }?>> <label for="groom"><?=translate('groom')?></label> </div> </div> </div> </div> <?php } ?> <div class="row"> <div class="col-sm-6"> <div class="form-group has-feedback"> <label for="" class="text-uppercase"><?php echo translate('age_from')?></label> <input type="number" class="form-control form-control-sm" name="aged_from" id="filter_aged_from" value="<?php if(isset($aged_from)){echo $aged_from;}?>"> <div class="help-block with-errors"> </div> </div> </div> <div class="col-sm-6"> <div class="form-group has-feedback"> <label for="" class="text-uppercase"><?php echo translate('to')?></label> <input type="number" class="form-control form-control-sm" name="aged_to" id="filter_aged_to" value="<?php if(isset($aged_to)){echo $aged_to;}?>"> </div> <div class="help-block with-errors"> </div> </div> </div> <div class="row"> <div class="col-sm-12"> <div class="form-group has-feedback"> <label for="" class="text-uppercase"><?php echo translate('member_id')?></label> <input type="text" class="form-control form-control-sm" name="member_id" id="filter_member_id" value="<?php if(isset($member_id)){echo $member_id;}?>"> <div class="help-block with-errors"> </div> </div> </div> </div> <div class="row"> <div class="col-sm-12"> <div class="form-group has-feedback"> <label for="" class="text-uppercase"><?php echo translate('marital_status')?></label> <?= $this->Crud_model->select_html('marital_status', 'marital_status', 'name', 'edit', 'form-control form-control-sm selectpicker', '', '', '', ''); ?> <span class="help-block with-errors"></span> </div> </div> </div> <div class="row"> <div class="col-sm-12"> <?php if ($this->db->get_where('frontend_settings', array('type' => 'spiritual_and_social_background'))->row()->value == "yes") { ?> <div class="form-group has-feedback"> <label for="" class="text-uppercase"><?php echo translate('religion')?></label> <?= $this->Crud_model->select_html('religion', 'religion', 'name', 'edit', 'form-control form-control-sm selectpicker s_religion', $home_religion, '', '', ''); ?> <div class="help-block with-errors"> </div> </div> <div class="form-group has-feedback"> <label for="" class="text-uppercase"><?php echo translate('caste_/_sect')?></label> <select class="form-control form-control-sm selectpicker s_caste" name="caste" > <option value="<?= $home_caste ?>"><?php echo translate('choose_a_religion_first')?></option> </select> <div class="help-block with-errors"> </div> </div> <div class="form-group has-feedback" id=""> <label for="" class="text-uppercase"><?php echo translate('sub_caste')?></label> <select class="form-control form-control-sm selectpicker s_sub_caste" name="sub_caste"> <option value="<?= $home_sub_caste ?>"><?php echo translate('choose_a_caste_first')?></option> </select> <div class="help-block with-errors"> </div> </div> <?php } ?> <?php if ($this->db->get_where('frontend_settings', array('type' => 'language'))->row()->value == "yes") { ?> <div class="form-group has-feedback"> <label for="" class="text-uppercase"><?php echo translate('mother_tongue')?></label> <?= $this->Crud_model->select_html('language', 'language', 'name', 'edit', 'form-control form-control-sm selectpicker', $home_language, '', '', ''); ?> <div class="help-block with-errors"> </div> </div> <?php } ?> <?php if ($this->db->get_where('frontend_settings', array('type' => 'education_and_career'))->row()->value == "yes") { ?> <div class="form-group has-feedback"> <label for="" class="text-uppercase"><?php echo translate('profession')?></label> <input type="text" class="form-control form-control-sm" name="profession" id="filter_profession" value="<?php if(isset($profession)){echo $profession;}?>"> <div class="help-block with-errors"> </div> </div> <?php } ?> <?php if ($this->db->get_where('frontend_settings', array('type' => 'present_address'))->row()->value == "yes") { ?> <div class="form-group has-feedback"> <label for="" class="text-uppercase"><?php echo translate('country')?></label> <?= $this->Crud_model->select_html('country', 'country', 'name', 'edit', 'form-control form-control-sm selectpicker s_country', '', '', '', ''); ?> <div class="help-block with-errors"> </div> </div> <div class="form-group has-feedback"> <label for="" class="text-uppercase"><?php echo translate('state')?></label> <select class="form-control form-control-sm selectpicker s_state" name="state"> <option value=""><?php echo translate('choose_a_country_first')?></option> </select> <div class="help-block with-errors"> </div> </div> <div class="form-group has-feedback"> <label for="" class="text-uppercase"><?php echo translate('city')?></label> <select class="form-control form-control-sm selectpicker s_city" name="city"> <option value=""><?php echo translate('choose_a_state_first')?></option> </select> <div class="help-block with-errors"> </div> </div> <?php } ?> </div> </div> <?php if ($this->db->get_where('frontend_settings', array('type' => 'physical_attributes'))->row()->value == "yes") { ?> <div class="row"> <div class="col-sm-6"> <div class="form-group has-feedback"> <label for="" class="text-uppercase"><?php echo translate('min_height_(Feet)')?></label> <input type="text" class="form-control form-control-sm height_mask" name="min_height" id="min_height" value="<?php if($min_height != ""){echo $min_height;}else{echo '0.00';}?>"> <div class="help-block with-errors"> </div> </div> </div> <div class="col-sm-6"> <div class="form-group has-feedback"> <label for="" class="text-uppercase"><?php echo translate('max_height_(Feet)')?></label> <input type="text" class="form-control form-control-sm height_mask" name="max_height" id="max_height" value="<?php if($max_height != ""){echo $max_height;}else{echo '8.00';}?>"> </div> <div class="help-block with-errors"> </div> </div> </div> <?php } ?> <button type="button" class="btn btn-block btn-base-1 mt-2 z-depth-2-bottom" onclick="filter_members('0','search')"><?php echo translate('search')?></button> </form> </div> </div> </div> </div> </div> <div class="col-lg-4 size-sm-btn mb-4"> <button type="button" class="btn btn-block btn-base-1 mt-2 z-depth-2-bottom" onclick="adv_search()"><?php echo translate('advanced_search')?></button> </div>
67.817308
213
0.375656
5c80dbddb6bf42b84122ced30555cb600ddada89
157
h
C
designer/editor/delegate/AreaCheckBoxDelegate.h
DarksKnight/nim_duilib_designer
100a2a4e796d0b5c4a4d7a3e33bf9fce3758a5b7
[ "Apache-2.0" ]
null
null
null
designer/editor/delegate/AreaCheckBoxDelegate.h
DarksKnight/nim_duilib_designer
100a2a4e796d0b5c4a4d7a3e33bf9fce3758a5b7
[ "Apache-2.0" ]
null
null
null
designer/editor/delegate/AreaCheckBoxDelegate.h
DarksKnight/nim_duilib_designer
100a2a4e796d0b5c4a4d7a3e33bf9fce3758a5b7
[ "Apache-2.0" ]
null
null
null
#pragma once #include "AreaLabelDelegate.h" class AreaCheckBoxDelegate : public AreaLabelDelegate { public: AreaCheckBoxDelegate(ui::Control* control); };
19.625
53
0.796178
0ef39f1c50c737ea9f64a99350afd219aae80aaa
1,439
ts
TypeScript
server/app/Controllers/Http/AttributesController.ts
steferson-augusto/rpg
64da3afc41819b3a3a84e1823f2d90b9a624bb8c
[ "MIT" ]
null
null
null
server/app/Controllers/Http/AttributesController.ts
steferson-augusto/rpg
64da3afc41819b3a3a84e1823f2d90b9a624bb8c
[ "MIT" ]
null
null
null
server/app/Controllers/Http/AttributesController.ts
steferson-augusto/rpg
64da3afc41819b3a3a84e1823f2d90b9a624bb8c
[ "MIT" ]
null
null
null
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext' import Attribute from 'App/Models/Attribute' import { schema as Schema } from '@ioc:Adonis/Core/Validator' import dices from 'App/Helpers/dices' const schema = Schema.create({ dices: Schema.enumSet(dices) }) export default class AttributesController { public async show({ params, auth }: HttpContextContract) { const userId = Number(auth.user?.isMaster ? params.id : auth.user?.id) let attributes = await Attribute.query().where({ userId }).orderBy('label', 'asc') if (attributes.length === 0) { attributes = await Attribute.createMany([ { userId, label: 'Agilidade', dices: ['d4'] }, { userId, label: 'Astúcia', dices: ['d4'] }, { userId, label: 'Espírito', dices: ['d4'] }, { userId, label: 'Força', dices: ['d4'] }, { userId, label: 'Vigor', dices: ['d4'] } ]) } return attributes } public async update({ request, params, bouncer }: HttpContextContract) { const { dices } = await request.validate({ schema, messages: { required: 'Campo obrigatório' } }) const attribute = (await Attribute.find(params.id)) as Attribute await bouncer.authorize('update', attribute) attribute.dices = dices await attribute?.save() return attribute } // public async update({}: HttpContextContract) {} // public async destroy({}: HttpContextContract) {} }
32.704545
86
0.647672
b26c6896c81ce8a3ae77a12aa9e867e3de2f6b0a
620
sql
SQL
services/headless-lms/migrations/20210723110245_add_public_spec_endpoint_path_and_comments_to_service_info.up.sql
rage/secret-project-331
3c78c02f2f1d2e4539522e73c3065ae8866604e3
[ "Apache-2.0" ]
6
2021-09-23T05:28:58.000Z
2022-03-11T09:25:05.000Z
services/headless-lms/migrations/20210723110245_add_public_spec_endpoint_path_and_comments_to_service_info.up.sql
rage/secret-project-331
3c78c02f2f1d2e4539522e73c3065ae8866604e3
[ "Apache-2.0" ]
232
2021-07-09T07:13:31.000Z
2022-03-31T13:35:09.000Z
services/headless-lms/migrations/20210723110245_add_public_spec_endpoint_path_and_comments_to_service_info.up.sql
rage/secret-project-331
3c78c02f2f1d2e4539522e73c3065ae8866604e3
[ "Apache-2.0" ]
null
null
null
-- Add up migration script here ALTER TABLE exercise_service_info ADD COLUMN public_spec_endpoint_path VARCHAR(255); UPDATE exercise_service_info SET public_spec_endpoint_path = '' WHERE public_spec_endpoint_path IS NULL; ALTER TABLE exercise_service_info ALTER COLUMN public_spec_endpoint_path SET NOT NULL; COMMENT ON COLUMN exercise_service_info.public_spec_endpoint_path IS 'URL to an endpoint that will generate the public spec for an exercise service from respective private spec.'; COMMENT ON COLUMN exercise_service_info.submission_iframe_path IS 'URL to the iframe where an exercise submission can be viewed.';
51.666667
179
0.853226
a1edaca4046d85598ee454c39bf791f049a68a2d
1,142
h
C
project/race3d/src/Menus/MenuAbout.h
maximbilan/cpp_marmalade_sdk_the_pursuit_3d
b0e42bae7ba5c47c5bf2f9db22d973f3319cdb06
[ "MIT" ]
5
2015-01-05T17:03:00.000Z
2016-04-07T07:43:32.000Z
project/race3d/src/Menus/MenuAbout.h
maximbilan/cpp_marmalade_sdk_the_pursuit_3d
b0e42bae7ba5c47c5bf2f9db22d973f3319cdb06
[ "MIT" ]
null
null
null
project/race3d/src/Menus/MenuAbout.h
maximbilan/cpp_marmalade_sdk_the_pursuit_3d
b0e42bae7ba5c47c5bf2f9db22d973f3319cdb06
[ "MIT" ]
null
null
null
#ifndef _MENUABOUT_H_ #define _MENUABOUT_H_ #include "IwGxFont.h" #include "MenuElement.h" class FontManager; class TouchManager; class SmoothScroll; //----------------------------------------------------------------------------------- // Menu About - constains information about authors and game //----------------------------------------------------------------------------------- class MenuAbout : public MenuElement { public: MenuAbout(); virtual ~MenuAbout(); // Initialization void Init(); // Render void Render(); // Update void Update( const s3e_uint64_t dt ); // Event, when push menu to array void OnShow(); // Event, when pop menu from array void OnHide(); // Event when user button is pressed bool OnButtonPressed( const GUIButton* apButton ); // Event when user button is released bool OnButtonReleased( const GUIButton* apButton ); private: // Prepare titles void PrepareTitles(); private: FontManager* m_fontManager; TouchManager* m_touchManager; SmoothScroll* m_smoothScroll; CIwGxFontPreparedData m_preparedText; int m_titlesX; int m_titlesY; }; #endif // _MENUABOUT_H_
20.763636
85
0.623468
76e1f46d03411247c4fb8574987bf9d1bf48849d
4,384
h
C
alljoyn/alljoyn_core/router/packetengine/PacketEngineStream.h
WigWagCo/alljoyn
1b148edd934882ca32fd319af86a5a927f9d35a7
[ "0BSD" ]
null
null
null
alljoyn/alljoyn_core/router/packetengine/PacketEngineStream.h
WigWagCo/alljoyn
1b148edd934882ca32fd319af86a5a927f9d35a7
[ "0BSD" ]
null
null
null
alljoyn/alljoyn_core/router/packetengine/PacketEngineStream.h
WigWagCo/alljoyn
1b148edd934882ca32fd319af86a5a927f9d35a7
[ "0BSD" ]
null
null
null
/** * @file * PacketEngineStream is an implemenation of qcc::Stream used by PacketEngine. */ /****************************************************************************** * Copyright (c) 2011-2012, AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef _ALLJOYN_PACKETENGINESTREAM_H #define _ALLJOYN_PACKETENGINESTREAM_H #include <qcc/platform.h> #include <qcc/Stream.h> #include <alljoyn/Status.h> namespace ajn { /* Forward Declaration */ class PacketEngine; /** * Stream is a virtual class that defines a standard interface for a streaming source and sink. */ class PacketEngineStream : public qcc::Stream { friend class PacketEngine; public: /** Default Constructor */ PacketEngineStream(); /** Destructor */ ~PacketEngineStream(); /** Copy constructor */ PacketEngineStream(const PacketEngineStream& other); /** Assignment operator */ PacketEngineStream& operator=(const PacketEngineStream& other); /** Equality */ bool operator==(const PacketEngineStream& other) const; uint32_t GetChannelId() const { return chanId; } /** * Pull bytes from the source. * The source is exhausted when ER_NONE is returned. * * @param buf Buffer to store pulled bytes * @param reqBytes Number of bytes requested to be pulled from source. * @param actualBytes Actual number of bytes retrieved from source. * @param timeout Time to wait to pull the requested bytes. * @return ER_OK if successful. ER_NONE if source is exhausted. Otherwise an error. */ QStatus PullBytes(void* buf, size_t reqBytes, size_t& actualBytes, uint32_t timeout = qcc::Event::WAIT_FOREVER); /** * Get the Event indicating that data is available when signaled. * * @return Event that is signaled when data is available. */ qcc::Event& GetSourceEvent() { return *sourceEvent; } /** * Push zero or more bytes into the sink with per-msg time-to-live. * * @param buf Buffer to store pulled bytes * @param numBytes Number of bytes from buf to send to sink. * @param numSent Number of bytes actually consumed by sink. * @param ttl Time-to-live in ms or 0 for infinite ttl. * @return ER_OK if successful. */ QStatus PushBytes(const void* buf, size_t numBytes, size_t& numSent, uint32_t ttl); /** * Push zero or more bytes into the sink with infinite ttl. * * @param buf Buffer to store pulled bytes * @param numBytes Number of bytes from buf to send to sink. * @param numSent Number of bytes actually consumed by sink. * @return ER_OK if successful. */ QStatus PushBytes(const void* buf, size_t numBytes, size_t& numSent) { return PushBytes(buf, numBytes, numSent, 0); } /** * Get the Event that indicates when data can be pushed to sink. * * @return Event that is signaled when sink can accept more bytes. */ qcc::Event& GetSinkEvent() { return *sinkEvent; } /** * Set the send timeout for this sink. * * @param sendTimeout Send timeout in ms. */ void SetSendTimeout(uint32_t sendTimeout) { this->sendTimeout = sendTimeout; } private: PacketEngine* engine; uint32_t chanId; qcc::Event* sourceEvent; qcc::Event* sinkEvent; uint32_t sendTimeout; PacketEngineStream(PacketEngine& engine, uint32_t chanId, qcc::Event& sourceEvent, qcc::Event& sinkEvent); }; } /* namespace */ #endif
34.793651
116
0.652828
122bfc262e277cf8017275def2525ec0edbaf062
1,800
c
C
src/codec/codec_gtk.c
turenar/progbasictrain-report1
73ab33e14eb9bb1bd1716ef22716d9e2d35b08c6
[ "MIT" ]
null
null
null
src/codec/codec_gtk.c
turenar/progbasictrain-report1
73ab33e14eb9bb1bd1716ef22716d9e2d35b08c6
[ "MIT" ]
null
null
null
src/codec/codec_gtk.c
turenar/progbasictrain-report1
73ab33e14eb9bb1bd1716ef22716d9e2d35b08c6
[ "MIT" ]
null
null
null
#include "config.inc.h" #ifdef USE_GTK #include "codecs.h" #include <stdlib.h> #include <gtk/gtk.h> #include <gdk-pixbuf/gdk-pixbuf.h> #include <pbm.h> #include "logger.h" /** * g_freeするだけの関数 * @param pixels データ * @param unused 未使用 */ static void free_pixels(guchar* pixels, gpointer unused); pbm_error_t pbmcodec_gtk_write(const pbm_info* info, FILE* fp) { UNUSED_VAR(fp); gtk_init(0, NULL); // 3u == RGB gsize allocation_size = 3u * sizeof(guint8) * (gsize) (info->height * info->width); guint8* rgb_image = (guint8*) g_malloc(allocation_size); guint8* out_p = rgb_image; uint8_t** row_p = info->data; for (int y = 0; y < info->height; ++y) { uint8_t* col_p = *row_p++; for (int x = 0; x < info->width; ++x) { guint8 brightness = (guint8) (*col_p++ ? 0 : 255); *out_p++ = brightness; // R *out_p++ = brightness; // G *out_p++ = brightness; // B } } GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL); GdkPixbuf* pixbuf = gdk_pixbuf_new_from_data(rgb_image, GDK_COLORSPACE_RGB, FALSE, 8, info->width, info->height, info->width * 3, free_pixels, NULL); if (pixbuf == NULL) { return PBM_ALLOCATION_FAILED; } GtkWidget* image = gtk_image_new_from_pixbuf(pixbuf); gtk_container_add(GTK_CONTAINER(window), image); gtk_widget_show_all(window); gtk_main(); // FcFini()を呼び出すとfontconfigのalloc leakが報告されなくなるらしいけど、 // fontconfigを直接的に使用してないのにFcFini()を呼び出すのはどうなのだろうか // どちらかというとleak sanitizer側で無視指定したほうが良さそう return PBM_SUCCESS; } static void free_pixels(guchar* pixels, gpointer unused) { UNUSED_VAR(unused); g_free(pixels); } #else typedef int make_iso_compilers_happy; // suppress "ISO C forbids an empty translation unit" #endif
27.272727
113
0.693889
b056c09b7f20d51e66280f902804ba086128b663
646
a51
Assembly
a51test/(A2)MOV_C_bit.a51
Aimini/51cpu
cdeb75510d1dcd867fbebe10e963c4dbecd5ff13
[ "MIT" ]
null
null
null
a51test/(A2)MOV_C_bit.a51
Aimini/51cpu
cdeb75510d1dcd867fbebe10e963c4dbecd5ff13
[ "MIT" ]
null
null
null
a51test/(A2)MOV_C_bit.a51
Aimini/51cpu
cdeb75510d1dcd867fbebe10e963c4dbecd5ff13
[ "MIT" ]
null
null
null
MOV 0x20,#0x01 MOV 0x24,#0x02 MOV 0x2A,#0x04 MOV 0x2F,#0x08 MOV 0x80,#0x10 MOV 0x88,#0x20 MOV 0xA8,#0x40 MOV 0xF0,#0x80 DB 0xA5 ;;;;;;;;;;;;;;;;;;;1 MOV 0xD0,#0 MOV C,0x20.0 ;1 MOV 0xD0,#0 MOV C,0x24.1 ;1 MOV 0xD0,#0 MOV C,0x2A.2 ;1 MOV 0xD0,#0 MOV C,0x2F.3 ;1 MOV 0xD0,#0 MOV C,0x80.4 ;1 MOV 0xD0,#0 MOV C,0x88.5 ;1 MOV 0xD0,#0 MOV C,0xA8.6 ;1 MOV 0xD0,#0 MOV C,0xF0.7 ;1 ;;;;;;;;;;;;;;;;;;;0 MOV 0xD0,#0x80 MOV C,0x20.7 MOV 0xD0,#0x80 MOV C,0x24.0 MOV 0xD0,#0x80 MOV C,0x2A.1 MOV 0xD0,#0x80 MOV C,0x2F.2 MOV 0xD0,#0x80 MOV C,0x80.3 MOV 0xD0,#0x80 MOV C,0x88.4 MOV 0xD0,#0x80 MOV C,0xA8.5 MOV 0xD0,#0x80 MOV C,0xF0.6
11.137931
20
0.619195
c0b0df5e6eacb778dee650fd7f052d2dfc42ef97
13,823
sql
SQL
Is-201/SQL/Mandatory4, Vigilantes.sql
bragex/the-vigilantes
cef95795cb02e7ffea5fbb77134b06234ebe0e7f
[ "MIT" ]
1
2017-08-30T08:27:26.000Z
2017-08-30T08:27:26.000Z
Is-201/SQL/Mandatory4, Vigilantes.sql
bragex/the-vigilantes
cef95795cb02e7ffea5fbb77134b06234ebe0e7f
[ "MIT" ]
1
2017-10-04T12:20:31.000Z
2017-10-04T12:20:31.000Z
Is-201/SQL/Mandatory4, Vigilantes.sql
bragex/the-vigilantes
cef95795cb02e7ffea5fbb77134b06234ebe0e7f
[ "MIT" ]
2
2017-10-04T10:46:09.000Z
2019-04-05T08:58:59.000Z
drop database man4; create database man4; use man4; /* Creates a table for users. */ create table `user` ( user_id varchar(5) primary key, user_name varchar(40), user_email varchar(30), user_number int(12) ); insert into `user` (user_id, user_name, user_email, user_number) values ('us001', 'Morten', 'Morten@hotmail.com', 959595 ), ('us002', 'Benjamin', 'Benjamin@gmail.com', 969696), ('us003', 'Kim', 'Kim@hotmail.com', 979797 ), ('us004', 'Vegard', 'Vegard@gmail.com', 989898 ), ('us005', 'Brage', 'Brage@hotmail.com', 999999), ('us006', 'Jenny', 'Jenny@hotmail.com', 949494), ('us007', 'Tønnes', 'Tønnes@gmail.com', 939393),('us008', 'Ingfrid', 'Ingfrid@hotmail.com', 929292), ('us009', 'Kevin', 'Kevin@hotmail.com', 919191), ('us010', 'Halgeir', 'Halgeir@gmail.com', 909090 ); /* Creates a table for lecturers. The table helps identifying who's a lecturer. */ create table lecturer ( lecturer_id varchar(5) primary key, user_id varchar(5) unique, foreign key (user_id) references `user` (user_id) ); insert into lecturer (lecturer_id, user_id) values ('le001', 'us001'), ('le002', 'us002'); /* Creates a table for modules. We store the information about the assignments here. */ create table module ( module_id varchar(5) primary key, module_name varchar(20), module_goals text, module_details text, module_task text, module_deadline date, module_numquestions int(2) ); /* Tenk på normalform på ressurser */ insert into module (module_id, module_name, module_goals, module_details, module_task, module_deadline, module_numquestions) values ('mo001', 'Module 1', 'Learn function', 'This is module 1', 'Make a function', '2017-06-15', 8), ('mo002', 'Module 2', 'Learn method', 'This is module 2', 'Make a method', '2017-07-15', 5), ('mo003', 'Module 3', 'Learn array', 'This is module 3', 'Make a array', '2017-08-15', 9), ('mo004', 'Module 4', 'Learn testing', 'This is module 4', 'Do some testing and debuging', '2017-09-15', 4), ('mo005', 'Module 5', 'Learn hasmap', 'This is module 5', 'Make a hashmap', '2017-10-15', 6), ('mo006', 'Module 6', 'Learn stuff', 'This is module 6', 'Spesifikk oppgave', '2017-10-15', 3); /* Creates a table for resources for modules */ create table moduleResources( mr_id int auto_increment primary key, mr_resources varchar(50), module_id varchar(5), foreign key (module_id) references module(module_id) ); insert into moduleResources (mr_resources, module_id) values ('LINKLINK','mo001'), ('LINKLINK','mo001'), ('LINKLINK','mo001'), ('LINKLINK','mo002'), ('LINKLINK','mo002'), ('LINKLINK','mo002'), ('LINKLINK','mo002'), ('LINKLINK','mo003'), ('LINKLINK','mo003'), ('LINKLINK','mo003'), ('LINKLINK','mo003'), ('LINKLINK','mo003'), ('LINKLINK','mo004'), ('LINKLINK','mo004'), ('LINKLINK','mo004'), ('LINKLINK','mo004'), ('LINKLINK','mo004'), ('LINKLINK','mo005'), ('LINKLINK','mo005'), ('LINKLINK','mo005'), ('LINKLINK','mo005'), ('LINKLINK','mo006'), ('LINKLINK','mo006'), ('LINKLINK','mo006'); /* Creates a table for students. It exists to identify the students. */ create table student ( student_id varchar(5) primary key, user_id varchar(5) unique, foreign key (user_id) references `user` (user_id) ); insert into student (student_id, user_id) values ('st001', 'us003'), ('st002', 'us004'), ('st003', 'us005'), ('st004', 'us006'), ('st005', 'us007'), ('st006', 'us008'), ('st007', 'us009'), ('st008', 'us010'); /* Creates a table for assigments. This is where the students' assigments are stored. */ create table submit ( submit_id varchar(5) primary key, submit_file varchar(10), submit_date date, module_id varchar(5), student_id varchar(5), foreign key (module_id) references module (module_id), foreign key (student_id) references student (student_id) ); /* Submit_file is for the file name. We used the names for simplicity. */ insert into submit (submit_id, submit_file, submit_date, module_id, student_id) values ('su001', 'fi001', '2017-06-14', 'mo001', 'st001'), ('su002', 'fi002', '2017-07-14', 'mo001', 'st002'), ('su003', 'fi003', '2017-08-14', 'mo002', 'st001'), ('su004', 'fi004', '2017-09-14', 'mo002', 'st004'), ('su005', 'fi005', '2017-10-14', 'mo003', 'st005'), ('su006', 'fi006', '2017-11-14', 'mo003', 'st006'), ('su007', 'fi007', '2017-12-14', 'mo004', 'st007'), ('su008', 'fi008', '2018-01-14', 'mo003', 'st007'), ('su009', 'fi009', '2018-02-14', 'mo005', 'st008'), ('su010', 'fi010', '2018-03-14', 'mo003', 'st008'); /* Creates a table that stores feedback on assignments done by students. */ create table feedback ( feedback_id varchar(5) primary key, feedback_content text, feedback_date date, feedback_points int(2), submit_id varchar(5), foreign key (submit_id) references submit (submit_id) ); insert into feedback (feedback_id, feedback_content, feedback_date, feedback_points, submit_id) values ('fe001','This was good','2017-06-16', 1,'su001'), ('fe002','This was bad','2017-07-16', 2,'su002'), ('fe003', 'Need more work', '2017-08-16', 3, 'su003'), ('fe004', 'Excellent', '2017-09-16', 4, 'su004'), ('fe005', 'Give up', '2017-10-16', 5, 'su005'); /* Creates a table for the blog. */ create table blog ( blog_postID varchar(5) primary key, blog_title varchar(20), blog_content text, blog_datePosted date, student_id varchar(5), foreign key (student_id) references student (student_id) ); insert into blog (blog_postID, blog_title, blog_content, blog_datePosted, student_id) values ('bl001', 'blog 1', 'Ones upon a time', '2017-06-17', 'st001'), ('bl002', 'blog 2', 'There was a boy/girl', '2017-07-17', 'st002'), ('bl003', 'blog 3', 'who was destined', '2017-08-17', 'st003'), ('bl004', 'blog 4', 'to fail the course', '2017-09-17', 'st004'), ('bl005', 'blog 5', 'then they had a little cry', '2017-10-17', 'st005'), ('bl006', 'blog 6', ' but then they relaized', '2017-11-17', 'st006'), ('st007', 'blog 7', 'they had to get their shit together', '2017-12-17', 'st007'), ('st008', 'blog 8', 'and do it again and pass', '2018-01-17', 'st008'); /* Creates a table for standardized notifications. */ create table notification ( notif_id varchar(20) primary key, notif_text text ); insert into notification (notif_id,notif_text) values ('no-submit','Hva nå enn vi skriver her kommer til å vise som en varsel i programmet'), ('no-feedback','Denne varselen er for feedback'), ('no-module','Denne er for modul'); /* Creates a table that connects certain events to a notification. */ create table notifConnections ( notifCon_id varchar(5) primary key, module_id varchar(5), submit_id varchar(5), feedback_id varchar(5), notif_id varchar(20), foreign key (module_id) references module(module_id), foreign key (submit_id) references submit(submit_id), foreign key (feedback_id) references feedback(feedback_id), foreign key (notif_id) references notification(notif_id) ); insert into notifConnections (notifCon_id, module_id, submit_id, feedback_id, notif_id) values ('nc001', null, 'su001', null, 'no-submit'), ('nc002', 'mo001', null, null, 'no-module'), ('nc003', null, null, 'fe001', 'no-feedback'); /* MANDATORY 4 */ create table `comment` ( comment_id varchar(5) primary key, comment_content text, comment_dateposted date, user_id varchar(5), foreign key (user_id) references `user`(user_id) ); insert into `comment` (comment_id, comment_content, comment_dateposted, user_id) values ('co001', 'Oioi! Dette var kos', '2017-10-25', 'us005'), ('co002', 'Godt å høre!', '2017-10-25', 'us001'), ('co003', 'Hjelp!', '2017-10-25', 'us006'), ('co004', 'HJEEEEEELP!!', '2017-10-25', 'us006'), ('co005', 'Ser greit ut', '2017-10-26', 'us003'), ('co006', 'Bræææ', '2017-10-26', 'us002'), ('co007', 'Gjør det, gjør det gjennomfør det!', '2017-10-26', 'us004'), ('co008', 'Tihi', '2017-10-26', 'us009'), ('co009', 'Gulrotkake e best', '2017-10-26', 'us002'), ('co010', 'Hylvedde', '2017-10-26', 'us007'), ('co011', 'SNEISEN', '2017-10-26', 'us002'), ('co012', 'TestTest', '2017-10-26', 'us006'); create table commentModule ( comment_id varchar(5), module_id varchar(5), foreign key (comment_id) references `comment`(comment_id), foreign key (module_id) references module(module_id), primary key (comment_id, module_id) ); insert into commentModule (comment_id, module_id) values ('co005','mo001'),('co006','mo001'),('co007','mo001'); create table commentSubmit ( comment_id varchar(5), submit_id varchar(5), foreign key (comment_id) references `comment`(comment_id), foreign key (submit_id) references submit(submit_id), primary key (comment_id, submit_id) ); insert into commentSubmit (comment_id, submit_id) values ('co001', 'su001'), ('co002', 'su001'), ('co003', 'su002'), ('co004', 'su001'), ('co008', 'su003'), ('co009', 'su004'), ('co010', 'su003'), ('co011', 'su005'), ('co004', 'su005'); /* 1)Define a “view” that only gives read access to a user’s modules and that shows the number of hand-ins each user has. A user name will show several times, as well as the total hand-ins. */ CREATE VIEW opg1 AS SELECT `user`.user_name, submit.module_id, total_deliveries FROM (SELECT user_name, COUNT(submit.submit_id) AS total_deliveries FROM `user`, student, submit WHERE `user`.user_id = student.user_id AND student.student_id = submit.student_id GROUP BY `user`.user_name) AS td_table, `user`, student, submit WHERE `user`.user_id = student.user_id AND student.student_id = submit.student_id AND `user`.user_name = td_table.user_name GROUP BY submit.submit_id ORDER BY `user`.user_name; /* 2)Write a query that lists all modules which does not have hand-ins. */ select module_name from module where module_id not in(select module_id from submit); /* 3)Make an overview of all student users’ tests and results, where you write the number of questions for each test. */ select user_name, module_name, feedback_points, module_numquestions from `user`, student, submit, feedback, module where `user`.user_id = student.user_id and student.student_id = submit.student_id and submit.submit_id = feedback.submit_id and submit.module_id = module.module_id; /* 4)List all users who have “Gmail” as email address. */ select * from `user` where user_email like '%@gmail%'; /* 5)Show an overview of which modules have most comments on the hand-ins, sort according to descending number of comments. */ SELECT module_name, COUNT(`comment`.comment_id) AS comment_amount FROM module, submit, commentSubmit, `comment` WHERE module.module_id = submit.module_id AND submit.submit_id = commentSubmit.submit_id AND commentSubmit.comment_id = `comment`.comment_id GROUP BY module.module_id ORDER BY comment_amount DESC; /* 6)Elaborate the query in question 5 to only include modules that have 3 comments or more. */ SELECT module_name, COUNT(`comment`.comment_id) AS comment_amount FROM module, submit, commentSubmit, `comment` WHERE module.module_id = submit.module_id AND submit.submit_id = commentSubmit.submit_id AND commentSubmit.comment_id = `comment`.comment_id GROUP BY module.module_id HAVING COUNT(`comment`.comment_id) >= 3 ORDER BY comment_amount DESC; /* 7)Write a query to show all the modules that have “Program” in the name, with number of questions. There are no modules with "Program" in the name. */ select module_name, module_numquestions from module where module_name like '%Program%'; /* 8)What is the average number of resources in the modules taken by user X? (Select a particular user). We tried using avg(), but kept getting wrong results.*/ SELECT user_name, COUNT(mr_resources) / divise AS average_resources FROM (SELECT COUNT(submit.submit_id) AS divise, student.student_id FROM `user`, student, submit WHERE `user`.user_id = student.user_id AND student.student_id = submit.student_id GROUP BY student.student_id) AS oioi, `user`, student, submit, module, moduleResources WHERE `user`.user_id = student.user_id AND student.student_id = submit.student_id AND submit.module_id = module.module_id AND moduleResources.module_id = module.module_id AND student.student_id = oioi.student_id AND student.student_id = 'st004' GROUP BY user_name; /* 9)What is “outer join” used for? Give an example. Outer joins return all rows matching your statements, depending on what type of join you do. A left join returns all rows matching your statements in the left table. It also returns those rows in the right table. However, a left join also shows null fields in the right table as long as their is a row returned from the left table. Right join does the opposite. A full outer join find all rows in both tables, so you could have null values in both tables. The query below selects all the rows in the left table (submit). It also selects all the matching and non-matching rows in the right table (feedback). It selects all the hand-ins and the feedback connected to it, which may be null. */ select user_name, submit.submit_id, feedback.feedback_id, feedback_content, feedback_points from submit left outer join feedback on submit.submit_id = feedback.submit_id join student on submit.student_id = student.student_id join `user` on student.user_id = `user`.user_id;
37.5625
113
0.6746
d0ed44f47f526daa365e91212460df319bd0f41b
820
asm
Assembly
oeis/142/A142828.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/142/A142828.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/142/A142828.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A142828: Primes congruent to 30 mod 61. ; Submitted by Jon Maiga ; 457,701,823,1433,2287,2531,2897,3019,4483,5581,6679,7411,8387,8753,9241,9851,9973,10949,11071,11437,11681,12413,13267,13633,13877,13999,14243,14731,16073,16561,16927,17293,17659,17903,18269,18757,19001,19489,21319,21563,21929,22051,22783,23027,24247,24979,25589,26321,26687,27541,28151,28517,30103,30347,30469,30713,31079,31567,32299,32909,33641,34129,34739,35227,35593,35837,36691,37057,37423,39619,39863,40351,40961,42181,43889,44621,44987,45841,46451,46573,46817,48281,48647,50111,50599,51941 mov $2,$0 add $2,6 pow $2,2 lpb $2 mov $3,$4 add $3,29 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 mov $1,$0 max $1,0 cmp $1,$0 mul $2,$1 add $3,1 sub $2,$3 add $4,61 lpe mov $0,$4 add $0,30
35.652174
497
0.731707
9c4c5cfde77550de3c72209f72ee5dd795ccf5f3
1,239
js
JavaScript
tests/pages/Login.spec.js
DiegoVictor/tindev-app
d69e3249117a12125227d12ccc430d747dbbe1ae
[ "MIT" ]
null
null
null
tests/pages/Login.spec.js
DiegoVictor/tindev-app
d69e3249117a12125227d12ccc430d747dbbe1ae
[ "MIT" ]
null
null
null
tests/pages/Login.spec.js
DiegoVictor/tindev-app
d69e3249117a12125227d12ccc430d747dbbe1ae
[ "MIT" ]
null
null
null
import React from 'react'; import { render, fireEvent, act } from '@testing-library/react-native'; import AsyncStorage from '@react-native-community/async-storage'; import faker from 'faker'; import MockAdapter from 'axios-mock-adapter'; import api from '~/services/api'; import Login from '~/pages/Login'; import { UserContext } from '~/contexts/User'; describe('Login page', () => { const apiMock = new MockAdapter(api); it('should be able to login', async () => { const setUser = jest.fn(); const { getByTestId, getByPlaceholderText } = render( <UserContext.Provider value={{ setUser, }} > <Login /> </UserContext.Provider> ); const id = faker.random.number(); const token = faker.random.uuid(); apiMock.onPost('developers').reply(200, { developer: { _id: id }, token }); fireEvent.changeText( getByPlaceholderText('Digite seu usuáro no Github'), faker.internet.userName() ); await act(async () => { fireEvent.press(getByTestId('submit')); }); expect(await AsyncStorage.getItem('tindev_user')).toBe( JSON.stringify({ id, token }) ); expect(setUser).toHaveBeenCalledWith({ id, token }); }); });
26.934783
79
0.632768
189d39b549542bab9b583804d53bb8cb0aa0e344
4,071
rb
Ruby
lib/synced_memory_store/subscriber.rb
shiftcommerce/synced_memory_store
1fe627d8a785a801618da01275d3c142204d8dd8
[ "MIT" ]
null
null
null
lib/synced_memory_store/subscriber.rb
shiftcommerce/synced_memory_store
1fe627d8a785a801618da01275d3c142204d8dd8
[ "MIT" ]
null
null
null
lib/synced_memory_store/subscriber.rb
shiftcommerce/synced_memory_store
1fe627d8a785a801618da01275d3c142204d8dd8
[ "MIT" ]
null
null
null
require 'redis' require 'thread' module SyncedMemoryStore class Subscriber include Singleton def initialize self.mutex = Mutex.new self.subscriptions = [] self.subscribed = false end def subscribe(cache_instance) subscriptions << cache_instance unless subscriptions.include?(cache_instance) log("SyncedMemoryStore instance #{cache_instance.uuid} registered for updates") end def configure(logger: nil) mutex.synchronize do next self if configured self.logger = logger self.configured = true self end end def reset! self.subscriptions = [] end def start(wait: false) mutex.synchronize do next self if started start_thread if wait wait_for_subscription end self.started = true self end end def start_thread self.thread = Thread.new do begin redis.subscribe(:synced_memory_store_writes, :synced_memory_store_deletes, :synced_memory_store_clears) do |on| on.subscribe do |channel, subscriptions| log("Subscribed to channel #{channel}") self.subscribed = true end on.message do |channel, message| send("on_#{channel}".to_sym, message) redis.unsubscribe if message == "exit" end on.unsubscribe do |channel, subscriptions| log("Unsubscribed from channel #{channel}") self.subscribed = false end end rescue Redis::BaseConnectionError => error puts "#{error}, retrying in 1s" sleep 1 retry rescue Exception => ex raise end end end private def log(msg) return if logger.nil? if logger.respond_to?(:tagged) logger.tagged("synced_memory_store") { logger.info msg } else logger.info msg end end def on_synced_memory_store_writes(message) message_decoded = Marshal.load(message) subscribers_informed = 0 subscriptions.each do |cache_instance| next if cache_instance.uuid == message_decoded[:sender_uuid] cache_instance.write_from_subscriber(message_decoded[:key], message_decoded[:entry], silent: true, persist: false, **message_decoded[:options]) subscribers_informed += 1 end log("Write to key #{message_decoded[:key]} shared with #{subscribers_informed} subscribers") unless subscribers_informed == 0 end def on_synced_memory_store_deletes(message) message_decoded = Marshal.load(message) subscribers_informed = 0 subscriptions.each do |cache_instance| next if cache_instance.uuid == message_decoded[:sender_uuid] cache_instance.delete(message_decoded[:key], silent: true, persist: false) subscribers_informed += 1 end log("Delete key #{message_decoded[:key]} shared with #{subscribers_informed} subscribers") unless subscribers_informed == 0 end def on_synced_memory_store_clears(message) message_decoded = Marshal.load(message) subscribers_informed = 0 subscriptions.each do |cache_instance| next if cache_instance.uuid == message_decoded[:sender_uuid] cache_instance.clear(silent: true, persist: false) subscribers_informed += 1 end log("Clear call shared with #{subscribers_informed} subscribers") unless subscribers_informed == 0 end def subscribed? subscribed end def wait_for_subscription start = Time.now while Time.now < (start + 10.seconds) break if subscribed? sleep 0.1 end raise "Could not subscribe to redis in 10 seconds" unless subscribed? end def redis @redis ||= Redis.new end attr_accessor :thread, :subscriptions, :subscribed, :logger, :configured, :started, :mutex private_class_method :initialize private_class_method :new end end redis = Redis.new
28.87234
151
0.644805
219b1b4efe38a2547a3373927bcdf217c3b20946
184
rs
Rust
cmd/starcoin/src/chain/verify/mod.rs
fengzeyan/starcoin
6518ed5f16cf3c6111e0c2523a7f774f88658061
[ "Apache-2.0" ]
1
2021-04-23T05:49:08.000Z
2021-04-23T05:49:08.000Z
cmd/starcoin/src/chain/verify/mod.rs
fengzeyan/starcoin
6518ed5f16cf3c6111e0c2523a7f774f88658061
[ "Apache-2.0" ]
null
null
null
cmd/starcoin/src/chain/verify/mod.rs
fengzeyan/starcoin
6518ed5f16cf3c6111e0c2523a7f774f88658061
[ "Apache-2.0" ]
null
null
null
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 mod block; mod epoch_info; mod node; pub use block::*; pub use epoch_info::*; pub use node::*;
16.727273
47
0.711957
d9c937099c8564a53802618996cced9e0f6e302c
200
sql
SQL
Create_table.sql
UltimateSheep/Express-app
8e0ae81850547cbaffdbd9fec73d6d788702e560
[ "MIT" ]
null
null
null
Create_table.sql
UltimateSheep/Express-app
8e0ae81850547cbaffdbd9fec73d6d788702e560
[ "MIT" ]
null
null
null
Create_table.sql
UltimateSheep/Express-app
8e0ae81850547cbaffdbd9fec73d6d788702e560
[ "MIT" ]
null
null
null
CREATE TABLE A_IMAGE ( id serial not null primary key, name VARCHAR(255) NOT NULL, image VARCHAR(199) NOT NULL, date TIMESTAMP NOT NULL, data bytea NOT NULL ) -- DROP TABLE A_IMAGE
28.571429
35
0.69
a6fe69123cc7984389de20b30f5ccf1a27c101c8
574
asm
Assembly
PRG/levels/Desert/W2HBA.asm
narfman0/smb3_pp1
38a58adafff67a403591e38875e9fae943a5fe76
[ "Unlicense" ]
null
null
null
PRG/levels/Desert/W2HBA.asm
narfman0/smb3_pp1
38a58adafff67a403591e38875e9fae943a5fe76
[ "Unlicense" ]
null
null
null
PRG/levels/Desert/W2HBA.asm
narfman0/smb3_pp1
38a58adafff67a403591e38875e9fae943a5fe76
[ "Unlicense" ]
null
null
null
; Original address was $B1F6 ; World 2 Boomerang/Fire Bro .word $0000 ; Alternate level layout .word $0000 ; Alternate object layout .byte LEVEL1_SIZE_01 | LEVEL1_YSTART_180 .byte LEVEL2_BGPAL_01 | LEVEL2_OBJPAL_08 | LEVEL2_XSTART_18 .byte LEVEL3_TILESET_09 | LEVEL3_VSCROLL_LOCKED .byte LEVEL4_BGBANK_INDEX(9) | LEVEL4_INITACT_NOTHING .byte LEVEL5_BGM_BATTLE | LEVEL5_TIME_200 .byte $11, $04, $0A, $11, $0C, $0A, $14, $0A, $0A, $16, $00, $04, $16, $05, $04, $16 .byte $0D, $04, $79, $00, $20, $79, $02, $23, $79, $07, $20, $18, $09, $62, $19, $09 .byte $62, $FF
41
85
0.681185