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
4070742e277cd53474765332c944e9da1da29e95
4,889
py
Python
AutomationFramework/tests/qos/test_qos_scheduler.py
sbarguil/Testing-framework
f3ef69f1c4f0aeafd02e222d846162c711783b15
[ "Apache-2.0" ]
1
2020-04-23T15:22:16.000Z
2020-04-23T15:22:16.000Z
AutomationFramework/tests/qos/test_qos_scheduler.py
sbarguil/Testing-framework
f3ef69f1c4f0aeafd02e222d846162c711783b15
[ "Apache-2.0" ]
44
2020-08-13T19:35:41.000Z
2021-03-01T09:08:00.000Z
AutomationFramework/tests/qos/test_qos_scheduler.py
sbarguil/Testing-framework
f3ef69f1c4f0aeafd02e222d846162c711783b15
[ "Apache-2.0" ]
6
2020-04-23T15:29:38.000Z
2022-03-03T14:23:38.000Z
import pytest from AutomationFramework.page_objects.qos.qos import QOS from AutomationFramework.tests.base_test import BaseTest class TestQOSScheduler(BaseTest): test_case_file = 'qos_scheduler.yml' @pytest.mark.parametrize('create_page_object_arg', [{'test_case_file': test_case_file, 'test_case_name': 'qos_scheduler_policy_name', 'page_object_class': QOS}]) def test_qos_scheduler_policy_name(self, create_page_object): create_page_object.execute_qos_scheduler_edit_config_test_case() assert create_page_object.generic_validate_test_case_params(), create_page_object.get_test_case_description() @pytest.mark.parametrize('create_page_object_arg', [{'test_case_file': test_case_file, 'test_case_name': 'qos_scheduler_sequence', 'page_object_class': QOS}]) def test_qos_scheduler_sequence(self, create_page_object): create_page_object.execute_qos_scheduler_edit_config_test_case() assert create_page_object.generic_validate_test_case_params(), create_page_object.get_test_case_description() @pytest.mark.parametrize('create_page_object_arg', [{'test_case_file': test_case_file, 'test_case_name': 'qos_scheduler_id', 'page_object_class': QOS}]) def test_qos_scheduler_id(self, create_page_object): create_page_object.execute_qos_scheduler_edit_config_test_case() assert create_page_object.generic_validate_test_case_params(), create_page_object.get_test_case_description() @pytest.mark.parametrize('multiple_create_page_objects_arg', [{'test_case_file': test_case_file, 'test_case_name': 'qos_scheduler_queue', 'page_object_rpcs_classes': [QOS, QOS], 'rpc_clean_order': [1, 0], }]) def test_qos_scheduler_queue(self, multiple_create_page_objects): multiple_create_page_objects[0].execute_qos_queue_edit_config_test_case() assert multiple_create_page_objects[0].validate_rpc(), multiple_create_page_objects[0].get_test_case_description() multiple_create_page_objects[1].execute_qos_scheduler_edit_config_test_case() assert multiple_create_page_objects[1].validate_rpc(), multiple_create_page_objects[1].get_test_case_description() @pytest.mark.parametrize('create_page_object_arg', [{'test_case_file': test_case_file, 'test_case_name': 'qos_scheduler_weight', 'page_object_class': QOS}]) def test_qos_scheduler_weight(self, create_page_object): create_page_object.execute_qos_scheduler_edit_config_test_case() assert create_page_object.generic_validate_test_case_params(), create_page_object.get_test_case_description() @pytest.mark.parametrize('create_page_object_arg', [{'test_case_file': test_case_file, 'test_case_name': 'qos_scheduler_cir', 'page_object_class': QOS}]) def test_qos_scheduler_cir(self, create_page_object): create_page_object.execute_qos_scheduler_edit_config_test_case() assert create_page_object.generic_validate_test_case_params(), create_page_object.get_test_case_description() @pytest.mark.parametrize('create_page_object_arg', [{'test_case_file': test_case_file, 'test_case_name': 'qos_scheduler_max_queue_depth_bytes', 'page_object_class': QOS}]) def test_qos_scheduler_max_queue_depth_bytes(self, create_page_object): create_page_object.execute_qos_scheduler_edit_config_test_case() assert create_page_object.generic_validate_test_case_params(), create_page_object.get_test_case_description() @pytest.mark.parametrize('create_page_object_arg', [{'test_case_file': test_case_file, 'test_case_name': 'qos_scheduler_bc', 'page_object_class': QOS}]) def test_qos_scheduler_bc(self, create_page_object): create_page_object.execute_qos_scheduler_edit_config_test_case() assert create_page_object.generic_validate_test_case_params(), create_page_object.get_test_case_description()
71.897059
122
0.635713
8ecd6deb2d4e9372a22e4ec0f68762249e9f0f13
965
rb
Ruby
lib/iron/settings/node.rb
irongaze/iron-settings
9807fa70ec1ba0efe8c0073c677f859f14bc1288
[ "MIT" ]
null
null
null
lib/iron/settings/node.rb
irongaze/iron-settings
9807fa70ec1ba0efe8c0073c677f859f14bc1288
[ "MIT" ]
null
null
null
lib/iron/settings/node.rb
irongaze/iron-settings
9807fa70ec1ba0efe8c0073c677f859f14bc1288
[ "MIT" ]
null
null
null
class Settings # Base class for groups and entries - provides our structure class Node # Used to separate node names in a full key NODE_SEPARATOR = '.'.freeze # All nodes have these items... attr_accessor :root, :parent, :name, :key def initialize(parent, name = nil) # Validate name unless parent.nil? || name.match(/[a-z0-9_]+/) raise ArgumentError.new("Invalid settings key name '#{name}' - may only contain a-z, 0-9 and _ characters") end @parent = parent @name = name if @parent.nil? # We are the root! @root = self @key = nil else # Normal node, chain ourselves @root = parent.root if parent.key.blank? @key = name else @key = [@parent.key, name].join(NODE_SEPARATOR) end end end def group? false end def entry? false end end end
20.978261
115
0.550259
5df4d2bac79bc7fe997f240cdbd7f544410d7917
498
h
C
Morpheus/Engine/Source/Engine/Util/StringUtil.h
madureira/morpheus-engine
4f99726b24f8d6f05f9ad971a2000a023ac8a656
[ "MIT" ]
15
2019-12-11T07:01:42.000Z
2022-03-23T21:09:24.000Z
Morpheus/Engine/Source/Engine/Util/StringUtil.h
madureira/morpheus-engine
4f99726b24f8d6f05f9ad971a2000a023ac8a656
[ "MIT" ]
2
2018-08-04T16:29:11.000Z
2018-12-19T11:43:40.000Z
Morpheus/Engine/Source/Engine/Util/StringUtil.h
madureira/morpheus-engine
4f99726b24f8d6f05f9ad971a2000a023ac8a656
[ "MIT" ]
null
null
null
#pragma once #include <string> #include <algorithm> namespace Morpheus { class StringUtil final { public: static inline std::string ToLowerCase(std::string str) { std::transform(str.begin(), str.end(), str.begin(), ::tolower); return str; } static inline std::string ToUpperCase(std::string str) { std::transform(str.begin(), str.end(), str.begin(), ::toupper); return str; } }; }
19.92
75
0.542169
2f880a9d27a655f03f7c503c909fcc6cbb46ce7a
167
swift
Swift
Tests/FluentTests/Utilities/Serialize.swift
cardoso/fluent
82b6a8644387babbbecbc7fcd70971770d3c1bdc
[ "MIT" ]
null
null
null
Tests/FluentTests/Utilities/Serialize.swift
cardoso/fluent
82b6a8644387babbbecbc7fcd70971770d3c1bdc
[ "MIT" ]
null
null
null
Tests/FluentTests/Utilities/Serialize.swift
cardoso/fluent
82b6a8644387babbbecbc7fcd70971770d3c1bdc
[ "MIT" ]
null
null
null
import Fluent func serialize<E: Entity>(_ query: Query<E>) -> (String, [Node]) { let serializer = GeneralSQLSerializer(query) return serializer.serialize() }
23.857143
66
0.700599
7bcb65c8c528de3f1c869d09b1878b58ccc69690
312
jbuilder
Ruby
app/views/topics/_topic.json.jbuilder
ramses-lopez/forum
4bebc432b890fd4dc1eeefcae2c3a7d67ffe591a
[ "MIT" ]
null
null
null
app/views/topics/_topic.json.jbuilder
ramses-lopez/forum
4bebc432b890fd4dc1eeefcae2c3a7d67ffe591a
[ "MIT" ]
10
2019-11-08T17:57:43.000Z
2022-03-30T22:29:07.000Z
app/views/topics/_topic.json.jbuilder
ramses-lopez/forum
4bebc432b890fd4dc1eeefcae2c3a7d67ffe591a
[ "MIT" ]
null
null
null
json.extract! topic, :id, :title, :content, :user_id, :created_at, :updated_at json.user topic.user.name json.created_at topic.created_at.to_formatted_s(:long) json.updated_at topic.updated_at.to_formatted_s(:long) json.post_count topic.posts.size json.posts topic.posts json.url topic_url(topic, format: :json)
39
78
0.801282
3ee1c38b672c9e1e6d9c0a31d8624d0caea53d75
210
h
C
app/src/main/cpp/libetpan/src/data-types/mailsasl_private.h
yuryybk/android-libetpan-cmake-example
ca5acbee12894b575b868b7782877c48e984d131
[ "MIT" ]
null
null
null
app/src/main/cpp/libetpan/src/data-types/mailsasl_private.h
yuryybk/android-libetpan-cmake-example
ca5acbee12894b575b868b7782877c48e984d131
[ "MIT" ]
null
null
null
app/src/main/cpp/libetpan/src/data-types/mailsasl_private.h
yuryybk/android-libetpan-cmake-example
ca5acbee12894b575b868b7782877c48e984d131
[ "MIT" ]
null
null
null
#ifndef MAILSASL_PRIVATE_H #define MAILSASL_PRIVATE_H #ifdef __cplusplus extern"C"{ #endif extern void mailsasl_init_lock(void); extern void mailsasl_uninit_lock(void); #ifdef __cplusplus } #endif #endif
11.666667
39
0.8
6575a4e50194eeca4106df833f2ed7433bc0b860
537
sql
SQL
world-cup.sql
lindig/rowing-championships
07dde09580693fe6d0abefe3fe009e01bdfce2ca
[ "CC0-1.0" ]
null
null
null
world-cup.sql
lindig/rowing-championships
07dde09580693fe6d0abefe3fe009e01bdfce2ca
[ "CC0-1.0" ]
null
null
null
world-cup.sql
lindig/rowing-championships
07dde09580693fe6d0abefe3fe009e01bdfce2ca
[ "CC0-1.0" ]
null
null
null
DROP TABLE IF EXISTS crew; CREATE TABLE crew( race INTEGER, team TEXT, athlete TEXT, birthday DATE ); DROP TABLE IF EXISTS race; CREATE TABLE race( id INTEGER, year INTEGER, date DATE, descr TEXT, class TEXT, number TEXT, round TEXT, gender TEXT, weight TEXT, junior TEXT, adaptive TEXT, coxed TEXT, final TEXT, time_500m REAL, time_1000m REAL, time_1500m REAL, time_2000m REAL ); .mode csv .header on .import crew.csv crew .import race.csv race CREATE UNIQUE INDEX race_idx on race(id);
13.425
41
0.700186
2682a211109d64bc5b20f0ca45460599d531ea23
1,016
java
Java
javaweb-jiajiale-master/jiajiale-web/src/main/java/com/vip/service/VipConsumeManageService.java
xionghaoxh/vip
9446c68194c1265d9e1fc37f1a8810e92863868e
[ "Apache-2.0" ]
null
null
null
javaweb-jiajiale-master/jiajiale-web/src/main/java/com/vip/service/VipConsumeManageService.java
xionghaoxh/vip
9446c68194c1265d9e1fc37f1a8810e92863868e
[ "Apache-2.0" ]
null
null
null
javaweb-jiajiale-master/jiajiale-web/src/main/java/com/vip/service/VipConsumeManageService.java
xionghaoxh/vip
9446c68194c1265d9e1fc37f1a8810e92863868e
[ "Apache-2.0" ]
null
null
null
package com.vip.service; import com.vip.ao.QueryVipConsumeAo; import com.vip.ao.VipConsumeAo; import com.vip.dto.QueryResult; import com.vip.entity.VipConsumeEntity; public interface VipConsumeManageService { /** * 添加vip消费记录 * @param ao * @throws Exception */ void addVipConsume(VipConsumeAo ao)throws Exception; /** * 查询指定消费记录详情 * @param id * @return * @throws Exception */ VipConsumeEntity checkVipConsume(String id)throws Exception; QueryResult<VipConsumeEntity> queryVipConsumeByMobile(String mobile,int pageNo, int pageSize) throws Exception ; /** * 作废指定的消费记录 * @param id * @throws Exception */ void deleteVipConsume(String id)throws Exception; QueryResult<VipConsumeEntity> queryVipConsumeByKey(String key, int pageNo, int pageSize) throws Exception; /** * 查询消费记录 * @param ao * @param pageNo * @param pageSize * @return * @throws Exception */ QueryResult<VipConsumeEntity> queryConsume(QueryVipConsumeAo ao, int pageNo, int pageSize)throws Exception; }
23.627907
113
0.745079
b0b4ebff9d42f0ad15d22d24935729da1c4fd44b
138
kt
Kotlin
src/main/kotlin/anissia/domain/board/core/model/RecentHomeItem.kt
anissia-net/anissia-core
f2af520cace8185f443e0818b311cc567dae367b
[ "CC-BY-4.0" ]
12
2019-11-17T04:20:10.000Z
2022-03-01T17:02:29.000Z
src/main/kotlin/anissia/domain/board/core/model/RecentHomeItem.kt
anissia-net/anissia-core
f2af520cace8185f443e0818b311cc567dae367b
[ "CC-BY-4.0" ]
4
2021-04-26T08:40:25.000Z
2021-05-16T18:41:36.000Z
src/main/kotlin/anissia/domain/board/core/model/RecentHomeItem.kt
anissia-net/anissia-core
f2af520cace8185f443e0818b311cc567dae367b
[ "CC-BY-4.0" ]
2
2021-03-29T00:08:48.000Z
2021-03-31T05:53:06.000Z
package anissia.domain.board.core.model data class RecentHomeItem( val notice: RecentTickerItem, val inquiry: RecentTickerItem )
19.714286
39
0.782609
93260b37c560150116a9bb55994827df02e83f00
188
sql
SQL
database/sqls/old/2017-11-27_discount_showtimes.sql
darrellweaverjr/Ticketbat
a7ba85504d6979e8e1d69ae1b00948911ae8f574
[ "MIT" ]
1
2021-09-02T22:05:04.000Z
2021-09-02T22:05:04.000Z
database/sqls/old/2017-11-27_discount_showtimes.sql
darrellweaverjr/Ticketbat
a7ba85504d6979e8e1d69ae1b00948911ae8f574
[ "MIT" ]
null
null
null
database/sqls/old/2017-11-27_discount_showtimes.sql
darrellweaverjr/Ticketbat
a7ba85504d6979e8e1d69ae1b00948911ae8f574
[ "MIT" ]
null
null
null
CREATE TABLE `discount_show_times` ( `discount_id` INT(10) UNSIGNED NOT NULL, `show_time_id` INT(10) UNSIGNED NOT NULL, PRIMARY KEY (`discount_id`, `show_time_id`)) ENGINE = InnoDB;
31.333333
46
0.734043
123a99636d4e1fc997bf6b63892bcee0b694eec1
594
h
C
src/mainwindow.h
t0msk/InputLagTester
b2f4df7dff721e176f37dec42045425fcd87f39a
[ "MIT" ]
null
null
null
src/mainwindow.h
t0msk/InputLagTester
b2f4df7dff721e176f37dec42045425fcd87f39a
[ "MIT" ]
null
null
null
src/mainwindow.h
t0msk/InputLagTester
b2f4df7dff721e176f37dec42045425fcd87f39a
[ "MIT" ]
null
null
null
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private slots: void on_pushButton_Click_clicked(); void on_pushButton_State_clicked(); void toggleState(); void redButton(); void setButtonClass(QString); void measure(QString); void wait(int); void setUI(QString, int, bool); void on_lineEdit_textChanged(); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H
14.142857
45
0.693603
e57d29cc07e111ce9128d21c6b958a592d3f5b60
321
ts
TypeScript
projects/angular-tabler-icons/icons/svg/arrow-big-right.ts
pierreavn/angular-tabler-icons
25148633a72e980be8468cd5afa823c0f274e224
[ "MIT" ]
4
2021-05-21T12:47:31.000Z
2022-03-23T19:55:21.000Z
projects/angular-tabler-icons/icons/svg/arrow-big-right.ts
pierreavn/angular-tabler-icons
25148633a72e980be8468cd5afa823c0f274e224
[ "MIT" ]
3
2021-08-07T13:33:08.000Z
2022-01-27T07:52:20.000Z
projects/angular-tabler-icons/icons/svg/arrow-big-right.ts
pierreavn/angular-tabler-icons
25148633a72e980be8468cd5afa823c0f274e224
[ "MIT" ]
4
2021-08-07T13:09:51.000Z
2022-01-03T14:18:29.000Z
export const IconArrowBigRight = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <path stroke="none" d="M0 0h24v24H0z" fill="none"/> <path d="M4 9h8v-3.586a1 1 0 0 1 1.707 -.707l6.586 6.586a1 1 0 0 1 0 1.414l-6.586 6.586a1 1 0 0 1 -1.707 -.707v-3.586h-8a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1z" /> </svg> `
45.857143
161
0.629283
5230da42f0a79ed2b8ca8ec96bbf3c3da170ee63
1,176
swift
Swift
ChannelIO/Source/Promises/ChannelPromise.swift
konifar/channel-plugin-ios
fa459a7b0c9f1c0fbdfd391bbb44be9be79edf7b
[ "MIT" ]
12
2017-11-03T09:16:46.000Z
2020-11-17T03:43:15.000Z
ChannelIO/Source/Promises/ChannelPromise.swift
konifar/channel-plugin-ios
fa459a7b0c9f1c0fbdfd391bbb44be9be79edf7b
[ "MIT" ]
93
2018-05-31T09:36:25.000Z
2020-09-26T09:52:13.000Z
ChannelIO/Source/Promises/ChannelPromise.swift
konifar/channel-plugin-ios
fa459a7b0c9f1c0fbdfd391bbb44be9be79edf7b
[ "MIT" ]
11
2017-04-01T05:17:23.000Z
2021-12-14T01:50:44.000Z
// // ChannelPromise.swift // CHPlugin // // Created by Haeun Chung on 06/02/2017. // Copyright © 2017 ZOYI. All rights reserved. // import Foundation import RxSwift import Alamofire import ObjectMapper import SwiftyJSON struct ChannelPromise { static func getChannel() -> Observable<CHChannel> { return Observable.create { (subscriber) -> Disposable in let req = AF .request(RestRouter.GetChannel) .validate(statusCode: 200..<300) .responseJSON(completionHandler: { response in switch response.result{ case .success(let data): let json = JSON(data) guard let channel = Mapper<CHChannel>() .map(JSONObject: json["channel"].object) else { subscriber.onError(ChannelError.parseError) return } subscriber.onNext(channel) subscriber.onCompleted() case .failure(let error): subscriber.onError(ChannelError.serverError( msg: error.localizedDescription )) } }) return Disposables.create { req.cancel() } } } }
26.133333
61
0.590136
fff1111b05fb159b7d062b5161138a48747a2742
114
html
HTML
projects/yoda-float/src/lib/yoda-float-ship/yoda-float-ship.component.html
hearsol/yoda-lib
8faad6219dc0238de1358e45de40a7677fe27ff0
[ "MIT" ]
1
2019-07-30T05:10:30.000Z
2019-07-30T05:10:30.000Z
projects/yoda-float/src/lib/yoda-float-ship/yoda-float-ship.component.html
hearsol/yoda-lib
8faad6219dc0238de1358e45de40a7677fe27ff0
[ "MIT" ]
7
2021-03-09T00:18:21.000Z
2022-03-02T02:58:07.000Z
projects/yoda-float/src/lib/yoda-float-ship/yoda-float-ship.component.html
hearsol/yoda-lib
8faad6219dc0238de1358e45de40a7677fe27ff0
[ "MIT" ]
2
2019-02-13T13:31:10.000Z
2019-11-04T05:07:33.000Z
<div class="tp-box unit-wrap" [@flipState]="flip" id="scrollToMe" #flip> <ng-template #vc></ng-template> </div>
28.5
72
0.657895
3a59d6be5a1f173011639cdddbce2cb139d70f22
3,744
swift
Swift
MusicApp/Pods/Spartan/Spartan/Classes/AudioAnalysisTrack.swift
MondaleFelix/MusicApp
3071ec20cd5d659d466a0776d75d602e2a1be3e0
[ "MIT" ]
112
2017-02-02T15:00:10.000Z
2022-03-16T19:10:48.000Z
MusicApp/Pods/Spartan/Spartan/Classes/AudioAnalysisTrack.swift
MondaleFelix/MusicApp
3071ec20cd5d659d466a0776d75d602e2a1be3e0
[ "MIT" ]
24
2017-07-10T01:05:09.000Z
2021-03-10T08:27:44.000Z
MusicApp/Pods/Spartan/Spartan/Classes/AudioAnalysisTrack.swift
MondaleFelix/MusicApp
3071ec20cd5d659d466a0776d75d602e2a1be3e0
[ "MIT" ]
24
2017-02-01T09:10:34.000Z
2021-12-29T17:45:32.000Z
/* The MIT License (MIT) Copyright (c) 2017 Dalton Hinterscher Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ import ObjectMapper public class AudioAnalysisTrack: Mappable { public private(set) var numberOfSamples: Int! public private(set) var duration: Double! public private(set) var sampleMd5: String! public private(set) var offsetSeconds: Int! public private(set) var windowSeconds: Int! public private(set) var analysisSampleRate: Int! public private(set) var analysisChannels: Int! public private(set) var endOfFadeIn: Double! public private(set) var startOfFadeOut: Int! public private(set) var loudness: Double! public private(set) var tempo: Double! public private(set) var tempoConfidence: Double! public private(set) var timeSignature: Int! public private(set) var timeSignatureConfidence: Int! public private(set) var key: Int! public private(set) var keyConfidence: Double! public private(set) var mode: Int! public private(set) var modeConfidence: Double! public private(set) var codestring: String! public private(set) var codeVersion: Double! public private(set) var echoPrintString: String! public private(set) var echoPrintVersion: Double! public private(set) var synchString: String! public private(set) var synchVersion: Double! public private(set) var rhythmsString: String! public private(set) var rhythmsVersion: Double! required public init?(map: Map) { mapping(map: map) } public func mapping(map: Map) { numberOfSamples <- map["num_samples"] duration <- map["duration"] sampleMd5 <- map["sample_md5"] offsetSeconds <- map["offset_seconds"] windowSeconds <- map["window_seconds"] analysisSampleRate <- map["analysis_sample_rate"] analysisChannels <- map["analysis_channels"] endOfFadeIn <- map["end_of_fade_in"] startOfFadeOut <- map["start_of_fade_out"] loudness <- map["loudness"] tempo <- map["tempo"] tempoConfidence <- map["tempo_confidence"] timeSignature <- map["time_signature"] timeSignatureConfidence <- map["time_signature_confidence"] key <- map["key"] keyConfidence <- map["key_confidence"] mode <- map["mode"] modeConfidence <- map["mode_confidence"] codestring <- map["codestring"] codeVersion <- map["code_version"] echoPrintString <- map["echoprintstring"] echoPrintVersion <- map["echoprint_version"] synchString <- map["synchstring"] synchVersion <- map["synch_version"] rhythmsString <- map["rhythmstring"] rhythmsVersion <- map["rhythm_version"] } }
45.108434
147
0.7086
c62033ee79237efc75e6e84058df3307b5bbe518
343
rb
Ruby
spec/features/delete_movie_spec.rb
nikita-kazakov/flix-rails-app
fcd43ce9ea0ea485d09b7a7b9045925f36b4643e
[ "MIT" ]
4
2019-06-27T22:59:06.000Z
2022-01-26T00:07:09.000Z
spec/features/delete_movie_spec.rb
nikita-kazakov/flix-rails-app
fcd43ce9ea0ea485d09b7a7b9045925f36b4643e
[ "MIT" ]
11
2020-02-25T23:27:57.000Z
2022-03-30T23:17:46.000Z
spec/features/delete_movie_spec.rb
nikita-kazakov/flix-rails-app
fcd43ce9ea0ea485d09b7a7b9045925f36b4643e
[ "MIT" ]
null
null
null
require 'rails_helper' describe 'Deleting a Movie' do it 'destroys the movie and show movie listing without it' do movie = Movie.create(movie_attributes(title: "Pains")) visit movie_url(movie) click_link 'Delete Movie' expect(page).to_not have_text(movie.title) expect(page).to have_text('Movie Deleted.') end end
21.4375
62
0.720117
e7ed80b597ccfb79e5e0d84b01e14970f4384658
434
py
Python
day22/day22.py
norbert-e-horn/adventofcode-2017
81a6a8eb6f23f2191786d1ea8b2aad1f54d9c12a
[ "Apache-2.0" ]
null
null
null
day22/day22.py
norbert-e-horn/adventofcode-2017
81a6a8eb6f23f2191786d1ea8b2aad1f54d9c12a
[ "Apache-2.0" ]
null
null
null
day22/day22.py
norbert-e-horn/adventofcode-2017
81a6a8eb6f23f2191786d1ea8b2aad1f54d9c12a
[ "Apache-2.0" ]
null
null
null
import sys c=[[2if a=="#"else 0for a in i]for i in sys.argv[1].split("\n")] n=len(c) def m(x): d[0]=(d[0]+a[d[1]]+3)%4 a[d[1]]=(x+a[d[1]])%4 if a[d[1]]==2:d[2]+=1 d[1]+=(s+(1-s)*(d[0]&1))*(-1+2*(d[0]&1^(d[0]&2)>>1)) s=1001 a=[] k=(s-n)//2 for i in range(s):a+=[0]*k+c[i-k]+k*[0]if k<=i<(s+n)/2else[0]*s b=list(a) d=[0,s**2//2,0] for i in range(10000):m(2) print(d[2]) a=b d=[0,s**2//2,0] for i in range(10000000):m(1) print(d[2])
20.666667
64
0.495392
39f190855f5caf4d836ba3e2c4a04e76b07a406d
697
java
Java
learn-04/src/main/java/com/exciter/learn04/servlet/TestServlet02.java
exciter-z/SpringBootLearn
7fc0951831772fa16ac182aaee95bb6d60b82fcc
[ "Apache-2.0" ]
null
null
null
learn-04/src/main/java/com/exciter/learn04/servlet/TestServlet02.java
exciter-z/SpringBootLearn
7fc0951831772fa16ac182aaee95bb6d60b82fcc
[ "Apache-2.0" ]
null
null
null
learn-04/src/main/java/com/exciter/learn04/servlet/TestServlet02.java
exciter-z/SpringBootLearn
7fc0951831772fa16ac182aaee95bb6d60b82fcc
[ "Apache-2.0" ]
null
null
null
package com.exciter.learn04.servlet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @WebServlet(urlPatterns = "/test/02") public class TestServlet02 extends HttpServlet { private final Logger logger = LoggerFactory.getLogger(getClass()); @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { logger.info("[doGet][uri:{}]",req.getRequestURI()); } }
29.041667
113
0.784792
121c2af539b4d0a5e1acaa60aac7fbb476c372b7
4,221
kt
Kotlin
server/src/main/java/com/krillsson/sysapi/graphql/domain/Monitor.kt
Krillsson/sys-api
478327340aa91593afaaae1242add9dd9ddf5e20
[ "Apache-2.0" ]
25
2016-02-13T20:31:49.000Z
2018-02-09T06:41:55.000Z
server/src/main/java/com/krillsson/sysapi/graphql/domain/Monitor.kt
Krillsson/sys-api
478327340aa91593afaaae1242add9dd9ddf5e20
[ "Apache-2.0" ]
13
2015-08-05T09:13:04.000Z
2018-02-10T13:51:24.000Z
server/src/main/java/com/krillsson/sysapi/graphql/domain/Monitor.kt
Krillsson/sys-api
478327340aa91593afaaae1242add9dd9ddf5e20
[ "Apache-2.0" ]
null
null
null
package com.krillsson.sysapi.graphql.domain import com.krillsson.sysapi.core.domain.monitor.MonitoredValue import com.krillsson.sysapi.core.monitoring.monitors.* import java.time.OffsetDateTime import java.util.* interface MonitoredValue data class NumericalValue(val number: Long) : com.krillsson.sysapi.graphql.domain.MonitoredValue data class FractionalValue(val fraction: Float) : com.krillsson.sysapi.graphql.domain.MonitoredValue data class ConditionalValue(val condition: Boolean) : com.krillsson.sysapi.graphql.domain.MonitoredValue data class MonitoredValueHistoryEntry( val date: OffsetDateTime, val value: com.krillsson.sysapi.graphql.domain.MonitoredValue ) data class Monitor( val id: UUID, val inertiaInSeconds: Int, val monitoredItemId: String?, val threshold: com.krillsson.sysapi.graphql.domain.MonitoredValue, val type: com.krillsson.sysapi.core.monitoring.Monitor.Type ) fun com.krillsson.sysapi.core.monitoring.Monitor<MonitoredValue>.asMonitor(): Monitor { return Monitor( id, config.inertia.seconds.toInt(), config.monitoredItemId, config.threshold.asMonitoredValue(), type ) } fun MonitoredValue.asMonitoredValue(): com.krillsson.sysapi.graphql.domain.MonitoredValue { return when(this) { is MonitoredValue.ConditionalValue -> ConditionalValue(value) is MonitoredValue.FractionalValue -> FractionalValue(value) is MonitoredValue.NumericalValue -> NumericalValue(value) } } object Selectors { fun forConditionalMonitorType(type: com.krillsson.sysapi.core.monitoring.Monitor.Type): ConditionalValueSelector = when (type) { com.krillsson.sysapi.core.monitoring.Monitor.Type.NETWORK_UP -> NetworkUpMonitor.selector com.krillsson.sysapi.core.monitoring.Monitor.Type.PROCESS_EXISTS -> ProcessExistsMonitor.selector com.krillsson.sysapi.core.monitoring.Monitor.Type.CONNECTIVITY -> ConnectivityMonitor.selector com.krillsson.sysapi.core.monitoring.Monitor.Type.EXTERNAL_IP_CHANGED -> ExternalIpChangedMonitor.selector com.krillsson.sysapi.core.monitoring.Monitor.Type.CONTAINER_RUNNING -> throw IllegalArgumentException("Use forContainerConditionalMonitor() method") else -> throw IllegalArgumentException("$type is a ${type.valueType} type") } fun forNumericalMonitorType(type: com.krillsson.sysapi.core.monitoring.Monitor.Type): NumericalValueSelector = when (type) { com.krillsson.sysapi.core.monitoring.Monitor.Type.CPU_TEMP -> CpuTemperatureMonitor.selector com.krillsson.sysapi.core.monitoring.Monitor.Type.DRIVE_SPACE -> DriveSpaceMonitor.selector com.krillsson.sysapi.core.monitoring.Monitor.Type.DRIVE_READ_RATE -> DriveReadRateMonitor.selector com.krillsson.sysapi.core.monitoring.Monitor.Type.DRIVE_WRITE_RATE -> DriveWriteRateMonitor.selector com.krillsson.sysapi.core.monitoring.Monitor.Type.MEMORY_SPACE -> MemorySpaceMonitor.selector com.krillsson.sysapi.core.monitoring.Monitor.Type.NETWORK_UPLOAD_RATE -> NetworkUploadRateMonitor.selector com.krillsson.sysapi.core.monitoring.Monitor.Type.NETWORK_DOWNLOAD_RATE -> NetworkDownloadRateMonitor.selector com.krillsson.sysapi.core.monitoring.Monitor.Type.PROCESS_MEMORY_SPACE -> ProcessMemoryMonitor.selector else -> throw IllegalArgumentException("$type is a ${type.valueType} type") } fun forFractionalMonitorType(type: com.krillsson.sysapi.core.monitoring.Monitor.Type): FractionalValueSelector = when (type) { com.krillsson.sysapi.core.monitoring.Monitor.Type.CPU_LOAD -> CpuMonitor.selector com.krillsson.sysapi.core.monitoring.Monitor.Type.PROCESS_CPU_LOAD -> ProcessCpuMonitor.selector else -> throw IllegalArgumentException("$type is a ${type.valueType} type") } fun forContainerConditionalMonitor(type: com.krillsson.sysapi.core.monitoring.Monitor.Type): ContainerConditionalValueSelector = when (type) { com.krillsson.sysapi.core.monitoring.Monitor.Type.CONTAINER_RUNNING -> DockerContainerRunningMonitor.selector else -> throw IllegalArgumentException("Use forConditionalMonitorType() method") } }
51.47561
156
0.772566
ddf05b7233fcceef169134aef3e0b8b5de458387
1,996
swift
Swift
BadJokes/App Flow/Joke/UI/WaitingForFirstJokeDetailViewController.swift
balazs630/Jokes
1505c4ab3b43a22590b3346272aa8e4baeb0c514
[ "Apache-2.0" ]
1
2019-01-12T23:47:04.000Z
2019-01-12T23:47:04.000Z
BadJokes/App Flow/Joke/UI/WaitingForFirstJokeDetailViewController.swift
balazs630/Jokes
1505c4ab3b43a22590b3346272aa8e4baeb0c514
[ "Apache-2.0" ]
null
null
null
BadJokes/App Flow/Joke/UI/WaitingForFirstJokeDetailViewController.swift
balazs630/Jokes
1505c4ab3b43a22590b3346272aa8e4baeb0c514
[ "Apache-2.0" ]
1
2018-06-06T00:41:58.000Z
2018-06-06T00:41:58.000Z
// // WaitingForFirstJokeDetailViewController.swift // BadJokes // // Created by Balázs Horváth on 2020. 11. 06.. // Copyright © 2020. Horváth Balázs. All rights reserved. // import UIKit class WaitingForFirstJokeDetailViewController: UIViewController { // MARK: Outlets @IBOutlet private weak var notificationReminderContainerView: UIView! @IBOutlet private weak var notificationReminderLabel: UILabel! // MARK: View lifecycle override func viewDidLoad() { super.viewDidLoad() setupNotificationReminder() } override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { super.traitCollectionDidChange(previousTraitCollection) setupNotificationReminder() } // MARK: - Setup appearance private func setupNotificationReminder() { notificationReminderContainerView.layer.cornerRadius = 20 notificationReminderLabel.attributedText = { var boldFont: UIFont! if #available(iOS 11.0, *) { boldFont = UIFontMetrics(forTextStyle: .body).scaledFont(for: .boldSystemFont(ofSize: 17)) } else { boldFont = .boldSystemFont(ofSize: 17) } let tipTextAttributes = [NSAttributedString.Key.font: boldFont!] let boldTipText = NSMutableAttributedString( string: "Tipp: ", attributes: tipTextAttributes ) let descriptionTextAttributes = [NSAttributedString.Key.font: UIFont.preferredFont(forTextStyle: .body)] let descriptionText = NSAttributedString( string: "Hagyd bekapcsolva az értesítéseket, hogy a viccek célba érjenek!", attributes: descriptionTextAttributes ) boldTipText.append(descriptionText) return boldTipText }() } // MARK: Actions @IBAction func closeButtonTap(_ sender: Any) { dismiss(animated: true) } }
33.830508
116
0.655311
95af7c51eb679c6681426f66a3b656121a1b1aa8
1,276
swift
Swift
Sources/SexpyJSON/Functions/Divide.swift
juri/SexpyJSON
73d9bfb99f38a2d804d6eaf1961185607a2d0a01
[ "MIT" ]
null
null
null
Sources/SexpyJSON/Functions/Divide.swift
juri/SexpyJSON
73d9bfb99f38a2d804d6eaf1961185607a2d0a01
[ "MIT" ]
null
null
null
Sources/SexpyJSON/Functions/Divide.swift
juri/SexpyJSON
73d9bfb99f38a2d804d6eaf1961185607a2d0a01
[ "MIT" ]
1
2021-09-29T10:21:17.000Z
2021-09-29T10:21:17.000Z
/* fundoc name / */ /* fundoc example (/ 12.0 -13.0 14.0) */ /* fundoc expect -0.06593407 */ /* fundoc example (/ 25 2) */ /* fundoc expect 12 */ /* fundoc text `/` is the division operator. It operates on integers or doubles. It converts integers to doubles if it receives both as arguments. It performs integer division when operating on integers, discarding the fraction part. */ private func dividef(_ values: [IntermediateValue]) throws -> IntermediateValue { guard let numbers = IntermediateValue.numbers(from: values) else { throw EvaluatorError.badFunctionParameters(values, "Divide requires numbers") } switch numbers { case let .integers(array): guard let first = array.first else { return .integer(0) } let result = try array.dropFirst().reduce(first) { total, num in guard num != 0 else { throw EvaluatorError.divisionByZero(total) } return total / num } return .integer(result) case let .doubles(array): guard let first = array.first else { return .double(0) } return .double(array.dropFirst().reduce(first, /)) } } extension Callable { static let divideFunction = Callable.functionVarargs(FunctionVarargs(noContext: dividef(_:))) }
26.040816
102
0.666928
91674f1f4e3d1907145ac66d93f7ac6c88479d64
2,438
html
HTML
src/app/shared/triggerslist/triggerslist.component.html
somervda/ourLora
8ee21a3eefd13464ad5063174a7a7cab57229e0d
[ "MIT" ]
1
2021-07-11T23:02:37.000Z
2021-07-11T23:02:37.000Z
src/app/shared/triggerslist/triggerslist.component.html
somervda/ourBoatMonitor
1896d271d09355d1a74a0e2ac10864a12e0f6d8a
[ "MIT" ]
4
2021-10-06T22:27:25.000Z
2022-02-24T20:06:40.000Z
src/app/shared/triggerslist/triggerslist.component.html
somervda/ourBoatMonitor
1896d271d09355d1a74a0e2ac10864a12e0f6d8a
[ "MIT" ]
null
null
null
<mat-card> <ng-container *ngIf="!disabled"> <div> <span class="prompt">Triggers</span> <button mat-raised-button [routerLink]="'/application/' + application.id + '/trigger/create'" style="float: right; margin-bottom: 10px; width: 200px" > <i class="material-icons-outlined">add</i>&nbsp; <span>Create a New Trigger</span> </button> <br /> </div> </ng-container> <table mat-table [dataSource]="triggers$ | async" class="mat-elevation-z8"> <ng-container matColumnDef="name"> <th mat-header-cell *matHeaderCellDef>Name</th> <td mat-cell *matCellDef="let trigger"> <ng-container *ngIf="!disabled"> <a [routerLink]=" '/application/' + application.id + '/trigger/' + trigger.id " [matTooltip]=" trigger.active ? 'Update Trigger' : 'Update Trigger : Inactive' " >{{ trigger.name }}</a > </ng-container> <ng-container *ngIf="disabled"> {{ trigger.name }} </ng-container> </td> </ng-container> <ng-container matColumnDef="description"> <th mat-header-cell *matHeaderCellDef>Description</th> <td mat-cell *matCellDef="let trigger" [class.inactive]="!trigger.active"> {{ trigger.description | truncate: 40 }} </td> </ng-container> <ng-container matColumnDef="triggerAction"> <th mat-header-cell *matHeaderCellDef>Action</th> <td mat-cell *matCellDef="let trigger" [class.inactive]="!trigger.active"> {{ getTriggerActionInfoItem(trigger.triggerAction).nameShort }} </td> </ng-container> <ng-container matColumnDef="id"> <th mat-header-cell *matHeaderCellDef></th> <td mat-cell class="deleteRow" *matCellDef="let trigger" [style.display]="disabled ? 'none' : ''" > <button mat-button [routerLink]=" '/application/' + application.id + '/trigger/' + trigger.id + '/delete' " matTooltip="Delete Trigger" > <mat-icon>clear</mat-icon> </button> </td> </ng-container> <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr> <tr mat-row *matRowDef="let row; columns: displayedColumns"></tr> </table> </mat-card>
30.475
80
0.551682
968d88e6d097bc244423f55fa3c64cfa92fba873
927
html
HTML
index.html
albertocc/Give-Me-A-GIF
a7a3f6adb8c354255ca920add5e80c83ca0b48c5
[ "MIT" ]
null
null
null
index.html
albertocc/Give-Me-A-GIF
a7a3f6adb8c354255ca920add5e80c83ca0b48c5
[ "MIT" ]
null
null
null
index.html
albertocc/Give-Me-A-GIF
a7a3f6adb8c354255ca920add5e80c83ca0b48c5
[ "MIT" ]
null
null
null
<!DOCTYPE html> <html lang="en"> <head> <meta name="viewport" content="width=device-width"> <title>Give me a GIF!</title> <link rel="stylesheet" type="text/css" href="css/style.css" /> </head> <body> <main><span class="loading">Loading...</span></main> <footer> <a href="#" class="arrow left" title="Previous"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"> <path d="M7.8 13l4.428 4.428-1.4 1.4L4 12l6.828-6.828 1.4 1.4L7.8 11H20v2z" /> </svg> </a> <span class="pagination"></span> <a href="#" class="arrow right" title="Next"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"> <path d="M16.2 13l-4.428 4.428 1.4 1.4L20 12l-6.828-6.828-1.4 1.4L16.2 11H4v2z" /> </svg> </a> </footer> </body> <script src="js/script.js"></script> </html>
30.9
85
0.533981
38cb77d588faeab1fa663b7a4704117e051c9563
1,152
swift
Swift
Codesigner/Home/TabBar.swift
ts666823/Codesigner
6a54d39469204b2f47bd4d33b37e5ca669c4e059
[ "MIT" ]
44
2021-12-10T11:04:45.000Z
2022-02-27T02:50:33.000Z
Codesigner/Home/TabBar.swift
ts666823/Codesigner
6a54d39469204b2f47bd4d33b37e5ca669c4e059
[ "MIT" ]
3
2021-12-11T10:14:31.000Z
2021-12-31T06:46:39.000Z
Codesigner/Home/TabBar.swift
ts666823/Codesigner
6a54d39469204b2f47bd4d33b37e5ca669c4e059
[ "MIT" ]
null
null
null
// // TabBar.swift // SwiftUIDemo // // Created by LEE on 2019/10/19. // Copyright © 2019 Lee. All rights reserved. // import SwiftUI @available(iOS 15.0, *) struct TabBar: View { @State var selectedView = 1 init() { UITabBar.appearance().backgroundColor = UIColor.white } var body: some View { TabView(selection: $selectedView) { Home() .tabItem { Image(systemName:"house.fill") Text("Home") } .tag(1) SocialContentView() .tabItem { Image(systemName: "person.and.person") Text("Certificates") } .tag(2) } .accentColor(Color.init(red: 66/255, green: 67/255, blue: 194/255)) .edgesIgnoringSafeArea(.top) } } @available(iOS 15.0, *) struct TabBar_Previews: PreviewProvider { static var previews: some View { TabBar() .previewInterfaceOrientation(.landscapeLeft) // .environment(\.colorScheme, .dark) // .environment(\.sizeCategory, .extraExtraLarge) } }
23.510204
75
0.532118
41e13a235d03bc37f83d18f5a7387d09d299030a
196
h
C
RichText/RichText/RichLabel.h
bimeteor/RichText
096480f59ec82f30fbaf804fd81f8acfa0e54e55
[ "MIT" ]
null
null
null
RichText/RichText/RichLabel.h
bimeteor/RichText
096480f59ec82f30fbaf804fd81f8acfa0e54e55
[ "MIT" ]
null
null
null
RichText/RichText/RichLabel.h
bimeteor/RichText
096480f59ec82f30fbaf804fd81f8acfa0e54e55
[ "MIT" ]
null
null
null
// // RichLabel.h // RichText // // Created by WG on 15/11/22. // Copyright © 2015年 frank. All rights reserved. // #import "RichTextViewBase.h" @interface RichLabel : RichTextViewBase @end
14
49
0.678571
9c0066974682b4265c3558d74a6121d808b3f721
34
tsx
TypeScript
components/ui/Graph/index.tsx
martinenzinger/pipeline
219386b38912330a3f494f472870d60fbb10e3f2
[ "MIT" ]
null
null
null
components/ui/Graph/index.tsx
martinenzinger/pipeline
219386b38912330a3f494f472870d60fbb10e3f2
[ "MIT" ]
null
null
null
components/ui/Graph/index.tsx
martinenzinger/pipeline
219386b38912330a3f494f472870d60fbb10e3f2
[ "MIT" ]
null
null
null
export { default } from './Graph';
34
34
0.647059
83e8bfa11f8797082f3607b9bf4bf4eb8673aed3
1,758
sql
SQL
sql/_17_sql_extension2/_02_full_test/_05_date_time_function/_08_second/cases/second_007.sql
Zhaojia2019/cubrid-testcases
475a828e4d7cf74aaf2611fcf791a6028ddd107d
[ "BSD-3-Clause" ]
9
2016-03-24T09:51:52.000Z
2022-03-23T10:49:47.000Z
sql/_17_sql_extension2/_02_full_test/_05_date_time_function/_08_second/cases/second_007.sql
Zhaojia2019/cubrid-testcases
475a828e4d7cf74aaf2611fcf791a6028ddd107d
[ "BSD-3-Clause" ]
173
2016-04-13T01:16:54.000Z
2022-03-16T07:50:58.000Z
sql/_17_sql_extension2/_02_full_test/_05_date_time_function/_08_second/cases/second_007.sql
Zhaojia2019/cubrid-testcases
475a828e4d7cf74aaf2611fcf791a6028ddd107d
[ "BSD-3-Clause" ]
38
2016-03-24T17:10:31.000Z
2021-10-30T22:55:45.000Z
--pass out-of-range data of time/timestamp/datetime type to the parameter --1. [error] out-of-range argument: time type select second(time'24:00:00'); select second(time'25:30:59 pm'); select second(time'4:71:45 am'); select second(time'13:24:88'); select second(time'09:345 pm'); select second(time'100:59 am'); --2. [error] out-of-range argument: timestamp type select second(timestamp'23:00:00 13/01'); select second(timestamp'04:14:07 1/19/2038'); select second(timestamp'03:15:07 1/19/2038'); select second(timestamp'03:14:08 1/19/2038'); select second(timestamp'03:14:07 2/19/2038'); select second(timestamp'03:14:07 1/20/2038'); select second(timestamp'03:14:07 1/19/2039'); --?? select second(timestamp'03:14:07 PM 1/19/2038'); select second(timestamp'0:0:0 PM 1969-01-01'); select second(timestamp'11:03:22 PM 1864-01-23'); select second(timestamp'2300-12-12 22:02:33'); select second(timestamp'2020-23-11 03:14:66 pm'); select second(timestamp'1970-10-101 0:0'); select second(timestamp'1999/12/11 3:14:7 am'); select second(timestamp'2010-4-31 3:14:7 am'); --3. [error] out-of-range argument: datetime type select second(datetime'2010-10 10:10:100.00 am'); select second(datetime'24:59:59.999 12/31/9999'); select second(datetime'23:60:59.999 12/31/9999'); select second(datetime'23:59:60.999 12/31/9999'); select second(datetime'23:59:59.1000 12/31/9999'); select second(datetime'23:59:59.999 13/31/9999'); select second(datetime'23:59:59.999 12/32/9999'); select second(datetime'23:59:59.999 12/31/10000'); select second(datetime'20:33:61.111 1990-10-19 '); select second(datetime'2/31/2022 10:20:30.400'); select second(datetime'12/31/9999 23:59:59.999'); select second(datetime'0-12-12 23:59:59:999');
22.253165
73
0.715586
0ecced1b6b0b79481cf8e6fb9f7f7c83ae373756
4,983
ts
TypeScript
node_modules/@slack/client/dist/util.d.ts
JoKraken/slackbot
7fbb285c45481fc447505b516105762006b4de20
[ "MIT" ]
null
null
null
node_modules/@slack/client/dist/util.d.ts
JoKraken/slackbot
7fbb285c45481fc447505b516105762006b4de20
[ "MIT" ]
null
null
null
node_modules/@slack/client/dist/util.d.ts
JoKraken/slackbot
7fbb285c45481fc447505b516105762006b4de20
[ "MIT" ]
null
null
null
/// <reference types="node" /> import { Agent } from 'http'; /** * For when you need a function that does nothing */ export declare function noop(): void; /** * Appends the app metadata into the User-Agent value * @param appMetadata.name name of tool to be counted in instrumentation * @param appMetadata.version version of tool to be counted in instrumentation */ export declare function addAppMetadata({ name, version }: { name: string; version: string; }): void; /** * Returns the current User-Agent value for instrumentation */ export declare function getUserAgent(): string; /** * Build a Promise that will resolve after the specified number of milliseconds. * @param ms milliseconds to wait * @param value value for eventual resolution */ export declare function delay<T>(ms: number, value?: T): Promise<T>; /** * Reduce an asynchronous iterable into a single value. * @param iterable the async iterable to be reduced * @param callbackfn a function that implements one step of the reduction * @param initialValue the initial value for the accumulator */ export declare function awaitAndReduce<T, U>(iterable: AsyncIterable<T>, callbackfn: (previousValue: U, currentValue: T) => U, initialValue: U): Promise<U>; /** * Instead of depending on the util.callbackify type in the `@types/node` package, we're copying the type defintion * of that function into an interface here. This needs to be manually updated if the type definition in that package * changes. */ interface Callbackify { (fn: () => Promise<void>): (callback: (err: NodeJS.ErrnoException) => void) => void; <TResult>(fn: () => Promise<TResult>): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; <T1, TResult>(fn: (arg1: T1) => Promise<TResult>): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; <T1, T2>(fn: (arg1: T1, arg2: T2) => Promise<void>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void; <T1, T2, TResult>(fn: (arg1: T1, arg2: T2) => Promise<TResult>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; <T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void; <T1, T2, T3, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; <T1, T2, T3, T4>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void; <T1, T2, T3, T4, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; <T1, T2, T3, T4, T5>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void; <T1, T2, T3, T4, T5, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; <T1, T2, T3, T4, T5, T6>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void; <T1, T2, T3, T4, T5, T6, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; } /** * The following is a polyfill of Node >= 8.2.0's util.callbackify method. The source is copied (with some * modification) from: * https://github.com/nodejs/node/blob/bff5d5b8f0c462880ef63a396d8912d5188bbd31/lib/util.js#L1095-L1140 * The modified parts are denoted using comments starting with `original` and ending with `modified` * This could really be made an independent module. It was suggested here: https://github.com/js-n/callbackify/issues/5 */ export declare const callbackify: Callbackify; export declare type AgentOption = Agent | { http?: Agent; https?: Agent; } | boolean; export interface TLSOptions { pfx?: string | Buffer | Array<string | Buffer | Object>; key?: string | Buffer | Array<Buffer | Object>; passphrase?: string; cert?: string | Buffer | Array<string | Buffer>; ca?: string | Buffer | Array<string | Buffer>; } /** * Returns an agent (or false or undefined) for the specific scheme and option passed in * @param scheme either 'http' or 'https' */ export declare function agentForScheme(scheme: string, agentOption?: AgentOption): Agent | boolean | undefined; export {};
63.884615
259
0.673691
121ffa84d2825d098ed09c9e1ceaf9232f0f68e9
3,058
sql
SQL
database/schema.sql
kohkimakimoto/pingcrm-echo
ddf61ba7e5160dca18a9ee2fb62c350de37892bb
[ "MIT" ]
1
2022-02-14T09:27:10.000Z
2022-02-14T09:27:10.000Z
database/schema.sql
kohkimakimoto/pingcrm-echo
ddf61ba7e5160dca18a9ee2fb62c350de37892bb
[ "MIT" ]
null
null
null
database/schema.sql
kohkimakimoto/pingcrm-echo
ddf61ba7e5160dca18a9ee2fb62c350de37892bb
[ "MIT" ]
null
null
null
CREATE TABLE IF NOT EXISTS "personal_access_tokens" ( "id" integer NOT NULL, "tokenable_type" varchar NOT NULL, "tokenable_id" integer NOT NULL, "name" varchar NOT NULL, "token" varchar NOT NULL, "abilities" text, "last_used_at" datetime, "created_at" datetime, "updated_at" datetime, PRIMARY KEY("id" AUTOINCREMENT) ); CREATE TABLE IF NOT EXISTS "password_resets" ( "email" varchar NOT NULL, "token" varchar NOT NULL, "created_at" datetime ); CREATE TABLE IF NOT EXISTS "failed_jobs" ( "id" integer NOT NULL, "uuid" varchar NOT NULL, "connection" text NOT NULL, "queue" text NOT NULL, "payload" text NOT NULL, "exception" text NOT NULL, "failed_at" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY("id" AUTOINCREMENT) ); CREATE TABLE IF NOT EXISTS "accounts" ( "id" integer NOT NULL, "name" varchar NOT NULL, "created_at" datetime, "updated_at" datetime, PRIMARY KEY("id" AUTOINCREMENT) ); CREATE TABLE IF NOT EXISTS "users" ( "id" integer NOT NULL, "account_id" integer NOT NULL, "first_name" varchar NOT NULL, "last_name" varchar NOT NULL, "email" varchar NOT NULL, "email_verified_at" datetime, "password" varchar, "owner" tinyint(1) NOT NULL DEFAULT '0', "photo_path" varchar, "remember_token" varchar, "created_at" datetime, "updated_at" datetime, "deleted_at" datetime, PRIMARY KEY("id" AUTOINCREMENT) ); CREATE TABLE IF NOT EXISTS "organizations" ( "id" integer NOT NULL, "account_id" integer NOT NULL, "name" varchar NOT NULL, "email" varchar, "phone" varchar, "address" varchar, "city" varchar, "region" varchar, "country" varchar, "postal_code" varchar, "created_at" datetime, "updated_at" datetime, "deleted_at" datetime, PRIMARY KEY("id" AUTOINCREMENT) ); CREATE TABLE IF NOT EXISTS "contacts" ( "id" integer NOT NULL, "account_id" integer NOT NULL, "organization_id" integer, "first_name" varchar NOT NULL, "last_name" varchar NOT NULL, "email" varchar, "phone" varchar, "address" varchar, "city" varchar, "region" varchar, "country" varchar, "postal_code" varchar, "created_at" datetime, "updated_at" datetime, "deleted_at" datetime, PRIMARY KEY("id" AUTOINCREMENT) ); CREATE INDEX IF NOT EXISTS "personal_access_tokens_tokenable_type_tokenable_id_index" ON "personal_access_tokens" ( "tokenable_type", "tokenable_id" ); CREATE UNIQUE INDEX IF NOT EXISTS "personal_access_tokens_token_unique" ON "personal_access_tokens" ( "token" ); CREATE INDEX IF NOT EXISTS "password_resets_email_index" ON "password_resets" ( "email" ); CREATE UNIQUE INDEX IF NOT EXISTS "failed_jobs_uuid_unique" ON "failed_jobs" ( "uuid" ); CREATE INDEX IF NOT EXISTS "users_account_id_index" ON "users" ( "account_id" ); CREATE UNIQUE INDEX IF NOT EXISTS "users_email_unique" ON "users" ( "email" ); CREATE INDEX IF NOT EXISTS "organizations_account_id_index" ON "organizations" ( "account_id" ); CREATE INDEX IF NOT EXISTS "contacts_account_id_index" ON "contacts" ( "account_id" ); CREATE INDEX IF NOT EXISTS "contacts_organization_id_index" ON "contacts" ( "organization_id" );
27.061947
115
0.743296
dbdc35b2e1584a6d2cd9dd58a8fc17b0b300b3e9
891
swift
Swift
Demo/Demo/Details/ObliquenessViewController.swift
GYQ6/AttributedString
db895f4e1e69a4df3c387842446f6a5f340bc90b
[ "MIT" ]
528
2019-11-19T06:20:07.000Z
2022-03-27T03:14:56.000Z
Demo/Demo/Details/ObliquenessViewController.swift
GYQ6/AttributedString
db895f4e1e69a4df3c387842446f6a5f340bc90b
[ "MIT" ]
41
2019-12-10T09:35:37.000Z
2022-03-25T07:12:32.000Z
Demo/Demo/Details/ObliquenessViewController.swift
GYQ6/AttributedString
db895f4e1e69a4df3c387842446f6a5f340bc90b
[ "MIT" ]
53
2019-11-20T12:38:13.000Z
2022-03-23T03:38:35.000Z
// // ObliquenessViewController.swift // Demo // // Created by Lee on 2019/11/19. // Copyright © 2019 LEE. All rights reserved. // import UIKit class ObliquenessViewController: UIViewController { @IBOutlet weak var textView: UITextView! override func viewDidLoad() { super.viewDidLoad() textView.attributed.text = """ obliqueness: none \("obliqueness: 0.1", .obliqueness(0.1)) \("obliqueness: 0.3", .obliqueness(0.3)) \("obliqueness: 0.5", .obliqueness(0.5)) \("obliqueness: 1.0", .obliqueness(1.0)) \("obliqueness: -0.1", .obliqueness(-0.1)) \("obliqueness: -0.3", .obliqueness(-0.3)) \("obliqueness: -0.5", .obliqueness(-0.5)) \("obliqueness: -1.0", .obliqueness(-1.0)) """ } }
21.731707
51
0.519641
715b36b6ca1821ae68378998021585d545f2ea7d
129
ts
TypeScript
src/public-api.ts
ngx-tc/form-group
7cfd6b6593ccf3bc158ef3019ea22c7ab8db90fd
[ "MIT" ]
null
null
null
src/public-api.ts
ngx-tc/form-group
7cfd6b6593ccf3bc158ef3019ea22c7ab8db90fd
[ "MIT" ]
null
null
null
src/public-api.ts
ngx-tc/form-group
7cfd6b6593ccf3bc158ef3019ea22c7ab8db90fd
[ "MIT" ]
null
null
null
/* * Public API Surface of form-group */ export * from './lib/form-group.component'; export * from './lib/form-group.module';
18.428571
43
0.666667
9c225ea5e129de29714da80555dad2d585b25e5b
2,106
js
JavaScript
app/navigation/MainTabNavigator.js
IveanZhang/uuwill
31af031011fc5195f14b2915c3863668db8c1ee1
[ "MIT" ]
null
null
null
app/navigation/MainTabNavigator.js
IveanZhang/uuwill
31af031011fc5195f14b2915c3863668db8c1ee1
[ "MIT" ]
2
2020-09-04T16:55:23.000Z
2021-05-07T04:00:06.000Z
app/navigation/MainTabNavigator.js
IveanZhang/uuwill
31af031011fc5195f14b2915c3863668db8c1ee1
[ "MIT" ]
null
null
null
import React from 'react'; import { Platform } from 'react-native'; import { createStackNavigator, createBottomTabNavigator } from 'react-navigation'; import TabBarIcon from '../components/TabBarIcon'; import SettingScreen from '../screens/setting/SettingScreen'; import HomeScreen from '../screens/home/HomeScreen'; import RecommendScreen from '../screens/recommendArticle/RecommendScreen'; import ServiceScreen from '../screens/services/ServiceScreen'; import ProjectScreen from '../screens/projects/ProjectScreen' import DetailsScreen from '../screens/details/DetailsScreen'; import TopicsScreen from '../screens/topics/TopicsScreen'; import ProductDetailScreen from '../screens/productDetailScreen/ProductDetailScreen'; const HomeStack = createStackNavigator({ Home: HomeScreen, Service: ServiceScreen, Projects: ProjectScreen, Details: DetailsScreen, Topics: TopicsScreen, ProductDetail: ProductDetailScreen }); HomeStack.navigationOptions = { tabBarLabel: '首页', tabBarIcon: ({ focused }) => ( <TabBarIcon focused={focused} name={ Platform.OS === 'ios' ? `ios-home` : `md-home` } /> ), }; const RecommendStack = createStackNavigator({ Links: RecommendScreen, Details: DetailsScreen }); RecommendStack.navigationOptions = { tabBarLabel: '推荐', tabBarIcon: ({ focused }) => ( <TabBarIcon focused={focused} name={Platform.OS === 'ios' ? 'ios-information-circle-outline' : 'md-information-circle-outline'} /> ), }; const SettingStack = createStackNavigator({ Setting: SettingScreen, }); SettingStack.navigationOptions = { tabBarLabel: '特惠', tabBarIcon: ({ focused }) => ( <TabBarIcon focused={focused} name={ Platform.OS === 'ios' ? `ios-heart` : `md-heart` } /> ), }; export default createBottomTabNavigator({ HomeStack, RecommendStack, SettingStack, });
28.08
109
0.632479
143670d49b7041e941d4a5c1c8c2b6086aa55fff
116
sql
SQL
login.sql
ExplorerUK/Capture-Page-Session-State-Plugin
1d5ac539a28ad845753fdb59b862558a92bde7ff
[ "MIT" ]
null
null
null
login.sql
ExplorerUK/Capture-Page-Session-State-Plugin
1d5ac539a28ad845753fdb59b862558a92bde7ff
[ "MIT" ]
null
null
null
login.sql
ExplorerUK/Capture-Page-Session-State-Plugin
1d5ac539a28ad845753fdb59b862558a92bde7ff
[ "MIT" ]
null
null
null
-- enable compiler warnings --alter session set plsql_warnings = 'enable:all'; set define off; set serveroutput on;
29
50
0.767241
f140a45304ff4c31f3072e9252dd87dbb64175f1
9,395
rb
Ruby
vendor/plugins/newrelic_rpm/test/newrelic/agent/tc_transaction_sampler.rb
blogmitnik/rails2_code
2392486677fc9828f41f41eac8ba85f81f13fd94
[ "MIT" ]
2
2016-05-08T16:05:20.000Z
2019-06-12T20:19:42.000Z
vendor/plugins/newrelic_rpm/test/newrelic/agent/tc_transaction_sampler.rb
blogmitnik/rails2_code
2392486677fc9828f41f41eac8ba85f81f13fd94
[ "MIT" ]
null
null
null
vendor/plugins/newrelic_rpm/test/newrelic/agent/tc_transaction_sampler.rb
blogmitnik/rails2_code
2392486677fc9828f41f41eac8ba85f81f13fd94
[ "MIT" ]
null
null
null
require 'newrelic/agent/transaction_sampler' require 'test/unit' ::RPM_DEVELOPER = true unless defined? ::RPM_DEVELOPER module NewRelic module Agent class TransactionSampler public :with_builder end class TransationSamplerTests < Test::Unit::TestCase def test_multiple_samples @sampler = TransactionSampler.new(Agent.instance) run_sample_trace run_sample_trace run_sample_trace run_sample_trace samples = @sampler.get_samples assert_equal 4, samples.length assert_equal "a", samples.first.root_segment.called_segments[0].metric_name assert_equal "a", samples.last.root_segment.called_segments[0].metric_name end def test_harvest_slowest @sampler = TransactionSampler.new(Agent.instance) run_sample_trace run_sample_trace run_sample_trace { sleep 0.5 } run_sample_trace run_sample_trace slowest = @sampler.harvest_slowest_sample(nil) assert slowest.duration >= 0.5 run_sample_trace { sleep 0.2 } not_as_slow = @sampler.harvest_slowest_sample(slowest) assert not_as_slow == slowest run_sample_trace { sleep 0.6 } new_slowest = @sampler.harvest_slowest_sample(slowest) assert new_slowest != slowest assert new_slowest.duration >= 0.6 end def test_preare_to_send @sampler = TransactionSampler.new(Agent.instance) run_sample_trace { sleep 0.2 } sample = @sampler.harvest_slowest_sample(nil) ready_to_send = sample.prepare_to_send assert sample.duration == ready_to_send.duration end def test_multithread @sampler = TransactionSampler.new(Agent.instance) threads = [] 20.times do t = Thread.new(@sampler) do |the_sampler| @sampler = the_sampler 100.times do run_sample_trace { sleep 0.01 } end end threads << t end threads.each {|t| t.join } end def test_sample_with_parallel_paths @sampler = TransactionSampler.new(Agent.instance) assert_equal 0, @sampler.scope_depth @sampler.notice_first_scope_push @sampler.notice_transaction "/path", nil, {} @sampler.notice_push_scope "a" assert_equal 1, @sampler.scope_depth @sampler.notice_pop_scope "a" @sampler.notice_scope_empty assert_equal 0, @sampler.scope_depth @sampler.notice_first_scope_push @sampler.notice_transaction "/path", nil, {} @sampler.notice_push_scope "a" @sampler.notice_pop_scope "a" @sampler.notice_scope_empty end def test_double_scope_stack_empty @sampler = TransactionSampler.new(Agent.instance) @sampler.notice_first_scope_push @sampler.notice_transaction "/path", nil, {} @sampler.notice_push_scope "a" @sampler.notice_pop_scope "a" @sampler.notice_scope_empty @sampler.notice_scope_empty @sampler.notice_scope_empty @sampler.notice_scope_empty assert_not_nil @sampler.harvest_slowest_sample(nil) end def test_record_sql_off sampler = TransactionSampler.new(Agent.instance, :record_sql => :off) sampler.notice_first_scope_push sampler.notice_sql("test", nil) segment = nil sampler.with_builder do |builder| segment = builder.current_segment end assert_nil segment[:sql] end def test_record_sql_raw sampler = TransactionSampler.new(Agent.instance, :record_sql => :raw) sampler.notice_first_scope_push sampler.notice_sql("test", nil) segment = nil sampler.with_builder do |builder| segment = builder.current_segment end assert segment[:sql] end def test_record_sql_raw sampler = TransactionSampler.new(Agent.instance, :record_sql => :obfuscated) sampler.notice_first_scope_push sampler.notice_sql("test", nil) segment = nil sampler.with_builder do |builder| segment = builder.current_segment end assert segment[:sql] end def test_big_sql @sampler = TransactionSampler.new(Agent.instance) @sampler.notice_first_scope_push sql = "SADJKHASDHASD KAJSDH ASKDH ASKDHASDK JASHD KASJDH ASKDJHSAKDJHAS DKJHSADKJSAH DKJASHD SAKJDH SAKDJHS" len = 0 while len <= NewRelic::Agent::TransactionSampler::MAX_SQL_LENGTH @sampler.notice_sql(sql, nil) len += sql.length end segment = nil @sampler.with_builder do |builder| segment = builder.current_segment end sql = segment[:sql] assert sql.length <= NewRelic::Agent::TransactionSampler::MAX_SQL_LENGTH end def test_segment_obfuscated @sampler = TransactionSampler.new(Agent.instance) @sampler.notice_first_scope_push orig_sql = "SELECT * from Jim where id=66" @sampler.notice_sql(orig_sql, nil) segment = nil @sampler.with_builder do |builder| segment = builder.current_segment end assert_equal orig_sql, segment[:sql] assert_equal "SELECT * from Jim where id=?", segment.obfuscated_sql end def test_param_capture [true, false].each do |capture| t = TransactionSampler.new(Agent.instance) t.capture_params = capture t.notice_first_scope_push t.notice_transaction('/path', nil, {:param => 'hi'}) t.notice_scope_empty tt = t.harvest_slowest_sample assert_equal (capture) ? 1 : 0, tt.params[:request_params].length end end def test_sql_normalization t = TransactionSampler.new(Agent.instance) # basic statement assert_equal "INSERT INTO X values(?,?, ? , ?)", t.default_sql_obfuscator("INSERT INTO X values('test',0, 1 , 2)") # escaped literals assert_equal "INSERT INTO X values(?, ?,?, ? , ?)", t.default_sql_obfuscator("INSERT INTO X values('', 'jim''s ssn',0, 1 , 'jim''s son''s son')") # multiple string literals assert_equal "INSERT INTO X values(?,?,?, ? , ?)", t.default_sql_obfuscator("INSERT INTO X values('jim''s ssn','x',0, 1 , 2)") # empty string literal # NOTE: the empty string literal resolves to empty string, which for our purposes is acceptable assert_equal "INSERT INTO X values(?,?,?, ? , ?)", t.default_sql_obfuscator("INSERT INTO X values('','x',0, 1 , 2)") # try a select statement assert_equal "select * from table where name=? and ssn=?", t.default_sql_obfuscator("select * from table where name='jim gochee' and ssn=0012211223") # number literals embedded in sql - oh well assert_equal "select * from table_? where name=? and ssn=?", t.default_sql_obfuscator("select * from table_007 where name='jim gochee' and ssn=0012211223") end def test_sql_obfuscation_filters orig = NewRelic::Agent.agent.obfuscator NewRelic::Agent.set_sql_obfuscator(:replace) do |sql| sql = "1" + sql end sql = "SELECT * FROM TABLE 123 'jim'" assert_equal "1" + sql, NewRelic::Agent.instance.obfuscator.call(sql) NewRelic::Agent.set_sql_obfuscator(:before) do |sql| sql = "2" + sql end assert_equal "12" + sql, NewRelic::Agent.instance.obfuscator.call(sql) NewRelic::Agent.set_sql_obfuscator(:after) do |sql| sql = sql + "3" end assert_equal "12" + sql + "3", NewRelic::Agent.instance.obfuscator.call(sql) NewRelic::Agent.agent.set_sql_obfuscator(:replace, &orig) end private def run_sample_trace(&proc) @sampler.notice_first_scope_push @sampler.notice_transaction '/path', nil, {} @sampler.notice_push_scope "a" @sampler.notice_sql("SELECT * FROM sandwiches WHERE bread = 'wheat'", nil) @sampler.notice_push_scope "ab" @sampler.notice_sql("SELECT * FROM sandwiches WHERE bread = 'white'", nil) proc.call if proc @sampler.notice_pop_scope "ab" @sampler.notice_push_scope "lew" @sampler.notice_sql("SELECT * FROM sandwiches WHERE bread = 'french'", nil) @sampler.notice_pop_scope "lew" @sampler.notice_pop_scope "a" @sampler.notice_scope_empty end end end end
30.904605
116
0.586482
9bf5adf0371ba25acce192d4634a85078bf9f34b
607
js
JavaScript
lib/api/get_hosted_address.js
xhad/gatewayd
0a216bf6cc8ad626336d472533ad5a08a9079c86
[ "0BSD" ]
null
null
null
lib/api/get_hosted_address.js
xhad/gatewayd
0a216bf6cc8ad626336d472533ad5a08a9079c86
[ "0BSD" ]
null
null
null
lib/api/get_hosted_address.js
xhad/gatewayd
0a216bf6cc8ad626336d472533ad5a08a9079c86
[ "0BSD" ]
null
null
null
var config = require(__dirname+'/../../config/environment.js'); var RippleAddresses = require(__dirname+'/../data/').models.rippleAddresses; /**@requires config, rippleAddresses * @function getHostedAddress * * @description Returns the promise from a RippleAddresses findOrCreate using the gatewayd cold_wallet, provided tag, * type: 'hosted' and managed: true * * @param tag */ function getHostedAddress(tag) { return RippleAddresses.findOrCreate({ address: config.get('COLD_WALLET'), tag: tag, type: 'hosted', managed: true }); } module.exports = getHostedAddress;
26.391304
117
0.706755
56cd55ec55c707618c0e30c2be6525f4576fce3a
1,181
go
Go
service/server.go
petarov/query-apple-osupdates
61436bd5d158a774a559f97341a2b8ee8908ec8b
[ "MIT" ]
null
null
null
service/server.go
petarov/query-apple-osupdates
61436bd5d158a774a559f97341a2b8ee8908ec8b
[ "MIT" ]
null
null
null
service/server.go
petarov/query-apple-osupdates
61436bd5d158a774a559f97341a2b8ee8908ec8b
[ "MIT" ]
null
null
null
package service import ( "fmt" "net/http" "github.com/petarov/query-apple-firmware-updates/client" "github.com/petarov/query-apple-firmware-updates/config" "github.com/petarov/query-apple-firmware-updates/db" ) type ServerContext struct { router *http.ServeMux ipswClient *http.Client workerPool *WokerPool } func ServeNow() (err error) { ctx := new(ServerContext) ctx.router = http.NewServeMux() // ctx.router.HandleFunc("/debug/pprof/", pprof.Index) // ctx.router.HandleFunc("/debug/pprof/{action}", pprof.Index) // ctx.router.HandleFunc("/debug/pprof/symbol", pprof.Symbol) ctx.ipswClient, err = client.NewIPSWClient() if err != nil { return err } jsonDB, err := db.LoadDevices(config.DevicePath) if err != nil { return err } if err = db.InitDb(config.DbPath, jsonDB); err != nil { return err } ctx.workerPool = NewWorkPool() ctx.workerPool.Start() attachApi(ctx) attachWww(ctx) fmt.Printf("Serving at %s and port %d ...\n", config.ListenAddress, config.ListenPort) if err = http.ListenAndServe(fmt.Sprintf("%s:%d", config.ListenAddress, config.ListenPort), EnableGzip(ctx.router)); err != nil { return err } return nil }
21.472727
87
0.707028
83a1fe02d17ffa6c3decc11fb4c3de6b38358607
42
sql
SQL
migrations/sqls/20160120172122-addArchivedToMutePosts-down.sql
mywaylearning/waybook-api
b98477471004516883e5105425c2bac3c581701e
[ "MIT" ]
null
null
null
migrations/sqls/20160120172122-addArchivedToMutePosts-down.sql
mywaylearning/waybook-api
b98477471004516883e5105425c2bac3c581701e
[ "MIT" ]
null
null
null
migrations/sqls/20160120172122-addArchivedToMutePosts-down.sql
mywaylearning/waybook-api
b98477471004516883e5105425c2bac3c581701e
[ "MIT" ]
null
null
null
ALTER TABLE `MutedPosts` DROP `archived`;
21
41
0.761905
3e5b056bbafe19bd6def476fc44091e711df01ee
34,483
c
C
src/atsc3_stltp_depacketizer.c
motinev/libatsc3
61bf0035d7610219de5189e3a3443b49545b086e
[ "MIT" ]
null
null
null
src/atsc3_stltp_depacketizer.c
motinev/libatsc3
61bf0035d7610219de5189e3a3443b49545b086e
[ "MIT" ]
null
null
null
src/atsc3_stltp_depacketizer.c
motinev/libatsc3
61bf0035d7610219de5189e3a3443b49545b086e
[ "MIT" ]
null
null
null
/* * atsc3_stltp_depacketizer.c * * Created on: Aug 11, 2020 * Author: jjustman */ #include "atsc3_stltp_depacketizer.h" int _ATSC3_STLTP_DEPACKETIZER_INFO_ENABLED = 0; int _ATSC3_STLTP_DEPACKETIZER_DEBUG_ENABLED = 0; int _ATSC3_STLTP_DEPACKETIZER_TRACE_ENABLED = 0; //TODO - add SMPTE-2022.1 FEC decoding (see fork of prompeg-decoder - https://github.com/jjustman/prompeg-decoder) //#define __ATSC3_STLTP_DEPACKETIZER_PENDANTIC__ void atsc3_stltp_depacketizer_from_ip_udp_rtp_packet(atsc3_ip_udp_rtp_packet_t* ip_udp_rtp_packet, atsc3_stltp_depacketizer_context_t* atsc3_stltp_depacketizer_context) { atsc3_stltp_tunnel_packet_t* atsc3_stltp_tunnel_packet_processed = NULL; atsc3_alp_packet_collection_t* atsc3_alp_packet_collection = atsc3_stltp_depacketizer_context->atsc3_alp_packet_collection; #ifdef __ATSC3_STLTP_DEPACKETIZER_PENDANTIC__ _ATSC3_STLTP_DEPACKETIZER_WARN("ip_udp_rtp packet: %u.%u.%u.%u:%u, destination_flow_filter: %u.%u.%u.%u:%u", __toipandportnonstruct(ip_udp_rtp_packet->udp_flow.dst_ip_addr, ip_udp_rtp_packet->udp_flow.dst_port), __toipandportnonstruct(atsc3_stltp_depacketizer_context->destination_flow_filter.dst_ip_addr, atsc3_stltp_depacketizer_context->destination_flow_filter.dst_port)); #endif _ATSC3_STLTP_DEPACKETIZER_DEBUG("atsc3_stltp_depacketizer_from_ip_udp_rtp_packet: packet: %p, pcap len: %d", ip_udp_rtp_packet, ip_udp_rtp_packet->data->p_size); //dispatch for STLTP decoding and reflection if(ip_udp_rtp_packet->udp_flow.dst_ip_addr == atsc3_stltp_depacketizer_context->destination_flow_filter.dst_ip_addr && ip_udp_rtp_packet->udp_flow.dst_port == atsc3_stltp_depacketizer_context->destination_flow_filter.dst_port) { atsc3_stltp_depacketizer_context->atsc3_stltp_tunnel_packet_processed = atsc3_stltp_raw_packet_extract_inner_from_outer_packet(atsc3_stltp_depacketizer_context, ip_udp_rtp_packet, atsc3_stltp_depacketizer_context->atsc3_stltp_tunnel_packet_processed); atsc3_stltp_tunnel_packet_processed = atsc3_stltp_depacketizer_context->atsc3_stltp_tunnel_packet_processed; #ifdef __ATSC3_STLTP_DEPACKETIZER_PENDANTIC__ _ATSC3_STLTP_DEPACKETIZER_WARN("atsc3_stltp_depacketizer_from_ip_udp_rtp_packet: packet: %p, pcap len: %d, atsc3_stltp_tunnel_packet_processed: %p", ip_udp_rtp_packet, ip_udp_rtp_packet->data->p_size, atsc3_stltp_tunnel_packet_processed); #endif if(!atsc3_stltp_tunnel_packet_processed) { __ERROR("process_packet: atsc3_stltp_tunnel_packet_processed is null, error processing packet: %p, size: %u", ip_udp_rtp_packet, ip_udp_rtp_packet->data->p_size); goto cleanup; } if(atsc3_stltp_tunnel_packet_processed->atsc3_stltp_baseband_packet_v.count) { _ATSC3_STLTP_DEPACKETIZER_DEBUG(">>>stltp atsc3_stltp_baseband_packet packet complete: count: %u", atsc3_stltp_tunnel_packet_processed->atsc3_stltp_baseband_packet_v.count); //TODO: jjustman-2019-08-09 refactor stltp baseband to alp processing logic out for(int i=0; i < atsc3_stltp_tunnel_packet_processed->atsc3_stltp_baseband_packet_v.count; i++) { atsc3_alp_packet_t* atsc3_alp_packet = NULL; atsc3_stltp_baseband_packet_t* atsc3_stltp_baseband_packet = atsc3_stltp_tunnel_packet_processed->atsc3_stltp_baseband_packet_v.data[i]; _ATSC3_STLTP_DEPACKETIZER_DEBUG("atsc3_baseband_packet: sequence_num: %d, port: %d", atsc3_stltp_baseband_packet->ip_udp_rtp_packet_inner->rtp_header->sequence_number, atsc3_stltp_baseband_packet->ip_udp_rtp_packet_inner->udp_flow.dst_port); //switch contexts if we don't have our inner_rtp_port_filter set for BBP if(atsc3_stltp_depacketizer_context->inner_rtp_port_filter == ATSC3_STLTP_DEPACKETIZER_ALL_PLPS_INNER_RTP_PORT && (atsc3_stltp_baseband_packet->ip_udp_rtp_packet_inner->udp_flow.dst_port >= 30000 && atsc3_stltp_baseband_packet->ip_udp_rtp_packet_inner->udp_flow.dst_port < 30064)) { //noop } else { //filter out by PLP if inner_rtp_port_filter is set if(atsc3_stltp_depacketizer_context->inner_rtp_port_filter != atsc3_stltp_baseband_packet->ip_udp_rtp_packet_inner->udp_flow.dst_port) { _ATSC3_STLTP_DEPACKETIZER_DEBUG("ignorning stltp_baseband_packet port: %d", atsc3_stltp_baseband_packet->ip_udp_rtp_packet_inner->udp_flow.dst_port); //atsc3_stltp_baseband_packet_free(&atsc3_stltp_baseband_packet); continue; } } //reset our context, as we may have pushed a new marker bbp in processing atsc3_stltp_tunnel_packet_set_baseband_packet_pending_from_plp(atsc3_stltp_depacketizer_context, atsc3_stltp_baseband_packet->plp_num, atsc3_stltp_tunnel_packet_processed); //make sure we get a packet back, base field pointer (13b) : 0x1FFF (8191 bytes) will return NULL atsc3_baseband_packet_t* atsc3_baseband_packet = atsc3_stltp_parse_baseband_packet(atsc3_stltp_baseband_packet); if(!atsc3_baseband_packet) { _ATSC3_STLTP_DEPACKETIZER_DEBUG("no baseband packet returned, ^^^ should be only padding"); } if(atsc3_baseband_packet) { atsc3_alp_packet_collection_add_atsc3_baseband_packet(atsc3_alp_packet_collection, atsc3_baseband_packet); //inner rtp may be null if we have a small/super incomplete fragment..but we need non-null inner if we are going to re-assemble a baseband packet short fragment //hack to carry over 1 (or N) byte payload(s) that is too small from our last run...trumps pending packets if(atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_baseband_packet_short_fragment) { if(atsc3_baseband_packet->alp_payload_pre_pointer) { __DEBUG("atsc3_baseband_packet: carry over: atsc3_baseband_packet_short_fragment: atsc3_baseband_packet_short_fragment: ptr: %p, size: %d, alp_payload_pre_pointer: ptr: %p, size: %d, new size: %d, sequence: %d, port: %d", atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_baseband_packet_short_fragment, atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_baseband_packet_short_fragment->p_size, atsc3_baseband_packet->alp_payload_pre_pointer, atsc3_baseband_packet->alp_payload_pre_pointer->p_size, (atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_baseband_packet_short_fragment->p_size + atsc3_baseband_packet->alp_payload_pre_pointer->p_size), atsc3_stltp_baseband_packet->ip_udp_rtp_packet_inner->rtp_header->sequence_number, atsc3_stltp_baseband_packet->ip_udp_rtp_packet_inner->udp_flow.dst_port); uint32_t holdover_alp_payload_size = atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_baseband_packet_short_fragment->p_size; uint32_t old_alp_payload_size = atsc3_baseband_packet->alp_payload_pre_pointer->p_size; block_Merge(atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_baseband_packet_short_fragment, atsc3_baseband_packet->alp_payload_pre_pointer); block_Destroy(&atsc3_baseband_packet->alp_payload_pre_pointer); atsc3_baseband_packet->alp_payload_pre_pointer = atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_baseband_packet_short_fragment; atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_baseband_packet_short_fragment = NULL; //null instead of clone/release since we just blcok_merged } else { __WARN("atsc3_baseband_packet: carry over: atsc3_baseband_packet_short_fragment: atsc3_baseband_packet_short_fragment: ptr: %p, size: %d, alp_payload_pre_pointer: ptr: %p, size: %d, new size: %d, sequence: %d, port: %d", atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_baseband_packet_short_fragment, atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_baseband_packet_short_fragment->p_size, atsc3_baseband_packet->alp_payload_post_pointer, atsc3_baseband_packet->alp_payload_post_pointer->p_size, (atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_baseband_packet_short_fragment->p_size + atsc3_baseband_packet->alp_payload_post_pointer->p_size), atsc3_stltp_baseband_packet->ip_udp_rtp_packet_inner->rtp_header->sequence_number, atsc3_stltp_baseband_packet->ip_udp_rtp_packet_inner->udp_flow.dst_port); uint32_t holdover_alp_payload_size = atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_baseband_packet_short_fragment->p_size; uint32_t old_alp_payload_size = atsc3_baseband_packet->alp_payload_post_pointer->p_size; block_Merge(atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_baseband_packet_short_fragment, atsc3_baseband_packet->alp_payload_post_pointer); block_Destroy(&atsc3_baseband_packet->alp_payload_post_pointer); atsc3_baseband_packet->alp_payload_post_pointer = atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_baseband_packet_short_fragment; atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_baseband_packet_short_fragment = NULL; //null instead of clone/release since we just blcok_merged } } if(atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending) { //if we have a pending packet and a pre-pointer baseband frame block if(atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending && atsc3_baseband_packet->alp_payload_pre_pointer) { //merge block_t pre_pointer by computing the difference... uint32_t remaining_packet_pending_bytes = block_Remaining_size(atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending->alp_payload); uint32_t remaining_baseband_frame_bytes = block_Remaining_size(atsc3_baseband_packet->alp_payload_pre_pointer); _ATSC3_STLTP_DEPACKETIZER_DEBUG("atsc3_baseband_packet: alp_packet_pending: size: %d, fragment remaining bytes: %d, bb pre_pointer frame bytes remaining: %d, bb pre_pointer size: %d", atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending->alp_payload->p_size, remaining_packet_pending_bytes, remaining_baseband_frame_bytes, atsc3_baseband_packet->alp_payload_pre_pointer->p_size); //we may overrun this clamping... block_Seek(atsc3_baseband_packet->alp_payload_pre_pointer, __MIN(remaining_packet_pending_bytes, remaining_baseband_frame_bytes)); //this is messy, as atsc3_baseband_packet will have alp_payload pointers to alp_payload.. atsc3_alp_packet_t* atsc3_alp_packet_pre_pointer = atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending; block_Append(atsc3_alp_packet_pre_pointer->alp_payload, atsc3_baseband_packet->alp_payload_pre_pointer); uint32_t final_alp_packet_short_bytes_remaining = block_Remaining_size(atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending->alp_payload); //if our refragmenting is short, try and recover based upon baseband packet split if(final_alp_packet_short_bytes_remaining) { if(atsc3_baseband_packet->alp_payload_post_pointer) { __WARN("atsc3_baseband_packet: pending packet: short and post pointer: %d bytes still remaining, atsc3_alp_packet_pre_pointer->alp_payload size: %d, pos: %d, atsc3_baseband_packet->alp_payload_pre_pointer size: %d, pos: %d", final_alp_packet_short_bytes_remaining, atsc3_alp_packet_pre_pointer->alp_payload->p_size, atsc3_alp_packet_pre_pointer->alp_payload->i_pos, atsc3_baseband_packet->alp_payload_pre_pointer->p_size, atsc3_baseband_packet->alp_payload_pre_pointer->i_pos); } else { _ATSC3_STLTP_DEPACKETIZER_DEBUG("atsc3_baseband_packet: carry over pending packet: short: %d bytes still remaining", final_alp_packet_short_bytes_remaining); } //do not attempt to free atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending, as it will free our interm reference to atsc3_alp_packet atsc3_alp_packet_pre_pointer->is_alp_payload_complete = false; atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending = atsc3_alp_packet_clone(atsc3_alp_packet_pre_pointer); __ERROR(" atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending is now: %p", atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending); atsc3_alp_packet_free(&atsc3_alp_packet_pre_pointer); } else { //packet is complete after refragmenting - atsc3_alp_packet_pre_pointer->is_alp_payload_complete = true; atsc3_alp_packet_packet_set_bootstrap_timing_ref_from_baseband_packet(atsc3_alp_packet_pre_pointer, atsc3_baseband_packet); atsc3_alp_packet_collection_add_atsc3_alp_packet(atsc3_alp_packet_collection, atsc3_alp_packet_pre_pointer); atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending = NULL; atsc3_alp_packet_pre_pointer = NULL; uint32_t remaining_baseband_frame_bytes = block_Remaining_size(atsc3_baseband_packet->alp_payload_pre_pointer); _ATSC3_STLTP_DEPACKETIZER_DEBUG("atsc3_baseband_packet: pushed: bb pre_pointer frame bytes remaining: %d, bb pre_pointer size: %d", remaining_baseband_frame_bytes, atsc3_baseband_packet->alp_payload_pre_pointer->p_size); if(remaining_baseband_frame_bytes) { //push remaining bytes to post-pointer, if(atsc3_baseband_packet->alp_payload_post_pointer) { __INFO("atsc3_baseband_packet: prepending alp_payload_pre_pointer with alp_payload_post_pointer"); block_t* alp_payload_post_pointer_orig = atsc3_baseband_packet->alp_payload_post_pointer; atsc3_baseband_packet->alp_payload_post_pointer = block_Duplicate_from_position(atsc3_baseband_packet->alp_payload_pre_pointer); block_Merge(atsc3_baseband_packet->alp_payload_post_pointer, alp_payload_post_pointer_orig); block_Destroy(&alp_payload_post_pointer_orig); } else { atsc3_baseband_packet->alp_payload_post_pointer = block_Duplicate_from_position(atsc3_baseband_packet->alp_payload_pre_pointer); block_Destroy(&atsc3_baseband_packet->alp_payload_pre_pointer); } } } } } //process our pre_pointers from a baseband fragment for alp if(atsc3_baseband_packet->alp_payload_pre_pointer && block_Remaining_size(atsc3_baseband_packet->alp_payload_pre_pointer)) { while((atsc3_alp_packet = atsc3_alp_packet_parse(atsc3_baseband_packet->plp_num, atsc3_baseband_packet->alp_payload_pre_pointer))) { atsc3_alp_packet_packet_set_bootstrap_timing_ref_from_baseband_packet(atsc3_alp_packet, atsc3_baseband_packet); _ATSC3_STLTP_DEPACKETIZER_DEBUG(" atsc3_baseband_packet: carry over: parse alp_payload_pre_pointer: pos: %d, size: %d", atsc3_baseband_packet->alp_payload_pre_pointer->i_pos, atsc3_baseband_packet->alp_payload_pre_pointer->p_size); if(atsc3_alp_packet->is_alp_payload_complete) { atsc3_alp_packet_collection_add_atsc3_alp_packet(atsc3_alp_packet_collection, atsc3_alp_packet); } else { if(atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending && atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending->alp_payload) { __ERROR(" incomplete fragment for atsc3_alp_packet_pending, discarding! atsc3_alp_packet_pending: %p, pos: %d, size: %d, alp_packet_header.type: %d, alp_packet_header.type: %d", atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending, atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending->alp_payload->i_pos, atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending->alp_payload->p_size, atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending->alp_packet_header.alp_packet_header_mode.header_mode, atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending->alp_packet_header.alp_packet_header_mode.length); } else if(atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending) { __ERROR(" incomplete fragment for atsc3_alp_packet_pending, discarding! atsc3_alp_packet_pending: %p, alp_packet_header.type: %d, alp_packet_header.length: %d", atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending, atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending->alp_packet_header.alp_packet_header_mode.header_mode, atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending->alp_packet_header.alp_packet_header_mode.length); } else { __ERROR(" fragment for atsc3_alp_packet_pending is NULL, discarding!"); } //jjustman-2019-08-08 - free before stoping on pending payload reference if(atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending) { atsc3_alp_packet_free(&atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending); } atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending = atsc3_alp_packet_clone(atsc3_alp_packet); __ERROR(" atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending is now: %p", atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending); atsc3_alp_packet_free(&atsc3_alp_packet); break; } } block_Destroy(&atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_baseband_packet_short_fragment); } //process post_pointer for our baseband frame if(atsc3_baseband_packet->alp_payload_post_pointer) { _ATSC3_STLTP_DEPACKETIZER_DEBUG("atsc3_baseband_packet: starting alp_payload_post_pointer: pos: %d, size: %d", atsc3_baseband_packet->alp_payload_post_pointer->i_pos, atsc3_baseband_packet->alp_payload_post_pointer->p_size); while((atsc3_alp_packet = atsc3_alp_packet_parse(atsc3_baseband_packet->plp_num, atsc3_baseband_packet->alp_payload_post_pointer))) { atsc3_alp_packet_packet_set_bootstrap_timing_ref_from_baseband_packet(atsc3_alp_packet, atsc3_baseband_packet); _ATSC3_STLTP_DEPACKETIZER_DEBUG(" atsc3_baseband_packet: after parse alp_payload_post_pointer: pos: %d, size: %d", atsc3_baseband_packet->alp_payload_post_pointer->i_pos, atsc3_baseband_packet->alp_payload_post_pointer->p_size); if(atsc3_alp_packet->is_alp_payload_complete) { atsc3_alp_packet_collection_add_atsc3_alp_packet(atsc3_alp_packet_collection, atsc3_alp_packet); } else { //carry-over as atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending //jjustman-2019-08-08 - free before stoping on pending payload reference if(atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending) { atsc3_alp_packet_free(&atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending); } if(atsc3_alp_packet) { atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending = atsc3_alp_packet_clone(atsc3_alp_packet); _ATSC3_STLTP_DEPACKETIZER_DEBUG(" atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending is now: %p", atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending); atsc3_alp_packet_free(&atsc3_alp_packet); } break; } } //anything remaining in post_pointer needs to be carried over for next alp_packet processing uint32_t remaining_size = block_Remaining_size(atsc3_baseband_packet->alp_payload_post_pointer); if(remaining_size) { atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_baseband_packet_short_fragment = block_Duplicate_from_position(atsc3_baseband_packet->alp_payload_post_pointer); __DEBUG("atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_baseband_packet_short_fragment: %p, Carrying over due to short ALP packet, port: %d, sequence: %d, alp_payload_post_pointer remaining size: %d (pos: %d, len: %d), peek: 0x%02x", atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_baseband_packet_short_fragment, atsc3_stltp_baseband_packet->ip_udp_rtp_packet_inner->udp_flow.dst_port, atsc3_stltp_baseband_packet->ip_udp_rtp_packet_inner->rtp_header->sequence_number, remaining_size, atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_baseband_packet_short_fragment->i_pos, atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_baseband_packet_short_fragment->p_size, atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_baseband_packet_short_fragment->p_buffer[0]); } } else { _ATSC3_STLTP_DEPACKETIZER_DEBUG("atsc3_alp_packet_pending: no alp_payload_post_pointer - carrying over pkt: %p", atsc3_stltp_tunnel_packet_processed->atsc3_stltp_tunnel_baseband_packet_pending_by_plp->atsc3_alp_packet_pending); } } } //send our ALP IP packets, then clear the collection if(atsc3_stltp_depacketizer_context->atsc3_stltp_baseband_alp_packet_collection_callback) { atsc3_stltp_depacketizer_context->atsc3_stltp_baseband_alp_packet_collection_callback(atsc3_alp_packet_collection); } //generic context for class instance re-scoping if(atsc3_stltp_depacketizer_context->atsc3_stltp_baseband_alp_packet_collection_callback_with_context && atsc3_stltp_depacketizer_context->atsc3_stltp_baseband_alp_packet_collection_callback_context) { atsc3_stltp_depacketizer_context->atsc3_stltp_baseband_alp_packet_collection_callback_with_context(atsc3_alp_packet_collection, atsc3_stltp_depacketizer_context->atsc3_stltp_baseband_alp_packet_collection_callback_context); } //explicit callback context for pcap_t reflection if(atsc3_stltp_depacketizer_context->atsc3_stltp_baseband_alp_packet_collection_callback_with_pcap_device_reference && atsc3_stltp_depacketizer_context->atsc3_baseband_alp_output_pcap_device_reference) { atsc3_stltp_depacketizer_context->atsc3_stltp_baseband_alp_packet_collection_callback_with_pcap_device_reference(atsc3_alp_packet_collection, atsc3_stltp_depacketizer_context->atsc3_baseband_alp_output_pcap_device_reference); } //TODO: jjustman-2019-11-23: move this to atsc3_alp_packet_free ATSC3_VECTOR_BUILDER free method //clear out our inner payloads, then let collection_clear free the object instance for(int i=0; i < atsc3_alp_packet_collection->atsc3_alp_packet_v.count; i++) { atsc3_alp_packet_t* atsc3_alp_packet = atsc3_alp_packet_collection->atsc3_alp_packet_v.data[i]; atsc3_alp_packet_free_alp_payload(atsc3_alp_packet); } atsc3_alp_packet_collection_clear_atsc3_alp_packet(atsc3_alp_packet_collection); //todo: refactor to _free(..) for vector_t if(atsc3_alp_packet_collection->atsc3_alp_packet_v.data) { free(atsc3_alp_packet_collection->atsc3_alp_packet_v.data); atsc3_alp_packet_collection->atsc3_alp_packet_v.data = NULL; } for(int i=0; i < atsc3_alp_packet_collection->atsc3_baseband_packet_v.count; i++) { atsc3_baseband_packet_t* atsc3_baseband_packet = atsc3_alp_packet_collection->atsc3_baseband_packet_v.data[i]; atsc3_baseband_packet_free_v(atsc3_baseband_packet); } atsc3_alp_packet_collection_clear_atsc3_baseband_packet(atsc3_alp_packet_collection); if(atsc3_alp_packet_collection->atsc3_baseband_packet_v.data) { free(atsc3_alp_packet_collection->atsc3_baseband_packet_v.data); atsc3_alp_packet_collection->atsc3_baseband_packet_v.data = NULL; } } if(atsc3_stltp_tunnel_packet_processed->atsc3_stltp_preamble_packet_v.count) { _ATSC3_STLTP_DEPACKETIZER_DEBUG("preamble: >>>stltp atsc3_stltp_preamble_packet packet complete: count: %u", atsc3_stltp_tunnel_packet_processed->atsc3_stltp_preamble_packet_v.count); for(int i=0; i < atsc3_stltp_tunnel_packet_processed->atsc3_stltp_preamble_packet_v.count; i++) { atsc3_stltp_preamble_packet_t* atsc3_stltp_preamble_packet = atsc3_stltp_tunnel_packet_processed->atsc3_stltp_preamble_packet_v.data[i]; atsc3_preamble_packet_t* atsc3_preamble_packet = atsc3_stltp_parse_preamble_packet(atsc3_stltp_preamble_packet); if(!atsc3_preamble_packet) { _ATSC3_STLTP_DEPACKETIZER_WARN("atsc3_preamble_packet is NULL for i: %d", i); } else { atsc3_stltp_preamble_packet->preamble_packet = atsc3_preamble_packet; } } //send our preamble packets //simple impl: atsc3_preamble_packet_dump(atsc3_preamble_packet); if(atsc3_stltp_depacketizer_context->atsc3_stltp_preamble_packet_collection_callback) { atsc3_stltp_depacketizer_context->atsc3_stltp_preamble_packet_collection_callback(&atsc3_stltp_tunnel_packet_processed->atsc3_stltp_preamble_packet_v); } } if(atsc3_stltp_tunnel_packet_processed->atsc3_stltp_timing_management_packet_v.count) { _ATSC3_STLTP_DEPACKETIZER_DEBUG("timing management: >>>stltp atsc3_stltp_timing_management_packet packet complete: count: %u", atsc3_stltp_tunnel_packet_processed->atsc3_stltp_timing_management_packet_v.count); for(int i=0; i < atsc3_stltp_tunnel_packet_processed->atsc3_stltp_timing_management_packet_v.count; i++) { atsc3_stltp_timing_management_packet_t* atsc3_stltp_timing_management_packet = atsc3_stltp_tunnel_packet_processed->atsc3_stltp_timing_management_packet_v.data[i]; atsc3_timing_management_packet_t* atsc3_timing_management_packet = atsc3_stltp_parse_timing_management_packet(atsc3_stltp_timing_management_packet); if(!atsc3_timing_management_packet) { _ATSC3_STLTP_DEPACKETIZER_WARN("atsc3_timing_management_packet is NULL for i: %d", i); } else { atsc3_stltp_timing_management_packet->timing_management_packet = atsc3_timing_management_packet; } } //send our timing and management packets //simple impl atsc3_timing_management_packet_dump(atsc3_timing_management_packet); if(atsc3_stltp_depacketizer_context->atsc3_stltp_timing_management_packet_collection_callback) { atsc3_stltp_depacketizer_context->atsc3_stltp_timing_management_packet_collection_callback(&atsc3_stltp_tunnel_packet_processed->atsc3_stltp_timing_management_packet_v); } } //this method will clear _v.data inner references atsc3_stltp_tunnel_packet_clear_completed_inner_packets(atsc3_stltp_tunnel_packet_processed); } cleanup: atsc3_ip_udp_rtp_packet_destroy(&ip_udp_rtp_packet); } /* jjustman-2020-08-18 - TODO: verify this... * * note: packet ownership is transferred to atsc3_stltp_depacketizer of ip_udp_rtp packet, * so do NOT try and free ip_udp_rtp * * *block_t unless we return false; * * A/324: 8 STLTP TRANSPORT PROTOCOL Address Assignments IPv4 packet format and addressing shall be used exclusively on the STL. The Multicast (destination) address range is 224.0.0.0 – 239.255.255.255. Of that range, 239.0.0.0 – 239.255.255.255 are for private addresses and shall be used for both inner Tunneled and outer Tunnel Packets. */ bool atsc3_stltp_depacketizer_from_blockt(block_t** packet_p, atsc3_stltp_depacketizer_context_t* atsc3_stltp_depacketizer_context) { atsc3_ip_udp_rtp_packet_t* ip_udp_rtp_packet = atsc3_ip_udp_rtp_packet_process_from_blockt_pos(*packet_p); if(!ip_udp_rtp_packet) { return false; } if(!atsc3_stltp_depacketizer_context->context_configured) { //try and find a flow that might be STLTP, must be in the range of 239.0.0.0-239.255.255.255 if (ip_udp_rtp_packet->udp_flow.dst_ip_addr >= ATSC3_STLTP_MULTICAST_RANGE_MIN && ip_udp_rtp_packet->udp_flow.dst_ip_addr <= ATSC3_STLTP_MULTICAST_RANGE_MAX) { //additionally rtp_header->version should be a value of 2 if (ip_udp_rtp_packet->rtp_header && ip_udp_rtp_packet->rtp_header->version == 0x2) { atsc3_stltp_depacketizer_context->destination_flow_filter.dst_ip_addr = ip_udp_rtp_packet->udp_flow.dst_ip_addr; atsc3_stltp_depacketizer_context->destination_flow_filter.dst_port = ip_udp_rtp_packet->udp_flow.dst_port; atsc3_stltp_depacketizer_context->inner_rtp_port_filter = ATSC3_STLTP_DEPACKETIZER_ALL_PLPS_INNER_RTP_PORT; atsc3_stltp_depacketizer_context->context_configured = true; _ATSC3_STLTP_DEPACKETIZER_INFO("auto-assigning stltp_depacketizer_context with: dst_ip_addr: %d, dst_port: %d, inner_rtp_port_filter: %d", atsc3_stltp_depacketizer_context->destination_flow_filter.dst_ip_addr, atsc3_stltp_depacketizer_context->destination_flow_filter.dst_port, atsc3_stltp_depacketizer_context->inner_rtp_port_filter); } } } atsc3_stltp_depacketizer_from_ip_udp_rtp_packet(ip_udp_rtp_packet, atsc3_stltp_depacketizer_context); block_Destroy(packet_p); *packet_p = NULL; return true; } void atsc3_stltp_depacketizer_from_pcap_frame(u_char *user, const struct pcap_pkthdr *pkthdr, const u_char *packet, atsc3_stltp_depacketizer_context_t* atsc3_stltp_depacketizer_context) { //extract our outer ip/udp/rtp packet atsc3_ip_udp_rtp_packet_t* ip_udp_rtp_packet = atsc3_ip_udp_rtp_process_packet_from_pcap(user, pkthdr, packet); if(!ip_udp_rtp_packet) { return; } atsc3_stltp_depacketizer_from_ip_udp_rtp_packet(ip_udp_rtp_packet, atsc3_stltp_depacketizer_context); } uint8_t atsc3_stltp_depacketizer_context_get_plp_from_context(atsc3_stltp_depacketizer_context_t* atsc3_stltp_depacketizer_context) { uint8_t plp = 0; if(atsc3_stltp_depacketizer_context->inner_rtp_port_filter > 30000 && atsc3_stltp_depacketizer_context->inner_rtp_port_filter <= 30064) { plp = atsc3_stltp_depacketizer_context->inner_rtp_port_filter - 30000; } return plp; }
76.45898
376
0.755068
4022122f0e04cd8a106c6a4bc12a0c65a3f99cd4
1,253
py
Python
src/test/marker_array_test.py
fftn/rviz
a9de85555b040f625b0bac5d7c3eba3be9e8fa42
[ "BSD-3-Clause-Clear" ]
null
null
null
src/test/marker_array_test.py
fftn/rviz
a9de85555b040f625b0bac5d7c3eba3be9e8fa42
[ "BSD-3-Clause-Clear" ]
null
null
null
src/test/marker_array_test.py
fftn/rviz
a9de85555b040f625b0bac5d7c3eba3be9e8fa42
[ "BSD-3-Clause-Clear" ]
null
null
null
#!/usr/bin/env python from visualization_msgs.msg import Marker from visualization_msgs.msg import MarkerArray import rospy import math topic = "visualization_marker_array" publisher = rospy.Publisher(topic, MarkerArray) rospy.init_node("register") markerArray = MarkerArray() count = 0 MARKERS_MAX = 100 while not rospy.is_shutdown(): marker = Marker() marker.header.frame_id = "base_link" marker.type = marker.SPHERE marker.action = marker.ADD marker.scale.x = 0.2 marker.scale.y = 0.2 marker.scale.z = 0.2 marker.color.a = 1.0 marker.color.r = 1.0 marker.color.g = 1.0 marker.color.b = 0.0 marker.pose.orientation.w = 1.0 marker.pose.position.x = math.cos(count / 50.0) marker.pose.position.y = math.cos(count / 40.0) marker.pose.position.z = math.cos(count / 30.0) # We add the new marker to the MarkerArray, removing the oldest marker from it when necessary if count > MARKERS_MAX: markerArray.markers.pop(0) markerArray.markers.append(marker) # Renumber the marker IDs id = 0 for m in markerArray.markers: m.id = id id += 1 # Publish the MarkerArray publisher.publish(markerArray) count += 1 rospy.sleep(0.01)
23.203704
97
0.676776
3e75078288d470199659033ad9dce9700cfc6a0d
3,809
h
C
headers/Hologram/FGPipelineSupportHologram.h
ficsit/source-data
d79699a359575cff266f2eae8d36577e3f9870d1
[ "Apache-2.0" ]
null
null
null
headers/Hologram/FGPipelineSupportHologram.h
ficsit/source-data
d79699a359575cff266f2eae8d36577e3f9870d1
[ "Apache-2.0" ]
null
null
null
headers/Hologram/FGPipelineSupportHologram.h
ficsit/source-data
d79699a359575cff266f2eae8d36577e3f9870d1
[ "Apache-2.0" ]
null
null
null
// Copyright 2016-2019 Coffee Stain Studios. All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "FGFactoryHologram.h" #include "FGPipeConnectionComponent.h" #include "FGPoleDescriptor.h" #include "FGPipelineSupportHologram.generated.h" /** * Hologram for constructing supports that pipelines can snap to. */ UCLASS() class FACTORYGAME_API AFGPipelineSupportHologram : public AFGFactoryHologram { GENERATED_BODY() public: AFGPipelineSupportHologram(); virtual void BeginPlay() override; // Begin AFGHologram interface virtual bool DoMultiStepPlacement( bool isInputFromARelease ) override; virtual bool IsValidHitResult( const FHitResult& hitResult ) const override; virtual bool TrySnapToActor( const FHitResult& hitResult ) override; virtual void SetHologramLocationAndRotation( const FHitResult& hitResult ) override; virtual void CheckClearance() override; // End AFGHologram interface // Begin FGConstructionMessageInterface virtual void SerializeConstructMessage( FArchive& ar, FNetConstructionID id ) override; // End FGConstructionMessageInterface /** Helper */ bool CheckClearanceForBuildingMesh( UStaticMeshComponent* mesh, const FComponentQueryParams& params = FComponentQueryParams::DefaultComponentQueryParams ); /** Set the height of the support */ void SetSupportLength( float height ); /** Get the connections the pipeline snaps to */ FORCEINLINE UFGPipeConnectionComponentBase* GetSnapConnection() const { return mSnapConnection; } /** Snap this supports's snap connection to to the given connection. */ void SnapToConnection( UFGPipeConnectionComponentBase* connection, class AFGPipelineHologram* parentPipeline ); void ResetBuildSteps(); void ResetVerticalRotation(); void SetVerticalAngle( float newValue ) { mVerticalAngle = newValue; } FORCEINLINE float GetVerticalAngle() const { return mVerticalAngle; } /** Updates the relative offset for mSupportHeightComponent based on mSupportMesh */ void UpdateSupportLengthRelativeLoc(); void Scroll( int32 delta ) override; protected: // Begin AFGBuildableHologram interface virtual void ConfigureActor( class AFGBuildable* inBuildable ) const override; // End AFGBuildableHologram interface private: UFUNCTION() void OnRep_SupportMesh(); protected: /** The most fitting mesh for our aim height. */ UPROPERTY( ReplicatedUsing = OnRep_SupportMesh ) FPoleHeightMesh mSupportMesh; /** if you should be able to adjust the vrticale direction of the connection and top part of the pole*/ UPROPERTY( EditDefaultsOnly ) bool mCanAdjustVerticalAngle = true; private: /** The connection conveyors snap to, used when placing a support automatically. */ UPROPERTY() UFGPipeConnectionComponentBase* mSnapConnection; //Used to rotate the connection and top part vetically UPROPERTY( CustomSerialization ) float mVerticalAngle = 0.0f; /** True if we've placed it on the ground and is working with the height */ bool mIsAdjustingLength; bool mCanAdjustLength; /** Can this pole be stacked. */ bool mCanStack = false; float mStackHeight = 200; /** Used to determine whether the relative offset needs to be updated for the support mesh */ bool mSupportLengthMarkedDirty : 1; /** The support mesh. */ UPROPERTY() class UStaticMeshComponent* mSupportMeshComponent; /** The support mesh. */ UPROPERTY() class UStaticMeshComponent* mSupportTopPartMeshComponent; /** The scene component for adjusting the length of the support. */ UPROPERTY() class USceneComponent* mSupportLengthComponent; /**Used to store the initial offset of the support length component, so we can compensate for it during placement*/ float mSupportLengthOffset; };
33.412281
157
0.762142
4c318a1d354892287e13e09d320d44b2f705dbfa
4,315
lua
Lua
prototypes/styles.lua
ko5h/FactorioSmartDisplay
2fd7b30e5830f995f1797ded5249ace3fe815bf0
[ "MIT" ]
null
null
null
prototypes/styles.lua
ko5h/FactorioSmartDisplay
2fd7b30e5830f995f1797ded5249ace3fe815bf0
[ "MIT" ]
null
null
null
prototypes/styles.lua
ko5h/FactorioSmartDisplay
2fd7b30e5830f995f1797ded5249ace3fe815bf0
[ "MIT" ]
null
null
null
local default_gui = data.raw["gui-style"].default data:extend( { { type = "font", name = "smadisp_font", from = "default", border = false, size = 15 }, { type = "font", name = "smadisp_font_small", from = "default-bold", border = false, size = 12 }, { type = "font", name = "smadisp_font_bold", from = "default-bold", border = false, size = 15 }, } ) local spacing_right = 5 local spacing_vertical = 3 default_gui["smadisp_frame_style"] = { type="frame_style", top_padding = spacing_vertical, bottom_padding = spacing_vertical, left_padding = spacing_vertical, right_padding = spacing_vertical, resize_row_to_width = true, max_on_row = 1, vertical_flow_style= { type = "vertical_flow_style", horizontal_spacing = spacing_right, vertical_spacing = spacing_vertical, resize_row_to_width = true, resize_to_row_height = false }, horizontal_flow_style= { type = "horizontal_flow_style", horizontal_spacing = spacing_right, vertical_spacing = spacing_vertical, resize_row_to_width = true, resize_to_row_height = false } } default_gui["smadisp_flow_style"] = { type = "horizontal_flow_style", top_padding = spacing_vertical, bottom_padding = spacing_vertical, left_padding = 0, right_padding = spacing_right, horizontal_spacing = spacing_right, vertical_spacing = spacing_vertical, --max_on_row = 1, --resize_row_to_width = true, max_on_row = 0, resize_row_to_width = false, resize_to_row_height = false, graphical_set = { type = "none" }, } default_gui["smadisp_vertical_flow_style"] = { type = "vertical_flow_style", top_padding = spacing_vertical, bottom_padding = spacing_vertical, left_padding = 0, right_padding = spacing_right, horizontal_spacing = spacing_right, vertical_spacing = spacing_vertical, --max_on_row = 1, --resize_row_to_width = true, max_on_row = 0, resize_row_to_width = false, resize_to_row_height = false, graphical_set = { type = "none" }, } default_gui["smadisp_progressbar_style"] = { type="progressbar_style", parent="progressbar", font="smadisp_font_bold", top_padding = 0, bottom_padding = 0, left_padding = spacing_right, right_padding = spacing_right, } default_gui["smadisp_checkbox_style"] = { type="checkbox_style", parent="checkbox", font="smadisp_font_bold", top_padding = 0, bottom_padding = 0, left_padding = spacing_right, right_padding = spacing_right, } default_gui["smadisp_button_style"] = { type="button_style", font="smadisp_font_bold", align = "center", default_font_color={r=1, g=1, b=1}, hovered_font_color={r=1, g=1, b=1}, top_padding = 0, bottom_padding = 0, left_padding = spacing_right, right_padding = spacing_right, left_click_sound = { { filename = "__core__/sound/gui-click.ogg", volume = 1 } }, } default_gui["smadisp_button_color_style"] = { type="button_style", font="smadisp_font_bold", align = "center", default_font_color={r=1, g=1, b=1}, hovered_font_color={r=1, g=1, b=1}, top_padding = 0, bottom_padding = 0, left_padding = spacing_right, right_padding = spacing_right, left_click_sound = { { filename = "__core__/sound/gui-click.ogg", volume = 1 } }, } default_gui["smadisp_label_style"] = { type="label_style", font="smadisp_font_bold", align = "left", default_font_color={r=1, g=1, b=1}, hovered_font_color={r=1, g=1, b=1}, top_padding = 0, bottom_padding = 0, left_padding = 0, right_padding = spacing_right, minimal_width = 100, maximal_width = 100, } default_gui["smadisp_textfield_style"] = { type = "textbox_style", font="smadisp_font_bold", align = "left", font_color = {}, default_font_color={r=1, g=1, b=1}, hovered_font_color={r=1, g=1, b=1}, selection_background_color= {r=0.66, g=0.7, b=0.83}, top_padding = 0, bottom_padding = 0, left_padding = 0, right_padding = spacing_right, minimal_width = 200, maximal_width = 200, graphical_set = { type = "composition", filename = "__core__/graphics/gui.png", priority = "extra-high-no-scale", corner_size = {3, 3}, position = {16, 0} }, }
21.467662
57
0.670684
c6ef3c0b3457f51d0681f7205ad2f0caf7103092
5,819
kts
Kotlin
data/RF01824/rnartist.kts
fjossinet/Rfam-for-RNArtist
3016050675602d506a0e308f07d071abf1524b67
[ "MIT" ]
null
null
null
data/RF01824/rnartist.kts
fjossinet/Rfam-for-RNArtist
3016050675602d506a0e308f07d071abf1524b67
[ "MIT" ]
null
null
null
data/RF01824/rnartist.kts
fjossinet/Rfam-for-RNArtist
3016050675602d506a0e308f07d071abf1524b67
[ "MIT" ]
null
null
null
import io.github.fjossinet.rnartist.core.* rnartist { ss { rfam { id = "RF01824" name = "consensus" use alignment numbering } } theme { details { value = 3 } color { location { 2 to 9 433 to 440 } value = "#da5fa4" } color { location { 11 to 14 427 to 430 } value = "#96ac56" } color { location { 36 to 41 381 to 386 } value = "#540a0c" } color { location { 58 to 59 64 to 65 } value = "#9845b7" } color { location { 72 to 73 79 to 80 } value = "#8ae6f5" } color { location { 87 to 88 96 to 97 } value = "#90d43b" } color { location { 104 to 105 241 to 242 } value = "#270151" } color { location { 107 to 109 237 to 239 } value = "#90ab30" } color { location { 117 to 118 229 to 230 } value = "#43e461" } color { location { 122 to 124 223 to 225 } value = "#aa16d0" } color { location { 139 to 143 166 to 170 } value = "#2171c8" } color { location { 146 to 148 158 to 160 } value = "#5b1818" } color { location { 176 to 182 198 to 204 } value = "#d2520b" } color { location { 187 to 188 193 to 194 } value = "#ddff39" } color { location { 255 to 256 265 to 266 } value = "#cce972" } color { location { 293 to 299 306 to 312 } value = "#689b84" } color { location { 330 to 334 350 to 354 } value = "#d3b12a" } color { location { 399 to 402 411 to 414 } value = "#2218a7" } color { location { 10 to 10 431 to 432 } value = "#cbe348" } color { location { 15 to 35 387 to 398 415 to 426 } value = "#daae02" } color { location { 42 to 57 66 to 71 81 to 86 98 to 103 243 to 254 267 to 292 313 to 329 355 to 380 } value = "#29b8ff" } color { location { 60 to 63 } value = "#7d50e9" } color { location { 74 to 78 } value = "#ca9c83" } color { location { 89 to 95 } value = "#305d01" } color { location { 106 to 106 240 to 240 } value = "#e28e06" } color { location { 110 to 116 231 to 236 } value = "#7a88bd" } color { location { 119 to 121 226 to 228 } value = "#bba153" } color { location { 125 to 138 171 to 175 205 to 222 } value = "#a493b2" } color { location { 144 to 145 161 to 165 } value = "#5809ff" } color { location { 149 to 157 } value = "#b2d550" } color { location { 183 to 186 195 to 197 } value = "#7bab9d" } color { location { 189 to 192 } value = "#626c6c" } color { location { 257 to 264 } value = "#1139c2" } color { location { 300 to 305 } value = "#f87f5f" } color { location { 335 to 349 } value = "#69d68f" } color { location { 403 to 410 } value = "#23a0d5" } color { location { 1 to 1 } value = "#49d507" } color { location { 441 to 454 } value = "#e20966" } } }
16.25419
48
0.268947
42b0b3b85dc58155ed878504f989dfc187d9ae64
194
kt
Kotlin
idea/testData/refactoring/rename/renameCompareTo/before/compareTo.kt
qussarah/declare
c83b764c7394efa3364915d973ae79c4ebed2437
[ "Apache-2.0" ]
337
2020-05-14T00:40:10.000Z
2022-02-16T23:39:07.000Z
idea/testData/refactoring/rename/renameCompareTo/before/compareTo.kt
qussarah/declare
c83b764c7394efa3364915d973ae79c4ebed2437
[ "Apache-2.0" ]
92
2020-06-10T23:17:42.000Z
2020-09-25T10:50:13.000Z
idea/testData/refactoring/rename/renameCompareTo/before/compareTo.kt
qussarah/declare
c83b764c7394efa3364915d973ae79c4ebed2437
[ "Apache-2.0" ]
54
2016-02-29T16:27:38.000Z
2020-12-26T15:02:23.000Z
class A(val n: Int) { operator fun compareTo(other: A): Int = n.compareTo(other.n) } fun test() { A(0) compareTo A(1) A(0) < A(1) A(0) <= A(1) A(0) > A(1) A(0) >= A(1) }
17.636364
64
0.484536
5c0dd6da0b64668d3bd3c527d062621fc8a8e113
6,502
swift
Swift
Sources/iOSBasics/SyncServer/Misc Types/DeclarableObject+Specific.swift
SyncServerII/iOSBasics
ae7b7fe931d90c017921614a333781cf64f45eec
[ "MIT" ]
null
null
null
Sources/iOSBasics/SyncServer/Misc Types/DeclarableObject+Specific.swift
SyncServerII/iOSBasics
ae7b7fe931d90c017921614a333781cf64f45eec
[ "MIT" ]
3
2020-09-23T01:14:30.000Z
2021-02-09T03:15:29.000Z
Sources/iOSBasics/SyncServer/Misc Types/DeclarableObject+Specific.swift
SyncServerII/iOSBasics
ae7b7fe931d90c017921614a333781cf64f45eec
[ "MIT" ]
null
null
null
// // DeclarableObject+Specific.swift // // // Created by Christopher G Prince on 9/3/20. // import Foundation import ServerShared public struct FileDeclaration: DeclarableFile, Codable, Hashable { public var fileLabel: String public let mimeTypes: Set<MimeType> public let changeResolverName: String? public init(fileLabel: String, mimeTypes: Set<MimeType>, changeResolverName: String?) { self.fileLabel = fileLabel self.mimeTypes = mimeTypes self.changeResolverName = changeResolverName } public static func == (lhs: FileDeclaration, rhs: FileInfo) -> Bool { // Not including fileLabel in comparison because fileLabel can be nil in FileInfo. var mimeTypeFactor = true if let rhsMimeType = rhs.mimeType { let mimeTypeStrings:Set<String> = Set(lhs.mimeTypes.map {$0.rawValue}) mimeTypeFactor = mimeTypeStrings.contains(rhsMimeType) } return mimeTypeFactor && lhs.changeResolverName == rhs.changeResolverName } } public struct FileToDownload: DownloadableFile { public let uuid: UUID public let fileVersion: FileVersionInt public init(uuid: UUID, fileVersion: FileVersionInt) { self.uuid = uuid self.fileVersion = fileVersion } public static func ==(lhs: FileToDownload, rhs: FileToDownload) -> Bool { return lhs.uuid == rhs.uuid && lhs.fileVersion == rhs.fileVersion } } public struct ObjectToDownload: DownloadableObject { public let fileGroupUUID: UUID public let downloads: [FileToDownload] public init(fileGroupUUID: UUID, downloads: [FileDownload]) { self.fileGroupUUID = fileGroupUUID self.downloads = downloads } } public struct DownloadFile: FileNeedingDownload { public let uuid: UUID public let fileVersion: FileVersionInt public let fileLabel: String public init(uuid: UUID, fileVersion: FileVersionInt, fileLabel: String) { self.uuid = uuid self.fileVersion = fileVersion self.fileLabel = fileLabel } public static func ==(lhs: DownloadFile, rhs: DownloadFile) -> Bool { return lhs.fileLabel == rhs.fileLabel && lhs.uuid == rhs.uuid } public static func ==(lhs: DownloadFile, rhs: UploadableFile) -> Bool { return lhs.fileLabel == rhs.fileLabel && lhs.uuid == rhs.uuid } } public struct NotDownloadedFile: FileNotDownloaded { public let uuid: UUID public init(uuid: UUID) { self.uuid = uuid } } public struct DownloadObject: ObjectNeedingDownload { public let sharingGroupUUID: UUID public let fileGroupUUID: UUID public let creationDate: Date public let downloads: [DownloadFile] public init(sharingGroupUUID: UUID, fileGroupUUID: UUID, creationDate: Date, downloads: [DownloadFile]) { self.sharingGroupUUID = sharingGroupUUID self.fileGroupUUID = fileGroupUUID self.creationDate = creationDate self.downloads = downloads } } public struct NotDownloadedObject: ObjectNotDownloaded { public let sharingGroupUUID: UUID public let fileGroupUUID: UUID public let downloads: [NotDownloadedFile] public init(sharingGroupUUID: UUID, fileGroupUUID: UUID, downloads: [NotDownloadedFile]) { self.sharingGroupUUID = sharingGroupUUID self.fileGroupUUID = fileGroupUUID self.downloads = downloads } } public struct IndexObject: IndexableObject { public let deleted: Bool public let objectType: String public let sharingGroupUUID: UUID public let fileGroupUUID: UUID public let creationDate: Date // This is the most recent update date of any file in the object. public let updateDate: Date? public let downloads: [DownloadFile] public init(sharingGroupUUID: UUID, fileGroupUUID: UUID, objectType: String, creationDate: Date, updateDate: Date?, deleted: Bool, downloads: [DownloadFile]) { self.sharingGroupUUID = sharingGroupUUID self.fileGroupUUID = fileGroupUUID self.creationDate = creationDate self.updateDate = updateDate self.downloads = downloads self.deleted = deleted self.objectType = objectType } } public struct DownloadedFile: FileWasDownloaded { public let uuid: UUID public let fileVersion: FileVersionInt public let fileLabel: String public let mimeType: MimeType public let updateDate: Date? public let appMetaData: String? public enum Contents { case gone(GoneReason) // When returned to the client, this file needs to be moved or copied to a client location for persistence. case download(URL) } public let contents: Contents public init(uuid: UUID, fileVersion: FileVersionInt, fileLabel: String, mimeType: MimeType, updateDate: Date?, appMetaData: String?, contents: DownloadedFile.Contents) { self.uuid = uuid self.fileVersion = fileVersion self.fileLabel = fileLabel self.mimeType = mimeType self.contents = contents self.updateDate = updateDate self.appMetaData = appMetaData } } public struct DownloadedObject: ObjectWasDownloaded { public let creationDate: Date // Has a sharingGroupUUID because `DownloadedObject` is used in the `ObjectDownloadHandler` `objectWasDownloaded` method and that method needs to know the sharing group. public let sharingGroupUUID: UUID public let fileGroupUUID: UUID public let downloads: [DownloadedFile] public init(sharingGroupUUID: UUID, fileGroupUUID: UUID, creationDate: Date, downloads: [DownloadedFile]) { self.sharingGroupUUID = sharingGroupUUID self.fileGroupUUID = fileGroupUUID self.creationDate = creationDate self.downloads = downloads } } public struct ObjectDeclaration: DeclarableObject { // The type of object that this collection of files is representing. // E.g., a Neebla image or Neebla URL as above. This is optional only to grandfather in early versions of Neebla. New object declarations must have this non-nil. public let objectType: String public var declaredFiles: [DeclarableFile] public init(objectType: String, declaredFiles: [DeclarableFile]) { self.objectType = objectType self.declaredFiles = declaredFiles } }
32.838384
173
0.688557
1e68592a2bb0d74960e9e0c662cd0075efec730e
633
css
CSS
public/admin/assets/pages/ace-editor/build/aui-image-cropper/assets/skins/sam/aui-image-cropper-skin.css
jesusvegardz/TIKS
1b6e5efe8d4b49d0c8990d00157e11859ad5391d
[ "MIT" ]
5
2020-08-12T14:23:12.000Z
2021-08-24T05:31:35.000Z
public/admin/assets/pages/ace-editor/build/aui-image-cropper/assets/skins/sam/aui-image-cropper-skin.css
jesusvegardz/TIKS
1b6e5efe8d4b49d0c8990d00157e11859ad5391d
[ "MIT" ]
22
2020-03-04T23:39:29.000Z
2022-03-31T21:43:22.000Z
public/admin/assets/pages/ace-editor/build/aui-image-cropper/assets/skins/sam/aui-image-cropper-skin.css
jesusvegardz/TIKS
1b6e5efe8d4b49d0c8990d00157e11859ad5391d
[ "MIT" ]
4
2020-11-18T21:46:41.000Z
2021-02-24T15:35:41.000Z
.aui-image-cropper .aui-image-cropper-crop .yui3-resize-handle-inner-t, .aui-image-cropper .aui-image-cropper-crop .yui3-resize-handle-inner-tr, .aui-image-cropper .aui-image-cropper-crop .yui3-resize-handle-inner-r, .aui-image-cropper .aui-image-cropper-crop .yui3-resize-handle-inner-br, .aui-image-cropper .aui-image-cropper-crop .yui3-resize-handle-inner-b, .aui-image-cropper .aui-image-cropper-crop .yui3-resize-handle-inner-bl, .aui-image-cropper .aui-image-cropper-crop .yui3-resize-handle-inner-l, .aui-image-cropper .aui-image-cropper-crop .yui3-resize-handle-inner-tl { background: url(resize-handle.png) no-repeat 0 0; }
63.3
73
0.774092
993bf933dd627e9085f266afa72046804a467d7f
4,146
c
C
src/iteration_utilities/_iteration_utilities/exported_helper.c
Abhisheknishant/iteration_utilities
b2bf8d8668ed54d1aadf8c31884fc8a7d28551cc
[ "Apache-2.0" ]
72
2016-09-12T03:01:02.000Z
2022-03-05T16:54:45.000Z
src/iteration_utilities/_iteration_utilities/exported_helper.c
Abhisheknishant/iteration_utilities
b2bf8d8668ed54d1aadf8c31884fc8a7d28551cc
[ "Apache-2.0" ]
127
2016-09-14T02:07:33.000Z
2022-03-19T13:17:32.000Z
src/iteration_utilities/_iteration_utilities/exported_helper.c
Abhisheknishant/iteration_utilities
b2bf8d8668ed54d1aadf8c31884fc8a7d28551cc
[ "Apache-2.0" ]
11
2017-02-22T20:40:37.000Z
2022-03-05T16:55:40.000Z
/****************************************************************************** * Licensed under Apache License Version 2.0 - see LICENSE *****************************************************************************/ #include "exported_helper.h" #include "helper.h" /****************************************************************************** * This file contains functions that are meant as helpers, they are especially * written to speed up parts of the Python code, they shouldn't be considered * safe to use elsewhere. *****************************************************************************/ static PyObject * PyIU_parse_args(PyObject *tuple, PyObject *item, Py_ssize_t index) { assert(tuple != NULL && PyTuple_CheckExact(tuple)); assert(item != NULL); assert(index >= 0 && index <= PyTuple_GET_SIZE(tuple)); PyObject *new_tuple; Py_ssize_t i; Py_ssize_t tuple_size = PyTuple_GET_SIZE(tuple); new_tuple = PyTuple_New(tuple_size + 1); if (new_tuple == NULL) { return NULL; } Py_INCREF(item); PyTuple_SET_ITEM(new_tuple, index, item); for (i = 0; i < tuple_size + 1; i++) { PyObject *tmp; if (i < index) { tmp = PyTuple_GET_ITEM(tuple, i); Py_INCREF(tmp); PyTuple_SET_ITEM(new_tuple, i, tmp); } else if (i == index) { continue; } else { tmp = PyTuple_GET_ITEM(tuple, i - 1); Py_INCREF(tmp); PyTuple_SET_ITEM(new_tuple, i, tmp); } } return new_tuple; } static PyObject * PyIU_parse_kwargs(PyObject *dct, PyObject *remvalue) { assert(dct != NULL && PyDict_CheckExact(dct)); assert(remvalue != NULL); PyObject *key; PyObject *value; PyObject *small_stack[PyIU_SMALL_ARG_STACK_SIZE]; PyObject **stack = small_stack; Py_ssize_t pos; Py_ssize_t dict_size; Py_ssize_t i; Py_ssize_t j; dict_size = PyDict_Size(dct); if (dict_size == 0) { Py_RETURN_NONE; } if (dict_size > PyIU_SMALL_ARG_STACK_SIZE) { stack = PyIU_AllocatePyObjectArray(dict_size); if (stack == NULL) { return PyErr_NoMemory(); } } pos = 0; i = 0; while (PyDict_Next(dct, &pos, &key, &value)) { /* Compare the "value is remvalue" (this is not "value == remvalue" at least in the python-sense). */ if (value == remvalue) { stack[i] = key; i++; } } if (i == dict_size) { PyDict_Clear(dct); } else { for (j = 0; j < i; j++) { /* Error checking is intentionally omitted since we know that the items in the stack are not-NULL and hashable. */ PyDict_DelItem(dct, stack[j]); } } if (stack != small_stack) { PyMem_Free(stack); } Py_RETURN_NONE; } #if PyIU_USE_VECTORCALL PyObject * PyIU_TupleToList_and_InsertItemAtIndex(PyObject *Py_UNUSED(m), PyObject *const *args, size_t nargs) { PyObject *tup; PyObject *item; Py_ssize_t index; if (!_PyArg_ParseStack(args, nargs, "OOn:_parse_args", &tup, &item, &index)) { return NULL; } return PyIU_parse_args(tup, item, index); } PyObject * PyIU_RemoveFromDictWhereValueIs(PyObject *Py_UNUSED(m), PyObject *const *args, size_t nargs) { PyObject *dct; PyObject *remvalue; if (!_PyArg_ParseStack(args, nargs, "OO:_parse_kwargs", &dct, &remvalue)) { return NULL; } return PyIU_parse_kwargs(dct, remvalue); } #else PyObject * PyIU_TupleToList_and_InsertItemAtIndex(PyObject *Py_UNUSED(m), PyObject *args) { PyObject *tup; PyObject *item; Py_ssize_t index; if (!PyArg_ParseTuple(args, "OOn:_parse_args", &tup, &item, &index)) { return NULL; } return PyIU_parse_args(tup, item, index); } PyObject * PyIU_RemoveFromDictWhereValueIs(PyObject *Py_UNUSED(m), PyObject *args) { PyObject *dct; PyObject *remvalue; if (!PyArg_ParseTuple(args, "OO:_parse_kwargs", &dct, &remvalue)) { return NULL; } return PyIU_parse_kwargs(dct, remvalue); } #endif
28.013514
101
0.569947
dd0510e2667f7e6a18ff55e63a2da8da2f40b08f
487
swift
Swift
Sources/Intermodular/Helpers/SwiftUI/ToolbarItem.swift
fr-/SwiftUIX
d02d877a982a4bb290b34917398bfbad0009fe65
[ "MIT" ]
33
2019-06-04T21:17:27.000Z
2019-08-01T16:00:35.000Z
Sources/Intermodular/Helpers/SwiftUI/ToolbarItem.swift
fr-/SwiftUIX
d02d877a982a4bb290b34917398bfbad0009fe65
[ "MIT" ]
null
null
null
Sources/Intermodular/Helpers/SwiftUI/ToolbarItem.swift
fr-/SwiftUIX
d02d877a982a4bb290b34917398bfbad0009fe65
[ "MIT" ]
null
null
null
// // Copyright (c) Vatsal Manot // import Swift import SwiftUI @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) extension View { /// Converts this view into a toolbar item with a given placement. /// /// Use `toolbarItem(_:)` to configure a view as a toolbar item in a toolbar. public func toolbarItem( placement: ToolbarItemPlacement ) -> ToolbarItem<Void, Self> { ToolbarItem(placement: placement) { self } } }
23.190476
81
0.626283
960777fe84c19f032205b252519b1fb6dcf1c0f7
466
sql
SQL
engine/sql/api/176_remove_old_model.sql
jqueguiner/cds
b629b7e18108142440dcc06fafca420001384511
[ "BSD-3-Clause" ]
4,040
2016-10-11T08:46:07.000Z
2022-03-31T10:59:41.000Z
engine/sql/api/176_remove_old_model.sql
jqueguiner/cds
b629b7e18108142440dcc06fafca420001384511
[ "BSD-3-Clause" ]
2,582
2016-10-12T12:14:21.000Z
2022-03-31T16:46:07.000Z
engine/sql/api/176_remove_old_model.sql
jqueguiner/cds
b629b7e18108142440dcc06fafca420001384511
[ "BSD-3-Clause" ]
436
2016-10-11T08:46:16.000Z
2022-03-21T09:08:44.000Z
-- +migrate Up DROP TABLE workflow_node_join_source; DROP TABLE workflow_node_join_trigger CASCADE; DROP TABLE workflow_node_fork_trigger CASCADE; DROP TABLE workflow_node_outgoing_hook_trigger CASCADE; DROP TABLE workflow_node_trigger CASCADE; DROP TABLE workflow_node_context; DROP TABLE workflow_node_hook; DROP TABLE workflow_node_join; DROP TABLE workflow_node_fork; DROP TABLE workflow_node_outgoing_hook; DROP TABLE workflow_node; -- +migrate Down SELECT 1;
29.125
55
0.862661
39ec9335764349cb568a554f976dbab70b07cf7c
1,290
java
Java
lazy/src/test/java/com/gamesneox/lazy/LazyTest.java
games-neox/Lazy
147c0a361c1e73bf2791e2b03c784426d311157e
[ "MIT" ]
null
null
null
lazy/src/test/java/com/gamesneox/lazy/LazyTest.java
games-neox/Lazy
147c0a361c1e73bf2791e2b03c784426d311157e
[ "MIT" ]
null
null
null
lazy/src/test/java/com/gamesneox/lazy/LazyTest.java
games-neox/Lazy
147c0a361c1e73bf2791e2b03c784426d311157e
[ "MIT" ]
null
null
null
/** * Copyright (c) 2015-2016 Games Neox. All rights reserved. * * This file is an original work developed by Games Neox */ package com.gamesneox.lazy; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; import java.util.concurrent.atomic.AtomicInteger; import static org.junit.Assert.assertEquals; /** * @author Games Neox (games.neox@gmail.com) */ @RunWith(RobolectricTestRunner.class) public class LazyTest { /** * invalid ({@code null}) loader provided */ @SuppressWarnings("ConstantConditions") @Test(expected = NullPointerException.class) public void testLazy0() { new Lazy<String>(null); } /** * correct flow */ @SuppressWarnings("Convert2Diamond") @Test public void testLazy1() { final AtomicInteger loaderCalledTimes = new AtomicInteger(0); Lazy<String> lazy = new Lazy<String>(new Lazy.ILoader<String>() { @Override public String load() { loaderCalledTimes.incrementAndGet(); return "test"; } }); assertEquals("test", lazy.safeGet()); assertEquals(lazy.safeGet(), lazy.fastGet()); assertEquals(1, loaderCalledTimes.get()); } }
22.631579
73
0.637209
c7c5a5a8f2750a554a87002be5af5f829b2e52d4
24,936
py
Python
final.py
scheelelab/MultiPep
2483e50e2bef3a875b70c78d1bfa5ae93bdc93b0
[ "MIT" ]
null
null
null
final.py
scheelelab/MultiPep
2483e50e2bef3a875b70c78d1bfa5ae93bdc93b0
[ "MIT" ]
null
null
null
final.py
scheelelab/MultiPep
2483e50e2bef3a875b70c78d1bfa5ae93bdc93b0
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ Created on Wed Nov 11 14:01:00 2020 @author: hvf811 """ seed_val = 1234 import os import tensorflow as tf from tensorflow.keras.layers import Dense, Input, Dropout,Multiply, LSTM, Add, Concatenate, TimeDistributed from tensorflow.keras.layers import Conv1D, Flatten, Lambda, MaxPooling1D, GRU, SimpleRNN, PReLU from tensorflow.keras.layers import Reshape from tensorflow.keras.models import Model from keras.regularizers import l2, l1 from tensorflow.keras.losses import BinaryCrossentropy from tensorflow.keras.initializers import RandomNormal, RandomUniform, Constant from tensorflow.keras import backend as K from tensorflow.keras.constraints import non_neg from tensorflow.keras.models import load_model from tensorflow.keras.activations import relu from tensorflow.keras.optimizers import Adam import random import pickle import numpy as np import matplotlib.pyplot as plt from sklearn.metrics import matthews_corrcoef, roc_auc_score, precision_score, recall_score,f1_score,cohen_kappa_score,accuracy_score import time ### Controlling randomness tf.random.set_seed(seed_val) np.random.seed(seed_val) random.seed(seed_val) #### Readaing peptide sequence data with open("total_classes_seq_bins32.pkl","rb") as f: tot_bins = pickle.load(f) with open("total_classes_seq32.pkl","rb") as f: encoder = pickle.load(f) with open("branches32.pkl","rb") as f: branches = pickle.load(f) branches = [list(i) for i in branches] lvl1 = [list(branches[0]+branches[1]), list(branches[2]+branches[3]+branches[4])] lvl2_1 = [list(branches[0]),list(branches[1])] lvl2_2 = [list(branches[2]),list(branches[3]+branches[4])] lvl3 = [list(branches[3]),list(branches[4])] lvl4_1 = [list(branches[0])] lvl4_2 = [list(branches[1])] lvl4_3 = [list(branches[2])] lvl4_4 = [list(branches[3])] lvl4_5 = [list(branches[4])] levels = [lvl1, lvl2_1, lvl2_2, lvl3, lvl4_1, lvl4_2, lvl4_3, lvl4_4, lvl4_5] vocab = ['A', 'R', 'N', 'D', 'C', 'Q', 'E', 'G', 'H', 'I', 'L', 'K', 'M', 'F', 'P', 'S', 'T', 'W', 'Y', 'V',] folds = [ [[0], [1], [2, 3, 4, 5, 6, 7, 8, 9]], [[1], [2], [0, 3, 4, 5, 6, 7, 8, 9]], [[2], [3], [0, 1, 4, 5, 6, 7, 8, 9]], [[3], [4], [0, 1, 2, 5, 6, 7, 8, 9]], [[4], [5], [0, 1, 2, 3, 6, 7, 8, 9]], [[5], [6], [0, 1, 2, 3, 4, 7, 8, 9]], [[6], [7], [0, 1, 2, 3, 4, 5, 8, 9]], [[7], [8], [0, 1, 2, 3, 4, 5, 6, 9]], [[8], [9], [0, 1, 2, 3, 4, 5, 6, 7]], [[9], [0], [1, 2, 3, 4, 5, 6, 7, 8]] ] ## Getting the labels labels1 = set() for i in list(encoder.values()): labels1.update(i) labels1 = list(labels1) labels1.sort() labels = set() for k,v in tot_bins.items(): #print(v) tmp = k.split(" | ") tmp.remove("") labels.update(tmp) labels = list(labels) labels.sort() print(labels1) print("------") print(labels) assert labels == labels1 del labels1 ############################################################# ## Functions def calc_real_acc(yt,tmp_val): return np.sum(yt == np.round(tmp_val))/(yt.shape[0] * yt.shape[1]) def print_function(name,x,y): print(name,"||",sep=" ", end=" ") for i in range(len(x)): print(x[i], np.round(y[i],4),"|",sep=" ", end=" ") print("") try: print("average:", np.average(y)) except: print("average:", np.average(y[1:])) print("\n") def calc_score(yt,tmp_val,funk): out = [] for i in range(len(yt)): indx = np.sum(yt[i],axis=-1) ind = indx > 0 out.append(np.average(funk(tmp_val[i][ind], yt[i][ind]))) return out def calc_score_wzero(yt,tmp_val,funk): out = [] out0 = [] for i in range(len(yt)): indx = np.sum(yt[i],axis=-1) ind = indx > 0 ind0 = indx == 0 out.append(funk(yt[i][ind], tmp_val[i][ind])) if np.sum(ind0) > 0: out0.append(funk(yt[i][ind0], tmp_val[i][ind0])) if np.sum(ind0) == 0: out0.append([]) return out, out0 def calc_roc(yt,tmp_val,funk): out = [] out0 = [] for i in range(len(yt)): indx = np.sum(yt[i],axis=-1) ind = indx > 0 out.append(funk(yt[i][ind], tmp_val[i][ind])) out0.append(funk(yt[i], tmp_val[i])) return out, out0 def calc_score_wzero_round(yt,tmp_val,funk): out = [] out0 = [] for i in range(len(yt)): indx = np.sum(yt[i],axis=-1) ind = indx > 0 ind0 = indx == 0 out.append(funk(yt[i][ind], np.round(tmp_val[i][ind]))) if np.sum(ind0) > 0: out0.append(funk(yt[i][ind0], np.round(tmp_val[i][ind0]))) if np.sum(ind0) == 0: out0.append([]) return out, out0 def per_pred(yv,tmp_val,funk, name): mccs = [] for iq in range(len(yv)): mccs.append([funk(yv[iq][:,iqq],np.round(tmp_val[iq][:,iqq])) for iqq in range(len(yv[iq][0]))]) for iq in range(len(mccs)): print(level_names[iq]) for iqq in mccs[iq]: print(np.round(iqq,4), sep=" ", end=" ") print("") all_mcc = [] for iq in mccs: all_mcc += iq all_mcc1 = np.prod(all_mcc) all_mcc2 = np.average(all_mcc) print("\naverage {}:".format(name), all_mcc2, "| prod", all_mcc1) print("\naverage {} for leaves:".format(name), np.average(all_mcc[-len(labels):]), "| prod", np.prod(all_mcc[-len(labels):])) return all_mcc2 def per_pred2(yv,tmp_val,funk, name): mccs = [] for iq in range(len(yv)): mccs.append([funk(yv[iq][:,iqq],np.round(tmp_val[iq][:,iqq])) for iqq in range(len(yv[iq][0]))]) for iq in range(len(mccs)): print(level_names[iq]) for iqq in mccs[iq]: print(np.round(iqq,4), sep=" ", end=" ") print("") all_mcc = [] for iq in mccs: all_mcc += iq all_mcc1 = np.prod(all_mcc) all_mcc2 = np.average(all_mcc) #print("\naverage {}:".format(name), all_mcc2, "| prod", all_mcc1) #print("\naverage {} for leaves:".format(name), np.average(all_mcc[-len(labels):]), "| prod", np.prod(all_mcc[-len(labels):])) return all_mcc2 def printer_stuff(yv,xv,modd): tmp_val = modd.predict(xv) val_loss = [losser(yv[iq],tmp_val[iq]).numpy() for iq in range(len(yv))] print_function("val_loss",level_names,val_loss) val_acc = [accuracy_score(yv[iq],np.round(tmp_val[iq])) for iq in range(len(yv))] print_function("val_exact_ACC",level_names,val_acc) ac1, ac2 = calc_score_wzero_round(yv,tmp_val,accuracy_score) print_function("exact_acc_labels",level_names,ac1) print_function("exact_acc_zeros",level_names,ac2) print_function("TP_ranked",level_names,calc_score(yv,tmp_val,estimate_acc)) ac1, ac2 = calc_score_wzero(yv,tmp_val,calc_real_acc) print_function("real_acc_labels",level_names,ac1) print_function("real_acc_zeros",level_names,ac2) roc1, roc0 = calc_roc(yv,tmp_val,roc_auc_score) print_function("roc_labels",level_names,roc1) print_function("roc_with_zeros",level_names,roc0) _ = per_pred(yv,tmp_val,precision_score,"PREC") _ = per_pred(yv,tmp_val,recall_score,"REC") _ = per_pred(yv,tmp_val,f1_score,"F1") _ = per_pred(yv,tmp_val,cohen_kappa_score,"KAPPA") all_mcc2 = per_pred(yv,tmp_val,matthews_corrcoef,"MCC") ### Functions for sequence encoding def making_ys(activity,levels): lvls = [] for l in levels: lvls.append([]) for j,l in enumerate(levels): if len(l) == 2: lab = np.zeros((len(l),)) for jj,ll in enumerate(l): if activity in ll: lab[jj] = 1 lvls[j].append(lab) if len(l) == 1: lab = np.zeros((len(l[0]),)) if activity in l[0]: lab[l[0].index(activity)] = 1 lvls[j].append(lab) return lvls def encode_seqs(sq_dct, encoder, max_, voc, ac_over, levels): lnv = len(voc) #dims = len(ac_over) alsqs = [] y_list = [] x_list = [] for sq in sq_dct: tmp = [] for ii in encoder[sq]: tmp2 = making_ys(ii, levels) if len(tmp) == 0: for iii in tmp2: tmp.append(iii) else: for iii in range(len(tmp2)): #print(sq,tmp[iii]) tmp[iii][0] += tmp2[iii][0] for ii in tmp: ii[0][ii[0] > 0] = 1 y_list.append(tmp) diff = max_ - len(sq) if diff % 2 == 0: tmps = "9"*int(diff/2) + sq + "9"*int(diff/2) if diff % 2 != 0: tmps = "9"*int((diff-1)/2) + sq + "9"*int((diff-1)/2 + 1) #tmps = sq + "9"*int(diff) alsqs.append(sq) tmp_x = np.zeros((max_,lnv)) for ii in range(len(tmp_x)): if tmps[ii] in voc: tmp_x[ii][voc.index(tmps[ii])] = 1. x_list.append([tmp_x.flatten()]) return np.concatenate(x_list,axis=0), y_list, alsqs def folder(folder, tot_bins): train_to_encode = [] val_to_encode = [] test_to_encode = [] for k,v in tot_bins.items(): for i in folder[-1]: train_to_encode += v[i] val_to_encode += v[folder[0][0]] test_to_encode += v[folder[1][0]] return train_to_encode, val_to_encode, test_to_encode #### def make_rn(x): rn = np.arange(len(x)) np.random.shuffle(rn) return rn def res(X): X = X.reshape((len(X),len(X[0]),1)) return X def y_sets(y,levels): lvls = [[] for i in levels] for j,i in enumerate(y): for jj,ii in enumerate(i): lvls[jj].append(ii) for j,i in enumerate(lvls): lvls[j] = np.concatenate(lvls[j],axis=0) return lvls def sorter(a,b): c = list(zip(a,b)) c.sort() a1,b1 = zip(*c) b1 = list(b1[::-1]) a1 = list(a1[::-1]) return a1, b1 def estimate_acc(pred,y): acc = [] for i in range(len(y)): a,b = sorter(pred[i],np.arange(len(pred[i]))) a1,b1 = sorter(y[i],np.arange(len(y[i]))) ln = len(y[i][y[i] > 0]) ac = len(set(b1[:ln]).intersection(set(b[:ln])))/len(b1[:ln]) acc.append(ac) return acc binary_cross = BinaryCrossentropy()#reduction="sum") binnz = K.binary_crossentropy def mcc_norm_rev_sumXxX(y_true, y_pred): def mcc_loss_binary_mean_cor(y_true, y_pred): y = K.sum(K.cast(y_true, 'float32'), axis=0) q = K.cast(K.equal(y/K.cast(K.shape(y_true)[0],'float32'),1),'float32') q_ = K.cast(K.equal(y/K.cast(K.shape(y_true)[0],'float32'),0),'float32') yh = K.sum(K.cast(y_pred, 'float32'), axis=0) qq = K.cast(K.equal(yh/K.cast(K.shape(y_true)[0],'float32'),1),'float32') qq_ = K.cast(K.equal(yh/K.cast(K.shape(y_true)[0],'float32'),0),'float32') e_ = K.sum(K.cast(K.abs(y_true-y_pred), 'float32'), axis=0) e = K.cast(K.not_equal(e_,0),'float32') tp = K.clip(K.sum(K.cast(y_true*y_pred, 'float32'), axis=0),K.clip(q_,0,1), K.cast(K.shape(y_true)[0],'float32')) tn = K.clip(K.sum(K.cast((1-y_true)*(1-y_pred), 'float32'), axis=0),K.clip(q,0,1), K.cast(K.shape(y_true)[0],'float32')) fp = K.clip(K.sum(K.cast((1-y_true)*y_pred, 'float32'), axis=0),K.clip(qq_,0,1), K.cast(K.shape(y_true)[0],'float32')) fn = K.clip(K.sum(K.cast(y_true*(1-y_pred), 'float32'), axis=0),K.clip(qq,0,1), K.cast(K.shape(y_true)[0],'float32')) up = tp*tn - fp*fn down = K.sqrt((tp+fp) * (tp+fn) * (tn+fp) * (tn+fn)) mcc = up / down return (1-mcc)*e e_ = K.sum(K.cast(K.abs(y_true-y_pred), 'float32'), axis=0) e = K.cast(K.equal(e_,K.cast(K.shape(y_true)[0],'float32')),'float32') e = e * 2 m1 = mcc_loss_binary_mean_cor(y_true, y_pred) return K.clip(m1,e,2) def upper_loss(y_true, y_pred): y_pred = K.cast(y_pred, 'float32') y_true = K.cast(y_true, 'float32') return K.sum(mcc_norm_rev_sumXxX(y_true, y_pred)) def loss_1(y_true, y_pred): y_pred = K.cast(y_pred, 'float32') y_true = K.cast(y_true, 'float32') return K.sum(K.mean(binnz(y_true, y_pred),axis=0)+mcc_norm_rev_sumXxX(y_true, y_pred)) #return K.sum(K.mean(binnz(y_true, y_pred)+mcc_norm_rev_sumXxX(y_true, y_pred),axis=0)) #return K.square(mcc_norm_rev_sumXxX(y_true, y_pred)) ############################################################# #### Intializing the network init3 = RandomUniform(minval=-0.001, maxval=0.001, seed=seed_val) init4 = Constant(1) init5 = RandomUniform(minval=0.001, maxval=0.05, seed=seed_val) init6 = RandomUniform(minval=-1, maxval=1, seed=seed_val) init7 = Constant(0.001) def max_sec_ax_keep_dims(inp): return K.max(inp,axis=-2, keepdims=True) def divider(inp): #return inp / (K.max(K.abs(inp),axis=-1, keepdims=True) + K.epsilon()) return inp / (K.sum(K.abs(inp),axis=-1, keepdims=True) + K.epsilon()) def bottum_up(inp): pred = K.max(inp, axis=-1, keepdims=True) return pred def small_cnn(x,kernels,LR,init2): l1x = [] l2_reg = 0.0 drop = 0.5 for i in [4,6,10,16,22,30,40]: cxc = len(vocab) x4 = Conv1D(kernels,kernel_size=cxc*i, strides=cxc, padding="valid", activation=LR,kernel_initializer=init2, use_bias=False)(x) x4 = PReLU(alpha_initializer=Constant(value=0.3))(x4) x4 = Lambda(max_sec_ax_keep_dims)(x4) l1x.append(x4) x4 = Concatenate(axis=-2)(l1x) z41x = Flatten()(x4) z41x = Lambda(divider)(z41x) z41 = Dropout(0.2)(z41x) z42 = Dense(500, activation='linear',kernel_initializer=init6, use_bias=True)(z41) z42 = PReLU(alpha_initializer=Constant(value=0.3))(z42) #z42 = Lambda(divider)(z42) #z42x = Concatenate()([z41x, z42]) z42 = Dropout(drop)(z42) z43 = Dense(500, activation='linear',kernel_initializer=init6, use_bias=True)(z42) z43 = PReLU(alpha_initializer=Constant(value=0.3))(z43) #z43 = Lambda(divider)(z43) #z43x = Concatenate()([z42x, z43]) z43 = Dropout(drop)(z43) z44 = Dense(500, activation='linear',kernel_initializer=init6, use_bias=True)(z43) z44 = PReLU(alpha_initializer=Constant(value=0.3))(z44) #z44 = Lambda(divider)(z44) #z44x = Concatenate()([z43x, z44]) z4 = Dropout(drop)(z44) return z4 def activation3(x): #return K.relu((x-0.5)*2) #return K.relu(x, threshold=0.5) return K.relu(x/0.5-0.5,max_value=1) inputs = Input(shape=(len(vocab)*200,1)) x = inputs xx = Flatten()(x) init2 = "orthogonal" name1 = "fold1_" kernels = 40 LR = "linear" l2_reg = 0.0 z4 = small_cnn(x,kernels,LR,init2) lvl3_1 = Dense(len(levels[4][0]), activation='sigmoid',kernel_initializer=init5, use_bias=True, name="outputs5") outputs5 = lvl3_1(z4) #outputs5 = Lambda(activation3)(outputs5) z4 = small_cnn(x,kernels,LR,init2) lvl3_1 = Dense(len(levels[5][0]), activation='sigmoid',kernel_initializer=init5, use_bias=True, name="outputs6") outputs6 = lvl3_1(z4) #outputs6 = Lambda(activation3)(outputs6) z7 = small_cnn(x,kernels,LR,init2) lvl3_2 = Dense(len(levels[6][0]), activation='sigmoid',kernel_initializer=init5, use_bias=True, name="outputs7") outputs7 = lvl3_2(z7) #outputs7 = Lambda(activation3)(outputs7) z5 = small_cnn(x,kernels,LR,init2) lvl3_3 = Dense(len(levels[7][0]), activation='sigmoid',kernel_initializer=init5, use_bias=True, name="outputs8") outputs8 = lvl3_3(z5) #outputs8 = Lambda(activation3)(outputs8) z6 = small_cnn(x,kernels,LR,init2) lvl3_4 = Dense(len(levels[8][0]), activation='sigmoid',kernel_initializer=init5, use_bias=True, name="outputs9") outputs9 = lvl3_4(z6) #outputs9 = Lambda(activation3)(outputs9) outputs51 = Lambda(bottum_up)(outputs8) outputs52 = Lambda(bottum_up)(outputs9) outputs4 = Concatenate(axis=-1)([outputs51,outputs52]) outputs31 = Lambda(bottum_up)(outputs7) outputs32 = Lambda(bottum_up)(outputs4) outputs3 = Concatenate(axis=-1)([outputs31,outputs32]) outputs21 = Lambda(bottum_up)(outputs5) outputs22 = Lambda(bottum_up)(outputs6) outputs2 = Concatenate(axis=-1)([outputs21,outputs22]) outputs11 = Lambda(bottum_up)(outputs2) outputs12 = Lambda(bottum_up)(outputs3) outputs1 = Concatenate(axis=-1)([outputs11,outputs12]) outputs = [outputs1,outputs2,outputs3,outputs4,outputs5,outputs6,outputs7, outputs8, outputs9] def special_loss_mean_n_sum(y_true, y_pred): y_true = K.cast(y_true, "float32") y_pred = K.cast(y_pred, "float32") return K.sum(K.mean(binnz(y_true, y_pred)+mcc_norm_rev_sumXxX(y_true, y_pred),axis=0)) def mena_binn_loss(y_true, y_pred): y_true = K.cast(y_true, "float32") y_pred = K.cast(y_pred, "float32") return K.sum(K.mean(binnz(y_true, y_pred), axis=0)) losser = special_loss_mean_n_sum losses = [loss_1 for i in levels] #losses = [upper_loss,upper_loss,upper_loss,upper_loss, loss_1,loss_1,loss_1,loss_1,loss_1] #losses = [upper_loss,upper_loss,upper_loss,upper_loss, upper_loss,upper_loss,upper_loss,upper_loss,upper_loss] lossesx = [mena_binn_loss for i in levels] train_losses = [loss_1 for i in levels] #train_losses = [upper_loss,upper_loss,upper_loss,upper_loss, loss_1,loss_1,loss_1,loss_1,loss_1] #train_losses = [upper_loss,upper_loss,upper_loss,upper_loss, upper_loss,upper_loss,upper_loss,upper_loss,upper_loss] opt = Adam(learning_rate=0.0005) decoderx = Model(inputs, outputs) decoderx.compile(optimizer=opt, loss=train_losses, loss_weights=[1,1,1,1, 1,1,1,1,1]) decoderx.summary() ############################################################# #### Running the network accc = 100000. toxl = 100000. ambl = 100000. pepl = 100000. hypl = 100000. enzl = 100000. total_loss = 100000 level_names = ["lvl1", "lvl2_1", "lvl2_2","lvl3", "lvl4_1", "lvl4_2", "lvl4_3", "lvl4_4", "lvl4_5"] ws = decoderx.get_weights() start_ws = ws.copy() order = np.arange(len(levels)) breaker = 0 losseZ = [] losseZ_train = [] for fs in range(len(folds)):#2,3):#len(folds)): accc = 100000. toxl = 100000. ambl = 100000. pepl = 100000. hypl = 100000. enzl = 100000. total_loss = 100000 train_to_encode, val_to_encode, test_to_encode = folder(folds[fs], tot_bins) xtr, ytr, xtrsq = encode_seqs(train_to_encode,encoder, 200, vocab, labels,levels) xv, yv, xvsq = encode_seqs(val_to_encode,encoder, 200, vocab, labels,levels) xt, yt ,xtsq = encode_seqs(test_to_encode,encoder, 200, vocab, labels,levels) print(ytr[:10]) tmp = [] for i in [ytr,yv,yt]: tmp.append(y_sets(i,levels)) ytr,yv,yt = tmp with open("numpy_mullab_data_tree_final_{}.pkl".format(fs),"wb") as f: pickle.dump([xtr, ytr, xtrsq, xv, yv, xvsq, xt, yt ,xtsq], f) print("numpy data saved") tmpenc = [xtr,xv,xt] tmpsq = [xtrsq,xvsq,xtsq] for i in range(3): assert len(tmpenc[i]) == len(tmpsq[i]) for ii in range(len(tmpenc[i])): assert len(tmpsq[i][ii]) == np.sum(tmpenc[i][ii]) del(tmpenc) del(tmpsq) rntr = make_rn(xtr) rnv = make_rn(xv) rnt = make_rn(xt) all_ys = [i[rntr] for i in ytr] xtr = res(xtr) xv = res(xv) xt = res(xt) print(xtr.shape) for i in (ytr): print(i.shape) print("\n") print(xv.shape) for i in (yv): print(i.shape) print("\n") print(xt.shape) for i in (yt): print(i.shape) decoderx.set_weights(start_ws) name1 = "fold_"+str(fs)+"_save_model_based_on_MCC_loss_and_bin_" for i in range(500): print("\nEPOCH", i) decoderx.fit(xtr[rntr], all_ys, verbose=0, #validation_data=(xv, yv), epochs=1, batch_size=128, use_multiprocessing=True, workers=2)#, class_weight=wdct)#,callbacks=my_callbacks) rntr = make_rn(xtr) all_ys = [i[rntr] for i in ytr] start = time.time() tmp_val = decoderx.predict(xv, batch_size=128)#, use_multiprocessing=True, workers=3) end = time.time() print(end - start) val_loss = [loss_1(yv[iq],tmp_val[iq]).numpy() for iq in range(len(yv))] val_loss_bin = [mena_binn_loss(yv[iq],tmp_val[iq]).numpy() for iq in range(len(yv))] print_function("val_loss_bin",level_names,val_loss_bin) print_function("val_loss",level_names,val_loss) losseZ.append([val_loss, val_loss_bin]) av_loss = np.average(val_loss[4:]) ww = decoderx.get_weights() val_loss_bin = val_loss print("\n") all_mcc2 = per_pred(yv,tmp_val,matthews_corrcoef,"VAL_MCC") if val_loss_bin[4] < toxl: print("\n\tsaving best tox_hem model",val_loss_bin[4]) decoderx.save_weights(name1+"best_toxhem_plusMCC5.h5") toxl = val_loss_bin[4] breaker = -1 ws[28:35] = ww[28:35] ws[49:56] = ww[49:56] ws[76] = ww[76] ws[77] = ww[77] ws[82] = ww[82] ws[91:93] = ww[91:93] ws[97] = ww[97] ws[106:108] = ww[106:108] ws[112] = ww[112] ws[119:121] = ww[119:121] if val_loss_bin[5] < ambl: print("\n\tsaving best ambl model",val_loss_bin[5]) decoderx.save_weights(name1+"best_ambl_plusMCC5.h5") ambl = val_loss_bin[5] breaker = -1 ws[35:42] = ww[35:42] ws[56:63] = ww[56:63] ws[78] = ww[78] ws[79] = ww[79] ws[83] = ww[83] ws[93:95] = ww[93:95] ws[98] = ww[98] ws[108:110] = ww[108:110] ws[113] = ww[113] ws[121:123] = ww[121:123] if val_loss_bin[6] < pepl: print("\n\tsaving best pepl model",val_loss_bin[6]) decoderx.save_weights(name1+"best_pepl_plusMCC5.h5") pepl = val_loss_bin[6] breaker = -1 ws[42:49] = ww[42:49] ws[63:70] = ww[63:70] ws[80] = ww[80] ws[81] = ww[81] ws[84] = ww[84] ws[95:97] = ww[95:97] ws[99] = ww[99] ws[110:112] = ww[110:112] ws[114] = ww[114] ws[123:125] = ww[123:125] if val_loss_bin[7] < hypl: print("\n\tsaving best hyp model",val_loss_bin[7]) decoderx.save_weights(name1+"best_hyp_plusMCC5.h5") hypl = val_loss_bin[7] breaker = -1 ws[7:14] = ww[7:14] ws[21:28] = ww[21:28] ws[72] = ww[72] ws[73] = ww[73] ws[75] = ww[75] ws[87:89] = ww[87:89] ws[90] = ww[90] ws[102:104] = ww[102:104] ws[105] = ww[105] ws[117:119] = ww[117:119] if val_loss_bin[8] < enzl: print("\n\tsaving best enz model",val_loss_bin[8]) decoderx.save_weights(name1+"best_enz_plusMCC5.h5") enzl = val_loss_bin[8] breaker = -1 ws[:7] = ww[:7] ws[14:21] = ww[14:21] ws[70] = ww[70] ws[71] = ww[71] ws[74] = ww[74] ws[85:87] = ww[85:87] ws[89] = ww[89] ws[100:102] = ww[100:102] ws[104] = ww[104] ws[115:117] = ww[115:117] if np.sum(val_loss_bin) < total_loss: total_loss = np.sum(val_loss_bin) print("\n\tsaving best overal best model",np.sum(val_loss_bin)) decoderx.save_weights(name1+"best_overall_best_plusMCC5.h5") with open(name1+"best_all_plusMCC5.pkl", "wb") as f: pickle.dump(ws,f) #decoderx.set_weights(ws) with open(name1+"losses.pkl", "wb") as f: pickle.dump(losseZ,f) with open(name1+"losses_train.pkl", "wb") as f: pickle.dump(losseZ_train,f) breaker += 1 if breaker == 20: break print("\n")
31.014925
137
0.565327
738b796144ece0f93d6aef533820ee1526d4d85d
528
swift
Swift
Sources/Scenes/Photo Comments/Localization/STPhotoCommentsLocalization.swift
mikelanza/st-photo-details-ios
f551594939949f5be191e2fec01270c30ffba13c
[ "MIT" ]
1
2020-01-16T17:32:33.000Z
2020-01-16T17:32:33.000Z
Sources/Scenes/Photo Comments/Localization/STPhotoCommentsLocalization.swift
mikelanza/st-photo-details-ios
f551594939949f5be191e2fec01270c30ffba13c
[ "MIT" ]
null
null
null
Sources/Scenes/Photo Comments/Localization/STPhotoCommentsLocalization.swift
mikelanza/st-photo-details-ios
f551594939949f5be191e2fec01270c30ffba13c
[ "MIT" ]
null
null
null
// // STPhotoCommentsLocalization.swift // STPhotoDetails // // Created by Dimitri Strauneanu on 01/08/2019. // Copyright © 2019 Streetography. All rights reserved. // import Foundation class STPhotoCommentsLocalization { static let shared = STPhotoCommentsLocalization() private init() { } struct LocalizedKey { static let emptyStateText = "STPhotoComments.empty.state.text" } let emptyStateText = LocalizedKey.emptyStateText.localized(in: Bundle.module) }
21.12
81
0.685606
0ed29c4dec95e1d29f826a275551e9c0ca5d070a
389
tsx
TypeScript
packages/web/src/index.tsx
AZagatti/proffy
f3a49c4dedf6befb023474393fccdd400fa56f7b
[ "MIT" ]
2
2020-08-06T00:27:17.000Z
2020-08-10T01:44:04.000Z
packages/web/src/index.tsx
AZagatti/proffy
f3a49c4dedf6befb023474393fccdd400fa56f7b
[ "MIT" ]
2
2022-02-19T05:56:36.000Z
2022-02-27T09:28:00.000Z
packages/web/src/index.tsx
AZagatti/proffy
f3a49c4dedf6befb023474393fccdd400fa56f7b
[ "MIT" ]
2
2020-08-04T03:13:42.000Z
2020-08-10T01:44:08.000Z
import React from 'react'; import { render, hydrate } from 'react-dom'; import App from './App'; const rootElement = document.getElementById('root'); if (rootElement?.hasChildNodes()) { hydrate( <React.StrictMode> <App /> </React.StrictMode>, rootElement, ); } else { render( <React.StrictMode> <App /> </React.StrictMode>, rootElement, ); }
16.913043
52
0.616967
0b7e90a5769d5e45dae418f0e034fd90269bdc99
711
py
Python
bermuda/demos/shape_options.py
glue-viz/bermuda
0bc26bac376d4f08a4964481d1f737f6deb86270
[ "BSD-3-Clause" ]
1
2018-07-20T21:09:46.000Z
2018-07-20T21:09:46.000Z
bermuda/demos/shape_options.py
glue-viz/bermuda
0bc26bac376d4f08a4964481d1f737f6deb86270
[ "BSD-3-Clause" ]
null
null
null
bermuda/demos/shape_options.py
glue-viz/bermuda
0bc26bac376d4f08a4964481d1f737f6deb86270
[ "BSD-3-Clause" ]
1
2018-07-20T21:15:41.000Z
2018-07-20T21:15:41.000Z
import matplotlib.pyplt as plt from bermuda import ellipse, polygon, rectangle plt.plot([1,2,3], [2,3,4]) ax = plg.gca() # default choices for everything e = ellipse(ax) # custom position, genric interface for all shapes e = ellipse(ax, bbox = (x, y, w, h, theta)) e = ellipse(ax, cen=(x, y), width=w, height=h, theta=theta) # force square/circle? e = ellipse(ax, aspect_equal=True) # freeze properties? e = ellipse(ax, width=1, height=2, aspect_frozen = True) e = ellipse(ax, rotation_frozen=True) e = ellipse(ax, center_frozen=True) e = ellipse(ax, size_frozen=True) # all of these kwargs should be settable properties as well e.bbox = (x, y, w, h, theta) e.aspect_equal = True e.aspect_frozen = True
24.517241
59
0.707454
0edf81984dd66be912c340e6064f879689aa9293
187
ts
TypeScript
typescript/src/server.ts
subarusakaguchi/learning-nodejs-rocketseat
72aed64377306d93f314d70f8e307abb8c3494a3
[ "MIT" ]
null
null
null
typescript/src/server.ts
subarusakaguchi/learning-nodejs-rocketseat
72aed64377306d93f314d70f8e307abb8c3494a3
[ "MIT" ]
null
null
null
typescript/src/server.ts
subarusakaguchi/learning-nodejs-rocketseat
72aed64377306d93f314d70f8e307abb8c3494a3
[ "MIT" ]
null
null
null
import express from 'express' import { createCourse } from './routes' const app = express() app.get('/', createCourse) app.listen(3000, () => console.log('Server running on port 3000'))
26.714286
66
0.700535
40d09c34a2677918b5754d8d250071181146f110
551
py
Python
hqca/acse/__init__.py
damazz/HQCA
b013ba68f86e42350913c4abc2e1c91695a429b7
[ "Apache-2.0" ]
null
null
null
hqca/acse/__init__.py
damazz/HQCA
b013ba68f86e42350913c4abc2e1c91695a429b7
[ "Apache-2.0" ]
null
null
null
hqca/acse/__init__.py
damazz/HQCA
b013ba68f86e42350913c4abc2e1c91695a429b7
[ "Apache-2.0" ]
1
2021-08-10T00:20:09.000Z
2021-08-10T00:20:09.000Z
from hqca.acse._store_acse import * from hqca.acse.acse import * from hqca.tomography import * from hqca.core._quantum_storage import * from hqca.transforms import * from hqca.instructions import * from hqca.processes import * __all__ = [ 'StorageACSE', 'RunACSE', 'QuantumStorage', 'StandardTomography', 'QubitTomography', 'ReducedTomography', 'ReducedQubitTomography', 'JordanWigner', 'Parity', 'BravyiKitaev', 'PauliSet', 'StandardProcess', ]
23.956522
40
0.627949
725366889b0722a4a81c254fbb49331a93fd78a2
984
rs
Rust
entity/src/app.rs
cuckooemm/config
4a10b5b7be0d84062abc2fd77aa471820b8dc822
[ "MIT" ]
null
null
null
entity/src/app.rs
cuckooemm/config
4a10b5b7be0d84062abc2fd77aa471820b8dc822
[ "MIT" ]
null
null
null
entity/src/app.rs
cuckooemm/config
4a10b5b7be0d84062abc2fd77aa471820b8dc822
[ "MIT" ]
null
null
null
use sea_orm::{entity::prelude::*, FromQueryResult}; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Deserialize, Serialize)] #[sea_orm(table_name = "app")] pub struct Model { #[sea_orm(primary_key)] #[serde(skip)] pub id: u32, pub app_id: String, // app 唯一 ID pub name: String, // app name pub org_id: u32, // 部门 ID pub creator_user: u32, // 创建者ID pub deleted_at: u64, // 删除时间 为0则未删除 pub created_at: DateTimeWithTimeZone, // 创建时间 pub updated_at: DateTimeWithTimeZone, // 更新时间 } #[derive(Copy, Clone, Debug, EnumIter)] pub enum Relation {} impl RelationTrait for Relation { fn def(&self) -> RelationDef { panic!("No RelationDef") } } impl ActiveModelBehavior for ActiveModel {} #[derive(FromQueryResult, Serialize, Debug)] pub struct AppItem { pub app_id: String, pub name: String, }
28.941176
77
0.612805
cb2781667c669990f22945581243148ab1ef6072
446
asm
Assembly
programs/oeis/101/A101256.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/101/A101256.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
programs/oeis/101/A101256.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
; A101256: Sum of composites <= n. ; 0,0,0,4,4,10,10,18,27,37,37,49,49,63,78,94,94,112,112,132,153,175,175,199,224,250,277,305,305,335,335,367,400,434,469,505,505,543,582,622,622,664,664,708,753,799,799,847,896,946,997,1049,1049,1103,1158,1214 mov $2,$0 mov $4,$0 lpb $2 mov $0,$4 sub $2,1 sub $0,$2 mov $3,$0 add $3,2 cal $0,10051 ; Characteristic function of primes: 1 if n is prime, else 0. gcd $3,$0 sub $3,1 add $1,$3 lpe
26.235294
208
0.641256
98b224a3023baf7aa92f2a2e1729286bd83c9a8c
19,114
html
HTML
elm-intro/index.html
vjousse/talks
1987cd46204521eb1aa3a72d767c78435fa9dec3
[ "MIT" ]
null
null
null
elm-intro/index.html
vjousse/talks
1987cd46204521eb1aa3a72d767c78435fa9dec3
[ "MIT" ]
null
null
null
elm-intro/index.html
vjousse/talks
1987cd46204521eb1aa3a72d767c78435fa9dec3
[ "MIT" ]
null
null
null
<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <title>Elm : la prog frontend réinventée</title> <link rel="stylesheet" href="css/reveal.css"> <link rel="stylesheet" href="css/custom.css"> <link rel="stylesheet" href="css/theme/blood.css"> <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css"> <!-- Theme used for syntax highlighting of code --> <link rel="stylesheet" href="lib/css/zenburn.css"> <!-- Printing and PDF exports --> <script> var link = document.createElement( 'link' ); link.rel = 'stylesheet'; link.type = 'text/css'; link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css'; document.getElementsByTagName( 'head' )[0].appendChild( link ); </script> </head> <body> <div class="reveal"> <div class="slides"> <section> <h1>Elm</h1> <h2>La prog frontend réinventée</h2> <h4> <small>Préparé avec <i id="heart" class="fa fa-heart" aria-hidden="true"></i> par <a href="http://vincent.jousse.org">Vincent Jousse</a><br /><a href="http://twitter.com/vjousse">@vjousse</a> / <a href="mailto:v.jousse@allo-media.fr">v.jousse@allo-media.fr</a></small> </h4> </section> <section> <img src="images/logo_allomedia_typo_blanche.png" style="width: 50%;"/> <h4>Directeur Technique</h4> <ul> <li>Voix sur IP</li> <li>Reconnaissance automatique de la parole</li> <li>Machine learning</li> </ul> </section> <section> <section> <h2>J'aime pas la prog frontend</h2> <p class="fragment"> … et pourtant j'ai essayé. </p> </section> <section> <h2>DE 1999 à 2015</h2> <ul> <li>DHTML</li> <li>script.aculo.us</li> <li>Ajax</li> <li>jQuery</li> <li>Angular</li> <li>Mithril.js</li> <li>…</li> </ul> <p class="fragment">Saurez-vous trouver le <strong class="red">Single Point of Failure</strong> ?</p> </section> <section> <img src="images/logo_javascript.png" /> <p>Et l'écosystème qui va avec :<br />ni l'un ni l'autre ne <strong>me</strong> conviennent.</p> </section> <section> <pre><code data-trim data-noescape> 1 == 1; //true 'foo' == 'foo'; //true [1,2,3] == [1,2,3]; //false new Array(3) == ",,"; //true </code></pre> <img class="fragment" src="images/undefined_is_not.jpg" /> </section> <section> <p>C'est trop le foutoir pour moi :-)</p> <p class="fragment">Pourquoi me laisser faire ?!</p> </section> </section> <section> <h2>Mais ça c'était avant …</h2> <h2 class="fragment">la découverte d'Elm</h2> </section> <section> <section> <h2>A delightful language for reliable webapps.</h2> <p>Generate JavaScript with great performance and no runtime exceptions.</p> </section> <section> <p>Un langage <strong>fonctionnel</strong> et <strong>statiquement typé</strong></p> </section> <section> <h2>Fonctionnel</h2> <p>Plein de gros mots:</p> <ul> <li>Plus de variables (immuabilités/immutabilité)</li> <li>Fonctions pures</li> <li>Transparence référentielle</li> <li>Pas d'effets de bord</li> </ul> </section> <section> <h2>Fortement et statiquement typé</h2> <p>En résumé : le compilateur est votre nouvel ami.</p> </section> <section> <p>Mais aussi et surtout : <strong>une architecture</strong></p> </section> <section> <img src="images/elm-pattern.png" /> </section> </section> <section> <section> <h2>Pas d'exceptions</h2> <pre><code data-trim data-noescape class="elm fragment"> numbers = [ 1, 2, 3 ] first = List.head numbers doubleFirst = first * 2 </code></pre> <p class="fragment">Votre premier code <strong>Elm</strong> :')</p> </section> <section> <p>Et si la liste est vide ?</p> <pre><code data-trim data-noescape class="elm"> numbers = [ ] first = List.head numbers doubleFirst = first * 2 </code></pre> </section> <section> <pre><code data-trim data-noescape class="elm"> numbers = [ ] first = List.head numbers doubleFirst = first * 2 </code></pre> <h2>En JS</h2> <pre><code data-trim data-noescape class="javascript"> NaN </code></pre> <p>AND HAVE FUN!</p> </section> <section> <pre><code data-trim data-noescape class="elm"> numbers = [ ] first = List.head numbers doubleFirst = first * 2 </code></pre> <h2>En Ruby</h2> <pre><code data-trim data-noescape class="ruby"> NoMethodError: undefined method `*' for nil:NilClass </code></pre> <p>BIEN MAIS PAS TOP</p> </section> <section> <h2>En Elm</h2> <img class="fragment" src="images/elm-compile-error.png" /> </section> <section> <pre><code data-trim data-noescape class="elm"> numbers = [ ] first = Maybe.withDefault 0 (List.head numbers) doubleFirst = first * 2 </code></pre> <p>Elm vous force à gérer ce cas là.</p> </section> </section> <section> <section> <h2>Un compilateur utile</h2> <p>car compréhensible</p> </section> <section> <pre><code data-trim data-noescape class="elm"> numbers = [ ] first = Maybe.withDefaul 0 (List.head numbers) doubleFirst = first * 2 </code></pre> </section> <section> <img src="images/elm-suggestion.png" /> </section> </section> <section> <h2>Si ça compile, c'est que ça marche</h2> <ul> <li>Pas de null pointer</li> <li>Pas d'erreur de typo</li> <li>Vive le refactoring</li> </ul> </section> <section> <section> <h2>Et en plus c'est rapide</h2> </section> <section> <img src="images/elm-performance.png" /> </section> </section> <section> <section> <h2>Et en cas de coup dur</h2> </section> <section> <h3>Ça s'intègre à du JS</h3> <img src="images/elm-js.png" /> </section> </section> <section> <h2>La cerise sur le gâteau</h2> <p class="fragment">C'est beginner friendly :-)</p> </section> <section> <h2>LA QUESTION QUI TUE</h2> <p class="fragment">C'est utilisé en production ton truc ?</p> <p class="fragment">Il parait que oui …</p> </section> <section> <img src="images/logo_allomedia_typo_blanche.png"/> </section> <section> <img src="images/nuage_juppe.png" /> </section> <section> <h1>Un peu de <span style="white-space: nowrap;">fonctionnel</span></h1> </section> <section> <section> <h1>De quoi parle-t-on ?</h1> </section> <section> <p>« La <strong>programmation fonctionnelle</strong> est un <strong>paradigme de programmation</strong> qui considère le calcul en tant qu'évaluation de fonctions mathématiques et <strong>rejette le changement d'état et la mutation des données</strong>.</p><p>Elle souligne <strong>l'application des fonctions</strong>, contrairement au modèle de programmation impérative qui met en avant <strong>les changements d'état</strong>. »</p> </section> <section> <h1>Et pourquoi en parle-t-on maintenant ?</h1> </section> <section> <h2>Ça date !</h2> <ul> <li>Lisp (1958), ML (1973)</li> <li class="fragment">Mais ça revient à la mode !</li> <li class="fragment">Erlang (1995), Scala (2003), F# (2005), Clojure (2007), Elm (2012), Elixir (2012), ReasonML (2016), …</li> </ul> </section> <section> <h2>Exemples</h2> <ul> <li>Le chat Facebook (ejabberd) : <span class="fragment"><strong class="orange">Erlang</strong></span></li> <li>WhatsApp : <span class="fragment"><strong class="orange">Erlang</strong></span></li> <li>Le moteur de recherche de Twitter : <span class="fragment"><strong class="orange">Scala</strong></span></li> <li>Serveur Call of Duty : <span class="fragment"><strong class="orange">Erlang</strong></span></li> <li>Ils utilisent Scala : <span class="fragment"><strong class="orange">Apple, Linkedin, Foursquare, Netflix, Tumblr, …</strong></span></li> <li><span class="fragment">…</span></li> </ul> </section> </section> <section> <section> <h3>Et pour de vrai ?</h3> <p style="padding-bottom: 30px" class="fragment">C'est une façon d'écrire des programmes en n'utilisant que des <em><strong>fonctions pures</strong></em>.</p> <h4 class="fragment">Qu'est-ce qu'une fonction pure ?</h4> <p style="padding-bottom: 30px" class="fragment">C'est une fonction sans <em><strong>effet de bord</strong></em> (side effect).</p> <h4 class="fragment">Qu'est-ce qu'une fonction avec effet de bord ?</h4> <p class="fragment">C'est une fonction qui fait autre chose que simplement <strong>retourner un résultat</strong>.</p> </section> <section> <h1>Mais <span style="white-space: nowrap;">concrêtement</span> ?</h1> </section> <section> <p>En fait, chaque fonction dispose de deux ensembles d'entrées/sorties : vous n'en êtes certainement pas conscient pour l'instant.</p> <p>Prenons <strong>un exemple</strong> :</p> <pre><code data-trim class="java"> public int square(int x) { return x * x; } </code></pre> <p class="fragment">=> Une entrée (les paramètres), une sortie (le return).</p> </section> <section> <p>Et dans cet exemple, quelles sont les entrées/sorties ?</p> <pre><code data-trim class="java"> public void processNext() { Message message = InboxQueue.popMessage(); if (message != null) { process(message); } } </code></pre> <p>=> Pas de paramètres, pas de return.</p> <p class="fragment">On parle ici d'<strong>effets de bord</strong> (« side-effects »)</p> </section> <section> <h2>Effet de bord = Complexité</h2> <pre><code data-trim class="java"> public void processMessage() {...} </code></pre> <ul class="fragment" style="padding-top:40px;"> <li>Aucune idée de ce que fait cette fonction !</li> <li>Code très difficile à comprendre/tester : il faut connaître le monde qui entoure la fonction.</li> </ul> </section> <section> <h2>Comment s'en débarrasser ?</h2> <p>En déterrant tous les effets de bord !</p> </section> <section> <h2>Un petit exemple</h2> <pre><code data-trim class="java"> public Program getCurrentProgram(TVGuide guide, int channel) { Schedule schedule = guide.getSchedule(channel); Program current = schedule.programAt(new Date()); return current; } </code></pre> <p>Êtes-vous capable de trouver l'effet de bord ?</p> <p>De quoi dépend cette fonction qui n'est pas spécifié en paramètre ?</p> </section> <section> <pre><code data-trim class="java"> public Program getProgramAt(TVGuide guide, int channel, Date when) { Schedule schedule = guide.getSchedule(channel); Program program = schedule.programAt(when); return program; } </code></pre> </section> <section> <h3>Désavantage</h3> <p style="padding-bottom: 20px;">Un paramètre en plus : c'est plus complexe</p> <div class="fragment"> <h3>Avantages</h3> <p>En fait, ce n'est pas plus complexe (au contraire)</p> <p>C'est beaucoup beaucoup plus facile à tester</p> <p>Il est plus facile de raisonner avec cette fonction</p> </div> </section> <section> <h3>Quelques exemples d'effets de bord</h3> <ul> <li>Modifier le contenu d'une structure de données</li> <li>Changer l'état d'un objet (setter)</li> <li>Retourner une exception</li> <li>Afficher quelque chose</li> <li>Lire ou écrire un fichier</li> <li>…</li> </ul> <p>On parle de <strong>transparence référentielle</strong></p> <p class="fragment" style="padding-top:30px;">Mais on ne peut plus rien faire ?!</p> <p class="fragment" style="padding-top:30px;">En fait si, mais il va falloir s'adapter.</p> </section> <section> <h2>Finalement, qu'est-ce qu'une <em>fonction pure</em> ?</h2> <p>On peut dire qu'une fonction est pure lorsque toutes ses entrées sont <strong>déclarées comme telles</strong> et lorsque toutes ses sorties le sont aussi.</p> </section> </section> <section> <h2>Comment boucler ?</h2> <h3>Java</h3> <pre><code data-trim class="java"> int i; for(i = 0; i &lt; myArray.length; i++) { myArray[i] = myArray[i] + 1 } </code></pre> <h3 style="padding-top: 60px" class="fragment">Elm</h3> <pre class="fragment"><code data-trim class="elm"> List.map (\x -> x + 1) myArray </code></pre> </section> <section> <h2>Comment accumuler ?</h2> <h3>Java</h3> <pre><code data-trim class="java"> int i; int acc = 0; for(i = 0; i &lt; myArray.length; i++) { acc = acc + myArray[i] } </code></pre> <h3 style="padding-top: 60px" class="fragment">Elm</h3> <pre class="fragment"><code data-trim class="elm"> List.foldl (\x y -> x + y) 0 myArray </code></pre> </section> <section> <h2>Des questions ?</h2> <p class="quote"><i class="icon-quote-left"></i><em>Fait à la main !</em><i class="icon-quote-right"></i></p> <ul> <li>Reveal.js <span><a href="http://lab.hakim.se/reveal-js/">http://lab.hakim.se/reveal-js/</a></span></li> <li>Font-awesome <span><a href="http://fontawesome.io">http://fontawesome.io</a></span></li> <li>Chromium</li> <li>Vim</li> <li>ArchLinux</li> </ul> <p style="text-align: center"><small><a href="mailto:v.jousse@allo-media.fr">v.jousse@allo-media.fr</a> / <a href="http://vincent.jousse.org">Vincent Jousse</a> / <a href="http://twitter.com/vjousse">@vjousse</a></small></p> </section> </div> </div> <script src="lib/js/head.min.js"></script> <script src="js/reveal.js"></script> <script> // More info https://github.com/hakimel/reveal.js#configuration Reveal.initialize({ history: true, // More info https://github.com/hakimel/reveal.js#dependencies dependencies: [ { src: 'plugin/markdown/marked.js' }, { src: 'plugin/markdown/markdown.js' }, { src: 'plugin/notes/notes.js', async: true }, { src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } } ] }); </script> </body> </html>
38.458753
459
0.467982
cda046807e310a19cc90d24a4face0ca1bd12d38
1,217
swift
Swift
BagOfTricks/IntegerEnum.swift
wildthink/BagOfTricks
3e93098db5a946e30507fe558eb29f75d6db8993
[ "MIT" ]
1
2016-12-19T04:31:14.000Z
2016-12-19T04:31:14.000Z
BagOfTricks/IntegerEnum.swift
wildthink/BagOfTricks
3e93098db5a946e30507fe558eb29f75d6db8993
[ "MIT" ]
null
null
null
BagOfTricks/IntegerEnum.swift
wildthink/BagOfTricks
3e93098db5a946e30507fe558eb29f75d6db8993
[ "MIT" ]
null
null
null
// // IntegerEnum.swift // BagOfTricks // // Created by Jason Jobe on 8/21/16. // Copyright © 2016 WildThink. All rights reserved. // import Foundation // Distilation of ideas and examples from these great contributions to the community // http://stackoverflow.com/questions/24007461/how-to-enumerate-an-enum-with-string-type // https://forums.developer.apple.com/thread/4404 // https://www.natashatherobot.com/swift-conform-to-sequence-protocol/ public protocol IntegerEnum { init? (rawValue: Int) static var firstRawValue: Int { get } } public extension IntegerEnum { static var firstRawValue: Int { return 0 } static var sequence: AnyIterator<Self> { var lastIteration = firstRawValue return AnyIterator { lastIteration += 1 return Self(rawValue: lastIteration - 1) } } } /** Example Use enum Suit: Int, IntegerEnum { case Hearts, Clubs, Diamonds, Spades } enum Size: Int, IntegerEnum { case Small, Medium, Large } for s in Suit.sequence { print (s) } for s in Size.sequence { print (s) } let a = Array(Suit.sequence) // [Hearts, Clubs, Diamonds, Spades] Size.sequence.reverse() // [Large, Medium, Small] */
22.127273
88
0.677075
7c1e471f7e3aa8fc4cabe6f22b2150edc42d061b
1,638
rs
Rust
aoc-2020-3/src/main.rs
rnestler/aoc-2020
266245f34594b9c82be49fa60865f3bdbb9087d2
[ "MIT" ]
1
2020-12-01T13:00:24.000Z
2020-12-01T13:00:24.000Z
aoc-2020-3/src/main.rs
rnestler/aoc-2020
266245f34594b9c82be49fa60865f3bdbb9087d2
[ "MIT" ]
null
null
null
aoc-2020-3/src/main.rs
rnestler/aoc-2020
266245f34594b9c82be49fa60865f3bdbb9087d2
[ "MIT" ]
null
null
null
use std::fs::File; use std::io::prelude::*; #[derive(Debug)] struct Map { trees: Vec<Vec<bool>>, } impl From<&str> for Map { fn from(value: &str) -> Map { let trees = value .lines() .map(|line| { line.bytes() .map(|byte| if byte == b'#' { true } else { false }) .collect() }) .collect(); Map { trees } } } impl Map { pub fn check_position(&self, x: usize, y: usize) -> bool { // we assume the map is rectangular let x = x % self.trees[0].len(); self.trees[y][x] } fn check_slope(&self, dx: usize, dy: usize) -> usize { let mut x = 0; let mut y = 0; let mut tree_count = 0; loop { if self.check_position(x, y) { tree_count += 1; } x += dx; y += dy; if y >= self.trees.len() { break; } } tree_count } fn part_1(&self) -> usize { self.check_slope(3, 1) } fn part_2(&self) -> usize { let slopes = [(1, 1), (3, 1), (5, 1), (7, 1), (1, 2)]; slopes.iter().fold(1, |product, slope| { product * self.check_slope(slope.0, slope.1) }) } } fn main() -> Result<(), Box<dyn std::error::Error>> { let mut file = File::open("input.txt")?; let mut contents = String::new(); file.read_to_string(&mut contents)?; let map = Map::from(contents.as_str()); println!("part1: {}", map.part_1()); println!("part1: {}", map.part_2()); Ok(()) }
23.4
72
0.448107
f036df0dcc80c87934635d8fb174672fa6d57d8c
4,804
js
JavaScript
src/competitionEngine/governors/competitionsGovernor/tournamentLinks.js
CourtHive/competitionFactory
dee35b7f93e29b2cc6f3dd0307622e548ffb4005
[ "MIT" ]
null
null
null
src/competitionEngine/governors/competitionsGovernor/tournamentLinks.js
CourtHive/competitionFactory
dee35b7f93e29b2cc6f3dd0307622e548ffb4005
[ "MIT" ]
null
null
null
src/competitionEngine/governors/competitionsGovernor/tournamentLinks.js
CourtHive/competitionFactory
dee35b7f93e29b2cc6f3dd0307622e548ffb4005
[ "MIT" ]
null
null
null
import { findTournamentExtension } from '../../../tournamentEngine/governors/queryGovernor/extensionQueries'; import { addExtension, removeExtension } from './competitionExtentions'; import { decorateResult } from '../../../global/functions/decorateResult'; import { addTournamentExtension, removeTournamentExtension, } from '../../../tournamentEngine/governors/tournamentGovernor/addRemoveExtensions'; import { LINKED_TOURNAMENTS } from '../../../constants/extensionConstants'; import { SUCCESS } from '../../../constants/resultConstants'; import { INVALID_VALUES, MISSING_TOURNAMENT_ID, MISSING_TOURNAMENT_RECORDS, } from '../../../constants/errorConditionConstants'; export function getLinkedTournamentIds({ tournamentRecords }) { if ( typeof tournamentRecords !== 'object' || !Object.keys(tournamentRecords).length ) return { error: MISSING_TOURNAMENT_RECORDS }; const linkedTournamentIds = Object.assign( {}, ...Object.keys(tournamentRecords).map((tournamentId) => { const tournamentRecord = tournamentRecords[tournamentId]; const touranmentId = tournamentRecord?.tournamentId; const { extension } = findTournamentExtension({ tournamentRecord, name: LINKED_TOURNAMENTS, }); const tournamentIds = (extension?.value?.tournamentIds || []).filter( (currentTournamentId) => currentTournamentId !== touranmentId ); return { [tournamentId]: tournamentIds }; }) ); return { linkedTournamentIds }; } /** * Links all tournaments which are currently loaded into competitionEngine state * * @param {object[]} tournamentRecords - provided by competitionEngine - all currently loaded tournamentRecords * @returns { success, error } */ export function linkTournaments({ tournamentRecords }) { if ( typeof tournamentRecords !== 'object' || !Object.keys(tournamentRecords).length ) return { error: MISSING_TOURNAMENT_RECORDS }; const { tournamentIds, error } = getTournamentIds(tournamentRecords); if (error) return { error }; if (tournamentIds?.length > 1) { const extension = { name: LINKED_TOURNAMENTS, value: { tournamentIds }, }; return addExtension({ tournamentRecords, extension }); } return { ...SUCCESS }; } export function unlinkTournaments({ tournamentRecords }) { if ( typeof tournamentRecords !== 'object' || !Object.keys(tournamentRecords).length ) return { error: MISSING_TOURNAMENT_RECORDS }; const result = removeExtension({ name: LINKED_TOURNAMENTS, tournamentRecords, }); // TODO: check the integrity of the venues attached to each tournment... // get all competitionScheduleMatchUps and ensure that each tournamentRecord has all venues for scheduled matchUps return decorateResult({ result, stack: 'unlinkTournaments' }); } export function unlinkTournament({ tournamentRecords, tournamentId }) { if (typeof tournamentRecords !== 'object') return { error: INVALID_VALUES }; if (!tournamentId) return { error: MISSING_TOURNAMENT_ID }; const { tournamentIds, error } = getTournamentIds(tournamentRecords); if (error) return { error }; if (!tournamentIds.includes(tournamentId)) return { error: MISSING_TOURNAMENT_ID }; // not using bulk update function here to handle scenario where // tournamentRecords loaded into state are not all linked let unlinkError; tournamentIds.every((currentTournamentId) => { const tournamentRecord = tournamentRecords[currentTournamentId]; const { extension } = findTournamentExtension({ tournamentRecord, name: LINKED_TOURNAMENTS, }); // if there is no extension return { ...SUCCESS } because no links exist if (!extension) return true; let linkedTournamentIds = extension?.value?.tournamentIds || []; // if there are no tournamentIds if ( !linkedTournamentIds?.length || (linkedTournamentIds.length === 1 && linkedTournamentIds.includes(tournamentId)) || currentTournamentId === tournamentId ) { const result = removeTournamentExtension({ tournamentRecord, name: LINKED_TOURNAMENTS, }); if (result.error) unlinkError = result.error; return result.success; } const tournamentIds = linkedTournamentIds.filter( (linkedTournamentId) => linkedTournamentId !== tournamentId ); extension.value = { tournamentIds }; const result = addTournamentExtension({ tournamentRecord, extension }); if (result.error) unlinkError = result.error; return result.success; }); return unlinkError ? { error: unlinkError } : { ...SUCCESS }; } function getTournamentIds(tournamentRecords) { const tournamentIds = Object.keys(tournamentRecords).filter(Boolean); return { tournamentIds }; }
32.026667
116
0.705662
1fbe82675249337d43a6d2d3cd501772adcb2710
3,223
css
CSS
applystyle.css
sunil-dhi/travel-guru
8d492fa27d62f180158301d7a8e590e1d831cdfd
[ "MIT" ]
null
null
null
applystyle.css
sunil-dhi/travel-guru
8d492fa27d62f180158301d7a8e590e1d831cdfd
[ "MIT" ]
null
null
null
applystyle.css
sunil-dhi/travel-guru
8d492fa27d62f180158301d7a8e590e1d831cdfd
[ "MIT" ]
null
null
null
* { padding: 0; margin: 0; color: #f7f2f2; } .contact{ position: absolute; top: 0; left: 0; width: 100%; z-index: -1; height: 570px; } .top{ background: rgb(255, 255, 255); width:100%; margin-top: 480px; } .top img{ border: 2px solid rgb(196, 109, 109); width: 70%; display: flex; justify-content: space-around; margin-top: 100px; margin-left: 200px; } nav { width: 96%; height: 70px; font-family: sans-serif; margin:2px auto; display: flex; justify-content: space-around; } nav h1{ color: white; font-size: 50px; width: 40%; font-weight: bold; top: 0; left: 0; } nav ul{ width: 60%; list-style: none; } nav ul li{ list-style: none; float: left; margin: 10px 20px; padding: 10px; font-size: 20px; font-weight: bold; } nav ul li a, nav ul li a { text-decoration: none; color:white; } .box { width: 100%; height: 120px; padding: 200px; /*position: relative; top: 300px;*/ text-align: center; margin: 10px auto; margin-top: 10px; } .box h1 { width: 400px; margin-left: 18%; color: rgb(167, 114, 49); padding: 17px; font-size: 50px; border-radius: 10px 10px 0px 0px; } .box h2 { width: 70%; color: rgb(58, 52, 44); padding: 15px; font-size: 25px; border-radius: 10px 10px 0px 0px; } .box p{ color: rgb(7, 6, 6); width: 70%; padding: 13px; } #form h2, h3{ text-align: center; } #form{ display: inline-block; background-color: lightgrey; opacity: 0.85; width: 49%; } form{ color: white; background-color: rgb(49, 12, 2); margin-left: auto; margin-right: auto; margin-bottom: 1em; padding-bottom: 1em; width: 95%; } label { display: inline-block; width: 100px; padding: 1em; text-align: right; } input, textarea{ display: inline-block; height: 20px; width: 400px; border-radius: 0.5em; padding-left: 0.5em; } button{ display: block; margin-left: auto; margin-right: auto; padding-left: 1em; padding-right: 1em; } #Address{ display: inline-block; background-color: lightgrey; font-weight: bold; opacity: 0.85; width: 49%; padding-left: 1em; } #Address i, h3{ display: inline-block; font-weight: bold; } #map{ display: block; width: 100%; height: 300px; } nav{ width: 96%; height: 70px; font-family:sans-serif; margin: 20px auto; display: flex; justify-content: space-around; } nav h1{ color: white; font-size: 50px; width: 40%; font-weight: bold; top:0; left:0; } nav ul{ width: 60%; list-style: none; } nav ul li{ list-style: none; float: left; margin: 10px 20px; padding: 10px; font-size: 20px; font-weight: bold; } nav ul li a, nav ul li a .fa{ text-decoration: none; color:white; } footer{ background-color:rgb(173, 156, 60); padding:50px; text-align: center; padding: 25px; box-sizing: border-box; }
16.360406
42
0.554763
0eb3ab13666008618d997dcf0f672f5455be815a
2,766
swift
Swift
TriviaApp/TriviaApp/Utilities/CoreDataStack.swift
icaksama/TriviaApp
6b588245bca3933fc46b8c40b989b017238a7352
[ "MIT" ]
2
2017-11-20T13:29:33.000Z
2019-01-18T21:21:02.000Z
TriviaApp/TriviaApp/Utilities/CoreDataStack.swift
icaksama/TriviaApp
6b588245bca3933fc46b8c40b989b017238a7352
[ "MIT" ]
null
null
null
TriviaApp/TriviaApp/Utilities/CoreDataStack.swift
icaksama/TriviaApp
6b588245bca3933fc46b8c40b989b017238a7352
[ "MIT" ]
null
null
null
// // CoreDataStack.swift // TriviaApp // // Created by Saiful I. Wicaksana on 18/11/17. // Copyright © 2017 icaksama. All rights reserved. // import Foundation import UIKit import CoreData class CoreDataStack { /** Get document directory */ static var applicationDocumentsDirectory: URL = { let urls = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask) return urls[urls.count-1] }() /** Get object model */ static var managedObjectModel: NSManagedObjectModel = { let modelURL = Bundle(for: CoreDataStack.self).url(forResource: "TriviaApp", withExtension: "momd")! return NSManagedObjectModel(contentsOf: modelURL)! }() /** Get object coordinator */ static var persistentStoreCoordinator: NSPersistentStoreCoordinator = { let coordinator = NSPersistentStoreCoordinator(managedObjectModel: managedObjectModel) let url = applicationDocumentsDirectory.appendingPathComponent("TriviaApp.xcdatamodeld") var failureReason = "There was an error creating or loading the application's saved data." let options = [NSMigratePersistentStoresAutomaticallyOption: NSNumber(value: true as Bool), NSInferMappingModelAutomaticallyOption: NSNumber(value: true as Bool)] do { try coordinator.addPersistentStore(ofType: NSSQLiteStoreType, configurationName: nil, at: url, options: options) } catch { var dict = [String: AnyObject]() dict[NSLocalizedDescriptionKey] = "Failed to initialize the application's saved data" as AnyObject dict[NSLocalizedFailureReasonErrorKey] = failureReason as AnyObject dict[NSUnderlyingErrorKey] = error as NSError let wrappedError = NSError(domain: "http://www.icaksama.com", code: 9999, userInfo: dict) NSLog("Unresolved error \(wrappedError), \(wrappedError.userInfo)") abort() } return coordinator }() /** Get Object Context */ static var managedObjectContext: NSManagedObjectContext = { let coordinator = persistentStoreCoordinator var managedObjectContext = NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType) managedObjectContext.persistentStoreCoordinator = coordinator return managedObjectContext }() /** Save Core Data with boolean response */ static func saveContext() { if managedObjectContext.hasChanges { do { try managedObjectContext.save() } catch { let nserror = error as NSError NSLog("Unresolved error \(nserror), \(nserror.userInfo)") abort() } } } }
39.514286
170
0.665221
83e28e39a72536e04420a7f311f45229e6e6539f
17,585
rs
Rust
src/libstd/collections/mod.rs
wickerwaka/rust
140e79385494da83f5a36f8fefa001b2180fa541
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
2
2016-12-02T22:31:57.000Z
2022-03-14T19:54:37.000Z
src/libstd/collections/mod.rs
wickerwaka/rust
140e79385494da83f5a36f8fefa001b2180fa541
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
null
null
null
src/libstd/collections/mod.rs
wickerwaka/rust
140e79385494da83f5a36f8fefa001b2180fa541
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
1
2017-06-08T10:09:37.000Z
2017-06-08T10:09:37.000Z
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. //! Collection types. //! //! Rust's standard collection library provides efficient implementations of the //! most common general purpose programming data structures. By using the //! standard implementations, it should be possible for two libraries to //! communicate without significant data conversion. //! //! To get this out of the way: you should probably just use `Vec` or `HashMap`. //! These two collections cover most use cases for generic data storage and //! processing. They are exceptionally good at doing what they do. All the other //! collections in the standard library have specific use cases where they are //! the optimal choice, but these cases are borderline *niche* in comparison. //! Even when `Vec` and `HashMap` are technically suboptimal, they're probably a //! good enough choice to get started. //! //! Rust's collections can be grouped into four major categories: //! //! * Sequences: `Vec`, `VecDeque`, `LinkedList` //! * Maps: `HashMap`, `BTreeMap` //! * Sets: `HashSet`, `BTreeSet` //! * Misc: `BinaryHeap` //! //! # When Should You Use Which Collection? //! //! These are fairly high-level and quick break-downs of when each collection //! should be considered. Detailed discussions of strengths and weaknesses of //! individual collections can be found on their own documentation pages. //! //! ### Use a `Vec` when: //! * You want to collect items up to be processed or sent elsewhere later, and //! don't care about any properties of the actual values being stored. //! * You want a sequence of elements in a particular order, and will only be //! appending to (or near) the end. //! * You want a stack. //! * You want a resizable array. //! * You want a heap-allocated array. //! //! ### Use a `VecDeque` when: //! * You want a `Vec` that supports efficient insertion at both ends of the //! sequence. //! * You want a queue. //! * You want a double-ended queue (deque). //! //! ### Use a `LinkedList` when: //! * You want a `Vec` or `VecDeque` of unknown size, and can't tolerate //! amortization. //! * You want to efficiently split and append lists. //! * You are *absolutely* certain you *really*, *truly*, want a doubly linked //! list. //! //! ### Use a `HashMap` when: //! * You want to associate arbitrary keys with an arbitrary value. //! * You want a cache. //! * You want a map, with no extra functionality. //! //! ### Use a `BTreeMap` when: //! * You're interested in what the smallest or largest key-value pair is. //! * You want to find the largest or smallest key that is smaller or larger //! than something. //! * You want to be able to get all of the entries in order on-demand. //! * You want a sorted map. //! //! ### Use the `Set` variant of any of these `Map`s when: //! * You just want to remember which keys you've seen. //! * There is no meaningful value to associate with your keys. //! * You just want a set. //! //! ### Use a `BinaryHeap` when: //! //! * You want to store a bunch of elements, but only ever want to process the //! "biggest" or "most important" one at any given time. //! * You want a priority queue. //! //! # Performance //! //! Choosing the right collection for the job requires an understanding of what //! each collection is good at. Here we briefly summarize the performance of //! different collections for certain important operations. For further details, //! see each type's documentation, and note that the names of actual methods may //! differ from the tables below on certain collections. //! //! Throughout the documentation, we will follow a few conventions. For all //! operations, the collection's size is denoted by n. If another collection is //! involved in the operation, it contains m elements. Operations which have an //! *amortized* cost are suffixed with a `*`. Operations with an *expected* //! cost are suffixed with a `~`. //! //! All amortized costs are for the potential need to resize when capacity is //! exhausted. If a resize occurs it will take O(n) time. Our collections never //! automatically shrink, so removal operations aren't amortized. Over a //! sufficiently large series of operations, the average cost per operation will //! deterministically equal the given cost. //! //! Only HashMap has expected costs, due to the probabilistic nature of hashing. //! It is theoretically possible, though very unlikely, for HashMap to //! experience worse performance. //! //! ## Sequences //! //! | | get(i) | insert(i) | remove(i) | append | split_off(i) | //! |--------------|----------------|-----------------|----------------|--------|----------------| //! | Vec | O(1) | O(n-i)* | O(n-i) | O(m)* | O(n-i) | //! | VecDeque | O(1) | O(min(i, n-i))* | O(min(i, n-i)) | O(m)* | O(min(i, n-i)) | //! | LinkedList | O(min(i, n-i)) | O(min(i, n-i)) | O(min(i, n-i)) | O(1) | O(min(i, n-i)) | //! //! Note that where ties occur, Vec is generally going to be faster than VecDeque, and VecDeque //! is generally going to be faster than LinkedList. //! //! ## Maps //! //! For Sets, all operations have the cost of the equivalent Map operation. //! //! | | get | insert | remove | predecessor | //! |----------|-----------|----------|----------|-------------| //! | HashMap | O(1)~ | O(1)~* | O(1)~ | N/A | //! | BTreeMap | O(log n) | O(log n) | O(log n) | O(log n) | //! //! Note that BTreeMap's precise performance depends on the value of B. //! //! # Correct and Efficient Usage of Collections //! //! Of course, knowing which collection is the right one for the job doesn't //! instantly permit you to use it correctly. Here are some quick tips for //! efficient and correct usage of the standard collections in general. If //! you're interested in how to use a specific collection in particular, consult //! its documentation for detailed discussion and code examples. //! //! ## Capacity Management //! //! Many collections provide several constructors and methods that refer to //! "capacity". These collections are generally built on top of an array. //! Optimally, this array would be exactly the right size to fit only the //! elements stored in the collection, but for the collection to do this would //! be very inefficient. If the backing array was exactly the right size at all //! times, then every time an element is inserted, the collection would have to //! grow the array to fit it. Due to the way memory is allocated and managed on //! most computers, this would almost surely require allocating an entirely new //! array and copying every single element from the old one into the new one. //! Hopefully you can see that this wouldn't be very efficient to do on every //! operation. //! //! Most collections therefore use an *amortized* allocation strategy. They //! generally let themselves have a fair amount of unoccupied space so that they //! only have to grow on occasion. When they do grow, they allocate a //! substantially larger array to move the elements into so that it will take a //! while for another grow to be required. While this strategy is great in //! general, it would be even better if the collection *never* had to resize its //! backing array. Unfortunately, the collection itself doesn't have enough //! information to do this itself. Therefore, it is up to us programmers to give //! it hints. //! //! Any `with_capacity` constructor will instruct the collection to allocate //! enough space for the specified number of elements. Ideally this will be for //! exactly that many elements, but some implementation details may prevent //! this. `Vec` and `VecDeque` can be relied on to allocate exactly the //! requested amount, though. Use `with_capacity` when you know exactly how many //! elements will be inserted, or at least have a reasonable upper-bound on that //! number. //! //! When anticipating a large influx of elements, the `reserve` family of //! methods can be used to hint to the collection how much room it should make //! for the coming items. As with `with_capacity`, the precise behavior of //! these methods will be specific to the collection of interest. //! //! For optimal performance, collections will generally avoid shrinking //! themselves. If you believe that a collection will not soon contain any more //! elements, or just really need the memory, the `shrink_to_fit` method prompts //! the collection to shrink the backing array to the minimum size capable of //! holding its elements. //! //! Finally, if ever you're interested in what the actual capacity of the //! collection is, most collections provide a `capacity` method to query this //! information on demand. This can be useful for debugging purposes, or for //! use with the `reserve` methods. //! //! ## Iterators //! //! Iterators are a powerful and robust mechanism used throughout Rust's //! standard libraries. Iterators provide a sequence of values in a generic, //! safe, efficient and convenient way. The contents of an iterator are usually //! *lazily* evaluated, so that only the values that are actually needed are //! ever actually produced, and no allocation need be done to temporarily store //! them. Iterators are primarily consumed using a `for` loop, although many //! functions also take iterators where a collection or sequence of values is //! desired. //! //! All of the standard collections provide several iterators for performing //! bulk manipulation of their contents. The three primary iterators almost //! every collection should provide are `iter`, `iter_mut`, and `into_iter`. //! Some of these are not provided on collections where it would be unsound or //! unreasonable to provide them. //! //! `iter` provides an iterator of immutable references to all the contents of a //! collection in the most "natural" order. For sequence collections like `Vec`, //! this means the items will be yielded in increasing order of index starting //! at 0. For ordered collections like `BTreeMap`, this means that the items //! will be yielded in sorted order. For unordered collections like `HashMap`, //! the items will be yielded in whatever order the internal representation made //! most convenient. This is great for reading through all the contents of the //! collection. //! //! ``` //! let vec = vec![1, 2, 3, 4]; //! for x in vec.iter() { //! println!("vec contained {}", x); //! } //! ``` //! //! `iter_mut` provides an iterator of *mutable* references in the same order as //! `iter`. This is great for mutating all the contents of the collection. //! //! ``` //! let mut vec = vec![1, 2, 3, 4]; //! for x in vec.iter_mut() { //! *x += 1; //! } //! ``` //! //! `into_iter` transforms the actual collection into an iterator over its //! contents by-value. This is great when the collection itself is no longer //! needed, and the values are needed elsewhere. Using `extend` with `into_iter` //! is the main way that contents of one collection are moved into another. //! `extend` automatically calls `into_iter`, and takes any `T: IntoIterator`. //! Calling `collect` on an iterator itself is also a great way to convert one //! collection into another. Both of these methods should internally use the //! capacity management tools discussed in the previous section to do this as //! efficiently as possible. //! //! ``` //! let mut vec1 = vec![1, 2, 3, 4]; //! let vec2 = vec![10, 20, 30, 40]; //! vec1.extend(vec2); //! ``` //! //! ``` //! use std::collections::VecDeque; //! //! let vec = vec![1, 2, 3, 4]; //! let buf: VecDeque<_> = vec.into_iter().collect(); //! ``` //! //! Iterators also provide a series of *adapter* methods for performing common //! threads to sequences. Among the adapters are functional favorites like `map`, //! `fold`, `skip`, and `take`. Of particular interest to collections is the //! `rev` adapter, that reverses any iterator that supports this operation. Most //! collections provide reversible iterators as the way to iterate over them in //! reverse order. //! //! ``` //! let vec = vec![1, 2, 3, 4]; //! for x in vec.iter().rev() { //! println!("vec contained {}", x); //! } //! ``` //! //! Several other collection methods also return iterators to yield a sequence //! of results but avoid allocating an entire collection to store the result in. //! This provides maximum flexibility as `collect` or `extend` can be called to //! "pipe" the sequence into any collection if desired. Otherwise, the sequence //! can be looped over with a `for` loop. The iterator can also be discarded //! after partial use, preventing the computation of the unused items. //! //! ## Entries //! //! The `entry` API is intended to provide an efficient mechanism for //! manipulating the contents of a map conditionally on the presence of a key or //! not. The primary motivating use case for this is to provide efficient //! accumulator maps. For instance, if one wishes to maintain a count of the //! number of times each key has been seen, they will have to perform some //! conditional logic on whether this is the first time the key has been seen or //! not. Normally, this would require a `find` followed by an `insert`, //! effectively duplicating the search effort on each insertion. //! //! When a user calls `map.entry(&key)`, the map will search for the key and //! then yield a variant of the `Entry` enum. //! //! If a `Vacant(entry)` is yielded, then the key *was not* found. In this case //! the only valid operation is to `insert` a value into the entry. When this is //! done, the vacant entry is consumed and converted into a mutable reference to //! the value that was inserted. This allows for further manipulation of the //! value beyond the lifetime of the search itself. This is useful if complex //! logic needs to be performed on the value regardless of whether the value was //! just inserted. //! //! If an `Occupied(entry)` is yielded, then the key *was* found. In this case, //! the user has several options: they can `get`, `insert`, or `remove` the //! value of the occupied entry. Additionally, they can convert the occupied //! entry into a mutable reference to its value, providing symmetry to the //! vacant `insert` case. //! //! ### Examples //! //! Here are the two primary ways in which `entry` is used. First, a simple //! example where the logic performed on the values is trivial. //! //! #### Counting the number of times each character in a string occurs //! //! ``` //! use std::collections::btree_map::BTreeMap; //! //! let mut count = BTreeMap::new(); //! let message = "she sells sea shells by the sea shore"; //! //! for c in message.chars() { //! *count.entry(c).or_insert(0) += 1; //! } //! //! assert_eq!(count.get(&'s'), Some(&8)); //! //! println!("Number of occurrences of each character"); //! for (char, count) in &count { //! println!("{}: {}", char, count); //! } //! ``` //! //! When the logic to be performed on the value is more complex, we may simply //! use the `entry` API to ensure that the value is initialized, and perform the //! logic afterwards. //! //! #### Tracking the inebriation of customers at a bar //! //! ``` //! use std::collections::btree_map::BTreeMap; //! //! // A client of the bar. They have an id and a blood alcohol level. //! struct Person { id: u32, blood_alcohol: f32 } //! //! // All the orders made to the bar, by client id. //! let orders = vec![1,2,1,2,3,4,1,2,2,3,4,1,1,1]; //! //! // Our clients. //! let mut blood_alcohol = BTreeMap::new(); //! //! for id in orders { //! // If this is the first time we've seen this customer, initialize them //! // with no blood alcohol. Otherwise, just retrieve them. //! let person = blood_alcohol.entry(id).or_insert(Person{id: id, blood_alcohol: 0.0}); //! //! // Reduce their blood alcohol level. It takes time to order and drink a beer! //! person.blood_alcohol *= 0.9; //! //! // Check if they're sober enough to have another beer. //! if person.blood_alcohol > 0.3 { //! // Too drunk... for now. //! println!("Sorry {}, I have to cut you off", person.id); //! } else { //! // Have another! //! person.blood_alcohol += 0.1; //! } //! } //! ``` #![stable(feature = "rust1", since = "1.0.0")] pub use core_collections::Bound; pub use core_collections::{BinaryHeap, BTreeMap, BTreeSet}; pub use core_collections::{LinkedList, VecDeque}; pub use core_collections::{binary_heap, btree_map, btree_set}; pub use core_collections::{linked_list, vec_deque}; pub use self::hash_map::HashMap; pub use self::hash_set::HashSet; mod hash; #[stable(feature = "rust1", since = "1.0.0")] pub mod hash_map { //! A hashmap pub use super::hash::map::*; } #[stable(feature = "rust1", since = "1.0.0")] pub mod hash_set { //! A hashset pub use super::hash::set::*; } /// Experimental support for providing custom hash algorithms to a HashMap and /// HashSet. #[unstable(feature = "hashmap_hasher", reason = "module was recently added", issue = "27713")] pub mod hash_state { pub use super::hash::state::*; }
44.406566
98
0.682229
857e886a57141e95a71676d0c4203ac2c3d0f650
1,729
js
JavaScript
IdentifiableObject.js
peopleware/js-ppwcode-vernacular-semantics
26b64753a62b6128c29dcf2901630afb0ca10481
[ "Apache-2.0" ]
null
null
null
IdentifiableObject.js
peopleware/js-ppwcode-vernacular-semantics
26b64753a62b6128c29dcf2901630afb0ca10481
[ "Apache-2.0" ]
null
null
null
IdentifiableObject.js
peopleware/js-ppwcode-vernacular-semantics
26b64753a62b6128c29dcf2901630afb0ca10481
[ "Apache-2.0" ]
null
null
null
/* Copyright 2016 - $Date $ by PeopleWare n.v. 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. */ define(["dojo/_base/declare", "./PpwCodeObject", "ppwcode-util-oddsAndEnds/js", "module"], function(declare, PpwCodeObject, js, module) { var IdentifiableObject = declare([PpwCodeObject], { // summary: // IdentifiableObjects are PpwCodeObjects that feature a method `getKey()`. _c_invar: [ function() {return js.typeOf(this.getTypeDescription()) === "string";} ], getKey: function() { // summary: // A (business) key (String) that uniquely identifies // the object represented by this (if we all keep to the rules). // description: // There is no default, but implementations are advised to return // `this.getTypeDescription() + "@" + id`, where `id` is a String uniquely // and durably identifying the instance within the type. // If it is impossible to return a unique key (in border conditions), // the function should return falsy. // tags // protected extension this._c_ABSTRACT(); } }); IdentifiableObject.mid = module.id; return IdentifiableObject; } );
33.901961
90
0.663968
752a8b4f5554191723186a6e7ce944748b07f1f2
3,035
c
C
src/mpv_plugin.c
YggdrasiI/onion-mpv-webui
96ad9cc91cfa9b00d43bf8c7139018aabe5602de
[ "MIT" ]
null
null
null
src/mpv_plugin.c
YggdrasiI/onion-mpv-webui
96ad9cc91cfa9b00d43bf8c7139018aabe5602de
[ "MIT" ]
null
null
null
src/mpv_plugin.c
YggdrasiI/onion-mpv-webui
96ad9cc91cfa9b00d43bf8c7139018aabe5602de
[ "MIT" ]
null
null
null
#define _GNU_SOURCE #include <stddef.h> #include <stdio.h> #include <stdlib.h> #include <signal.h> #include <string.h> #include <unistd.h> #include <pthread.h> #include <mpv/client.h> mpv_handle *mpv = NULL; pthread_mutex_t mpv_lock = PTHREAD_MUTEX_INITIALIZER; #include <onion/onion.h> #include "webui_onion.h" #include "mpv_api_commands.h" #include "mpv_script_options.h" #include "onion_ws_status.h" extern onion *o; extern __status_t *status; extern __clients_t *websockets; int mpv_open_cplugin(mpv_handle *handle) { if( !handle ){ perror("Hey, mpv_handle is NULL\n"); return EXIT_FAILURE; } int err=0; mpv = handle; const char *mpv_plugin_name = mpv_client_name(handle); printf("Webui C plugin loaded as '%s'!\n", mpv_plugin_name); onion_dict *options = get_default_options(); update_options(mpv, mpv_plugin_name, options); if ('1' == onion_dict_get(options, "paused")[0]) { int pause = 1; err = mpv_set_property(mpv, "pause", MPV_FORMAT_FLAG, &pause); check_mpv_err(err); } // Daemon mode. if ('1' == onion_dict_get(options, "daemon")[0]) { int daemon = 1; err = mpv_set_property(mpv, "idle", MPV_FORMAT_FLAG, &daemon); check_mpv_err(err); } int error; error = webui_onion_init(options); // also init mutex mpv_lock. if( error < 0){ perror("Initialization of onion object failed.\n"); webui_onion_uninit(o); return EXIT_FAILURE; } error = onion_listen(o); if (error) { perror("Cant create the server.\n"); onion_listen_stop(o); webui_onion_uninit(o); return EXIT_FAILURE; } //printf("After nonblocking server...\n"); webui_onion_set_running(1); while (webui_onion_is_running()) { /* Do not use timeout < 0 to avoid infinite * waiting. Otherwise the ^C-signal handler * only stops the onion server, but not mpv. */ mpv_event *event = mpv_wait_event(handle, 0.5); if (event->event_id == MPV_EVENT_NONE){ continue; // timeout triggered. } pthread_mutex_lock(&mpv_lock); if (event->event_id == MPV_EVENT_PROPERTY_CHANGE){ status_update(status, mpv, event); if (status->num_updated > 0){ // Null bei Initialisierung status_send_update(status, websockets); } }else{ printf("Got event: %d\n", event->event_id); } // […] pthread_mutex_unlock(&mpv_lock); if (event->event_id == MPV_EVENT_SHUTDOWN){ webui_onion_set_running(0); break; } } printf("Stop listening (2)\n"); // Redudant in SIGINT-case webui_onion_end_signal(0); // includes onion_listen_stop(o); webui_onion_uninit(o); onion_dict_free(options); // Returing do not quit the main mpv thread, but this plugin. // Quitting mpv is triggered in webui_onion_uninit() return EXIT_SUCCESS; }
25.940171
70
0.623723
0b519f8596f5bf7ee53103adc8d550ce1fb62540
68,172
py
Python
tests/test_generate_unique_id_function.py
ssensalo/fastapi
146f57b8f70c5757dc20edc716dba1b96936a8d6
[ "MIT" ]
1
2022-01-08T16:39:28.000Z
2022-01-08T16:39:28.000Z
tests/test_generate_unique_id_function.py
ssensalo/fastapi
146f57b8f70c5757dc20edc716dba1b96936a8d6
[ "MIT" ]
1
2022-01-07T21:04:04.000Z
2022-01-07T21:04:04.000Z
tests/test_generate_unique_id_function.py
ssensalo/fastapi
146f57b8f70c5757dc20edc716dba1b96936a8d6
[ "MIT" ]
null
null
null
import warnings from typing import List from fastapi import APIRouter, FastAPI from fastapi.routing import APIRoute from fastapi.testclient import TestClient from pydantic import BaseModel def custom_generate_unique_id(route: APIRoute): return f"foo_{route.name}" def custom_generate_unique_id2(route: APIRoute): return f"bar_{route.name}" def custom_generate_unique_id3(route: APIRoute): return f"baz_{route.name}" class Item(BaseModel): name: str price: float class Message(BaseModel): title: str description: str def test_top_level_generate_unique_id(): app = FastAPI(generate_unique_id_function=custom_generate_unique_id) router = APIRouter() @app.post("/", response_model=List[Item], responses={404: {"model": List[Message]}}) def post_root(item1: Item, item2: Item): return item1, item2 # pragma: nocover @router.post( "/router", response_model=List[Item], responses={404: {"model": List[Message]}} ) def post_router(item1: Item, item2: Item): return item1, item2 # pragma: nocover app.include_router(router) client = TestClient(app) response = client.get("/openapi.json") data = response.json() assert data == { "openapi": "3.0.2", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/": { "post": { "summary": "Post Root", "operationId": "foo_post_root", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Body_foo_post_root" } } }, "required": True, }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "title": "Response Foo Post Root", "type": "array", "items": {"$ref": "#/components/schemas/Item"}, } } }, }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "title": "Response 404 Foo Post Root", "type": "array", "items": { "$ref": "#/components/schemas/Message" }, } } }, }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, }, }, } }, "/router": { "post": { "summary": "Post Router", "operationId": "foo_post_router", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Body_foo_post_router" } } }, "required": True, }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "title": "Response Foo Post Router", "type": "array", "items": {"$ref": "#/components/schemas/Item"}, } } }, }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "title": "Response 404 Foo Post Router", "type": "array", "items": { "$ref": "#/components/schemas/Message" }, } } }, }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, }, }, } }, }, "components": { "schemas": { "Body_foo_post_root": { "title": "Body_foo_post_root", "required": ["item1", "item2"], "type": "object", "properties": { "item1": {"$ref": "#/components/schemas/Item"}, "item2": {"$ref": "#/components/schemas/Item"}, }, }, "Body_foo_post_router": { "title": "Body_foo_post_router", "required": ["item1", "item2"], "type": "object", "properties": { "item1": {"$ref": "#/components/schemas/Item"}, "item2": {"$ref": "#/components/schemas/Item"}, }, }, "HTTPValidationError": { "title": "HTTPValidationError", "type": "object", "properties": { "detail": { "title": "Detail", "type": "array", "items": {"$ref": "#/components/schemas/ValidationError"}, } }, }, "Item": { "title": "Item", "required": ["name", "price"], "type": "object", "properties": { "name": {"title": "Name", "type": "string"}, "price": {"title": "Price", "type": "number"}, }, }, "Message": { "title": "Message", "required": ["title", "description"], "type": "object", "properties": { "title": {"title": "Title", "type": "string"}, "description": {"title": "Description", "type": "string"}, }, }, "ValidationError": { "title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", "properties": { "loc": { "title": "Location", "type": "array", "items": { "anyOf": [{"type": "string"}, {"type": "integer"}] }, }, "msg": {"title": "Message", "type": "string"}, "type": {"title": "Error Type", "type": "string"}, }, }, } }, } def test_router_overrides_generate_unique_id(): app = FastAPI(generate_unique_id_function=custom_generate_unique_id) router = APIRouter(generate_unique_id_function=custom_generate_unique_id2) @app.post("/", response_model=List[Item], responses={404: {"model": List[Message]}}) def post_root(item1: Item, item2: Item): return item1, item2 # pragma: nocover @router.post( "/router", response_model=List[Item], responses={404: {"model": List[Message]}} ) def post_router(item1: Item, item2: Item): return item1, item2 # pragma: nocover app.include_router(router) client = TestClient(app) response = client.get("/openapi.json") data = response.json() assert data == { "openapi": "3.0.2", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/": { "post": { "summary": "Post Root", "operationId": "foo_post_root", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Body_foo_post_root" } } }, "required": True, }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "title": "Response Foo Post Root", "type": "array", "items": {"$ref": "#/components/schemas/Item"}, } } }, }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "title": "Response 404 Foo Post Root", "type": "array", "items": { "$ref": "#/components/schemas/Message" }, } } }, }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, }, }, } }, "/router": { "post": { "summary": "Post Router", "operationId": "bar_post_router", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Body_bar_post_router" } } }, "required": True, }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "title": "Response Bar Post Router", "type": "array", "items": {"$ref": "#/components/schemas/Item"}, } } }, }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "title": "Response 404 Bar Post Router", "type": "array", "items": { "$ref": "#/components/schemas/Message" }, } } }, }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, }, }, } }, }, "components": { "schemas": { "Body_bar_post_router": { "title": "Body_bar_post_router", "required": ["item1", "item2"], "type": "object", "properties": { "item1": {"$ref": "#/components/schemas/Item"}, "item2": {"$ref": "#/components/schemas/Item"}, }, }, "Body_foo_post_root": { "title": "Body_foo_post_root", "required": ["item1", "item2"], "type": "object", "properties": { "item1": {"$ref": "#/components/schemas/Item"}, "item2": {"$ref": "#/components/schemas/Item"}, }, }, "HTTPValidationError": { "title": "HTTPValidationError", "type": "object", "properties": { "detail": { "title": "Detail", "type": "array", "items": {"$ref": "#/components/schemas/ValidationError"}, } }, }, "Item": { "title": "Item", "required": ["name", "price"], "type": "object", "properties": { "name": {"title": "Name", "type": "string"}, "price": {"title": "Price", "type": "number"}, }, }, "Message": { "title": "Message", "required": ["title", "description"], "type": "object", "properties": { "title": {"title": "Title", "type": "string"}, "description": {"title": "Description", "type": "string"}, }, }, "ValidationError": { "title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", "properties": { "loc": { "title": "Location", "type": "array", "items": { "anyOf": [{"type": "string"}, {"type": "integer"}] }, }, "msg": {"title": "Message", "type": "string"}, "type": {"title": "Error Type", "type": "string"}, }, }, } }, } def test_router_include_overrides_generate_unique_id(): app = FastAPI(generate_unique_id_function=custom_generate_unique_id) router = APIRouter(generate_unique_id_function=custom_generate_unique_id2) @app.post("/", response_model=List[Item], responses={404: {"model": List[Message]}}) def post_root(item1: Item, item2: Item): return item1, item2 # pragma: nocover @router.post( "/router", response_model=List[Item], responses={404: {"model": List[Message]}} ) def post_router(item1: Item, item2: Item): return item1, item2 # pragma: nocover app.include_router(router, generate_unique_id_function=custom_generate_unique_id3) client = TestClient(app) response = client.get("/openapi.json") data = response.json() assert data == { "openapi": "3.0.2", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/": { "post": { "summary": "Post Root", "operationId": "foo_post_root", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Body_foo_post_root" } } }, "required": True, }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "title": "Response Foo Post Root", "type": "array", "items": {"$ref": "#/components/schemas/Item"}, } } }, }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "title": "Response 404 Foo Post Root", "type": "array", "items": { "$ref": "#/components/schemas/Message" }, } } }, }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, }, }, } }, "/router": { "post": { "summary": "Post Router", "operationId": "bar_post_router", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Body_bar_post_router" } } }, "required": True, }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "title": "Response Bar Post Router", "type": "array", "items": {"$ref": "#/components/schemas/Item"}, } } }, }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "title": "Response 404 Bar Post Router", "type": "array", "items": { "$ref": "#/components/schemas/Message" }, } } }, }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, }, }, } }, }, "components": { "schemas": { "Body_bar_post_router": { "title": "Body_bar_post_router", "required": ["item1", "item2"], "type": "object", "properties": { "item1": {"$ref": "#/components/schemas/Item"}, "item2": {"$ref": "#/components/schemas/Item"}, }, }, "Body_foo_post_root": { "title": "Body_foo_post_root", "required": ["item1", "item2"], "type": "object", "properties": { "item1": {"$ref": "#/components/schemas/Item"}, "item2": {"$ref": "#/components/schemas/Item"}, }, }, "HTTPValidationError": { "title": "HTTPValidationError", "type": "object", "properties": { "detail": { "title": "Detail", "type": "array", "items": {"$ref": "#/components/schemas/ValidationError"}, } }, }, "Item": { "title": "Item", "required": ["name", "price"], "type": "object", "properties": { "name": {"title": "Name", "type": "string"}, "price": {"title": "Price", "type": "number"}, }, }, "Message": { "title": "Message", "required": ["title", "description"], "type": "object", "properties": { "title": {"title": "Title", "type": "string"}, "description": {"title": "Description", "type": "string"}, }, }, "ValidationError": { "title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", "properties": { "loc": { "title": "Location", "type": "array", "items": { "anyOf": [{"type": "string"}, {"type": "integer"}] }, }, "msg": {"title": "Message", "type": "string"}, "type": {"title": "Error Type", "type": "string"}, }, }, } }, } def test_subrouter_top_level_include_overrides_generate_unique_id(): app = FastAPI(generate_unique_id_function=custom_generate_unique_id) router = APIRouter() sub_router = APIRouter(generate_unique_id_function=custom_generate_unique_id2) @app.post("/", response_model=List[Item], responses={404: {"model": List[Message]}}) def post_root(item1: Item, item2: Item): return item1, item2 # pragma: nocover @router.post( "/router", response_model=List[Item], responses={404: {"model": List[Message]}} ) def post_router(item1: Item, item2: Item): return item1, item2 # pragma: nocover @sub_router.post( "/subrouter", response_model=List[Item], responses={404: {"model": List[Message]}}, ) def post_subrouter(item1: Item, item2: Item): return item1, item2 # pragma: nocover router.include_router(sub_router) app.include_router(router, generate_unique_id_function=custom_generate_unique_id3) client = TestClient(app) response = client.get("/openapi.json") data = response.json() assert data == { "openapi": "3.0.2", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/": { "post": { "summary": "Post Root", "operationId": "foo_post_root", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Body_foo_post_root" } } }, "required": True, }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "title": "Response Foo Post Root", "type": "array", "items": {"$ref": "#/components/schemas/Item"}, } } }, }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "title": "Response 404 Foo Post Root", "type": "array", "items": { "$ref": "#/components/schemas/Message" }, } } }, }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, }, }, } }, "/router": { "post": { "summary": "Post Router", "operationId": "baz_post_router", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Body_baz_post_router" } } }, "required": True, }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "title": "Response Baz Post Router", "type": "array", "items": {"$ref": "#/components/schemas/Item"}, } } }, }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "title": "Response 404 Baz Post Router", "type": "array", "items": { "$ref": "#/components/schemas/Message" }, } } }, }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, }, }, } }, "/subrouter": { "post": { "summary": "Post Subrouter", "operationId": "bar_post_subrouter", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Body_bar_post_subrouter" } } }, "required": True, }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "title": "Response Bar Post Subrouter", "type": "array", "items": {"$ref": "#/components/schemas/Item"}, } } }, }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "title": "Response 404 Bar Post Subrouter", "type": "array", "items": { "$ref": "#/components/schemas/Message" }, } } }, }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, }, }, } }, }, "components": { "schemas": { "Body_bar_post_subrouter": { "title": "Body_bar_post_subrouter", "required": ["item1", "item2"], "type": "object", "properties": { "item1": {"$ref": "#/components/schemas/Item"}, "item2": {"$ref": "#/components/schemas/Item"}, }, }, "Body_baz_post_router": { "title": "Body_baz_post_router", "required": ["item1", "item2"], "type": "object", "properties": { "item1": {"$ref": "#/components/schemas/Item"}, "item2": {"$ref": "#/components/schemas/Item"}, }, }, "Body_foo_post_root": { "title": "Body_foo_post_root", "required": ["item1", "item2"], "type": "object", "properties": { "item1": {"$ref": "#/components/schemas/Item"}, "item2": {"$ref": "#/components/schemas/Item"}, }, }, "HTTPValidationError": { "title": "HTTPValidationError", "type": "object", "properties": { "detail": { "title": "Detail", "type": "array", "items": {"$ref": "#/components/schemas/ValidationError"}, } }, }, "Item": { "title": "Item", "required": ["name", "price"], "type": "object", "properties": { "name": {"title": "Name", "type": "string"}, "price": {"title": "Price", "type": "number"}, }, }, "Message": { "title": "Message", "required": ["title", "description"], "type": "object", "properties": { "title": {"title": "Title", "type": "string"}, "description": {"title": "Description", "type": "string"}, }, }, "ValidationError": { "title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", "properties": { "loc": { "title": "Location", "type": "array", "items": { "anyOf": [{"type": "string"}, {"type": "integer"}] }, }, "msg": {"title": "Message", "type": "string"}, "type": {"title": "Error Type", "type": "string"}, }, }, } }, } def test_router_path_operation_overrides_generate_unique_id(): app = FastAPI(generate_unique_id_function=custom_generate_unique_id) router = APIRouter(generate_unique_id_function=custom_generate_unique_id2) @app.post("/", response_model=List[Item], responses={404: {"model": List[Message]}}) def post_root(item1: Item, item2: Item): return item1, item2 # pragma: nocover @router.post( "/router", response_model=List[Item], responses={404: {"model": List[Message]}}, generate_unique_id_function=custom_generate_unique_id3, ) def post_router(item1: Item, item2: Item): return item1, item2 # pragma: nocover app.include_router(router) client = TestClient(app) response = client.get("/openapi.json") data = response.json() assert data == { "openapi": "3.0.2", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/": { "post": { "summary": "Post Root", "operationId": "foo_post_root", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Body_foo_post_root" } } }, "required": True, }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "title": "Response Foo Post Root", "type": "array", "items": {"$ref": "#/components/schemas/Item"}, } } }, }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "title": "Response 404 Foo Post Root", "type": "array", "items": { "$ref": "#/components/schemas/Message" }, } } }, }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, }, }, } }, "/router": { "post": { "summary": "Post Router", "operationId": "baz_post_router", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Body_baz_post_router" } } }, "required": True, }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "title": "Response Baz Post Router", "type": "array", "items": {"$ref": "#/components/schemas/Item"}, } } }, }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "title": "Response 404 Baz Post Router", "type": "array", "items": { "$ref": "#/components/schemas/Message" }, } } }, }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, }, }, } }, }, "components": { "schemas": { "Body_baz_post_router": { "title": "Body_baz_post_router", "required": ["item1", "item2"], "type": "object", "properties": { "item1": {"$ref": "#/components/schemas/Item"}, "item2": {"$ref": "#/components/schemas/Item"}, }, }, "Body_foo_post_root": { "title": "Body_foo_post_root", "required": ["item1", "item2"], "type": "object", "properties": { "item1": {"$ref": "#/components/schemas/Item"}, "item2": {"$ref": "#/components/schemas/Item"}, }, }, "HTTPValidationError": { "title": "HTTPValidationError", "type": "object", "properties": { "detail": { "title": "Detail", "type": "array", "items": {"$ref": "#/components/schemas/ValidationError"}, } }, }, "Item": { "title": "Item", "required": ["name", "price"], "type": "object", "properties": { "name": {"title": "Name", "type": "string"}, "price": {"title": "Price", "type": "number"}, }, }, "Message": { "title": "Message", "required": ["title", "description"], "type": "object", "properties": { "title": {"title": "Title", "type": "string"}, "description": {"title": "Description", "type": "string"}, }, }, "ValidationError": { "title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", "properties": { "loc": { "title": "Location", "type": "array", "items": { "anyOf": [{"type": "string"}, {"type": "integer"}] }, }, "msg": {"title": "Message", "type": "string"}, "type": {"title": "Error Type", "type": "string"}, }, }, } }, } def test_app_path_operation_overrides_generate_unique_id(): app = FastAPI(generate_unique_id_function=custom_generate_unique_id) router = APIRouter(generate_unique_id_function=custom_generate_unique_id2) @app.post( "/", response_model=List[Item], responses={404: {"model": List[Message]}}, generate_unique_id_function=custom_generate_unique_id3, ) def post_root(item1: Item, item2: Item): return item1, item2 # pragma: nocover @router.post( "/router", response_model=List[Item], responses={404: {"model": List[Message]}}, ) def post_router(item1: Item, item2: Item): return item1, item2 # pragma: nocover app.include_router(router) client = TestClient(app) response = client.get("/openapi.json") data = response.json() assert data == { "openapi": "3.0.2", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/": { "post": { "summary": "Post Root", "operationId": "baz_post_root", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Body_baz_post_root" } } }, "required": True, }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "title": "Response Baz Post Root", "type": "array", "items": {"$ref": "#/components/schemas/Item"}, } } }, }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "title": "Response 404 Baz Post Root", "type": "array", "items": { "$ref": "#/components/schemas/Message" }, } } }, }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, }, }, } }, "/router": { "post": { "summary": "Post Router", "operationId": "bar_post_router", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Body_bar_post_router" } } }, "required": True, }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "title": "Response Bar Post Router", "type": "array", "items": {"$ref": "#/components/schemas/Item"}, } } }, }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "title": "Response 404 Bar Post Router", "type": "array", "items": { "$ref": "#/components/schemas/Message" }, } } }, }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, }, }, } }, }, "components": { "schemas": { "Body_bar_post_router": { "title": "Body_bar_post_router", "required": ["item1", "item2"], "type": "object", "properties": { "item1": {"$ref": "#/components/schemas/Item"}, "item2": {"$ref": "#/components/schemas/Item"}, }, }, "Body_baz_post_root": { "title": "Body_baz_post_root", "required": ["item1", "item2"], "type": "object", "properties": { "item1": {"$ref": "#/components/schemas/Item"}, "item2": {"$ref": "#/components/schemas/Item"}, }, }, "HTTPValidationError": { "title": "HTTPValidationError", "type": "object", "properties": { "detail": { "title": "Detail", "type": "array", "items": {"$ref": "#/components/schemas/ValidationError"}, } }, }, "Item": { "title": "Item", "required": ["name", "price"], "type": "object", "properties": { "name": {"title": "Name", "type": "string"}, "price": {"title": "Price", "type": "number"}, }, }, "Message": { "title": "Message", "required": ["title", "description"], "type": "object", "properties": { "title": {"title": "Title", "type": "string"}, "description": {"title": "Description", "type": "string"}, }, }, "ValidationError": { "title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", "properties": { "loc": { "title": "Location", "type": "array", "items": { "anyOf": [{"type": "string"}, {"type": "integer"}] }, }, "msg": {"title": "Message", "type": "string"}, "type": {"title": "Error Type", "type": "string"}, }, }, } }, } def test_callback_override_generate_unique_id(): app = FastAPI(generate_unique_id_function=custom_generate_unique_id) callback_router = APIRouter(generate_unique_id_function=custom_generate_unique_id2) @callback_router.post( "/post-callback", response_model=List[Item], responses={404: {"model": List[Message]}}, generate_unique_id_function=custom_generate_unique_id3, ) def post_callback(item1: Item, item2: Item): return item1, item2 # pragma: nocover @app.post( "/", response_model=List[Item], responses={404: {"model": List[Message]}}, generate_unique_id_function=custom_generate_unique_id3, callbacks=callback_router.routes, ) def post_root(item1: Item, item2: Item): return item1, item2 # pragma: nocover @app.post( "/tocallback", response_model=List[Item], responses={404: {"model": List[Message]}}, ) def post_with_callback(item1: Item, item2: Item): return item1, item2 # pragma: nocover client = TestClient(app) response = client.get("/openapi.json") data = response.json() assert data == { "openapi": "3.0.2", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/": { "post": { "summary": "Post Root", "operationId": "baz_post_root", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Body_baz_post_root" } } }, "required": True, }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "title": "Response Baz Post Root", "type": "array", "items": {"$ref": "#/components/schemas/Item"}, } } }, }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "title": "Response 404 Baz Post Root", "type": "array", "items": { "$ref": "#/components/schemas/Message" }, } } }, }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, }, }, "callbacks": { "post_callback": { "/post-callback": { "post": { "summary": "Post Callback", "operationId": "baz_post_callback", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Body_baz_post_callback" } } }, "required": True, }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "title": "Response Baz Post Callback", "type": "array", "items": { "$ref": "#/components/schemas/Item" }, } } }, }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "title": "Response 404 Baz Post Callback", "type": "array", "items": { "$ref": "#/components/schemas/Message" }, } } }, }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, }, }, } } } }, } }, "/tocallback": { "post": { "summary": "Post With Callback", "operationId": "foo_post_with_callback", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Body_foo_post_with_callback" } } }, "required": True, }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "title": "Response Foo Post With Callback", "type": "array", "items": {"$ref": "#/components/schemas/Item"}, } } }, }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "title": "Response 404 Foo Post With Callback", "type": "array", "items": { "$ref": "#/components/schemas/Message" }, } } }, }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, }, }, } }, }, "components": { "schemas": { "Body_baz_post_callback": { "title": "Body_baz_post_callback", "required": ["item1", "item2"], "type": "object", "properties": { "item1": {"$ref": "#/components/schemas/Item"}, "item2": {"$ref": "#/components/schemas/Item"}, }, }, "Body_baz_post_root": { "title": "Body_baz_post_root", "required": ["item1", "item2"], "type": "object", "properties": { "item1": {"$ref": "#/components/schemas/Item"}, "item2": {"$ref": "#/components/schemas/Item"}, }, }, "Body_foo_post_with_callback": { "title": "Body_foo_post_with_callback", "required": ["item1", "item2"], "type": "object", "properties": { "item1": {"$ref": "#/components/schemas/Item"}, "item2": {"$ref": "#/components/schemas/Item"}, }, }, "HTTPValidationError": { "title": "HTTPValidationError", "type": "object", "properties": { "detail": { "title": "Detail", "type": "array", "items": {"$ref": "#/components/schemas/ValidationError"}, } }, }, "Item": { "title": "Item", "required": ["name", "price"], "type": "object", "properties": { "name": {"title": "Name", "type": "string"}, "price": {"title": "Price", "type": "number"}, }, }, "Message": { "title": "Message", "required": ["title", "description"], "type": "object", "properties": { "title": {"title": "Title", "type": "string"}, "description": {"title": "Description", "type": "string"}, }, }, "ValidationError": { "title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", "properties": { "loc": { "title": "Location", "type": "array", "items": { "anyOf": [{"type": "string"}, {"type": "integer"}] }, }, "msg": {"title": "Message", "type": "string"}, "type": {"title": "Error Type", "type": "string"}, }, }, } }, } def test_warn_duplicate_operation_id(): def broken_operation_id(route: APIRoute): return "foo" app = FastAPI(generate_unique_id_function=broken_operation_id) @app.post("/") def post_root(item1: Item): return item1 # pragma: nocover @app.post("/second") def post_second(item1: Item): return item1 # pragma: nocover @app.post("/third") def post_third(item1: Item): return item1 # pragma: nocover client = TestClient(app) with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") client.get("/openapi.json") assert len(w) == 2 assert issubclass(w[-1].category, UserWarning) assert "Duplicate Operation ID" in str(w[-1].message)
41.772059
106
0.285161
c2e2ed68f79577483837a3a3d82f99ecd611f93b
4,125
go
Go
vendor/github.com/trustedanalytics-ng/tap-catalog/models/instance.go
trustedanalytics-ng/tap-image-factory
0e03b8cd6671f3274adf1d075572bfc60ac0ac6f
[ "Apache-2.0" ]
1
2019-09-05T19:38:31.000Z
2019-09-05T19:38:31.000Z
vendor/github.com/trustedanalytics-ng/tap-catalog/models/instance.go
trustedanalytics-ng/tap-image-factory
0e03b8cd6671f3274adf1d075572bfc60ac0ac6f
[ "Apache-2.0" ]
null
null
null
vendor/github.com/trustedanalytics-ng/tap-catalog/models/instance.go
trustedanalytics-ng/tap-image-factory
0e03b8cd6671f3274adf1d075572bfc60ac0ac6f
[ "Apache-2.0" ]
null
null
null
/** * Copyright (c) 2016 Intel Corporation * * 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 models import ( "fmt" "reflect" "strings" ) func init() { RegisterType("Metadata", reflect.TypeOf(Metadata{})) RegisterType("Bindings", reflect.TypeOf(InstanceBindings{})) } const ( BROKER_OFFERING_PREFIX = "BROKER_OFFERING_" BROKER_TEMPLATE_ID = "BROKER_TEMPLATE_ID" APPLICATION_IMAGE_ADDRESS = "APPLICATION_IMAGE_ADDRESS" OFFERING_PLAN_ID = "PLAN_ID" LAST_STATE_CHANGE_REASON = "LAST_STATE_CHANGE_REASON" ) const ReasonDeleteFailure = "Instance was in FAILURE state. Removing..." type Instance struct { Id string `json:"id"` Name string `json:"name"` Type InstanceType `json:"type"` ClassId string `json:"classId"` Bindings []InstanceBindings `json:"bindings"` Metadata []Metadata `json:"metadata"` State InstanceState `json:"state"` AuditTrail AuditTrail `json:"auditTrail"` } type InstanceState string const ( InstanceStateRequested InstanceState = "REQUESTED" InstanceStateDeploying InstanceState = "DEPLOYING" InstanceStateFailure InstanceState = "FAILURE" InstanceStateStopped InstanceState = "STOPPED" InstanceStateStartReq InstanceState = "START_REQ" InstanceStateStarting InstanceState = "STARTING" InstanceStateRunning InstanceState = "RUNNING" InstanceStateReconfiguration InstanceState = "RECONFIGURATION" InstanceStateStopReq InstanceState = "STOP_REQ" InstanceStateStopping InstanceState = "STOPPING" InstanceStateDestroyReq InstanceState = "DESTROY_REQ" InstanceStateDestroying InstanceState = "DESTROYING" InstanceStateUnavailable InstanceState = "UNAVAILABLE" ) func (state InstanceState) String() string { return string(state) } type InstanceBindings struct { Id string `json:"id"` Data map[string]string `json:"data"` } type Metadata struct { Id string `json:"key"` Value string `json:"value"` } type InstanceType string const ( InstanceTypeApplication InstanceType = "APPLICATION" InstanceTypeService InstanceType = "SERVICE" InstanceTypeServiceBroker InstanceType = "SERVICE_BROKER" ) func GetValueFromMetadata(metadatas []Metadata, key string) string { for _, metadata := range metadatas { if metadata.Id == key { return metadata.Value } } return "" } func GetPrefixedOfferingName(offeringName string) string { return BROKER_OFFERING_PREFIX + offeringName } func IsServiceBrokerOfferingMetadata(metadata Metadata) bool { return strings.Contains(metadata.Id, BROKER_OFFERING_PREFIX) } func (instance *Instance) ValidateInstanceStructCreate(instanceType InstanceType) error { if instance.Id != "" { return GetIdFieldHasToBeEmptyError() } if instanceType == InstanceTypeService && GetValueFromMetadata(instance.Metadata, OFFERING_PLAN_ID) == "" { return fmt.Errorf("key %s not found!", OFFERING_PLAN_ID) } err := CheckIfMatchingRegexp(instance.Name, RegexpDnsLabelLowercase) if err != nil { return GetInvalidValueError("Name", instance.Name, err) } //although it copies for loop from instances.go, in this case we don't query etcd before being sure request is proper //in most cases bindings array will be small so no issue with performance should happen here for _, binding := range instance.Bindings { for k := range binding.Data { if err = CheckIfMatchingRegexp(k, RegexpProperSystemEnvName); err != nil { return GetInvalidValueError("Data", k, err) } } } return nil }
31.25
118
0.726788
b0cd3962c1bfa00ae4eade9d14917658750a7e24
721
lua
Lua
CompressedFluidsKingfork/prototypes/recipe/decompressor.lua
bjerkt/Factorio-Mods
198c8c603e9c91a6f9b2bae78c70bf6a35836563
[ "Unlicense" ]
5
2019-12-28T05:24:50.000Z
2021-10-05T12:40:36.000Z
CompressedFluidsKingfork/prototypes/recipe/decompressor.lua
bjerkt/Factorio-Mods
198c8c603e9c91a6f9b2bae78c70bf6a35836563
[ "Unlicense" ]
3
2019-10-04T05:14:58.000Z
2021-12-05T19:41:55.000Z
CompressedFluidsKingfork/prototypes/recipe/decompressor.lua
bjerkt/Factorio-Mods
198c8c603e9c91a6f9b2bae78c70bf6a35836563
[ "Unlicense" ]
5
2019-12-27T19:14:07.000Z
2021-10-13T20:17:21.000Z
if settings.startup["fluid-compression-singeEntity"].value == false then data:extend({ { type = "recipe", name = "fluid-compressor-to-decompressor", enabled = false, energy_required = 1, ingredients = { {"fluid-compressor", 1}, }, result = "fluid-decompressor", }, { type = "recipe", name = "fluid-decompressor-to-compressor", enabled = false, energy_required = 2.5, ingredients = { {"fluid-decompressor", 1}, }, allow_as_intermediate = false, allow_intermediates = false, result = "fluid-compressor", order = data.raw["item"]["fluid-compressor"].order.."-bis" }, }) end
24.033333
72
0.558946
f0577968e01ff58468ce5e55f1fbd26663455932
320
js
JavaScript
data/js/00/13/44/00/00/00.24.js
hdm/mac-tracker
69f0c4efaa3d60111001d40f7a33886cc507e742
[ "CC-BY-4.0", "MIT" ]
20
2018-12-26T17:06:05.000Z
2021-08-05T07:47:31.000Z
data/js/00/13/44/00/00/00.24.js
hdm/mac-tracker
69f0c4efaa3d60111001d40f7a33886cc507e742
[ "CC-BY-4.0", "MIT" ]
1
2021-06-03T12:20:55.000Z
2021-06-03T16:36:26.000Z
data/js/00/13/44/00/00/00.24.js
hdm/mac-tracker
69f0c4efaa3d60111001d40f7a33886cc507e742
[ "CC-BY-4.0", "MIT" ]
8
2018-12-27T05:07:48.000Z
2021-01-26T00:41:17.000Z
macDetailCallback("001344000000/24",[{"d":"2005-01-15","t":"add","a":"6533 Flying Cloud Drive\nEden Prairie MN 55344\n\n","c":"UNITED STATES","o":"Fargo Electronics Inc.","s":"wireshark.org"},{"d":"2015-08-27","t":"change","a":"6533 Flying Cloud Drive Eden Prairie MN US 55344","c":"US","o":"Fargo Electronics Inc."}]);
160
319
0.6625
e9356367d369197c50795d3b135375209a369db3
1,247
go
Go
bmsf-configuration/pkg/common/common_test.go
stonewesley/bk-bcs
6f58cdcfb7caf7c09b2dd4071ab752ba00071c54
[ "Apache-2.0" ]
null
null
null
bmsf-configuration/pkg/common/common_test.go
stonewesley/bk-bcs
6f58cdcfb7caf7c09b2dd4071ab752ba00071c54
[ "Apache-2.0" ]
null
null
null
bmsf-configuration/pkg/common/common_test.go
stonewesley/bk-bcs
6f58cdcfb7caf7c09b2dd4071ab752ba00071c54
[ "Apache-2.0" ]
null
null
null
/* * Tencent is pleased to support the open source community by making Blueking Container Service available., * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT * 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 common import ( "testing" ) // TestVerifyFileUser test VerifyFileUser function func TestVerifyFileUser(t *testing.T) { testCases := []struct { userInput string isValid bool }{ { "user00", true, }, { "root", true, }, { "007root", false, }, { "root+1", false, }, } for i, c := range testCases { t.Logf("test %d", i) err := VerifyFileUser(c.userInput) if (c.isValid && err != nil) || (!c.isValid && err == nil) { t.Errorf("isValid %v err %v", c.isValid, err) } } }
24.45098
107
0.677626
81d97e82de7ecb1307ef845ea444bf8bbe164c89
18,799
html
HTML
docs/javadoc/org/pdfbox/pdmodel/graphics/color/PDGamma.html
lockss/lockss-sf-pdfbox
83fd469a983fcf310f5795c610bc11136f28cf6a
[ "BSD-3-Clause" ]
null
null
null
docs/javadoc/org/pdfbox/pdmodel/graphics/color/PDGamma.html
lockss/lockss-sf-pdfbox
83fd469a983fcf310f5795c610bc11136f28cf6a
[ "BSD-3-Clause" ]
null
null
null
docs/javadoc/org/pdfbox/pdmodel/graphics/color/PDGamma.html
lockss/lockss-sf-pdfbox
83fd469a983fcf310f5795c610bc11136f28cf6a
[ "BSD-3-Clause" ]
null
null
null
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.4.2_07) on Thu Oct 12 12:19:57 EDT 2006 --> <TITLE> PDGamma (PDFBox-0.7.3 API) </TITLE> <META NAME="keywords" CONTENT="org.pdfbox.pdmodel.graphics.color.PDGamma class"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { parent.document.title="PDGamma (PDFBox-0.7.3 API)"; } </SCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/PDGamma.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../../org/pdfbox/pdmodel/graphics/color/PDDeviceRGB.html" title="class in org.pdfbox.pdmodel.graphics.color"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../../org/pdfbox/pdmodel/graphics/color/PDICCBased.html" title="class in org.pdfbox.pdmodel.graphics.color"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="PDGamma.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> org.pdfbox.pdmodel.graphics.color</FONT> <BR> Class PDGamma</H2> <PRE> <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html" title="class or interface in java.lang">java.lang.Object</A> <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by"><B>org.pdfbox.pdmodel.graphics.color.PDGamma</B> </PRE> <DL> <DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../../../org/pdfbox/pdmodel/common/COSObjectable.html" title="interface in org.pdfbox.pdmodel.common">COSObjectable</A></DD> </DL> <HR> <DL> <DT>public class <B>PDGamma</B><DT>extends <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A><DT>implements <A HREF="../../../../../org/pdfbox/pdmodel/common/COSObjectable.html" title="interface in org.pdfbox.pdmodel.common">COSObjectable</A></DL> <P> A gamma array, or collection of three floating point parameters used for color operations. <P> <P> <DL> <DT><B>Version:</B></DT> <DD>$Revision: 1.2 $</DD> <DT><B>Author:</B></DT> <DD><a href="mailto:ben@benlitchfield.com">Ben Litchfield</a></DD> </DL> <HR> <P> <!-- ======== NESTED CLASS SUMMARY ======== --> <!-- =========== FIELD SUMMARY =========== --> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TD COLSPAN=2><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../../org/pdfbox/pdmodel/graphics/color/PDGamma.html#PDGamma()">PDGamma</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructor. </TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../../org/pdfbox/pdmodel/graphics/color/PDGamma.html#PDGamma(org.pdfbox.cos.COSArray)">PDGamma</A></B>(<A HREF="../../../../../org/pdfbox/cos/COSArray.html" title="class in org.pdfbox.cos">COSArray</A>&nbsp;array)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructor from COS object.</TD> </TR> </TABLE> &nbsp; <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TD COLSPAN=2><FONT SIZE="+2"> <B>Method Summary</B></FONT></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;float</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/pdfbox/pdmodel/graphics/color/PDGamma.html#getB()">getB</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This will get the b value of the tristimulus.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../org/pdfbox/cos/COSArray.html" title="class in org.pdfbox.cos">COSArray</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/pdfbox/pdmodel/graphics/color/PDGamma.html#getCOSArray()">getCOSArray</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Convert this standard java object to a COS object.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../org/pdfbox/cos/COSBase.html" title="class in org.pdfbox.cos">COSBase</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/pdfbox/pdmodel/graphics/color/PDGamma.html#getCOSObject()">getCOSObject</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Convert this standard java object to a COS object.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;float</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/pdfbox/pdmodel/graphics/color/PDGamma.html#getG()">getG</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This will get the g value of the tristimulus.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;float</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/pdfbox/pdmodel/graphics/color/PDGamma.html#getR()">getR</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This will get the r value of the tristimulus.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/pdfbox/pdmodel/graphics/color/PDGamma.html#setB(float)">setB</A></B>(float&nbsp;b)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This will set the b value of the tristimulus.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/pdfbox/pdmodel/graphics/color/PDGamma.html#setG(float)">setG</A></B>(float&nbsp;g)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This will set the g value of the tristimulus.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/pdfbox/pdmodel/graphics/color/PDGamma.html#setR(float)">setR</A></B>(float&nbsp;r)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This will set the r value of the tristimulus.</TD> </TR> </TABLE> &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TD><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></B></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD> </TR> </TABLE> &nbsp; <P> <!-- ============ FIELD DETAIL =========== --> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TD COLSPAN=1><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TD> </TR> </TABLE> <A NAME="PDGamma()"><!-- --></A><H3> PDGamma</H3> <PRE> public <B>PDGamma</B>()</PRE> <DL> <DD>Constructor. Defaults all values to 0, 0, 0. <P> </DL> <HR> <A NAME="PDGamma(org.pdfbox.cos.COSArray)"><!-- --></A><H3> PDGamma</H3> <PRE> public <B>PDGamma</B>(<A HREF="../../../../../org/pdfbox/cos/COSArray.html" title="class in org.pdfbox.cos">COSArray</A>&nbsp;array)</PRE> <DL> <DD>Constructor from COS object. <P> <DT><B>Parameters:</B><DD><CODE>array</CODE> - The array containing the XYZ values.</DL> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TD COLSPAN=1><FONT SIZE="+2"> <B>Method Detail</B></FONT></TD> </TR> </TABLE> <A NAME="getCOSObject()"><!-- --></A><H3> getCOSObject</H3> <PRE> public <A HREF="../../../../../org/pdfbox/cos/COSBase.html" title="class in org.pdfbox.cos">COSBase</A> <B>getCOSObject</B>()</PRE> <DL> <DD>Convert this standard java object to a COS object. <P> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/pdfbox/pdmodel/common/COSObjectable.html#getCOSObject()">getCOSObject</A></CODE> in interface <CODE><A HREF="../../../../../org/pdfbox/pdmodel/common/COSObjectable.html" title="interface in org.pdfbox.pdmodel.common">COSObjectable</A></CODE></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>The cos object that matches this Java object.</DL> </DD> </DL> <HR> <A NAME="getCOSArray()"><!-- --></A><H3> getCOSArray</H3> <PRE> public <A HREF="../../../../../org/pdfbox/cos/COSArray.html" title="class in org.pdfbox.cos">COSArray</A> <B>getCOSArray</B>()</PRE> <DL> <DD>Convert this standard java object to a COS object. <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>The cos object that matches this Java object.</DL> </DD> </DL> <HR> <A NAME="getR()"><!-- --></A><H3> getR</H3> <PRE> public float <B>getR</B>()</PRE> <DL> <DD>This will get the r value of the tristimulus. <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>The R value.</DL> </DD> </DL> <HR> <A NAME="setR(float)"><!-- --></A><H3> setR</H3> <PRE> public void <B>setR</B>(float&nbsp;r)</PRE> <DL> <DD>This will set the r value of the tristimulus. <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>r</CODE> - The r value for the tristimulus.</DL> </DD> </DL> <HR> <A NAME="getG()"><!-- --></A><H3> getG</H3> <PRE> public float <B>getG</B>()</PRE> <DL> <DD>This will get the g value of the tristimulus. <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>The g value.</DL> </DD> </DL> <HR> <A NAME="setG(float)"><!-- --></A><H3> setG</H3> <PRE> public void <B>setG</B>(float&nbsp;g)</PRE> <DL> <DD>This will set the g value of the tristimulus. <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>g</CODE> - The g value for the tristimulus.</DL> </DD> </DL> <HR> <A NAME="getB()"><!-- --></A><H3> getB</H3> <PRE> public float <B>getB</B>()</PRE> <DL> <DD>This will get the b value of the tristimulus. <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>The B value.</DL> </DD> </DL> <HR> <A NAME="setB(float)"><!-- --></A><H3> setB</H3> <PRE> public void <B>setB</B>(float&nbsp;b)</PRE> <DL> <DD>This will set the b value of the tristimulus. <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>b</CODE> - The b value for the tristimulus.</DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/PDGamma.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../../org/pdfbox/pdmodel/graphics/color/PDDeviceRGB.html" title="class in org.pdfbox.pdmodel.graphics.color"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../../org/pdfbox/pdmodel/graphics/color/PDICCBased.html" title="class in org.pdfbox.pdmodel.graphics.color"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="PDGamma.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>
40.602592
1,521
0.614501
7f580b7e4bd6ebffca62efb5c40fc5964fba9b19
5,719
html
HTML
Audio/Sermon Index/KenBaird/index.html
BFFBraga/homeflix2
edaf608a0a11c2de833ed040a31abb7e34850f0c
[ "Unlicense" ]
1
2021-08-21T19:30:58.000Z
2021-08-21T19:30:58.000Z
Audio/Sermon Index/KenBaird/index.html
BFFBraga/homeflix2
edaf608a0a11c2de833ed040a31abb7e34850f0c
[ "Unlicense" ]
1
2019-05-17T03:39:07.000Z
2019-05-17T03:39:07.000Z
Audio/Sermon Index/KenBaird/index.html
BFFBraga/homeflix2
edaf608a0a11c2de833ed040a31abb7e34850f0c
[ "Unlicense" ]
null
null
null
<h1>./KenBaird/</h1><p>Use a download manager like <a href=http://jdownloader.org>jdownloader</a> to download this entire folder.</p> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8430">2Peter2.1.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8444">AVarietyOfTerms.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8458">AppropiatingTheLord.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8406">Church-Part1.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8407">Church-Part2.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8408">Church-Part3.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8409">Church-Part4.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8410">Church-Part5.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8411">Church-Part6.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8412">Church-Part7.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8413">ContinualQuickening-Part1.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8414">ContinualQuickening-Part2.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8415">Crowns-Part1.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8416">Crowns-Part2.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8442">ElijahandElisha.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8445">Fullness.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8432">Genesis3.1-7.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8446">GiftsFromTheFather.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8433">IfAnyManThirst.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8447">Jehosophat.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8448">Jeremiah37-39.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8436">MotivatingPowerOfLove.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8452">OpenHouseAtLyman.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8437">ParableOfTheInheritance.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8456">ParableOfTheSower.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8438">Philemon3.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8450">PleadingOfTheKing.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8429">RahabTheHarlot.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8434">Rehoboam.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8453">SevenBeatitudesInRevelation.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8417">StudiesinHebrews-Part1.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8418">StudiesinHebrews-Part2.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8419">StudiesinHebrews-Part3.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8420">StudiesinHebrews-Part4.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8443">SuperioritiesInChrist.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8435">TheDemandsOfAKing.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8431">TheGospelMessage.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8421">TheHolySpirit-Part1.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8422">TheHolySpirit-Part2.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8423">TheHolySpirit-Part3.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8424">TheHolySpirit-Part4.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8425">TheHolySpirit-Part5.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8426">TheHolySpirit-Part6.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8455">TheHolySpiritsMinistry.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8451">TheLordsPrayer.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8439">TheRockInScripture.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8440">TheSupernaturalLife.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8457">TheWisdomOfSolomon.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8441">TheWisdomOfTheKing.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8454">ThingsThatBringUsTogether.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8427">Tongues-Part1.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8428">Tongues-Part2.mp3</a><br> <a href="http://www.sermonindex.net/modules/mydownloads/visit.php?lid=8449">Zachaaeus.mp3</a><br>
103.981818
133
0.766568
755fd5f11a4aeec3042613d52f5a29befb32522f
978
rs
Rust
Parity/parity-bitcoin-master/db/src/block_origin.rs
jeamick/Nchain-Project
b791a6d3af6116b76131c1c6eada1b6e857274ec
[ "MIT" ]
null
null
null
Parity/parity-bitcoin-master/db/src/block_origin.rs
jeamick/Nchain-Project
b791a6d3af6116b76131c1c6eada1b6e857274ec
[ "MIT" ]
null
null
null
Parity/parity-bitcoin-master/db/src/block_origin.rs
jeamick/Nchain-Project
b791a6d3af6116b76131c1c6eada1b6e857274ec
[ "MIT" ]
null
null
null
use std::fmt; use hash::H256; #[derive(Clone)] pub struct SideChainOrigin { /// newest ancestor block number pub ancestor: u32, /// side chain block hashes. Ordered from oldest to newest pub canonized_route: Vec<H256>, /// canon chain block hahses. Ordered from oldest to newest pub decanonized_route: Vec<H256>, /// new block number pub block_number: u32, } impl fmt::Debug for SideChainOrigin { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("SideChainOrigin") .field("ancestor", &self.ancestor) .field("canonized_route", &self.canonized_route.iter().map(|h| h.reversed()).collect::<Vec<_>>()) .field("decanonized_route", &self.decanonized_route.iter().map(|h| h.reversed()).collect::<Vec<_>>()) .field("block_number", &self.block_number) .finish() } } #[derive(Debug)] pub enum BlockOrigin { KnownBlock, CanonChain { block_number: u32, }, SideChain(SideChainOrigin), SideChainBecomingCanonChain(SideChainOrigin), }
27.166667
104
0.708589
8a4bf341f170fe4121004b5e4a4d89493d02d80f
207
rs
Rust
src/lib.rs
ditsing/more-sync
df47c9c3c1112220aae86117cdfa7c590c547263
[ "MIT" ]
null
null
null
src/lib.rs
ditsing/more-sync
df47c9c3c1112220aae86117cdfa7c590c547263
[ "MIT" ]
null
null
null
src/lib.rs
ditsing/more-sync
df47c9c3c1112220aae86117cdfa7c590c547263
[ "MIT" ]
null
null
null
//! A collection of synchronization utils for concurrent programming. mod carrier; mod versioned_parker; pub use carrier::{Carrier, CarrierRef}; pub use versioned_parker::{VersionedGuard, VersionedParker};
29.571429
69
0.806763
38e82e0eaeb6937a932ebf53dccfdc63d50ca7c6
4,686
c
C
autosrc/rtpp_netaddr_fin.c
CyBHFal/rtpproxy
0bc25b3e8a332bbac85b12cf5a46a9f9e9a228fb
[ "BSD-2-Clause" ]
340
2015-01-16T00:57:44.000Z
2022-03-30T03:35:00.000Z
autosrc/rtpp_netaddr_fin.c
CyBHFal/rtpproxy
0bc25b3e8a332bbac85b12cf5a46a9f9e9a228fb
[ "BSD-2-Clause" ]
100
2015-01-13T01:48:47.000Z
2022-03-30T20:26:45.000Z
autosrc/rtpp_netaddr_fin.c
CyBHFal/rtpproxy
0bc25b3e8a332bbac85b12cf5a46a9f9e9a228fb
[ "BSD-2-Clause" ]
108
2015-01-08T19:13:39.000Z
2022-03-15T07:41:16.000Z
/* Auto-generated by genfincode_stat.sh - DO NOT EDIT! */ #include <stdio.h> #include <stdint.h> #include <stdlib.h> #define RTPP_FINCODE #include "rtpp_types.h" #include "rtpp_debug.h" #include "rtpp_netaddr.h" #include "rtpp_netaddr_fin.h" static void rtpp_netaddr_cmp_fin(void *pub) { fprintf(stderr, "Method rtpp_netaddr@%p::cmp (rtpp_netaddr_cmp) is invoked after destruction\x0a", pub); RTPP_AUTOTRAP(); } static void rtpp_netaddr_cmphost_fin(void *pub) { fprintf(stderr, "Method rtpp_netaddr@%p::cmphost (rtpp_netaddr_cmphost) is invoked after destruction\x0a", pub); RTPP_AUTOTRAP(); } static void rtpp_netaddr_copy_fin(void *pub) { fprintf(stderr, "Method rtpp_netaddr@%p::copy (rtpp_netaddr_copy) is invoked after destruction\x0a", pub); RTPP_AUTOTRAP(); } static void rtpp_netaddr_get_fin(void *pub) { fprintf(stderr, "Method rtpp_netaddr@%p::get (rtpp_netaddr_get) is invoked after destruction\x0a", pub); RTPP_AUTOTRAP(); } static void rtpp_netaddr_isaddrseq_fin(void *pub) { fprintf(stderr, "Method rtpp_netaddr@%p::isaddrseq (rtpp_netaddr_isaddrseq) is invoked after destruction\x0a", pub); RTPP_AUTOTRAP(); } static void rtpp_netaddr_isempty_fin(void *pub) { fprintf(stderr, "Method rtpp_netaddr@%p::isempty (rtpp_netaddr_isempty) is invoked after destruction\x0a", pub); RTPP_AUTOTRAP(); } static void rtpp_netaddr_set_fin(void *pub) { fprintf(stderr, "Method rtpp_netaddr@%p::set (rtpp_netaddr_set) is invoked after destruction\x0a", pub); RTPP_AUTOTRAP(); } static void rtpp_netaddr_sip_print_fin(void *pub) { fprintf(stderr, "Method rtpp_netaddr@%p::sip_print (rtpp_netaddr_sip_print) is invoked after destruction\x0a", pub); RTPP_AUTOTRAP(); } static const struct rtpp_netaddr_smethods rtpp_netaddr_smethods_fin = { .cmp = (rtpp_netaddr_cmp_t)&rtpp_netaddr_cmp_fin, .cmphost = (rtpp_netaddr_cmphost_t)&rtpp_netaddr_cmphost_fin, .copy = (rtpp_netaddr_copy_t)&rtpp_netaddr_copy_fin, .get = (rtpp_netaddr_get_t)&rtpp_netaddr_get_fin, .isaddrseq = (rtpp_netaddr_isaddrseq_t)&rtpp_netaddr_isaddrseq_fin, .isempty = (rtpp_netaddr_isempty_t)&rtpp_netaddr_isempty_fin, .set = (rtpp_netaddr_set_t)&rtpp_netaddr_set_fin, .sip_print = (rtpp_netaddr_sip_print_t)&rtpp_netaddr_sip_print_fin, }; void rtpp_netaddr_fin(struct rtpp_netaddr *pub) { RTPP_DBG_ASSERT(pub->smethods->cmp != (rtpp_netaddr_cmp_t)NULL); RTPP_DBG_ASSERT(pub->smethods->cmphost != (rtpp_netaddr_cmphost_t)NULL); RTPP_DBG_ASSERT(pub->smethods->copy != (rtpp_netaddr_copy_t)NULL); RTPP_DBG_ASSERT(pub->smethods->get != (rtpp_netaddr_get_t)NULL); RTPP_DBG_ASSERT(pub->smethods->isaddrseq != (rtpp_netaddr_isaddrseq_t)NULL); RTPP_DBG_ASSERT(pub->smethods->isempty != (rtpp_netaddr_isempty_t)NULL); RTPP_DBG_ASSERT(pub->smethods->set != (rtpp_netaddr_set_t)NULL); RTPP_DBG_ASSERT(pub->smethods->sip_print != (rtpp_netaddr_sip_print_t)NULL); RTPP_DBG_ASSERT(pub->smethods != &rtpp_netaddr_smethods_fin && pub->smethods != NULL); pub->smethods = &rtpp_netaddr_smethods_fin; } #if defined(RTPP_FINTEST) #include <assert.h> #include <stddef.h> #include "rtpp_mallocs.h" #include "rtpp_refcnt.h" #include "rtpp_linker_set.h" #define CALL_TFIN(pub, fn) ((void (*)(typeof(pub)))((pub)->smethods->fn))(pub) void rtpp_netaddr_fintest() { int naborts_s; struct { struct rtpp_netaddr pub; } *tp; naborts_s = _naborts; tp = rtpp_rzmalloc(sizeof(*tp), offsetof(typeof(*tp), pub.rcnt)); assert(tp != NULL); assert(tp->pub.rcnt != NULL); static const struct rtpp_netaddr_smethods dummy = { .cmp = (rtpp_netaddr_cmp_t)((void *)0x1), .cmphost = (rtpp_netaddr_cmphost_t)((void *)0x1), .copy = (rtpp_netaddr_copy_t)((void *)0x1), .get = (rtpp_netaddr_get_t)((void *)0x1), .isaddrseq = (rtpp_netaddr_isaddrseq_t)((void *)0x1), .isempty = (rtpp_netaddr_isempty_t)((void *)0x1), .set = (rtpp_netaddr_set_t)((void *)0x1), .sip_print = (rtpp_netaddr_sip_print_t)((void *)0x1), }; tp->pub.smethods = &dummy; CALL_SMETHOD(tp->pub.rcnt, attach, (rtpp_refcnt_dtor_t)&rtpp_netaddr_fin, &tp->pub); RTPP_OBJ_DECREF(&(tp->pub)); CALL_TFIN(&tp->pub, cmp); CALL_TFIN(&tp->pub, cmphost); CALL_TFIN(&tp->pub, copy); CALL_TFIN(&tp->pub, get); CALL_TFIN(&tp->pub, isaddrseq); CALL_TFIN(&tp->pub, isempty); CALL_TFIN(&tp->pub, set); CALL_TFIN(&tp->pub, sip_print); assert((_naborts - naborts_s) == 8); } const static void *_rtpp_netaddr_ftp = (void *)&rtpp_netaddr_fintest; DATA_SET(rtpp_fintests, _rtpp_netaddr_ftp); #endif /* RTPP_FINTEST */
41.469027
120
0.719163
0a3ff9cdee5edf9dd160c70402bd1e3aa97aa548
390
ts
TypeScript
stagifyfrontend/src/app/components/artist-item/artist-item.component.ts
Davee02/Stagify
048dd53219267cfdbe804cd91626a06964f64a2a
[ "MIT" ]
null
null
null
stagifyfrontend/src/app/components/artist-item/artist-item.component.ts
Davee02/Stagify
048dd53219267cfdbe804cd91626a06964f64a2a
[ "MIT" ]
2
2021-01-02T18:02:56.000Z
2021-01-04T18:24:08.000Z
stagifyfrontend/src/app/components/artist-item/artist-item.component.ts
Davee02/Stagify
048dd53219267cfdbe804cd91626a06964f64a2a
[ "MIT" ]
null
null
null
import { Component, Input, OnInit } from '@angular/core'; import ArtistModel from 'src/app/models/artist.model'; @Component({ selector: 'app-artist-item', templateUrl: './artist-item.component.html', styleUrls: ['./artist-item.component.scss'], }) export class ArtistItemComponent implements OnInit { @Input() artistModel: ArtistModel; constructor() {} ngOnInit(): void {} }
24.375
57
0.710256
bb5dd9b331f24c2271142dc49b01f1b45124cdb5
45,149
html
HTML
docs/wtengine/classwte_1_1mgr_1_1world.html
wtfsystems/wtfsystems.github.io
27be982ee3281ccb43207c5e2ee662b52e06f1ed
[ "MIT" ]
1
2021-08-25T13:40:52.000Z
2021-08-25T13:40:52.000Z
docs/wtengine/classwte_1_1mgr_1_1world.html
wtfsystems/wtfsystems.github.io
27be982ee3281ccb43207c5e2ee662b52e06f1ed
[ "MIT" ]
5
2021-04-26T18:38:04.000Z
2021-06-29T03:43:10.000Z
docs/wtengine/classwte_1_1mgr_1_1world.html
wtfsystems/wtfsystems.github.io
27be982ee3281ccb43207c5e2ee662b52e06f1ed
[ "MIT" ]
1
2020-07-15T05:43:53.000Z
2020-07-15T05:43:53.000Z
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=11"/> <meta name="generator" content="Doxygen 1.9.2"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>WTEngine: wte::mgr::world Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">WTEngine </div> <div id="projectbrief">C++ Game Engine using Allegro</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.9.2 --> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */ var searchBox = new SearchBox("searchBox", "search",'Search','.html'); /* @license-end */ </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */ $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); /* @license-end */ </script> <div id="main-nav"></div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="namespacewte.html">wte</a></li><li class="navelem"><a class="el" href="namespacewte_1_1mgr.html">mgr</a></li><li class="navelem"><a class="el" href="classwte_1_1mgr_1_1world.html">world</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#pub-static-methods">Static Public Member Functions</a> &#124; <a href="#pub-static-attribs">Static Public Attributes</a> &#124; <a href="#friends">Friends</a> &#124; <a href="classwte_1_1mgr_1_1world-members.html">List of all members</a> </div> <div class="headertitle"><div class="title">wte::mgr::world Class Reference<span class="mlabels"><span class="mlabel">final</span></span></div></div> </div><!--header--> <div class="contents"> <p>Store a collection of entities and their corresponding components in memory. <a href="classwte_1_1mgr_1_1world.html#details">More...</a></p> <p><code>#include &lt;world.hpp&gt;</code></p> <div class="dynheader"> Inheritance diagram for wte::mgr::world:</div> <div class="dyncontent"> <div class="center"> <img src="classwte_1_1mgr_1_1world.png" usemap="#wte::mgr::world_map" alt=""/> <map id="wte::mgr::world_map" name="wte::mgr::world_map"> <area href="classwte_1_1mgr_1_1manager.html" alt="wte::mgr::manager&lt; world &gt;" shape="rect" coords="0,0,168,24"/> </map> </div></div> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-static-methods" name="pub-static-methods"></a> Static Public Member Functions</h2></td></tr> <tr class="memitem:a71400054906705fca9d0bcd8c4e8b6e2"><td class="memItemLeft" align="right" valign="top">static const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classwte_1_1mgr_1_1world.html#a71400054906705fca9d0bcd8c4e8b6e2">new_entity</a> (void)</td></tr> <tr class="memdesc:a71400054906705fca9d0bcd8c4e8b6e2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a new entity by name, using the next available ID. <a href="classwte_1_1mgr_1_1world.html#a71400054906705fca9d0bcd8c4e8b6e2">More...</a><br /></td></tr> <tr class="separator:a71400054906705fca9d0bcd8c4e8b6e2"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ac14c840bc97aad4c94d285e7dc165f15"><td class="memItemLeft" align="right" valign="top">static const bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classwte_1_1mgr_1_1world.html#ac14c840bc97aad4c94d285e7dc165f15">delete_entity</a> (const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> &amp;e_id)</td></tr> <tr class="memdesc:ac14c840bc97aad4c94d285e7dc165f15"><td class="mdescLeft">&#160;</td><td class="mdescRight">Delete entity by ID. <a href="classwte_1_1mgr_1_1world.html#ac14c840bc97aad4c94d285e7dc165f15">More...</a><br /></td></tr> <tr class="separator:ac14c840bc97aad4c94d285e7dc165f15"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aa018f5a92c3a08f9857b216916a0aa1b"><td class="memItemLeft" align="right" valign="top">static const bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classwte_1_1mgr_1_1world.html#aa018f5a92c3a08f9857b216916a0aa1b">entity_exists</a> (const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> &amp;e_id)</td></tr> <tr class="memdesc:aa018f5a92c3a08f9857b216916a0aa1b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if an entity exists. <a href="classwte_1_1mgr_1_1world.html#aa018f5a92c3a08f9857b216916a0aa1b">More...</a><br /></td></tr> <tr class="separator:aa018f5a92c3a08f9857b216916a0aa1b"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ac68ca36f979b0cc244fd06700dd19484"><td class="memItemLeft" align="right" valign="top">static const std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classwte_1_1mgr_1_1world.html#ac68ca36f979b0cc244fd06700dd19484">get_name</a> (const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> &amp;e_id)</td></tr> <tr class="memdesc:ac68ca36f979b0cc244fd06700dd19484"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get entity name. <a href="classwte_1_1mgr_1_1world.html#ac68ca36f979b0cc244fd06700dd19484">More...</a><br /></td></tr> <tr class="separator:ac68ca36f979b0cc244fd06700dd19484"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ad1bdd3cc983c97ec2191dac23e8f2cdf"><td class="memItemLeft" align="right" valign="top">static const bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classwte_1_1mgr_1_1world.html#ad1bdd3cc983c97ec2191dac23e8f2cdf">set_name</a> (const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> &amp;e_id, const std::string &amp;name)</td></tr> <tr class="memdesc:ad1bdd3cc983c97ec2191dac23e8f2cdf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the entity name. <a href="classwte_1_1mgr_1_1world.html#ad1bdd3cc983c97ec2191dac23e8f2cdf">More...</a><br /></td></tr> <tr class="separator:ad1bdd3cc983c97ec2191dac23e8f2cdf"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ad8ed4ac1b8f40e30b9656b710ed0076d"><td class="memItemLeft" align="right" valign="top">static const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classwte_1_1mgr_1_1world.html#ad8ed4ac1b8f40e30b9656b710ed0076d">get_id</a> (const std::string &amp;name)</td></tr> <tr class="memdesc:ad8ed4ac1b8f40e30b9656b710ed0076d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get entity ID by name. <a href="classwte_1_1mgr_1_1world.html#ad8ed4ac1b8f40e30b9656b710ed0076d">More...</a><br /></td></tr> <tr class="separator:ad8ed4ac1b8f40e30b9656b710ed0076d"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a96f5c518b653ab53e98aea0808337528"><td class="memItemLeft" align="right" valign="top">static const <a class="el" href="namespacewte.html#a9f86554d6a9e6f20df0dba235e5e36dc">world_container</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classwte_1_1mgr_1_1world.html#a96f5c518b653ab53e98aea0808337528">get_entities</a> (void)</td></tr> <tr class="memdesc:a96f5c518b653ab53e98aea0808337528"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the entity reference vector. <a href="classwte_1_1mgr_1_1world.html#a96f5c518b653ab53e98aea0808337528">More...</a><br /></td></tr> <tr class="separator:a96f5c518b653ab53e98aea0808337528"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a8927c25edea7270cde2bd0c0e9d111e1"><td class="memItemLeft" align="right" valign="top">static const <a class="el" href="namespacewte.html#ae0779b06e2731efe7a169ea34facbb49">entity_container</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classwte_1_1mgr_1_1world.html#a8927c25edea7270cde2bd0c0e9d111e1">set_entity</a> (const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> &amp;e_id)</td></tr> <tr class="memdesc:a8927c25edea7270cde2bd0c0e9d111e1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set all components related to an entity. <a href="classwte_1_1mgr_1_1world.html#a8927c25edea7270cde2bd0c0e9d111e1">More...</a><br /></td></tr> <tr class="separator:a8927c25edea7270cde2bd0c0e9d111e1"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a5530e7c9ca4585b1e1fe071aca4ef809"><td class="memItemLeft" align="right" valign="top">static const <a class="el" href="namespacewte.html#adb06d3544221b0d8128e07b63ff0760e">const_entity_container</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classwte_1_1mgr_1_1world.html#a5530e7c9ca4585b1e1fe071aca4ef809">get_entity</a> (const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> &amp;e_id)</td></tr> <tr class="memdesc:a5530e7c9ca4585b1e1fe071aca4ef809"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get all components related to an entity. <a href="classwte_1_1mgr_1_1world.html#a5530e7c9ca4585b1e1fe071aca4ef809">More...</a><br /></td></tr> <tr class="separator:a5530e7c9ca4585b1e1fe071aca4ef809"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a86a9ce6fefe7d04544b93148b6620722"><td class="memTemplParams" colspan="2">template&lt;typename T , typename... Args&gt; </td></tr> <tr class="memitem:a86a9ce6fefe7d04544b93148b6620722"><td class="memTemplItemLeft" align="right" valign="top">static const bool&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classwte_1_1mgr_1_1world.html#a86a9ce6fefe7d04544b93148b6620722">add_component</a> (const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> &amp;e_id, Args... args)</td></tr> <tr class="memdesc:a86a9ce6fefe7d04544b93148b6620722"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a new component to an entity. <a href="classwte_1_1mgr_1_1world.html#a86a9ce6fefe7d04544b93148b6620722">More...</a><br /></td></tr> <tr class="separator:a86a9ce6fefe7d04544b93148b6620722"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:abb1c22c50e6be539f14c650b83146178"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr> <tr class="memitem:abb1c22c50e6be539f14c650b83146178"><td class="memTemplItemLeft" align="right" valign="top">static const bool&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classwte_1_1mgr_1_1world.html#abb1c22c50e6be539f14c650b83146178">delete_component</a> (const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> &amp;e_id)</td></tr> <tr class="memdesc:abb1c22c50e6be539f14c650b83146178"><td class="mdescLeft">&#160;</td><td class="mdescRight">Delete a component by type for an entity. <a href="classwte_1_1mgr_1_1world.html#abb1c22c50e6be539f14c650b83146178">More...</a><br /></td></tr> <tr class="separator:abb1c22c50e6be539f14c650b83146178"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:af8f632f4274c045e8f67cfe981ed037b"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr> <tr class="memitem:af8f632f4274c045e8f67cfe981ed037b"><td class="memTemplItemLeft" align="right" valign="top">static const bool&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classwte_1_1mgr_1_1world.html#af8f632f4274c045e8f67cfe981ed037b">has_component</a> (const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> &amp;e_id)</td></tr> <tr class="memdesc:af8f632f4274c045e8f67cfe981ed037b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if an entity has a component by type. <a href="classwte_1_1mgr_1_1world.html#af8f632f4274c045e8f67cfe981ed037b">More...</a><br /></td></tr> <tr class="separator:af8f632f4274c045e8f67cfe981ed037b"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a536f15ca8b8a4fd73121bca48ff32009"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr> <tr class="memitem:a536f15ca8b8a4fd73121bca48ff32009"><td class="memTemplItemLeft" align="right" valign="top">static const std::shared_ptr&lt; T &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classwte_1_1mgr_1_1world.html#a536f15ca8b8a4fd73121bca48ff32009">set_component</a> (const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> &amp;e_id)</td></tr> <tr class="memdesc:a536f15ca8b8a4fd73121bca48ff32009"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the value of a component by type for an entity. <a href="classwte_1_1mgr_1_1world.html#a536f15ca8b8a4fd73121bca48ff32009">More...</a><br /></td></tr> <tr class="separator:a536f15ca8b8a4fd73121bca48ff32009"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ab7f7cf991482e2026a7c30a7c42446d9"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr> <tr class="memitem:ab7f7cf991482e2026a7c30a7c42446d9"><td class="memTemplItemLeft" align="right" valign="top">static const std::shared_ptr&lt; const T &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classwte_1_1mgr_1_1world.html#ab7f7cf991482e2026a7c30a7c42446d9">get_component</a> (const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> &amp;e_id)</td></tr> <tr class="memdesc:ab7f7cf991482e2026a7c30a7c42446d9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read the value of a component by type for an entity. <a href="classwte_1_1mgr_1_1world.html#ab7f7cf991482e2026a7c30a7c42446d9">More...</a><br /></td></tr> <tr class="separator:ab7f7cf991482e2026a7c30a7c42446d9"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a4ea7a44464ed5feb29e62d3e0680e0f5"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr> <tr class="memitem:a4ea7a44464ed5feb29e62d3e0680e0f5"><td class="memTemplItemLeft" align="right" valign="top">static const <a class="el" href="namespacewte.html#a56755629ebb58790ea2caba5b704ff51">component_container</a>&lt; T &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classwte_1_1mgr_1_1world.html#a4ea7a44464ed5feb29e62d3e0680e0f5">set_components</a> (void)</td></tr> <tr class="memdesc:a4ea7a44464ed5feb29e62d3e0680e0f5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set all components for a particulair type. <a href="classwte_1_1mgr_1_1world.html#a4ea7a44464ed5feb29e62d3e0680e0f5">More...</a><br /></td></tr> <tr class="separator:a4ea7a44464ed5feb29e62d3e0680e0f5"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a10ba157fd774620fc5941f39e8360101"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr> <tr class="memitem:a10ba157fd774620fc5941f39e8360101"><td class="memTemplItemLeft" align="right" valign="top">static const <a class="el" href="namespacewte.html#a4fc4f86a660a0c1c54c06a1186c7d0f8">const_component_container</a>&lt; T &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classwte_1_1mgr_1_1world.html#a10ba157fd774620fc5941f39e8360101">get_components</a> (void)</td></tr> <tr class="memdesc:a10ba157fd774620fc5941f39e8360101"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get all components for a particulair type. <a href="classwte_1_1mgr_1_1world.html#a10ba157fd774620fc5941f39e8360101">More...</a><br /></td></tr> <tr class="separator:a10ba157fd774620fc5941f39e8360101"><td class="memSeparator" colspan="2">&#160;</td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-static-attribs" name="pub-static-attribs"></a> Static Public Attributes</h2></td></tr> <tr class="memitem:a54e970329a13066b0d997bba1fd4195c"><td class="memItemLeft" align="right" valign="top"><a id="a54e970329a13066b0d997bba1fd4195c" name="a54e970329a13066b0d997bba1fd4195c"></a> static const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a>&#160;</td><td class="memItemRight" valign="bottom"><b>ENTITY_ERROR</b> = 0</td></tr> <tr class="memdesc:a54e970329a13066b0d997bba1fd4195c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Entity error code. <br /></td></tr> <tr class="separator:a54e970329a13066b0d997bba1fd4195c"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a6d5864e136fec4dcfc271e3b98a1d4e8"><td class="memItemLeft" align="right" valign="top"><a id="a6d5864e136fec4dcfc271e3b98a1d4e8" name="a6d5864e136fec4dcfc271e3b98a1d4e8"></a> static const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a>&#160;</td><td class="memItemRight" valign="bottom"><b>ENTITY_START</b> = 1</td></tr> <tr class="memdesc:a6d5864e136fec4dcfc271e3b98a1d4e8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Start of Entity counter. <br /></td></tr> <tr class="separator:a6d5864e136fec4dcfc271e3b98a1d4e8"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aaf30a4968d3884bf61190fd4ce4b97f6"><td class="memItemLeft" align="right" valign="top">static const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classwte_1_1mgr_1_1world.html#aaf30a4968d3884bf61190fd4ce4b97f6">ENTITY_MAX</a></td></tr> <tr class="memdesc:aaf30a4968d3884bf61190fd4ce4b97f6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Entity max value. <a href="classwte_1_1mgr_1_1world.html#aaf30a4968d3884bf61190fd4ce4b97f6">More...</a><br /></td></tr> <tr class="separator:aaf30a4968d3884bf61190fd4ce4b97f6"><td class="memSeparator" colspan="2">&#160;</td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="friends" name="friends"></a> Friends</h2></td></tr> <tr class="memitem:a3cb4ac1e642c3c077cd603a991204bf0"><td class="memItemLeft" align="right" valign="top"><a id="a3cb4ac1e642c3c077cd603a991204bf0" name="a3cb4ac1e642c3c077cd603a991204bf0"></a> class&#160;</td><td class="memItemRight" valign="bottom"><b>wte::engine</b></td></tr> <tr class="separator:a3cb4ac1e642c3c077cd603a991204bf0"><td class="memSeparator" colspan="2">&#160;</td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p >Store a collection of entities and their corresponding components in memory. </p> </div><h2 class="groupheader">Member Function Documentation</h2> <a id="a86a9ce6fefe7d04544b93148b6620722" name="a86a9ce6fefe7d04544b93148b6620722"></a> <h2 class="memtitle"><span class="permalink"><a href="#a86a9ce6fefe7d04544b93148b6620722">&#9670;&nbsp;</a></span>add_component()</h2> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template&lt;typename T , typename... Args&gt; </div> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">static const bool wte::mgr::world::add_component </td> <td>(</td> <td class="paramtype">const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> &amp;&#160;</td> <td class="paramname"><em>e_id</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Args...&#160;</td> <td class="paramname"><em>args</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">static</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Add a new component to an entity. </p> <p >Entities can only have a single compoenent of each type.</p> <dl class="tparams"><dt>Template Parameters</dt><dd> <table class="tparams"> <tr><td class="paramname">T</td><td>Component type to add. </td></tr> </table> </dd> </dl> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">e_id</td><td>Entity ID to add a component to. </td></tr> <tr><td class="paramname">args</td><td>List of parameters to pass to component constructor. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>Return false if the entity does not exist. </dd> <dd> Return false if the entity already has a component of the same type. </dd> <dd> Return true on success. </dd></dl> </div> </div> <a id="abb1c22c50e6be539f14c650b83146178" name="abb1c22c50e6be539f14c650b83146178"></a> <h2 class="memtitle"><span class="permalink"><a href="#abb1c22c50e6be539f14c650b83146178">&#9670;&nbsp;</a></span>delete_component()</h2> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template&lt;typename T &gt; </div> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">static const bool wte::mgr::world::delete_component </td> <td>(</td> <td class="paramtype">const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> &amp;&#160;</td> <td class="paramname"><em>e_id</em></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">static</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Delete a component by type for an entity. </p> <dl class="tparams"><dt>Template Parameters</dt><dd> <table class="tparams"> <tr><td class="paramname">T</td><td>Component type to delete. </td></tr> </table> </dd> </dl> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">e_id</td><td>Entity ID to delete component from. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>Return true if a component was deleted. </dd> <dd> Return false if no components were deleted. </dd></dl> </div> </div> <a id="ac14c840bc97aad4c94d285e7dc165f15" name="ac14c840bc97aad4c94d285e7dc165f15"></a> <h2 class="memtitle"><span class="permalink"><a href="#ac14c840bc97aad4c94d285e7dc165f15">&#9670;&nbsp;</a></span>delete_entity()</h2> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">static const bool wte::mgr::world::delete_entity </td> <td>(</td> <td class="paramtype">const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> &amp;&#160;</td> <td class="paramname"><em>e_id</em></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">static</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Delete entity by ID. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">e_id</td><td>The entity ID to delete. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>Return true on success, false if entity does not exist. </dd></dl> </div> </div> <a id="aa018f5a92c3a08f9857b216916a0aa1b" name="aa018f5a92c3a08f9857b216916a0aa1b"></a> <h2 class="memtitle"><span class="permalink"><a href="#aa018f5a92c3a08f9857b216916a0aa1b">&#9670;&nbsp;</a></span>entity_exists()</h2> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">static const bool wte::mgr::world::entity_exists </td> <td>(</td> <td class="paramtype">const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> &amp;&#160;</td> <td class="paramname"><em>e_id</em></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">static</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Check if an entity exists. </p> <p >Check the entity vector by ID and return result.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">e_id</td><td>The entity ID to check. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>Return true if found, return false if not found. </dd></dl> </div> </div> <a id="ab7f7cf991482e2026a7c30a7c42446d9" name="ab7f7cf991482e2026a7c30a7c42446d9"></a> <h2 class="memtitle"><span class="permalink"><a href="#ab7f7cf991482e2026a7c30a7c42446d9">&#9670;&nbsp;</a></span>get_component()</h2> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template&lt;typename T &gt; </div> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">static const std::shared_ptr&lt; const T &gt; wte::mgr::world::get_component </td> <td>(</td> <td class="paramtype">const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> &amp;&#160;</td> <td class="paramname"><em>e_id</em></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">static</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Read the value of a component by type for an entity. </p> <dl class="tparams"><dt>Template Parameters</dt><dd> <table class="tparams"> <tr><td class="paramname">T</td><td>Component type to search. </td></tr> </table> </dd> </dl> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">e_id</td><td>The entity ID to search. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>Return the component. </dd></dl> <dl class="exception"><dt>Exceptions</dt><dd> <table class="exception"> <tr><td class="paramname"><a class="el" href="classwte_1_1wte__exception.html" title="Throws an internal engine exception.">wte_exception</a></td><td>Component not found. </td></tr> </table> </dd> </dl> </div> </div> <a id="a10ba157fd774620fc5941f39e8360101" name="a10ba157fd774620fc5941f39e8360101"></a> <h2 class="memtitle"><span class="permalink"><a href="#a10ba157fd774620fc5941f39e8360101">&#9670;&nbsp;</a></span>get_components()</h2> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template&lt;typename T &gt; </div> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">static const <a class="el" href="namespacewte.html#a4fc4f86a660a0c1c54c06a1186c7d0f8">const_component_container</a>&lt; T &gt; wte::mgr::world::get_components </td> <td>(</td> <td class="paramtype">void&#160;</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">static</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Get all components for a particulair type. </p> <p >This will return a container of non-modifiable components casted to their type.</p> <dl class="tparams"><dt>Template Parameters</dt><dd> <table class="tparams"> <tr><td class="paramname">T</td><td>Component type to search. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>Returns a constant container of components of all the same type. </dd></dl> </div> </div> <a id="a96f5c518b653ab53e98aea0808337528" name="a96f5c518b653ab53e98aea0808337528"></a> <h2 class="memtitle"><span class="permalink"><a href="#a96f5c518b653ab53e98aea0808337528">&#9670;&nbsp;</a></span>get_entities()</h2> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">static const <a class="el" href="namespacewte.html#a9f86554d6a9e6f20df0dba235e5e36dc">world_container</a> wte::mgr::world::get_entities </td> <td>(</td> <td class="paramtype">void&#160;</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">static</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Get the entity reference vector. </p> <dl class="section return"><dt>Returns</dt><dd>Returns a vector of all entity IDs and names. </dd></dl> </div> </div> <a id="a5530e7c9ca4585b1e1fe071aca4ef809" name="a5530e7c9ca4585b1e1fe071aca4ef809"></a> <h2 class="memtitle"><span class="permalink"><a href="#a5530e7c9ca4585b1e1fe071aca4ef809">&#9670;&nbsp;</a></span>get_entity()</h2> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">static const <a class="el" href="namespacewte.html#adb06d3544221b0d8128e07b63ff0760e">const_entity_container</a> wte::mgr::world::get_entity </td> <td>(</td> <td class="paramtype">const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> &amp;&#160;</td> <td class="paramname"><em>e_id</em></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">static</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Get all components related to an entity. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">e_id</td><td>Entity ID to get components for. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>Returns a constant container of components based by entity ID. </dd></dl> <dl class="exception"><dt>Exceptions</dt><dd> <table class="exception"> <tr><td class="paramname"><a class="el" href="classwte_1_1wte__exception.html" title="Throws an internal engine exception.">wte_exception</a></td><td>Entity does not exist. </td></tr> </table> </dd> </dl> </div> </div> <a id="ad8ed4ac1b8f40e30b9656b710ed0076d" name="ad8ed4ac1b8f40e30b9656b710ed0076d"></a> <h2 class="memtitle"><span class="permalink"><a href="#ad8ed4ac1b8f40e30b9656b710ed0076d">&#9670;&nbsp;</a></span>get_id()</h2> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">static const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> wte::mgr::world::get_id </td> <td>(</td> <td class="paramtype">const std::string &amp;&#160;</td> <td class="paramname"><em>name</em></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">static</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Get entity ID by name. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">name</td><td>Name to search. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>Entity ID, WTE_ENTITY_ERROR if not found. </dd></dl> </div> </div> <a id="ac68ca36f979b0cc244fd06700dd19484" name="ac68ca36f979b0cc244fd06700dd19484"></a> <h2 class="memtitle"><span class="permalink"><a href="#ac68ca36f979b0cc244fd06700dd19484">&#9670;&nbsp;</a></span>get_name()</h2> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">static const std::string wte::mgr::world::get_name </td> <td>(</td> <td class="paramtype">const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> &amp;&#160;</td> <td class="paramname"><em>e_id</em></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">static</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Get entity name. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">e_id</td><td>Entity ID to get name for. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>Entity name string. </dd></dl> <dl class="exception"><dt>Exceptions</dt><dd> <table class="exception"> <tr><td class="paramname"><a class="el" href="classwte_1_1wte__exception.html" title="Throws an internal engine exception.">wte_exception</a></td><td>Entity does not exist. </td></tr> </table> </dd> </dl> </div> </div> <a id="af8f632f4274c045e8f67cfe981ed037b" name="af8f632f4274c045e8f67cfe981ed037b"></a> <h2 class="memtitle"><span class="permalink"><a href="#af8f632f4274c045e8f67cfe981ed037b">&#9670;&nbsp;</a></span>has_component()</h2> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template&lt;typename T &gt; </div> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">static const bool wte::mgr::world::has_component </td> <td>(</td> <td class="paramtype">const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> &amp;&#160;</td> <td class="paramname"><em>e_id</em></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">static</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Check if an entity has a component by type. </p> <dl class="tparams"><dt>Template Parameters</dt><dd> <table class="tparams"> <tr><td class="paramname">T</td><td>Component type to check. </td></tr> </table> </dd> </dl> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">e_id</td><td>The entity ID to check. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>Return true if the entity has the component. </dd> <dd> Return false if it does not. </dd></dl> </div> </div> <a id="a71400054906705fca9d0bcd8c4e8b6e2" name="a71400054906705fca9d0bcd8c4e8b6e2"></a> <h2 class="memtitle"><span class="permalink"><a href="#a71400054906705fca9d0bcd8c4e8b6e2">&#9670;&nbsp;</a></span>new_entity()</h2> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">static const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> wte::mgr::world::new_entity </td> <td>(</td> <td class="paramtype">void&#160;</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">static</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Create a new entity by name, using the next available ID. </p> <p >Throw error if there is no room for entities.</p> <dl class="section return"><dt>Returns</dt><dd>The newly created entity ID. WTE_ENTITY_ERROR on fail. </dd></dl> </div> </div> <a id="a536f15ca8b8a4fd73121bca48ff32009" name="a536f15ca8b8a4fd73121bca48ff32009"></a> <h2 class="memtitle"><span class="permalink"><a href="#a536f15ca8b8a4fd73121bca48ff32009">&#9670;&nbsp;</a></span>set_component()</h2> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template&lt;typename T &gt; </div> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">static const std::shared_ptr&lt; T &gt; wte::mgr::world::set_component </td> <td>(</td> <td class="paramtype">const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> &amp;&#160;</td> <td class="paramname"><em>e_id</em></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">static</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Set the value of a component by type for an entity. </p> <dl class="tparams"><dt>Template Parameters</dt><dd> <table class="tparams"> <tr><td class="paramname">T</td><td>Component type to search. </td></tr> </table> </dd> </dl> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">e_id</td><td>The entity ID to search. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>Return the component. </dd></dl> <dl class="exception"><dt>Exceptions</dt><dd> <table class="exception"> <tr><td class="paramname"><a class="el" href="classwte_1_1wte__exception.html" title="Throws an internal engine exception.">wte_exception</a></td><td>Component not found. </td></tr> </table> </dd> </dl> </div> </div> <a id="a4ea7a44464ed5feb29e62d3e0680e0f5" name="a4ea7a44464ed5feb29e62d3e0680e0f5"></a> <h2 class="memtitle"><span class="permalink"><a href="#a4ea7a44464ed5feb29e62d3e0680e0f5">&#9670;&nbsp;</a></span>set_components()</h2> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template&lt;typename T &gt; </div> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">static const <a class="el" href="namespacewte.html#a56755629ebb58790ea2caba5b704ff51">component_container</a>&lt; T &gt; wte::mgr::world::set_components </td> <td>(</td> <td class="paramtype">void&#160;</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">static</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Set all components for a particulair type. </p> <p >This will return a container of modifiable components casted to their type.</p> <dl class="tparams"><dt>Template Parameters</dt><dd> <table class="tparams"> <tr><td class="paramname">T</td><td>Component type to search. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>Returns a container of components of all the same type. </dd></dl> </div> </div> <a id="a8927c25edea7270cde2bd0c0e9d111e1" name="a8927c25edea7270cde2bd0c0e9d111e1"></a> <h2 class="memtitle"><span class="permalink"><a href="#a8927c25edea7270cde2bd0c0e9d111e1">&#9670;&nbsp;</a></span>set_entity()</h2> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">static const <a class="el" href="namespacewte.html#ae0779b06e2731efe7a169ea34facbb49">entity_container</a> wte::mgr::world::set_entity </td> <td>(</td> <td class="paramtype">const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> &amp;&#160;</td> <td class="paramname"><em>e_id</em></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">static</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Set all components related to an entity. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">e_id</td><td>Entity ID to set components for. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>Returns a container of components based by entity ID. </dd></dl> <dl class="exception"><dt>Exceptions</dt><dd> <table class="exception"> <tr><td class="paramname"><a class="el" href="classwte_1_1wte__exception.html" title="Throws an internal engine exception.">wte_exception</a></td><td>Entity does not exist. </td></tr> </table> </dd> </dl> </div> </div> <a id="ad1bdd3cc983c97ec2191dac23e8f2cdf" name="ad1bdd3cc983c97ec2191dac23e8f2cdf"></a> <h2 class="memtitle"><span class="permalink"><a href="#ad1bdd3cc983c97ec2191dac23e8f2cdf">&#9670;&nbsp;</a></span>set_name()</h2> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">static const bool wte::mgr::world::set_name </td> <td>(</td> <td class="paramtype">const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> &amp;&#160;</td> <td class="paramname"><em>e_id</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const std::string &amp;&#160;</td> <td class="paramname"><em>name</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">static</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Set the entity name. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">e_id</td><td>Entity ID to set. </td></tr> <tr><td class="paramname">name</td><td>Entity name to set. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>True if set, false on error. </dd></dl> </div> </div> <h2 class="groupheader">Member Data Documentation</h2> <a id="aaf30a4968d3884bf61190fd4ce4b97f6" name="aaf30a4968d3884bf61190fd4ce4b97f6"></a> <h2 class="memtitle"><span class="permalink"><a href="#aaf30a4968d3884bf61190fd4ce4b97f6">&#9670;&nbsp;</a></span>ENTITY_MAX</h2> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">const <a class="el" href="namespacewte.html#abf2544b3056d60f0182109d89eab289a">entity_id</a> wte::mgr::world::ENTITY_MAX</td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">static</span></span> </td> </tr> </table> </div><div class="memdoc"> <b>Initial value:</b><div class="fragment"><div class="line">=</div> <div class="line"> std::numeric_limits&lt;entity_id&gt;::max()</div> </div><!-- fragment --> <p>Entity max value. </p> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li>include/wtengine/mgr/world.hpp</li> </ul> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Tue Oct 26 2021 21:26:19 for WTEngine by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.2 </small></address> </body> </html>
52.014977
483
0.688786
e7293f444a6bf0df1f2c10a7ba01efd7203eabd9
12,832
js
JavaScript
dist/structures/Function.js
Bumblebee-3/aoi.js
0cf9ad3ccec53ecb547b369247ed33f4fb390f64
[ "MIT" ]
null
null
null
dist/structures/Function.js
Bumblebee-3/aoi.js
0cf9ad3ccec53ecb547b369247ed33f4fb390f64
[ "MIT" ]
null
null
null
dist/structures/Function.js
Bumblebee-3/aoi.js
0cf9ad3ccec53ecb547b369247ed33f4fb390f64
[ "MIT" ]
null
null
null
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Function = void 0; const option_1 = __importDefault(require("../util/functions/option")); const Return_1 = require("./Return"); const ReturnType_1 = require("../typings/enums/ReturnType"); const AoiFunctionManager_1 = __importDefault(require("../core/AoiFunctionManager")); const createRuntimeError_1 = __importDefault(require("../util/functions/createRuntimeError")); const RuntimeErrorType_1 = require("../typings/enums/RuntimeErrorType"); const noop_1 = __importDefault(require("../util/functions/noop")); const Regexes_1 = require("../typings/namespaces/Regexes"); const BooleanInput_1 = __importDefault(require("../util/constants/BooleanInput")); const intoFunction_1 = __importDefault(require("../util/functions/intoFunction")); const AoiOperators_1 = __importDefault(require("../typings/enums/AoiOperators")); const checkCondition_1 = __importDefault(require("../util/functions/checkCondition")); class Function { data; inside = (0, option_1.default)(); fields = (0, option_1.default)(); conditionFields = new Array(); id; executor; constructor(data, id) { this.data = data; this.id = id; } setInside(str) { this.inside = str; if (this.inside !== null) { this.executor = (0, intoFunction_1.default)(this.inside); } return this; } async resolveConditionField(arg, data) { const lhs = await this.resolveField(arg, data.left); if (arg.mustReturn(lhs)) { return lhs; } if (data.op) { const rhs = await this.resolveField(arg, data.right); if (arg.mustReturn(rhs)) { return rhs; } return (0, checkCondition_1.default)(lhs.unwrapAs(), data.op, rhs.unwrapAs()); } else { return (0, checkCondition_1.default)(lhs.unwrapAs(), null, null); } } getConditionField(pos) { if (this.conditionFields[pos] !== undefined) return this.conditionFields[pos]; const normal = this.field(pos); if (!normal) return null; const op = AoiOperators_1.default.find(x => normal.value.includes(x)); if (!op) { return { op: null, right: null, value: normal.value, left: { executor: normal.executor, overloads: normal.overloads, value: normal.value } }; } const [left, right] = normal.value.split(op); const newer = { value: normal.value, op, left: { executor: (0, intoFunction_1.default)(left), value: left, overloads: normal.overloads.filter(c => left.includes(c.id)) }, right: { executor: (0, intoFunction_1.default)(right), value: right, overloads: normal.overloads.filter(c => right.includes(c.id)) }, }; this.conditionFields[pos] = newer; return newer; } /** * Gets an image of this function. */ get image() { if (!this.data.brackets) return this.data.name; if (this.data.optional && this.inside === null) { return this.data.name; } else { let inside = this.inside; for (let i = 0, len = this.fields.length; i < len; i++) { const field = this.fields[i]; for (let x = 0, len2 = field.overloads.length; x < len2; x++) { const overload = field.overloads[x]; inside = inside.replace(overload.id, overload.image); } } return `${this.data.name}[${inside}]`; } } async resolveAll(arg) { if (!this.hasFields()) return new Return_1.Return(ReturnType_1.ReturnType.Success, ''); const fields = this.fields; const code = new Array(); for (let i = 0, len = fields.length; i < len; i++) { const field = fields[i]; const val = await this.resolveField(arg, field); if (!val.isSuccess()) { return val; } code.push(val.as().unwrap()); } return new Return_1.Return(ReturnType_1.ReturnType.Success, code.join(';')); } /** * This function is not fully optimized, beware from using it too much. * @param arg * @param field * @param code * @returns */ async resolveCode(arg, field, code) { if (!field || !code) return Return_1.Return.string(''); for (let i = 0, len = field.overloads.length; i < len; i++) { const overload = field.overloads[i]; if (!code.includes(overload.id)) { continue; } const res = await overload.data.execute.call(arg, overload); if (!res.isSuccess()) { return res; } code = code.replace(overload.id, res.unwrapAs()); } return Return_1.Return.string(code); } /** * This function is not fully optimized, beware from using it too much. * @param arg * @param fields * @param codes * @returns */ async resolveCodes(arg, fields, codes) { if (!fields?.length || !codes?.length) return Return_1.Return.success([]); const newer = new Array(); for (let i = 0, len = fields.length; i < len; i++) { const field = fields[i]; const code = codes[i]; if (!field || !code) { newer.push(''); continue; } const t = performance.now(); const res = await this.resolveCode(arg, field, code); if (!res.isSuccess()) { return res; } newer.push(res.unwrapAs()); } return Return_1.Return.success(newer); } async resolveArray(arg, offset = 0) { const fields = this.data.fields; const parsedArgs = []; for (let i = offset, len = fields.length; i < len; i++) { const field = fields[i]; const unresolved = field.rest ? this.fields.slice(i) : [this.fields[i]]; for (let x = 0, len2 = unresolved.length; x < len2; x++) { const data = unresolved[x]; if (!data) { if (field.default) { const got = await field.default.call(arg); parsedArgs.push(got); continue; } if (!field.required) { parsedArgs.push(null); continue; } return (0, createRuntimeError_1.default)(arg, this, RuntimeErrorType_1.RuntimeErrorType.MISSING_FIELD, field.name); } let res = await this.resolveField(arg, data); if (!res.isSuccess()) { return res; } const input = res.unwrapAs(); const parsed = await this.#parse(parsedArgs, arg, field, input); if (!parsed.isSuccess()) { return parsed; } parsedArgs.push(parsed.unwrap()); } } return new Return_1.Return(ReturnType_1.ReturnType.Success, parsedArgs); } async #parse(args, arg, field, input) { let data = input; //@ts-ignore const reject = createRuntimeError_1.default.bind(null, arg, this, RuntimeErrorType_1.RuntimeErrorType.INVALID_INPUT, input, field.type); switch (field.type) { case 'TIME': { try { const ms = arg.bot.parser.parseToMS(input); data = ms; } catch (error) { return reject(); } } case 'USER': { if (!Regexes_1.Regexes.DISCORD_ID.test(input)) { return reject(); } const u = await arg.bot.client.users.fetch(input).catch(noop_1.default); if (!u) { return reject(); } data = u; break; } case 'NUMBER': { const n = Number(input); if (isNaN(n) || n > Number.MAX_SAFE_INTEGER) return reject(); data = n; break; } case 'BOOLEAN': { const res = BooleanInput_1.default[input]; if (res === undefined) return reject(); data = res; break; } case 'GUILD': { const guild = arg.bot.client.guilds.cache.get(input); if (!guild) return reject(); data = guild; break; } case 'MEMBER': { const guild = args[field.pointer]; if (!Regexes_1.Regexes.DISCORD_ID.test(input)) return reject(); const member = await guild.members.fetch(input).catch(noop_1.default); if (!member) return reject(); data = member; break; } case 'MESSAGE': { const channel = args[field.pointer]; if (!Regexes_1.Regexes.DISCORD_ID.test(input)) return reject(); const msg = await channel.messages?.fetch(input).catch(noop_1.default); if (!msg) return reject(); data = msg; break; } case 'CHANNEL': { const channel = arg.bot.client.channels.cache.get(input); if (!channel) return reject(); data = channel; break; } case 'ENUM': { const enums = field.choices; let got = null; input = input.toLowerCase(); for (let i = 0, len = enums.length; i < len; i++) { const [key, value] = enums[i]; if (key.toLowerCase() === input) { got = value; break; } } if (!got) return reject(); data = got; break; } } return new Return_1.Return(ReturnType_1.ReturnType.Success, data); } setFields(fields) { this.fields = []; for (let i = 0, len = fields.length; i < len; i++) { const raw = fields[i]; const overloads = []; for (let x = 0, len2 = raw.overloads.length; x < len2; x++) { const overload = raw.overloads[x]; const data = AoiFunctionManager_1.default.allFunctions.get(overload.name); const fn = Function.create(data, overload); overloads.push(fn); } this.fields.push({ value: raw.value, overloads: overloads, executor: (0, intoFunction_1.default)(raw.value) }); } return this; } static create(raw, data) { return new Function(raw, data.id) .setFields(data.fields) .setInside(data.inside); } get str() { return this.inside ?? undefined; } field(index) { return this.fields?.[index]; } hasFields() { return Boolean(this.fields?.length); } async resolveField(arg, field) { if (!field) return new Return_1.Return(ReturnType_1.ReturnType.Success); const { overloads } = field; const arr = []; for (let i = 0, len = overloads.length; i < len; i++) { const overload = overloads[i]; const res = await overload.data.execute.call(arg, overload); if (arg.mustReturnPlusBreak(res)) { return res; } const str = res.as().unwrap(); arr.push(str); } return Return_1.Return.string(field.executor(arr)); } } exports.Function = Function; //# sourceMappingURL=Function.js.map
36.351275
144
0.487453
268035f722db78d2c33ba1f4a9d0d370cf499a1a
1,036
java
Java
src/main/java/com/planmill/api/datahelper/webhooks/WebHookListener.java
planmill/api-data-helper
fc6f3bf3f8882d96268e383133e3a307704be14c
[ "MIT" ]
1
2020-08-27T12:40:05.000Z
2020-08-27T12:40:05.000Z
src/main/java/com/planmill/api/datahelper/webhooks/WebHookListener.java
planmill/api-data-helper
fc6f3bf3f8882d96268e383133e3a307704be14c
[ "MIT" ]
null
null
null
src/main/java/com/planmill/api/datahelper/webhooks/WebHookListener.java
planmill/api-data-helper
fc6f3bf3f8882d96268e383133e3a307704be14c
[ "MIT" ]
1
2020-04-16T11:32:10.000Z
2020-04-16T11:32:10.000Z
package com.planmill.api.datahelper.webhooks; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; /** * Endpoint that waits for incoming requests. * * Created by konstantin.petrukhnov@planmill.com on 2017-10-26. */ @Slf4j @RestController @RequestMapping(value = "/webhooks") public class WebHookListener { @RequestMapping(value = "/account/update", method = RequestMethod.POST) @ResponseStatus(HttpStatus.OK) @ResponseBody public String accountUpdate(@RequestBody String body) { log.info("accountUpdate: {}", body); return "ok"; } /** * Example of returning no content response. * * @param body * @return */ @RequestMapping(value = "/request/update", method = RequestMethod.POST) @ResponseStatus(HttpStatus.NO_CONTENT) @ResponseBody public Object requestUpdate(@RequestBody String body) { log.info("requestUpdate: {}", body); return null; } }
22.042553
75
0.681467
0bc2ad3e4f4d56e26e899d8c6fe3206f21e03522
200
js
JavaScript
src/index.js
AlexanderKrat/reverse-int-1
fa148bc4229bdb27497c0454ef3dba28971612fa
[ "MIT" ]
null
null
null
src/index.js
AlexanderKrat/reverse-int-1
fa148bc4229bdb27497c0454ef3dba28971612fa
[ "MIT" ]
null
null
null
src/index.js
AlexanderKrat/reverse-int-1
fa148bc4229bdb27497c0454ef3dba28971612fa
[ "MIT" ]
null
null
null
module.exports = function reverse (n) { let reverse = n.toString().split('').reverse().join(''); if (n < 0){ return reverse.slice(0, -1) } else{ return reverse } }
20
60
0.525
f9552593d6f9ff875c02358b42a367e0be541d13
1,085
swift
Swift
DouYuSwift/Classes/Tools/Extension/UIBarButtonItem-Extension.swift
pengfei923/PengSwift
533dd51c1a2dc16ed49677937ae2df678d4352be
[ "MIT" ]
null
null
null
DouYuSwift/Classes/Tools/Extension/UIBarButtonItem-Extension.swift
pengfei923/PengSwift
533dd51c1a2dc16ed49677937ae2df678d4352be
[ "MIT" ]
null
null
null
DouYuSwift/Classes/Tools/Extension/UIBarButtonItem-Extension.swift
pengfei923/PengSwift
533dd51c1a2dc16ed49677937ae2df678d4352be
[ "MIT" ]
null
null
null
// // UIBarButtonItem-Extension.swift // DouYuSwift // // Created by hoomsun on 2019/3/25. // Copyright © 2019年 hoomsun. All rights reserved. // import UIKit extension UIBarButtonItem { // 类方法 class func createItem(imageName:String,highImageImage:String,size:CGSize) ->UIBarButtonItem { let btn = UIButton() btn.setImage(UIImage(named: imageName), for: .normal) btn.setImage(UIImage(named: highImageImage), for: .highlighted) btn.frame = CGRect(origin: .zero, size: size) return UIBarButtonItem(customView: btn) } //便利构造函数 convenience init(imageName:String,highImageImage:String = "",size:CGSize = .zero) { let btn = UIButton() btn.setImage(UIImage(named: imageName), for: .normal) if highImageImage != "" { btn.setImage(UIImage(named: highImageImage), for: .highlighted) } if size == .zero { btn.sizeToFit() } else { btn.frame = CGRect(origin: .zero, size: size) } self.init(customView:btn) } }
28.552632
97
0.610138
40d119304a165f9dd8806ec5846e392ccbcc9300
2,570
html
HTML
005_Bootstrap_Colors_bg_txt.html
ddharanik96/Bootstrap
520cf246d55107fdf81ede65c3b27fc31c11f8ff
[ "BSL-1.0" ]
null
null
null
005_Bootstrap_Colors_bg_txt.html
ddharanik96/Bootstrap
520cf246d55107fdf81ede65c3b27fc31c11f8ff
[ "BSL-1.0" ]
null
null
null
005_Bootstrap_Colors_bg_txt.html
ddharanik96/Bootstrap
520cf246d55107fdf81ede65c3b27fc31c11f8ff
[ "BSL-1.0" ]
null
null
null
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie-edge"> <!-- CSS Files --> <link rel="stylesheet" href="bootstrap/css/bootstrap.css"> <link rel="stylesheet" href="bootstrap/css/mdb.css"> <link rel="stylesheet" href="bootstrap/css/style.css"> <title>Bootstrap Colors & Backgrounds</title> </head> <body> <!-- Javascript Files --> <script href="bootstrap/js/bootstrap.js"></script> <script href="bootstrap/js/jquery.js"></script> <script href="bootstrap/js/mdb.js"></script> <script href="bootstrap/js/popper.js"></script> <nav class="navbar navbar-expand-xl navbar-dark bg-dark "> <a class="navbar-brand"href="#">Bootstrap Colors & Backgrounds</a> </nav> <!-- **********************START HERE*************************--> <div class="container mt-5"> <div> <!-- Text Colors--> <h1 class="text-info">Welcome to Bootstrap Colors</h1> <h1 class="text-primary">Welcome to Bootstrap Colors</h1> <h1 class="text-secondary">Welcome to Bootstrap Colors</h1> <h1 class="text-success">Welcome to Bootstrap Colors</h1> <h1 class="text-warning">Welcome to Bootstrap Colors</h1> <h1 class="text-white bg-dark">Welcome to Bootstrap Colors</h1> <h1 class="text-dark">Welcome to Bootstrap Colors</h1> <h1 class="text-danger">Welcome to Bootstrap Colors</h1> <h1 class="text-black-50">Welcome to Bootstrap Colors</h1> <h1 class="text-light">Welcome to Bootstrap Colors</h1> <hr> <!-- Background Colors --> <h1 class=" bg-info">Welcome to Bootstrap background colors</h1> <h1 class=" bg-primary">Welcome to Bootstrap background colors</h1> <h1 class=" bg-secondary">Welcome to Bootstrap background colors</h1> <h1 class=" bg-success">Welcome to Bootstrap background colors</h1> <h1 class=" bg-warning">Welcome to Bootstrap background colors</h1> <h1 class=" bg-danger">Welcome to Bootstrap background colors</h1> <h1 class=" bg-black-50">Welcome to Bootstrap background colors</h1> <h1 class=" bg-light">Welcome to Bootstrap background colors</h1> <h1 class=" bg-white">Welcome to Bootstrap background colors</h1> <h1 class=" text-primary bg-dark">Welcome to Bootstrap background colors</h1> </div> </div> <!-- **********************END HERE*************************-->
38.939394
88
0.624514
dc16f83963911bc447f884b6e6f1c378e114241a
1,401
py
Python
scripts/setEnv.py
elastest/elastest-toolbox
bd06c8f0a9d8e2f9707cef8cae2f69d28dabea25
[ "Apache-2.0" ]
2
2017-11-23T06:27:52.000Z
2021-05-25T20:23:13.000Z
scripts/setEnv.py
elastest/elastest-toolbox
bd06c8f0a9d8e2f9707cef8cae2f69d28dabea25
[ "Apache-2.0" ]
2
2017-09-26T11:54:46.000Z
2019-10-03T13:13:54.000Z
scripts/setEnv.py
elastest/elastest-toolbox
bd06c8f0a9d8e2f9707cef8cae2f69d28dabea25
[ "Apache-2.0" ]
3
2017-10-02T14:52:14.000Z
2019-10-24T07:40:28.000Z
#!/usr/bin/python3 -u import fileinput def appendLine(path, line): with open(path, "a") as f: f.write(line + "\n") def searchAndReplace(path, pattern, value): for line in fileinput.input(path, inplace = True): print line.replace(pattern, value), def setServerAddress(address): etm_dir = '../etm' env_var_name = 'ET_PUBLIC_HOST' env_var = env_var_name + '=' + address default = env_var_name + '=localhost' try: searchAndReplace(etm_dir + '/deploy/docker-compose-main.yml', default, env_var) searchAndReplace(etm_dir + '/docker/docker-compose-main.yml', default, env_var) except IOError: print 'Error: Environment variable could not be inserted' exit(1) def replaceEnvVarValue(var_name, new_value, old_value, files_paths): env_var_name = var_name new_env_var = env_var_name + '=' + new_value old_env_var = env_var_name + '=' + old_value try: for file_path in files_paths: searchAndReplace(file_path, old_env_var, new_env_var) except IOError: print 'Error: Environment variable could not be inserted' exit(1) def replaceKeyValue(key_name, new_value, old_value, files_paths): new_key_entry = key_name + ': ' + new_value old_key_entry = key_name + ': ' + old_value try: for file_path in files_paths: searchAndReplace(file_path, old_key_entry, new_key_entry) except IOError: print 'Error: Environment variable could not be inserted' exit(1)
29.1875
81
0.734475
40b61d7e5c1b78b3e38053ee45e5e8f3b4f1168b
819
swift
Swift
testFiles/lucidDreamsTests/model/test18-extendProtocol.swift
theplanlab/swift
00dc16e7e4a0b28408308629e993b5d6e4fc3192
[ "Apache-2.0" ]
1
2018-01-11T07:08:30.000Z
2018-01-11T07:08:30.000Z
testFiles/lucidDreamsTests/model/test18-extendProtocol.swift
theplanlab/swift
00dc16e7e4a0b28408308629e993b5d6e4fc3192
[ "Apache-2.0" ]
153
2018-01-21T15:24:47.000Z
2018-09-13T12:46:16.000Z
testFiles/lucidDreamsTests/model/test18-extendProtocol.swift
theplanlab/swift
00dc16e7e4a0b28408308629e993b5d6e4fc3192
[ "Apache-2.0" ]
2
2018-01-11T09:33:05.000Z
2018-01-23T21:01:31.000Z
/* * Extending multiple structs/classes with a protocol to pass them into * functions * * Two different structs start off by being of different types. However, * we are able to pass them into a function and use a shared functionality * because we extend them both with the person protocol. */ struct Human{ init(_ name:String, age:Int = -1){ self.name = name self.age = age } var age:Int var name:String } class Pet{ init(_ name:String, ownerName:String="Unknown"){ self.name = name self.ownerName = ownerName } var name:String var ownerName:String } protocol Person{ var name:String{get set} } extension Human:Person{} extension Pet:Person{} func printName(_ p:Person){ print(p.name) } let y:Human=Human("Yaser") let p:Pet = Pet("Snowflake") printName(y) printName(p)
18.613636
74
0.699634
5f3f25c4ef49cf74898062ad6d72fa2e4e4cc5e3
1,523
ts
TypeScript
src/Components/TableColumn/TableColumnConfig.ts
vularsoft/dragit
d71f82782998b862484443b1525206a5f7c86d49
[ "MIT" ]
78
2021-07-02T05:30:07.000Z
2022-03-18T03:51:50.000Z
src/Components/TableColumn/TableColumnConfig.ts
vularsoft/dragit
d71f82782998b862484443b1525206a5f7c86d49
[ "MIT" ]
9
2021-07-16T07:16:39.000Z
2022-03-31T17:45:56.000Z
src/Components/TableColumn/TableColumnConfig.ts
vularsoft/dragit
d71f82782998b862484443b1525206a5f7c86d49
[ "MIT" ]
19
2020-12-21T03:38:44.000Z
2021-01-18T06:14:57.000Z
import { MetaConfig } from "Base/RXNode/MetaConfig"; import { IPropConfig } from "rx-drag/models/IPropConfig"; import { IMeta } from "Base/RXNode/IMeta"; export class TableColumnConfig extends MetaConfig{ accept(child:IMeta){ if(child.name === 'TableColumn' || child.name.startsWith('ListView') ){ return false; } return true; } getPropConfigs(): Array<IPropConfig>{ return [ { name:'label', labelKey:'label', propType:'string', }, { name:'width', labelKey:'width', propType:'string', }, { name:'align', labelKey:'align', propType:'select', props:{ items:[ { value:'center', label:'Center' }, { value:'inherit', label:'Inherit' }, { value:'justify', label:'Justify' }, { value:'left', label:'Left' }, { value:'right', label:'Right' }, ] }, }, { name:'size', labelKey:'size', propType:'select', props:{ items:[ { value:'medium', label:'Medium' }, { value:'small', label:'Small' }, ] }, }, ] } }
19.779221
57
0.389363
2dc1da82ef154456c59786298a6af50a3ebe17b0
2,651
html
HTML
other/webkb/course/misc/http:^^cs-www.bu.edu^students^grads^rgaimari^cs101^s96^cs101.html
Hyperpilotio/datasets
1fe03e7f08dd008f1b7f3b7ed750f40d3165ecf2
[ "Apache-2.0" ]
null
null
null
other/webkb/course/misc/http:^^cs-www.bu.edu^students^grads^rgaimari^cs101^s96^cs101.html
Hyperpilotio/datasets
1fe03e7f08dd008f1b7f3b7ed750f40d3165ecf2
[ "Apache-2.0" ]
null
null
null
other/webkb/course/misc/http:^^cs-www.bu.edu^students^grads^rgaimari^cs101^s96^cs101.html
Hyperpilotio/datasets
1fe03e7f08dd008f1b7f3b7ed750f40d3165ecf2
[ "Apache-2.0" ]
null
null
null
Date: Tue, 14 Jan 1997 20:30:10 GMT Server: NCSA/1.5 Content-type: text/html <TITLE>CS-101(B1): Introduction to Computers </TITLE> <H2> <!WA0><A href = "http://web.bu.edu/"> Boston University</A> / <!WA1><A href = "gopher://gopher.bu.edu">CAS</A><BR> <!WA2><A href = "http://cs-www.bu.edu/Home.html"> Computer Science Dept</A><P> <!WA3><A href = "http://cs-www.bu.edu/students/grads/rgaimari/cs101/s96/cs101.html">CAS CS-101 (B1): Introduction to Computers</A> </H2> <HR> <P> CS 101 is a general introduction to computers and their applications that assumes no previous knowledge of the subject. CS101 introduces computers and their uses in the arts and sciences -- what they are, how they work, how they can be programmed, what they can and cannot do. It is for people who read about such topics as microprocessors or the WWW and want to understand them, for people who need to have data processed on the job, and for people who see the computerization of our society and ask about the meaning of it all. <P> <B>Instructor</B>: <PRE> Name: <!WA4><A href="http://cs-www.bu.edu/students/grads/rgaimari/Home.html">Bob Gaimari</A> Email: <EM>rgaimari@cs.bu.edu</EM> Office: MCS-205A (ext: 3-5230) Hours: Thur: 10:00am-12:00pm / Fri: 9:30am-10:30am (or by appointment) </PRE> <P> <B>Teaching Fellow</B>: <PRE> Name: <!WA5><A href="http://cs-www.bu.edu/students/grads/rip/Home.html">Rob Pitts</A> Email: <EM>rip@cs.bu.edu</EM> Office: MCS-286 (ext: 3-6412) Hours: Mon: 2:00pm-4:00pm / Tue: 3:00pm-4:00pm / Thu: 7:00pm-9:00pm </PRE> <P> <B>Class Meeting</B>: <PRE> Time: Mon/Wed/Fri 8:00am-9:00am Place: STO B50 </PRE> <P> <HR> <P> <B>Course Archives</B>: <UL> <LI> <!WA6><A href = "http://cs-www.bu.edu/students/grads/rgaimari/cs101/s96/syllabus/syllSpring96.html"> Course Syllabus</A> <LI> <!WA7><A href = "http://cs-www.bu.edu/students/grads/rgaimari/cs101/s96/homeworks/list.html"> Homeworks Archive</A> <LI> <!WA8><A href = "http://cs-www.bu.edu/students/grads/rgaimari/cs101/s96/handouts/list.html"> Miscellaneous Handouts</A> <LI> <!WA9><A href = "http://cs-www.bu.edu/students/grads/rgaimari/cs101/s96/discussions/"> Discussion Sections</A> <LI> <!WA10><A href = "http://cs-www.bu.edu/students/grads/rgaimari/cs101/s96/students.html"> Student Home Pages </A> (Not available outside the CS cluster) </UL> <HR> This document has been adapted from one prepared by Professor <!WA11><A href = "http://cs-www.bu.edu/faculty/best/Home.html"> Azer Bestavros</A> <<EM>best@cs.bu.edu</EM>>.<P> <PRE> Created on: <EM>February 11, 1996.</EM> Updated on: <EM>March 18, 1996</EM> </PRE> <HR>
33.1375
105
0.685025
4d8fcb77ba0ea03d8d626836c2c059b8d6b0fac6
20,307
html
HTML
_projects/idea_video/printspeak/presentation-sample.html
klueless-io/k_dsl
4dde2c19bdb3092381c80ccd8ef6931594ed03e3
[ "MIT" ]
null
null
null
_projects/idea_video/printspeak/presentation-sample.html
klueless-io/k_dsl
4dde2c19bdb3092381c80ccd8ef6931594ed03e3
[ "MIT" ]
null
null
null
_projects/idea_video/printspeak/presentation-sample.html
klueless-io/k_dsl
4dde2c19bdb3092381c80ccd8ef6931594ed03e3
[ "MIT" ]
null
null
null
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>PrintSpeak Architecture</title> <link rel="stylesheet" href="../dist/reveal.css"> <link rel="stylesheet" href="../dist/theme/printspeak.css" id="theme"> <!-- <link rel="stylesheet" href="../plugin/highlight/zenburn.css"> <link rel="stylesheet" href="../plugin/highlight/monokai.css"> --> <link rel='stylesheet' href='../highlight_css/github-dark-dimmed.css'> </head> <body> <div class="reveal"> <div class="slides"> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-spec-1.rb.png" data-background-size='30% auto' data-background-opacity='.2'> <h2 data-id='h2'>Code audit on <a>campaign.rb</a></h2> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-spec-1.rb.png" data-background-size='30% auto' data-background-opacity='.2'> <h2 data-id='h2'>Campaign - Fat Model</h2> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-spec-1.rb.png" data-background-size='30% auto' data-background-opacity='.2'> <h2 data-id='h2'>Campaign - Fat Model</h2> <h3 data-id='h3'><a>82</a> methods, <a>1300</a> lines</h3> <p class='fragment fade-in-then-semi-out'>Including Rails DSL methods</p> <p class='fragment fade-in-then-semi-out'>scope<br/>belongs_to<br/>has_one<br/>has_many</p> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-spec-1.rb.png" data-background-size='30% auto' data-background-opacity='1'> <p class='fragment fade-in-then-semi-out'><a>DSL methods</a></p> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-spec-2.rb.png" data-background-size='30% auto' data-background-opacity='1'> <p class='fragment fade-in-then-semi-out'><a>Read only methods</a></p> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-spec-3.rb.png" data-background-size='50% auto' data-background-opacity='1'> <p class='fragment fade-in-then-semi-out'><a>Operations</a></p> <p class='fragment fade-in-then-semi-out'><a>Queries / Presenters</a></p> <p class='fragment fade-in-then-semi-out'><a>Commands / Async Jobs</a></p> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-01-thin-1.rb.png" data-background-size='70% auto' data-background-opacity='.2'> <h3 data-id='h3'>Campaign - Thin Model</h3> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-01-thin-1.rb.png" data-background-size='70% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-01-thin-2.rb.png" data-background-size='60% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-04-0.rb.png" data-background-size='45% auto' data-background-opacity='.2'> <h3 data-id='h3'>Campaign - Virtual Fields <br /> <a>readonly</a> fields</h3> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-04-0.rb.png" data-background-size='45% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-04-1b-count.rb.png" data-background-size='80% auto' data-background-opacity='1'> <p class='fragment fade-in-then-semi-out'><a>count records</a></p> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-04-1b-count.rb.png" data-background-size='80% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-04-2b-lookup.rb.png" data-background-size='60% auto' data-background-opacity='1'> <p class='fragment fade-in-then-semi-out'><a>lookup single records</a></p> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-04-2b-lookup.rb.png" data-background-size='60% auto' data-background-opacity='.2'> <h2 data-id='h2'>Why would we care?</h2> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-04-2b-lookup.rb.png" data-background-size='60% auto' data-background-opacity='.2'> <h2 data-id='h2'>Why would we care?</h2> <h3 data-id='h3'>Patterns</h3> <p class='fragment fade-in-then-semi-out'>different patterns require different tests</p> <p class='fragment fade-in-then-semi-out'>data setup is based on patterns</p> <p class='fragment fade-in-then-semi-out'>what you test is based on patterns</p> <p class='fragment fade-in-then-semi-out'>pattern tags can be used for code generation</p> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-04-2b-lookup.rb.png" data-background-size='60% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-04-2c-lookup.rb.png" data-background-size='60% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-04-3b-predicate.rb.png" data-background-size='60% auto' data-background-opacity='1'> <p class='fragment fade-in-then-semi-out'><a>predicates return true/false</a></p> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-04-3b-predicate.rb.png" data-background-size='60% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-04-3c-predicate.rb.png" data-background-size='70% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-04-3d-predicate.rb.png" data-background-size='70% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-04-4b.rb.png" data-background-size='50% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-04-4b.rb.png" data-background-size='50% auto' data-background-opacity='.2'> <h3 data-id='h3'>Policy vs Predicate</h3> <p class='fragment fade-in-then-semi-out'>policy is a type of predicate</p> <p class='fragment fade-in-then-semi-out'>policy also known as <a>access grant</a></p> <p class='fragment fade-in-then-semi-out'>policies are related to authorization</p> <p class='fragment fade-in-then-semi-out'>policies are are cross-cutting concerns</p> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-04-4b.rb.png" data-background-size='50% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-04-5a-validation-0.rb.png" data-background-size='60% auto' data-background-opacity='.2'> <h3 data-id='h3'><a>Validators</a></h3> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-04-5a-validation-0.rb.png" data-background-size='60% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-04-5a-validation-2a.rb.png" data-background-size='80% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-04-5a-validation-2b.rb.png" data-background-size='80% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-04-5a-validation-2c.rb.png" data-background-size='60% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-04-5a-validation-9.rb.png" data-background-size='80% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/base_presenter.rb.png" data-background-size='60% auto' data-background-opacity='.2'> <h3 data-id='h3'><a>Presenters</a></h3> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/base_presenter.rb.png" data-background-size='60% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-05-action-click-statistics-0.rb.png" data-background-size='50% auto' data-background-opacity='.2'> <h3 data-id='h3'>Click Statistics - Presenter <br/><a>combined</a> query/present</h3> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-05-action-click-statistics-0.rb.png" data-background-size='50% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-05-action-click-statistics-2-1.rb.png" data-background-size='45% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-05-action-click-statistics-2-2.rb.png" data-background-size='50% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-05-action-click-statistics-2-3.rb.png" data-background-size='40% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-05-action-click-statistics-9.rb.png" data-background-size='80% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-05-action-contact-0.rb.png" data-background-size='45% auto' data-background-opacity='.2'> <h3 data-id='h3'>Contacts - Presenter <br/><a>separated</a> query/present</h3> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-05-action-contact-0.rb.png" data-background-size='45% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-05-action-contact-2.rb.png" data-background-size='60% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-05-action-contact-2a.rb.png" data-background-size='80% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-05-action-contact-2b.rb.png" data-background-size='80% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-05-action-contact-2c.rb.png" data-background-size='60% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-05-action-contact-9.rb.png" data-background-size='50% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-08-decorator-campaign-0.rb.png" data-background-size='80% auto' data-background-opacity='.2'> <h3 data-id='h3'>Decorators</h3> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-08-decorator-campaign-0.rb.png" data-background-size='80% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-08-decorator-campaign-2.rb.png" data-background-size='70% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-08-decorator-campaign-9.rb.png" data-background-size='70% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-06-action-check-bounce-rate-0.rb.png" data-background-size='55% auto' data-background-opacity='.2'> <h3 data-id='h3'>Commands</h3> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-06-action-check-bounce-rate-0.rb.png" data-background-size='55% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-06-action-check-bounce-rate-1.rb.png" data-background-size='40% auto' data-background-opacity='.2'> <h3 data-id='h3'>Check Bounce Rate - <a>Command</a></h3> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-06-action-check-bounce-rate-1.rb.png" data-background-size='40% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-06-action-check-bounce-rate-1a.rb.png" data-background-size='70% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-06-action-check-bounce-rate-1b.rb.png" data-background-size='80% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-06-action-check-bounce-rate-1c.rb.png" data-background-size='80% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-06-action-check-bounce-rate-9.rb.png" data-background-size='70% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-07-job-resend-messages-0.rb.png" data-background-size='80% auto' data-background-opacity='.2'> <h3 data-id='h3'>Async Jobs</h3> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-07-job-resend-messages-0.rb.png" data-background-size='80% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-07-job-resend-messages-2.rb.png" data-background-size='80% auto' data-background-opacity='.2'> <h3 data-id='h3'>Resend Messages - <a>Job</a></h3> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-07-job-resend-messages-2.rb.png" data-background-size='80% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-07-job-resend-messages-9.rb.png" data-background-size='80% auto' data-background-opacity='1'> </section> <section data-transition="zoom-in" data-transition-speed="slow" data-auto-animate data-background="images/code-campaign-spec-1.rb.png" data-background-size='30% auto' data-background-opacity='.2'> <h2 data-id='h2'>Code audit on <a>campaign.rb</a> - end</h2> </section> </div> </div> <script src="../dist/reveal.js"></script> <!-- <script src="../plugin/zoom/zoom.js"></script> <script src="../plugin/notes/notes.js"></script> <script src="../plugin/search/search.js"></script> <script src="../plugin/markdown/markdown.js"></script> --> <script src="../plugin/highlight/highlight.js"></script> <script> Reveal.initialize({ controls: true, progress: true, center: true, hash: true, // disableLayout: false, // width: 960, // height: 700, // // Factor of the display size that should remain empty around the content margin: 0.00, // // Bounds for smallest/largest possible scale to apply to content minScale: 0.0, maxScale: 2.0, plugins: [ RevealHighlight ] // RevealZoom, RevealNotes, RevealSearch, RevealMarkdown, }); </script> <style> .reveal pre code { max-height: 600px; } </style> </body> </html>
58.02
166
0.660856
e753ba69ad2c8077512bbe069df99a4f8f73176b
345
kt
Kotlin
app/src/main/java/com/example/squarerepos/data/remote/ReposApi.kt
kllaas/SquareRepos
b93fae35296832777c39a46a060955ada3905f4c
[ "Unlicense" ]
null
null
null
app/src/main/java/com/example/squarerepos/data/remote/ReposApi.kt
kllaas/SquareRepos
b93fae35296832777c39a46a060955ada3905f4c
[ "Unlicense" ]
null
null
null
app/src/main/java/com/example/squarerepos/data/remote/ReposApi.kt
kllaas/SquareRepos
b93fae35296832777c39a46a060955ada3905f4c
[ "Unlicense" ]
null
null
null
package com.example.squarerepos.data.remote import com.example.squarerepos.data.model.Repository import io.reactivex.Observable import retrofit2.http.GET interface ReposApi { @GET(GET_REPOS_URL) fun getRepos(): Observable<List<Repository>> companion object { private const val GET_REPOS_URL = "orgs/square/repos" } }
21.5625
61
0.750725
5ea46fb72470746a3f01c1102dd230d6ab4c5345
2,796
swift
Swift
swift38/swift38/ViewController.swift
lovexiaobai/-swiftStudy
b510b4b5846ade5c8fc4ce9ad91a894e33c6c378
[ "MIT" ]
1
2016-07-29T07:03:02.000Z
2016-07-29T07:03:02.000Z
swift38/swift38/ViewController.swift
lovexiaobai/-swiftStudy
b510b4b5846ade5c8fc4ce9ad91a894e33c6c378
[ "MIT" ]
null
null
null
swift38/swift38/ViewController.swift
lovexiaobai/-swiftStudy
b510b4b5846ade5c8fc4ce9ad91a894e33c6c378
[ "MIT" ]
null
null
null
// // ViewController.swift // swift38 // Swift38 - 使用SSZipArchive实现文件的压缩、解压缩 // Created by Alan on 16/7/12. // Copyright © 2016年 jollycorp. All rights reserved. // import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. //解压普通zip文件 let zipPath = NSBundle.mainBundle().pathForResource("test", ofType: "zip") SSZipArchive.unzipFileAtPath(zipPath!, toDestination: tempDestPath()!); //解压带密码的zip文件 let zipPath2 = NSBundle.mainBundle().pathForResource("test_password", ofType: "zip") do { try SSZipArchive.unzipFileAtPath(zipPath2!, toDestination: tempDestPath()!, overwrite: true, password: "hangge.com") } catch { } //将文件打成压缩包 let files = [NSBundle.mainBundle().pathForResource("logo", ofType: "png")!, NSBundle.mainBundle().pathForResource("icon", ofType: "png")!] let zipPath3 = tempDestPath()! + "/hangge.zip" SSZipArchive.createZipFileAtPath(zipPath3, withFilesAtPaths: files) let zipPath4 = tempDestPath()! + "/hangge.zip" SSZipArchive.createZipFileAtPath(zipPath4, withFilesAtPaths: files, withPassword: "hangge.com") //带密码 //将整个文件夹下的文件打成压缩包 //需要压缩的文件夹啊 let filePath:String = NSHomeDirectory() + "/Documents" //先在该文件夹下添加一个文件 let image = UIImage(named: "logo.png") let data:NSData = UIImagePNGRepresentation(image!)! data.writeToFile(filePath + "/logo.png", atomically: true) let zipPath5 = tempDestPath()! + "/hangge.zip" SSZipArchive.createZipFileAtPath(zipPath5, withContentsOfDirectory: filePath) let zipPath6 = tempDestPath()! + "/hangge.zip" SSZipArchive.createZipFileAtPath(zipPath6, withContentsOfDirectory: filePath, withPassword: "hangge.com") //带密码 } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } func tempDestPath() -> String?{ var path = NSSearchPathForDirectoriesInDomains(.CachesDirectory,.UserDomainMask, true)[0] path += "/\(NSUUID().UUIDString)"; let url = NSURL(fileURLWithPath: path) do { try NSFileManager.defaultManager().createDirectoryAtURL(url, withIntermediateDirectories: true, attributes: nil) } catch { return nil } if let path = url.path { print("path:\(path)") return path } return nil } }
32.894118
128
0.6098
11b3ffa77195529534ec8d7afcea84a28678c3eb
6,915
swift
Swift
4champ/AppDelegate.swift
sitomani/4champ
ff30c977546bd6510726faac1c9bd72af049fa74
[ "MIT" ]
22
2018-04-22T18:41:42.000Z
2022-02-09T11:22:39.000Z
4champ/AppDelegate.swift
sitomani/4champ
ff30c977546bd6510726faac1c9bd72af049fa74
[ "MIT" ]
null
null
null
4champ/AppDelegate.swift
sitomani/4champ
ff30c977546bd6510726faac1c9bd72af049fa74
[ "MIT" ]
1
2020-04-13T01:26:26.000Z
2020-04-13T01:26:26.000Z
// // AppDelegate.swift // 4champ Amiga Music Player // // Copyright © 2018 Aleksi Sitomaniemi. All rights reserved. // import UIKit import SwiftyBeaver import AVFoundation import Alamofire import UserNotifications import SwiftUI // Global let modulePlayer = ModulePlayer() let moduleStorage = ModuleStorage() let log = SwiftyBeaver.self let settings = SettingsInteractor() let shareUtil = ShareUtility() @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { private var _bgFetchCallback: ((UIBackgroundFetchResult) -> Void)? private var sharedMod: MMD? private lazy var dlController: DownloadController = DownloadController() var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. Appearance.setup() setupLogging() setupAVSession() cleanupFiles() // UNCOMMENT BELOW TWO LINES TO TEST LOCAL NOTIFICATIONS // settings.prevCollectionSize = 0 // settings.newestPlayed = 152890 updateLatest() UIApplication.shared.beginReceivingRemoteControlEvents() #if DEBUG ReviewActions.reset() #endif application.setMinimumBackgroundFetchInterval(UIApplication.backgroundFetchIntervalMinimum) return true } func setupAVSession() { let sess = AVAudioSession.sharedInstance() do { try sess.setCategory(.playback, mode: .default, options: []) try sess.setActive(true) } catch { log.error(error) } } func applicationWillResignActive(_ application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. } func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(_ application: UIApplication) { } func applicationDidBecomeActive(_ application: UIApplication) { } func applicationWillTerminate(_ application: UIApplication) { modulePlayer.cleanup() // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { log.debug("performFetch") _bgFetchCallback = completionHandler updateLatest() } func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { guard userActivity.activityType == NSUserActivityTypeBrowsingWeb, let url = userActivity.webpageURL, let components = URLComponents(url: url, resolvingAgainstBaseURL: true) else { return false } if components.path == "/mod", let idString = components.queryItems?.first?.value, let modId = Int(idString) { dlController.rootViewController = UIApplication.shared.windows[0].rootViewController dlController.show(modId: modId) } return true } func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { if url.scheme == "fourchamp" && url.host == "modules" { if let idString = url.path.split(separator: "/").first, let modId = Int(idString) { dlController.show(modId: modId) } } else { dlController.showImport(for: [url]); } return true } func application(_ application: UIApplication, handleOpen url: URL) -> Bool { return true } /// Set up SwiftyBeaver logging func setupLogging() { let console = ConsoleDestination() // log to Xcode Console // use custom format and set console output to short time, log level & message console.format = "$DHH:mm:ss $d $L $N.$F $M" console.levelString.error = "🛑" console.levelString.warning = "🔶" console.levelString.info = "🔷" console.levelString.debug = "◾️" console.levelString.verbose = "◽️" log.addDestination(console) console.minLevel = .warning #if DEBUG console.minLevel = .debug #endif log.info("Logger initialized") } func cleanupFiles() { let fileManager = FileManager.default let documentsURL = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] do { let fileURLs = try fileManager.contentsOfDirectory(at: documentsURL, includingPropertiesForKeys: nil) if let first = fileURLs.first { log.debug(first) } // process files } catch { log.error("Error while enumerating files \(documentsURL.path): \(error.localizedDescription)") } } func updateLatest() { log.debug("") let req = RESTRoutes.latestId AF.request(req).validate().responseString { resp in switch resp.result { case .failure(_): self._bgFetchCallback?(.noData) self._bgFetchCallback = nil case .success(let str): guard let collectionSize = Int(str) else { return } log.info("Collection Size: \(collectionSize)") self.updateCollectionSize(size: collectionSize) } } } func updateCollectionSize(size: Int) { log.debug("") settings.collectionSize = size let prevSize = settings.prevCollectionSize // Only fire the request once per a given collectionSize/diff if prevSize < size && settings.badgeCount < Constants.maxBadgeValue { let fmt = "Radio_Notification".l13n() let content = UNMutableNotificationContent() content.body = String.init(format: fmt, "\(settings.badgeCount)") content.categoryIdentifier = "newmodules" let trigger = UNTimeIntervalNotificationTrigger.init(timeInterval: 0.1, repeats: false) let req = UNNotificationRequest.init(identifier: "newmodules-usernotif", content: content, trigger: trigger) UNUserNotificationCenter.current().add(req, withCompletionHandler: nil) settings.prevCollectionSize = settings.collectionSize _bgFetchCallback?(.newData) } else { _bgFetchCallback?(.noData) } _bgFetchCallback = nil } }
35.461538
281
0.710629
bc66ffb62670b4a07f74c0893de3d7281f973665
605
swift
Swift
PlaceObject/Models/Cone.swift
AndreyMomot/PlaceObject
07cae44f83124b63816b9e35fb80fa0895402565
[ "MIT" ]
2
2017-11-28T13:18:00.000Z
2021-05-25T13:10:38.000Z
PlaceObject/Models/Cone.swift
AndreyMomot/PlaceObject
07cae44f83124b63816b9e35fb80fa0895402565
[ "MIT" ]
null
null
null
PlaceObject/Models/Cone.swift
AndreyMomot/PlaceObject
07cae44f83124b63816b9e35fb80fa0895402565
[ "MIT" ]
null
null
null
// // Cone.swift // PlaneDetection // // Created by Andrei Momot on 11/6/17. // Copyright © 2017 Andrey Momot. All rights reserved. // import UIKit import SceneKit class Cone: VirtualObject { override init() { let cone = SCNCone(topRadius: 0, bottomRadius: 0.05, height: 0.1) cone.materials.first?.diffuse.contents = UIColor.white let node = SCNNode(geometry: cone) super.init(model: node, thumbImageFilename: "cone", title: "Cone") } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } }
24.2
74
0.642975
87cda27544f1167a6d7db5190071b08cdcbb01fb
135
kt
Kotlin
core/src/main/kotlin/org/taymyr/lagom/internal/openapi/LagomServiceInfo.kt
gnuzzz/lagom-openapi
347358510d11776a4f6e65344d00beb413730d6b
[ "Apache-2.0" ]
null
null
null
core/src/main/kotlin/org/taymyr/lagom/internal/openapi/LagomServiceInfo.kt
gnuzzz/lagom-openapi
347358510d11776a4f6e65344d00beb413730d6b
[ "Apache-2.0" ]
null
null
null
core/src/main/kotlin/org/taymyr/lagom/internal/openapi/LagomServiceInfo.kt
gnuzzz/lagom-openapi
347358510d11776a4f6e65344d00beb413730d6b
[ "Apache-2.0" ]
null
null
null
package org.taymyr.lagom.internal.openapi data class LagomServiceInfo( val service: Class<*>, val calls: List<LagomCallInfo> )
22.5
41
0.748148
c7e4f13f76ef3af282b62ab912e5a63a40c53a96
4,055
java
Java
src/test/java/freemarker/core/AppMetaTemplateDateFormatFactory.java
jivesoftware/incubator-freemarker
479ea6c538f32bd74f770b1aff63a0bf25329210
[ "Apache-2.0" ]
null
null
null
src/test/java/freemarker/core/AppMetaTemplateDateFormatFactory.java
jivesoftware/incubator-freemarker
479ea6c538f32bd74f770b1aff63a0bf25329210
[ "Apache-2.0" ]
null
null
null
src/test/java/freemarker/core/AppMetaTemplateDateFormatFactory.java
jivesoftware/incubator-freemarker
479ea6c538f32bd74f770b1aff63a0bf25329210
[ "Apache-2.0" ]
null
null
null
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 freemarker.core; import java.util.Date; import java.util.Locale; import java.util.TimeZone; import freemarker.template.TemplateDateModel; import freemarker.template.TemplateModelException; public class AppMetaTemplateDateFormatFactory extends TemplateDateFormatFactory { public static final AppMetaTemplateDateFormatFactory INSTANCE = new AppMetaTemplateDateFormatFactory(); private AppMetaTemplateDateFormatFactory() { // Defined to decrease visibility } @Override public TemplateDateFormat get(String params, int dateType, Locale locale, TimeZone timeZone, boolean zonelessInput, Environment env) throws UnknownDateTypeFormattingUnsupportedException, InvalidFormatParametersException { TemplateFormatUtil.checkHasNoParameters(params); return AppMetaTemplateDateFormat.INSTANCE; } private static class AppMetaTemplateDateFormat extends TemplateDateFormat { private static final AppMetaTemplateDateFormat INSTANCE = new AppMetaTemplateDateFormat(); private AppMetaTemplateDateFormat() { } @Override public String formatToPlainText(TemplateDateModel dateModel) throws UnformattableValueException, TemplateModelException { String result = String.valueOf(TemplateFormatUtil.getNonNullDate(dateModel).getTime()); if (dateModel instanceof AppMetaTemplateDateModel) { result += "/" + ((AppMetaTemplateDateModel) dateModel).getAppMeta(); } return result; } @Override public boolean isLocaleBound() { return false; } @Override public boolean isTimeZoneBound() { return false; } @Override public Object parse(String s, int dateType) throws UnparsableValueException { int slashIdx = s.indexOf('/'); try { if (slashIdx != -1) { return new AppMetaTemplateDateModel( new Date(Long.parseLong(s.substring(0, slashIdx))), dateType, s.substring(slashIdx +1)); } else { return new Date(Long.parseLong(s)); } } catch (NumberFormatException e) { throw new UnparsableValueException("Malformed long"); } } @Override public String getDescription() { return "millis since the epoch"; } } public static class AppMetaTemplateDateModel implements TemplateDateModel { private final Date date; private final int dateType; private final String appMeta; public AppMetaTemplateDateModel(Date date, int dateType, String appMeta) { this.date = date; this.dateType = dateType; this.appMeta = appMeta; } public Date getAsDate() throws TemplateModelException { return date; } public int getDateType() { return dateType; } public String getAppMeta() { return appMeta; } } }
33.791667
119
0.641924
395714e3fa457096bf23fa9a33b4bb9352568b06
407
html
HTML
webapp/src/app/pages/login/login.component.html
davide97g/dynamiqr
47d32101137b854e98751a1567be5a4ab1ab3133
[ "MIT" ]
1
2021-06-26T12:51:48.000Z
2021-06-26T12:51:48.000Z
webapp/src/app/pages/login/login.component.html
davide97g/dynamiqr
47d32101137b854e98751a1567be5a4ab1ab3133
[ "MIT" ]
4
2021-03-10T23:48:59.000Z
2021-03-10T23:55:03.000Z
webapp/src/app/pages/login/login.component.html
davide97g/dynamiqr
47d32101137b854e98751a1567be5a4ab1ab3133
[ "MIT" ]
null
null
null
<div *ngIf="auth.user$ | async; then authenticated; else guest"> <!-- template will replace this div --> </div> <ng-template #guest> <div id="firebaseui-auth-container"></div> </ng-template> <!-- User logged in --> <ng-template #authenticated> <div style="margin: auto; text-align: center; margin-top: 100px"> <h3>Already logged as {{ user.displayName }}</h3> </div> </ng-template>
29.071429
69
0.638821
072aac82afe09cc8920377f2a45123f9078fc63d
550
sql
SQL
db/updatedb.sql
Kaffeedrache/Coalda
71ee692c85d186ce4ee15eff11d3889e38cf2e60
[ "BSD-3-Clause" ]
null
null
null
db/updatedb.sql
Kaffeedrache/Coalda
71ee692c85d186ce4ee15eff11d3889e38cf2e60
[ "BSD-3-Clause" ]
null
null
null
db/updatedb.sql
Kaffeedrache/Coalda
71ee692c85d186ce4ee15eff11d3889e38cf2e60
[ "BSD-3-Clause" ]
null
null
null
-- Update the markable table with word information (makes a lot things faster) update markables set document_id = words.doc_id from words where markables.head = word_id; update markables set sentence_id = words.sentence_id from words where markables.head = word_id; update markables m set content = array_to_string(array(select word from words w where w.word_id>=m.firstword and w.word_id<=m.lastword), ' '); -- Calculation of markable_features update markables m set markable_features = (select wordfeatures from words w where w.word_id = m.head);
61.111111
103
0.792727
563834a0dbfdf0a09aeaf70829c166ffe7b711bb
611
go
Go
framework/bass/track.go
Wieku/danser-go
da852a7987627a5e64f63aa782213089fa4759a5
[ "MIT" ]
431
2019-05-14T07:17:15.000Z
2022-03-31T11:55:19.000Z
framework/bass/track.go
Wieku/danser-go
da852a7987627a5e64f63aa782213089fa4759a5
[ "MIT" ]
189
2019-05-18T13:58:25.000Z
2022-03-30T15:27:25.000Z
framework/bass/track.go
Wieku/danser-go
da852a7987627a5e64f63aa782213089fa4759a5
[ "MIT" ]
95
2019-03-28T16:04:42.000Z
2022-03-30T13:39:57.000Z
package bass const ( MUSIC_STOPPED = 0 MUSIC_PLAYING = 1 MUSIC_STALLED = 2 MUSIC_PAUSED = 3 ) type ITrack interface { AddSilence(seconds float64) Play() PlayV(volume float64) Pause() Resume() Stop() SetVolume(vol float64) SetVolumeRelative(vol float64) GetLength() float64 SetPosition(pos float64) GetPosition() float64 SetTempo(tempo float64) GetTempo() float64 SetPitch(tempo float64) GetPitch() float64 GetState() int Update() GetFFT() []float32 GetPeak() float64 GetLevelCombined() float64 GetLeftLevel() float64 GetRightLevel() float64 GetBoost() float64 GetBeat() float64 }
16.972222
31
0.747954
2e9c7ad4ddc25d17376faa8feea12c51f3bb09f4
220
sql
SQL
sql/updates/2.0.6-2.0.7/20110315-1-drop_property_fields.sql
gxa/gxa
630aef60b25e94413d94127ae983be52d2b5ec44
[ "Apache-2.0" ]
7
2015-04-27T15:06:08.000Z
2020-04-23T03:29:30.000Z
sql/updates/2.0.6-2.0.7/20110315-1-drop_property_fields.sql
gxa/gxa
630aef60b25e94413d94127ae983be52d2b5ec44
[ "Apache-2.0" ]
23
2016-03-10T17:02:21.000Z
2021-06-04T01:30:37.000Z
sql/updates/2.0.6-2.0.7/20110315-1-drop_property_fields.sql
gxa/gxa
630aef60b25e94413d94127ae983be52d2b5ec44
[ "Apache-2.0" ]
1
2016-03-08T22:47:29.000Z
2016-03-08T22:47:29.000Z
alter table A2_PROPERTY drop column AE1TABLENAME_ASSAY; alter table A2_PROPERTY drop column AE1TABLENAME_SAMPLE; alter table A2_PROPERTY drop column ASSAYPROPERTYID; alter table A2_PROPERTY drop column SAMPLEPROPERTYID;
44
56
0.872727
84bff83977f7ae08c6069d0208c39e91299b83a6
4,845
c
C
mc/model/com.mentor.nucleus.bp.core/src416/ooaofooa_R_CONE_class.c
NDGuthrie/bposs
2c47abf74a3e6fadb174b08e57aa66a209400606
[ "Apache-2.0" ]
1
2018-01-24T16:28:01.000Z
2018-01-24T16:28:01.000Z
mc/model/com.mentor.nucleus.bp.core/src418/ooaofooa_R_CONE_class.c
NDGuthrie/bposs
2c47abf74a3e6fadb174b08e57aa66a209400606
[ "Apache-2.0" ]
null
null
null
mc/model/com.mentor.nucleus.bp.core/src418/ooaofooa_R_CONE_class.c
NDGuthrie/bposs
2c47abf74a3e6fadb174b08e57aa66a209400606
[ "Apache-2.0" ]
null
null
null
/*---------------------------------------------------------------------------- * File: ooaofooa_R_CONE_class.c * * Class: Class As Derived One Side (R_CONE) * Component: ooaofooa * * your copyright statement can go here (from te_copyright.body) *--------------------------------------------------------------------------*/ #include "sys_sys_types.h" #include "LOG_bridge.h" #include "POP_bridge.h" #include "T_bridge.h" #include "ooaofooa_classes.h" /* * Instance Loader (from string data). */ Escher_iHandle_t ooaofooa_R_CONE_instanceloader( Escher_iHandle_t instance, const c_t * avlstring[] ) { Escher_iHandle_t return_identifier = 0; ooaofooa_R_CONE * self = (ooaofooa_R_CONE *) instance; /* Initialize application analysis class attributes. */ self->Obj_ID = (Escher_iHandle_t) Escher_atoi( avlstring[ 1 ] ); self->Rel_ID = (Escher_iHandle_t) Escher_atoi( avlstring[ 2 ] ); self->OIR_ID = (Escher_iHandle_t) Escher_atoi( avlstring[ 3 ] ); self->Mult = Escher_atoi( avlstring[ 4 ] ); self->Cond = Escher_atoi( avlstring[ 5 ] ); self->Txt_Phrs = Escher_strcpy( self->Txt_Phrs, avlstring[ 6 ] ); return return_identifier; } /* * Select any where using referential/identifying attribute set. * If not_empty, relate this instance to the selected instance. */ void ooaofooa_R_CONE_batch_relate( Escher_iHandle_t instance ) { ooaofooa_R_CONE * ooaofooa_R_CONE_instance = (ooaofooa_R_CONE *) instance; ooaofooa_R_COMP * ooaofooa_R_COMPrelated_instance1 = ooaofooa_R_COMP_AnyWhere1( ooaofooa_R_CONE_instance->Rel_ID ); if ( ooaofooa_R_COMPrelated_instance1 ) { ooaofooa_R_CONE_R214_Link_relates( ooaofooa_R_COMPrelated_instance1, ooaofooa_R_CONE_instance ); } { ooaofooa_R_OIR * ooaofooa_R_OIRrelated_instance1 = ooaofooa_R_OIR_AnyWhere1( ooaofooa_R_CONE_instance->Obj_ID, ooaofooa_R_CONE_instance->Rel_ID, ooaofooa_R_CONE_instance->OIR_ID ); if ( ooaofooa_R_OIRrelated_instance1 ) { ooaofooa_R_CONE_R203_Link( ooaofooa_R_OIRrelated_instance1, ooaofooa_R_CONE_instance ); } } } /* * RELATE R_OIR TO R_CONE ACROSS R203 */ void ooaofooa_R_CONE_R203_Link( ooaofooa_R_OIR * supertype, ooaofooa_R_CONE * subtype ) { /* Use TagEmptyHandleDetectionOn() to detect empty handle references. */ subtype->OIR_ID = supertype->OIR_ID; subtype->Obj_ID = supertype->Obj_ID; subtype->Rel_ID = supertype->Rel_ID; /* Optimized linkage for R_CONE->R_OIR[R203] */ subtype->R_OIR_R203 = supertype; /* Optimized linkage for R_OIR->R_CONE[R203] */ supertype->R203_subtype = subtype; supertype->R203_object_id = ooaofooa_R_CONE_CLASS_NUMBER; } /* * UNRELATE R_OIR FROM R_CONE ACROSS R203 */ void ooaofooa_R_CONE_R203_Unlink( ooaofooa_R_OIR * supertype, ooaofooa_R_CONE * subtype ) { /* Use TagEmptyHandleDetectionOn() to detect empty handle references. */ subtype->R_OIR_R203 = 0; supertype->R203_subtype = 0; supertype->R203_object_id = 0; } /* * RELATE R_COMP TO R_CONE ACROSS R214 */ void ooaofooa_R_CONE_R214_Link_relates( ooaofooa_R_COMP * part, ooaofooa_R_CONE * form ) { /* Use TagEmptyHandleDetectionOn() to detect empty handle references. */ form->Rel_ID = part->Rel_ID; form->R_COMP_R214_is_related_to_other_type_via = part; part->R_CONE_R214_relates = form; } /* * UNRELATE R_COMP FROM R_CONE ACROSS R214 */ void ooaofooa_R_CONE_R214_Unlink_relates( ooaofooa_R_COMP * part, ooaofooa_R_CONE * form ) { /* Use TagEmptyHandleDetectionOn() to detect empty handle references. */ form->R_COMP_R214_is_related_to_other_type_via = 0; part->R_CONE_R214_relates = 0; } /* * Dump instances in SQL format. */ void ooaofooa_R_CONE_instancedumper( Escher_iHandle_t instance ) { ooaofooa_R_CONE * self = (ooaofooa_R_CONE *) instance; printf( "INSERT INTO R_CONE VALUES ( %ld,%ld,%ld,%d,%d,'%s' );\n", ((long)self->Obj_ID & ESCHER_IDDUMP_MASK), ((long)self->Rel_ID & ESCHER_IDDUMP_MASK), ((long)self->OIR_ID & ESCHER_IDDUMP_MASK), self->Mult, self->Cond, ( 0 != self->Txt_Phrs ) ? self->Txt_Phrs : "" ); } /* * Statically allocate space for the instance population for this class. * Allocate space for the class instance and its attribute values. * Depending upon the collection scheme, allocate containoids (collection * nodes) for gathering instances into free and active extents. */ static Escher_SetElement_s ooaofooa_R_CONE_container[ ooaofooa_R_CONE_MAX_EXTENT_SIZE ]; static ooaofooa_R_CONE ooaofooa_R_CONE_instances[ ooaofooa_R_CONE_MAX_EXTENT_SIZE ]; Escher_Extent_t pG_ooaofooa_R_CONE_extent = { {0,0}, {0,0}, &ooaofooa_R_CONE_container[ 0 ], (Escher_iHandle_t) &ooaofooa_R_CONE_instances, sizeof( ooaofooa_R_CONE ), 0, ooaofooa_R_CONE_MAX_EXTENT_SIZE };
35.108696
183
0.707946
90bd75734697651a5c0df5b2924de464010fab77
839
swift
Swift
MyApp/View/Controller/Search/Searching/History/Cell/HistorySearchTableCell.swift
LuongQuocThien/DoAnTotNghiep
13dd2b7a58f324d6829edc77b2dbb1f0e714bb47
[ "MIT" ]
null
null
null
MyApp/View/Controller/Search/Searching/History/Cell/HistorySearchTableCell.swift
LuongQuocThien/DoAnTotNghiep
13dd2b7a58f324d6829edc77b2dbb1f0e714bb47
[ "MIT" ]
null
null
null
MyApp/View/Controller/Search/Searching/History/Cell/HistorySearchTableCell.swift
LuongQuocThien/DoAnTotNghiep
13dd2b7a58f324d6829edc77b2dbb1f0e714bb47
[ "MIT" ]
null
null
null
// // HistorySearchTableCell.swift // MyApp // // Created by PCI0001 on 3/11/19. // Copyright © 2019 Asian Tech Co., Ltd. All rights reserved. // import UIKit final class HistorySearchTableCell: UITableViewCell { @IBOutlet private weak var contentLabel: UILabel! @IBOutlet private weak var removeButton: UIButton! // MARK: - Properties var viewModel: HistorySearchCellViewModel? { didSet { updateCell() } } // MARK: - Private private func updateCell() { guard let viewModel = viewModel else { return } contentLabel.text = viewModel.getHistorySearch().content } @IBAction private func removeHistorySearchButtonTouchUpInside(_ sender: Any) { guard let viewModel = viewModel else { return } viewModel.deleteHistorySearchRealm() } }
24.676471
82
0.667461