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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0ee3662d6c14ad3778c1ed3419486f6971b507d3 | 5,384 | tsx | TypeScript | src/types/tTypes.tsx | 4very/mplus_leaderboard | 71854d1b9f04a1a1531fdbad3e06f140d8c1aa20 | [
"MIT"
] | 5 | 2021-08-17T04:42:08.000Z | 2022-03-14T19:48:13.000Z | src/types/tTypes.tsx | 4very/mplus_leaderboard | 71854d1b9f04a1a1531fdbad3e06f140d8c1aa20 | [
"MIT"
] | null | null | null | src/types/tTypes.tsx | 4very/mplus_leaderboard | 71854d1b9f04a1a1531fdbad3e06f140d8c1aa20 | [
"MIT"
] | 1 | 2021-10-04T04:19:45.000Z | 2021-10-04T04:19:45.000Z | import {
addClass,
addCov,
addFaction,
addRole,
classColorRender,
compareDate,
Links,
linksRender,
percentToString,
runScoreRender,
strToDate,
strtolink,
timeToString,
} from './funcs';
export interface TPropsType {
runRows: TRunRow[];
teamData: TTeamData[];
metaData: TMetaData;
rules: string | null;
upDATE: string;
}
export interface TMetaData {
name: string;
startText: string;
endText: string;
collectGraphs: boolean;
teamDetails: boolean;
teamHall: boolean;
}
export interface TRunRow {
id: string;
name: string;
dunegonName: string;
keystoneLevel: string;
score: number;
dateCompleted: string;
timeDiff: number;
percDiff: number;
url: string;
keyMod: number;
}
export interface TTeamData {
id: string;
name: string;
runsCompleted: number;
score: number;
players: TPlayerRow[];
scoreColor: string;
avgilvl: number;
highestkey: { key: number; per: number; str: string; link: string };
numkeys: number;
}
export interface TPlayerRow {
id: string;
faction: string;
name: string;
realm: string;
className: string;
classColor: string;
rank: string;
score: number;
links: Links;
scoreColor: string;
team: string;
render: string;
}
export const tTeamColumns = [
{
field: 'id',
type: 'number',
hide: true,
},
{
field: 'role',
headerName: 'Role',
width: 70,
disableColumnMenu: true,
sortable: false,
renderCell: addRole,
},
{
field: 'className',
headerName: 'Class',
width: 60,
renderCell: addClass,
disableColumnMenu: true,
sortable: false,
},
{
field: 'name',
headerName: 'Name',
width: 170,
renderCell: classColorRender,
},
{
field: 'faction',
headerName: 'Faction',
width: 150,
hide: true,
},
{
field: 'level',
headerName: 'Level',
width: 70,
disableColumnMenu: true,
sortable: false,
hide: true,
},
{
field: 'rank',
headerName: 'Rank',
width: 200,
hide: true,
},
{
field: 'score',
headerName: 'R.IO Score',
width: 150,
renderCell: runScoreRender,
},
{
field: 'ilvl',
headerName: 'Gear Score',
width: 110,
disableColumnMenu: true,
sortable: false,
},
{
field: 'links',
headerName: 'Links',
width: 170,
renderCell: linksRender,
},
];
export const tRunColumns = [
{ field: 'id', headerName: 'ID', width: 100, hide: true },
{ field: 'team', headerName: 'Team', width: 120, renderCell: addFaction },
{
field: 'dunegonName',
headerName: 'Dungeon',
width: 200,
},
{
field: 'keystoneLevel',
headerName: 'Key Level',
width: 150,
type: 'number',
},
{
field: 'score',
headerName: 'Score',
width: 130,
type: 'number',
renderCell: runScoreRender,
},
{
field: 'dateCompleted',
headerName: 'Completed',
width: 200,
type: 'date',
renderCell: strToDate,
sortComarator: compareDate,
},
{
field: 'timeDiff',
headerName: 'Time Difference',
width: 200,
type: 'number',
renderCell: timeToString,
},
{
field: 'percDiff',
headerName: '% Over/Under',
width: 200,
type: 'number',
renderCell: percentToString,
},
{
field: 'url',
headerName: 'Link',
width: 70,
renderCell: strtolink,
disableColumnMenu: true,
sortable: false,
},
{
field: 'keyMod',
headerName: 'Key Upgrade',
width: 150,
type: 'number',
hide: true,
},
];
export const TournTeamDetails = [
{
field: 'id',
type: 'number',
hide: true,
},
{
field: 'team',
headerName: 'Team',
width: 90,
headerClassName: 'pr-0',
sortable: false,
align: 'left',
renderCell: addFaction,
},
{
field: 'role',
headerName: 'Role',
width: 50,
renderCell: addRole,
headerClassName: 'pr-0',
sortable: false,
},
{
field: 'className',
headerName: 'Class',
width: 60,
renderCell: addClass,
sortable: false,
},
{
field: 'covenant',
headerName: 'Cov',
width: 40,
headerClassName: 'pr-0',
renderCell: addCov,
sortable: false,
},
{
field: 'name',
headerName: 'Name',
width: 130,
renderCell: classColorRender,
headerClassName: 'pr-0',
sortable: false,
},
{
field: 'faction',
headerName: 'Faction',
width: 150,
hide: true,
headerClassName: 'pr-0',
sortable: false,
},
{
field: 'level',
headerName: 'Level',
width: 60,
headerClassName: 'pr-0',
sortable: false,
align: 'center',
},
{
field: 'rank',
headerName: 'Rank',
width: 200,
hide: true,
headerClassName: 'pr-0',
sortable: false,
},
{
field: 'score',
headerName: 'Score',
width: 60,
renderCell: runScoreRender,
headerClassName: 'pr-0',
sortable: false,
align: 'center',
},
{
field: 'ilvl',
headerName: 'ilvl',
width: 40,
headerClassName: 'pr-0',
sortable: false,
align: 'center',
},
{
field: 'renown',
headerName: 'Renown',
width: 75,
headerClassName: 'pr-0',
sortable: false,
align: 'center',
},
{
field: 'links',
headerName: 'Links',
width: 150,
renderCell: linksRender,
hide: false,
headerClassName: 'pr-0',
sortable: false,
},
];
| 17.367742 | 76 | 0.585253 |
17c9b9679356c134af81e0bdf78b2096a36b8b09 | 395 | swift | Swift | ch18/02 CustomNotification/customnotification/MyObj.swift | carry0987/iOS-12-Programming-Practice-Swift-4.2-Example-Code | 07a2390cf45b2c12cff67bdd45a477f969fe0c26 | [
"MIT"
] | null | null | null | ch18/02 CustomNotification/customnotification/MyObj.swift | carry0987/iOS-12-Programming-Practice-Swift-4.2-Example-Code | 07a2390cf45b2c12cff67bdd45a477f969fe0c26 | [
"MIT"
] | null | null | null | ch18/02 CustomNotification/customnotification/MyObj.swift | carry0987/iOS-12-Programming-Practice-Swift-4.2-Example-Code | 07a2390cf45b2c12cff67bdd45a477f969fe0c26 | [
"MIT"
] | 1 | 2019-03-08T07:33:18.000Z | 2019-03-08T07:33:18.000Z | //
// MyObj.swift
// CustomNotification
//
// Created by KoKang Chu on 2017/7/18.
// Copyright © 2017年 KoKang Chu. All rights reserved.
//
import UIKit
class MyObj: NSObject {
@objc func receiveNotification(_ notification: Notification) {
if let num = notification.object as? NSNumber {
print("Name: \(notification.name), Value: \(num.intValue)")
}
}
}
| 21.944444 | 71 | 0.640506 |
1c369c848a93d742d5c617365192d026c8ac49ce | 271 | sql | SQL | sechub-server/src/main/resources/db/migration/V3__store_projectid_in_product_results.sql | manu-ki/sechub | 36d946386ea9d637f231b819da4d3ba2038a9ca2 | [
"MIT"
] | 79 | 2019-07-30T14:08:37.000Z | 2022-01-17T03:03:19.000Z | sechub-server/src/main/resources/db/migration/V3__store_projectid_in_product_results.sql | manu-ki/sechub | 36d946386ea9d637f231b819da4d3ba2038a9ca2 | [
"MIT"
] | 699 | 2019-07-30T08:37:52.000Z | 2022-01-24T16:06:12.000Z | sechub-server/src/main/resources/db/migration/V3__store_projectid_in_product_results.sql | manu-ki/sechub | 36d946386ea9d637f231b819da4d3ba2038a9ca2 | [
"MIT"
] | 36 | 2019-07-29T15:37:19.000Z | 2022-01-08T09:22:22.000Z | ALTER TABLE scan_product_result
ADD COLUMN project_id varchar(60) not null -- we accept 60 (3x20), see ProjectIdValidation
DEFAULT '[undefined]' -- just for having a fallback here for upgraded with null, [,] are not valid user input so no clash with new projects
;
| 54.2 | 143 | 0.756458 |
7b32e572fc2b58e9d071a73f3006ef403143b131 | 7,852 | swift | Swift | ios/Classes/SwiftAppodealFlutterPlugin.swift | a4medsoft/appodeal_flutter-1.1.1 | 7126ca377f3fd71b076dce45bca4947d5709eb3f | [
"MIT"
] | 28 | 2020-08-31T18:58:03.000Z | 2021-09-01T20:46:40.000Z | ios/Classes/SwiftAppodealFlutterPlugin.swift | a4medsoft/appodeal_flutter-1.1.1 | 7126ca377f3fd71b076dce45bca4947d5709eb3f | [
"MIT"
] | 39 | 2020-09-04T14:57:39.000Z | 2021-09-09T17:02:16.000Z | ios/Classes/SwiftAppodealFlutterPlugin.swift | a4medsoft/appodeal_flutter-1.1.1 | 7126ca377f3fd71b076dce45bca4947d5709eb3f | [
"MIT"
] | 26 | 2020-09-01T05:17:36.000Z | 2021-09-09T13:43:10.000Z | import Appodeal
import AppTrackingTransparency
import Flutter
import StackConsentManager
import UIKit
public class SwiftAppodealFlutterPlugin: NSObject, FlutterPlugin {
internal var channel: FlutterMethodChannel?
public static func register(with registrar: FlutterPluginRegistrar) {
let instance = SwiftAppodealFlutterPlugin()
instance.channel = FlutterMethodChannel(name: "appodeal_flutter", binaryMessenger: registrar.messenger())
registrar.addMethodCallDelegate(instance, channel: instance.channel!)
registrar.register(AppodealBannerFactory(instance: instance), withId: "plugins.io.vinicius.appodeal/banner")
registrar.register(AppodealMrecFactory(instance: instance), withId: "plugins.io.vinicius.appodeal/mrec")
}
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
switch call.method {
case "initialize": initialize(call, result)
case "setAutoCache": setAutoCache(call, result)
case "cache": cache(call, result)
case "isReadyForShow": isReadyForShow(call, result)
case "canShow": canShow(call, result)
case "show": show(call, result)
// Consent Manager
case "fetchConsentInfo": fetchConsentInfo(call, result)
case "shouldShowConsent": shouldShowConsent(call, result)
case "requestConsentAuthorization": requestConsentAuthorization(result)
// Permissions
case "requestIOSTrackingAuthorization": requestIOSTrackingAuthorization(result)
case "setIOSLocationTracking": setIOSLocationTracking(call, result)
default: result(FlutterMethodNotImplemented)
}
}
// MARK: - Appodeal
private func initialize(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) {
let args = call.arguments as! [String: Any]
let appKey = args["iosAppKey"] as! String
let hasConsent = args["hasConsent"] as! Bool
let adTypes = args["adTypes"] as! [Int]
let testMode = args["testMode"] as! Bool
let verbose = args["verbose"] as! Bool
// Registering callbacks
setCallbacks()
let ads = AppodealAdType(rawValue: adTypes.reduce(0) { $0 | getAdType(adId: $1).rawValue })
Appodeal.setTestingEnabled(testMode)
Appodeal.initialize(withApiKey: appKey, types: ads, hasConsent: hasConsent)
if verbose {
Appodeal.setLogLevel(APDLogLevel.verbose)
}
result(nil)
}
private func setAutoCache(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) {
let args = call.arguments as! [String: Any]
let adType = getAdType(adId: args["adType"] as! Int)
let autoCache = args["autoCache"] as! Bool
Appodeal.setAutocache(autoCache, types: adType)
result(nil)
}
private func cache(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) {
let args = call.arguments as! [String: Any]
let adType = getAdType(adId: args["adType"] as! Int)
Appodeal.cacheAd(adType)
result(nil)
}
private func isReadyForShow(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) {
let args = call.arguments as! [String: Any]
let adType = getShowStyle(adType: getAdType(adId: args["adType"] as! Int))
result(Appodeal.isReadyForShow(with: adType))
}
private func canShow(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) {
let args = call.arguments as! [String: Any]
let adType = getAdType(adId: args["adType"] as! Int)
let placementName = args["placementName"] as? String ?? ""
result(Appodeal.canShow(adType, forPlacement: placementName))
}
private func show(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) {
let args = call.arguments as! [String: Any]
let adType = getShowStyle(adType: getAdType(adId: args["adType"] as! Int))
let rootViewController = UIApplication.shared.keyWindow?.rootViewController
if let placementName = args["placementName"] as? String {
result(Appodeal.showAd(adType, forPlacement: placementName, rootViewController: rootViewController))
} else {
result(Appodeal.showAd(adType, rootViewController: rootViewController))
}
}
private func setCallbacks() {
// Banner callbacks are registered in AppodealBannerFactory > AppodealBannerView
Appodeal.setInterstitialDelegate(self)
Appodeal.setRewardedVideoDelegate(self)
Appodeal.setNonSkippableVideoDelegate(self)
}
// MARK: - Consent Manager
private func fetchConsentInfo(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) {
let args = call.arguments as! [String: Any]
let appKey = args["iosAppKey"] as! String
STKConsentManager.shared().synchronize(withAppKey: appKey) { error in
if error == nil {
result([
"acceptedVendors": [],
"status": STKConsentManager.shared().consentStatus.rawValue,
"zone": STKConsentManager.shared().regulation.rawValue,
])
} else {
result(FlutterError(code: "CONSENT_INFO_ERROR", message: error!.localizedDescription, details: nil))
}
}
}
private func shouldShowConsent(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) {
let args = call.arguments as! [String: Any]
let appKey = args["iosAppKey"] as! String
STKConsentManager.shared().synchronize(withAppKey: appKey) { error in
if error == nil {
result(STKConsentManager.shared().shouldShowConsentDialog == .true)
} else {
result(FlutterError(code: "CONSENT_CHECK_ERROR", message: error!.localizedDescription, details: nil))
}
}
}
private func requestConsentAuthorization(_ result: @escaping FlutterResult) {
STKConsentManager.shared().loadConsentDialog { error in
if error == nil {
let controller = UIApplication.shared.keyWindow?.rootViewController
STKConsentManager.shared().showConsentDialog(fromRootViewController: controller!, delegate: nil)
result(nil)
} else {
result(FlutterError(code: "CONSENT_WINDOW_ERROR", message: error!.localizedDescription, details: nil))
}
}
}
// MARK: - Permissions
private func requestIOSTrackingAuthorization(_ result: @escaping FlutterResult) {
if #available(iOS 14, *) {
ATTrackingManager.requestTrackingAuthorization { status in
result(status == .authorized)
}
} else {
result(true)
}
}
private func setIOSLocationTracking(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) {
let args = call.arguments as! [String: Any]
let enabled = args["enabled"] as! Bool
Appodeal.setLocationTracking(enabled)
result(nil)
}
// MARK: - Helper Methods
private func getShowStyle(adType: AppodealAdType) -> AppodealShowStyle {
switch adType {
case .interstitial: return .interstitial
case .rewardedVideo: return .rewardedVideo
case .nonSkippableVideo: return .nonSkippableVideo
default: return AppodealShowStyle(rawValue: 0)
}
}
private func getAdType(adId: Int) -> AppodealAdType {
switch adId {
case 1: return .banner
case 2: return .nativeAd
case 3: return .interstitial
case 4: return .rewardedVideo
case 5: return .nonSkippableVideo
case 6: return .MREC
default: return AppodealAdType(rawValue: 0)
}
}
}
| 38.490196 | 118 | 0.653719 |
f61873b8199321de1a25928aa198179c00f0d297 | 4,023 | swift | Swift | Sources/LambdaSwiftSprinter/LambdaApiCURL.swift | bok-/aws-lambda-swift-sprinter-core | 31ae88008dba13c56e91636d41d7fcf889fbd163 | [
"Apache-2.0"
] | null | null | null | Sources/LambdaSwiftSprinter/LambdaApiCURL.swift | bok-/aws-lambda-swift-sprinter-core | 31ae88008dba13c56e91636d41d7fcf889fbd163 | [
"Apache-2.0"
] | null | null | null | Sources/LambdaSwiftSprinter/LambdaApiCURL.swift | bok-/aws-lambda-swift-sprinter-core | 31ae88008dba13c56e91636d41d7fcf889fbd163 | [
"Apache-2.0"
] | null | null | null | // Copyright 2019 (c) Andrea Scuderi - https://github.com/swift-sprinter
//
// 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.
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
public class LambdaApiCURL: LambdaAPI {
let urlSession: URLSession
let builder: LambdaRuntimeRequestBuilder
static var timeoutIntervalForRequest: TimeInterval = 3600
public required init(awsLambdaRuntimeAPI: String) throws {
let configuration = URLSessionConfiguration.default
configuration.timeoutIntervalForRequest = LambdaApiCURL.timeoutIntervalForRequest
self.urlSession = URLSession(configuration: configuration)
self.builder = try LambdaRuntimeRequestBuilder(awsLambdaRuntimeAPI: awsLambdaRuntimeAPI)
}
internal init(awsLambdaRuntimeAPI: String, session: URLSession) throws {
self.urlSession = session
self.builder = try LambdaRuntimeRequestBuilder(awsLambdaRuntimeAPI: awsLambdaRuntimeAPI)
}
internal func synchronousDataTask(with urlRequest: URLRequest) throws -> (event: Data, responseHeaders: [AnyHashable: Any]) {
let (optData, optResponse, optError) = urlSession.synchronousDataTask(with: urlRequest)
guard optError == nil else {
throw SprinterError.endpointError(String(describing: optError!))
}
guard let httpResponse = optResponse as? HTTPURLResponse else {
throw SprinterError.endpointError("Invalid HTTPURLResponse from AWS Lambda Runtime API. \(optResponse.debugDescription)")
}
guard httpResponse.statusCode >= 200,
httpResponse.statusCode < 300 else {
throw SprinterError.endpointError("Invalid HTTPURLResponse from AWS Lambda Runtime API. \(httpResponse.debugDescription)")
}
return (event: optData ?? Data(), responseHeaders: httpResponse.allHeaderFields)
}
public func getNextInvocation() throws -> (event: Data, responseHeaders: [AnyHashable: Any]) {
let request = builder.getNextInvocationRequest()
return try synchronousDataTask(with: request)
}
public func postInvocationResponse(for requestId: String, httpBody: Data) throws {
let request = builder.postInvocationResponseRequest(requestId: requestId, body: httpBody)
_ = try synchronousDataTask(with: request)
}
public func postInvocationError(for requestId: String, error: Error) throws {
let request = builder.postInvocationErrorRequest(
requestId: requestId,
error: error
)
_ = try synchronousDataTask(with: request)
}
public func postInitializationError(error: Error) throws {
let request = builder.postInitializationErrorRequest(error: error)
_ = try synchronousDataTask(with: request)
}
}
extension URLSession {
internal func synchronousDataTask(with urlRequest: URLRequest) -> (Data?, URLResponse?, Error?) {
var data: Data?
var response: URLResponse?
var error: Error?
let dispatchGroup = DispatchGroup()
dispatchGroup.enter()
let dataTask = self.dataTask(with: urlRequest) { pData, pResponse, pError in
data = pData
response = pResponse
error = pError
dispatchGroup.leave()
}
dataTask.resume()
dispatchGroup.wait()
return (data, response, error)
}
}
public typealias SprinterCURL = Sprinter<LambdaApiCURL>
| 39.831683 | 134 | 0.700721 |
8aef94f3d51e2f1ed4b9b96327802f0ce740e685 | 980 | rs | Rust | src/entities/cosmic/universe.rs | muzudho/rust-kifuwarabe-wcsc30 | e21fda4d648c8fa162ca3e59dd2d85dab6272fc5 | [
"MIT"
] | null | null | null | src/entities/cosmic/universe.rs | muzudho/rust-kifuwarabe-wcsc30 | e21fda4d648c8fa162ca3e59dd2d85dab6272fc5 | [
"MIT"
] | null | null | null | src/entities/cosmic/universe.rs | muzudho/rust-kifuwarabe-wcsc30 | e21fda4d648c8fa162ca3e59dd2d85dab6272fc5 | [
"MIT"
] | null | null | null | //!
//! Data transfer object.
//!
extern crate rand;
use crate::entities::cosmic::playing::Game;
/// アプリケーション開始時に決め終えておくものだぜ☆(^~^)
pub struct Universe {
pub game: Game,
/// 対話モード
pub dialogue_mode: bool,
/// 読みの最大深さ。
pub option_max_depth: usize,
// /// 思考時間の最小秒☆(^~^)
// pub option_min_think_sec: usize,
// /// 思考時間の最大秒☆(^~^)
// pub option_max_think_sec: usize,
/// 諦めない深さ☆(^~^)読み終わるまで、思考時間を無視するぜ☆(^~^)max_depth - 1 より小さくしろだぜ☆(^~^)
pub option_depth_not_to_give_up: usize,
}
impl Default for Universe {
fn default() -> Self {
Universe {
game: Game::default(),
dialogue_mode: false,
option_max_depth: 1,
option_depth_not_to_give_up: 2,
// /// min < max にしろだぜ☆(^~^)
// option_min_think_sec: 7,
// option_max_think_sec: 17,
}
}
}
impl Universe {
/// 宇宙誕生
pub fn big_bang(&mut self) {
self.game.big_bang();
}
}
| 23.902439 | 73 | 0.560204 |
569714efa3e04e4e310aeda7555816918cf71c2d | 137 | ts | TypeScript | src/logic/ga/Selection/GraphSelectionBase.ts | technote-space/ga-framework-template | 22c91c4d3ab3f132f4de0a780c3f21438dc1ad96 | [
"MIT"
] | 3 | 2020-08-03T02:54:26.000Z | 2020-08-06T07:12:27.000Z | src/logic/ga/Selection/GraphSelectionBase.ts | technote-space/ga-framework-template | 22c91c4d3ab3f132f4de0a780c3f21438dc1ad96 | [
"MIT"
] | 17 | 2020-08-06T10:04:06.000Z | 2022-03-30T10:21:24.000Z | src/logic/ga/Selection/GraphSelectionBase.ts | technote-space/ga-framework-template | 22c91c4d3ab3f132f4de0a780c3f21438dc1ad96 | [
"MIT"
] | 1 | 2020-08-03T02:55:28.000Z | 2020-08-03T02:55:28.000Z | import {SelectionBase} from '@technote-space/genetic-algorithms-js';
export abstract class GraphSelectionBase extends SelectionBase {
}
| 27.4 | 68 | 0.817518 |
02f1b3a20036ce44a08f7b135ca47c401d062fa7 | 877 | kt | Kotlin | AndroidTransitionsProject/app/src/main/java/com/shevart/androidtransitions/advanced/mvpandmvvmpatterns/mvp/base/AbsMvpTransitionActivity.kt | shevart/AndroidTransitions | 41071f419effae08a9cf542bd5ff63a0999baa9f | [
"Apache-2.0"
] | 11 | 2018-06-04T12:03:10.000Z | 2022-03-01T17:28:21.000Z | AndroidTransitionsProject/app/src/main/java/com/shevart/androidtransitions/advanced/mvpandmvvmpatterns/mvp/base/AbsMvpTransitionActivity.kt | shevart/AndroidTransitions | 41071f419effae08a9cf542bd5ff63a0999baa9f | [
"Apache-2.0"
] | null | null | null | AndroidTransitionsProject/app/src/main/java/com/shevart/androidtransitions/advanced/mvpandmvvmpatterns/mvp/base/AbsMvpTransitionActivity.kt | shevart/AndroidTransitions | 41071f419effae08a9cf542bd5ff63a0999baa9f | [
"Apache-2.0"
] | null | null | null | package com.shevart.androidtransitions.advanced.mvpandmvvmpatterns.mvp.base
import android.os.Bundle
import com.shevart.androidtransitions.advanced.clean.code.initContentTransition
import com.shevart.androidtransitions.advanced.clean.code.initSharedElementsTransition
import com.shevart.androidtransitions.base.AbsActivity
abstract class AbsMvpTransitionActivity<P: BasePresenter<V>, V: BaseView> : AbsActivity() {
protected lateinit var presenter: P
protected abstract fun provideView(): V
protected abstract fun providePresenter(): P
override fun onCreate(savedInstanceState: Bundle?) {
initSharedElementsTransition()
super.onCreate(savedInstanceState)
presenter = providePresenter()
presenter.attachView(provideView())
}
override fun onDestroy() {
super.onDestroy()
presenter.detachView()
}
} | 33.730769 | 91 | 0.763968 |
d2e6b1e3c789d9c40e11dc98c8f287e36e477858 | 2,323 | php | PHP | application/admin/controller/Deal.php | namelzx/car | 7ce5af0dc2f225f09d4a899276151453b5411f2f | [
"Apache-2.0"
] | null | null | null | application/admin/controller/Deal.php | namelzx/car | 7ce5af0dc2f225f09d4a899276151453b5411f2f | [
"Apache-2.0"
] | null | null | null | application/admin/controller/Deal.php | namelzx/car | 7ce5af0dc2f225f09d4a899276151453b5411f2f | [
"Apache-2.0"
] | null | null | null | <?php
namespace app\admin\controller;
use think\Controller;
class deal extends Controller
{
/*
* 审车预约
*/
public function index()
{
$data = input('param.');
$res = db('Whosecar')->where('status', $data['status'])->paginate();
$this->assign('res', $res);
return view();
}
/*
* 审车预约车辆状况
*/
public function infolist()
{
$data = input('param.');
$res = db('Whosecar_child')->where('whosecar_id', $data['id'])->select();
$this->assign('res', $res);
return view();
}
/*
* 审车预约状态修改
*/
public function wstatus()
{
$data = input('param.');
// print_r($data);
$res = db('Whosecar')->where('id', $data['id'])->data(['status' => $data['status']])->update();
if ($res) {
$this->success('更新成功');
} else {
$this->error('更新失败');
}
}
/*
* 二手车估价
*/
public function usedcar()
{
$data = input('param.');
$res = db('usedcar')->where('status', $data['status'])->paginate();
$this->assign('res', $res);
return view();
}
/*
* 审车预约状态修改
*/
public function ustatus()
{
$data = input('param.');
$res = db('usedcar')->where('id', $data['id'])->data(['status' => $data['status']])->update();
if ($res) {
$this->success('更新成功');
} else {
$this->error('更新失败');
}
}
/*
* 保险询价
*/
public function insurance()
{
$data = input('param.');
$res = db('insurance')->where('status', $data['status'])->paginate();
$this->assign('res', $res);
return view();
}
/*
* 保险询价详情
*/
public function insurancelist()
{
$data = input('param.');
$res = db('insurance_child')->where('insurance_id', $data['id'])->select();
$this->assign('res', $res);
return view();
}
/*
* 保险询价
*/
public function istatus()
{
$data = input('param.');
$res = db('insurance')->where('id', $data['id'])->data(['status' => $data['status']])->update();
if ($res) {
$this->success('更新成功');
} else {
$this->error('更新失败');
}
}
} | 21.311927 | 104 | 0.446836 |
3b1beca6896bd826014f12bbf78fe5c0cd5c08e3 | 7,306 | h | C | lefdef_util/src/include/def/defiNonDefault.h | wei-zeng/obfusX | d9605318af670c474a089ede8c70b7fce088a9c2 | [
"Unlicense"
] | null | null | null | lefdef_util/src/include/def/defiNonDefault.h | wei-zeng/obfusX | d9605318af670c474a089ede8c70b7fce088a9c2 | [
"Unlicense"
] | null | null | null | lefdef_util/src/include/def/defiNonDefault.h | wei-zeng/obfusX | d9605318af670c474a089ede8c70b7fce088a9c2 | [
"Unlicense"
] | null | null | null | /*
* This file is part of the Cadence LEF/DEF Open Source
* Distribution, Product Version 5.7, and is subject to the Cadence LEF/DEF
* Open Source License Agreement. Your continued use of this file
* constitutes your acceptance of the terms of the LEF/DEF Open Source
* License and an agreement to abide by its terms. If you don't agree
* with this, you must remove this and any other files which are part of the
* distribution and destroy any copies made.
*
* For updates, support, or to become part of the LEF/DEF Community, check
* www.openeda.org for details.
*/
#ifndef defiNonDefault_h
#define defiNonDefault_h
#include <stdio.h>
#include "defiKRDefs.h"
#include "defiMisc.h"
/*
* A non default rule can have one or more layers.
*/
/*
* The layer information is kept in an array.
*/
/*
* Will be obsoleted in 5.7
*/
/*
* Will be obsoleted in 5.7
*/
/*
* Will be obsoleted in 5.7
*/
/*
* Will be obsoleted in 5.7
*/
/*
* Debug print
*/
/*
* Layer information
*/
typedef struct defiNonDefault_s {
char *name_;
char hardSpacing_;
int numLayers_;
int layersAllocated_;
char **layerName_;
double *width_;
char *hasDiagWidth_;
double *diagWidth_;
char *hasSpacing_;
double *spacing_;
char *hasWireExt_;
double *wireExt_;
int numVias_;
int viasAllocated_;
char **viaNames_;
int numViaRules_;
int viaRulesAllocated_;
char **viaRuleNames_;
int numMinCuts_;
int minCutsAllocated_;
char **cutLayerName_;
int *numCuts_;
int numProps_;
int propsAllocated_;
char **names_;
char **values_;
double *dvalues_;
char *types_;
} defiNonDefault;
EXTERN defiNonDefault *
defiNonDefault_Create
PROTO_PARAMS(( ));
EXTERN void
defiNonDefault_Init
PROTO_PARAMS(( defiNonDefault * this ));
EXTERN void
defiNonDefault_Destroy
PROTO_PARAMS(( defiNonDefault * this ));
EXTERN void
defiNonDefault_Delete
PROTO_PARAMS(( defiNonDefault * this ));
EXTERN void
defiNonDefault_clear
PROTO_PARAMS(( defiNonDefault * this ));
EXTERN void
defiNonDefault_setName
PROTO_PARAMS(( defiNonDefault * this,
const char *name ));
EXTERN void
defiNonDefault_setHardspacing
PROTO_PARAMS(( defiNonDefault * this ));
EXTERN void
defiNonDefault_addLayer
PROTO_PARAMS(( defiNonDefault * this,
const char *name ));
EXTERN void
defiNonDefault_addWidth
PROTO_PARAMS(( defiNonDefault * this,
double num ));
EXTERN void
defiNonDefault_addDiagWidth
PROTO_PARAMS(( defiNonDefault * this,
double num ));
EXTERN void
defiNonDefault_addSpacing
PROTO_PARAMS(( defiNonDefault * this,
double num ));
EXTERN void
defiNonDefault_addWireExt
PROTO_PARAMS(( defiNonDefault * this,
double num ));
EXTERN void
defiNonDefault_addVia
PROTO_PARAMS(( defiNonDefault * this,
const char *name ));
EXTERN void
defiNonDefault_addViaRule
PROTO_PARAMS(( defiNonDefault * this,
const char *name ));
EXTERN void
defiNonDefault_addMinCuts
PROTO_PARAMS(( defiNonDefault * this,
const char *name,
int numCuts ));
EXTERN void
defiNonDefault_addProperty
PROTO_PARAMS(( defiNonDefault * this,
const char *name,
const char *value,
const char type ));
EXTERN void
defiNonDefault_addNumProperty
PROTO_PARAMS(( defiNonDefault * this,
const char *name,
const double d,
const char *value,
const char type ));
EXTERN void
defiNonDefault_end
PROTO_PARAMS(( defiNonDefault * this ));
EXTERN const char *
defiNonDefault_name
PROTO_PARAMS(( const defiNonDefault * this ));
EXTERN int
defiNonDefault_hasHardspacing
PROTO_PARAMS(( const defiNonDefault * this ));
EXTERN int
defiNonDefault_numProps
PROTO_PARAMS(( const defiNonDefault * this ));
EXTERN const char *
defiNonDefault_propName
PROTO_PARAMS(( const defiNonDefault * this,
int index ));
EXTERN const char *
defiNonDefault_propValue
PROTO_PARAMS(( const defiNonDefault * this,
int index ));
EXTERN double
defiNonDefault_propNumber
PROTO_PARAMS(( const defiNonDefault * this,
int index ));
EXTERN const char
defiNonDefault_propType
PROTO_PARAMS(( const defiNonDefault * this,
int index ));
EXTERN int
defiNonDefault_propIsNumber
PROTO_PARAMS(( const defiNonDefault * this,
int index ));
EXTERN int
defiNonDefault_propIsString
PROTO_PARAMS(( const defiNonDefault * this,
int index ));
EXTERN int
defiNonDefault_numLayers
PROTO_PARAMS(( const defiNonDefault * this ));
EXTERN const char *
defiNonDefault_layerName
PROTO_PARAMS(( const defiNonDefault * this,
int index ));
EXTERN double
defiNonDefault_layerWidth
PROTO_PARAMS(( const defiNonDefault * this,
int index ));
EXTERN int
defiNonDefault_layerWidthVal
PROTO_PARAMS(( const defiNonDefault * this,
int index ));
EXTERN int
defiNonDefault_hasLayerDiagWidth
PROTO_PARAMS(( const defiNonDefault * this,
int index ));
EXTERN double
defiNonDefault_layerDiagWidth
PROTO_PARAMS(( const defiNonDefault * this,
int index ));
EXTERN int
defiNonDefault_layerDiagWidthVal
PROTO_PARAMS(( const defiNonDefault * this,
int index ));
EXTERN int
defiNonDefault_hasLayerSpacing
PROTO_PARAMS(( const defiNonDefault * this,
int index ));
EXTERN double
defiNonDefault_layerSpacing
PROTO_PARAMS(( const defiNonDefault * this,
int index ));
EXTERN int
defiNonDefault_layerSpacingVal
PROTO_PARAMS(( const defiNonDefault * this,
int index ));
EXTERN int
defiNonDefault_hasLayerWireExt
PROTO_PARAMS(( const defiNonDefault * this,
int index ));
EXTERN double
defiNonDefault_layerWireExt
PROTO_PARAMS(( const defiNonDefault * this,
int index ));
EXTERN int
defiNonDefault_layerWireExtVal
PROTO_PARAMS(( const defiNonDefault * this,
int index ));
EXTERN int
defiNonDefault_numVias
PROTO_PARAMS(( const defiNonDefault * this ));
EXTERN const char *
defiNonDefault_viaName
PROTO_PARAMS(( const defiNonDefault * this,
int index ));
EXTERN int
defiNonDefault_numViaRules
PROTO_PARAMS(( const defiNonDefault * this ));
EXTERN const char *
defiNonDefault_viaRuleName
PROTO_PARAMS(( const defiNonDefault * this,
int index ));
EXTERN int
defiNonDefault_numMinCuts
PROTO_PARAMS(( const defiNonDefault * this ));
EXTERN const char *
defiNonDefault_cutLayerName
PROTO_PARAMS(( const defiNonDefault * this,
int index ));
EXTERN int
defiNonDefault_numCuts
PROTO_PARAMS(( const defiNonDefault * this,
int index ));
EXTERN void
defiNonDefault_print
PROTO_PARAMS(( defiNonDefault * this,
FILE * f ));
#endif
| 23.120253 | 77 | 0.660142 |
3305cde3ca6c04110a543b7c99c3c1ade131f3f3 | 2,214 | sql | SQL | db/chat.sql | andr3m0ur4/ChatMyChatApp | d75cd5451d89860b7c61d5ca311e71ed1b61110b | [
"MIT"
] | null | null | null | db/chat.sql | andr3m0ur4/ChatMyChatApp | d75cd5451d89860b7c61d5ca311e71ed1b61110b | [
"MIT"
] | null | null | null | db/chat.sql | andr3m0ur4/ChatMyChatApp | d75cd5451d89860b7c61d5ca311e71ed1b61110b | [
"MIT"
] | null | null | null | -- phpMyAdmin SQL Dump
-- version 4.8.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: 17-Jun-2019 às 17:02
-- Versão do servidor: 10.1.34-MariaDB
-- PHP Version: 7.2.8
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `chat`
--
-- --------------------------------------------------------
--
-- Estrutura da tabela `chats`
--
CREATE TABLE `chats` (
`chat_id` int(11) NOT NULL,
`chat_user_id` int(11) NOT NULL,
`chat_text` varchar(140) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estrutura da tabela `users`
--
CREATE TABLE `users` (
`user_id` int(11) NOT NULL,
`user_name` varchar(50) NOT NULL,
`user_email` varchar(50) NOT NULL,
`user_password` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `users`
--
INSERT INTO `users` (`user_id`, `user_name`, `user_email`, `user_password`) VALUES
(1, 'André Moura', 'andremoura@gmail.com', '40bd001563085fc35165329ea1ff5c5ecbdbbeef'),
(2, 'L', 'ryuzaki@gmail.com', '40042502f4a360fdd871e8973a9ac6d089cd8799'),
(3, 'Kira', 'killer@gmail.com', 'b3d07f7c0439e2128ef9a7159c688e5e9050a4f6');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `chats`
--
ALTER TABLE `chats`
ADD PRIMARY KEY (`chat_id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`user_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `chats`
--
ALTER TABLE `chats`
MODIFY `chat_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| 23.305263 | 87 | 0.672538 |
9c3fb24e07c3f6b798185b1863eecadb035657b7 | 9,082 | js | JavaScript | miniprogram/miniprogram_npm/weui-miniprogram/uploader/uploader.js | qq81860186/tuya-weapp-demo | 4101e9203200a9c5a81931aceb25084ab67626ec | [
"MIT"
] | 15 | 2020-03-15T05:26:00.000Z | 2021-12-03T07:50:37.000Z | miniprogram/miniprogram_npm/weui-miniprogram/uploader/uploader.js | qq81860186/tuya-weapp-demo | 4101e9203200a9c5a81931aceb25084ab67626ec | [
"MIT"
] | 15 | 2020-09-23T13:20:56.000Z | 2021-12-01T02:43:45.000Z | miniprogram/miniprogram_npm/weui-miniprogram/uploader/uploader.js | qq81860186/tuya-weapp-demo | 4101e9203200a9c5a81931aceb25084ab67626ec | [
"MIT"
] | 3 | 2021-11-10T10:59:44.000Z | 2021-11-25T13:01:23.000Z | module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 22);
/******/ })
/************************************************************************/
/******/ ({
/***/ 22:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Component({
options: {
addGlobalClass: true
},
properties: {
title: {
type: String,
value: '图片上传'
},
sizeType: {
type: Array,
value: ['original', 'compressed']
},
sourceType: {
type: Array,
value: ['album', 'camera']
},
maxSize: {
type: Number,
value: 5 * 1024 * 1024
},
maxCount: {
// 最多上传多少个文件
type: Number,
value: 1
},
files: {
// 当前的图片列表, {url, error, loading}
type: Array,
value: [],
observer(newVal) {
this.setData({
currentFiles: newVal
});
}
},
select: {
// 过滤某个文件
type: null,
value: () => {}
},
upload: {
// 返回Promise的一个文件上传的函数
type: null,
value: null
},
tips: {
type: String,
value: ''
},
extClass: {
type: String,
value: ''
},
showDelete: {
// 是否显示delete按钮
type: Boolean,
value: true
}
},
data: {
currentFiles: [],
showPreview: false,
previewImageUrls: []
},
ready() {},
methods: {
previewImage(e) {
const {
index
} = e.currentTarget.dataset;
const previewImageUrls = [];
this.data.files.forEach(item => {
previewImageUrls.push(item.url);
});
this.setData({
previewImageUrls,
previewCurrent: index,
showPreview: true
});
},
chooseImage() {
if (this.uploading) return;
wx.chooseImage({
count: this.data.maxCount - this.data.files.length,
success: res => {
// console.log('chooseImage resp', res)
// 首先检查文件大小
let invalidIndex = -1; // @ts-ignore
res.tempFiles.forEach((item, index) => {
if (item.size > this.data.maxSize) {
invalidIndex = index;
}
});
if (typeof this.data.select === 'function') {
const ret = this.data.select(res);
if (ret === false) {
return;
}
}
if (invalidIndex >= 0) {
this.triggerEvent('fail', {
type: 1,
errMsg: `chooseImage:fail size exceed ${this.data.maxSize}`,
total: res.tempFilePaths.length,
index: invalidIndex
}, {});
return;
} // 获取文件内容
const mgr = wx.getFileSystemManager();
const contents = res.tempFilePaths.map(item => {
// @ts-ignore
const fileContent = mgr.readFileSync(item);
return fileContent;
});
const obj = {
tempFilePaths: res.tempFilePaths,
tempFiles: res.tempFiles,
contents
}; // 触发选中的事件,开发者根据内容来上传文件,上传了把上传的结果反馈到files属性里面
this.triggerEvent('select', obj, {});
const files = res.tempFilePaths.map((item, i) => ({
loading: true,
// @ts-ignore
url: `data:image/jpg;base64,${wx.arrayBufferToBase64(contents[i])}`
}));
if (!files || !files.length) return;
if (typeof this.data.upload === 'function') {
const len = this.data.files.length;
const newFiles = this.data.files.concat(files);
this.setData({
files: newFiles,
currentFiles: newFiles
});
this.loading = true;
this.data.upload(obj).then(json => {
this.loading = false;
if (json.urls) {
const oldFiles = this.data.files;
json.urls.forEach((url, index) => {
oldFiles[len + index].url = url;
oldFiles[len + index].loading = false;
});
this.setData({
files: oldFiles,
currentFiles: newFiles
});
this.triggerEvent('success', json, {});
} else {
this.triggerEvent('fail', {
type: 3,
errMsg: 'upload file fail, urls not found'
}, {});
}
}).catch(err => {
this.loading = false;
const oldFiles = this.data.files;
res.tempFilePaths.forEach((item, index) => {
oldFiles[len + index].error = true;
oldFiles[len + index].loading = false;
});
this.setData({
files: oldFiles,
currentFiles: newFiles
});
this.triggerEvent('fail', {
type: 3,
errMsg: 'upload file fail',
error: err
}, {});
});
}
},
fail: fail => {
if (fail.errMsg.indexOf('chooseImage:fail cancel') >= 0) {
this.triggerEvent('cancel', {}, {});
return;
}
fail.type = 2;
this.triggerEvent('fail', fail, {});
}
});
},
deletePic(e) {
const index = e.detail.index;
const files = this.data.files;
const file = files.splice(index, 1);
this.setData({
files,
currentFiles: files
});
this.triggerEvent('delete', {
index,
item: file[0]
});
}
}
});
/***/ })
/******/ }); | 28.923567 | 159 | 0.48987 |
6821dbf91e8c96d1d95a2919396babe15ec93244 | 17,070 | lua | Lua | src/pixman.lua | LuaDist-testing/llui | 2da9971e87908dd48d1d92d120ad51e17c8a22ba | [
"MIT"
] | 13 | 2015-09-28T17:02:53.000Z | 2018-07-16T18:13:36.000Z | pixman.lua | Wiladams/LJIT2pixman | 75d0dd2936fb0312e047a2e3b2091aab95e0ab4b | [
"MIT"
] | 1 | 2015-09-30T07:54:02.000Z | 2015-10-06T16:06:24.000Z | src/pixman.lua | Wiladams/LLUI | 42eed4135a9b7c755de36e08cc03bc5823c5e6d3 | [
"MIT"
] | 2 | 2020-06-19T15:47:12.000Z | 2021-01-26T08:07:41.000Z | local ffi = require("ffi")
local ENUM = ffi.C;
local bit = require("bit")
local band, bor, bnot = bit.band, bit.bor, bit.bnot;
local lshift, rshift = bit.lshift, bit.rshift;
local Lib_pixman = require("pixman_ffi")
local Constants = {}
local Enums = {
pixman_repeat_t =
{
PIXMAN_REPEAT_NONE = ENUM.PIXMAN_REPEAT_NONE,
PIXMAN_REPEAT_NORMAL = ENUM.PIXMAN_REPEAT_NORMAL,
PIXMAN_REPEAT_PAD = ENUM.PIXMAN_REPEAT_PAD,
PIXMAN_REPEAT_REFLECT = ENUM.PIXMAN_REPEAT_REFLECT
};
pixman_filter_t =
{
PIXMAN_FILTER_FAST = ENUM.PIXMAN_FILTER_FAST,
PIXMAN_FILTER_GOOD = ENUM.PIXMAN_FILTER_GOOD,
PIXMAN_FILTER_BEST = ENUM.PIXMAN_FILTER_BEST,
PIXMAN_FILTER_NEAREST = ENUM.PIXMAN_FILTER_NEAREST,
PIXMAN_FILTER_BILINEAR = ENUM.PIXMAN_FILTER_BILINEAR,
PIXMAN_FILTER_CONVOLUTION = ENUM.PIXMAN_FILTER_CONVOLUTION,
PIXMAN_FILTER_SEPARABLE_CONVOLUTION = ENUM.PIXMAN_FILTER_SEPARABLE_CONVOLUTION
};
pixman_op_t =
{
PIXMAN_OP_CLEAR = 0x00,
PIXMAN_OP_SRC = 0x01,
PIXMAN_OP_DST = 0x02,
PIXMAN_OP_OVER = 0x03,
PIXMAN_OP_OVER_REVERSE = 0x04,
PIXMAN_OP_IN = 0x05,
PIXMAN_OP_IN_REVERSE = 0x06,
PIXMAN_OP_OUT = 0x07,
PIXMAN_OP_OUT_REVERSE = 0x08,
PIXMAN_OP_ATOP = 0x09,
PIXMAN_OP_ATOP_REVERSE = 0x0a,
PIXMAN_OP_XOR = 0x0b,
PIXMAN_OP_ADD = 0x0c,
PIXMAN_OP_SATURATE = 0x0d,
PIXMAN_OP_DISJOINT_CLEAR = 0x10,
PIXMAN_OP_DISJOINT_SRC = 0x11,
PIXMAN_OP_DISJOINT_DST = 0x12,
PIXMAN_OP_DISJOINT_OVER = 0x13,
PIXMAN_OP_DISJOINT_OVER_REVERSE = 0x14,
PIXMAN_OP_DISJOINT_IN = 0x15,
PIXMAN_OP_DISJOINT_IN_REVERSE = 0x16,
PIXMAN_OP_DISJOINT_OUT = 0x17,
PIXMAN_OP_DISJOINT_OUT_REVERSE = 0x18,
PIXMAN_OP_DISJOINT_ATOP = 0x19,
PIXMAN_OP_DISJOINT_ATOP_REVERSE = 0x1a,
PIXMAN_OP_DISJOINT_XOR = 0x1b,
PIXMAN_OP_CONJOINT_CLEAR = 0x20,
PIXMAN_OP_CONJOINT_SRC = 0x21,
PIXMAN_OP_CONJOINT_DST = 0x22,
PIXMAN_OP_CONJOINT_OVER = 0x23,
PIXMAN_OP_CONJOINT_OVER_REVERSE = 0x24,
PIXMAN_OP_CONJOINT_IN = 0x25,
PIXMAN_OP_CONJOINT_IN_REVERSE = 0x26,
PIXMAN_OP_CONJOINT_OUT = 0x27,
PIXMAN_OP_CONJOINT_OUT_REVERSE = 0x28,
PIXMAN_OP_CONJOINT_ATOP = 0x29,
PIXMAN_OP_CONJOINT_ATOP_REVERSE = 0x2a,
PIXMAN_OP_CONJOINT_XOR = 0x2b,
PIXMAN_OP_MULTIPLY = 0x30,
PIXMAN_OP_SCREEN = 0x31,
PIXMAN_OP_OVERLAY = 0x32,
PIXMAN_OP_DARKEN = 0x33,
PIXMAN_OP_LIGHTEN = 0x34,
PIXMAN_OP_COLOR_DODGE = 0x35,
PIXMAN_OP_COLOR_BURN = 0x36,
PIXMAN_OP_HARD_LIGHT = 0x37,
PIXMAN_OP_SOFT_LIGHT = 0x38,
PIXMAN_OP_DIFFERENCE = 0x39,
PIXMAN_OP_EXCLUSION = 0x3a,
PIXMAN_OP_HSL_HUE = 0x3b,
PIXMAN_OP_HSL_SATURATION = 0x3c,
PIXMAN_OP_HSL_COLOR = 0x3d,
PIXMAN_OP_HSL_LUMINOSITY = 0x3e
} ;
pixman_region_overlap_t =
{
PIXMAN_REGION_OUT = ENUM.PIXMAN_REGION_OUT,
PIXMAN_REGION_IN = ENUM.PIXMAN_REGION_IN,
PIXMAN_REGION_PART = ENUM.PIXMAN_REGION_PART
};
pixman_format_code_t = {
PIXMAN_a8r8g8b8 = 0x20028888,
PIXMAN_x8r8g8b8 = 0x20020888,
PIXMAN_a8b8g8r8 = 0x20038888,
PIXMAN_x8b8g8r8 = 0x20030888,
PIXMAN_b8g8r8a8 = 0x20088888,
PIXMAN_b8g8r8x8 = 0x20080888,
PIXMAN_r8g8b8a8 = 0x20098888,
PIXMAN_r8g8b8x8 = 0x20090888,
PIXMAN_x14r6g6b6 = 0x20020666,
PIXMAN_x2r10g10b10 = 0x20020aaa,
PIXMAN_a2r10g10b10 = 0x20022aaa,
PIXMAN_x2b10g10r10 = 0x20030aaa,
PIXMAN_a2b10g10r10 = 0x20032aaa,
PIXMAN_a8r8g8b8_sRGB = 0x200a8888,
PIXMAN_r8g8b8 = 0x18020888,
PIXMAN_b8g8r8 = 0x18030888,
PIXMAN_r5g6b5 = 0x10020565,
PIXMAN_b5g6r5 = 0x10030565,
PIXMAN_a1r5g5b5 = 0x10021555,
PIXMAN_x1r5g5b5 = 0x10020555,
PIXMAN_a1b5g5r5 = 0x10031555,
PIXMAN_x1b5g5r5 = 0x10030555,
PIXMAN_a4r4g4b4 = 0x10024444,
PIXMAN_x4r4g4b4 = 0x10020444,
PIXMAN_a4b4g4r4 = 0x10034444,
PIXMAN_x4b4g4r4 = 0x10030444,
PIXMAN_a8 = 0x8018000,
PIXMAN_r3g3b2 = 0x8020332,
PIXMAN_b2g3r3 = 0x8030332,
PIXMAN_a2r2g2b2 = 0x8022222,
PIXMAN_a2b2g2r2 = 0x8032222,
PIXMAN_c8 = 0x8040000,
PIXMAN_g8 = 0x8050000,
PIXMAN_x4a4 = 0x8014000,
PIXMAN_x4c4 = 0x8040000,
PIXMAN_x4g4 = 0x8050000,
PIXMAN_a4 = 0x4014000,
PIXMAN_r1g2b1 = 0x4020121,
PIXMAN_b1g2r1 = 0x4030121,
PIXMAN_a1r1g1b1 = 0x4021111,
PIXMAN_a1b1g1r1 = 0x4031111,
PIXMAN_c4 = 0x4040000,
PIXMAN_g4 = 0x4050000,
PIXMAN_a1 = 0x1011000,
PIXMAN_g1 = 0x1050000,
PIXMAN_yuy2 = 0x10060000,
PIXMAN_yv12 = 0xc070000
} ;
}
--[[
All the types that are declared in the library
--]]
local Types = {
pixman_bool_t = ffi.typeof("pixman_bool_t");
pixman_fixed_32_32_t = ffi.typeof("pixman_fixed_32_32_t");
pixman_fixed_48_16_t = ffi.typeof("pixman_fixed_48_16_t");
pixman_fixed_1_31_t = ffi.typeof("pixman_fixed_1_31_t");
pixman_fixed_1_16_t = ffi.typeof("pixman_fixed_1_16_t");
pixman_fixed_16_16_t = ffi.typeof("pixman_fixed_16_16_t");
pixman_fixed_t = ffi.typeof("pixman_fixed_t");
pixman_color = ffi.typeof("struct pixman_color");
pixman_point_fixed = ffi.typeof("struct pixman_point_fixed");
pixman_line_fixed = ffi.typeof("struct pixman_line_fixed");
pixman_vector = ffi.typeof("struct pixman_vector");
pixman_transform = ffi.typeof("struct pixman_transform");
-- floating point matrices
pixman_f_transform_t = ffi.typeof("pixman_f_transform_t");
pixman_f_vector_t = ffi.typeof("pixman_f_vector_t");
pixman_f_vector = ffi.typeof("struct pixman_f_vector");
pixman_f_transform = ffi.typeof("struct pixman_f_transform");
-- Regions
pixman_region16_data_t = ffi.typeof("pixman_region16_data_t");
pixman_box16_t = ffi.typeof("pixman_box16_t");
pixman_rectangle16_t = ffi.typeof("pixman_rectangle16_t");
pixman_region16_t = ffi.typeof("pixman_region16_t");
pixman_region16_data = ffi.typeof("struct pixman_region16_data");
pixman_rectangle16 = ffi.typeof("struct pixman_rectangle16");
pixman_box16 = ffi.typeof("struct pixman_box16");
pixman_region16 = ffi.typeof("struct pixman_region16");
pixman_gradient_stop = ffi.typeof("struct pixman_gradient_stop");
pixman_indexed = ffi.typeof("struct pixman_indexed");
-- 32-bit regions
pixman_region32_data = ffi.typeof("struct pixman_region32_data");
pixman_rectangle32 = ffi.typeof("struct pixman_rectangle32");
pixman_box32 = ffi.typeof("struct pixman_box32");
pixman_region32 = ffi.typeof("struct pixman_region32");
pixman_glyph_t = ffi.typeof("pixman_glyph_t");
pixman_edge = ffi.typeof("struct pixman_edge");
pixman_trapezoid = ffi.typeof("struct pixman_trapezoid");
pixman_triangle = ffi.typeof("struct pixman_triangle");
pixman_span_fix = ffi.typeof("struct pixman_span_fix");
pixman_trap = ffi.typeof("struct pixman_trap");
}
Types.pixman_gradient_stop_t = Types.pixman_gradient_stop;
--[[
Filling out this list of functions is a convenience for putting the
functions pointers into the global namespace. This table is needed
in the least, as you can access the functions more quickly using the
library references directly.
--]]
local Functions = {
-- Transforms
pixman_transform_init_identity = Lib_pixman.pixman_transform_init_identity;
pixman_transform_point_3d = Lib_pixman.pixman_transform_point_3d;
pixman_transform_point = Lib_pixman.pixman_transform_point;
pixman_transform_multiply = Lib_pixman.pixman_transform_multiply;
pixman_transform_init_scale = Lib_pixman.pixman_transform_init_scale;
pixman_transform_scale = Lib_pixman.pixman_transform_scale;
pixman_transform_init_rotate = Lib_pixman.pixman_transform_init_rotate;
pixman_transform_rotate = Lib_pixman.pixman_transform_rotate;
pixman_transform_init_translate = Lib_pixman.pixman_transform_init_translate;
pixman_transform_translate = Lib_pixman.pixman_transform_translate;
pixman_transform_bounds = Lib_pixman.pixman_transform_bounds;
pixman_transform_invert = Lib_pixman.pixman_transform_invert;
pixman_transform_is_identity = Lib_pixman.pixman_transform_is_identity;
pixman_transform_is_scale = Lib_pixman.pixman_transform_is_scale;
pixman_transform_is_int_translate = Lib_pixman.pixman_transform_is_int_translate;
pixman_transform_is_inverse = Lib_pixman.pixman_transform_is_inverse;
-- Floating point transforms
pixman_transform_from_pixman_f_transform= Lib_pixman.pixman_transform_from_pixman_f_transform;
pixman_f_transform_from_pixman_transform= Lib_pixman.pixman_f_transform_from_pixman_transform;
pixman_f_transform_invert= Lib_pixman.pixman_f_transform_invert;
pixman_f_transform_point= Lib_pixman.pixman_f_transform_point;
pixman_f_transform_point_3d= Lib_pixman.pixman_f_transform_point_3d;
pixman_f_transform_multiply= Lib_pixman.pixman_f_transform_multiply;
pixman_f_transform_init_scale= Lib_pixman.pixman_f_transform_init_scale;
pixman_f_transform_scale= Lib_pixman.pixman_f_transform_scale;
pixman_f_transform_init_rotate= Lib_pixman.pixman_f_transform_init_rotate;
pixman_f_transform_rotate= Lib_pixman.pixman_f_transform_rotate;
pixman_f_transform_init_translate= Lib_pixman.pixman_f_transform_init_translate;
pixman_f_transform_translate= Lib_pixman.pixman_f_transform_translate;
pixman_f_transform_bounds= Lib_pixman.pixman_f_transform_bounds;
pixman_f_transform_init_identity= Lib_pixman.pixman_f_transform_init_identity;
-- Regions
pixman_region_init = Lib_pixman.pixman_region_init;
pixman_region_init_rect = Lib_pixman.pixman_region_init_rect;
pixman_region_init_rects = Lib_pixman.pixman_region_init_rects;
pixman_region_init_with_extents = Lib_pixman.pixman_region_init_with_extents;
pixman_region_init_from_image = Lib_pixman.pixman_region_init_from_image;
pixman_region_fini = Lib_pixman.pixman_region_fini;
pixman_region_translate = Lib_pixman.pixman_region_translate;
pixman_region_copy = Lib_pixman.pixman_region_copy;
pixman_region_intersect = Lib_pixman.pixman_region_intersect;
pixman_region_union = Lib_pixman.pixman_region_union;
pixman_region_union_rect = Lib_pixman.pixman_region_union_rect;
pixman_region_intersect_rect = Lib_pixman.pixman_region_intersect_rect;
pixman_region_subtract = Lib_pixman.pixman_region_subtract;
pixman_region_inverse = Lib_pixman.pixman_region_inverse;
pixman_region_contains_point = Lib_pixman.pixman_region_contains_point;
pixman_region_contains_rectangle = Lib_pixman.pixman_region_contains_rectangle;
pixman_region_not_empty = Lib_pixman.pixman_region_not_empty;
pixman_region_extents = Lib_pixman.pixman_region_extents;
pixman_region_n_rects = Lib_pixman.pixman_region_n_rects;
pixman_region_rectangles = Lib_pixman.pixman_region_rectangles;
pixman_region_equal = Lib_pixman.pixman_region_equal;
pixman_region_selfcheck = Lib_pixman.pixman_region_selfcheck;
pixman_region_reset = Lib_pixman.pixman_region_reset;
pixman_region_clear = Lib_pixman.pixman_region_clear;
-- Region32
-- Miscellaneous
pixman_blt = Lib_pixman.pixman_blt;
pixman_fill = Lib_pixman.pixman_fill;
pixman_version = Lib_pixman.pixman_version;
pixman_version_string = Lib_pixman.pixman_version_string;
-- Image Constructors
pixman_image_create_solid_fill = Lib_pixman.pixman_image_create_solid_fill;
pixman_image_create_linear_gradient = Lib_pixman.pixman_image_create_linear_gradient;
pixman_image_create_radial_gradient = Lib_pixman.pixman_image_create_radial_gradient;
pixman_image_create_conical_gradient = Lib_pixman.pixman_image_create_conical_gradient;
pixman_image_create_bits = Lib_pixman.pixman_image_create_bits;
pixman_image_create_bits_no_clear = Lib_pixman.pixman_image_create_bits_no_clear;
-- Image Destructors
pixman_image_ref = Lib_pixman.pixman_image_ref;
pixman_image_unref = Lib_pixman.pixman_image_unref;
pixman_image_set_destroy_function = Lib_pixman.pixman_image_set_destroy_function;
pixman_image_get_destroy_data = Lib_pixman.pixman_image_get_destroy_data;
-- Image Properties
pixman_image_set_clip_region = Lib_pixman.pixman_image_set_clip_region;
pixman_image_set_clip_region32 = Lib_pixman.pixman_image_set_clip_region32;
pixman_image_set_has_client_clip = Lib_pixman.pixman_image_set_has_client_clip;
pixman_image_set_transform = Lib_pixman.pixman_image_set_transform;
pixman_image_set_repeat = Lib_pixman.pixman_image_set_repeat;
pixman_image_set_filter = Lib_pixman.pixman_image_set_filter;
pixman_image_set_source_clipping = Lib_pixman.pixman_image_set_source_clipping;
pixman_image_set_alpha_map = Lib_pixman.pixman_image_set_alpha_map;
pixman_image_set_component_alpha = Lib_pixman.pixman_image_set_component_alpha;
pixman_image_get_component_alpha = Lib_pixman.pixman_image_get_component_alpha;
pixman_image_set_accessors = Lib_pixman.pixman_image_set_accessors;
pixman_image_set_indexed = Lib_pixman.pixman_image_set_indexed;
pixman_image_get_data = Lib_pixman.pixman_image_get_data;
pixman_image_get_width = Lib_pixman.pixman_image_get_width;
pixman_image_get_height = Lib_pixman.pixman_image_get_height;
pixman_image_get_stride = Lib_pixman.pixman_image_get_stride;
pixman_image_get_depth = Lib_pixman.pixman_image_get_depth;
pixman_image_get_format = Lib_pixman.pixman_image_get_format;
-- Compositing
pixman_compute_composite_region = Lib_pixman.pixman_compute_composite_region;
pixman_image_composite = Lib_pixman.pixman_image_composite;
pixman_image_composite32 = Lib_pixman.pixman_image_composite32;
-- Glyphs
-- Trapezoid Library Functions
pixman_sample_ceil_y = Lib_pixman.pixman_sample_ceil_y;
pixman_sample_floor_y = Lib_pixman.pixman_sample_floor_y;
pixman_edge_step = Lib_pixman.pixman_edge_step;
pixman_edge_init = Lib_pixman.pixman_edge_init;
pixman_line_fixed_edge_init = Lib_pixman.pixman_line_fixed_edge_init;
pixman_rasterize_edges = Lib_pixman.pixman_rasterize_edges;
pixman_add_traps = Lib_pixman.pixman_add_traps;
pixman_add_trapezoids = Lib_pixman.pixman_add_trapezoids;
pixman_rasterize_trapezoid = Lib_pixman.pixman_rasterize_trapezoid;
pixman_composite_trapezoids = Lib_pixman.pixman_composite_trapezoids;
pixman_composite_triangles = Lib_pixman.pixman_composite_triangles;
pixman_add_triangles = Lib_pixman.pixman_add_triangles;
}
function Functions.pixman_fixed_to_int(f) return ffi.cast("int", rshift((f), 16)) end;
function Functions.pixman_int_to_fixed(i) return ffi.cast("pixman_fixed_t", lshift(i, 16)) end;
function Functions.pixman_fixed_to_double(f) return ffi.cast("double", (f / ffi.cast("double", Constants.pixman_fixed_1))) end;
function Functions.pixman_double_to_fixed(d) return ffi.cast("pixman_fixed_t", d * 65536.0) end;
function Functions.pixman_fixed_frac(f) return band(f, Constants.pixman_fixed_1_minus_e) end;
function Functions.pixman_fixed_floor(f) return band(f, bnot(Constants.pixman_fixed_1_minus_e)) end;
function Functions.pixman_fixed_ceil(f) return Functions.pixman_fixed_floor (f + Constants.pixman_fixed_1_minus_e) end;
function Functions.pixman_fixed_fraction(f) return band(f, Constants.pixman_fixed_1_minus_e) end;
function Functions.pixman_fixed_mod_2(f) return band(f, bor(Constants.pixman_fixed1, Constants.pixman_fixed_1_minus_e)) end
Constants.pixman_fixed_e = ffi.cast("pixman_fixed_t", 1);
Constants.pixman_fixed_1 = Functions.pixman_int_to_fixed(1);
Constants.pixman_fixed_1_minus_e = Constants.pixman_fixed_1 - Constants.pixman_fixed_e;
Constants.pixman_fixed_minus_1 = Functions.pixman_int_to_fixed(-1);
Constants.pixman_max_fixed_48_16 = tonumber(ffi.cast("pixman_fixed_48_16_t", 0x7fffffff));
Constants.pixman_min_fixed_48_16 = tonumber(-ffi.cast("pixman_fixed_48_16_t", lshift(1, 31)));
--/* whether 't' is a well defined not obviously empty trapezoid */
function Functions.pixman_trapezoid_valid(t)
return (t.left.p1.y ~= t.left.p2.y and
t.right.p1.y ~= t.right.p2.y and
(t.bottom > t.top))
end
local exports = {
Lib_pixman = Lib_pixman;
Constants = Constants;
Enums = Enums;
Functions = Functions;
Types = Types;
}
setmetatable(exports, {
__call = function(self, tbl)
tbl = tbl or _G;
for k,v in pairs(self.Constants) do
tbl[k] = v;
end
for k,v in pairs(self.Enums) do
for key, value in pairs(v) do
tbl[key] = value;
end
end
for k,v in pairs(self.Functions) do
tbl[k] = v;
end
for k,v in pairs(self.Types) do
tbl[k] = v;
end
return self;
end,
})
return exports
| 41.735941 | 127 | 0.768658 |
a1d30368b80276e9c27acef0f5b11425ce15d819 | 1,244 | h | C | B2G/gecko/netwerk/base/src/nsAuthInformationHolder.h | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | 3 | 2015-08-31T15:24:31.000Z | 2020-04-24T20:31:29.000Z | B2G/gecko/netwerk/base/src/nsAuthInformationHolder.h | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | null | null | null | B2G/gecko/netwerk/base/src/nsAuthInformationHolder.h | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | 3 | 2015-07-29T07:17:15.000Z | 2020-11-04T06:55:37.000Z | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef NSAUTHINFORMATIONHOLDER_H_
#define NSAUTHINFORMATIONHOLDER_H_
#include "nsIAuthInformation.h"
#include "nsString.h"
class nsAuthInformationHolder : public nsIAuthInformation {
public:
// aAuthType must be ASCII
nsAuthInformationHolder(uint32_t aFlags, const nsString& aRealm,
const nsCString& aAuthType)
: mFlags(aFlags), mRealm(aRealm), mAuthType(aAuthType) {}
virtual ~nsAuthInformationHolder() {}
NS_DECL_ISUPPORTS
NS_DECL_NSIAUTHINFORMATION
const nsString& User() const { return mUser; }
const nsString& Password() const { return mPassword; }
const nsString& Domain() const { return mDomain; }
/**
* This method can be used to initialize the username when the
* ONLY_PASSWORD flag is set.
*/
void SetUserInternal(const nsString& aUsername) {
mUser = aUsername;
}
private:
nsString mUser;
nsString mPassword;
nsString mDomain;
uint32_t mFlags;
nsString mRealm;
nsCString mAuthType;
};
#endif
| 26.468085 | 70 | 0.69373 |
b92e0c128649040832b2b31464e0b60b21145d0d | 234 | h | C | json/jsonobj_delete.h | mattsta/krmt | 7ccdfb0976d2f119e0984236a580096c30f2b9bc | [
"BSD-2-Clause"
] | 95 | 2015-01-05T03:50:33.000Z | 2021-12-14T02:29:55.000Z | json/jsonobj_delete.h | mattsta/krmt | 7ccdfb0976d2f119e0984236a580096c30f2b9bc | [
"BSD-2-Clause"
] | 8 | 2015-01-11T12:24:58.000Z | 2015-09-06T17:47:05.000Z | json/jsonobj_delete.h | mattsta/krmt | 7ccdfb0976d2f119e0984236a580096c30f2b9bc | [
"BSD-2-Clause"
] | 21 | 2015-01-20T08:22:48.000Z | 2021-03-10T13:53:31.000Z | #ifndef __JSONOBJ_DELETE_H__
#define __JSONOBJ_DELETE_H__
#include "json.h"
#include "jsonobj.h"
#include "jsonobj_box.h"
int hgetallAndRecursivelyDeleteEverything(sds key);
int findAndRecursivelyDelete(sds key, sds field);
#endif
| 19.5 | 51 | 0.811966 |
cb78d6f81b2be07139d8e94793725db0a64dd5e1 | 10,428 | html | HTML | index.html | abdulkadir90/Cvwebsite | 606f0546263f4ce28af700c7a8049b8fc553ed3d | [
"MIT"
] | null | null | null | index.html | abdulkadir90/Cvwebsite | 606f0546263f4ce28af700c7a8049b8fc553ed3d | [
"MIT"
] | 1 | 2021-05-11T21:32:25.000Z | 2021-05-11T21:32:25.000Z | index.html | abdulkadir90/Cvwebsite | 606f0546263f4ce28af700c7a8049b8fc553ed3d | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Abdulkadir Semiz</title>
<!-- Bootstrap core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom fonts for this template -->
<link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Varela+Round" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/grayscale.min.css" rel="stylesheet">
</head>
<body id="page-top">
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-light fixed-top" id="mainNav">
<div class="container">
<a class="navbar-brand js-scroll-trigger" href="#page-top">Sayfa başına dön butonu</a>
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
Menu
<i class="fas fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link js-scroll-trigger" href="#about">Kimim Ben?</a>
</li>
<li class="nav-item">
<a class="nav-link js-scroll-trigger" href="#projects">CV</a>
</li>
<li class="nav-item">
<a class="nav-link js-scroll-trigger" href="#contact">İletişim</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- Header -->
<header class="masthead">
<div class="container d-flex h-100 align-items-center">
<div class="mx-auto text-center">
<h1 class="mx-auto my-0 text-uppercase">Abdulkadir Semiz</h1>
<h2 class="text-white-50 mx-auto mt-2 mb-5">GREYHAWK</h2>
<a href="#about" class="btn btn-primary js-scroll-trigger">Hadi Başlayalım</a>
</div>
</div>
</header>
<!-- About Section -->
<section id="about" class="about-section text-center">
<div class="container">
<h2 class="text-white mb-4">Kimim ben?</h2>
<div class="row">
<div class="col-lg-8 mx-auto">
<p class="text-white-50">
Hoşgeldiniz! İstanbul Üniversitesi-Cerrahpaşa Bilgisayar Mühendisliği 3. Sınıf öğrencisiyim. Burayı Web Programlama dersim için oluşturmuş olsam da kişisel zevkim için de kullanmayı düşünüyorum.
</div>
<div class="col-lg-8 mx-auto">
<p class="text-white-50">
Temelde verilen ödevlerin uygulaması eklenecek olup ilginç gördüğüm içerikleri de ekleyebilirim.
</p>
</p>
</div>
</div>
<!-- <img src="img/ipad.png" class="img-fluid" alt=""> -->
</div>
</section>
<!-- Projects Section -->
<section id="projects" class="projects-section bg-light">
<div class="container">
<!-- Featured Project Row -->
<div class="row align-items-center no-gutters mb-4 mb-lg-5">
<div class="col-xl-8 col-lg-7">
<img class="img-fluid mb-3 mb-lg-0" src="img/bg-masthead.jpg" alt="">
</div>
<div class="col-xl-4 col-lg-5">
<div class="featured-text text-center text-lg-left">
<h4>Eğitim</h4>
<p class="text-black-50 mb-0">Ünye Mehmet Refik Gürel Anadolu Öğretmen Lisesi 2016 mezunu</p>
<p></p>
<p class="text-black-50 mb-0">İstanbul Üniversitesi-Cerrahpaşa Bilgisayar Mühendisliği 3. Sınıf Öğrencisi</p>
</div>
</div>
</div>
<!-- Project One Row -->
<div class="row justify-content-center no-gutters mb-5 mb-lg-0">
<div class="col-lg-6">
<img class="img-fluid" src="img/demo-image-01.jpg" alt="">
</div>
<div class="col-lg-6">
<div class="bg-black text-center h-100 project">
<div class="d-flex h-100">
<div class="project-text w-100 my-auto text-center text-lg-left">
<h4 class="text-white">Bildiğim Teknolojiler</h4>
<p class="mb-0 text-white-50">C</p>
<p class="mb-0 text-white-50">C++</p>
<p class="mb-0 text-white-50">Java</p>
<p class="mb-0 text-white-50">CSS</p>
<p class="mb-0 text-white-50">HTML</p>
<p class="mb-0 text-white-50">SQL</p>
<p class="mb-0 text-white-50">PHP</p>
<p class="mb-0 text-white-50">HTML5</p>
<p class="mb-0 text-white-50">JSP</p>
<hr class="d-none d-lg-block mb-0 ml-0">
</div>
</div>
</div>
</div>
</div>
<!-- Project Two Row -->
<div class="row justify-content-center no-gutters">
<div class="col-lg-6">
<img class="img-fluid" src="img/demo-image-02.jpg" alt="">
</div>
<div class="col-lg-6 order-lg-first">
<div class="bg-black text-center h-100 project">
<div class="d-flex h-100">
<div class="project-text w-100 my-auto text-center text-lg-right">
<h4 class="text-white">Yabancı Dil</h4>
<p class="mb-0 text-white-50">İngilizce (1 Sene İngilizce Hazırlık/B1/Intermediate)</p>
<hr class="d-none d-lg-block mb-0 mr-0">
</div>
</div>
</div>
</div>
</div>
<!-- Project One Row -->
<div class="row justify-content-center no-gutters mb-5 mb-lg-0">
<div class="col-lg-6">
<img class="img-fluid" src="img/paperwork.jpg" alt="">
</div>
<div class="col-lg-6">
<div class="bg-black text-center h-100 project">
<div class="d-flex h-100">
<div class="project-text w-100 my-auto text-center text-lg-left">
<h4 class="text-white">Sertifikalar ve Katılım Belgelerim</h4>
<p class="mb-0 text-white-50">WordPress İle Web Sitesi Kurma Eğitimi</p>
<p></p>
<p class="mb-0 text-white-50">Algı Yönetimi</p>
<p></p>
<p class="mb-0 text-white-50">Kariyer Zirvesi’19</p>
<p></p>
<p class="mb-0 text-white-50">WordPress İle Web Sitesi Kurma Eğitimi</p>
<p></p>
<p class="mb-0 text-white-50">Young Executive Academy İnsan Kaynakları Akademi Programı Katılım ve Başarı Sertifikası</p>
<p></p>
<p class="mb-0 text-white-50">Young Executive Academy Industry 4.0 Akademi Programı Katılım ve Başarı Sertifikası</p>
<hr class="d-none d-lg-block mb-0 ml-0">
</div>
</div>
</div>
</div>
</div>
<!-- Project Two Row -->
<div class="row justify-content-center no-gutters">
<div class="col-lg-6">
<img class="img-fluid" src="img/dice.jpg" alt="">
</div>
<div class="col-lg-6 order-lg-first">
<div class="bg-black text-center h-100 project">
<div class="d-flex h-100">
<div class="project-text w-100 my-auto text-center text-lg-right">
<h4 class="text-white">Hobiler</h4>
<p class="mb-0 text-white-50">Kitap okumak, Film izlemek, E-Spor, Yüzme, Bisiklet Sürmek, Müzik Dinlemek, FRP oyunları</p>
<hr class="d-none d-lg-block mb-0 mr-0">
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Contact Section -->
<section id="contact"class="contact-section bg-black">
<div class="container">
<div class="row">
<div class="col-md-4 mb-3 mb-md-0">
<div class="card py-4 h-100">
<div class="card-body text-center">
<i class="fas fa-envelope text-primary mb-2"></i>
<h4 class="text-uppercase m-0">Email</h4>
<hr class="my-4">
<div class="small text-black-50">
<a href="#">abdulkadirsemiz@outlook.com</a>
</div>
</div>
</div>
</div>
</div>
<div class="social d-flex justify-content-center">
<a class="mx-2" href="https://www.linkedin.com/in/abdulkadir-semiz-828779150/">
<i class="fab fa-fw fa-linkedin-in"></i>
</a>
<a class="mx-2" href="https://github.com/abdulkadir90">
<i class="fab fa-fw fa-github"></i>
</a>
</div>
</div>
</section>
<!-- Footer -->
<footer class="bg-black small text-center text-white-50">
<div class="container">
Copyright © Abdulkadir Semiz 2020
</div>
</footer>
<!-- Bootstrap core JavaScript -->
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Plugin JavaScript -->
<script src="vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for this template -->
<script src="js/grayscale.min.js"></script>
</body>
</html>
| 42.390244 | 216 | 0.500384 |
f06af1e43cd602a4110eaefbe57a7689462ff166 | 2,908 | js | JavaScript | public/front_end/source_frame/FontView.js | xueduany/chii | d5f0fcb896c1048bfd4a6cb5a8e116d67b1381e2 | [
"MIT"
] | 1 | 2021-03-04T09:24:45.000Z | 2021-03-04T09:24:45.000Z | public/front_end/source_frame/FontView.js | xueduany/chii | d5f0fcb896c1048bfd4a6cb5a8e116d67b1381e2 | [
"MIT"
] | null | null | null | public/front_end/source_frame/FontView.js | xueduany/chii | d5f0fcb896c1048bfd4a6cb5a8e116d67b1381e2 | [
"MIT"
] | 2 | 2021-03-04T09:25:23.000Z | 2021-03-07T03:48:28.000Z | import*as Common from"../common/common.js";import*as Platform from"../platform/platform.js";import*as TextUtils from"../text_utils/text_utils.js";import*as UI from"../ui/ui.js";export class FontView extends UI.View.SimpleView{constructor(e,t){super(Common.UIString.UIString("Font")),this.registerRequiredCSS("source_frame/fontView.css"),this.element.classList.add("font-view"),this._url=t.contentURL(),UI.ARIAUtils.setAccessibleName(this.element,ls`Preview of font from ${this._url}`),this._mimeType=e,this._contentProvider=t,this._mimeTypeLabel=new UI.Toolbar.ToolbarText(e)}async toolbarItems(){return[this._mimeTypeLabel]}_onFontContentLoaded(e,t){const{content:i}=t,n=i?TextUtils.ContentProvider.contentAsDataURL(i,this._mimeType,!0):this._url;this.fontStyleElement.textContent=Platform.StringUtilities.sprintf('@font-face { font-family: "%s"; src: url(%s); }',e,n)}_createContentIfNeeded(){if(this.fontPreviewElement)return;const e="WebInspectorFontPreview"+ ++_fontId;this.fontStyleElement=createElement("style"),this._contentProvider.requestContent().then(t=>{this._onFontContentLoaded(e,t)}),this.element.appendChild(this.fontStyleElement);const t=createElement("div");for(let e=0;e<_fontPreviewLines.length;++e)e>0&&t.createChild("br"),t.createTextChild(_fontPreviewLines[e]);this.fontPreviewElement=t.cloneNode(!0),UI.ARIAUtils.markAsHidden(this.fontPreviewElement),this.fontPreviewElement.style.overflow="hidden",this.fontPreviewElement.style.setProperty("font-family",e),this.fontPreviewElement.style.setProperty("visibility","hidden"),this._dummyElement=t,this._dummyElement.style.visibility="hidden",this._dummyElement.style.zIndex="-1",this._dummyElement.style.display="inline",this._dummyElement.style.position="absolute",this._dummyElement.style.setProperty("font-family",e),this._dummyElement.style.setProperty("font-size",_measureFontSize+"px"),this.element.appendChild(this.fontPreviewElement)}wasShown(){this._createContentIfNeeded(),this.updateFontPreviewSize()}onResize(){if(!this._inResize){this._inResize=!0;try{this.updateFontPreviewSize()}finally{delete this._inResize}}}_measureElement(){this.element.appendChild(this._dummyElement);const e={width:this._dummyElement.offsetWidth,height:this._dummyElement.offsetHeight};return this.element.removeChild(this._dummyElement),e}updateFontPreviewSize(){if(!this.fontPreviewElement||!this.isShowing())return;this.fontPreviewElement.style.removeProperty("visibility");const e=this._measureElement(),t=e.height,i=e.width,n=this.element.offsetWidth-50,s=this.element.offsetHeight-30;if(!(t&&i&&n&&s))return void this.fontPreviewElement.style.removeProperty("font-size");const o=n/i,m=s/t,r=Math.floor(_measureFontSize*Math.min(o,m))-2;this.fontPreviewElement.style.setProperty("font-size",r+"px",null)}}let _fontId=0;const _fontPreviewLines=["ABCDEFGHIJKLM","NOPQRSTUVWXYZ","abcdefghijklm","nopqrstuvwxyz","1234567890"],_measureFontSize=50; | 2,908 | 2,908 | 0.812242 |
8567c7b1cd5db1de6e0fc22fb20d0507954be068 | 615 | js | JavaScript | js/compilers/f2m.js | richardo2016/tsf | 08d3c877862c2ce301c39724e7acbacc3c5cca5c | [
"MIT"
] | null | null | null | js/compilers/f2m.js | richardo2016/tsf | 08d3c877862c2ce301c39724e7acbacc3c5cca5c | [
"MIT"
] | null | null | null | js/compilers/f2m.js | richardo2016/tsf | 08d3c877862c2ce301c39724e7acbacc3c5cca5c | [
"MIT"
] | null | null | null | const fs = require('fs')
const { transpileTypescript } = require('./memory');
const UTILs = require('../_utils')
const TSFError = require('../error')
exports.compileFile = function (filepath = '', compilerOptions, options) {
UTILs.checkFilepathStat(filepath)
let tsRaw = fs.readTextFile(filepath)
if (!tsRaw)
throw new TSFError(`${UTILs.getLogPrefix('api', 'compileFile')}filecontent is empty in ${filepath}`, TSFError.LITERALS.FILE_CONTENT_EMPTY)
return transpileTypescript(tsRaw, compilerOptions, {
...options,
fileName: filepath,
moduleName: filepath
})
} | 30.75 | 146 | 0.681301 |
dfadbf683dec3d3ddfab4abb93f1ed2d46a82ab1 | 132 | ts | TypeScript | packages/yarnpkg-fslib/sources/constants.ts | unitario/berry | 38fd3188dd5ca17b01fbc734c9879a3342b3c5d1 | [
"BSD-2-Clause"
] | 2 | 2021-07-23T20:24:42.000Z | 2021-11-07T18:58:45.000Z | packages/yarnpkg-fslib/sources/constants.ts | boost3vil/berry | 5cc3c8ae23a071387380c65ae3efc6a33902be22 | [
"BSD-2-Clause"
] | 9 | 2022-01-17T05:23:02.000Z | 2022-03-30T01:09:38.000Z | packages/yarnpkg-fslib/sources/constants.ts | boost3vil/berry | 5cc3c8ae23a071387380c65ae3efc6a33902be22 | [
"BSD-2-Clause"
] | 2 | 2021-07-22T02:03:06.000Z | 2021-07-26T09:53:30.000Z | export const S_IFMT = 0o170000;
export const S_IFDIR = 0o040000;
export const S_IFREG = 0o100000;
export const S_IFLNK = 0o120000;
| 22 | 32 | 0.780303 |
dda03de725c7b0baff5c8d021da5e34b92d36986 | 2,553 | php | PHP | app/lang/ru/client.php | OSDDQD/laravel-image-catalog | cd10763bebb9d219d650460a1bb633a3d7d73271 | [
"MIT"
] | 1 | 2015-04-08T12:03:52.000Z | 2015-04-08T12:03:52.000Z | app/lang/ru/client.php | OSDDQD/laravel-image-catalog | cd10763bebb9d219d650460a1bb633a3d7d73271 | [
"MIT"
] | null | null | null | app/lang/ru/client.php | OSDDQD/laravel-image-catalog | cd10763bebb9d219d650460a1bb633a3d7d73271 | [
"MIT"
] | null | null | null | <?php
return array(
/*
|--------------------------------------------------------------------------
| Messages Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the translator.
|
*/
'cabinet' => [
'opening_header' => 'Вход в личный кабинет',
'opening_text' => 'Доступ в личный кабинет доступен для абонентов заключивших договор в офисе Компании.',
],
'currencies' => [
'line1' => 'курс валют',
'line2' => 'в Узбекистане на :date',
'sum' => 'сум',
],
'developed_and_supported' => 'Сайт разработан и поддерживается компанией :companyname',
'feedback_message_sent' => 'Ваше сообщение отправлено. Спасибо!',
'footer' => [
'address' => 'Наш адрес в Ташкенте',
'all_rights_reserved' => 'Все права защищены © :year',
'license' => 'Лицензия № АА0003306 от 25.07.2010 г.',
'phones' => 'Телефон',
'schedule' => 'График работы',
'service_providers' => 'Услуги предоставляются компаниями SOHO Networks и NetCity',
],
'forget_password' => 'Забыть пароль',
'guestbook_message_added' => 'Ваше сообщение добавлено. Спасибо!',
'how_could_you' => 'Как вы могли',
'link_manager' => 'Админцентр',
'mail_send_error' => 'Ошибка при отправке сообщения!',
'go_to_archive' => 'Перейти к архиву',
'menu' => [
'cabinet' => 'Личный кабинет',
'reference_materials' => 'Справочные материалы',
],
'next_concert_countdown' => 'До следущего концерта осталось',
'password_reset' => 'Для восстановления забытого пароля введите e-mail указанный при регистрации',
'password_reset_complete' => 'Для завершения процедуры восстановления забытого пароля заполните форму ниже.',
'rss' => [
'title' => 'Лента новостей',
'description' => 'Последние новости :sitename',
],
'search' => [
'results_header' => 'Результаты поиска',
'results_empty' => 'Ничего не найдено',
'search_in_result' => 'Искать',
'search_in_submit' => 'Ок',
'scopes' => [
'actions' => 'Акции',
'announcements' => 'Оповещения',
'news' => 'Новости',
'pages' => 'Страницы',
],
],
'sign_in' => 'Вход',
'sign_out' => 'Выход',
'top_hello' => 'Привет, :displayname!',
'user_profile' => 'Профиль',
'sell_by_phone' => 'Заказать по телефону',
'phone_num' => '+998916668877'
);
| 35.458333 | 114 | 0.552291 |
21b35dfbe63a14e6da2d0695cb42bfc7ebefc51a | 2,463 | lua | Lua | lua/null-ls/builtins/diagnostics/buildifier.lua | t3rro/null-ls.nvim | 15d3aabc2b440293ecf6c85f25ca9fa645a468ae | [
"Apache-2.0"
] | null | null | null | lua/null-ls/builtins/diagnostics/buildifier.lua | t3rro/null-ls.nvim | 15d3aabc2b440293ecf6c85f25ca9fa645a468ae | [
"Apache-2.0"
] | null | null | null | lua/null-ls/builtins/diagnostics/buildifier.lua | t3rro/null-ls.nvim | 15d3aabc2b440293ecf6c85f25ca9fa645a468ae | [
"Apache-2.0"
] | null | null | null | local h = require("null-ls.helpers")
local methods = require("null-ls.methods")
local DIAGNOSTICS = methods.internal.DIAGNOSTICS
local function find_file_output(output, filename)
if not output.files then
return nil
end
for _, file in ipairs(output.files) do
if file.filename == filename then
return file
end
end
return nil
end
local function parse_warnings(file_output)
if not file_output.warnings then
return {}
end
local diagnostics = {}
for _, warning in ipairs(file_output.warnings) do
if warning["start"] and warning["end"] then
table.insert(diagnostics, {
row = warning["start"]["line"],
end_row = warning["end"]["line"],
col = warning["start"]["column"],
end_col = warning["end"]["column"],
source = "buildifier",
message = warning.message .. " (" .. warning.url .. ")",
severity = h.diagnostics.severities["warning"],
})
end
end
return diagnostics
end
local function parse_error(line)
local pattern = [[.-:(%d+):(%d+): (.*)]]
local results = { line:match(pattern) }
local row = tonumber(results[1])
local col = tonumber(results[2])
-- Remove trailing newline in the error message.
local message = vim.trim(results[3])
return {
{
row = row,
col = col,
source = "buildifier",
message = message,
severity = h.diagnostics.severities["error"],
},
}
end
return h.make_builtin({
name = "buildifier",
method = DIAGNOSTICS,
filetypes = { "bzl" },
generator_opts = {
command = "buildifier",
name = "buildifier",
args = {
"-mode=check",
"-lint=warn",
"-format=json",
"-path=$FILENAME",
},
format = "json_raw",
to_stdin = true,
on_output = function(params)
if params.err then
return parse_error(params.err)
end
if not params.output then
return {}
end
local file_output = find_file_output(params.output, params.bufname)
if not file_output then
return {}
end
return parse_warnings(file_output)
end,
},
factory = h.generator_factory,
})
| 27.988636 | 79 | 0.53715 |
266000da775fe39e0c52638204ee43b5dd16600c | 1,185 | java | Java | app/src/main/java/me/elmira/stayfocused/today/TodayContract.java | Orina/StayFocused | 3e24ec025234f46eb80b9a7a74a0a9da997f4941 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/me/elmira/stayfocused/today/TodayContract.java | Orina/StayFocused | 3e24ec025234f46eb80b9a7a74a0a9da997f4941 | [
"Apache-2.0"
] | 1 | 2017-02-17T06:42:33.000Z | 2017-02-23T08:02:18.000Z | app/src/main/java/me/elmira/stayfocused/today/TodayContract.java | Orina/StayFocused | 3e24ec025234f46eb80b9a7a74a0a9da997f4941 | [
"Apache-2.0"
] | null | null | null | package me.elmira.stayfocused.today;
import android.content.Intent;
import android.support.annotation.NonNull;
import java.util.List;
import me.elmira.stayfocused.BasePresenter;
import me.elmira.stayfocused.BaseView;
import me.elmira.stayfocused.adapter.TaskAdapter;
import me.elmira.stayfocused.data.Task;
/**
* Created by elmira on 1/31/17.
*/
public interface TodayContract {
interface View extends BaseView<Presenter> {
void setLoadingIndicator(boolean active);
boolean isActive();
void showTasks(List<Task> tasks);
void showNoTasks();
void showAddTaskUI();
void showTaskDetailsUI(@NonNull String taskId, @NonNull android.view.View view);
void onTaskCreated(@NonNull Task task);
void onTaskUpdated(@NonNull Task task);
void onTaskDeleted(@NonNull String taskId);
void onTaskCompleted(@NonNull String taskId);
}
interface Presenter extends BasePresenter, TaskAdapter.OnTaskClickListener, TaskAdapter.OnTaskTouchListener {
void loadTasks(boolean forceUpdate);
void result(int requestCode, int resultCode, Intent data);
void addNewTask();
}
}
| 23.7 | 113 | 0.716456 |
327c172790164d2ebf6d41301bd71318fb508e97 | 9,388 | kt | Kotlin | src/main/kotlin/org/semou/security_unit_frame_analyse/main.kt | JarvisSemou/SecurityUnitFrameAnalyse | b13d90d82b3d58d18f973fd5fdcb43f2159105b2 | [
"MIT"
] | 1 | 2021-12-17T03:18:38.000Z | 2021-12-17T03:18:38.000Z | src/main/kotlin/org/semou/security_unit_frame_analyse/main.kt | JarvisSemou/SecurityUnitFrameAnalyse | b13d90d82b3d58d18f973fd5fdcb43f2159105b2 | [
"MIT"
] | null | null | null | src/main/kotlin/org/semou/security_unit_frame_analyse/main.kt | JarvisSemou/SecurityUnitFrameAnalyse | b13d90d82b3d58d18f973fd5fdcb43f2159105b2 | [
"MIT"
] | null | null | null | package org.semou.security_unit_frame_analyse
import androidx.compose.desktop.Window
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.selection.SelectionContainer
import androidx.compose.ui.unit.dp
import java.util.*
fun main() = Window(
title = "SecurityUnit 2.0 FrameAnalyse ---- ShiYue Semou"
) {
MaterialTheme {
/** 输入的安全单元帧 */
var securityUnitFrame by remember { mutableStateOf("") }
/** 帧解析结果列表 */
val resultList = remember { mutableStateListOf<HashMap<ResultType, String>>() }
/** 是否显示原始帧,true 为显示,false 反之,默认为 true */
var isShowOriginFrame by remember { mutableStateOf(true) }
/** 是否显示含义详情,true 为显示,false 反之,默认为 false */
var isShowMeaningDetails by remember { mutableStateOf(false) }
var resultCode by remember {
mutableStateOf<SecurityUnitFrameDecoder.SecurityUnitFrameDecodeResultCode>(
SecurityUnitFrameDecoder.SecurityUnitFrameDecodeResultCode.DO_NOTHING
)
}
//总体布局
Column(
modifier = Modifier.fillMaxSize().padding(
start = 10.dp,
end = 10.dp
)
) {
SelectionContainer {
TextField(
value = securityUnitFrame,
modifier = Modifier.fillMaxWidth()
.padding(top = 10.dp)
.fillMaxHeight(0.15f),
label = { Text("输入安全单元帧") },
onValueChange = {
securityUnitFrame = it
if (it.isEmpty()) resultCode =
SecurityUnitFrameDecoder.SecurityUnitFrameDecodeResultCode.DO_NOTHING
})
}
Row(
modifier = Modifier.fillMaxWidth()
.padding(top = 10.dp, end = 5.dp)
.wrapContentHeight(),
horizontalArrangement = Arrangement.End
) {
Button(
modifier = Modifier.width(100.dp),
onClick = {
resultCode = SecurityUnitFrameDecoder.decode(securityUnitFrame, resultList)
}
) {
Text("解 析")
}
}
Column(
modifier = Modifier.fillMaxSize()
.padding(bottom = 10.dp)
) {
when (resultCode) {
is SecurityUnitFrameDecoder.SecurityUnitFrameDecodeResultCode.DONE -> {
// 帧显示列宽度比例
val frameDisplayWidth = 0.5f
// 意义显示列宽度比例
val meaningDisplayWidth = 0.5f
// 垂直滚动状态
val verticalScrollState = rememberScrollState(0f)
// 帧显示水平滚动状态
//val horizontalFrameScrollState = rememberScrollState(0f)
// 含义显示水平滚动状态
//val horizontalMeaningScrollState = rememberScrollState(0f)
CheckBoxPanel(
frameDisplayWidth,
meaningDisplayWidth,
isShowOriginFrame,
onFrameCheckboxChange = { isShowOriginFrame = it },
isShowMeaningDetails,
onMeaningCheckboxChange = { isShowMeaningDetails = it }
)
Column(
modifier = Modifier.fillMaxSize()
.verticalScroll(verticalScrollState)
.padding(
start = 10.dp, end = 10.dp
)
) {
// 奇数行背景色
val oddBackgroundColor = Color(177, 236, 235)
// 偶数行背景色
val evenBackgroundColor = Color(222, 255, 254)
// 鼠标悬浮高亮颜色
val highlightBackgroundColor = Color(238, 252, 217)
// 缓存颜色
val tmpColor by remember { mutableStateOf(Color(255, 255, 255)) }
//todo 鼠标悬浮高亮
var i = 1
var color: Color
for (result in resultList) {
color = when (i % 2 != 0) {
true -> oddBackgroundColor
false -> evenBackgroundColor
}
Row(
modifier = Modifier.wrapContentHeight()
.background(color)
.fillMaxWidth()
) {
val subframe: String = if (isShowOriginFrame)
result[ResultType.Origin]!!
else
result[ResultType.Analyzed]!!
val meanings = if (isShowMeaningDetails)
result[ResultType.MeaningDetails]!!
else
result[ResultType.Meaning]!!
Row(
modifier = Modifier
.fillMaxWidth(frameDisplayWidth)
.align(
Alignment.CenterVertically
)
.heightIn(
min = 25.dp
)
.padding(start = 5.dp)
) {
Text(
subframe,
modifier=Modifier.padding(start=4.dp)
)
}
Row(
modifier = Modifier
.fillMaxWidth()
.align(
Alignment.CenterVertically
)
.heightIn(
min = 25.dp
)
.padding(start = 5.dp)
) {
Text(
meanings,
modifier=Modifier.padding(end=4.dp)
)
}
}
i++
}
}
}
else -> {
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center
) {
Text(
resultCode.msg
)
}
}
}
}
}
}
}
/**
* 状态切换栏
*/
@Suppress("FunctionName")
@Composable
fun CheckBoxPanel(
frameDisplayWidth: Float,
meaningDisplayWidth: Float,
isShowOriginFrame: Boolean,
onFrameCheckboxChange: (Boolean) -> Unit,
isShowMeaningDetails: Boolean,
onMeaningCheckboxChange: (Boolean) -> Unit
) {
Row(
modifier = Modifier.fillMaxWidth()
.padding(start = 10.dp, end = 10.dp, top = 5.dp,bottom = 10.dp)
) {
Row(
modifier = Modifier.fillMaxWidth(frameDisplayWidth)
) {
Checkbox(checked = isShowOriginFrame, onCheckedChange = onFrameCheckboxChange)
Text("显示原始帧")
}
Row(
modifier = Modifier.fillMaxWidth(meaningDisplayWidth)
) {
Checkbox(checked = isShowMeaningDetails, onCheckedChange = onMeaningCheckboxChange)
Text("显示字段详情")
}
}
}
/**
* 结果列
*/
sealed class ResultType {
/**
* 原始列
*/
object Origin : ResultType()
/**
* 解析后的列
*/
object Analyzed : ResultType()
/**
* 简要解释列
*/
object Meaning : ResultType()
/**
* 详细解释
*/
object MeaningDetails : ResultType()
} | 37.40239 | 99 | 0.39689 |
d4d2369f1a84e2325153847252fd1ab86e829128 | 448 | sql | SQL | GameplayanalysisIV.sql | nikhilbhatewara/Leetcode | 9586a3027906b38ae0b0304fe65436b3a6c4c1b6 | [
"MIT"
] | null | null | null | GameplayanalysisIV.sql | nikhilbhatewara/Leetcode | 9586a3027906b38ae0b0304fe65436b3a6c4c1b6 | [
"MIT"
] | null | null | null | GameplayanalysisIV.sql | nikhilbhatewara/Leetcode | 9586a3027906b38ae0b0304fe65436b3a6c4c1b6 | [
"MIT"
] | null | null | null | /* Write your T-SQL query statement below */
/*
FOR EACH PLAYER AND FOR EACH EVENT DATE CREATE A RUNNING TOTAL/CUMULATIVE SUM
over clause determines that sum should be calculated as a running total
partition by determines that running total should be calculated for each player by player id
*/
select player_id, event_date, sum(games_played) over ( partition by player_id order by player_id,event_date ) as games_played_so_far
from activity;
| 29.866667 | 132 | 0.796875 |
4c28fcc36d4ef1ff1ba8253e01ae0b69f6ca8760 | 6,468 | php | PHP | activity/activity.php | ashutoshbw314/Organized | e0065235ceedbb5f5ef7abadb9521bcf0d3c1f38 | [
"MIT"
] | null | null | null | activity/activity.php | ashutoshbw314/Organized | e0065235ceedbb5f5ef7abadb9521bcf0d3c1f38 | [
"MIT"
] | null | null | null | activity/activity.php | ashutoshbw314/Organized | e0065235ceedbb5f5ef7abadb9521bcf0d3c1f38 | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Activity</title>
<link rel="stylesheet" type="text/css" href="../css/datumThings.css"/>
<link rel="stylesheet" type="text/css" href="../css/calendar.css"/>
<link rel="stylesheet" type="text/css" href="../css/activity.css"/>
<link rel="stylesheet" type="text/css" href="../css/note.css"/>
<link rel="stylesheet" type="text/css" href="../css/dataInfo.css"/>
<link rel="stylesheet" type="text/css" href="../css/datumInfoCon.css"/>
<link rel="stylesheet" type="text/css" href="../css/type.css"/>
<link rel="stylesheet" type="text/css" href="../css/output.css"/>
<style>
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<h1>Activity calendar</h1>
<article>
<a href="../index.php">Back to home</a> <br><br>
<div class="h">Select datum type below to show activities of a particular type</div>
<div id="typeCon"></div><br>
<div class="h">Calendar</div>
<div id="about_activity">
<div id="top">
</div>
<div id="stats">
<div id="total">
<span class="stat_title">Words learned</span>
<span id="total_output"></span>
<span id="total_range"></span>
</div>
<div id="longest_streaks">
<span class="stat_title">Longest Streaks</span>
<span id="longest_streaks_length"></span>
<div id="longest_streaks_ranges"></div>
</div>
<div id="current_streaks">
<span class="stat_title">Current Streak</span>
<span id="current_streak_length"></span>
<span id="current_streak_range"></span>
</div>
</div>
</div>
<br>
<div id="outputContainer">
<div class="h">Outputs</div>
<div id="outputContent">
</div></div>
</article>
<script src="../js/ajax.js"></script>
<script src="../js/utility.js"></script>
<script src="../js/getDatumInfo.js"></script>
<script src="../js/activity.js"></script>
<script src="../js/note.js"></script>
<script src="../js/warning.js"></script>
<script src="../js/type.js"></script>
<script src="../js/type_utility.js"></script>
<script src="../js/encode.js"></script>
<script>
let outputNo = 0;
let data = {};
/*
let ranges = [16, 32, 48];
let activity = [
["2018-07-04","1"],
["2018-07-03","20"],
["2018-07-02","20"],
["2018-07-01","20"],
["2018-06-30","20"],
["2018-06-29","20"],
["2018-05-08","20"],
["2018-05-07","30"],
["2018-05-06","20"],
["2018-05-05","15"],
["2018-04-03","50"],
["2018-04-02","40"],
["2018-04-01","10"],
["2018-02-08","25"],
["2018-02-05","25"]
,
["2018-02-02","22"],
["2018-02-01","21"],
["2018-01-15","21"],
["2017-01-15","21"]];
let topDiv = document.getElementById("top");
let calendars = drawCalendars(activity, ranges);
topDiv.appendChild(calendars);
let lsCon = document.getElementById("longest_streaks");
let lsLenElt = document.getElementById("longest_streaks_length");
let streaks = getStreaks(activity);
let totalElt = document.getElementById("total_output");
let totalRange = document.getElementById("total_range");
let csLenElt = document.getElementById("current_streak_length");
let csRangeElt = document.getElementById("current_streak_range");
displayTotalInfo(totalElt, totalRange, activity);
displayLongestStreaks(lsCon, lsLenElt, streaks);
displayCurrentStreak(csLenElt, csRangeElt, streaks);
*/
let typeCon = document.getElementById("typeCon");
repSelects(type, typeCon, [], drawActivity);
let topDiv = document.getElementById("top");
let lsRangesCon = document.getElementById("longest_streaks_ranges");
let lsLenElt = document.getElementById("longest_streaks_length");
let totalElt = document.getElementById("total_output");
let totalRange = document.getElementById("total_range");
let csLenElt = document.getElementById("current_streak_length");
let csRangeElt = document.getElementById("current_streak_range");
function checkForUnavailableTypes() {
getinfo("../php/getData/datum_types.php", "", data, "datum_types", doTheCheck);
function doTheCheck() {
data.datum_types = JSON.parse(data.datum_types);
let unavailable_types = [];
for (let i = 0; i < data.datum_types.length; i++) {
let curType = data.datum_types[i].split(" > ");
let matchedType = matchValues(type, curType);
if (matchedType.length != curType.length) {
unavailable_types.push(curType);
}
}
for (let i = 0; i < unavailable_types.length; i++) {
let curUT = unavailable_types[i];
showWarning("\"" + curUT.join(" > ") + "\" type have entries but is not present in your current datum types.");
}
}
}
checkForUnavailableTypes();
function drawActivity() {
getinfo("../php/getData/getActivityData.php", encodeTypeInfo(typeCon), data, "activity", drawActivityInternal);
function drawActivityInternal() {
let ranges = getRanges(typeCon, type);
data.activity = JSON.parse(data.activity);
let preCalendars = document.getElementById("calendars");
if (preCalendars) {
topDiv.removeChild(preCalendars);
}
let calendars = drawCalendars(data.activity, ranges, getCurrentType(typeCon));
topDiv.appendChild(calendars);
let streaks = getStreaks(data.activity);
displayTotalInfo (totalElt, totalRange, data.activity, getCurrentType(typeCon));
displayLongestStreaks (lsRangesCon, lsLenElt, streaks, getCurrentType(typeCon));
displayCurrentStreak (csLenElt, csRangeElt, streaks, getCurrentType(typeCon));
getinfo("../php/getData/getDatesOfNotes.php", "", data, "noteDates", tickNoteDays);
}
}
drawActivity();
function tickNoteDays() {
data.noteDates = JSON.parse(data.noteDates);
for (let i = 0; i < data.noteDates.length; i++) {
let day = document.getElementById(data.noteDates[i]);
if (day) {
day.style.backgroundImage = "url(../pics/note.png)";
}
}
let days = document.querySelectorAll(".day");
for (let i = 0; i < days.length; i++) {
days[i].addEventListener("click", function() {
getinfo("../php/getData/getNoteOfDay.php", "date=" + days[i].id, data, "note", launchDayWindow.bind(null, days[i]));
//let nw = createDayWindow("Hello world", days[i].id, "save.php", "discard.php");
//document.body.appendChild(nw);
});
}
}
function launchDayWindow(day) {
if (day.style.backgroundImage != "") {
let nw = createDayWindow(data.note, day, "../php/saveNote.php", "../php/discardNote.php",
"../php/getData/getDatumAndIDsOfDay.php", typeCon);
document.body.appendChild(nw);
} else {
let nw = createDayWindow(null, day, "../php/saveNote.php", "../php/discardNote.php",
"../php/getData/getDatumAndIDsOfDay.php", typeCon);
document.body.appendChild(nw);
}
}
</script>
</body>
</html>
| 29.534247 | 120 | 0.68522 |
ca43b39aeabca06fc0f17f6252bbe9c4f007028f | 140 | sql | SQL | verify/ciip/table/application.sql | bcgov/cas-ggircs-ciip-2018 | 8db19efadc96061e36b4c5bdc5da264865ce30fa | [
"Apache-2.0"
] | null | null | null | verify/ciip/table/application.sql | bcgov/cas-ggircs-ciip-2018 | 8db19efadc96061e36b4c5bdc5da264865ce30fa | [
"Apache-2.0"
] | 32 | 2019-08-28T16:49:06.000Z | 2021-01-27T11:13:32.000Z | verify/ciip/table/application.sql | bcgov/cas-ggircs-ciip-2018 | 8db19efadc96061e36b4c5bdc5da264865ce30fa | [
"Apache-2.0"
] | null | null | null | -- Verify ggircs:ciip_table_application on pg
begin;
select pg_catalog.has_table_privilege('ciip_2018.application', 'select');
rollback;
| 17.5 | 73 | 0.8 |
81e4f6cb0b01338659e44952825c0399a10a80eb | 811 | swift | Swift | UISeguesExample/UISeguesExample/SecondViewController.swift | ivlevAstef/UISegues | dbc2905d414686728e88dd517691515e1ef39fbb | [
"MIT"
] | 3 | 2018-09-22T05:27:36.000Z | 2018-09-23T06:30:03.000Z | UISeguesExample/UISeguesExample/SecondViewController.swift | ivlevAstef/UISegues | dbc2905d414686728e88dd517691515e1ef39fbb | [
"MIT"
] | null | null | null | UISeguesExample/UISeguesExample/SecondViewController.swift | ivlevAstef/UISegues | dbc2905d414686728e88dd517691515e1ef39fbb | [
"MIT"
] | null | null | null | //
// SecondViewController.swift
// UISeguesExample
//
// Created by Ивлев Александр Евгеньевич on 24/08/2018.
//
import UIKit
class SecondViewController: UIViewController {
private let coloredView: UIView = UIView(frame: CGRect(x: 50, y: 150, width: 50, height: 50))
override func loadView() {
self.view = UIView(frame: UIScreen.main.bounds)
self.view.backgroundColor = .white
}
override func viewDidLoad() {
super.viewDidLoad()
coloredView.layer.cornerRadius = 25.0
view.addSubview(coloredView)
let label = UILabel(frame: CGRect(x: 50, y: 215, width: 200, height: 25))
label.text = "Это ваш цвет?"
view.addSubview(label)
}
func setColor(_ color: UIColor) {
coloredView.backgroundColor = color
}
}
| 23.171429 | 97 | 0.646116 |
91588827a32999d60aa82d3490130736901d3e22 | 22,830 | html | HTML | public/app/tpls/iot/dashboard-room.html | wangmws/iotspacedashboard_wangmws | 0a9b6ff45c57fe92340809b07b39108826808068 | [
"Apache-2.0"
] | null | null | null | public/app/tpls/iot/dashboard-room.html | wangmws/iotspacedashboard_wangmws | 0a9b6ff45c57fe92340809b07b39108826808068 | [
"Apache-2.0"
] | null | null | null | public/app/tpls/iot/dashboard-room.html | wangmws/iotspacedashboard_wangmws | 0a9b6ff45c57fe92340809b07b39108826808068 | [
"Apache-2.0"
] | null | null | null |
<page-title ng-if="layoutOptions.pageTitles" title="Room Monitoring" description=""></page-title>
<div class="dx-warning hidden">
<div>
<h2>How to Include Charts Library in Xenon Theme</h2>
<p>The reason why you don't see charts like in the Xenon demo website is because of license restrictions from DevExpress company. <a href="http://js.devexpress.com/DevExtremeWeb/?folder=EULAs" target="_blank">Click here</a> to read license agreement.</p>
<p>Even that we have purchased the developer license we are not permitted to include the DevExtreme Web Charts JavaScript library in the default download file of Xenon theme, however you can include DevExpress Charts library manually and takes just few minutes:</p>
<ol>
<li>Download <strong>DevExtreme Web</strong> JavaScript library by clicking <a href="https://go.devexpress.com/DevExpressDownload_DevExtremeWebTrial.aspx" class="text-bold">here</a>. If the link doesn't work, then <a href="http://js.devexpress.com/Buy/" target="_parent"><strong>click this one</strong></a> and choose DevExtreme Web package to download.</li>
<li>Extract the downloaded archive. There you will find <strong>Lib/</strong> folder. <strong>Copy</strong> the folders inside.</li>
<li><strong>Paste</strong> copied files to <strong>assets/js/devexpress-web-14.1/</strong></li>
<li>You are all set! Charts will look the same just like in the demo website.</li>
</ol>
</div>
</div>
<script src="/scripts/canvas-gauges/gauge.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($)
{
if( ! $.isFunction($.fn.dxChart))
$(".dx-warning").removeClass('hidden');
});
</script>
<script type="text/javascript">
var types = ["spline", "stackedSpline", "fullStackedSpline"];
jQuery(document).ready(function($)
{
if( ! $.isFunction($.fn.dxChart))
return;
/*
var dataSource = [
{ year: 2040, europe: 680, americas: 1178, africa: 1665 },
{ year: 2050, europe: 650, americas: 1231, africa: 1937 }
];
*/
$("#bar-3").dxChart({
commonSeriesSettings: {
type: types[0],
argumentField: "time"
},
series: [
{ valueField: "Temperature", name: "Temperature", color: "#40bbea" },
{ valueField: "Humidity", name: "Humidity", color: "#8dc63f" },
{ valueField: "Presence", name: "Presence", color: "#cc3f44" }
],
argumentAxis:{
grid:{
visible: true
}
},
tooltip:{
enabled: true
},
title: "Temperature, Humidity, Presence Trends",
legend: {
verticalAlignment: "bottom",
horizontalAlignment: "center"
},
commonPaneSettings: {
border:{
visible: true,
right: false
}
}
});
});
</script>
<script type="text/javascript">
var sample_notification;
var sensorObj_current;
var sensor_counter = 0;
//get current sensor reading
var sensorlight_current = 0.0;
var sensorTemperature_current = 0.0;
var sensorHumidity_current = 0.0;
var sensorMotion_current = 0;
var timestamp_current;
/* Test HTTP Get
$.get('https://cors-anywhere.herokuapp.com/http://iotwmw.mybluemix.net/test',{x1 : "10"}).done(function(data){
console.log(data);
});
*/
var socket_current = io.connect();
socket_current.on("sensorObj", function(sensorObj) {
sensorObj_current = sensorObj;
sensorlight_current = sensorObj.d.Light;
if(!isNaN(sensorObj.d.Temperature))
sensorTemperature_current = sensorObj.d.Temperature;
if(!isNaN(sensorObj.d.Humidity))
sensorHumidity_current = sensorObj.d.Humidity;
sensorMotion_current = sensorObj.d.Motion;
timestamp_current = sensorObj.ts.slice(11,18);
});
setTimeout(function()
{
var $ = jQuery;
// Notifications
window.clearTimeout(sample_notification);
var notification = setTimeout(function()
{
var opts = {
"closeButton": true,
"debug": false,
"positionClass": "toast-top-right toast-default",
"toastClass": "black",
"onclick": null,
"showDuration": "100",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
};
toastr.info("Enjoy the Dashboard.", "Welcome to Shawn Dashboard", opts);
}, 3800);
if( ! $.isFunction($.fn.dxChart))
return;
// Charts
var xenonPalette = ['#68b828','#7c38bc','#0e62c7','#fcd036','#4fcdfc','#00b19d','#ff6264','#f7aa47'];
// Realtime Network Stats
var i = 0,
rns_values = [60,80],
rns2_values = [39,50],
realtime_network_stats = [];
var socket_array = io.connect();
socket_array.on("sensorObj_array", function(sensorObj_array) {
console.log("sensorObj_array");
console.log(sensorObj_array);
if(Array.isArray(sensorObj_array)){
var chart_data = new Array();
var temp_sum = 0;
var humid_sum = 0;
for(i=0; i< sensorObj_array.length; i++)
{
//Update light chart
var tempJson = JSON.parse(JSON.stringify(sensorObj_array[i]));
var timestamp = tempJson.PAYLOAD_TS.slice(11,16);
realtime_network_stats.push({ time: timestamp, x1: parseInt(tempJson.PAYLOAD_D_LIGHT) });
if (i != 0)
sensor_counter++;
var motion = 0;
if(tempJson.PAYLOAD_D_MOTION == 1)
motion = 100;
if(!isNaN(tempJson.PAYLOAD_D_TEMPERATURE)){
chart_data.push({time: timestamp, Temperature : tempJson.PAYLOAD_D_TEMPERATURE,
Humidity : tempJson.PAYLOAD_D_HUMIDITY, Presence : motion });
}
//{ year: 1950, europe: 546, americas: 332, africa: 227 }
sensor_counter++;
temp_sum += parseFloat(tempJson.PAYLOAD_D_TEMPERATURE);
humid_sum += parseFloat(tempJson.PAYLOAD_D_HUMIDITY);
}
$("#bar-3").dxChart('instance').option('dataSource', chart_data);
$('#realtime-network-stats').dxChart('instance').option('dataSource', realtime_network_stats);
$('.sparkline_temp').dxSparkline('instance').option('dataSource', sensorObj_array);
$('.sparkline_humid').dxSparkline('instance').option('dataSource', sensorObj_array);
$('#temp_chart_avg')[0].innerText = Math.round(temp_sum / sensorObj_array.length * 100) / 100 + '\xB0';
$('#humid_chart_avg')[0].innerText = Math.round(humid_sum / sensorObj_array.length * 100) / 100 + '%';
}
});
/*
for(i=0; i<=100; i++)
{
realtime_network_stats.push({ id: i, x1: between(rns_values[0], rns_values[1])});
}
*/
$("#realtime-network-stats").dxChart({
commonSeriesSettings: {
type: "area",
argumentField: "time"
},
series: [
{ valueField: "x1", name: "LUX", color: '#7c38bc', opacity: .4 },
],
legend: {
verticalAlignment: "bottom",
horizontalAlignment: "center"
},
commonAxisSettings: {
label: {
visible: true
},
grid: {
visible: true,
color: '#f5f5f5'
}
},
legend: {
visible: false
},
argumentAxis: {
valueMarginsEnabled: false
},
valueAxis: {
max: 3000
},
animation: {
enabled: false
}
}).data('iCount', i);
$('#network-realtime-gauge').dxCircularGauge({
scale: {
startValue: 0,
endValue: 2000,
majorTick: {
tickInterval: 50
}
},
rangeContainer: {
palette: 'pastel',
width: 3,
ranges: [
{ startValue: 0, endValue: 500, color: "#7c38bc" },
{ startValue: 500, endValue: 1000, color: "#7c38bc" },
{ startValue: 1000, endValue: 1500, color: "#7c38bc" },
{ startValue: 1500, endValue: 2000, color: "#7c38bc" },
],
},
value: 0,
valueIndicator: {
offset: 10,
color: '#7c38bc',
type: 'triangleNeedle',
spindleSize: 12
}
});
setInterval(function(){ networkRealtimeChartTick(); }, 600000);
setInterval(function(){ networkRealtimeGaugeTick(); }, 2000);
setInterval(function(){ networkRealtimeMBupdate(); }, 2000);
setInterval(function(){ TemperatureGaugeUpdate(); }, 2000);
setInterval(function(){ HumidityGaugeUpdate(); }, 2000);
setInterval(function(){ LightGaugeUpdate(); }, 2000);
setInterval(function(){ MotionTextUpdate(); }, 2000);
setInterval(function(){ bar3ChartUpdate(); }, 600000);
setInterval(function(){ presence_avgUpdate(); }, 2000);
function TemperatureGaugeUpdate(){
document.gauges[0].value = sensorTemperature_current;
jQuery("#motionText").textContent = 1000;
}
function HumidityGaugeUpdate(){
document.gauges[1].value = sensorHumidity_current;
}
function LightGaugeUpdate(){
document.gauges[2].value = sensorlight_current;
}
function MotionTextUpdate(){
if(sensorMotion_current == 0)
jQuery("#motionText")[0].innerText = "Emtpy";
else
jQuery("#motionText")[0].innerText = "People Around";
}
function presence_avgUpdate(){
if(typeof $("#bar-3").dxChart('instance').option('dataSource') !== 'undefined'){
var chart_data = $("#bar-3").dxChart('instance').option('dataSource');
var counter = 0;
var motionCount = 0;
//console.log(chart_data[0].Presence);
for(counter=0; counter< chart_data.length; counter++){
//console.log(chart_data[counter].Presence);
if(chart_data[counter].Presence == 100)
motionCount++;
}
jQuery("#presence_avg")[0].textContent = Math.round(motionCount / chart_data.length * 100 * 100)/100 + "%";
}
}
// Resize charts
$(window).on('xenon.resize', function()
{
$("#pageviews-visitors-chart").data("dxChart").render();
$("#server-uptime-chart").data("dxChart").render();
$("#realtime-network-stats").data("dxChart").render();
$('.first-month').data("dxSparkline").render();
$('.second-month').data("dxSparkline").render();
$('.third-month').data("dxSparkline").render();
});
});
function bar3ChartUpdate()
{
if(!isNaN(sensorObj_current.d.Temperature)){
var chart_data = $("#bar-3").dxChart('instance').option('dataSource');
if(chart_data.length >= 100)
chart_data.shift();
var motion = 0;
if(sensorMotion_current == 1)
motion = 100;
chart_data.push({time: timestamp_current, Temperature : sensorTemperature_current,
Humidity : sensorHumidity_current, Presence : motion });
$("#bar-3").dxChart('instance').option('dataSource', chart_data);
}
}
function networkRealtimeChartTick()
{
var $ = jQuery,
i = 0;
if( $('#realtime-network-stats').length == 0 )
return;
var chart_data = $('#realtime-network-stats').dxChart('instance').option('dataSource');
var count = $('#realtime-network-stats').data('iCount');
$('#realtime-network-stats').data('iCount', count + 1);
if(chart_data.length >= 100)
chart_data.shift();
chart_data.push({time: timestamp_current, x1: sensorlight_current });
sensor_counter++;
$('#realtime-network-stats').dxChart('instance').option('dataSource', chart_data);
}
function networkRealtimeGaugeTick()
{
if(jQuery('#network-realtime-gauge').length == 0)
return;
var nr_gauge = jQuery('#network-realtime-gauge').dxCircularGauge('instance');
nr_gauge.value( sensorlight_current );
}
function networkRealtimeMBupdate()
{
var $el = jQuery("#network-mbs-packets");
if($el.length == 0)
return;
var options = {
useEasing : true,
useGrouping : true,
separator : ',',
decimal : '.',
prefix : '' ,
suffix : 'LUX'
},
cntr = new countUp($el[0], parseFloat($el.text().replace('LUX')), sensorlight_current, 2, 1.5, options);
cntr.start();
}
function between(randNumMin, randNumMax)
{
var randInt = Math.floor((Math.random() * ((randNumMax + 1) - randNumMin)) + randNumMin);
return randInt;
}
</script>
<div class="row">
<div class="col-sm-3">
<canvas
id="TemperatureGauge"
data-title="Temperature"
data-type="radial-gauge"
data-width="200"
data-height="200"
data-units="DegC"
data-min-value="10"
data-max-value="40"
data-major-ticks="10,20,30,40"
data-minor-ticks="2"
data-stroke-ticks="true"
data-highlights='[
{"from": 10, "to": 20, "color": "rgba(200, 50, 50, .75)"},
{"from": 35, "to": 40, "color": "rgba(200, 50, 50, .75)"}
]'
data-color-plate="#fff"
data-border-shadow-width="0"
data-borders="false"
data-needle-type="arrow"
data-needle-width="2"
data-needle-circle-size="7"
data-needle-circle-outer="true"
data-needle-circle-inner="false"
data-animation-duration="1500"
data-animation-rule="cycle"
></canvas>
</div>
<div class="col-sm-3">
<canvas
id="HumidityGauge"
data-title="Humidity"
data-type="radial-gauge"
data-width="200"
data-height="200"
data-units="%"
data-min-value="0"
data-max-value="100"
data-major-ticks="0,25,50,75,100"
data-minor-ticks="2"
data-stroke-ticks="true"
data-highlights='[
{"from": 0, "to": 20, "color": "rgba(200, 50, 50, .75)"},
{"from": 20, "to": 40, "color": "yellow"},
{"from": 90, "to": 100, "color": "yellow"}
]'
data-color-plate="#fff"
data-border-shadow-width="0"
data-borders="false"
data-needle-type="arrow"
data-needle-width="2"
data-needle-circle-size="7"
data-needle-circle-outer="true"
data-needle-circle-inner="false"
data-animation-duration="1500"
data-animation-rule="cycle"
></canvas>
</div>
<div class="col-sm-3">
<canvas
id="LightGauge"
data-title="Light"
data-type="radial-gauge"
data-width="200"
data-height="200"
data-units="LUX"
data-min-value="0"
data-max-value="2000"
data-major-ticks="0,500,1000,1500,2000"
data-minor-ticks="2"
data-stroke-ticks="true"
data-highlights='[
{"from": 0, "to": 30, "color": "yellow"},
{"from": 1000, "to": 1500, "color": "yellow"},
{"from": 1500, "to": 2000, "color": "rgba(200, 50, 50, .75)"}
]'
data-color-plate="#fff"
data-border-shadow-width="0"
data-borders="false"
data-needle-type="arrow"
data-needle-width="2"
data-needle-circle-size="7"
data-needle-circle-outer="true"
data-needle-circle-inner="false"
data-animation-duration="1500"
data-animation-rule="cycle"
></canvas>
</div>
<div class="col-sm-3">
<div> </div>
<div class="xe-widget xe-counter-block xe-counter-block-blue" >
<div class="xe-upper">
<div class="xe-icon">
<i class="linecons-user"></i>
</div>
<div class="xe-label">
<strong id="motionText" >--</strong>
<span>Presence</span>
</div>
</div>
<div class="xe-lower">
<div class="border"></div>
<span>Occpancy</span>
<strong id="presence_avg">--%</strong>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="panel panel-default">
<div class="panel-body">
<div id="bar-3" style="height: 400px; width: 80%;"></div>
</div>
</div>
<script>
//{ valueField: "Temperature", name: "Temperature", color: "#40bbea" },
//{ valueField: "Humidity", name: "Humidity", color: "#8dc63f" },
// Sparklines
var temp_day_chart = {
argumentField: 'PAYLOAD_TS',
valueField: 'PAYLOAD_D_TEMPERATURE',
type: 'splinearea',
showMinMax: true,
lineColor: '#40bbea',
minColor: '#4fcdfc',
maxColor: '#d5080f',
showFirstLast: true
},
humid_day_chart = {
argumentField: 'PAYLOAD_TS',
valueField: 'PAYLOAD_D_HUMIDITY',
type: 'splinearea',
//lineWidth: 3,
lineColor: '#8dc63f',
minColor: '#4fcdfc',
maxColor: '#d5080f',
showMinMax: true,
showFirstLast: true
};
$('.sparkline_temp').dxSparkline(temp_day_chart);
$('.sparkline_humid').dxSparkline(humid_day_chart);
</script>
<div class="panel panel-default">
<div class="panel-heading">This Daily Analytics</div>
<table class="table">
<thead>
<tr>
<th>Type</th>
<th width="20%">Avg</th>
<th width="50%">Daily Chart</th>
</tr>
</thead>
<tbody>
<tr>
<td>Temperature</td>
<td id="temp_chart_avg">--°</td>
<td>
<div class="sparkline_temp"></div>
</td>
</tr>
<tr>
<td>Humidity</td>
<td id="humid_chart_avg">--%</td>
<td>
<div class="sparkline_humid"></div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-sm-6">
<div class="chart-item-bg">
<div class="chart-label">
<div id="network-mbs-packets" class="h1 text-purple text-bold" xe-counter data-count="this" data-from="0.00" data-to="0.00" data-suffix="LUX" data-duration="1">0.00LUX</div>
<span class="text-small text-muted text-upper">Light</span>
</div>
<div class="chart-right-legend">
<div id="network-realtime-gauge" style="width: 170px; height: 140px"></div>
</div>
<div id="realtime-network-stats" style="height: 320px"></div>
</div>
<script>
var months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
var c_date = new Date();
var c_date_text = "Today , " + c_date.getDate() + ' ' + months[c_date.getMonth()];
$('#current_date')[0].innerText = c_date_text;
</script>
<div class="xe-widget xe-weather">
<div class="xe-background xe-background-animated">
<img src="assets/images/clouds.png" />
</div>
<div class="xe-current-day">
<div class="xe-now">
<div class="xe-temperature">
<div class="xe-icon">
<i class="meteocons-cloud-moon"></i>
</div>
<div class="xe-label">
Now
<strong>30°</strong>
</div>
</div>
<div class="xe-location">
<h4>Singapore</h4>
<time id="current_date"></time>
</div>
</div>
<div class="xe-forecast">
<ul>
<li>
<div class="xe-forecast-entry">
<time>11:00</time>
<div class="xe-icon">
<i class="meteocons-sunrise"></i>
</div>
<strong class="xe-temp">28°</strong>
</div>
</li>
<li>
<div class="xe-forecast-entry">
<time>12:00</time>
<div class="xe-icon">
<i class="meteocons-clouds-flash"></i>
</div>
<strong class="xe-temp">30°</strong>
</div>
</li>
<li>
<div class="xe-forecast-entry">
<time>13:00</time>
<div class="xe-icon">
<i class="meteocons-cloud-moon-inv"></i>
</div>
<strong class="xe-temp">31°</strong>
</div>
</li>
<li>
<div class="xe-forecast-entry">
<time>14:00</time>
<div class="xe-icon">
<i class="meteocons-eclipse"></i>
</div>
<strong class="xe-temp">31°</strong>
</div>
</li>
<li>
<div class="xe-forecast-entry">
<time>15:00</time>
<div class="xe-icon">
<i class="meteocons-rain"></i>
</div>
<strong class="xe-temp">30°</strong>
</div>
</li>
<li>
<div class="xe-forecast-entry">
<time>16:00</time>
<div class="xe-icon">
<i class="meteocons-cloud-sun"></i>
</div>
<strong class="xe-temp">28°</strong>
</div>
</li>
</ul>
</div>
</div>
<div class="xe-weekdays">
<ul class="list-unstyled">
<li>
<div class="xe-weekday-forecast">
<div class="xe-temp">30°</div>
<div class="xe-day">Monday</div>
<div class="xe-icon">
<i class="meteocons-windy-inv"></i>
</div>
</div>
</li>
<li>
<div class="xe-weekday-forecast">
<div class="xe-temp">32°</div>
<div class="xe-day">Tuesday</div>
<div class="xe-icon">
<i class="meteocons-sun"></i>
</div>
</div>
</li>
<li>
<div class="xe-weekday-forecast">
<div class="xe-temp">30°</div>
<div class="xe-day">Wednesday</div>
<div class="xe-icon">
<i class="meteocons-na"></i>
</div>
</div>
</li>
<li>
<div class="xe-weekday-forecast">
<div class="xe-temp">31°</div>
<div class="xe-day">Thursday</div>
<div class="xe-icon">
<i class="meteocons-windy"></i>
</div>
</div>
</li>
<li>
<div class="xe-weekday-forecast">
<div class="xe-temp">30°</div>
<div class="xe-day">Friday</div>
<div class="xe-icon">
<i class="meteocons-sun"></i>
</div>
</div>
</li>
</ul>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Room Occupancy Weekly Chart</h3>
<div class="panel-options">
<a href="" data-toggle="panel">
<span class="collapse-icon">–</span>
<span class="expand-icon">+</span>
</a>
<a href="" data-toggle="remove">
×
</a>
</div>
</div>
<div class="panel-body">
<script type="text/javascript">
jQuery(document).ready(function($)
{
if( ! $.isFunction($.fn.dxChart))
return;
var dataSource = [
{ day: "Mon", occ: .83, book: .9},
{ day: "Tue", occ: .24, book: .85},
{ day: "Wed", occ: .1, book: .72},
{ day: "Fri", occ: .76, book: .65},
{ day: "Sat", occ: .39, book: .12},
{ day: "Sun", occ: .15, book: .0}
];
$("#bar-2").dxChart({
equalBarWidth: false,
dataSource: dataSource,
commonSeriesSettings: {
argumentField: "day",
type: "bar"
},
series: [
{ valueField: "occ", name: "Occupied", color: "#0e62c7" },
{
axis: "Room Booked",
type: "spline",
valueField: "book",
name: "Room Booked",
color: "#8dc63f"
}
//{ valueField: "book", name: "Room Booked", color: "#8dc63f" }
],
legend: {
verticalAlignment: "bottom",
horizontalAlignment: "center"
},
valueAxis:[
{
label: {
format: "percent"
}
},
{
name: "Room Booked",
label: {
visible: false
}
}
],
tooltip: {
enabled: true,
shared: true,
format: {
type: "percent",
precision: 1
},
customizeTooltip: function (arg) {
var items = arg.valueText.split("\n"),
color = arg.point.getColor();
$.each(items, function(index, item) {
if(item.indexOf(arg.seriesName) === 0) {
items[index] = $("<b>")
.text(item)
.css("color", color)
.prop("outerHTML");
}
});
return { text: items.join("\n") };
}
}
});
});
</script>
<div id="bar-2" style="height: 400px; width: 100%;"></div>
</div>
</div>
</div>
</div>
<script>
socket_current.emit('test', { my: 'data' });
</script>
| 26.484919 | 361 | 0.588874 |
57334013c3312bea1a21bf8681a244382fb97caf | 384 | kt | Kotlin | app/src/main/java/fi/jara/birdwatcher/data/room/ObservationDatabase.kt | Pikkuninja/Birdwatcher | 34744fc2347c094453bae3525f709ec1a6cf3285 | [
"MIT"
] | null | null | null | app/src/main/java/fi/jara/birdwatcher/data/room/ObservationDatabase.kt | Pikkuninja/Birdwatcher | 34744fc2347c094453bae3525f709ec1a6cf3285 | [
"MIT"
] | null | null | null | app/src/main/java/fi/jara/birdwatcher/data/room/ObservationDatabase.kt | Pikkuninja/Birdwatcher | 34744fc2347c094453bae3525f709ec1a6cf3285 | [
"MIT"
] | null | null | null | package fi.jara.birdwatcher.data.room
import androidx.room.Database
import androidx.room.RoomDatabase
import androidx.room.TypeConverters
@Database(
entities = [ObservationEntity::class],
version = 3,
exportSchema = true)
@TypeConverters(RoomTypeConverters::class)
abstract class ObservationDatabase: RoomDatabase() {
abstract fun observationDao(): ObservationDao
} | 25.6 | 52 | 0.786458 |
f71f9d51b193c8ff94ad1bc991c9e5f26881444a | 463 | h | C | ClientEngine/game/engine/Stage/UnitPart/UnitSelectSceneNodes/UnitSelectSceneNodeId.h | twesd/editor | 10ea9f535115dadab5694fecdb0c499d0013ac1b | [
"MIT"
] | null | null | null | ClientEngine/game/engine/Stage/UnitPart/UnitSelectSceneNodes/UnitSelectSceneNodeId.h | twesd/editor | 10ea9f535115dadab5694fecdb0c499d0013ac1b | [
"MIT"
] | null | null | null | ClientEngine/game/engine/Stage/UnitPart/UnitSelectSceneNodes/UnitSelectSceneNodeId.h | twesd/editor | 10ea9f535115dadab5694fecdb0c499d0013ac1b | [
"MIT"
] | null | null | null | #pragma once
#include "UnitSelectSceneNodeBase.h"
#include "Core/CompareType.h"
class UnitSelectSceneNodeId : public UnitSelectSceneNodeBase
{
public:
UnitSelectSceneNodeId(SharedParams_t params);
virtual ~UnitSelectSceneNodeId(void);
// Выполнить выборку
virtual core::array<scene::ISceneNode*> Select(core::array<Event_t*>& events);
private:
void SelectNodes( ISceneNode* start, ISceneNode* mainNode, core::array<scene::ISceneNode*> &selectNodes );
};
| 27.235294 | 107 | 0.784017 |
bb71e6a2cb9e06cef1fbc52b40b0a773c165655a | 386 | sql | SQL | posda/posdatools/queries/sql/FilesIdsVisibleInSeries.sql | UAMS-DBMI/PosdaTools | 7d33605da1b88e4787a1368dbecaffda1df95e5b | [
"Apache-2.0"
] | 6 | 2019-01-17T15:47:44.000Z | 2022-02-02T16:47:25.000Z | posda/posdatools/queries/sql/FilesIdsVisibleInSeries.sql | UAMS-DBMI/PosdaTools | 7d33605da1b88e4787a1368dbecaffda1df95e5b | [
"Apache-2.0"
] | 23 | 2016-06-08T21:51:36.000Z | 2022-03-02T08:11:44.000Z | posda/posdatools/queries/sql/FilesIdsVisibleInSeries.sql | UAMS-DBMI/PosdaTools | 7d33605da1b88e4787a1368dbecaffda1df95e5b | [
"Apache-2.0"
] | null | null | null | -- Name: FilesIdsVisibleInSeries
-- Schema: posda_files
-- Columns: ['file_id']
-- Args: ['series_instance_uid']
-- Tags: ['by_series_instance_uid', 'file_ids', 'posda_files']
-- Description: Get Distinct Unhidden Files in Series
--
select
distinct file_id
from
file_series natural join file_sop_common natural join ctp_file
where
series_instance_uid = ? and visibility is null
| 25.733333 | 64 | 0.759067 |
fac41823123cd2e60b50dd9a51ed5eb9f8346563 | 431 | lua | Lua | nvim/lua/plugin/packer/config.lua | raddari/dotfiles | f559b2738cdc33049f44a21653f2004529a959c4 | [
"Unlicense"
] | null | null | null | nvim/lua/plugin/packer/config.lua | raddari/dotfiles | f559b2738cdc33049f44a21653f2004529a959c4 | [
"Unlicense"
] | null | null | null | nvim/lua/plugin/packer/config.lua | raddari/dotfiles | f559b2738cdc33049f44a21653f2004529a959c4 | [
"Unlicense"
] | null | null | null | local M = {}
M.init = {
git = {
clone_timeout = 180,
},
display = {
open_fn = function ()
return require('packer.util').float({border = 'single'})
end,
},
profile = {
enable = true,
threshold = 1,
},
}
M.use = function (plugins)
return function (use)
use({'wbthomason/packer.nvim', opt = true})
for _, plugin in ipairs(plugins) do
use(plugin)
end
end
end
return M
| 15.392857 | 62 | 0.556845 |
a2a1aa6dea3c5f0152ff9e89023389b90f0dae6f | 297 | sql | SQL | src/functions.sql | knaw-huc/ING2SD | 9a2d292548f27f347165d83d3b24f84da4d292b5 | [
"MIT"
] | null | null | null | src/functions.sql | knaw-huc/ING2SD | 9a2d292548f27f347165d83d3b24f84da4d292b5 | [
"MIT"
] | null | null | null | src/functions.sql | knaw-huc/ING2SD | 9a2d292548f27f347165d83d3b24f84da4d292b5 | [
"MIT"
] | null | null | null | CREATE EXTENSION IF NOT EXISTS plpgsql;
DROP FUNCTION IF EXISTS public.sd_debug(msg character varying);
CREATE FUNCTION public.sd_debug(msg character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
RAISE NOTICE '?DBG: %', msg;
END;
$$;
-- SELECT sd_debug(format('hello %s','world')); | 29.7 | 67 | 0.73064 |
2635d5d74ee4b130f9bd793a80898c3f26dd0ab6 | 5,593 | java | Java | mobile/src/main/java/com/kuxhausen/huemore/BulbListFragment.java | ekux44/LampShade | 6c8a01e8624b03c3155b598c900f9a4ec197d673 | [
"Apache-2.0"
] | 21 | 2015-09-09T10:03:28.000Z | 2020-04-13T19:06:54.000Z | mobile/src/main/java/com/kuxhausen/huemore/BulbListFragment.java | ekux44/LampShade | 6c8a01e8624b03c3155b598c900f9a4ec197d673 | [
"Apache-2.0"
] | 33 | 2015-09-09T07:37:42.000Z | 2019-03-11T23:52:55.000Z | mobile/src/main/java/com/kuxhausen/huemore/BulbListFragment.java | ekux44/LampShade | 6c8a01e8624b03c3155b598c900f9a4ec197d673 | [
"Apache-2.0"
] | 14 | 2015-10-06T14:00:02.000Z | 2018-03-07T08:09:17.000Z | package com.kuxhausen.huemore;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.BaseColumns;
import android.support.v4.app.ListFragment;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
import android.support.v4.widget.CursorAdapter;
import android.support.v4.widget.SimpleCursorAdapter;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import com.kuxhausen.huemore.persistence.Definitions;
import com.kuxhausen.huemore.persistence.Definitions.InternalArguments;
import com.kuxhausen.huemore.persistence.Definitions.NetBulbColumns;
import com.kuxhausen.huemore.state.Group;
import com.kuxhausen.huemore.state.SyntheticGroup;
import java.util.ArrayList;
public class BulbListFragment extends ListFragment
implements LoaderManager.LoaderCallbacks<Cursor>, SelectableList {
private static final int BULBS_LOADER = 0;
private static final String[] columns = {NetBulbColumns.NAME_COLUMN,
NetBulbColumns.DEVICE_ID_COLUMN, BaseColumns._ID};
private CursorAdapter mDataSource;
private TextView mSelected, mLongSelected; // updated on long click
private int mSelectedPos = -1;
private NavigationDrawerActivity mParent;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mParent = (NavigationDrawerActivity) getActivity();
int layout = android.R.layout.simple_list_item_activated_1;
getLoaderManager().initLoader(BULBS_LOADER, null, this);
mDataSource =
new SimpleCursorAdapter(getActivity(), layout, null, columns,
new int[]{android.R.id.text1}, 0);
setListAdapter(mDataSource);
// Inflate the layout for this fragment
View myView = inflater.inflate(R.layout.bulb_view, null);
return myView;
}
@Override
public void onStart() {
super.onStart();
getListView().setChoiceMode(AbsListView.CHOICE_MODE_SINGLE);
mParent.trackSelectableList(this);
}
@Override
public void onStop() {
super.onStop();
mParent.forgetSelectableList(this);
}
public void invalidateSelection() {
// Set the previous selected item as checked to be unhighlighted when in
// two-pane layout
if (mSelected != null && mSelectedPos > -1) {
getListView().setItemChecked(mSelectedPos, false);
}
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
mLongSelected = (TextView) ((AdapterView.AdapterContextMenuInfo) menuInfo).targetView;
android.view.MenuInflater inflater = this.getActivity().getMenuInflater();
inflater.inflate(R.menu.context_bulb, menu);
}
@Override
public boolean onContextItemSelected(android.view.MenuItem item) {
if (mLongSelected == null) {
return false;
}
switch (item.getItemId()) {
case R.id.contextgroupmenu_rename: // <-- your custom menu item id here
AdapterView.AdapterContextMenuInfo info =
(AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
EditBulbDialogFragment ngdf = new EditBulbDialogFragment();
Bundle args = new Bundle();
args.putLong(InternalArguments.NET_BULB_DATABASE_ID, info.id);
ngdf.setArguments(args);
ngdf.show(getFragmentManager(), InternalArguments.FRAG_MANAGER_DIALOG_TAG);
default:
return super.onContextItemSelected(item);
}
}
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
mSelected = ((TextView) (v));
mSelectedPos = position;
ArrayList<Long> bulbIds = new ArrayList<Long>();
bulbIds.add(mDataSource.getItemId(position));
Group g = new SyntheticGroup(bulbIds, mSelected.getText().toString());
mParent.setGroup(g, this);
// Set the item as checked to be highlighted when in two-pane layout
getListView().setItemChecked(mSelectedPos, true);
}
@Override
public Loader<Cursor> onCreateLoader(int loaderID, Bundle arg1) {
/*
* Takes action based on the ID of the Loader that's being created
*/
switch (loaderID) {
case BULBS_LOADER:
// Returns a new CursorLoader
return new CursorLoader(getActivity(), // Parent activity context
Definitions.NetBulbColumns.URI, // Table
columns, // Projection to return
null, // No selection clause
null, // No selection arguments
null // Default sort order
);
default:
// An invalid id was passed in
return null;
}
}
@Override
public void onLoadFinished(Loader<Cursor> arg0, Cursor cursor) {
/*
* Moves the query results into the adapter, causing the ListView fronting this adapter to
* re-display
*/
mDataSource.changeCursor(cursor);
registerForContextMenu(getListView());
}
@Override
public void onLoaderReset(Loader<Cursor> arg0) {
/*
* Clears out the adapter's reference to the Cursor. This prevents memory leaks.
*/
// unregisterForContextMenu(getListView());
mDataSource.changeCursor(null);
}
}
| 32.707602 | 99 | 0.699446 |
91906ee0d328768449fb54c6e2652af57a0c67c8 | 8,243 | html | HTML | oldposts/10.html | codelifeliwan/codelifeliwan.github.io | 0ae46f420709799609ffd2069016021fb4934322 | [
"MIT"
] | null | null | null | oldposts/10.html | codelifeliwan/codelifeliwan.github.io | 0ae46f420709799609ffd2069016021fb4934322 | [
"MIT"
] | null | null | null | oldposts/10.html | codelifeliwan/codelifeliwan.github.io | 0ae46f420709799609ffd2069016021fb4934322 | [
"MIT"
] | null | null | null | <!doctype html>
<!--[if IE 6]>
<html id="ie6" lang="zh-CN">
<![endif]-->
<!--[if IE 7]>
<html id="ie7" lang="zh-CN">
<![endif]-->
<!--[if IE 8]>
<html id="ie8" lang="zh-CN">
<![endif]-->
<!--[if !(IE 6) | !(IE 7) | !(IE 8) ]><!-->
<html lang="zh-CN">
<!--<![endif]-->
<head>
<link rel="stylesheet" type="text/css" media="all" href="stylesheets/style.css">
<link rel="stylesheet" id="codebox-css" href="stylesheets/codebox.css" type="text/css" media="screen">
</head>
<body class="single single-post postid-10 single-format-standard content-sidebar">
<div id="page" class="hfeed">
<header id="branding" role="banner">
<hgroup>
<h1 id="site-title"><span><a href="http://codelifeliwan.github.io/" title="Code_Life_LiWan" rel="home">Code_Life_LiWan</a></span></h1>
<h2 id="site-description">My heart will go on and on…</h2>
</hgroup>
<!-- #access -->
</header>
<!-- #branding -->
<div id="main" class="clearfix">
<div id="primary">
<div id="content" role="main">
<!-- #nav-single -->
<article id="post-10" class="post-10 post type-post status-publish format-standard hentry category-professional_exchanges tag-gedit">
<header class="entry-header">
<h1 class="entry-title">gedit配置(主要是文本缩进)[转载]</h1>
<div class="entry-meta">
<span class="sep">Posted on </span>
<a href="http://codelifeliwan.github.io/?p=10" title="下午 8:29" rel="bookmark"><time class="entry-date" datetime="2011-03-10T20:29:51+00:00" pubdate>10 三月, 2011</time></a>
<span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="http://codelifeliwan.github.io/?author=1" title="View all posts by wanli" rel="author">wanli</a></span></span>
<span class="sep"> — </span>
<span class="comments-link"> <a href="http://codelifeliwan.github.io/?p=10#respond" title="Comment on gedit配置(主要是文本缩进)[转载]">No Comments ↓</a> </span>
</div>
<!-- .entry-meta -->
</header>
<!-- .entry-header -->
<div class="entry-content">
<div class="entry-content">
<p style="font-family: Tahoma, sans-serif; line-height: 22px; font-size: 14px;"> <span style="color: rgb(85, 85, 85); -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px;"><br> <a href="http://www.gnome.org/projects/gedit/" style="font-family: Tahoma, sans-serif; outline-style: none; outline-width: initial; outline-color: initial; color: rgb(41, 112, 166); font-size: 14px !important; line-height: normal; text-decoration: underline;"><br> Gedit</a> <wbr>是 GNOME<br> 桌面环境中默认的文本编辑器,其开放的插件支持特性不仅可以扩展文本编辑的功能,而且这些插件也能够使 Gedit<br> 更加好用。</span></p>
<ol style="font-family: Tahoma, sans-serif; line-height: normal;">
<li style="font-family: Tahoma, sans-serif; line-height: normal;"> Snippets:这是一个可以插入代码片段的插件。对于经常编写代码的朋友来说,该插件将使编码工作得心应手。这个插件具有一个代码片段管理器,用户可以在里面添加、编辑、设置自己需要使用的代码片段。 <wbr>使用这些代码片段有如下三种方法:一是用<br> Ctrl + Space 键呼出代码片段选择框,然后在里面选择需要使用的代码片段;二是在输入代码片段的名称之后,连续按两次 Tab<br> 键,如输入while+Tab+Tab可以触发需要使用的代码片段;三是使用预先定义的热键来触发要用的代码片段。 <wbr>该插件已经内置在<br> Gedit 中,用户不必安装,但在使用之前需要到 编辑 -> 首选项 -><br> 插件 中激活。</li>
<li style="font-family: Tahoma, sans-serif; line-height: normal;"> <a href="http://elias.hiex.at/gedit-plugins/" style="font-family: Tahoma, sans-serif; outline-style: none; outline-width: initial; outline-color: initial; color: rgb(41, 112, 166); font-size: 14px !important; line-height: normal;"><br> Auto Completion</a>: 顾名思义,该插件使在 Gedit<br> 中输入文本时具备自动完成功能。使用此插件需要进行安装,那是很简单的,只要把下载的文件复制到<br> ~/.gnome2/gedit/plugins 目录即可。可以使用 Tab 键来自动完成需要输入的文本。如,假设已经输过了<br> gedit,再次输入 gedit 时,只需 g[tab] 就可以了。</li>
<li style="font-family: Tahoma, sans-serif; line-height: normal;"> Tag list:无需直接输入,便可插入常用的 tag 和字符串。该插件支持插入 HTML 的 tag 和特殊字符、Latex 的<br> tag、以及 XSLT 的元素、函数和 Axes.</li>
<li style="font-family: Tahoma, sans-serif; line-height: normal;"> File Browser:这个插件为 gedit<br> 提供文件浏览支持,可以直接通过导航文件系统来处理文件。支持创建新的目录和文件,也可以监视目录的更改情况.</li>
<li style="font-family: Tahoma, sans-serif; line-height: normal;"> Document<br> Statistics:一个文档统计插件,可以统计文档的行数、字数、字符数、字节数等。 <wbr></li>
</ol>
<p style="font-family: Tahoma, sans-serif; line-height: 22px; font-size: 14px;"> 以上便是我最喜爱的 5 个 Gedit 插件。在 Gedit 网站上还可以找到<a href="http://live.gnome.org/Gedit/Plugins" style="font-family: Tahoma, sans-serif; outline-style: none; outline-width: initial; outline-color: initial; color: rgb(41, 112, 166); font-size: 14px !important; line-height: normal; text-decoration: underline;">更多有用的插件</a>。那么你最喜爱的<br> Gedit 插件是哪些呢?</p>
<p style="font-family: Tahoma, sans-serif; line-height: 22px; font-size: 14px;"> <strong style="font-family: Tahoma, sans-serif; line-height: normal;">函数显示插件</strong>,这个可以说是最有用的,下载二进制包,我的是ubuntu的i386但是可以在我的F8上使用。</p>
<p style="font-family: Tahoma, sans-serif; line-height: 22px; font-size: 14px;"> gedit-symbol-browser-plugin-bin-ubuntu-i386-0.1.tar.gz解压后有两个文件夹,</p>
<p style="font-family: Tahoma, sans-serif; line-height: 22px; font-size: 14px;"> 将plugins文件夹里的文件拷到/usr/lib/gedit-2/plugins/目录下,我把symbol文件夹也拷到了这个目录下。重启即可</p>
<p style="font-family: Tahoma, sans-serif; line-height: 22px; font-size: 14px;"> 默认的gedit稍微勾选几下,语法高亮、括号匹配、高亮显示当前行、简单的缩进 都已经有了<br style="font-family: Tahoma, sans-serif; line-height: normal;"><br> <br style="font-family: Tahoma, sans-serif; line-height: normal;"><br> 下载<br style="font-family: Tahoma, sans-serif; line-height: normal;"><br> Smart indentation plugin for C/C++/Java:<a href="http://live.gnome.org/Gedit/Plugins?action=AttachFile&do=get&target=csmartindent.tar.gz" style="font-family: Tahoma, sans-serif; outline-style: none; outline-width: initial; outline-color: initial; color: rgb(41, 112, 166); font-size: 14px !important; text-decoration: underline; line-height: normal;">http://live.gnome.org/Gedit/Plugins?action=AttachFile&do=get&target=csmartindent.tar.gz</a> <wbr>智能缩进</p>
<p style="font-family: Tahoma, sans-serif; line-height: 22px; font-size: 14px;"> Word Completion 的下载地址:<a href="http://users.tkk.fi/~otsaloma/gedit/" style="font-family: Tahoma, sans-serif; outline-style: none; outline-width: initial; outline-color: initial; color: rgb(41, 112, 166); font-size: 14px !important; line-height: normal; text-decoration: underline;">http://users.tkk.fi/~otsaloma/gedit/</a> <wbr>(注意:把completion.gedit-plugin<br> 和 completion.py 这两个文件下载就可以) 代码提示</p>
<p style="font-family: Tahoma, sans-serif; font-size: 14px;"> <span style="line-height: 22px;">Open<br> terminal here 的下载地址:</span><a href="http://www.gafouri.net/files/open-terminal-here.tar.gz" style="font-family: Tahoma, sans-serif; outline-style: none; outline-width: initial; outline-color: initial; color: rgb(41, 112, 166); font-size: 14px !important; line-height: normal; text-decoration: underline;">http://www.gafouri.net/files/open-terminal-here.tar.gz</a><span style="line-height: 22px;"> <wbr>在当前文件同目录打开terminal <wbr></span><br style="font-family: Tahoma, sans-serif; line-height: normal;"><br> <br style="font-family: Tahoma, sans-serif; line-height: normal;"><br> <span style="line-height: 22px;">这几个插件能够让你的gedit如虎添翼,感受到质的飞跃</span></p>
<p style="font-size: 14px;"><span style="line-height: normal;"><br></span><span style="line-height: 22px; font-family: Tahoma, sans-serif;">更多插件</span><a href="http://live.gnome.org/Gedit/Plugins" style="font-family: Tahoma, sans-serif; outline-style: none; outline-width: initial; outline-color: initial; color: rgb(41, 112, 166); font-size: 14px !important; line-height: normal; text-decoration: underline;">http://live.gnome.org/Gedit/Plugins</a></p>
</div>
</div>
<!-- .entry-content -->
<!-- .entry-meta -->
</article>
<!-- #post-10 -->
<!-- #comments -->
</div>
<!-- #content -->
</div>
<!-- #primary -->
<!-- #secondary .widget-area -->
</div>
<!-- #main -->
<!-- #colophon -->
</div>
<!-- #page -->
<!-- JiaThis Button BEGIN -->
<!-- JiaThis Button END -->
</body>
</html> | 99.313253 | 827 | 0.668203 |
d253dd200d72e06ff7ca8160e8ceecb86715cc20 | 2,025 | php | PHP | modules/adminui/plugins/formwidget/choice_adminlte/choice_adminlte.formwidget.php | jelix/adminui-module | e5b125aa816291125af76ddc836c11b63cc33eb7 | [
"MIT"
] | null | null | null | modules/adminui/plugins/formwidget/choice_adminlte/choice_adminlte.formwidget.php | jelix/adminui-module | e5b125aa816291125af76ddc836c11b63cc33eb7 | [
"MIT"
] | null | null | null | modules/adminui/plugins/formwidget/choice_adminlte/choice_adminlte.formwidget.php | jelix/adminui-module | e5b125aa816291125af76ddc836c11b63cc33eb7 | [
"MIT"
] | null | null | null | <?php
/**
* @author Laurent Jouanneau
* @copyright 2022 Laurent Jouanneau
*
* @link https://jelix.org
* @licence MIT
*/
require_once JELIX_LIB_PATH.'plugins/formwidget/choice_html/choice_html.formwidget.php';
class choice_adminlteFormWidget extends choice_htmlFormWidget
{
use \Jelix\AdminUI\Form\WidgetTrait;
protected function displayStartChoiceItem($idItem, $attrRadio, $checked, $label, $attrLabel)
{
echo '<li id="'.$idItem.'"><div class="radio">','<label ';
$this->_outputAttr($attrLabel);
echo '> <input ';
$this->_outputAttr($attrRadio);
echo ' '.($checked ? 'checked' : '').'/> ';
echo htmlspecialchars($label)."</label></div>\n";
}
/**
* @param \Jelix\Forms\HtmlWidget\WidgetInterface $widget
*/
protected function displayControl($widget)
{
echo ' <div class="jforms-item-controls form-group">';
$widget->outputLabel();
echo '<div class="controls">';
$widget->outputControl();
$widget->outputHelp();
echo "</div></div>\n";
}
protected function displayValueLabel($label, $value, $hasChildValues)
{
if ($hasChildValues) {
echo '<fieldset class="jforms-choice-value"><legend> '. htmlspecialchars($label).'</legend>';
}
else {
$attr = $this->getValueAttributes();
echo '<span ';
$this->_outputAttr($attr);
echo '>';
echo htmlspecialchars($label),"</span>\n";
}
}
/**
* @param \Jelix\Forms\HtmlWidget\WidgetInterface $widget
* @return void
*/
protected function displayControlValue($widget)
{
echo '<li class="jforms-item-controls form-group">';
$widget->outputLabel('', false);
echo '<div class="controls col-sm-10">';
$widget->outputControlValue();
echo "</div></li>\n";
}
protected function displayValueEndBlock()
{
echo "</ul></fieldset>\n";
}
}
| 27.364865 | 105 | 0.578272 |
8c5dda97560f7f08ff619d3ee5934ef2d520ec75 | 240 | swift | Swift | crashes-duplicates/07555-swift-modulefile-maybereadpattern.swift | radex/swift-compiler-crashes | 41a18a98ae38e40384a38695805745d509b6979e | [
"MIT"
] | null | null | null | crashes-duplicates/07555-swift-modulefile-maybereadpattern.swift | radex/swift-compiler-crashes | 41a18a98ae38e40384a38695805745d509b6979e | [
"MIT"
] | null | null | null | crashes-duplicates/07555-swift-modulefile-maybereadpattern.swift | radex/swift-compiler-crashes | 41a18a98ae38e40384a38695805745d509b6979e | [
"MIT"
] | null | null | null | // Distributed under the terms of the MIT license
// Test case submitted to project by https://github.com/practicalswift (practicalswift)
// Test case found by fuzzing
var d {
0.j == 1))"
class A {
protocol e : j.e {
var e: c
func c<T : c
| 21.818182 | 87 | 0.695833 |
5806c32a2c6799c6c3d1ed796d7732982af09ee0 | 3,481 | c | C | palmos/loginman/utils.c | bschau/Portfolio | 326e298322d7ca60b1c5198869fb6e7ea2a38e74 | [
"MIT"
] | null | null | null | palmos/loginman/utils.c | bschau/Portfolio | 326e298322d7ca60b1c5198869fb6e7ea2a38e74 | [
"MIT"
] | null | null | null | palmos/loginman/utils.c | bschau/Portfolio | 326e298322d7ca60b1c5198869fb6e7ea2a38e74 | [
"MIT"
] | 1 | 2020-03-28T18:25:41.000Z | 2020-03-28T18:25:41.000Z | #include "loginman.h"
/*******************************************************************************
*
* getformobject
*
* Return pointer to object.
*/
void *
getformobject(FormPtr form,
UInt16 obj)
{
if (!form)
form=FrmGetActiveForm();
return FrmGetObjectPtr(form, FrmGetObjectIndex(form, obj));
}
/*******************************************************************************
*
* refocus
*
* Refocus given a table.
*/
Boolean
refocus(FormPtr form,
refocustab *rt)
{
Int16 fidx=FrmGetObjectId(form, FrmGetFocus(form));
UInt16 i;
for (i=0; rt[i].this; i++) {
if (rt[i].this==fidx) {
FrmSetFocus(form, FrmGetObjectIndex(form, rt[i].other));
return true;
}
}
return false;
}
/*******************************************************************************
*
* isfieldblank
*
* Check to see if field is blank.
*/
Boolean
isfieldblank(UInt8 *fld)
{
if (!fld)
return true; /* yes, field is blank */
while (*fld) {
if (*fld>' ')
return false; /* no, field is not blank */
fld++;
}
return true; /* yes, field is blank */
}
/*******************************************************************************
*
* clonestring
*
* Clone a string.
*/
MemHandle
clonestring(UInt8 *src)
{
MemHandle mh=NULL;
UInt16 len;
UInt8 *mp;
if (src) {
len=StrLen(src);
mh=MemHandleNew(len+1);
ErrFatalDisplayIf(mh==NULL, "(clonestring) Out of memory");
mp=MemHandleLock(mh);
MemMove(mp, src, len);
*(mp+len)='\x00';
MemHandleUnlock(mh);
}
return mh;
}
/*******************************************************************************
*
* setfieldtext
*
* Sets and redraw a field text.
*/
void
setfieldtext(FormPtr form,
UInt16 fldobj,
UInt8 *txt)
{
FieldType *fld;
fld=getformobject(form, fldobj);
FldSetTextPtr(fld, txt);
FldRecalculateField(fld, true);
}
/*******************************************************************************
*
* setfieldhandle
*
* Sets text as a field handle.
*/
void
setfieldhandle(FormPtr form,
UInt16 fldobj,
UInt8 *txt)
{
FieldType *fld=getformobject(form, fldobj);
MemHandle mh, oh;
UInt16 len;
UInt8 *mp;
if (txt) {
len=StrLen(txt);
mh=MemHandleNew(len+1);
ErrFatalDisplayIf(mh==NULL, "(setfieldhandle) Out of memory");
mp=MemHandleLock(mh);
MemMove(mp, txt, len);
*(mp+len)='\x00';
MemHandleUnlock(mh);
oh=FldGetTextHandle(fld);
FldSetTextHandle(fld, mh);
if (oh)
MemHandleFree(oh);
}
}
/*******************************************************************************
*
* isxdigit
*
* Is char a hexdigit?
*/
Boolean
isxdigit(UInt8 digit)
{
UInt8 d=toupper(digit);
if (d>='0' && d<='9')
return true;
if (d>='A' && d<='F')
return true;
return false;
}
/*******************************************************************************
*
* isalnum
*
* Is char an alphanumeric char?
*/
Boolean
isalnum(UInt8 cu)
{
UInt8 c=toupper(cu);
if (c>='A' && c<='Z')
return true;
if (c>='0' && c<='9')
return true;
return false;
}
/*******************************************************************************
*
* htoi
*
* Convert two hex digits to integer.
*/
UInt16
htoi(UInt8 *src)
{
UInt16 v1, v2, c;
c=toupper(*src);
if (c>='0' && c<='9')
v2=c-'0';
else if (c>='A' && c<='F')
v2=c-'A'+10;
else
v2=0;
v1=v2<<4;
src++;
c=toupper(*src);
if (c>='0' && c<='9')
v2=c-'0';
else if (c>='A' && c<='F')
v2=c-'A'+10;
else
v2=0;
v1|=v2;
return v1;
}
| 16.041475 | 80 | 0.475725 |
dd918803f2191aeec5f0301507c2ddff7534c038 | 28,128 | php | PHP | resources/views/detail_user_client.blade.php | Mohamedbachir120/koudami_web | d55489f68cf1aeff181ad90b5e510c7e5c5b18d3 | [
"MIT"
] | null | null | null | resources/views/detail_user_client.blade.php | Mohamedbachir120/koudami_web | d55489f68cf1aeff181ad90b5e510c7e5c5b18d3 | [
"MIT"
] | null | null | null | resources/views/detail_user_client.blade.php | Mohamedbachir120/koudami_web | d55489f68cf1aeff181ad90b5e510c7e5c5b18d3 | [
"MIT"
] | null | null | null | <html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="koudami">
<title> {{ Auth::user()->name }}</title>
<script src="{{ asset('js/app.js') }}" defer></script>
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<link rel="icon" href="{{ asset('css/logo.png') }}">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js" integrity="sha256-Uv9BNBucvCPipKQ2NS9wYpJmi8DTOEfTA/nH2aoJALw=" crossorigin="anonymous"></script>
<script src="{{ asset('js/language.js') }}" defer></script>
</head>
<body>
<nav class="navbar navbar-dark sticky-top bg-primary flex-lg-nowrap p-0 shadow">
<a class="navbar-brand col-lg-2 mr-0 px-3" href="/">koudami</a>
<button class="navbar-toggler position-absolute d-lg-none collapsed" type="button" data-toggle="collapse" data-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<input class="form-control w-100 rounded" type="text" placeholder="Search" aria-label="Search">
<ul class="navbar-nav px-3">
<li class="nav-item text-nowrap">
<form id="logout-form" class="pt-2" action="{{ route('logout') }}" method="POST">
@csrf
<button type="submit" class="btn text-light">Quitter</button>
</form>
</li>
</ul>
</nav>
<div class="container-fluid">
<div class="row">
<nav id="sidebarMenu" class="col-lg-2 d-lg-block bg-light sidebar collapse">
<div class="sidebar-sticky pt-3">
<h5 class="p-3"> <span data-feather="user"></span> Mon Profile</h5>
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link active" href="/home">
<i class="fa fa-home"></i>
Acceuil <span class="sr-only">(current)</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" target="_blank" href="/fr/our_clients">
<i class="fa fa-server"></i>
Services
</a>
</li>
<li class="nav-item">
<a class="nav-link" target="_blank" href="/fr/store/show_articles">
<i class="fa fa-shopping-cart"></i>
Boutique
</a>
</li>
<li class="nav-item">
<button class="btn nav-link dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-users"></i>
Recrutements <span class="font-weight-bold text-danger">New </span>
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="/fr/jobs/all_articles">Tous les offres</a>
<a class="dropdown-item" href="/jobs/mes_articles">Mes offres</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="/messagerie">
<i class="fa fa-comment"></i>
Messagerie
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/home/show_users/detail_user/{{ Auth::user()->id }}">
<i class="fa fa-file"></i>
Informations personnels
</a>
</li>
</ul>
</div>
</nav>
<main role="main" class="col-md-12 ml-sm-auto col-lg-10 mt-3 px-lg-5 mb-5">
<div class="card">
<div class="card-header">
<h4>Votre photo de Profile</h4>
</div>
<div class="card-body d-flex flex-row justify-content-center mt-5 ">
@if (Auth::user()->photo != NULL)
<img class="profile rounded" src="{{ Storage::disk('s3')->temporaryUrl(Auth::user()->photo, now()->addHours(5)) }}" alt="" >
@else
<img class="profile rounded" src="/css/avatar.png" alt="">
@endif
</div>
<div class="p-3">
<div class=" d-flex flex-row justify-content-center">
<button class="btn btn-primary" onclick="show_form()"><i class="fa fa-edit"></i> Modifier</button>
</div>
<div class="d-flex flex-row justify-content-center p-3" id="change_pic">
<form action="/save_pic" enctype="multipart/form-data" method="post">
@csrf
<label for="photo">L'image</label>
<input type="file" name="image" id="photo" required>
<input type="submit" class="btn btn-success" value="Confirmer">
</form>
</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h4>Votre mot de passe</h4></div>
<div class="card-body">
<form method="POST" action="/update_password/{{ Auth::user()->id }}">
@csrf
<div class="form-group row">
<label for="password" class="col-md-4 col-form-label text-md-right">Ancien mot de passe</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required >
@error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<label for="password" class="col-md-4 col-form-label text-md-right">Nouveau mot de passe</label>
<div class="col-md-6">
<input id="confirmpassword" type="password" class="form-control @error('password') is-invalid @enderror" name="confirmpassword" required >
@error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row justify-content-end">
<div class="col-md-3 offset-md-4 ">
<button type="submit" class="btn btn-primary ">
Valider
</button>
</div>
</div>
</form>
</div>
</div>
<div class="card">
<div class="card-header bg-dark text-light text-center"><h4>{{ Auth::user()->name }} </h4></div>
<div class="card-body">
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
@endif
<ul>
<li>Identifiant: {{ Auth::user()->name }}</li>
<li>Email: {{ Auth::user()->email }} </li>
<li>Statut: {{Auth::user()->statut}}</li>
<li>Numéro de téléphone: {{ Auth::user()->phone_number }}</li>
<li>Derniére localisation: {{ Auth::user()->wilaya }} - {{ Auth::user()->wilaya }}</li>
<li>Catégorie : {{ Auth::user()->categorie }}</li>
<li>Fonction: {{ Auth::user()->function }} </li>
<li>A rejoint la plateforme le: {{ Auth::user()->created_at }} </li>
</ul>
<div class="row justify-content-center">
<div>
<button class="btn btn-primary" onclick="show_form2()"><i class="fa fa-edit"></i> Modifier</button>
</div>
</div>
<div id="change_info" class="border rounded p-4 m-3">
<form method="POST" action="/update_user/{{ Auth::user()->id }}">
@csrf
<div class="form-group row">
<label for="name" class="col-md-4 col-form-label text-md-right">Nom</label>
<div class="col-md-6">
<input id="name" type="text" class="form-control @error('name') is-invalid @enderror" value="{{ Auth::user()->name }}" name="name" autofocus>
@error('name')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ Auth::user()->email }}" autocomplete="email">
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<label for="phone_number" class="col-md-4 col-form-label text-md-right">Numéro de Téléphone</label>
<div class="col-md-6">
<input id="phone_number" type="tel" pattern="[0-9]{10,}" class="form-control" value="{{ Auth::user()->phone_number }}" name="phone_number" >
</div>
</div>
<div class="form-group row">
<label for="categorie" class="col-md-4 col-form-label text-md-right">Votre catégorie:</label>
<select name="categorie" class="selectpicker" id="categorie">
<option value="{{ Auth::user()->categorie}}" selected>{{ Auth::user()->categorie}}</option>
<option value="Constructions et Travaux">Constructions et Travaux</option>
<option value="Industrie et fabrication">Industrie et fabrication</option>
<option value="Décoration et Aménagement">Décoration et Aménagement</option>
<option value="Traiteurs et Gateaux">Traiteurs et Gateaux</option>
<option value="Nettoyage et jardinage">Nettoyage et jardinage</option>
<option value="Location de véhicules">Location de véhicules</option>
<option value="Securité et Alarme">Securité et Alarme</option>
<option value="Menuiserie et Meubles">Menuiserie et Meubles</option>
<option value="Hôtellerie">Hôtellerie</option>
<option value="Esthétique et Beauté">Esthétique et Beauté</option>
<option value="Comptabilité et Economie">Comptabilité et Economie</option>
<option value="Maintenance et infromatique">Maintenance et infromatique</option>
<option value="Paraboles et démos">Paraboles et démos</option>
<option value="Réparation Electromenager">Réparation Electromenager</option>
<option value="Juridique">Juridique</option>
<option value="Ecoles et formations">Ecoles et formations</option>
<option value="Transport et déménagement">Transport et déménagement</option>
<option value="Publicité et communication">Publicité et communication</option>
<option value="Froid et climatisation">Froid et climatisation</option>
<option value="Médecine et santé">Médecine et santé</option>
<option value="Réparation auto et diagnostic">Réparation auto et diagnostic</option>
<option value="Projet et études">Projet et études</option>
<option value="Bureautique et internet">Bureautique et internet</option>
<option value="Impression et édition">Impression et édition</option>
<option value="Image et son">Image et son</option>
<option value="Couture et confection">Couture et confection</option>
<option value="Evènement et Divertissement">Evènement et Divertissement</option>
<option value="Réparation Electronique">Réparation Electronique</option>
<option value="Voyage">Voyage</option>
<option value="Jeux">Jeux</option>
<option value="Accessoires et Modes">Accessoires et Modes</option>
<option value="Vêtements et Chaussures">Vêtements et Chaussures </option>
<option value="Sports et loisirs">Sports et loisirs</option>
</select>
</div>
<div class="form-group row">
<label for="function" class="col-md-4 col-form-label text-md-right">L'activité:</label>
<textarea name="function" id="function" placeholder="Example : Soudeur , Maçon , peintre , Vendeur , Comptable , Avocat ..." list="functions" cols="30" rows="10">
{{ Auth::user()->function }}
</textarea>
</div>
<div class="form-group row" hidden>
<label for="type_payement" class="col-md-4 col-form-label text-md-right">Moyen de payement:</label>
<div class="col-md-6">
<select name="type_payement" class="form-control" id="type_payement">
<option value="CCP" selected>1- CCP </option>
<option value="Carte Edahabia">2- Carte Edahabia </option>
<option value="en espèces">3- Payement en espèces </option>
</select>
</div>
</div>
<div class="form-group row">
<label for="wilaya" class="col-md-4 col-form-label text-md-right">Wilaya</label>
<div class="col-md-6">
<select name="wilaya" class="form-control" id="wilaya" required>
<option value="{{ Auth::user()->wilaya }}" selected> {{ Auth::user()->wilaya }}</option>
<option value="Adrar">01 Adrar </option>
<option value="Chlef">02 Chlef </option>
<option value="Laghouat">03 Laghouat </option>
<option value="Oum el Bouaghi">04 Oum-El- Bouaghi </option>
<option value="Batna">05 Batna </option>
<option value="Béjaïa">06 Béjaïa </option>
<option value="Biskra">07 Biskra </option>
<option value="Béchar">08 Béchar </option>
<option value="Blida">09 Blida </option>
<option value="Bouira">10 Bouira </option>
<option value="Tamanrasset">11 Tamanrasset </option>
<option value="Tébessa">12 Tébessa </option>
<option value="Tlemcen">13 Tlemcen </option>
<option value="Tiaret">14 Tiaret </option>
<option value="Tizi Ouzou">15 Tizi-Ouzou </option>
<option value="Alger">16 Alger </option>
<option value="Djelfa">17 Djelfa </option>
<option value="Jijel">18 Jijel </option>
<option value="Sétif">19 Sétif </option>
<option value="Saida">20 Saida </option>
<option value="Skikda">21 Skikda </option>
<option value="Sidi-Bel- Abbès">22 Sidi-Bel- Abbès </option>
<option value="Annaba">23 Annaba </option>
<option value="Guelma">24 Guelma </option>
<option value="Constantine">25 Constantine </option>
<option value="Médéa">26 Médéa </option>
<option value="Mostaganem">27 Mostaganem </option>
<option value="M'Sila">28 M'Sila </option>
<option value="Mascara">29 Mascara </option>
<option value="Ouargla">30 Ouargla </option>
<option value="Oran">31 Oran </option>
<option value="illizi">33 illizi </option>
<option value="Bordj Bou Arreridj">34 Bordj-Bou- Arreridj </option>
<option value="Boumerdès">35 Boumerdès </option>
<option value="El Tarf">36 El-Taref </option>
<option value="Tindouf">37 Tindouf </option>
<option value="Tissemsilt">38 Tissemsilt </option>
<option value="El Oued">39 El-Oued </option>
<option value="Khenchela">40 Khenchela </option>
<option value="Souk Ahras">41 Souk-Ahras </option>
<option value="Tipaza">42 Tipaza </option>
<option value="Mila">43 Mila </option>
<option value="Aïn Defla">44 Aïn-Defla </option>
<option value="Naâma">45 Naâma </option>
<option value="Aïn Témouchent">46 Aïn- Témouchent </option>
<option value="Ghardaia">47 Ghardaia </option>
<option value="Relizane">48 Relizane </option>
<option value="Timimoun">49 Timimoun</option>
<option value="Bordj Badji Mokhtar">50 Bordj Badji Mokhtar</option>
<option value="Ouled Djellal">51 Ouled Djellal</option>
<option value="Béni Abbès">52 Béni Abbès</option>
<option value="In Salah">53 In Salah</option>
<option value="In Guezzam">54 In Guezzam</option>
<option value="Touggourt">55 Touggourt</option>
<option value="Djanet">56 Djanet</option>
<option value="El M'Gahir">57 El M'Gahir</option>
<option value="El Meniaa">58 El Meniaa</option>
</select>
</div>
</div>
<div class="form-group row">
<label for="commune" class="col-md-4 col-form-label text-md-right">Commune</label>
<div class="col-md-6">
<select name="commune" id="commune" required>
<option value="{{ Auth::user()->commune }}" selected> {{ Auth::user()->commune }}</option>
</select>
</div>
</div>
<div class="form-group row" hidden>
<label for="Ncompte" class="col-md-4 col-form-label text-md-right">N°Compte:</label>
<div class="col-md-6">
<input id="Ncompte" type="text" class="form-control" name="Ncompte" value="0000000" >
</div>
</div>
<div class="form-group row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary" id="submit">
Valider
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</main>
</div>
</div>
</body>
<script>
$(document).ready(function(){
var tab=myMap.get(document.getElementById("wilaya").value);
var i=0;
for(i=0;i<tab.length;i++){
$("select#commune").append('<option value="'+tab[i]+'">'+tab[i]+'</option>');
}
$("select#wilaya").change(function(){
var selectedCountry = $(this).children("option:selected").val();
$("select#commune").empty();
var tab=myMap.get(selectedCountry);
var i=0;
for(i=0;i<tab.length;i++){
$("select#commune").append('<option value="'+tab[i]+'">'+tab[i]+'</option>');
}
});
});
function show_form(){
$('#change_pic').css('visibility')=="hidden"? $('#change_pic').css('visibility','visible'):$('#change_pic').css('visibility','hidden');
window.scrollTo({ top: 200, behavior: 'smooth' });
}
function show_form2(){
$('#change_info').css('visibility')=="hidden"? $('#change_info').css('visibility','visible'):$('#change_info').css('visibility','hidden');
$('#change_info').toggle();
window.scrollTo({ top: 1000, behavior: 'smooth' });
}
</script>
<style>
#change_info,#change_pic{
visibility: hidden;
display: none;
}
thead,.card-header{
text-align: center;
background: linear-gradient(130deg,dodgerblue,blueviolet);
color: white;
}
@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
body {
font-size: .875rem;
}
.feather {
width: 16px;
height: 16px;
vertical-align: text-bottom;
}
/*
* Sidebar
*/
.container{
min-width: 100%;
}
img{
max-width: 100%;
}
.sidebar {
position: fixed;
top: 0;
bottom: 0;
left: 0;
z-index: 100; /* Behind the navbar */
padding: 48px 0 0; /* Height of navbar */
box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
}
@media (max-width: 767.98px) {
.sidebar {
top: 5rem;
}
.first{
object-fit: cover;
width: 100%;
height:33vh;
border-radius: 15px;
}
thead{
background: dodgerblue;
}
}
.sidebar-sticky {
position: relative;
top: 0;
height: calc(100vh - 48px);
padding-top: .5rem;
overflow-x: hidden;
overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
}
@supports ((position: -webkit-sticky) or (position: sticky)) {
.sidebar-sticky {
position: -webkit-sticky;
position: sticky;
}
}
.sidebar .nav-link {
font-weight: 500;
color: #333;
}
.sidebar .nav-link .feather {
margin-right: 4px;
color: #999;
}
.sidebar .nav-link.active {
color: #007bff;
}
.sidebar .nav-link:hover .feather,
.sidebar .nav-link.active .feather {
color: inherit;
}
.sidebar-heading {
font-size: .75rem;
text-transform: uppercase;
}
/*
* Navbar
*/
.navbar-brand {
padding-top: .75rem;
padding-bottom: .75rem;
font-size: 1rem;
box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25);
}
.navbar .navbar-toggler {
top: .25rem;
right: 1rem;
}
.navbar .form-control {
padding: .75rem 1rem;
border-width: 0;
border-radius: 0;
}
.form-control-dark {
color: #fff;
background-color: rgba(255, 255, 255, .1);
border-color: rgba(255, 255, 255, .1);
}
.form-control-dark:focus {
border-color: transparent;
box-shadow: 0 0 0 3px rgba(255, 255, 255, .25);
}
.toggledText span.trimmed{
display:none;
}
.read-more .more:before{
content:'Voir plus';
}
.showAll .toggledText span.morePoints{
display:none;
}
.showAll .toggledText span.trimmed{
display:inline;
}
.showAll .read-more .more:before{
content:'Voir moin';
}
::-webkit-scrollbar {
width: 12px;
}
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
border-radius: 5px;
}
::-webkit-scrollbar-thumb {
border-radius: 5px;
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
background: dodgerblue;
}
</style>
</html> | 44.718601 | 216 | 0.445108 |
e77ba50786f445314ca4b2b700f83ecf1c183f00 | 2,085 | swift | Swift | Sources/OktaIdx/Internal/Utilities/DebugDescription.swift | chrisdmills-okta/okta-idx-swift | 1375a45816cf95994b14b5026e0c20ca92c16d3e | [
"Apache-2.0"
] | 4 | 2021-05-11T16:00:19.000Z | 2021-11-17T09:10:53.000Z | Sources/OktaIdx/Internal/Utilities/DebugDescription.swift | chrisdmills-okta/okta-idx-swift | 1375a45816cf95994b14b5026e0c20ca92c16d3e | [
"Apache-2.0"
] | 9 | 2021-03-01T22:36:39.000Z | 2021-08-04T21:57:08.000Z | Sources/OktaIdx/Internal/Utilities/DebugDescription.swift | chrisdmills-okta/okta-idx-swift | 1375a45816cf95994b14b5026e0c20ca92c16d3e | [
"Apache-2.0"
] | 3 | 2021-10-11T14:01:19.000Z | 2022-01-26T19:25:30.000Z | //
// Copyright (c) 2021-Present, Okta, Inc. and/or its affiliates. All rights reserved.
// The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (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.
//
import Foundation
struct DebugDescription<T: Any> {
private let openBraceChar = "<"
private let closeBraceChar = ">"
let object: T
init(_ object: T) {
self.object = object
}
func address() -> String where T: AnyObject {
"\(type(of: object)): \(Unmanaged.passUnretained(object).toOpaque())"
}
func address() -> String {
"\(type(of: object)): \(object)"
}
func unbrace(_ string: String) -> String {
var result = string
if string.first == Character(openBraceChar) {
result = String(result.dropFirst())
}
if string.last == Character(closeBraceChar) {
result = String(result.dropLast())
}
return result
}
func brace(_ string: String) -> String {
openBraceChar + string + closeBraceChar
}
func format(_ list: Array<String>, indent spaceCount: Int) -> String {
if list.isEmpty {
return "-".indentingNewlines(by: spaceCount)
}
return list.map { $0.indentingNewlines(by: spaceCount) }.joined(separator: ";\n")
}
}
extension String {
func indentingNewlines(by spaceCount: Int) -> String {
let spaces = String(repeating: " ", count: spaceCount)
let items = components(separatedBy: "\n")
return String(items.map { "\n" + spaces + $0 }.joined().dropFirst())
}
}
| 30.217391 | 120 | 0.615348 |
f4e80975dc8b2e6441d0ac6171809ffe2788b0c4 | 217 | go | Go | internal/utils/colors.go | Terisback/robo-biba | a86730aacc4d6f15c710a44e09eb9479681da711 | [
"MIT"
] | null | null | null | internal/utils/colors.go | Terisback/robo-biba | a86730aacc4d6f15c710a44e09eb9479681da711 | [
"MIT"
] | null | null | null | internal/utils/colors.go | Terisback/robo-biba | a86730aacc4d6f15c710a44e09eb9479681da711 | [
"MIT"
] | null | null | null | package utils
import "strconv"
const (
DefaultEmbedColor = "3498db"
)
func GetIntColor(embColor string) int {
color, err := strconv.ParseUint(embColor, 16, 64)
if err != nil {
return 0
}
return int(color)
}
| 13.5625 | 50 | 0.691244 |
877fda393ac17195e3bed95b03234a3d9048d444 | 1,961 | html | HTML | plugins/Admin/templates/edit-advanced.html | harryparkdotio/mdms | 37375399afe82af95d8eb80be4f0754207614742 | [
"MIT"
] | 4 | 2016-07-13T06:19:40.000Z | 2016-12-01T12:57:54.000Z | plugins/Admin/templates/edit-advanced.html | officialpipskweak/mdms | 37375399afe82af95d8eb80be4f0754207614742 | [
"MIT"
] | 2 | 2016-06-07T14:55:39.000Z | 2016-06-07T14:56:29.000Z | plugins/Admin/templates/edit-advanced.html | harryparkdotio/mdms | 37375399afe82af95d8eb80be4f0754207614742 | [
"MIT"
] | null | null | null | {% extends 'index.html' %}
{% block title %}Edit{% endblock %}
{% block content %}
<script type="text/javascript">
function Delete() {
document.body.innerHTML += '<form id="delete" action="../" method="post"><input type="hidden" name="delpage" value="{{ filename }}"></form>';
document.getElementById("delete").submit();
}
</script>
<div class="container">
<form action="{{ urldepth }}admin/pages" method="post" name="save">
<div class="form-group">
<div class="row">
<div class="col-md-9">
<div class="input-group">
<span class="input-group-addon">content/</span>
<input value="{{ filename }}" type="text" class="form-control" name="filename" autocomplete="off">
<span class="input-group-addon"><a target="_blank" href="{{ base }}{{ link }}"><i class="fa fa-eye" aria-hidden="true"></i> View</a></span>
</div>
</div>
<div class="col-md-3">
<div class="input-group">
<input type="submit" class="btn btn-success" role="button" name="save" value="save">
<span style="padding-left: 5px;"></span>
<input type="submit" class="btn btn-primary" role="button" name="cancel" value="cancel">
<span style="padding-left: 5px;"></span>
<input type="button" class="btn btn-danger" onclick="Delete()" value="delete">
</div>
</div>
</div>
</div>
<div class="form-group header-editor">
<label for="header">Header (YAML):</label>
<textarea name="header" class="form-control" rows="5" id="header" autocomplete="off" style="font-family: monospace;">{{ header }}</textarea>
</div>
<div class="form-group content-editor">
<label for="content">Content (Markdown):</label>
<textarea name="content" class="form-control" rows="20" id="content" autocomplete="off" style="font-family: monospace;">{{ content }}</textarea>
</div>
<div class="input-group">
<input value="{{ filename }}" type="hidden" name="oldfilename">
</div>
</form>
</div>
{% endblock %} | 39.22 | 147 | 0.626721 |
741daf16f85a4979220458268fd6a5e2f060dd1b | 35,484 | sql | SQL | development/datasource/teacher_attendance/postgres/teacher_attendance.sql | NithinRajGR/cQube_Workflow | f2423a16dfe735c18897000318fb02eecd99b915 | [
"MIT"
] | 1 | 2021-09-29T09:00:43.000Z | 2021-09-29T09:00:43.000Z | development/datasource/teacher_attendance/postgres/teacher_attendance.sql | NithinRajGR/cQube_Workflow | f2423a16dfe735c18897000318fb02eecd99b915 | [
"MIT"
] | null | null | null | development/datasource/teacher_attendance/postgres/teacher_attendance.sql | NithinRajGR/cQube_Workflow | f2423a16dfe735c18897000318fb02eecd99b915 | [
"MIT"
] | 20 | 2021-09-20T10:00:55.000Z | 2022-03-31T14:40:21.000Z |
/* teacher_hierarchy_details */
create table if not exists teacher_hierarchy_details
(
teacher_id bigint primary key not null,
school_id bigint,
year int,
teacher_designation varchar(100),
nature_of_employment varchar(50),
date_of_joining date,
created_on TIMESTAMP without time zone,
updated_on TIMESTAMP without time zone
-- ,foreign key (school_id) references school_hierarchy_details(school_id)
);
create index if not exists teacher_hierarchy_details_id on teacher_hierarchy_details(school_id,nature_of_employment);
/*teacher_attendance_trans*/
create table if not exists teacher_attendance_trans
(
teacher_id bigint,
school_id bigint,
year int,
month int,
day_1 smallint,
day_2 smallint,
day_3 smallint,
day_4 smallint,
day_5 smallint,
day_6 smallint,
day_7 smallint,
day_8 smallint,
day_9 smallint,
day_10 smallint,
day_11 smallint,
day_12 smallint,
day_13 smallint,
day_14 smallint,
day_15 smallint,
day_16 smallint,
day_17 smallint,
day_18 smallint,
day_19 smallint,
day_20 smallint,
day_21 smallint,
day_22 smallint,
day_23 smallint,
day_24 smallint,
day_25 smallint,
day_26 smallint,
day_27 smallint,
day_28 smallint,
day_29 smallint,
day_30 smallint,
day_31 smallint,
created_on TIMESTAMP without time zone ,
updated_on TIMESTAMP without time zone,
primary key(school_id,month,teacher_id,year)
);
alter table teacher_attendance_trans drop column if exists attendance_id;
alter table teacher_attendance_trans drop constraint if exists teacher_attendance_trans_pkey;
alter table teacher_attendance_trans add primary key(school_id,month,teacher_id,year);
create table if not exists teacher_attendance_temp
(
ff_uuid text,
teacher_id bigint,
school_id bigint,
year int,
month int,
day_1 smallint,
day_2 smallint,
day_3 smallint,
day_4 smallint,
day_5 smallint,
day_6 smallint,
day_7 smallint,
day_8 smallint,
day_9 smallint,
day_10 smallint,
day_11 smallint,
day_12 smallint,
day_13 smallint,
day_14 smallint,
day_15 smallint,
day_16 smallint,
day_17 smallint,
day_18 smallint,
day_19 smallint,
day_20 smallint,
day_21 smallint,
day_22 smallint,
day_23 smallint,
day_24 smallint,
day_25 smallint,
day_26 smallint,
day_27 smallint,
day_28 smallint,
day_29 smallint,
day_30 smallint,
day_31 smallint,
created_on timestamp without time zone,
updated_on timestamp without time zone
);
create table if not exists teacher_attendance_dup
(
ff_uuid text,
teacher_id bigint,
school_id bigint,
year int,
month int,
day_1 smallint,
day_2 smallint,
day_3 smallint,
day_4 smallint,
day_5 smallint,
day_6 smallint,
day_7 smallint,
day_8 smallint,
day_9 smallint,
day_10 smallint,
day_11 smallint,
day_12 smallint,
day_13 smallint,
day_14 smallint,
day_15 smallint,
day_16 smallint,
day_17 smallint,
day_18 smallint,
day_19 smallint,
day_20 smallint,
day_21 smallint,
day_22 smallint,
day_23 smallint,
day_24 smallint,
day_25 smallint,
day_26 smallint,
day_27 smallint,
day_28 smallint,
day_29 smallint,
day_30 smallint,
day_31 smallint,
created_on timestamp without time zone,
updated_on timestamp without time zone
);
create table if not exists teacher_attendance_staging_1
(
ff_uuid text,
teacher_id bigint,
school_id bigint,
year int,
month int,
day_1 smallint,
day_2 smallint,
day_3 smallint,
day_4 smallint,
day_5 smallint,
day_6 smallint,
day_7 smallint,
day_8 smallint,
day_9 smallint,
day_10 smallint,
day_11 smallint,
day_12 smallint,
day_13 smallint,
day_14 smallint,
day_15 smallint,
day_16 smallint,
day_17 smallint,
day_18 smallint,
day_19 smallint,
day_20 smallint,
day_21 smallint,
day_22 smallint,
day_23 smallint,
day_24 smallint,
day_25 smallint,
day_26 smallint,
day_27 smallint,
day_28 smallint,
day_29 smallint,
day_30 smallint,
day_31 smallint,
created_on timestamp without time zone,
updated_on timestamp without time zone
);
create table if not exists teacher_attendance_staging_2
(
ff_uuid text,
teacher_id bigint,
school_id bigint,
year int,
month int,
day_1 smallint,
day_2 smallint,
day_3 smallint,
day_4 smallint,
day_5 smallint,
day_6 smallint,
day_7 smallint,
day_8 smallint,
day_9 smallint,
day_10 smallint,
day_11 smallint,
day_12 smallint,
day_13 smallint,
day_14 smallint,
day_15 smallint,
day_16 smallint,
day_17 smallint,
day_18 smallint,
day_19 smallint,
day_20 smallint,
day_21 smallint,
day_22 smallint,
day_23 smallint,
day_24 smallint,
day_25 smallint,
day_26 smallint,
day_27 smallint,
day_28 smallint,
day_29 smallint,
day_30 smallint,
day_31 smallint,
created_on timestamp without time zone,
updated_on timestamp without time zone
);
/*school_teacher_total_attendance*/
create table if not exists school_teacher_total_attendance
(
id serial,
year int,
month smallint,
school_id bigint,
school_name varchar(200),
school_latitude double precision,
school_longitude double precision,
district_id bigint,
district_name varchar(100),
district_latitude double precision,
district_longitude double precision,
block_id bigint,
block_name varchar(100),
brc_name varchar(100),
block_latitude double precision,
block_longitude double precision,
cluster_id bigint,
cluster_name varchar(100),
crc_name varchar(100),
cluster_latitude double precision,
cluster_longitude double precision,
total_present double precision,
total_working_days int,
teachers_count bigint,
created_on TIMESTAMP without time zone ,
updated_on TIMESTAMP without time zone,
primary key(school_id,month,year)
);
alter table school_teacher_total_attendance add column if not exists school_management_type varchar(100);
alter table school_teacher_total_attendance add column if not exists school_category varchar(100);
create index if not exists school_teacher_total_attendance_id on school_teacher_total_attendance(month,school_id,block_id,cluster_id);
Drop view if exists teacher_attendance_exception_data cascade;
drop view if exists teacher_attendance_agg_last_1_day cascade;
drop view if exists teacher_attendance_agg_last_30_days cascade;
drop view if exists teacher_attendance_agg_last_7_days cascade;
drop view if exists teacher_attendance_agg_overall cascade;
alter table school_teacher_total_attendance drop constraint if exists school_teacher_total_attendance_pkey;
alter table school_teacher_total_attendance add primary key(school_id,month,year);
alter table school_teacher_total_attendance drop COLUMN if exists total_training;
alter table school_teacher_total_attendance drop COLUMN if exists total_halfday;
alter table school_teacher_total_attendance alter COLUMN total_present type double precision;
create table if not exists teacher_attendance_dup
(
teacher_id bigint,
school_id bigint,
year int,
month int,
day_1 smallint,
day_2 smallint,
day_3 smallint,
day_4 smallint,
day_5 smallint,
day_6 smallint,
day_7 smallint,
day_8 smallint,
day_9 smallint,
day_10 smallint,
day_11 smallint,
day_12 smallint,
day_13 smallint,
day_14 smallint,
day_15 smallint,
day_16 smallint,
day_17 smallint,
day_18 smallint,
day_19 smallint,
day_20 smallint,
day_21 smallint,
day_22 smallint,
day_23 smallint,
day_24 smallint,
day_25 smallint,
day_26 smallint,
day_27 smallint,
day_28 smallint,
day_29 smallint,
day_30 smallint,
day_31 smallint,
num_of_times int,
ff_uuid varchar(255),
created_on_file_process timestamp default current_timestamp
);
create table if not exists tch_att_null_col (filename text,ff_uuid text,count_null_teacherid int,
count_null_schoolid int, count_null_AcademicYear int,count_null_Month int, created_on TIMESTAMP without time zone);
create table IF NOT EXISTS teacher_attendance_meta
(
day_1 boolean,day_2 boolean,day_3 boolean,day_4 boolean,day_5 boolean,day_6 boolean,day_7 boolean,day_8 boolean,day_9 boolean,day_10 boolean,
day_11 boolean,day_12 boolean,day_13 boolean,day_14 boolean,day_15 boolean,day_16 boolean,day_17 boolean,day_18 boolean,day_19 boolean,day_20 boolean,
day_21 boolean,day_22 boolean,day_23 boolean,day_24 boolean,day_25 boolean,day_26 boolean,day_27 boolean,day_28 boolean,day_29 boolean,day_30 boolean,
day_31 boolean,month int,year int,primary key(month,year)
);
CREATE OR REPLACE FUNCTION teacher_attendance_refresh(year int,month int)
RETURNS text AS
$$
DECLARE
_col_sql text :='select string_agg(column_name,'','') from (select ''day_1'' as column_name from teacher_attendance_meta where day_1 = True and month= '||month||' and year = '||year||'
UNION
select ''day_2'' as column_name from teacher_attendance_meta where day_2 = True and month= '||month||' and year = '||year||'
UNION
select ''day_3'' as column_name from teacher_attendance_meta where day_3 = True and month= '||month||' and year = '||year||'
UNION
select ''day_4'' as column_name from teacher_attendance_meta where day_4 = True and month= '||month||' and year = '||year||'
UNION
select ''day_5'' as column_name from teacher_attendance_meta where day_5 = True and month= '||month||' and year = '||year||'
UNION
select ''day_6'' as column_name from teacher_attendance_meta where day_6 = True and month= '||month||' and year = '||year||'
UNION
select ''day_7'' as column_name from teacher_attendance_meta where day_7 = True and month= '||month||' and year = '||year||'
UNION
select ''day_8'' as column_name from teacher_attendance_meta where day_8 = True and month= '||month||' and year = '||year||'
UNION
select ''day_9'' as column_name from teacher_attendance_meta where day_9 = True and month= '||month||' and year = '||year||'
UNION
select ''day_10'' as column_name from teacher_attendance_meta where day_10 = True and month= '||month||' and year = '||year||'
UNION
select ''day_11'' as column_name from teacher_attendance_meta where day_11 = True and month= '||month||' and year = '||year||'
UNION
select ''day_12'' as column_name from teacher_attendance_meta where day_12 = True and month= '||month||' and year = '||year||'
UNION
select ''day_13'' as column_name from teacher_attendance_meta where day_13 = True and month= '||month||' and year = '||year||'
UNION
select ''day_14'' as column_name from teacher_attendance_meta where day_14 = True and month= '||month||' and year = '||year||'
UNION
select ''day_15'' as column_name from teacher_attendance_meta where day_15 = True and month= '||month||' and year = '||year||'
UNION
select ''day_16'' as column_name from teacher_attendance_meta where day_16 = True and month= '||month||' and year = '||year||'
UNION
select ''day_17'' as column_name from teacher_attendance_meta where day_17 = True and month= '||month||' and year = '||year||'
UNION
select ''day_18'' as column_name from teacher_attendance_meta where day_18 = True and month= '||month||' and year = '||year||'
UNION
select ''day_19'' as column_name from teacher_attendance_meta where day_19 = True and month= '||month||' and year = '||year||'
UNION
select ''day_20'' as column_name from teacher_attendance_meta where day_20 = True and month= '||month||' and year = '||year||'
UNION
select ''day_21'' as column_name from teacher_attendance_meta where day_21 = True and month= '||month||' and year = '||year||'
UNION
select ''day_22'' as column_name from teacher_attendance_meta where day_22 = True and month= '||month||' and year = '||year||'
UNION
select ''day_23'' as column_name from teacher_attendance_meta where day_23 = True and month= '||month||' and year = '||year||'
UNION
select ''day_24'' as column_name from teacher_attendance_meta where day_24 = True and month= '||month||' and year = '||year||'
UNION
select ''day_25'' as column_name from teacher_attendance_meta where day_25 = True and month= '||month||' and year = '||year||'
UNION
select ''day_26'' as column_name from teacher_attendance_meta where day_26 = True and month= '||month||' and year = '||year||'
UNION
select ''day_27'' as column_name from teacher_attendance_meta where day_27 = True and month= '||month||' and year = '||year||'
UNION
select ''day_28'' as column_name from teacher_attendance_meta where day_28 = True and month= '||month||' and year = '||year||'
UNION
select ''day_29'' as column_name from teacher_attendance_meta where day_29 = True and month= '||month||' and year = '||year||'
UNION
select ''day_30'' as column_name from teacher_attendance_meta where day_30 = True and month= '||month||' and year = '||year||'
UNION
select ''day_31'' as column_name from teacher_attendance_meta where day_31 = True and month= '||month||' and year = '||year||') as col_tab;';
_column text :='';
_sql text:='';
_start_date text:='select (cast('||year||' as varchar)'||'||'||'''-'''||'||'||'cast('||month||' as varchar)'||'||'||'''-01'''||')::date';
start_date date;
l_query text;
r_query text;
c_query text;
d_query text;
res text;
u_query text;
m_query text;
update_query text;
_cols text:='select string_agg(days_to_be_processed'||'||'' ''||'''||'boolean'''||','','') from teacher_attendance_meta_temp where month='||month||' and year='||year;
col_name text;
d_meta text;
us_query text;
cnt_query text;
_count int;
rec_query text;
rec_exists boolean;
error_msg text;
validation text;
validation_res boolean;
BEGIN
validation:='select case when date_part(''month'',CURRENT_DATE)<'||month||' or date_part(''year'',CURRENT_DATE)<'||year||' then True ELSE FALSE END';
EXECUTE validation into validation_res;
IF validation_res=True THEN
return 'Data emitted is future data - it has the data for month '||month||' and year '||year||'';
END IF;
cnt_query:='select count(*) from teacher_attendance_meta where month='||month||' and year='||year;
rec_query:='select EXISTS(select 1 from teacher_attendance_temp where month= '||month||' and year = '||year||')';
EXECUTE rec_query into rec_exists;
EXECUTE cnt_query into _count;
IF rec_exists=False THEN
error_msg:='teacher_attendance_temp table has no records for the month '||month||' and year '||year;
RAISE log 'teacher_attendance_temp table has no records for the month % and year %',month,year;
return error_msg;
END IF;
IF _count = 0 THEN
EXECUTE 'INSERT INTO teacher_attendance_meta(month,year) values('||month||','||year||')';
END IF;
EXECUTE _start_date into start_date;
l_query:='select '||'days_in_a_month.day '||'as processed_date'||','||month||'as month'||','||year||'as year'||', '||'''day_'''||'||'||'date_part('||'''day'''||',days_in_a_month.day) as days_to_be_processed,True as to_run from (select (generate_series('''||start_date||'''::date,('''||start_date||'''::date+'||'''1month'''||'::interval-'||'''1day'''||'::interval)::date,'||'''1day'''||'::interval)::date) as day) as days_in_a_month';
d_query:='drop table if exists teacher_attendance_meta_temp';
EXECUTE d_query;
c_query:='create table if not exists teacher_attendance_meta_temp as '||l_query;
EXECUTE c_query;
m_query:='update teacher_attendance_meta_temp set to_run=False where (extract(dow from processed_date)=0 and month='||month||' and year='||year||')';
update_query:='update teacher_attendance_meta_temp set to_run=False where (processed_date>CURRENT_DATE and month='||month||' and year='||year||')';
EXECUTE m_query;
EXECUTE update_query;
EXECUTE _cols into col_name;
d_meta:='drop table if exists teacher_attendance_meta_stg';
EXECUTE d_meta;
res :='create table if not exists teacher_attendance_meta_stg as select * from crosstab('''||'select month,year,days_to_be_processed,to_run from teacher_attendance_meta_temp order by 1,2'||''','''||'select days_to_be_processed from teacher_attendance_meta_temp'||''') as t('||'month int,year int,'||col_name||')';
EXECUTE res;
u_query:='UPDATE teacher_attendance_meta sam
set day_1 = CASE WHEN day_1 = False THEN
False
ELSE (select day_1 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_2 = CASE WHEN day_2 = False THEN
False
ELSE (select day_2 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_3 = CASE WHEN day_3 = False THEN
False
ELSE (select day_3 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_4 = CASE WHEN day_4 = False THEN
False
ELSE (select day_4 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_5 = CASE WHEN day_5 = False THEN
False
ELSE (select day_5 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_6 = CASE WHEN day_6 = False THEN
False
ELSE (select day_6 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_7 = CASE WHEN day_7 = False THEN
False
ELSE (select day_7 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_8 = CASE WHEN day_8 = False THEN
False
ELSE (select day_8 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_9 = CASE WHEN day_9 = False THEN
False
ELSE (select day_9 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_10 = CASE WHEN day_10 = False THEN
False
ELSE (select day_10 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_11 = CASE WHEN day_11 = False THEN
False
ELSE (select day_11 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_12 = CASE WHEN day_12 = False THEN
False
ELSE (select day_12 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_13 = CASE WHEN day_13 = False THEN
False
ELSE (select day_13 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_14 = CASE WHEN day_14 = False THEN
False
ELSE (select day_14 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_15 = CASE WHEN day_15 = False THEN
False
ELSE (select day_15 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_16 = CASE WHEN day_16 = False THEN
False
ELSE (select day_16 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_17 = CASE WHEN day_17 = False THEN
False
ELSE (select day_17 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_18 = CASE WHEN day_18 = False THEN
False
ELSE (select day_18 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_19 = CASE WHEN day_19 = False THEN
False
ELSE (select day_19 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_20 = CASE WHEN day_20 = False THEN
False
ELSE (select day_20 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_21 = CASE WHEN day_21 = False THEN
False
ELSE (select day_21 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_22 = CASE WHEN day_22 = False THEN
False
ELSE (select day_22 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_23 = CASE WHEN day_23 = False THEN
False
ELSE (select day_23 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_24 = CASE WHEN day_24 = False THEN
False
ELSE (select day_24 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_25 = CASE WHEN day_25 = False THEN
False
ELSE (select day_25 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_26 = CASE WHEN day_26 = False THEN
False
ELSE (select day_26 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_27 = CASE WHEN day_27 = False THEN
False
ELSE (select day_27 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_28 = CASE WHEN day_28 = False THEN
False
ELSE (select day_28 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_29 = CASE WHEN day_29 = False THEN
False
ELSE (select day_29 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_30 = CASE WHEN day_30 = False THEN
False
ELSE (select day_30 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
,day_31 = CASE WHEN day_31 = False THEN
False
ELSE (select day_31 from teacher_attendance_meta_stg where month='||month||' and year='||year||')
END
where
month = '||month||' and
year = '||year;
EXECUTE u_query;
EXECUTE _col_sql into _column;
_sql :=
'WITH s AS (select * from teacher_attendance_temp where teacher_attendance_temp.month='||month||'
and teacher_attendance_temp.year='||year||'),
upd AS (
UPDATE teacher_attendance_trans
set day_1 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_1 = True and month='||month||' and year='||year||') THEN
s.day_1
ELSE teacher_attendance_trans.day_1
END
,day_2 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_2 = True and month='||month||' and year='||year||') THEN
s.day_2
ELSE teacher_attendance_trans.day_2
END
,day_3 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_3 = True and month='||month||' and year='||year||') THEN
s.day_3
ELSE teacher_attendance_trans.day_3
END
,day_4 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_4 = True and month='||month||' and year='||year||') THEN
s.day_4
ELSE teacher_attendance_trans.day_4
END
,day_5 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_5 = True and month='||month||' and year='||year||') THEN
s.day_5
ELSE teacher_attendance_trans.day_5
END
,day_6 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_6 = True and month='||month||' and year='||year||') THEN
s.day_6
ELSE teacher_attendance_trans.day_6
END
,day_7 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_7 = True and month='||month||' and year='||year||') THEN
s.day_7
ELSE teacher_attendance_trans.day_7
END
,day_8 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_8 = True and month='||month||' and year='||year||') THEN
s.day_8
ELSE teacher_attendance_trans.day_8
END
,day_9 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_9 = True and month='||month||' and year='||year||') THEN
s.day_9
ELSE teacher_attendance_trans.day_9
END
,day_10 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_10 = True and month='||month||' and year='||year||') THEN
s.day_10
ELSE teacher_attendance_trans.day_10
END
,day_11 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_11 = True and month='||month||' and year='||year||') THEN
s.day_11
ELSE teacher_attendance_trans.day_11
END
,day_12 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_12 = True and month='||month||' and year='||year||') THEN
s.day_12
ELSE teacher_attendance_trans.day_12
END
,day_13 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_13 = True and month='||month||' and year='||year||') THEN
s.day_13
ELSE teacher_attendance_trans.day_13
END
,day_14 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_14 = True and month='||month||' and year='||year||') THEN
s.day_4
ELSE teacher_attendance_trans.day_14
END
,day_15 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_15 = True and month='||month||' and year='||year||') THEN
s.day_15
ELSE teacher_attendance_trans.day_15
END
,day_16 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_16 = True and month='||month||' and year='||year||') THEN
s.day_16
ELSE teacher_attendance_trans.day_16
END
,day_17 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_17 = True and month='||month||' and year='||year||') THEN
s.day_17
ELSE teacher_attendance_trans.day_17
END
,day_18 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_18 = True and month='||month||' and year='||year||') THEN
s.day_18
ELSE teacher_attendance_trans.day_18
END
,day_19 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_19 = True and month='||month||' and year='||year||') THEN
s.day_19
ELSE teacher_attendance_trans.day_19
END
,day_20 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_20 = True and month='||month||' and year='||year||') THEN
s.day_20
ELSE teacher_attendance_trans.day_20
END
,day_21 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_21 = True and month='||month||' and year='||year||') THEN
s.day_21
ELSE teacher_attendance_trans.day_21
END
,day_22 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_22 = True and month='||month||' and year='||year||') THEN
s.day_22
ELSE teacher_attendance_trans.day_22
END
,day_23 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_23 = True and month='||month||' and year='||year||') THEN
s.day_23
ELSE teacher_attendance_trans.day_23
END
,day_24 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_24 = True and month='||month||' and year='||year||') THEN
s.day_24
ELSE teacher_attendance_trans.day_24
END
,day_25 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_25 = True and month='||month||' and year='||year||') THEN
s.day_25
ELSE teacher_attendance_trans.day_25
END
,day_26 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_26 = True and month='||month||' and year='||year||') THEN
s.day_26
ELSE teacher_attendance_trans.day_26
END
,day_27 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_27 = True and month='||month||' and year='||year||') THEN
s.day_27
ELSE teacher_attendance_trans.day_27
END
,day_28 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_28 = True and month='||month||' and year='||year||') THEN
s.day_28
ELSE teacher_attendance_trans.day_28
END
,day_29 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_29 = True and month='||month||' and year='||year||') THEN
s.day_29
ELSE teacher_attendance_trans.day_29
END
,day_30 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_30 = True and month='||month||' and year='||year||') THEN
s.day_30
ELSE teacher_attendance_trans.day_30
END
,day_31 = CASE WHEN EXISTS (select 1 from teacher_attendance_meta where day_31 = True and month='||month||' and year='||year||') THEN
s.day_31
ELSE teacher_attendance_trans.day_31
END
FROM s
WHERE teacher_attendance_trans.teacher_id = s.teacher_id
and teacher_attendance_trans.month='||month||'
and teacher_attendance_trans.year='||year||'
RETURNING teacher_attendance_trans.teacher_id
) INSERT INTO teacher_attendance_trans(teacher_id,school_id,year,month,'||_column||',created_on,updated_on)
select s.teacher_id,s.school_id,s.year,s.month,'||_column ||',created_on,updated_on
from s
where s.teacher_id not in (select teacher_id from upd)';
us_query := 'UPDATE teacher_attendance_meta sam
set day_1 = CASE WHEN day_1 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_1 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_1
END
,day_2 = CASE WHEN day_2 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_2 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_2
END
,day_3 = CASE WHEN day_3 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_3 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_3
END
,day_4 = CASE WHEN day_4 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_4 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_4
END
,day_5 = CASE WHEN day_5 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_5 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_5
END
,day_6 = CASE WHEN day_6 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_6 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_6
END
,day_7 = CASE WHEN day_7 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_7 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_7
END
,day_8 = CASE WHEN day_8 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_8 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_8
END
,day_9 = CASE WHEN day_9 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_9 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_9
END
,day_10 = CASE WHEN day_10 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_10 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_10
END
,day_11 = CASE WHEN day_11 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_11 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_11
END
,day_12 = CASE WHEN day_12 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_12 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_12
END
,day_13 = CASE WHEN day_13 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_13 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_13
END
,day_14 = CASE WHEN day_14 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_14 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_14
END
,day_15 = CASE WHEN day_15 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_15 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_15
END
,day_16 = CASE WHEN day_16 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_16 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_16
END
,day_17 = CASE WHEN day_17 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_17 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_17
END
,day_18 = CASE WHEN day_18 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_18 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_18
END
,day_19 = CASE WHEN day_19 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_19 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_19
END
,day_20 = CASE WHEN day_20 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_20 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_20
END
,day_21 = CASE WHEN day_21 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_21 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_21
END
,day_22 = CASE WHEN day_22 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_22 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_22
END
,day_23 = CASE WHEN day_23 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_23 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_23
END
,day_24 = CASE WHEN day_24 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_24 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_24
END
,day_25 = CASE WHEN day_25 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_25 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_25
END
,day_26 = CASE WHEN day_26 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_26 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_26
END
,day_27 = CASE WHEN day_27 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_27 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_27
END
,day_28 = CASE WHEN day_28 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_28 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_28
END
,day_29 = CASE WHEN day_29 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_29 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_29
END
,day_30 = CASE WHEN day_30 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_30 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_30
END
,day_31 = CASE WHEN day_31 = False THEN
False
WHEN EXISTS (select 1 from teacher_attendance_trans where day_31 is not null and month='||month||' and year='||year||' limit 1) THEN
False
ELSE sam.day_31
END
where
month = '||month||' and
year = '||year;
IF _column <> '' THEN
EXECUTE _sql;
EXECUTE us_query;
END IF;
return 0;
END;
$$ LANGUAGE plpgsql;
/* Exception tables */
create table if not exists teacher_attendance_exception_agg
(
school_id bigint,
year int,
month int,
school_name varchar(300),
block_id bigint,
block_name varchar(100),
district_id bigint,
district_name varchar(100),
cluster_id bigint,
cluster_name varchar(100),
school_latitude double precision,
school_longitude double precision,
district_latitude double precision,
district_longitude double precision,
block_latitude double precision,
block_longitude double precision,
cluster_latitude double precision,
cluster_longitude double precision,
created_on TIMESTAMP without time zone,
updated_on TIMESTAMP without time zone,
primary key(school_id,month,year));
alter table teacher_attendance_exception_agg add column if not exists school_management_type varchar(100);
alter table teacher_attendance_exception_agg add column if not exists school_category varchar(100);
| 36.282209 | 433 | 0.73016 |
7a4418432af4adc57bc6d6a0506ef7800793fe9d | 150 | sql | SQL | db/seeds.sql | joekazem/burger1_HMK13 | de4e6cefe4b9b9c4144caad6d3203a5a5490860c | [
"Apache-2.0"
] | null | null | null | db/seeds.sql | joekazem/burger1_HMK13 | de4e6cefe4b9b9c4144caad6d3203a5a5490860c | [
"Apache-2.0"
] | null | null | null | db/seeds.sql | joekazem/burger1_HMK13 | de4e6cefe4b9b9c4144caad6d3203a5a5490860c | [
"Apache-2.0"
] | null | null | null | INSERT INTO burgers (burger_name, devoured)
VALUES ("Beef Burger", true), ("Turkey Burger", false), ("Bean Burger", true), ("Dessert Burger", false); | 75 | 105 | 0.7 |
a422875ce50c4cd2a24801f7312cbcb851437dcd | 4,478 | swift | Swift | FluidTabBarController/FluidTabBarController.swift | abdoh476/FluidBottomNavigation-ios | 19101ee96d0a501cdad735c93003326080cb9c9b | [
"MIT"
] | 47 | 2018-07-26T12:17:29.000Z | 2022-01-20T09:32:47.000Z | FluidTabBarController/FluidTabBarController.swift | abdoh476/FluidBottomNavigation-ios | 19101ee96d0a501cdad735c93003326080cb9c9b | [
"MIT"
] | 2 | 2019-10-18T05:03:11.000Z | 2021-03-14T13:00:23.000Z | FluidTabBarController/FluidTabBarController.swift | abdoh476/FluidBottomNavigation-ios | 19101ee96d0a501cdad735c93003326080cb9c9b | [
"MIT"
] | 15 | 2018-07-26T22:08:30.000Z | 2021-07-10T05:11:04.000Z | //
// FluidTabBarController.swift
// FluidTabBarController
//
// Created by Vincent Li on 2017/2/8.
// Copyright (c) 2013-2018 ESTabBarController (https://github.com/eggswift/ESTabBarController)
//
// Modified by Hubert Kuczyński on 09/07/2018.
//
// 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 UIKit
open class FluidTabBarController: UITabBarController {
// MARK: UIViewController lifecycle
open override func viewDidLoad() {
super.viewDidLoad()
let tabBar = { () -> FluidTabBar in
let tabBar = FluidTabBar()
tabBar.delegate = self
tabBar.tabBarController = self
return tabBar
}()
self.setValue(tabBar, forKey: "tabBar")
}
// MARK: Public properties
open override var selectedViewController: UIViewController? {
willSet {
guard let newValue = newValue else {
return
}
guard !ignoreNextSelection else {
ignoreNextSelection = false
return
}
guard
let tabBar = self.tabBar as? FluidTabBar,
let items = tabBar.items,
let index = viewControllers?.index(of: newValue)
else { return }
let value = (FluidTabBarController.isShowingMore(self) && index > items.count - 1) ? items.count - 1 : index
tabBar.select(itemAtIndex: value, animated: false)
}
}
open override var selectedIndex: Int {
willSet {
guard !ignoreNextSelection else {
ignoreNextSelection = false
return
}
guard let tabBar = self.tabBar as? FluidTabBar, let items = tabBar.items else {
return
}
let value = (FluidTabBarController.isShowingMore(self) && newValue > items.count - 1) ? items.count - 1 : newValue
tabBar.select(itemAtIndex: value, animated: false)
}
}
// MARK: Private properties
fileprivate var ignoreNextSelection = false
// MARK: Public functions
open static func isShowingMore(_ tabBarController: UITabBarController?) -> Bool {
return tabBarController?.moreNavigationController.parent != nil
}
open override func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) {
guard let idx = tabBar.items?.index(of: item) else {
return
}
if idx == tabBar.items!.count - 1, FluidTabBarController.isShowingMore(self) {
ignoreNextSelection = true
selectedViewController = moreNavigationController
return;
}
if let vc = viewControllers?[idx] {
ignoreNextSelection = true
selectedIndex = idx
delegate?.tabBarController?(self, didSelect: vc)
}
}
open override func setViewControllers(_ viewControllers: [UIViewController]?, animated: Bool) {
super.setViewControllers(viewControllers, animated: animated)
// Changing the order of view controllers is not supported
customizableViewControllers = nil
}
open func tabBar(_ tabBar: UITabBar, shouldSelect item: UITabBarItem) -> Bool {
if let idx = tabBar.items?.index(of: item), let vc = viewControllers?[idx] {
return delegate?.tabBarController?(self, shouldSelect: vc) ?? true
}
return true
}
}
| 37.316667 | 126 | 0.642698 |
e7603bc4a2407c6ac1fabc52caeaae613bd1556d | 4,675 | kt | Kotlin | clients/android-new/smas/src/main/java/cy/ac/ucy/cs/anyplace/smas/viewmodel/util/nw/LocationSendNW.kt | AthinaHc/anyplace | 72b8e4afd5703ac6f218c06e2ff981c0b529a989 | [
"MIT"
] | null | null | null | clients/android-new/smas/src/main/java/cy/ac/ucy/cs/anyplace/smas/viewmodel/util/nw/LocationSendNW.kt | AthinaHc/anyplace | 72b8e4afd5703ac6f218c06e2ff981c0b529a989 | [
"MIT"
] | null | null | null | clients/android-new/smas/src/main/java/cy/ac/ucy/cs/anyplace/smas/viewmodel/util/nw/LocationSendNW.kt | AthinaHc/anyplace | 72b8e4afd5703ac6f218c06e2ff981c0b529a989 | [
"MIT"
] | null | null | null | package cy.ac.ucy.cs.anyplace.smas.viewmodel.util.nw
import android.widget.Toast
import androidx.lifecycle.viewModelScope
import com.google.android.gms.maps.model.LatLng
import cy.ac.ucy.cs.anyplace.lib.android.utils.LOG
import cy.ac.ucy.cs.anyplace.lib.android.extensions.TAG
import cy.ac.ucy.cs.anyplace.lib.android.utils.utlTime
import cy.ac.ucy.cs.anyplace.lib.models.UserCoordinates
import cy.ac.ucy.cs.anyplace.lib.network.NetworkResult
import cy.ac.ucy.cs.anyplace.smas.SmasApp
import cy.ac.ucy.cs.anyplace.smas.consts.CHAT
import cy.ac.ucy.cs.anyplace.smas.data.RepoChat
import cy.ac.ucy.cs.anyplace.smas.data.models.ChatUser
import cy.ac.ucy.cs.anyplace.smas.data.models.LocationSendReq
import cy.ac.ucy.cs.anyplace.smas.data.models.LocationSendResp
import cy.ac.ucy.cs.anyplace.smas.data.models.SmasErrors
import cy.ac.ucy.cs.anyplace.smas.data.source.RetrofitHolderChat
import cy.ac.ucy.cs.anyplace.smas.viewmodel.SmasMainViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
import retrofit2.Response
import java.lang.Exception
import java.net.ConnectException
/**
* Manages Location fetching of other users
*/
class LocationSendNW(
private val app: SmasApp,
private val VM: SmasMainViewModel,
private val RH: RetrofitHolderChat,
private val repo: RepoChat) {
companion object {
val TEST_COORDS = LatLng(57.69579631991111, 11.913666007922222)
}
enum class Mode {
normal,
alert,
}
private val err by lazy { SmasErrors(app, VM.viewModelScope) }
/** Network Responses from API calls */
private val resp: MutableStateFlow<NetworkResult<LocationSendResp>> = MutableStateFlow(NetworkResult.Unset())
/** whether the user is issuing an alert or not */
val mode: MutableStateFlow<Mode> = MutableStateFlow(Mode.normal)
fun alerting() = mode.value == Mode.alert
private fun getAlertFlag(): Int {
return when (mode.value) {
Mode.alert -> 1
Mode.normal -> 0
}
}
private val C by lazy { CHAT(app.applicationContext) }
private lateinit var chatUser : ChatUser
/** Send the [Chatuser]'s location (safecall) */
suspend fun safeCall(userCoords: UserCoordinates) {
chatUser = app.dsChatUser.readUser.first()
LOG.D4(TAG, "Session: ${chatUser.uid} ${chatUser.sessionkey}")
resp.value = NetworkResult.Unset()
resp.value = NetworkResult.Loading()
if (app.hasInternet()) {
try {
val req= LocationSendReq(chatUser, getAlertFlag(), userCoords, utlTime.epoch().toString())
LOG.D3(TAG, "LocSend: ${req.time}: tp: ${mode.value} deck: ${req.deck}: x:${req.x} y:${req.y}")
val response = repo.remote.locationSend(req)
LOG.D4(TAG, "LocationSend: Resp: ${response.message()}" )
resp.value = handleResponse(response)
} catch(ce: ConnectException) {
val msg = "Connection failed:\n${RH.retrofit.baseUrl()}"
handleException(msg, ce)
} catch(e: Exception) {
val msg = "$TAG: Not Found." + "\nURL: ${RH.retrofit.baseUrl()}"
handleException(msg, e)
}
} else {
resp.value = NetworkResult.Error(C.ERR_MSG_NO_INTERNET)
}
}
private fun handleResponse(resp: Response<LocationSendResp>): NetworkResult<LocationSendResp> {
LOG.D3(TAG, "handleResponse")
if(resp.isSuccessful) {
when {
resp.message().toString().contains("timeout") -> return NetworkResult.Error("Timeout.")
resp.isSuccessful -> {
// SMAS special handling (errors should not be 200/OK)
val r = resp.body()!!
if (r.status == "err") {
return NetworkResult.Error(r.descr)
}
return NetworkResult.Success(r)
} // can be nullable
else -> return NetworkResult.Error(resp.message())
}
}
return NetworkResult.Error("$TAG: ${resp.message()}")
}
private fun handleException(msg: String, e: Exception) {
resp.value = NetworkResult.Error(msg)
LOG.E(TAG, msg)
LOG.E(TAG, e)
}
// TODO: make icons gray.. if time delay......
// TODO: show initials in icons....... (don't commit..)
// TODO: model.. UCY
suspend fun collect() {
resp.collect {
when (it) {
is NetworkResult.Success -> {
LOG.D4(TAG, "LocationSend: ${it.data?.status}")
}
is NetworkResult.Error -> {
if (!err.handle(app, it.message, "loc-send")) {
val msg = it.message ?: "unspecified error"
VM.viewModelScope.launch {
app.showToast(msg, Toast.LENGTH_SHORT)
}
}
}
else -> {}
}
}
}
}
| 32.922535 | 111 | 0.665668 |
4c1548665d9e931147b2d37e356a2d48a2f03e1e | 221 | php | PHP | src/Behavioral/Mediator/MediatorInterface.php | codacy-badger/php-design-patterns | 9f7864bde021e5f344a5ddd011555cdbc536caf8 | [
"MIT"
] | 3 | 2019-04-18T07:27:33.000Z | 2020-01-06T01:35:32.000Z | src/Behavioral/Mediator/MediatorInterface.php | codacy-badger/php-design-patterns | 9f7864bde021e5f344a5ddd011555cdbc536caf8 | [
"MIT"
] | 1 | 2019-04-30T10:32:20.000Z | 2019-04-30T10:32:20.000Z | src/Behavioral/Mediator/MediatorInterface.php | codacy-badger/php-design-patterns | 9f7864bde021e5f344a5ddd011555cdbc536caf8 | [
"MIT"
] | 2 | 2017-11-26T23:55:58.000Z | 2018-08-26T11:42:02.000Z | <?php
declare(strict_types=1);
namespace DesignPattern\Behavioral\Mediator;
interface MediatorInterface
{
public function sendRequest();
public function query();
public function recvResponse($content);
}
| 14.733333 | 44 | 0.751131 |
6b54b0070a2b66e73589243f79e123659dc22fc6 | 2,661 | rs | Rust | src/interpreter/library/keys/key_chord/key_chord_to_list.rs | emirayka/nia_interpreter_core | 8b212e44fdede3d49cd75eddb255091a1d67b0e5 | [
"MIT"
] | null | null | null | src/interpreter/library/keys/key_chord/key_chord_to_list.rs | emirayka/nia_interpreter_core | 8b212e44fdede3d49cd75eddb255091a1d67b0e5 | [
"MIT"
] | null | null | null | src/interpreter/library/keys/key_chord/key_chord_to_list.rs | emirayka/nia_interpreter_core | 8b212e44fdede3d49cd75eddb255091a1d67b0e5 | [
"MIT"
] | null | null | null | use crate::interpreter::interpreter::Interpreter;
use crate::interpreter::value::Value;
use crate::library;
use crate::KeyChord;
pub fn key_chord_to_list(
interpreter: &mut Interpreter,
key_chord: &KeyChord,
) -> Value {
let mut vector = Vec::new();
for modifier in key_chord.get_modifiers() {
let list = library::key_to_list(interpreter, *modifier);
vector.push(list);
}
let list = library::key_to_list(interpreter, key_chord.get_key());
vector.push(list);
interpreter.vec_to_list(vector)
}
#[cfg(test)]
mod tests {
use super::*;
#[allow(unused_imports)]
use nia_basic_assertions::*;
#[allow(unused_imports)]
use crate::utils;
use crate::KeyChord;
fn assert_returns_correct_list(s: &str, key_chord: KeyChord) {
let mut interpreter = Interpreter::new();
let expected = interpreter.execute_in_main_environment(s).unwrap();
let result = key_chord_to_list(&mut interpreter, &key_chord);
utils::assert_deep_equal(&mut interpreter, expected, result);
}
#[test]
fn constructs_correct_list_from_key_chord() {
let specs = vec![
(
"'(0 2 4)",
KeyChord::new(vec![nia_key!(0), nia_key!(2)], nia_key!(4)),
),
(
"'(0 2 (4 5))",
KeyChord::new(vec![nia_key!(0), nia_key!(2)], nia_key!(4, 5)),
),
(
"'(0 (2 3) 4)",
KeyChord::new(vec![nia_key!(0), nia_key!(2, 3)], nia_key!(4)),
),
(
"'(0 (2 3) (4 5))",
KeyChord::new(
vec![nia_key!(0), nia_key!(2, 3)],
nia_key!(4, 5),
),
),
(
"'((0 1) 2 4)",
KeyChord::new(vec![nia_key!(0, 1), nia_key!(2)], nia_key!(4)),
),
(
"'((0 1) 2 (4 5))",
KeyChord::new(
vec![nia_key!(0, 1), nia_key!(2)],
nia_key!(4, 5),
),
),
(
"'((0 1) (2 3) 4)",
KeyChord::new(
vec![nia_key!(0, 1), nia_key!(2, 3)],
nia_key!(4),
),
),
(
"'((0 1) (2 3) (4 5))",
KeyChord::new(
vec![nia_key!(0, 1), nia_key!(2, 3)],
nia_key!(4, 5),
),
),
];
for spec in specs {
assert_returns_correct_list(spec.0, spec.1);
}
}
}
| 26.61 | 78 | 0.444194 |
0bf70afe84c315084a26813766a559d2463df727 | 2,823 | js | JavaScript | react-ui/src/utils/i18n.js | osstotalsoft/atlas | a9d573c07f5978a224e4b4fea5c3d2a2624cdc3c | [
"MIT"
] | 7 | 2021-09-04T04:38:56.000Z | 2021-12-27T21:20:15.000Z | react-ui/src/utils/i18n.js | osstotalsoft/atlas | a9d573c07f5978a224e4b4fea5c3d2a2624cdc3c | [
"MIT"
] | null | null | null | react-ui/src/utils/i18n.js | osstotalsoft/atlas | a9d573c07f5978a224e4b4fea5c3d2a2624cdc3c | [
"MIT"
] | null | null | null | import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
import Backend from 'i18next-xhr-backend'
import LanguageDetector from 'i18next-browser-languagedetector'
import moment from 'moment'
import 'moment/locale/ro.js'
i18n
.use(Backend)
.use(LanguageDetector)
.use(initReactI18next)
.init(
{
fallbackLng: 'en',
// have a common namespace used around the full app
ns: ['translations'],
defaultNS: 'translations',
debug: true,
interpolation: {
format: function (value, format, lng) {
if (format === 'uppercase') return value.toUpperCase()
if (format === 'intlDate') {
if (value && moment(value).isValid()) {
return moment(value).format('L')
}
return ''
}
if (format === 'intlLongDate') {
if (value && moment(value).isValid()) {
return moment(value).format('LLLL')
}
return ''
}
if (format === 'intlTimeFromX') {
if (value && moment(value.start).isValid()) {
let startDate = moment(value.start)
let endDate = moment(value.end)
return moment(endDate).from(startDate, true)
}
return ''
}
if (format === 'intlHoursFromX') {
if (value && moment(value.start).isValid()) {
let startDate = moment(value.start)
let endDate = moment(value.end)
let span = moment.duration(endDate - startDate)
return `${parseInt(span.asHours(), 10)}h ${parseInt(span.asMinutes() % 60, 10)}m`
}
return ''
}
if (format === 'intlNumber') return new Intl.NumberFormat(lng).format(value)
if (format === 'intlDecimal') return new Intl.NumberFormat(lng, { minimumFractionDigits: 2 }).format(value)
if (format === 'intlDecimal2')
return new Intl.NumberFormat(lng, { minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(value)
//dateformat
if (value && value.format) {
if (value.value && moment(value).isValid()) {
return moment(value.value).format(value.format)
}
return ''
}
return value
}
},
react: {
wait: true,
usePureComponent: true
},
backend: {
loadPath: '/static/locales/{{lng}}/{{ns}}.json'
}
},
() => {
let currentLang = i18n.language
if (!currentLang || !currentLang.startsWith('ro')) {
i18n.changeLanguage('en')
} else {
i18n.changeLanguage('ro')
}
}
)
i18n.on('languageChanged', function (lng) {
moment.locale(lng)
})
export default i18n
| 28.23 | 117 | 0.536663 |
402be1cc76c21d1ea8ee86acb964f226eff14473 | 1,467 | py | Python | herd-code/herd-tools/herd-content-loader/setup.py | hoppinghol/herd | e51c056fcc43d9f146aa7de9036a5a1baf8718ac | [
"Apache-2.0"
] | null | null | null | herd-code/herd-tools/herd-content-loader/setup.py | hoppinghol/herd | e51c056fcc43d9f146aa7de9036a5a1baf8718ac | [
"Apache-2.0"
] | null | null | null | herd-code/herd-tools/herd-content-loader/setup.py | hoppinghol/herd | e51c056fcc43d9f146aa7de9036a5a1baf8718ac | [
"Apache-2.0"
] | null | null | null | """
Copyright 2015 herd contributors
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.
"""
"""
herdcontentloader
The herd data management module for populating content to UDC
"""
from setuptools import setup, find_packages
# To install the library, run the following
#
# python setup.py install
#
# prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools
setup(
name="herdcl",
version="@@Version@@",
description="herd data management",
maintainer="FINRA",
maintainer_email="herd@finra.org",
license="http://www.apache.org/licenses/LICENSE-2.0",
url="https://github.com/FINRAOS/herd",
keywords=["herd", "dm"],
install_requires=[
"herdsdk", "numpy >= 1.17.0", "pandas >= 0.24.0", "boto3 >= 1.9.50", "xlrd >= 1.1.0", "xlsxwriter >= 1.1.0"
],
packages=find_packages(),
include_package_data=True,
long_description="""\
The herd data management module for populating content to UDC
"""
)
| 29.938776 | 115 | 0.699387 |
e9997c24b779d477ca01e569408227990fdb80c5 | 11,528 | go | Go | pkg/multicluster/register/helpers.go | solo-io/skv2 | a7d0c83004bb24051a91e35fca7d04d788967f17 | [
"Apache-2.0"
] | 16 | 2020-04-12T18:36:23.000Z | 2021-10-05T16:09:47.000Z | pkg/multicluster/register/helpers.go | solo-io/skv2 | a7d0c83004bb24051a91e35fca7d04d788967f17 | [
"Apache-2.0"
] | 282 | 2020-04-16T14:18:45.000Z | 2022-02-17T23:27:45.000Z | pkg/multicluster/register/helpers.go | solo-io/skv2 | a7d0c83004bb24051a91e35fca7d04d788967f17 | [
"Apache-2.0"
] | 5 | 2021-02-17T18:22:36.000Z | 2021-10-05T16:09:48.000Z | package register
import (
"context"
"os"
"github.com/hashicorp/go-multierror"
"github.com/rotisserie/eris"
"github.com/solo-io/skv2/pkg/api/multicluster.solo.io/v1alpha1"
v1alpha1_providers "github.com/solo-io/skv2/pkg/api/multicluster.solo.io/v1alpha1/providers"
k8s_rbac_types "k8s.io/api/rbac/v1"
"k8s.io/client-go/rest"
k8s_core_v1 "github.com/solo-io/skv2/pkg/multicluster/internal/k8s/core/v1"
k8s_core_v1_providers "github.com/solo-io/skv2/pkg/multicluster/internal/k8s/core/v1/providers"
rbac_v1_providers "github.com/solo-io/skv2/pkg/multicluster/internal/k8s/rbac.authorization.k8s.io/v1/providers"
"k8s.io/client-go/tools/clientcmd"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/config"
)
// Options for registering and deregistering a cluster
type RegistrationOptions struct {
// Management kubeconfig
KubeCfg clientcmd.ClientConfig
// Remote kubeconfig
RemoteKubeCfg clientcmd.ClientConfig
// Remote context name
// We need to explicitly pass this because of this open issue: https://github.com/kubernetes/client-go/issues/735
RemoteCtx string
// localAPIServerAddress is optional. When passed in, it will overwrite the Api Server endpoint in
// the kubeconfig before it is written. This is primarily useful when running multi cluster KinD environments
// on a mac as the local IP needs to be re-written to `host.docker.internal` so that the local instance
// knows to hit localhost.
APIServerAddress string
// Name by which the cluster will be identified. Must not contain '.'
// If left empty will return error
ClusterName string
// Namespace to write namespaced resources to in the "management" cluster
// If left empty will return error
Namespace string
// Namespace to write namespaced resources to in the "remote" cluster
// If left empty will return error
RemoteNamespace string
// The Cluster Domain used by the Kubernetes DNS Service in the registered cluster.
// Defaults to 'cluster.local'
// Read more: https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/
ClusterDomain string
// A list of roles to bind the New kubeconfig token to
// Any Roles in this list will be Upserted by the registrant, prior to binding
Roles []*k8s_rbac_types.Role
// A list of cluster roles to bind the New kubeconfig token to
// Any ClusterRoles in this list will be Upserted by the registrant, prior to binding
ClusterRoles []*k8s_rbac_types.ClusterRole
// List of roles which will be bound to by the created role bindings
// The Roles upserted from the above list will automatically appended
RoleBindings []client.ObjectKey
// List of cluster roles which will be bound to by the created cluster role bindings
// The ClusterRoles upserted from the above list will automatically appended to the list
ClusterRoleBindings []client.ObjectKey
// Set of labels to include on the registration output resources, currently consisting of KubernetesCluster and Secret.
ResourceLabels map[string]string
// Set to true if the remote cluster no longer exists (e.g. was deleted).
// If true, deregistration will not attempt to delete registration resources on the remote cluster.
RemoteClusterDeleted bool
}
/*
RegisterCluster is meant to be a helper function to easily "register" a remote cluster.
Currently this entails:
1. Creating a `ServiceAccount` on the remote cluster.
2. Binding RBAC `Roles/ClusterRoles` to said `ServiceAccount`
3. And finally creating a kubeconfig `Secret` with the BearerToken of the remote `ServiceAccount`
*/
func (opts RegistrationOptions) RegisterCluster(
ctx context.Context,
) error {
return opts.RegisterProviderCluster(ctx, nil)
}
/*
RegisterProviderCluster augments RegisterCluster functionality
with additional metadata to persist to the resulting KubernetesCluster object.
ProviderInfo contains cloud provider metadata.
*/
func (opts RegistrationOptions) RegisterProviderCluster(
ctx context.Context,
providerInfo *v1alpha1.KubernetesClusterSpec_ProviderInfo,
) error {
mgmtRestCfg, remoteCfg, registrationOpts, registrant, err := opts.initialize(providerInfo)
if err != nil {
return err
}
return RegisterClusterFromConfig(
ctx,
mgmtRestCfg,
remoteCfg,
registrationOpts,
registrant,
)
}
/*
DeregisterCluster deregisters a cluster by cleaning up the resources created when RegisterCluster is invoked.
This entails:
1. Deleting the ServiceAccount on the remote cluster.
2. Deleting the remote Roles, RoleBindings, ClusterRoles, and ClusterRoleBindings associated with the ServiceAccount.
3. Deletes the secret containing the kubeconfig for the remote cluster.
*/
func (opts RegistrationOptions) DeregisterCluster(
ctx context.Context,
) error {
mgmtRestCfg, remoteCfg, registrationOpts, registrant, err := opts.initialize(nil)
if err != nil {
return err
}
return DeregisterClusterFromConfig(ctx, mgmtRestCfg, remoteCfg, registrationOpts, registrant)
}
// Initialize registration dependencies
func (opts RegistrationOptions) initialize(
providerInfo *v1alpha1.KubernetesClusterSpec_ProviderInfo,
) (mgmtRestCfg *rest.Config, remoteCfg clientcmd.ClientConfig, registrationOpts Options, registrant ClusterRegistrant, err error) {
if opts.KubeCfg == nil || opts.RemoteKubeCfg == nil {
return mgmtRestCfg, remoteCfg, registrationOpts, registrant, eris.New("must pass in both kubecfg and remoteKubeCfg")
}
mgmtRestCfg, err = opts.KubeCfg.ClientConfig()
if err != nil {
return mgmtRestCfg, remoteCfg, registrationOpts, registrant, err
}
remoteCfg = opts.RemoteKubeCfg
registrant, err = defaultRegistrant(mgmtRestCfg, opts.APIServerAddress)
if err != nil {
return mgmtRestCfg, remoteCfg, registrationOpts, registrant, err
}
rolePolicyRules, clusterRolePolicyRules := collectPolicyRules(opts.Roles, opts.ClusterRoles)
registrationOpts = Options{
ClusterName: opts.ClusterName,
Namespace: opts.Namespace,
RemoteCtx: opts.RemoteCtx,
RemoteNamespace: opts.RemoteNamespace,
ClusterDomain: opts.ClusterDomain,
RemoteClusterDeleted: opts.RemoteClusterDeleted,
RbacOptions: RbacOptions{
Roles: opts.Roles,
ClusterRoles: opts.ClusterRoles,
RoleBindings: opts.RoleBindings,
ClusterRoleBindings: opts.ClusterRoleBindings,
},
RegistrationMetadata: RegistrationMetadata{
ProviderInfo: providerInfo,
ResourceLabels: opts.ResourceLabels,
RolePolicyRules: rolePolicyRules,
ClusterRolePolicyRules: clusterRolePolicyRules,
},
}
if err = (®istrationOpts).validate(); err != nil {
return nil, nil, Options{}, nil, err
}
return mgmtRestCfg, remoteCfg, registrationOpts, registrant, nil
}
// Iterate Roles and ClusterRoles to collect set of PolicyRules for each.
func collectPolicyRules(
roles []*k8s_rbac_types.Role,
clusterRoles []*k8s_rbac_types.ClusterRole,
) (rolePolicyRules []*v1alpha1.PolicyRule, clusterRolePolicyRules []*v1alpha1.PolicyRule) {
for _, role := range roles {
for _, policyRules := range role.Rules {
rolePolicyRules = append(rolePolicyRules, &v1alpha1.PolicyRule{
Verbs: policyRules.Verbs,
ApiGroups: policyRules.APIGroups,
Resources: policyRules.Resources,
ResourceNames: policyRules.ResourceNames,
NonResourceUrls: policyRules.NonResourceURLs,
})
}
}
for _, clusterRole := range clusterRoles {
for _, policyRules := range clusterRole.Rules {
clusterRolePolicyRules = append(clusterRolePolicyRules, &v1alpha1.PolicyRule{
Verbs: policyRules.Verbs,
ApiGroups: policyRules.APIGroups,
Resources: policyRules.Resources,
ResourceNames: policyRules.ResourceNames,
NonResourceUrls: policyRules.NonResourceURLs,
})
}
}
return rolePolicyRules, clusterRolePolicyRules
}
func RegisterClusterFromConfig(
ctx context.Context,
mgmtClusterCfg *rest.Config,
remoteCfg clientcmd.ClientConfig,
opts Options,
registrant ClusterRegistrant,
) error {
err := registrant.EnsureRemoteNamespace(ctx, remoteCfg, opts.RemoteNamespace)
if err != nil {
return err
}
sa, err := registrant.EnsureRemoteServiceAccount(ctx, remoteCfg, opts)
if err != nil {
return err
}
token, err := registrant.CreateRemoteAccessToken(
ctx,
remoteCfg,
client.ObjectKey{
Namespace: sa.GetNamespace(),
Name: sa.GetName(),
},
opts)
if err != nil {
return err
}
return registrant.RegisterClusterWithToken(
ctx,
mgmtClusterCfg,
remoteCfg,
token,
opts,
)
}
func DeregisterClusterFromConfig(
ctx context.Context,
mgmtClusterCfg *rest.Config,
remoteCfg clientcmd.ClientConfig,
opts Options,
registrant ClusterRegistrant,
) error {
var multierr *multierror.Error
if err := registrant.DeregisterCluster(ctx, mgmtClusterCfg, opts); err != nil {
multierr = multierror.Append(multierr, err)
}
// Do not attempt to delete remote registration resources if remote cluster no longer exists.
if opts.RemoteClusterDeleted {
return multierr.ErrorOrNil()
}
if err := registrant.DeleteRemoteServiceAccount(ctx, remoteCfg, opts); err != nil {
multierr = multierror.Append(multierr, err)
}
if err := registrant.DeleteRemoteAccessResources(ctx, remoteCfg, opts); err != nil {
multierr = multierror.Append(multierr, err)
}
return multierr.ErrorOrNil()
}
/*
DefaultRegistrant provider function. This function will create a `ClusterRegistrant` using the
current kubeconfig, and the specified context. It will build all of the dependencies from the
available `ClientConfig`.
The apiServerAddress parameter is optional. When passed in, it will overwrite the Api Server
endpoint in the kubeconfig before it is written. This is primarily useful when running multi cluster
KinD environments on a mac as the local IP needs to be re-written to `host.docker.internal` so
that the local instance knows to hit localhost.
Meant to be used in tandem with RegisterClusterFromConfig above.
They are exposed separately so the `Registrant` may be mocked for the function above.
*/
func DefaultRegistrant(context, apiServerAddress string) (ClusterRegistrant, error) {
cfg, err := config.GetConfigWithContext(context)
if err != nil {
return nil, err
}
return defaultRegistrant(cfg, apiServerAddress)
}
func defaultRegistrant(cfg *rest.Config, apiServerAddress string) (ClusterRegistrant, error) {
clientset, err := k8s_core_v1.NewClientsetFromConfig(cfg)
if err != nil {
return nil, err
}
nsClientFactory := k8s_core_v1_providers.NamespaceClientFromConfigFactoryProvider()
secretClientFactory := k8s_core_v1_providers.SecretClientFromConfigFactoryProvider()
saClientFactory := k8s_core_v1_providers.ServiceAccountClientFromConfigFactoryProvider()
roleClientFactory := rbac_v1_providers.RoleClientFromConfigFactoryProvider()
clusterRoleClientFactory := rbac_v1_providers.ClusterRoleClientFromConfigFactoryProvider()
kubeClusterClientFactory := v1alpha1_providers.KubernetesClusterClientFromConfigFactoryProvider()
clusterRBACBinderFactory := NewClusterRBACBinderFactory()
registrant := NewClusterRegistrant(
apiServerAddress,
clusterRBACBinderFactory,
clientset.Secrets(),
secretClientFactory,
nsClientFactory,
saClientFactory,
clusterRoleClientFactory,
roleClientFactory,
kubeClusterClientFactory,
)
return registrant, nil
}
// expects `path` to be nonempty
func assertKubeConfigExists(path string) error {
if _, err := os.Stat(path); err != nil {
return err
}
return nil
}
| 34.106509 | 131 | 0.770385 |
98915bc600c15f8419014932b43e42db5460c711 | 1,334 | xhtml | HTML | axbook/chapter-contents-9.69-82.xhtml | alfredoport/jyperdoc | ea4578da90a259ff4bf02e734530d304a594e139 | [
"BSD-3-Clause"
] | null | null | null | axbook/chapter-contents-9.69-82.xhtml | alfredoport/jyperdoc | ea4578da90a259ff4bf02e734530d304a594e139 | [
"BSD-3-Clause"
] | null | null | null | axbook/chapter-contents-9.69-82.xhtml | alfredoport/jyperdoc | ea4578da90a259ff4bf02e734530d304a594e139 | [
"BSD-3-Clause"
] | null | null | null | <?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
"http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [
<!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xlink="http://www.w3.org/1999/xlink" >
<head>
<title>Chapter9.69-82</title>
<link rel="stylesheet" type="text/css" href="graphicstyle.css" />
<script type="text/javascript" src="bookax1.js" />
</head>
<body>
<h3>Chapter 9.69-82: Some Examples of Domains and Packages</h3>
<a href="section-9.69.xhtml">9.69 Segment</a><br/>
<a href="section-9.70.xhtml">9.70 SegmentBinding</a><br/>
<a href="section-9.71.xhtml">9.71 Set</a><br/>
<a href="section-9.72.xhtml">9.72 SingleInteger</a><br/>
<a href="section-9.73.xhtml">9.73 SparseTable</a><br/>
<a href="section-9.74.xhtml">9.74 SquareMatrix</a><br/>
<a href="section-9.75.xhtml">9.75 SquareFreeRegularTriangularSet</a><br/>
<a href="section-9.76.xhtml">9.76 Stream</a><br/>
<a href="section-9.77.xhtml">9.77 String</a><br/>
<a href="section-9.78.xhtml">9.78 StringTable</a><br/>
<a href="section-9.79.xhtml">9.79 Symbol</a><br/>
<a href="section-9.80.xhtml">9.80 Table</a><br/>
<a href="section-9.81.xhtml">9.81 TextFile</a><br/>
<a href="section-9.82.xhtml">9.82 TwoDimensionalArray</a><br/>
</body>
</html> | 38.114286 | 73 | 0.661169 |
7a6bfbaf1d708d662058c8e55e1fa9a510b2d89c | 3,436 | rs | Rust | src/lib.rs | vijaykiran/gobbledygit | 6fc6d14bfa1e1c23100565eba070ea368e7f1383 | [
"MIT",
"Unlicense"
] | 2 | 2019-10-02T09:31:20.000Z | 2019-10-03T18:24:44.000Z | src/lib.rs | vijaykiran/gobbledygit | 6fc6d14bfa1e1c23100565eba070ea368e7f1383 | [
"MIT",
"Unlicense"
] | null | null | null | src/lib.rs | vijaykiran/gobbledygit | 6fc6d14bfa1e1c23100565eba070ea368e7f1383 | [
"MIT",
"Unlicense"
] | null | null | null | use core::fmt;
use git2::{ErrorCode, Repository, RepositoryOpenFlags, Status, Statuses};
use std::fmt::{Error, Formatter};
use std::path::Path;
struct GitStatus {
new: i32,
modified: i32,
deleted: i32,
renamed: i32,
type_changed: i32,
conflicted: i32,
}
impl fmt::Display for GitStatus {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error> {
let mut fmt_string = String::new();
// TODO: Too much duplication, refactor this into a impl fn?
if self.new != 0 {
fmt_string.push_str(format!("{}A", self.new).as_str())
}
if self.modified != 0 {
fmt_string.push_str(format!("{}M", self.modified).as_str())
}
if self.deleted != 0 {
fmt_string.push_str(format!("{}D", self.deleted).as_str())
}
if self.renamed != 0 {
fmt_string.push_str(format!("{}R", self.renamed).as_str())
}
if self.type_changed != 0 {
fmt_string.push_str(format!("{}T", self.type_changed).as_str())
}
if self.conflicted != 0 {
fmt_string.push_str(format!("{}C", self.conflicted).as_str())
}
write!(f, "{}", fmt_string)
}
}
pub fn repo() -> Option<Repository> {
let open_flags = RepositoryOpenFlags::all();
let paths: [&Path; 0] = []; //Empty path that doesn't need to be
match Repository::open_ext(".", open_flags, paths.iter()) {
Ok(repo) => Some(repo),
Err(_e) => None,
}
}
pub fn head_status(repo: &Repository) -> String {
let head = match repo.head() {
Ok(head) => Some(head),
Err(ref e) if e.code() == ErrorCode::UnbornBranch || e.code() == ErrorCode::NotFound => {
None
}
Err(_e) => None,
};
head.as_ref()
.and_then(|r| r.shorthand())
.unwrap_or("HEAD")
.to_string()
}
pub fn status(repo: &Repository) -> String {
let result = repo.statuses(None);
match result.as_ref() {
Ok(statuses) => format!("{}", git_status(statuses)),
Err(_e) => format!(""),
}
}
fn git_status(statuses: &Statuses) -> GitStatus {
//TODO: Currently combines both index and working tree status. Separate them
let mut new = 0;
let mut modified = 0;
let mut renamed = 0;
let mut deleted = 0;
let mut type_changed = 0;
let mut conflicted = 0;
for entry in statuses.iter().filter(|e| e.status() != Status::CURRENT) {
match entry.status() {
s if s.contains(Status::INDEX_NEW) => new += 1,
s if s.contains(Status::INDEX_MODIFIED) => modified += 1,
s if s.contains(Status::INDEX_DELETED) => deleted += 1,
s if s.contains(Status::INDEX_RENAMED) => renamed += 1,
s if s.contains(Status::INDEX_TYPECHANGE) => type_changed += 1,
s if s.contains(Status::CONFLICTED) => conflicted += 1,
_ => (),
};
match entry.status() {
s if s.contains(git2::Status::WT_MODIFIED) => modified += 1,
s if s.contains(git2::Status::WT_DELETED) => deleted += 1,
s if s.contains(git2::Status::WT_RENAMED) => renamed += 1,
s if s.contains(git2::Status::WT_TYPECHANGE) => type_changed += 1,
_ => (),
};
}
GitStatus {
new,
modified,
renamed,
deleted,
type_changed,
conflicted,
}
}
| 29.62069 | 97 | 0.548603 |
e715d7b21b2e2909df160bc7e86e09b60e5f5b9e | 206 | js | JavaScript | doc/structmxml__custom__s.js | Paulb23/SSL_Simple_SDL_Library | e3b9019c1a1adc8009d612b869230ce9390fd375 | [
"MIT"
] | null | null | null | doc/structmxml__custom__s.js | Paulb23/SSL_Simple_SDL_Library | e3b9019c1a1adc8009d612b869230ce9390fd375 | [
"MIT"
] | null | null | null | doc/structmxml__custom__s.js | Paulb23/SSL_Simple_SDL_Library | e3b9019c1a1adc8009d612b869230ce9390fd375 | [
"MIT"
] | null | null | null | var structmxml__custom__s =
[
[ "data", "structmxml__custom__s.html#a735984d41155bc1032e09bece8f8d66d", null ],
[ "destroy", "structmxml__custom__s.html#ac83aa22a2350b43131c6e040344051b8", null ]
]; | 41.2 | 87 | 0.771845 |
f7859f5cad61773e0870cfecb9c2e3c0af6882ec | 4,622 | h | C | DREAM3DReviewFilters/HEDM/H5MicImporter.h | tuks188/DREAM3DReview | 81e921fd70c7050df361bf8626136d1c29faffe9 | [
"BSD-3-Clause"
] | null | null | null | DREAM3DReviewFilters/HEDM/H5MicImporter.h | tuks188/DREAM3DReview | 81e921fd70c7050df361bf8626136d1c29faffe9 | [
"BSD-3-Clause"
] | null | null | null | DREAM3DReviewFilters/HEDM/H5MicImporter.h | tuks188/DREAM3DReview | 81e921fd70c7050df361bf8626136d1c29faffe9 | [
"BSD-3-Clause"
] | null | null | null | /* ============================================================================
* Copyright (c) 2010, Michael A. Jackson (BlueQuartz Software)
* Copyright (c) 2010, Dr. Michael A. Groeber (US Air Force Research Laboratories
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* Neither the name of Michael A. Groeber, Michael A. Jackson, the US Air Force,
* BlueQuartz Software nor the names of its contributors may be used to endorse
* or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This code was written under United States Air Force Contract number
* FA8650-07-D-5800
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
#pragma once
#if defined(_MSC_VER)
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#endif
#include "hdf5.h"
#include <QtCore/QString>
#include "EbsdLib/EbsdImporter.h"
#include "EbsdLib/EbsdLib.h"
#include "EbsdLib/EbsdSetGetMacros.h"
#include "DREAM3DReview/DREAM3DReviewFilters/HEDM/MicReader.h"
/**
* @class H5MicImporter H5MicImporter.h EbsdLib/HEDM/H5MicImporter.h
* @brief This class will read a series of .Mic files and store the values into
* an HDF5 file according to the .h5ebsd specification
*
* @date March 23, 2011
* @version 1.2
*/
class H5MicImporter : public EbsdImporter
{
public:
EBSD_SHARED_POINTERS(H5MicImporter)
EBSD_TYPE_MACRO(H5MicImporter)
EBSD_STATIC_NEW_SUPERCLASS(EbsdImporter, H5MicImporter)
~H5MicImporter() override;
/**
* @brief Imports a specific file into the HDF5 file
* @param fileId The valid HDF5 file Id for an already open HDF5 file
* @param index The slice index for the file
* @param MicFile The absolute path to the input .Mic file
*/
int importFile(hid_t fileId, int64_t index, const QString& MicFile);
/**
* @brief Writes the phase data into the HDF5 file
* @param reader Valid MicReader instance
* @param gid Valid HDF5 Group ID for the phases.
* @return error condition
*/
int writePhaseData(MicReader& reader, hid_t gid);
int writeZandCoordinates(MicPhase* p, hid_t ZandCGid);
/**
* @brief Returns the dimensions for the EBSD Data set
* @param x Number of X Voxels (out)
* @param y Number of Y Voxels (out)
*/
void getDims(int64_t& x, int64_t& y) override;
/**
* @brief Returns the x and y resolution of the voxels
* @param x The x resolution (out)
* @param y The y resolution (out)
*/
void getSpacing(float& x, float& y) override;
/**
* @brief Return the number of slices imported
* @return
*/
int numberOfSlicesImported() override;
/**
* @brief This function sets the version of the H5Ebsd file that will be written.
* @param version
* @return
*/
void setFileVersion(uint32_t version) override;
protected:
H5MicImporter();
private:
int64_t xDim;
int64_t yDim;
float xRes;
float yRes;
int m_FileVersion;
public:
H5MicImporter(const H5MicImporter&) = delete; // Copy Constructor Not Implemented
H5MicImporter(H5MicImporter&&) = delete; // Move Constructor Not Implemented
H5MicImporter& operator=(const H5MicImporter&) = delete; // Copy Assignment Not Implemented
H5MicImporter& operator=(H5MicImporter&&) = delete; // Move Assignment Not Implemented
};
| 35.553846 | 94 | 0.706621 |
39492b45a25ee79fbea418f9f15d8ff391d5048e | 1,001 | html | HTML | pa1-skeleton/pa1-data/4/otl.stanford.edu_about_staff_linda_chao.html | yzhong94/cs276-spring-2019 | a4780a9f88b8c535146040fe11bb513c91c5693b | [
"MIT"
] | null | null | null | pa1-skeleton/pa1-data/4/otl.stanford.edu_about_staff_linda_chao.html | yzhong94/cs276-spring-2019 | a4780a9f88b8c535146040fe11bb513c91c5693b | [
"MIT"
] | null | null | null | pa1-skeleton/pa1-data/4/otl.stanford.edu_about_staff_linda_chao.html | yzhong94/cs276-spring-2019 | a4780a9f88b8c535146040fe11bb513c91c5693b | [
"MIT"
] | null | null | null | about otl who we are linda chao contact search home about otl what we do why we do it who we are resources contact ico otl llc for inventors our process our policies intellectual property resources disclosures faqs for industry our process our policies resources ico researcher portal techfinder search our database for opportunities and submit requests for additional information linda chao senior licensing associate education bs electrical engineering mit ms electrical engineering mit mba mit previous work experience digital equipment corporation vlsi design sematech competitive analysis of semiconductor industry applied materials product marketing registered patent agent otl responsibilities photonics nanotechnology semiconductor communications and bio engineering technologies representative to the stanford entrepreneurship network http sen stanford edu contact e mail linda chao stanford edu info otlmail stanford edu office of technology licensing 1705 el camino real palo alto ca 94306
| 500.5 | 1,000 | 0.86014 |
272970369ce0d8f112bf8e0b1c4e09858f96fe22 | 3,173 | css | CSS | style.css | Feruzteame/Quiz-App | b582ed295b6c595955674a0f1d059598fd23eed5 | [
"MIT"
] | null | null | null | style.css | Feruzteame/Quiz-App | b582ed295b6c595955674a0f1d059598fd23eed5 | [
"MIT"
] | 2 | 2020-08-18T05:51:54.000Z | 2020-08-18T06:57:18.000Z | style.css | Feruzteame/Quiz-App | b582ed295b6c595955674a0f1d059598fd23eed5 | [
"MIT"
] | null | null | null | *{
margin: 0;
padding: 0;
}
body{
font-family: monospace;
}
#container{
font-family: monospace;
display: grid;
grid-template-columns: 70% 30%;
background-color: #00798c;
}
#sub-container1{
margin: 5% 5% 5% 10%;
}
#sub-container2{
margin: 0% 0% 5% 20%;
height: auto;
min-height: 400px;
background-color: #edae49;
}
#answerInput{
width: 50%;
height: 40px;
border: #edae49 solid 2px;
border-radius: 5px;
padding: 1%;
margin-left: 15%;
}
#submitButton{
width: 10%;
height: 50px;
margin: 2%;
background-color: #edae49;
border-radius: 5px;
border: #edae49;
font-weight: bold;
}
#restart{
width: 30%;
height: 50px;
margin: 10% 20% 20% 15%;
background-color: #edae49;
border-radius: 5px;
border: #edae49;
font-weight: bold;
}
#submitButton:hover, #restart:hover{
background-color: black;
color: #edae49;
}
#successDiv{
padding: 5%;
margin: 3%;
font-size: 12px;
}
#failDiv{
padding: 5%;
margin: 3%;
font-size: 12px;
}
#failDiv:hover{
transform: scale(0.9);
}
#scoreHolder{
text-align: center;
padding-top: 5%;
font-size: 40px;
font-weight: bold;
}
#successDiv{
background-color: #40916c;
height: 100px;
border-radius: 10px;
animation: slideInRight;
animation-duration: 0.5s;
}
#failDiv {
background-color: #d1495b;
height: 100px;
border-radius: 10px;
animation: slideInRight;
animation-duration: 0.5s;
}
#questionLine{
font-size: 30px;
margin-top: 5%;
margin-left: 15%;
font-weight: bold;
}
span{
color: white
}
#myForm{
height: auto;
min-height: 100px;
padding-top: 10%;
}
label{
font-size: 20px;
size: 20px;
margin: 1%;
color: #edae49;
font-weight: bold;
}
input{
height: 20px;
size: 20px;
vertical-align: middle;
background-color: black;
color: white;
}
label:hover{
color: black;
}
footer{
background-color: black;
height: auto;
min-height: 50px;
margin-top: -1.5%;
text-align: center;
font-weight: bold;
color: #edae49;
}
form{
margin-left: 15%;
animation: slideInRight;
animation-duration: 0.5s;
}
#img{
width: 30px;
margin-left: 40%;
}
@media only screen and (min-width: 400px) and (max-width: 800px) {
#container{
display: grid;
grid-template-columns:100%;
}
#sub-container1{
height: auto;
min-height: 350px;
}
#sub-container2{
margin: 0% 0% 5% 0%;
height: auto;
min-height: 100px;
}
#answerInput{
width: 80%;
height: 40px;
margin: 10% 0% 0% 0%;
}
#submitButton{
width: 40%;
height: 50px;
margin: 10% 0% 0% 20%;
}
#questionLine{
width: 80%;
height: 150px;
margin: 10% 0% 0% 0%;
}
#restart{
width: 40%;
height: 40px;
margin: 10% 0% 0% 20%;
}
footer{
background-color: black;
height: auto;
min-height: 50px;
margin-top: -5%;
color: #edae49;
}
}
| 17.434066 | 66 | 0.55405 |
0ca3cc7e85961f379dcec8f7f5d9db60fd5df51d | 138,423 | py | Python | dlkit/abstract_osid/calendaring/queries.py | UOC/dlkit | a9d265db67e81b9e0f405457464e762e2c03f769 | [
"MIT"
] | 2 | 2018-02-23T12:16:11.000Z | 2020-10-08T17:54:24.000Z | dlkit/abstract_osid/calendaring/queries.py | UOC/dlkit | a9d265db67e81b9e0f405457464e762e2c03f769 | [
"MIT"
] | 87 | 2017-04-21T18:57:15.000Z | 2021-12-13T19:43:57.000Z | dlkit/abstract_osid/calendaring/queries.py | UOC/dlkit | a9d265db67e81b9e0f405457464e762e2c03f769 | [
"MIT"
] | 1 | 2018-03-01T16:44:25.000Z | 2018-03-01T16:44:25.000Z | """Implementations of calendaring abstract base class queries."""
# pylint: disable=invalid-name
# Method names comply with OSID specification.
# pylint: disable=no-init
# Abstract classes do not define __init__.
# pylint: disable=too-few-public-methods
# Some interfaces are specified as 'markers' and include no methods.
# pylint: disable=too-many-public-methods
# Number of methods are defined in specification
# pylint: disable=too-many-ancestors
# Inheritance defined in specification
# pylint: disable=too-many-arguments
# Argument signature defined in specification.
# pylint: disable=duplicate-code
# All apparent duplicates have been inspected. They aren't.
import abc
class EventQuery:
"""This is the query for searching events.
Each method match request produces an ``AND`` term while multiple
invocations of a method produces a nested ``OR``.
"""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def match_implicit(self, match):
"""Matches an event that is implicitly generated.
:param match: ``true`` to match events implicitly generated, ``false`` to match events explicitly defined
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_implicit_terms(self):
"""Clears the implcit terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
implicit_terms = property(fdel=clear_implicit_terms)
@abc.abstractmethod
def match_duration(self, low, high, match):
"""Matches the event duration between the given range inclusive.
:param low: low duration range
:type low: ``osid.calendaring.Duration``
:param high: high duration range
:type high: ``osid.calendaring.Duration``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``high`` is less than ``low``
:raise: ``NullArgument`` -- ``high`` or ``low`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_duration(self, match):
"""Matches an event that has any duration.
:param match: ``true`` to match events with any duration, ``false`` to match events with no start time
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_duration_terms(self):
"""Clears the duration terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
duration_terms = property(fdel=clear_duration_terms)
@abc.abstractmethod
def match_recurring_event_id(self, recurring_event_id, match):
"""Matches events that related to the recurring event.
:param recurring_event_id: an ``Id`` for a recurring event
:type recurring_event_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``recurring_event_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_recurring_event_id_terms(self):
"""Clears the recurring event terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
recurring_event_id_terms = property(fdel=clear_recurring_event_id_terms)
@abc.abstractmethod
def supports_recurring_event_query(self):
"""Tests if a ``RecurringEventQuery`` is available for querying recurring events.
:return: ``true`` if a recurring event query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_recurring_event_query(self):
"""Gets the query for a recurring event.
Multiple retrievals produce a nested ``OR`` term.
:return: the recurring event query
:rtype: ``osid.calendaring.RecurringEventQuery``
:raise: ``Unimplemented`` -- ``supports_recurring_event_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_recurring_event_query()`` is ``true``.*
"""
return # osid.calendaring.RecurringEventQuery
recurring_event_query = property(fget=get_recurring_event_query)
@abc.abstractmethod
def match_any_recurring_event(self, match):
"""Matches an event that is part of any recurring event.
:param match: ``true`` to match events part of any recurring event, ``false`` to match only standalone events
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_recurring_event_terms(self):
"""Clears the recurring event terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
recurring_event_terms = property(fdel=clear_recurring_event_terms)
@abc.abstractmethod
def match_superseding_event_id(self, superseding_event_id, match):
"""Matches events that relate to the superseding event.
:param superseding_event_id: an ``Id`` for a superseding event
:type superseding_event_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_superseding_event_id_terms(self):
"""Clears the superseding events type terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
superseding_event_id_terms = property(fdel=clear_superseding_event_id_terms)
@abc.abstractmethod
def supports_superseding_event_query(self):
"""Tests if a ``SupersedingEventQuery`` is available for querying offset events.
:return: ``true`` if a superseding event query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_superseding_event_query(self):
"""Gets the query for a superseding event.
Multiple retrievals produce a nested ``OR`` term.
:return: the superseding event query
:rtype: ``osid.calendaring.SupersedingEventQuery``
:raise: ``Unimplemented`` -- ``supports_superseding_event_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_superseding_event_query()`` is ``true``.*
"""
return # osid.calendaring.SupersedingEventQuery
superseding_event_query = property(fget=get_superseding_event_query)
@abc.abstractmethod
def match_any_superseding_event(self, match):
"""Matches any superseding event.
:param match: ``true`` to match any superseding events, ``false`` otherwise
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_superseding_event_terms(self):
"""Clears the superseding event terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
superseding_event_terms = property(fdel=clear_superseding_event_terms)
@abc.abstractmethod
def match_offset_event_id(self, offset_event_id, match):
"""Matches events that relates to the offset event.
:param offset_event_id: an ``Id`` for an offset event
:type offset_event_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_offset_event_id_terms(self):
"""Clears the recurring events type terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
offset_event_id_terms = property(fdel=clear_offset_event_id_terms)
@abc.abstractmethod
def supports_offset_event_query(self):
"""Tests if an ``OffsetEventQuery`` is available for querying offset events.
:return: ``true`` if an offset event query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_offset_event_query(self):
"""Gets the query for an offset event.
Multiple retrievals produce a nested ``OR`` term.
:return: the offset event query
:rtype: ``osid.calendaring.OffsetEventQuery``
:raise: ``Unimplemented`` -- ``supports_offset_event_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_offset_event_query()`` is ``true``.*
"""
return # osid.calendaring.OffsetEventQuery
offset_event_query = property(fget=get_offset_event_query)
@abc.abstractmethod
def match_any_offset_event(self, match):
"""Matches any offset event.
:param match: ``true`` to match any offset events, ``false`` otherwise
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_offset_event_terms(self):
"""Clears the offset event terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
offset_event_terms = property(fdel=clear_offset_event_terms)
@abc.abstractmethod
def match_location_description(self, location, string_match_type, match):
"""Matches the location description string.
:param location: location string
:type location: ``string``
:param string_match_type: string match type
:type string_match_type: ``osid.type.Type``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``location`` is not of ``string_match_type``
:raise: ``NullArgument`` -- ``location`` or ``string_match_type`` is ``null``
:raise: ``Unsupported`` -- ``supports_string_match_type(string_match_type)`` is ``false``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_location_description(self, match):
"""Matches an event that has any location description assigned.
:param match: ``true`` to match events with any location description, ``false`` to match events with no location
description
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_location_description_terms(self):
"""Clears the location description terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
location_description_terms = property(fdel=clear_location_description_terms)
@abc.abstractmethod
def match_location_id(self, location_id, match):
"""Sets the location ``Id`` for this query.
:param location_id: a location ``Id``
:type location_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``location_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_location_id_terms(self):
"""Clears the location ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
location_id_terms = property(fdel=clear_location_id_terms)
@abc.abstractmethod
def supports_location_query(self):
"""Tests if a ``LocationQuery`` is available for querying locations.
:return: ``true`` if a location query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_location_query(self):
"""Gets the query for a location.
Multiple retrievals produce a nested ``OR`` term.
:return: the location query
:rtype: ``osid.mapping.LocationQuery``
:raise: ``Unimplemented`` -- ``supports_location_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_location_query()`` is ``true``.*
"""
return # osid.mapping.LocationQuery
location_query = property(fget=get_location_query)
@abc.abstractmethod
def match_any_location(self, match):
"""Matches an event that has any location assigned.
:param match: ``true`` to match events with any location, ``false`` to match events with no location
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_location_terms(self):
"""Clears the location terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
location_terms = property(fdel=clear_location_terms)
@abc.abstractmethod
def match_sponsor_id(self, sponsor_id, match):
"""Sets the sponsor ``Id`` for this query.
:param sponsor_id: a sponsor ``Id``
:type sponsor_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``sponsor_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_sponsor_id_terms(self):
"""Clears the sponsor ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
sponsor_id_terms = property(fdel=clear_sponsor_id_terms)
@abc.abstractmethod
def supports_sponsor_query(self):
"""Tests if a ``LocationQuery`` is available for querying sponsors.
:return: ``true`` if a sponsor query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_sponsor_query(self):
"""Gets the query for a sponsor.
Multiple retrievals produce a nested ``OR`` term.
:return: the sponsor query
:rtype: ``osid.resource.ResourceQuery``
:raise: ``Unimplemented`` -- ``supports_sponsor_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_sponsor_query()`` is ``true``.*
"""
return # osid.resource.ResourceQuery
sponsor_query = property(fget=get_sponsor_query)
@abc.abstractmethod
def clear_sponsor_terms(self):
"""Clears the sponsor terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
sponsor_terms = property(fdel=clear_sponsor_terms)
@abc.abstractmethod
def match_coordinate(self, coordinate, match):
"""Matches events whose locations contain the given coordinate.
:param coordinate: a coordinate
:type coordinate: ``osid.mapping.Coordinate``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``coordinate`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_coordinate_terms(self):
"""Clears the cooordinate terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
coordinate_terms = property(fdel=clear_coordinate_terms)
@abc.abstractmethod
def match_spatial_unit(self, spatial_unit, match):
"""Matches events whose locations fall within the given spatial unit.
:param spatial_unit: a spatial unit
:type spatial_unit: ``osid.mapping.SpatialUnit``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``spatial_unit`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_spatial_unit_terms(self):
"""Clears the spatial unit terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
spatial_unit_terms = property(fdel=clear_spatial_unit_terms)
@abc.abstractmethod
def match_commitment_id(self, commitment_id, match):
"""Sets the commitment ``Id`` for this query.
:param commitment_id: a commitment ``Id``
:type commitment_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``commitment_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_commitment_id_terms(self):
"""Clears the commitment ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
commitment_id_terms = property(fdel=clear_commitment_id_terms)
@abc.abstractmethod
def supports_commitment_query(self):
"""Tests if a ``CommitmentQuery`` is available for querying recurring event terms.
:return: ``true`` if a commitment query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_commitment_query(self):
"""Gets the query for a commitment.
Multiple retrievals produce a nested ``OR`` term.
:return: the commitment query
:rtype: ``osid.calendaring.CommitmentQuery``
:raise: ``Unimplemented`` -- ``supports_commitment_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_commitment_query()`` is ``true``.*
"""
return # osid.calendaring.CommitmentQuery
commitment_query = property(fget=get_commitment_query)
@abc.abstractmethod
def match_any_commitment(self, match):
"""Matches an event that has any commitment.
:param match: ``true`` to match events with any commitment, ``false`` to match events with no commitments
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_commitment_terms(self):
"""Clears the commitment terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
commitment_terms = property(fdel=clear_commitment_terms)
@abc.abstractmethod
def match_containing_event_id(self, event_id, match):
"""Sets the event ``Id`` for this query to match events that have the specified event as an ancestor.
:param event_id: an event ``Id``
:type event_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``event_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_containing_event_id_terms(self):
"""Clears the containing event ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
containing_event_id_terms = property(fdel=clear_containing_event_id_terms)
@abc.abstractmethod
def supports_containing_event_query(self):
"""Tests if a containing event query is available.
:return: ``true`` if a containing event query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_containing_event_query(self):
"""Gets the query for a containing event.
:return: the containing event query
:rtype: ``osid.calendaring.EventQuery``
:raise: ``Unimplemented`` -- ``supports_containing_event_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_containing_event_query()`` is ``true``.*
"""
return # osid.calendaring.EventQuery
containing_event_query = property(fget=get_containing_event_query)
@abc.abstractmethod
def match_any_containing_event(self, match):
"""Matches events with any ancestor event.
:param match: ``true`` to match events with any ancestor event, ``false`` to match events with no ancestor
events
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_containing_event_terms(self):
"""Clears the containing event terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
containing_event_terms = property(fdel=clear_containing_event_terms)
@abc.abstractmethod
def match_calendar_id(self, calendar_id, match):
"""Sets the calendar ``Id`` for this query.
:param calendar_id: a calendar ``Id``
:type calendar_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``calendar_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_calendar_id_terms(self):
"""Clears the calendar ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
calendar_id_terms = property(fdel=clear_calendar_id_terms)
@abc.abstractmethod
def supports_calendar_query(self):
"""Tests if a ``CalendarQuery`` is available for querying calendars.
:return: ``true`` if a calendar query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_calendar_query(self):
"""Gets the query for a calendar.
Multiple retrievals produce a nested ``OR`` term.
:return: the calendar query
:rtype: ``osid.calendaring.CalendarQuery``
:raise: ``Unimplemented`` -- ``supports_calendar_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_calendar_query()`` is ``true``.*
"""
return # osid.calendaring.CalendarQuery
calendar_query = property(fget=get_calendar_query)
@abc.abstractmethod
def clear_calendar_terms(self):
"""Clears the calendar terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
calendar_terms = property(fdel=clear_calendar_terms)
@abc.abstractmethod
def get_event_query_record(self, event_record_type):
"""Gets the event query record corresponding to the given ``Event`` record ``Type``.
Multiple retrievals produce a nested ``OR`` term.
:param event_record_type: an event query record type
:type event_record_type: ``osid.type.Type``
:return: the event query record
:rtype: ``osid.calendaring.records.EventQueryRecord``
:raise: ``NullArgument`` -- ``event_record_type`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unsupported`` -- ``has_record_type(event_record_type)`` is ``false``
*compliance: mandatory -- This method must be implemented.*
"""
return # osid.calendaring.records.EventQueryRecord
class RecurringEventQuery:
"""This is the query for searching recurring events.
Each method match request produces an ``AND`` term while multiple
invocations of a method produces a nested ``OR``.
"""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def match_schedule_id(self, schedule_id, match):
"""Sets the schedule ``Id`` for this query for matching schedules.
:param schedule_id: a schedule ``Id``
:type schedule_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``schedule_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_schedule_id_terms(self):
"""Clears the schedule ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
schedule_id_terms = property(fdel=clear_schedule_id_terms)
@abc.abstractmethod
def supports_schedule_query(self):
"""Tests if a ``ScheduleQuery`` is available for querying schedules.
:return: ``true`` if a schedule query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_schedule_query(self):
"""Gets the query for a schedule.
Multiple retrievals produce a nested ``OR`` term.
:return: the schedule query
:rtype: ``osid.calendaring.ScheduleQuery``
:raise: ``Unimplemented`` -- ``supports_schedule_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_schedule_query()`` is ``true``.*
"""
return # osid.calendaring.ScheduleQuery
schedule_query = property(fget=get_schedule_query)
@abc.abstractmethod
def match_any_schedule(self, match):
"""Matches a recurring event that has any schedule assigned.
:param match: ``true`` to match recurring events with any schedules, ``false`` to match recurring events with no
schedules
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_schedule_terms(self):
"""Clears the schedule terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
schedule_terms = property(fdel=clear_schedule_terms)
@abc.abstractmethod
def match_superseding_event_id(self, superseding_event_id, match):
"""Sets the superseding event ``Id`` for this query.
:param superseding_event_id: a superseding event ``Id``
:type superseding_event_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``superseding_event_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_superseding_event_id_terms(self):
"""Clears the superseding event ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
superseding_event_id_terms = property(fdel=clear_superseding_event_id_terms)
@abc.abstractmethod
def supports_superseding_event_query(self):
"""Tests if a ``SupersedingEventQuery`` is available for querying superseding events.
:return: ``true`` if a superseding event query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_superseding_event_query(self):
"""Gets the query for a superseding event.
Multiple retrievals produce a nested ``OR`` term.
:return: the superseding event query
:rtype: ``osid.calendaring.SupersedingEventQuery``
:raise: ``Unimplemented`` -- ``supports_superseding_event_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_superseding_event_query()`` is ``true``.*
"""
return # osid.calendaring.SupersedingEventQuery
superseding_event_query = property(fget=get_superseding_event_query)
@abc.abstractmethod
def match_any_superseding_event(self, match):
"""Matches a recurring event that has any superseding event assigned.
:param match: ``true`` to match recurring events with any superseding events, ``false`` to match events with no
superseding events
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_superseding_event_terms(self):
"""Clears the superseding event terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
superseding_event_terms = property(fdel=clear_superseding_event_terms)
@abc.abstractmethod
def match_specific_meeting_time(self, start, end, match):
"""Matches recurring events with specific dates between the given range inclusive.
:param start: start date
:type start: ``osid.calendaring.DateTime``
:param end: end date
:type end: ``osid.calendaring.DateTime``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``end`` is less than ``start``
:raise: ``NullArgument`` -- ``start`` or ``end`` is ``zero``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_specific_meeting_time(self, match):
"""Matches a recurring event that has any specific date assigned.
:param match: ``true`` to match recurring events with any specific date, ``false`` to match recurring events
with no specific date
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_specific_meeting_time_terms(self):
"""Clears the blackout terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
specific_meeting_time_terms = property(fdel=clear_specific_meeting_time_terms)
@abc.abstractmethod
def match_event_id(self, event_id, match):
"""Sets the composed event ``Id`` for this query.
:param event_id: an event ``Id``
:type event_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``event_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_event_id_terms(self):
"""Clears the event ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
event_id_terms = property(fdel=clear_event_id_terms)
@abc.abstractmethod
def supports_event_query(self):
"""Tests if an ``EventQuery`` is available for querying composed events.
:return: ``true`` if an event query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_event_query(self):
"""Gets the query for an event.
Multiple retrievals produce a nested ``OR`` term.
:return: the event query
:rtype: ``osid.calendaring.EventQuery``
:raise: ``Unimplemented`` -- ``supports_event_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_event_query()`` is ``true``.*
"""
return # osid.calendaring.EventQuery
event_query = property(fget=get_event_query)
@abc.abstractmethod
def match_any_event(self, match):
"""Matches a recurring event that has any composed event assigned.
:param match: ``true`` to match recurring events with any composed events, ``false`` to match events with no
composed events
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_event_terms(self):
"""Clears the event terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
event_terms = property(fdel=clear_event_terms)
@abc.abstractmethod
def match_blackout(self, datetime, match):
"""Matches a blackout that contains the given date time.
:param datetime: a datetime
:type datetime: ``osid.calendaring.DateTime``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``datetime`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_blackout(self, match):
"""Matches a recurring event that has any blackout assigned.
:param match: ``true`` to match recurring events with any blackout, ``false`` to match recurring events with no
blackout
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_blackout_terms(self):
"""Clears the blackout terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
blackout_terms = property(fdel=clear_blackout_terms)
@abc.abstractmethod
def match_blackout_inclusive(self, start, end, match):
"""Matches recurring events with blackouts between the given range inclusive.
:param start: start date
:type start: ``osid.calendaring.DateTime``
:param end: end date
:type end: ``osid.calendaring.DateTime``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``end`` is less than ``start``
:raise: ``NullArgument`` -- ``start`` or ``end`` is ``zero``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_blackout_inclusive_terms(self):
"""Clears the blackout terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
blackout_inclusive_terms = property(fdel=clear_blackout_inclusive_terms)
@abc.abstractmethod
def match_sponsor_id(self, sponsor_id, match):
"""Sets the sponsor ``Id`` for this query.
:param sponsor_id: a sponsor ``Id``
:type sponsor_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``sponsor_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_sponsor_id_terms(self):
"""Clears the sponsor ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
sponsor_id_terms = property(fdel=clear_sponsor_id_terms)
@abc.abstractmethod
def supports_sponsor_query(self):
"""Tests if a ``LocationQuery`` is available for querying sponsors.
:return: ``true`` if a sponsor query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_sponsor_query(self):
"""Gets the query for a sponsor.
Multiple retrievals produce a nested ``OR`` term.
:return: the sponsor query
:rtype: ``osid.resource.ResourceQuery``
:raise: ``Unimplemented`` -- ``supports_sponsor_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_sponsor_query()`` is ``true``.*
"""
return # osid.resource.ResourceQuery
sponsor_query = property(fget=get_sponsor_query)
@abc.abstractmethod
def clear_sponsor_terms(self):
"""Clears the sponsor terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
sponsor_terms = property(fdel=clear_sponsor_terms)
@abc.abstractmethod
def match_calendar_id(self, calendar_id, match):
"""Sets the calendar ``Id`` for this query.
:param calendar_id: a calendar ``Id``
:type calendar_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``calendar_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_calendar_id_terms(self):
"""Clears the calendar ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
calendar_id_terms = property(fdel=clear_calendar_id_terms)
@abc.abstractmethod
def supports_calendar_query(self):
"""Tests if a ``CalendarQuery`` is available for querying calendars.
:return: ``true`` if a calendar query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_calendar_query(self):
"""Gets the query for a calendar.
Multiple retrievals produce a nested ``OR`` term.
:return: the calendar query
:rtype: ``osid.calendaring.CalendarQuery``
:raise: ``Unimplemented`` -- ``supports_calendar_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_calendar_query()`` is ``true``.*
"""
return # osid.calendaring.CalendarQuery
calendar_query = property(fget=get_calendar_query)
@abc.abstractmethod
def clear_calendar_terms(self):
"""Clears the calendar terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
calendar_terms = property(fdel=clear_calendar_terms)
@abc.abstractmethod
def get_recurring_event_query_record(self, recurring_event_record_type):
"""Gets the recurring event query recod corresponding to the given ``RecurringEvent`` record ``Type``.
Multiple retrievals produce a nested ``OR`` term.
:param recurring_event_record_type: a recurring event query record type
:type recurring_event_record_type: ``osid.type.Type``
:return: the recurring event query record
:rtype: ``osid.calendaring.records.RecurringEventQueryRecord``
:raise: ``NullArgument`` -- ``recurring_event_record_type`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unsupported`` -- ``has_record_type(recurring_event_record_type)`` is ``false``
*compliance: mandatory -- This method must be implemented.*
"""
return # osid.calendaring.records.RecurringEventQueryRecord
class SupersedingEventQuery:
"""This is the query for searching superseding events.
Each method match request produces an ``AND`` term while multiple
invocations of a method produces a nested ``OR``.
"""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def match_superseded_event_id(self, event_id, match):
"""Sets the event ``Id`` for this query for matching attached events.
:param event_id: an event ``Id``
:type event_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``event_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_superseded_event_id_terms(self):
"""Clears the event ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
superseded_event_id_terms = property(fdel=clear_superseded_event_id_terms)
@abc.abstractmethod
def supports_superseded_event_query(self):
"""Tests if an ``EventQuery`` is available for querying attached events.
:return: ``true`` if an event query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_superseded_event_query(self):
"""Gets the query for an attached event.
Multiple retrievals produce a nested ``OR`` term.
:return: the event query
:rtype: ``osid.calendaring.EventQuery``
:raise: ``Unimplemented`` -- ``supports_superseded_event_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_superseded_event_query()`` is ``true``.*
"""
return # osid.calendaring.EventQuery
superseded_event_query = property(fget=get_superseded_event_query)
@abc.abstractmethod
def clear_superseded_event_terms(self):
"""Clears the event terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
superseded_event_terms = property(fdel=clear_superseded_event_terms)
@abc.abstractmethod
def match_superseding_event_id(self, superseding_event_id, match):
"""Sets the superseding event ``Id`` for this query.
:param superseding_event_id: a superseding event ``Id``
:type superseding_event_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``superseding_event_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_superseding_event_id_terms(self):
"""Clears the superseding event ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
superseding_event_id_terms = property(fdel=clear_superseding_event_id_terms)
@abc.abstractmethod
def supports_superseding_event_query(self):
"""Tests if a ``SupersedingEventQuery`` is available.
:return: ``true`` if a superseding event query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_superseding_event_query(self):
"""Gets the query for a superseding event.
Multiple retrievals produce a nested ``OR`` term.
:return: the superseding event query
:rtype: ``osid.calendaring.EventQuery``
:raise: ``Unimplemented`` -- ``supports_superseding_event_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_superseding_event_query()`` is ``true``.*
"""
return # osid.calendaring.EventQuery
superseding_event_query = property(fget=get_superseding_event_query)
@abc.abstractmethod
def clear_superseding_event_terms(self):
"""Clears the superseding event terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
superseding_event_terms = property(fdel=clear_superseding_event_terms)
@abc.abstractmethod
def match_superseded_date(self, from_, to, match):
"""Matches superseding events that supersede within the given dates inclusive.
:param from: start date
:type from: ``osid.calendaring.DateTime``
:param to: end date
:type to: ``osid.calendaring.DateTime``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``from`` is greater than ``to``
:raise: ``NullArgument`` -- ``from`` or ``to`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_superseded_date(self, match):
"""Matches a superseding event that has any superseded date.
:param match: ``true`` to match superseding events with any superseded date, false to match superseding events
with no superseded date
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_superseded_date_terms(self):
"""Clears the superseded date terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
superseded_date_terms = property(fdel=clear_superseded_date_terms)
@abc.abstractmethod
def match_superseded_event_position(self, from_, to, match):
"""Matches superseding events that supersede within the denormalized event positions inclusive.
:param from: start position
:type from: ``integer``
:param to: end position
:type to: ``integer``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- the absolute value of ``from`` is greater than ``to``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_superseded_event_position(self, match):
"""Matches a superseding event that has any superseded position.
:param match: ``true`` to match superseding events with any superseded event position, false to match
superseding events with no superseded event position
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_superseded_event_position_terms(self):
"""Clears the superseded position terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
superseded_event_position_terms = property(fdel=clear_superseded_event_position_terms)
@abc.abstractmethod
def match_calendar_id(self, calendar_id, match):
"""Sets the calendar ``Id`` for this query.
:param calendar_id: a calendar ``Id``
:type calendar_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``calendar_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_calendar_id_terms(self):
"""Clears the calendar ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
calendar_id_terms = property(fdel=clear_calendar_id_terms)
@abc.abstractmethod
def supports_calendar_query(self):
"""Tests if a ``CalendarQuery`` is available for querying calendars.
:return: ``true`` if a calendar query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_calendar_query(self):
"""Gets the query for a calendar.
Multiple retrievals produce a nested ``OR`` term.
:return: the calendar query
:rtype: ``osid.calendaring.CalendarQuery``
:raise: ``Unimplemented`` -- ``supports_calendar_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_calendar_query()`` is ``true``.*
"""
return # osid.calendaring.CalendarQuery
calendar_query = property(fget=get_calendar_query)
@abc.abstractmethod
def clear_calendar_terms(self):
"""Clears the calendar terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
calendar_terms = property(fdel=clear_calendar_terms)
@abc.abstractmethod
def get_superseding_event_query_record(self, superseding_event_record_type):
"""Gets the superseding event query record corresponding to the given ``SupersedingEvent`` record ``Type``.
Multiple retrievals produce a nested ``OR`` term.
:param superseding_event_record_type: a superseding event query record type
:type superseding_event_record_type: ``osid.type.Type``
:return: the superseding event query record
:rtype: ``osid.calendaring.records.SupersedingEventQueryRecord``
:raise: ``NullArgument`` -- ``superseding_event_record_type`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unsupported`` -- ``has_record_type(superseding_event_record_type)`` is ``false``
*compliance: mandatory -- This method must be implemented.*
"""
return # osid.calendaring.records.SupersedingEventQueryRecord
class OffsetEventQuery:
"""This is the query for searching events.
Each method match request produces an ``AND`` term while multiple
invocations of a method produces a nested ``OR``.
"""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def match_fixed_start_time(self, from_, to, match):
"""Matches a fixed start time between the given range inclusive.
:param from: the start of the range
:type from: ``osid.calendaring.DateTime``
:param to: the end of the range
:type to: ``osid.calendaring.DateTime``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``to`` is less than ``from``
:raise: ``NullArgument`` -- ``from`` or ``to`` ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_fixed_start_time(self, match):
"""Matches events with fixed start times.
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_fixed_start_time_terms(self):
"""Clears the fixed start time terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
fixed_start_time_terms = property(fdel=clear_fixed_start_time_terms)
@abc.abstractmethod
def match_start_reference_event_id(self, event_id, match):
"""Sets the start reference event ``Id`` for this query.
:param event_id: an event ``Id``
:type event_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``event_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_start_reference_event_id_terms(self):
"""Clears the start reference event ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
start_reference_event_id_terms = property(fdel=clear_start_reference_event_id_terms)
@abc.abstractmethod
def supports_start_reference_event_query(self):
"""Tests if an ``EventQuery`` is available for querying start reference event terms.
:return: ``true`` if an event query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_start_reference_event_query(self):
"""Gets the query for the start reference event.
Multiple retrievals produce a nested ``OR`` term.
:return: the event query
:rtype: ``osid.calendaring.EventQuery``
:raise: ``Unimplemented`` -- ``supports_start_reference_event_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_start_reference_event_query()`` is ``true``.*
"""
return # osid.calendaring.EventQuery
start_reference_event_query = property(fget=get_start_reference_event_query)
@abc.abstractmethod
def match_any_start_reference_event(self, match):
"""Matches offset events with any starting reference event.
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_start_reference_event_terms(self):
"""Clears the start reference event terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
start_reference_event_terms = property(fdel=clear_start_reference_event_terms)
@abc.abstractmethod
def match_fixed_start_offset(self, from_, to, match):
"""Matches a fixed offset amount between the given range inclusive.
:param from: the start of the range
:type from: ``osid.calendaring.Duration``
:param to: the end of the range
:type to: ``osid.calendaring.Duration``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``to`` is less than ``from``
:raise: ``NullArgument`` -- ``from`` or ``to`` ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_fixed_start_offset(self, match):
"""Matches fixed offset events.
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_fixed_start_offset_terms(self):
"""Clears the fixed offset terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
fixed_start_offset_terms = property(fdel=clear_fixed_start_offset_terms)
@abc.abstractmethod
def match_relative_weekday_start_offset(self, low, high, match):
"""Matches a relative weekday offset amount between the given range inclusive.
:param low: the start of the range
:type low: ``integer``
:param high: the end of the range
:type high: ``integer``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_relative_weekday_start_offset_terms(self):
"""Clears the relative weekday offset terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
relative_weekday_start_offset_terms = property(fdel=clear_relative_weekday_start_offset_terms)
@abc.abstractmethod
def match_relative_start_weekday(self, weekday, match):
"""Matches a relative weekday.
:param weekday: the weekday
:type weekday: ``cardinal``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_relative_start_weekday(self, match):
"""Matches relative weekday offset events.
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_relative_start_weekday_terms(self):
"""Clears the relative weekday terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
relative_start_weekday_terms = property(fdel=clear_relative_start_weekday_terms)
@abc.abstractmethod
def match_fixed_duration(self, low, high, match):
"""Matches a fixed duration between the given range inclusive.
:param low: the start of the range
:type low: ``osid.calendaring.Duration``
:param high: the end of the range
:type high: ``osid.calendaring.Duration``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_fixed_duration_terms(self):
"""Clears the fixed duration offset terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
fixed_duration_terms = property(fdel=clear_fixed_duration_terms)
@abc.abstractmethod
def match_end_reference_event_id(self, event_id, match):
"""Sets the end reference event ``Id`` for this query.
:param event_id: an event ``Id``
:type event_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``event_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_end_reference_event_id_terms(self):
"""Clears the end reference event ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
end_reference_event_id_terms = property(fdel=clear_end_reference_event_id_terms)
@abc.abstractmethod
def supports_end_reference_event_query(self):
"""Tests if an ``EventQuery`` is available for querying end reference event terms.
:return: ``true`` if an event query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_end_reference_event_query(self):
"""Gets the query for the end reference event.
Multiple retrievals produce a nested ``OR`` term.
:return: the event query
:rtype: ``osid.calendaring.EventQuery``
:raise: ``Unimplemented`` -- ``supports_event_reference_event_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_end_reference_event_query()`` is ``true``.*
"""
return # osid.calendaring.EventQuery
end_reference_event_query = property(fget=get_end_reference_event_query)
@abc.abstractmethod
def match_any_end_reference_event(self, match):
"""Matches any end reference event events.
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_end_reference_event_terms(self):
"""Clears the end reference event terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
end_reference_event_terms = property(fdel=clear_end_reference_event_terms)
@abc.abstractmethod
def match_fixed_end_offset(self, from_, to, match):
"""Matches a fixed offset amount between the given range inclusive.
:param from: the start of the range
:type from: ``osid.calendaring.Duration``
:param to: the end of the range
:type to: ``osid.calendaring.Duration``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``to`` is less than ``from``
:raise: ``NullArgument`` -- ``from`` or ``to`` ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_fixed_end_offset(self, match):
"""Matches fixed offset events.
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_fixed_end_offset_terms(self):
"""Clears the fixed offset terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
fixed_end_offset_terms = property(fdel=clear_fixed_end_offset_terms)
@abc.abstractmethod
def match_relative_weekday_end_offset(self, low, high, match):
"""Matches a relative weekday offset amount between the given range inclusive.
:param low: the start of the range
:type low: ``integer``
:param high: the end of the range
:type high: ``integer``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_relative_weekday_end_offset_terms(self):
"""Clears the relative weekday offset terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
relative_weekday_end_offset_terms = property(fdel=clear_relative_weekday_end_offset_terms)
@abc.abstractmethod
def match_relative_end_weekday(self, weekday, match):
"""Matches a relative weekday.
:param weekday: the weekday
:type weekday: ``cardinal``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_relative_end_weekday(self, match):
"""Matches relative weekday offset events.
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_relative_end_weekday_terms(self):
"""Clears the relative weekday terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
relative_end_weekday_terms = property(fdel=clear_relative_end_weekday_terms)
@abc.abstractmethod
def match_location_description(self, location, string_match_type, match):
"""Matches the location description string.
:param location: location string
:type location: ``string``
:param string_match_type: string match type
:type string_match_type: ``osid.type.Type``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``location`` is not of ``string_match_type``
:raise: ``NullArgument`` -- ``location`` or ``string_match_type`` is ``null``
:raise: ``Unsupported`` -- ``supports_string_match_type(string_match_type)`` is ``false``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_location_description(self, match):
"""Matches an event that has any location description assigned.
:param match: ``true`` to match events with any location description, ``false`` to match events with no location
description
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_location_description_terms(self):
"""Clears the location description terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
location_description_terms = property(fdel=clear_location_description_terms)
@abc.abstractmethod
def match_location_id(self, location_id, match):
"""Sets the location ``Id`` for this query.
:param location_id: a location ``Id``
:type location_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``location_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_location_id_terms(self):
"""Clears the location ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
location_id_terms = property(fdel=clear_location_id_terms)
@abc.abstractmethod
def supports_location_query(self):
"""Tests if a ``LocationQuery`` is available for querying locations.
:return: ``true`` if a location query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_location_query(self):
"""Gets the query for a location.
Multiple retrievals produce a nested ``OR`` term.
:return: the location query
:rtype: ``osid.mapping.LocationQuery``
:raise: ``Unimplemented`` -- ``supports_location_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_location_query()`` is ``true``.*
"""
return # osid.mapping.LocationQuery
location_query = property(fget=get_location_query)
@abc.abstractmethod
def match_any_location(self, match):
"""Matches an event that has any location assigned.
:param match: ``true`` to match events with any location, ``false`` to match events with no location
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_location_terms(self):
"""Clears the location terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
location_terms = property(fdel=clear_location_terms)
@abc.abstractmethod
def match_sponsor_id(self, sponsor_id, match):
"""Sets the sponsor ``Id`` for this query.
:param sponsor_id: a sponsor ``Id``
:type sponsor_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``sponsor_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_sponsor_id_terms(self):
"""Clears the sponsor ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
sponsor_id_terms = property(fdel=clear_sponsor_id_terms)
@abc.abstractmethod
def supports_sponsor_query(self):
"""Tests if a ``LocationQuery`` is available for querying sponsors.
:return: ``true`` if a sponsor query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_sponsor_query(self):
"""Gets the query for a sponsor.
Multiple retrievals produce a nested ``OR`` term.
:return: the sponsor query
:rtype: ``osid.resource.ResourceQuery``
:raise: ``Unimplemented`` -- ``supports_sponsor_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_sponsor_query()`` is ``true``.*
"""
return # osid.resource.ResourceQuery
sponsor_query = property(fget=get_sponsor_query)
@abc.abstractmethod
def clear_sponsor_terms(self):
"""Clears the sponsor terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
sponsor_terms = property(fdel=clear_sponsor_terms)
@abc.abstractmethod
def match_calendar_id(self, calendar_id, match):
"""Sets the calendar ``Id`` for this query.
:param calendar_id: a calendar ``Id``
:type calendar_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``calendar_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_calendar_id_terms(self):
"""Clears the calendar ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
calendar_id_terms = property(fdel=clear_calendar_id_terms)
@abc.abstractmethod
def supports_calendar_query(self):
"""Tests if a ``CalendarQuery`` is available for querying calendars.
:return: ``true`` if a calendar query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_calendar_query(self):
"""Gets the query for a calendar.
Multiple retrievals produce a nested ``OR`` term.
:return: the calendar query
:rtype: ``osid.calendaring.CalendarQuery``
:raise: ``Unimplemented`` -- ``supports_calendar_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_calendar_query()`` is ``true``.*
"""
return # osid.calendaring.CalendarQuery
calendar_query = property(fget=get_calendar_query)
@abc.abstractmethod
def clear_calendar_terms(self):
"""Clears the calendar terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
calendar_terms = property(fdel=clear_calendar_terms)
@abc.abstractmethod
def get_offset_event_query_record(self, offset_event_record_type):
"""Gets the offset event query record corresponding to the given ``OffsetEvent`` record ``Type``.
Multiple retrievals produce a nested ``OR`` term.
:param offset_event_record_type: an offset event query record type
:type offset_event_record_type: ``osid.type.Type``
:return: the offset event query record
:rtype: ``osid.calendaring.records.OffsetEventQueryRecord``
:raise: ``NullArgument`` -- ``offset_event_record_type`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unsupported`` -- ``has_record_type(offset_event_record_type)`` is ``false``
*compliance: mandatory -- This method must be implemented.*
"""
return # osid.calendaring.records.OffsetEventQueryRecord
class ScheduleQuery:
"""This is the query for searching schedules.
Each method match request produces an ``AND`` term while multiple
invocations of a method produces a nested ``OR``.
"""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def match_schedule_slot_id(self, schedule_slot_id, match):
"""Sets the schedule ``Id`` for this query for matching nested schedule slots.
:param schedule_slot_id: a schedule slot ``Id``
:type schedule_slot_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``schedule_slot_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_schedule_slot_id_terms(self):
"""Clears the schedule slot ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
schedule_slot_id_terms = property(fdel=clear_schedule_slot_id_terms)
@abc.abstractmethod
def supports_schedule_slot_query(self):
"""Tests if a ``ScheduleSlotQuery`` is available for querying sechedule slots.
:return: ``true`` if a schedule slot query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_schedule_slot_query(self):
"""Gets the query for a schedul slot.
Multiple retrievals produce a nested ``OR`` term.
:return: the schedule slot query
:rtype: ``osid.calendaring.ScheduleSlotQuery``
:raise: ``Unimplemented`` -- ``supports_schedule_slot_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_schedule_slot_query()`` is ``true``.*
"""
return # osid.calendaring.ScheduleSlotQuery
schedule_slot_query = property(fget=get_schedule_slot_query)
@abc.abstractmethod
def match_any_schedule_slot(self, match):
"""Matches a schedule that has any schedule slot assigned.
:param match: ``true`` to match schedule with any schedule slots, ``false`` to match schedules with no schedule
slots
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_schedule_slot_terms(self):
"""Clears the schedule slot terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
schedule_slot_terms = property(fdel=clear_schedule_slot_terms)
@abc.abstractmethod
def match_time_period_id(self, time_period_id, match):
"""Sets the time period ``Id`` for this query.
:param time_period_id: a time period ``Id``
:type time_period_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``time_period_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_time_period_id_terms(self):
"""Clears the time period ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
time_period_id_terms = property(fdel=clear_time_period_id_terms)
@abc.abstractmethod
def supports_time_period_query(self):
"""Tests if a ``TimePeriodQuery`` is available.
:return: ``true`` if a time period query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_time_period_query(self):
"""Gets the query for a time period.
Multiple retrievals produce a nested ``OR`` term.
:return: the time period query
:rtype: ``osid.calendaring.TimePeriodQuery``
:raise: ``Unimplemented`` -- ``supports_time_period_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_time_period_query()`` is ``true``.*
"""
return # osid.calendaring.TimePeriodQuery
time_period_query = property(fget=get_time_period_query)
@abc.abstractmethod
def match_any_time_period(self, match):
"""Matches a schedule that has any time period assigned.
:param match: ``true`` to match schedules with any time periods, ``false`` to match schedules with no time
periods
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_time_period_terms(self):
"""Clears the time period terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
time_period_terms = property(fdel=clear_time_period_terms)
@abc.abstractmethod
def match_schedule_start(self, low, high, match):
"""Matches the schedule start time between the given range inclusive.
:param low: low time range
:type low: ``osid.calendaring.DateTime``
:param high: high time range
:type high: ``osid.calendaring.DateTime``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``high`` is less than ``low``
:raise: ``NullArgument`` -- ``high`` or ``low`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_schedule_start(self, match):
"""Matches a schedule that has any start time assigned.
:param match: ``true`` to match schedules with any start time, ``false`` to match schedules with no start time
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_schedule_start_terms(self):
"""Clears the schedule start terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
schedule_start_terms = property(fdel=clear_schedule_start_terms)
@abc.abstractmethod
def match_schedule_end(self, low, high, match):
"""Matches the schedule end time between the given range inclusive.
:param low: low time range
:type low: ``osid.calendaring.DateTime``
:param high: high time range
:type high: ``osid.calendaring.DateTime``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``high`` is less than ``low``
:raise: ``NullArgument`` -- ``high`` or ``low`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_schedule_end(self, match):
"""Matches a schedule that has any end time assigned.
:param match: ``true`` to match schedules with any end time, ``false`` to match schedules with no start time
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_schedule_end_terms(self):
"""Clears the schedule end terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
schedule_end_terms = property(fdel=clear_schedule_end_terms)
@abc.abstractmethod
def match_schedule_time(self, date, match):
"""Matches schedules with start and end times between the given range inclusive.
:param date: a date
:type date: ``osid.calendaring.DateTime``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``date`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_schedule_time(self, match):
"""Matches schedules that has any time assigned.
:param match: ``true`` to match schedules with any time, ``false`` to match schedules with no time
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_schedule_time_terms(self):
"""Clears the schedule time terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
schedule_time_terms = property(fdel=clear_schedule_time_terms)
@abc.abstractmethod
def match_schedule_time_inclusive(self, start, end, match):
"""Matches schedules with start and end times between the given range inclusive.
:param start: start date
:type start: ``osid.calendaring.DateTime``
:param end: end date
:type end: ``osid.calendaring.DateTime``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``end`` is less than ``start``
:raise: ``NullArgument`` -- ``end`` or ``start`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_schedule_time_inclusive_terms(self):
"""Clears the schedule time inclusive terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
schedule_time_inclusive_terms = property(fdel=clear_schedule_time_inclusive_terms)
@abc.abstractmethod
def match_limit(self, from_, to, match):
"""Matches schedules that have the given limit in the given range inclusive.
:param from: start range
:type from: ``integer``
:param to: end range
:type to: ``integer``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``to`` is less than ``from``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_limit(self, match):
"""Matches schedules with any occurrence limit.
:param match: ``true`` to match schedules with any limit, to match schedules with no limit
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_limit_terms(self):
"""Clears the limit terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
limit_terms = property(fdel=clear_limit_terms)
@abc.abstractmethod
def match_location_description(self, location, string_match_type, match):
"""Matches the location description string.
:param location: location string
:type location: ``string``
:param string_match_type: string match type
:type string_match_type: ``osid.type.Type``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``location`` is not of ``string_match_type``
:raise: ``NullArgument`` -- ``location`` or ``string_match_type`` is ``null``
:raise: ``Unsupported`` -- ``supports_string_match_type(string_match_type)`` is ``false``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_location_description(self, match):
"""Matches a schedule that has any location description assigned.
:param match: ``true`` to match schedules with any location description, ``false`` to match schedules with no
location description
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_location_description_terms(self):
"""Clears the location description terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
location_description_terms = property(fdel=clear_location_description_terms)
@abc.abstractmethod
def match_location_id(self, location_id, match):
"""Sets the location ``Id`` for this query.
:param location_id: a location ``Id``
:type location_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``location_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_location_id_terms(self):
"""Clears the location ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
location_id_terms = property(fdel=clear_location_id_terms)
@abc.abstractmethod
def supports_location_query(self):
"""Tests if a ``LocationQuery`` is available for querying locations.
:return: ``true`` if a location query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_location_query(self):
"""Gets the query for a location.
Multiple retrievals produce a nested ``OR`` term.
:return: the location query
:rtype: ``osid.mapping.LocationQuery``
:raise: ``Unimplemented`` -- ``supports_location_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_location_query()`` is ``true``.*
"""
return # osid.mapping.LocationQuery
location_query = property(fget=get_location_query)
@abc.abstractmethod
def match_any_location(self, match):
"""Matches a schedule that has any location assigned.
:param match: ``true`` to match schedules with any location, ``false`` to match schedules with no location
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_location_terms(self):
"""Clears the location terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
location_terms = property(fdel=clear_location_terms)
@abc.abstractmethod
def match_total_duration(self, low, high, match):
"""Matches the total duration between the given range inclusive.
:param low: low duration range
:type low: ``osid.calendaring.Duration``
:param high: high duration range
:type high: ``osid.calendaring.Duration``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``high`` is less than ``low``
:raise: ``NullArgument`` -- ``high`` or ``low`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_total_duration_terms(self):
"""Clears the total duration terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
total_duration_terms = property(fdel=clear_total_duration_terms)
@abc.abstractmethod
def match_calendar_id(self, calendar_id, match):
"""Sets the calendar ``Id`` for this query.
:param calendar_id: a calendar ``Id``
:type calendar_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``calendar_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_calendar_id_terms(self):
"""Clears the calendar ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
calendar_id_terms = property(fdel=clear_calendar_id_terms)
@abc.abstractmethod
def supports_calendar_query(self):
"""Tests if a ``CalendarQuery`` is available for querying calendars.
:return: ``true`` if a calendar query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_calendar_query(self):
"""Gets the query for a calendar.
Multiple retrievals produce a nested ``OR`` term.
:return: the calendar query
:rtype: ``osid.calendaring.CalendarQuery``
:raise: ``Unimplemented`` -- ``supports_calendar_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_calendar_query()`` is ``true``.*
"""
return # osid.calendaring.CalendarQuery
calendar_query = property(fget=get_calendar_query)
@abc.abstractmethod
def clear_calendar_terms(self):
"""Clears the calendar terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
calendar_terms = property(fdel=clear_calendar_terms)
@abc.abstractmethod
def get_schedule_query_record(self, schedule_record_type):
"""Gets the schedule query record corresponding to the given ``Schedule`` record ``Type``.
Multiple retrievals produce a nested ``OR`` term.
:param schedule_record_type: a schedule query record type
:type schedule_record_type: ``osid.type.Type``
:return: the schedule query record
:rtype: ``osid.calendaring.records.ScheduleQueryRecord``
:raise: ``NullArgument`` -- ``schedule_record_type`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unsupported`` -- ``has_record_type(schedule_record_type)`` is ``false``
*compliance: mandatory -- This method must be implemented.*
"""
return # osid.calendaring.records.ScheduleQueryRecord
class ScheduleSlotQuery:
"""This is the query for searching schedule slots.
Each method match request produces an ``AND`` term while multiple
invocations of a method produces a nested ``OR``.
"""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def match_schedule_slot_id(self, schedule_slot_id, match):
"""Sets the schedule ``Id`` for this query for matching nested schedule slots.
:param schedule_slot_id: a schedule slot ``Id``
:type schedule_slot_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``schedule_slot_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_schedule_slot_id_terms(self):
"""Clears the schedule slot ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
schedule_slot_id_terms = property(fdel=clear_schedule_slot_id_terms)
@abc.abstractmethod
def supports_schedule_slot_query(self):
"""Tests if a ``ScheduleSlotQuery`` is available for querying sechedule slots.
:return: ``true`` if a schedule slot query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_schedule_slot_query(self):
"""Gets the query for a schedul slot.
Multiple retrievals produce a nested ``OR`` term.
:return: the schedule slot query
:rtype: ``osid.calendaring.ScheduleSlotQuery``
:raise: ``Unimplemented`` -- ``supports_schedule_slot_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_schedule_slot_query()`` is ``true``.*
"""
return # osid.calendaring.ScheduleSlotQuery
schedule_slot_query = property(fget=get_schedule_slot_query)
@abc.abstractmethod
def match_any_schedule_slot(self, match):
"""Matches a schedule that has any schedule slot assigned.
:param match: ``true`` to match schedule with any schedule slots, ``false`` to match schedules with no schedule
slots
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_schedule_slot_terms(self):
"""Clears the schedule slot terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
schedule_slot_terms = property(fdel=clear_schedule_slot_terms)
@abc.abstractmethod
def match_weekday(self, weekday, match):
"""Matches schedules that have the given weekday.
:param weekday: a weekday
:type weekday: ``cardinal``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_weekday(self, match):
"""Matches schedules with any weekday set.
:param match: ``true`` to match schedules with any weekday, ``false`` to match schedules with no weekday
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_weekday_terms(self):
"""Clears the weekday terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
weekday_terms = property(fdel=clear_weekday_terms)
@abc.abstractmethod
def match_weekly_interval(self, from_, to, match):
"""Matches schedules that have the given weekly interval in the given range inclusive.
:param from: start range
:type from: ``integer``
:param to: end range
:type to: ``integer``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``to`` is less than ``from``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_weekly_interval(self, match):
"""Matches schedules with any weekly interval set.
:param match: ``true`` to match schedules with any weekly interval, ``false`` to match schedules with no weekly
interval
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_weekly_interval_terms(self):
"""Clears the weekly interval terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
weekly_interval_terms = property(fdel=clear_weekly_interval_terms)
@abc.abstractmethod
def match_week_of_month(self, from_, to, match):
"""Matches schedules that have a week of month in the given range inclusive.
:param from: start range
:type from: ``integer``
:param to: end range
:type to: ``integer``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``to`` is less than ``from``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_week_of_month(self, match):
"""Matches schedules with any month week set.
:param match: ``true`` to match schedules with any week of month, ``false`` to match schedules with no month
week
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_week_of_month_terms(self):
"""Clears the week of month terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
week_of_month_terms = property(fdel=clear_week_of_month_terms)
@abc.abstractmethod
def match_weekday_time(self, from_, to, match):
"""Matches schedules that have a weekday time in the given range inclusive.
:param from: start range
:type from: ``osid.calendaring.Time``
:param to: end range
:type to: ``osid.calendaring.Time``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``to`` is less than ``from``
:raise: ``NullArgument`` -- ``from`` or ``to`` ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_weekday_time(self, match):
"""Matches schedules with any weekday time.
:param match: ``true`` to match schedules with any weekday time, ``false`` to match schedules with no weekday
time
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_weekday_time_terms(self):
"""Clears the weekday time terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
weekday_time_terms = property(fdel=clear_weekday_time_terms)
@abc.abstractmethod
def match_fixed_interval(self, from_, to, match):
"""Matches schedules that have the given fixed interval in the given range inclusive.
:param from: start range
:type from: ``osid.calendaring.Duration``
:param to: end range
:type to: ``osid.calendaring.Duration``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``to`` is less than ``from``
:raise: ``NullArgument`` -- ``from`` or ``to`` ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_fixed_interval(self, match):
"""Matches schedules with any fixed interval.
:param match: ``true`` to match schedules with any fixed interval, ``false`` to match schedules with no fixed
interval
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_fixed_interval_terms(self):
"""Clears the fixed interval terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
fixed_interval_terms = property(fdel=clear_fixed_interval_terms)
@abc.abstractmethod
def match_duration(self, low, high, match):
"""Matches the duration between the given range inclusive.
:param low: low duration range
:type low: ``osid.calendaring.Duration``
:param high: high duration range
:type high: ``osid.calendaring.Duration``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``high`` is less than ``low``
:raise: ``NullArgument`` -- ``high`` or ``low`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_duration(self, match):
"""Matches a schedule slot that has any duration.
:param match: ``true`` to match schedules with any duration, ``false`` to match schedules with no start time
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_duration_terms(self):
"""Clears the duration terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
duration_terms = property(fdel=clear_duration_terms)
@abc.abstractmethod
def match_calendar_id(self, calendar_id, match):
"""Sets the calendar ``Id`` for this query.
:param calendar_id: a calendar ``Id``
:type calendar_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``calendar_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_calendar_id_terms(self):
"""Clears the calendar ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
calendar_id_terms = property(fdel=clear_calendar_id_terms)
@abc.abstractmethod
def supports_calendar_query(self):
"""Tests if a ``CalendarQuery`` is available for querying calendars.
:return: ``true`` if a calendar query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_calendar_query(self):
"""Gets the query for a calendar.
Multiple retrievals produce a nested ``OR`` term.
:return: the calendar query
:rtype: ``osid.calendaring.CalendarQuery``
:raise: ``Unimplemented`` -- ``supports_calendar_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_calendar_query()`` is ``true``.*
"""
return # osid.calendaring.CalendarQuery
calendar_query = property(fget=get_calendar_query)
@abc.abstractmethod
def clear_calendar_terms(self):
"""Clears the calendar terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
calendar_terms = property(fdel=clear_calendar_terms)
@abc.abstractmethod
def get_schedule_slot_query_record(self, schedule_slot_record_type):
"""Gets the schedule slot query record corresponding to the given ``ScheduleSlot`` record ``Type``.
Multiple retrievals produce a nested ``OR`` term.
:param schedule_slot_record_type: a schedule slot query record type
:type schedule_slot_record_type: ``osid.type.Type``
:return: the schedule slot query record
:rtype: ``osid.calendaring.records.ScheduleSlotQueryRecord``
:raise: ``NullArgument`` -- ``schedule_slot_record_type`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unsupported`` -- ``has_record_type(schedule_slot_record_type)`` is ``false``
*compliance: mandatory -- This method must be implemented.*
"""
return # osid.calendaring.records.ScheduleSlotQueryRecord
class TimePeriodQuery:
"""This is the query for searching time periods.
Each method match request produces an ``AND`` term while multiple
invocations of a method produces a nested ``OR``.
"""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def match_start(self, low, high, match):
"""Matches the time period start time between the given range inclusive.
:param low: low time range
:type low: ``osid.calendaring.DateTime``
:param high: high time range
:type high: ``osid.calendaring.DateTime``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``high`` is less than ``low``
:raise: ``NullArgument`` -- ``high`` or ``low`` is ``zero``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_start(self, match):
"""Matches a time period that has any start time assigned.
:param match: ``true`` to match time periods with any start time, ``false`` to match time periods with no start
time
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_start_terms(self):
"""Clears the time period start terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
start_terms = property(fdel=clear_start_terms)
@abc.abstractmethod
def match_end(self, low, high, match):
"""Matches the time period end time between the given range inclusive.
:param low: low time range
:type low: ``osid.calendaring.DateTime``
:param high: high time range
:type high: ``osid.calendaring.DateTime``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``high`` is less than ``low``
:raise: ``NullArgument`` -- ``high`` or ``low`` is ``zero``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_end(self, match):
"""Matches a time period that has any end time assigned.
:param match: ``true`` to match time periods with any end time, ``false`` to match time periods with no end time
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_end_terms(self):
"""Clears the time period end terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
end_terms = property(fdel=clear_end_terms)
@abc.abstractmethod
def match_time(self, time, match):
"""Matches time periods that include the given time.
:param time: date
:type time: ``osid.calendaring.DateTime``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def match_any_time(self, match):
"""Matches a time period that has any time assigned.
:param match: ``true`` to match time periods with any time, ``false`` to match time periods with no time
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_time_terms(self):
"""Clears the time terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
time_terms = property(fdel=clear_time_terms)
@abc.abstractmethod
def match_time_inclusive(self, start, end, match):
"""Matches time periods with start and end times between the given range inclusive.
:param start: start date
:type start: ``osid.calendaring.DateTime``
:param end: end date
:type end: ``osid.calendaring.DateTime``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``end`` is less than ``start``
:raise: ``NullArgument`` -- ``start`` or ``end`` is ``zero``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_time_inclusive_terms(self):
"""Clears the time inclusive terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
time_inclusive_terms = property(fdel=clear_time_inclusive_terms)
@abc.abstractmethod
def match_duration(self, low, high, match):
"""Matches the time period duration between the given range inclusive.
:param low: low duration range
:type low: ``osid.calendaring.Duration``
:param high: high duration range
:type high: ``osid.calendaring.Duration``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``InvalidArgument`` -- ``high`` is less than ``low``
:raise: ``NullArgument`` -- ``high`` or ``low`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_duration_terms(self):
"""Clears the duration terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
duration_terms = property(fdel=clear_duration_terms)
@abc.abstractmethod
def match_exception_id(self, event_id, match):
"""Sets the event ``Id`` for this query to match exceptions.
:param event_id: an exception event ``Id``
:type event_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``event_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_exception_id_terms(self):
"""Clears the exception event ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
exception_id_terms = property(fdel=clear_exception_id_terms)
@abc.abstractmethod
def supports_exception_query(self):
"""Tests if an ``EventQuery`` is available for querying exception events.
:return: ``true`` if a exception query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_exception_query(self):
"""Gets the query for an exception event.
Multiple retrievals produce a nested ``OR`` term.
:return: the event query
:rtype: ``osid.calendaring.EventQuery``
:raise: ``Unimplemented`` -- ``supports_exception_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_exception_query()`` is ``true``.*
"""
return # osid.calendaring.EventQuery
exception_query = property(fget=get_exception_query)
@abc.abstractmethod
def match_any_exception(self, match):
"""Matches a time period that has any exception event assigned.
:param match: ``true`` to match time periods with any exception, ``false`` to match time periods with no
exception
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_exception_terms(self):
"""Clears the exception event terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
exception_terms = property(fdel=clear_exception_terms)
@abc.abstractmethod
def match_event_id(self, event_id, match):
"""Sets the event ``Id`` for this query.
:param event_id: an event or recurring event ``Id``
:type event_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``event_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_event_id_terms(self):
"""Clears the event ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
event_id_terms = property(fdel=clear_event_id_terms)
@abc.abstractmethod
def supports_event_query(self):
"""Tests if an ``EventQuery`` is available for querying events.
:return: ``true`` if an event query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_event_query(self):
"""Gets the query for an event or recurring event.
Multiple retrievals produce a nested ``OR`` term.
:return: the event query
:rtype: ``osid.calendaring.EventQuery``
:raise: ``Unimplemented`` -- ``supports_event_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_event_query()`` is ``true``.*
"""
return # osid.calendaring.EventQuery
event_query = property(fget=get_event_query)
@abc.abstractmethod
def match_any_event(self, match):
"""Matches a time period that has any event assigned.
:param match: ``true`` to match time periods with any event, ``false`` to match time periods with no events
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_event_terms(self):
"""Clears the event terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
event_terms = property(fdel=clear_event_terms)
@abc.abstractmethod
def match_calendar_id(self, calendar_id, match):
"""Sets the calendar ``Id`` for this query.
:param calendar_id: a calendar ``Id``
:type calendar_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``calendar_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_calendar_id_terms(self):
"""Clears the calendar ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
calendar_id_terms = property(fdel=clear_calendar_id_terms)
@abc.abstractmethod
def supports_calendar_query(self):
"""Tests if a ``CalendarQuery`` is available for querying resources.
:return: ``true`` if a calendar query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_calendar_query(self):
"""Gets the query for a calendar.
Multiple retrievals produce a nested ``OR`` term.
:return: the calendar query
:rtype: ``osid.calendaring.CalendarQuery``
:raise: ``Unimplemented`` -- ``supports_calendar_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_calendar_query()`` is ``true``.*
"""
return # osid.calendaring.CalendarQuery
calendar_query = property(fget=get_calendar_query)
@abc.abstractmethod
def clear_calendar_terms(self):
"""Clears the calendar terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
calendar_terms = property(fdel=clear_calendar_terms)
@abc.abstractmethod
def get_time_period_query_record(self, time_period_record_type):
"""Gets the time period query record corresponding to the given ``TimePeriod`` record ``Type``.
Multiple retrievals produce a nested ``OR`` term.
:param time_period_record_type: a time period query record type
:type time_period_record_type: ``osid.type.Type``
:return: the time period query record
:rtype: ``osid.calendaring.records.TimePeriodQueryRecord``
:raise: ``NullArgument`` -- ``time_period_record_type`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unsupported`` -- ``has_record_type(time_period_record_type)`` is ``false``
*compliance: mandatory -- This method must be implemented.*
"""
return # osid.calendaring.records.TimePeriodQueryRecord
class CommitmentQuery:
"""This is the query for searching commitments.
Each method match request produces an ``AND`` term while multiple
invocations of a method produces a nested ``OR``.
"""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def match_event_id(self, event_id, match):
"""Sets the event ``Id`` for this query.
:param event_id: an event ``Id``
:type event_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``event_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_event_id_terms(self):
"""Clears the event ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
event_id_terms = property(fdel=clear_event_id_terms)
@abc.abstractmethod
def supports_event_query(self):
"""Tests if an ``EventQuery`` is available.
:return: ``true`` if an event query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_event_query(self):
"""Gets the query for an event.
Multiple retrievals produce a nested ``OR`` term.
:return: the event query
:rtype: ``osid.calendaring.EventQuery``
:raise: ``Unimplemented`` -- ``supports_event_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_event_query()`` is ``true``.*
"""
return # osid.calendaring.EventQuery
event_query = property(fget=get_event_query)
@abc.abstractmethod
def clear_event_terms(self):
"""Clears the event terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
event_terms = property(fdel=clear_event_terms)
@abc.abstractmethod
def match_resource_id(self, resource_id, match):
"""Sets the resource ``Id`` for this query.
:param resource_id: a resource ``Id``
:type resource_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``resource_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_resource_id_terms(self):
"""Clears the resource ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
resource_id_terms = property(fdel=clear_resource_id_terms)
@abc.abstractmethod
def supports_resource_query(self):
"""Tests if a ``ResourceQuery`` is available for querying resources.
:return: ``true`` if a resource query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_resource_query(self):
"""Gets the query for a resource.
Multiple retrievals produce a nested ``OR`` term.
:return: the resource query
:rtype: ``osid.resource.ResourceQuery``
:raise: ``Unimplemented`` -- ``supports_resource_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_resource_query()`` is ``true``.*
"""
return # osid.resource.ResourceQuery
resource_query = property(fget=get_resource_query)
@abc.abstractmethod
def clear_resource_terms(self):
"""Clears the resource terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
resource_terms = property(fdel=clear_resource_terms)
@abc.abstractmethod
def match_calendar_id(self, calendar_id, match):
"""Sets the calendar ``Id`` for this query.
:param calendar_id: a calendar ``Id``
:type calendar_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``calendar_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_calendar_id_terms(self):
"""Clears the calendar ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
calendar_id_terms = property(fdel=clear_calendar_id_terms)
@abc.abstractmethod
def supports_calendar_query(self):
"""Tests if a ``CalendarQuery`` is available for querying resources.
:return: ``true`` if a calendar query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_calendar_query(self):
"""Gets the query for a calendar.
Multiple retrievals produce a nested ``OR`` term.
:return: the calendar query
:rtype: ``osid.calendaring.CalendarQuery``
:raise: ``Unimplemented`` -- ``supports_calendar_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_calendar_query()`` is ``true``.*
"""
return # osid.calendaring.CalendarQuery
calendar_query = property(fget=get_calendar_query)
@abc.abstractmethod
def clear_calendar_terms(self):
"""Clears the calendar terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
calendar_terms = property(fdel=clear_calendar_terms)
@abc.abstractmethod
def get_commitment_query_record(self, commitment_record_type):
"""Gets the commitment query record corresponding to the given ``Commitment`` record ``Type``.
Multiple retrievals produce a nested ``OR`` term.
:param commitment_record_type: a commitment query record type
:type commitment_record_type: ``osid.type.Type``
:return: the commitment query record
:rtype: ``osid.calendaring.records.CommitmentQueryRecord``
:raise: ``NullArgument`` -- ``commitment_record_type`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unsupported`` -- ``has_record_type(commitment_record_type)`` is ``false``
*compliance: mandatory -- This method must be implemented.*
"""
return # osid.calendaring.records.CommitmentQueryRecord
class CalendarQuery:
"""This is the query for searching calendars.
Each method specifies an ``AND`` term while multiple invocations of
the same method produce a nested ``OR``.
"""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def match_event_id(self, event_id, match):
"""Sets the event ``Id`` for this query.
:param event_id: an event ``Id``
:type event_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``event_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_event_id_terms(self):
"""Clears the event ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
event_id_terms = property(fdel=clear_event_id_terms)
@abc.abstractmethod
def supports_event_query(self):
"""Tests if an ``EventQuery`` is available.
:return: ``true`` if an event query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_event_query(self):
"""Gets the query for an event.
Multiple retrievals produce a nested ``OR`` term.
:return: the event query
:rtype: ``osid.calendaring.EventQuery``
:raise: ``Unimplemented`` -- ``supports_event_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_event_query()`` is ``true``.*
"""
return # osid.calendaring.EventQuery
event_query = property(fget=get_event_query)
@abc.abstractmethod
def match_any_event(self, match):
"""Matches a calendar that has any event assigned.
:param match: ``true`` to match calendars with any event, ``false`` to match calendars with no events
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_event_terms(self):
"""Clears the event terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
event_terms = property(fdel=clear_event_terms)
@abc.abstractmethod
def match_time_period_id(self, time_period_id, match):
"""Sets the time period ``Id`` for this query.
:param time_period_id: a time period ``Id``
:type time_period_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``time_period_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_time_period_id_terms(self):
"""Clears the time period ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
time_period_id_terms = property(fdel=clear_time_period_id_terms)
@abc.abstractmethod
def supports_time_period_query(self):
"""Tests if a ``TimePeriodQuery`` is available.
:return: ``true`` if a time period query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_time_period_query(self):
"""Gets the query for a time period.
Multiple retrievals produce a nested ``OR`` term.
:return: the tiem period query
:rtype: ``osid.calendaring.TimePeriodQuery``
:raise: ``Unimplemented`` -- ``supports_time_period_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_time_period_query()`` is ``true``.*
"""
return # osid.calendaring.TimePeriodQuery
time_period_query = property(fget=get_time_period_query)
@abc.abstractmethod
def match_any_time_period(self, match):
"""Matches a calendar that has any time period assigned.
:param match: ``true`` to match calendars with any time period, ``false`` to match calendars with no time
periods
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_time_period_terms(self):
"""Clears the time period terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
time_period_terms = property(fdel=clear_time_period_terms)
@abc.abstractmethod
def match_commitment_id(self, commitment_id, match):
"""Sets the commitment ``Id`` for this query.
:param commitment_id: a commitment ``Id``
:type commitment_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``commitment_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_commitment_id_terms(self):
"""Clears the commitment ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
commitment_id_terms = property(fdel=clear_commitment_id_terms)
@abc.abstractmethod
def supports_commitment_query(self):
"""Tests if a ``CommitmentQuery`` is available.
:return: ``true`` if a commitment query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_commitment_query(self):
"""Gets the query for a commitment.
Multiple retrievals produce a nested ``OR`` term.
:return: the commitment query
:rtype: ``osid.calendaring.CommitmentQuery``
:raise: ``Unimplemented`` -- ``supports_commitment_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_commitment_query()`` is ``true``.*
"""
return # osid.calendaring.CommitmentQuery
commitment_query = property(fget=get_commitment_query)
@abc.abstractmethod
def match_any_commitment(self, match):
"""Matches a calendar that has any event commitment.
:param match: ``true`` to match calendars with any commitment, ``false`` to match calendars with no commitments
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_commitment_terms(self):
"""Clears the commitment terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
commitment_terms = property(fdel=clear_commitment_terms)
@abc.abstractmethod
def match_ancestor_calendar_id(self, calendar_id, match):
"""Sets the calendar ``Id`` for this query to match calendars that have the specified calendar as an ancestor.
:param calendar_id: a calendar ``Id``
:type calendar_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``calendar_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_ancestor_calendar_id_terms(self):
"""Clears the ancestor calendar ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
ancestor_calendar_id_terms = property(fdel=clear_ancestor_calendar_id_terms)
@abc.abstractmethod
def supports_ancestor_calendar_query(self):
"""Tests if a ``CalendarQuery`` is available.
:return: ``true`` if a calendar query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_ancestor_calendar_query(self):
"""Gets the query for a calendar.
Multiple retrievals produce a nested ``OR`` term.
:return: the calendar query
:rtype: ``osid.calendaring.CalendarQuery``
:raise: ``Unimplemented`` -- ``supports_ancestor_calendar_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_ancestor_calndar_query()`` is ``true``.*
"""
return # osid.calendaring.CalendarQuery
ancestor_calendar_query = property(fget=get_ancestor_calendar_query)
@abc.abstractmethod
def match_any_ancestor_calendar(self, match):
"""Matches a calendar that has any ancestor.
:param match: ``true`` to match calendars with any ancestor, ``false`` to match root calendars
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_ancestor_calendar_terms(self):
"""Clears the ancestor calendar terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
ancestor_calendar_terms = property(fdel=clear_ancestor_calendar_terms)
@abc.abstractmethod
def match_descendant_calendar_id(self, calendar_id, match):
"""Sets the calendar ``Id`` for this query to match calendars that have the specified calendar as a descendant.
:param calendar_id: a calendar ``Id``
:type calendar_id: ``osid.id.Id``
:param match: ``true`` for a positive match, ``false`` for a negative match
:type match: ``boolean``
:raise: ``NullArgument`` -- ``calendar_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_descendant_calendar_id_terms(self):
"""Clears the descendant calendar ``Id`` terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
descendant_calendar_id_terms = property(fdel=clear_descendant_calendar_id_terms)
@abc.abstractmethod
def supports_descendant_calendar_query(self):
"""Tests if a ``CalendarQuery``.
:return: ``true`` if a calendar query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_descendant_calendar_query(self):
"""Gets the query for a calendar.
Multiple retrievals produce a nested ``OR`` term.
:return: the calendar query
:rtype: ``osid.calendaring.CalendarQuery``
:raise: ``Unimplemented`` -- ``supports_descendant_calendar_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_descendant_calndar_query()`` is ``true``.*
"""
return # osid.calendaring.CalendarQuery
descendant_calendar_query = property(fget=get_descendant_calendar_query)
@abc.abstractmethod
def match_any_descendant_calendar(self, match):
"""Matches a calendar that has any descendant.
:param match: ``true`` to match calendars with any descendant, ``false`` to match leaf calendars
:type match: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
pass
@abc.abstractmethod
def clear_descendant_calendar_terms(self):
"""Clears the descendant calendar terms.
*compliance: mandatory -- This method must be implemented.*
"""
pass
descendant_calendar_terms = property(fdel=clear_descendant_calendar_terms)
@abc.abstractmethod
def get_calendar_query_record(self, calendar_record_type):
"""Gets the calendar query record corresponding to the given ``Calendar`` record ``Type``.
Multiple record retrievals produce a nested ``OR`` term.
:param calendar_record_type: a calendar record type
:type calendar_record_type: ``osid.type.Type``
:return: the calendar query record
:rtype: ``osid.calendaring.records.CalendarQueryRecord``
:raise: ``NullArgument`` -- ``calendar_record_type`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unsupported`` -- ``has_record_type(calendar_record_type)`` is ``false``
*compliance: mandatory -- This method must be implemented.*
"""
return # osid.calendaring.records.CalendarQueryRecord
| 28.934574 | 120 | 0.632409 |
9662728c799081dee7bec41ea238bea7c8b6ec56 | 932 | php | PHP | application/views/type/index.php | elyor0529/MadinatJumeirahInv | b382aaa5e89098c81bdff44de786336db3fb58a9 | [
"Apache-2.0"
] | null | null | null | application/views/type/index.php | elyor0529/MadinatJumeirahInv | b382aaa5e89098c81bdff44de786336db3fb58a9 | [
"Apache-2.0"
] | null | null | null | application/views/type/index.php | elyor0529/MadinatJumeirahInv | b382aaa5e89098c81bdff44de786336db3fb58a9 | [
"Apache-2.0"
] | null | null | null | <div class="type">
<form class="form-inline">
<a href="<?php echo site_url('type/add'); ?>" class="btn btn-primary glyphicon glyphicon-plus"
aria-hidden="true"></span>Add</a>
</form>
<table class="table table-inverse" style="width: 50%;">
<thead>
<tr>
<th>Name</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($rows as $row) { ?>
<tr>
<td><?php echo $row->name ?></td>
<td>
<a href="<?php echo site_url('type/edit/'.$row->id); ?>" class="btn btn-success"><span
class="glyphicon glyphicon-edit" aria-hidden="true"></span></a>
<a href="#" class="btn btn-danger" onclick="askTypeDeleting(<?php echo $row->id; ?>)"><span
class="glyphicon glyphicon-trash" aria-hidden="true"></span></a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div> | 34.518519 | 107 | 0.496781 |
70bfbfbf9c88bff2eaf2bcce92026bbd1fa67672 | 8,463 | c | C | distribution/src/space.c | Abhishek-17/Intranet-Web-Radio | 672568bdb8593a81f41877b786e15b3414f3661d | [
"BSD-2-Clause"
] | 1 | 2016-03-04T14:10:06.000Z | 2016-03-04T14:10:06.000Z | distribution/src/space.c | Abhishek-17/Intranet-Web-Radio | 672568bdb8593a81f41877b786e15b3414f3661d | [
"BSD-2-Clause"
] | null | null | null | distribution/src/space.c | Abhishek-17/Intranet-Web-Radio | 672568bdb8593a81f41877b786e15b3414f3661d | [
"BSD-2-Clause"
] | null | null | null | /*
Copyright (C) 1996 Alistair Conkie
You may distribute under the terms of the GNU General Public
Licence as specified in the README file.
*/
/* This makes the space and has the global data pointers defined too */
#include "t2s.h"
#include <sys/types.h>
#include <limits.h>
/* FreeBSD, and Linux? */
#ifdef FBSD_DATABASE
#include <db.h>
#else
#include <ndbm.h>
#endif
#include <fcntl.h>
int ft_endian_loc = 1; /* for deciding if we need to byte-swap */
ENTRY indx[NDIPHS];
FRAME dico[NFRAMES];
int nindex;
export void init(CONFIG *config, BUFFER *buffer, LING_LIST *ling_list, SENT *sent, SPROSOD_LIST *spl, SPN *ps, ACOUSTIC *as)
{
/* check the various files are accessible */
if(!strcmp(config->input_file,"-")) {
config->ifd = stdin;
} else if((config->ifd=fopen(config->input_file,"r")) == NULL) {
(void)fprintf(stderr,"File not accessible: %s\n",config->input_file);
exit(3);
}
output_open(config);
/* load the diphones including index */
load_speech(config);
/* set up database if present */
if(strcmp("-",config->hash_file)) {
#ifdef FBSD_DATABASE
config->db = (void *)dbopen(config->hash_file,O_RDONLY, 0000644, DB_HASH, NULL);
#else
config->db = (void *)dbm_open(config->hash_file,O_RDONLY, 0000644);
#endif
/* the (void *) is so config can remain ignorant about the database */
if(config->db==NULL) {
(void)fprintf(stderr,"\nDictionary file \"%s\" not found.\n",config->hash_file);
(void)fprintf(stderr,"Using letter-to-sound rules for transcriptions.\n\n");
}
} else {
config->db = (void *)NULL;
}
/* initialise input buffer */
buffer_init(buffer);
/* initialise linguistic list */
ling_list_malloc(DEF_LING_LIST,ling_list);
/* initialise sent list */
sent_init(sent);
/* initialise conv list */
spl_malloc(DEF_SPL,spl);
/* now the synthesis stuff */
ps_malloc(DEF_PHONS,DEF_TARGS,ps);
as_malloc(DEF_FRAMES,DEF_PM,as); /* should perhaps use ps?? */
/* size of fw,clas,dur0 tables (for binary) */
config->fw_num=0;
while(fw[config->fw_num].keyword[0] != '\0')
config->fw_num++;
config->broad_cats_num=0;
while(broad_cats[config->broad_cats_num].keyword[0] != '\0')
config->broad_cats_num++;
config->dur0_num=0;
while(dur0[config->dur0_num].keyword[0] != '\0')
config->dur0_num++;
config->edin2sampa0_num=0;
while(edin2sampa0[config->edin2sampa0_num].keyword[0] != '\0')
config->edin2sampa0_num++;
/* what follows is an example for use as a template */
load_context_rules("context_rules");
/* this goes with the rule engine code...
for(i=0;i<nrules;i++) {
rule[i].lc = regcomp(rule[i].left_context);
rule[i].rc = regcomp(rule[i].right_context);
}
*/
phon_rules_init();
(void)fprintf(stderr,"FreeSpeech (C) 1984,1996 Steve Isard, Alistair Conkie\n");
(void)fprintf(stderr,"There is ABSOLUTELY NO WARRANTY with this program.\n");
}
void terminate(CONFIG *config, BUFFER *buffer, LING_LIST *ling_list, SENT *sent, SPROSOD_LIST *spl, SPN *ps, ACOUSTIC *as)
{
if(config->db != NULL)
#ifdef FBSD_DATABASE
(void)(config->db->close)(config->db);
#else
dbm_close(config->db);
#endif
output_close(config);
buffer_free(buffer);
ling_list_free(ling_list);
sent_free(sent);
spl_free(spl);
ps_free(ps);
as_free(as);
unload_diphs(config);
phon_rules_free();
/* also need to free the various other structures */
}
/* malloc, realloc, free routines */
export void ling_list_malloc(int num, LING_LIST *ling_list)
{
int i;
ling_list->max = num;
ling_list->text = (LING **)malloc(sizeof(LING *)*ling_list->max);
for(i=0;i<ling_list->max;i++) {
ling_list->text[i] = (LING *)malloc(sizeof(LING));
}
ling_list->sz = 0;
}
export void ling_list_realloc(int num, LING_LIST *ling_list)
{
int i;
int rem = ling_list->max;
ling_list->max = num;
ling_list->text = (LING **)realloc(ling_list->text,sizeof(LING *)*ling_list->max);
for(i=rem;i<ling_list->max;i++) {
ling_list->text[i] = (LING *)malloc(sizeof(LING));
}
}
export void ling_list_free(LING_LIST *ling_list)
{
int i;
for(i=0;i<ling_list->max;i++) {
free(ling_list->text[i]);
}
free(ling_list->text);
}
export void spl_malloc(int num, SPROSOD_LIST *spl)
{
int i;
spl->max = num; /* REFerence VALue */
spl->phoneme = (SPROSOD **)malloc(sizeof(SPROSOD *)*spl->max);
for(i=0;i<spl->max;i++) {
spl->phoneme[i] = (SPROSOD *)malloc(sizeof(SPROSOD));
}
spl->sz = 0;
}
export void spl_realloc(int num, SPROSOD_LIST *spl)
{
int i;
int rem = spl->max;
spl->max = num; /* REFerence VALue */
spl->phoneme = (SPROSOD **)realloc(spl->phoneme,sizeof(SPROSOD *)*spl->max);
for(i=rem;i<spl->max;i++) {
spl->phoneme[i] = (SPROSOD *)malloc(sizeof(SPROSOD));
}
/* this seems totally redundant spl->sz = 0; WHY WHY WHY */
}
export void spl_free(SPROSOD_LIST *spl)
{
int i;
for(i=0;i<spl->max;i++) {
free(spl->phoneme[i]);
}
free(spl->phoneme);
}
export void ps_malloc(int nphons, int ntargs, SPN *ps)
{
int i;
ps->p_sz = 0;
ps->p_max = nphons;
ps->t_sz = 0;
ps->t_max = ntargs;
ps->pc_targs = (int *) malloc(sizeof(int)*(ntargs+1));
ps->targ_phon = (int *) malloc(sizeof(int)*(ntargs+1));
ps->targ_freq = (int *) malloc(sizeof(int)*(ntargs+1));
ps->abs_targ = (int *) malloc(sizeof(int)*(ntargs+1));
ps->cum_dur = (int *) malloc(sizeof(int)*(nphons+1));
ps->duration = (int *) malloc(sizeof(int)*(nphons+1));
ps->pb = (int *) malloc(sizeof(int)*(nphons+1));
ps->scale = (float *) malloc(sizeof(float)*(nphons+1));
ps->phons = (char **) malloc(sizeof(int)*(nphons+1));
ps->diphs = (char **) malloc(sizeof(int)*(nphons+1));
for(i=0;i<nphons;i++) {
ps->phons[i] = (char *)malloc(sizeof(PHON_SZ));
ps->diphs[i] = (char *)malloc(sizeof(DIPH_SZ));
}
}
export void ps_realloc(int nphons, int ntargs, SPN *ps)
{
int i;
int rem_p = ps->p_max;
ps->p_max = nphons;
ps->t_max = ntargs;
ps->pc_targs = (int *) realloc(ps->pc_targs,sizeof(int)*(ntargs+1));
ps->targ_phon = (int *) realloc(ps->targ_phon,sizeof(int)*(ntargs+1));
ps->targ_freq = (int *) realloc(ps->targ_freq,sizeof(int)*(ntargs+1));
ps->abs_targ = (int *) realloc(ps->abs_targ,sizeof(int)*(ntargs+1));
ps->cum_dur = (int *) realloc(ps->cum_dur,sizeof(int)*(nphons+1));
ps->duration = (int *) realloc(ps->duration,sizeof(int)*(nphons+1));
ps->pb = (int *) realloc(ps->pb,sizeof(int)*(nphons+1));
ps->scale = (float *) realloc(ps->scale,sizeof(float)*(nphons+1));
ps->phons = (char **) realloc(ps->phons,sizeof(int)*(nphons+1));
ps->diphs = (char **) realloc(ps->diphs,sizeof(int)*(nphons+1));
for(i=rem_p;i<nphons;i++) {
ps->phons[i] = (char *)malloc(sizeof(PHON_SZ));
ps->diphs[i] = (char *)malloc(sizeof(DIPH_SZ));
}
}
export void ps_free(SPN *ps)
{
int i;
for(i=0;i<ps->p_max;i++) {
free(ps->phons[i]);
free(ps->diphs[i]);
}
free(ps->pc_targs);
free(ps->targ_phon);
free(ps->targ_freq);
free(ps->abs_targ);
free(ps->cum_dur);
free(ps->duration);
free(ps->pb);
free(ps->scale);
free(ps->phons);
free(ps->diphs);
}
export void as_malloc(int nframes, int npp, ACOUSTIC *as)
{
as->p_sz = 0;
as->f_sz = 0;
as->p_max = npp;
as->f_max = nframes;
as->mcebuf = (FRAME **) malloc(sizeof(FRAME *)*(nframes));
/*...*/
as->duration = (short *) malloc(sizeof(short)*(nframes));
as->pitch = (short *) malloc(sizeof(short)*(npp));
}
export void as_realloc(int nframes, int npp, ACOUSTIC *as)
{
as->p_max = npp;
as->f_max = nframes;
as->mcebuf = (FRAME **) realloc(as->mcebuf,sizeof(FRAME *)*(nframes));
/*...*/
as->duration = (short *) realloc(as->duration,sizeof(short)*(nframes));
as->pitch = (short *) realloc(as->pitch,sizeof(short)*(npp));
}
export void as_free(ACOUSTIC *as)
{
free(as->mcebuf);
/*...*/
free(as->duration);
free(as->pitch);
}
/*
* 'SENT' operations.
*
*/
export void sent_init(SENT *sent)
{
sent->sil_max = DEF_SENT_SIL;
sent->sil_sz = 0;
sent->sil = (P_ELEM *)malloc(sizeof(P_ELEM)*sent->sil_max);
buffer_init(&(sent->list));
}
export void sent_alloc_sil(SENT *sent, int n)
{
if (n >= sent->sil_max) {
sent->sil_max = ((n*3)/2) + 16;
sent->sil = (P_ELEM*)realloc(sent->sil, sizeof(P_ELEM)*sent->sil_max);
}
}
export void sent_free(SENT *sent)
{
free(sent->sil);
buffer_free(&(sent->list));
}
| 23.378453 | 125 | 0.633581 |
c6262e96da6b6a83b3c047a7aef53b8185d47a68 | 1,392 | rb | Ruby | spec/controllers/selections_controller_spec.rb | vanessabandeira/martigua2 | c596bfd944b740ac71de9c817f58abff781b56dc | [
"MIT"
] | null | null | null | spec/controllers/selections_controller_spec.rb | vanessabandeira/martigua2 | c596bfd944b740ac71de9c817f58abff781b56dc | [
"MIT"
] | null | null | null | spec/controllers/selections_controller_spec.rb | vanessabandeira/martigua2 | c596bfd944b740ac71de9c817f58abff781b56dc | [
"MIT"
] | null | null | null | # frozen_string_literal: true
require "rails_helper"
describe SelectionsController, type: :controller do
let(:section) { create :section }
let(:coach) { create :user, with_section_as_coach: section }
let(:day) { create :day }
let(:match_1) { create :match, day: day }
let(:match_2) { create :match, day: day }
let(:match_3) { create :match, day: day }
let(:team_with_matches) { double }
before { sign_in coach }
describe "GET index" do
let(:request_params) { { section_id: section.to_param, day_id: day.id } }
let(:request) { get :index, params: request_params }
describe "assigns" do
before do
expect(Team).to receive(:team_with_match_on).with(day, section).and_return(team_with_matches)
expect(team_with_matches).to receive(:map).and_return([])
request
end
it { expect(assigns[:day]).to eq day }
it { expect(assigns[:teams_with_matches]).to eq team_with_matches }
end
end
describe "DELETE destroy" do
subject { delete :destroy, params: request_params }
let(:match) { create :match, day: day }
let(:selection) { create :selection, match: match }
let(:request_params) { { section_id: section.to_param, match_id: match.id, id: selection.id } }
it { expect(subject).to redirect_to(root_path) }
it { expect(subject && Selection.find_by_id(selection.id)).to be_nil }
end
end
| 32.372093 | 101 | 0.675287 |
1854734bf605db37e5ce36a755747e4e3aac6ba4 | 138 | rb | Ruby | test/test_helper.rb | toughbyte/work_calendar | 84ba788234db4511012b0843b29a77f9005688b7 | [
"MIT"
] | null | null | null | test/test_helper.rb | toughbyte/work_calendar | 84ba788234db4511012b0843b29a77f9005688b7 | [
"MIT"
] | 4 | 2019-09-06T11:01:51.000Z | 2021-12-23T10:49:10.000Z | test/test_helper.rb | toughbyte/work_calendar | 84ba788234db4511012b0843b29a77f9005688b7 | [
"MIT"
] | null | null | null | # frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
require 'work_calendar'
require 'minitest/autorun'
| 19.714286 | 54 | 0.782609 |
04f961a89f5307e60dab1da9ce4bd270b3b9c5d3 | 528 | sql | SQL | plugins/story_module/uninstall/query.sql | nikhil-muskowl/admin-panel | 0c1e6fa73135a2ab2adf53b7de38871fedf12651 | [
"MIT"
] | null | null | null | plugins/story_module/uninstall/query.sql | nikhil-muskowl/admin-panel | 0c1e6fa73135a2ab2adf53b7de38871fedf12651 | [
"MIT"
] | null | null | null | plugins/story_module/uninstall/query.sql | nikhil-muskowl/admin-panel | 0c1e6fa73135a2ab2adf53b7de38871fedf12651 | [
"MIT"
] | null | null | null | SET foreign_key_checks = 0;
DROP TABLE IF EXISTS `stories`;
DROP TABLE IF EXISTS `story_comments`;
DROP TABLE IF EXISTS `story_complains`;
DROP TABLE IF EXISTS `story_details`;
DROP TABLE IF EXISTS `story_images`;
DROP TABLE IF EXISTS `story_image_details`;
DROP TABLE IF EXISTS `story_rankings`;
DROP TABLE IF EXISTS `story_tags`;
DROP TABLE IF EXISTS `story_to_types`;
DROP TABLE IF EXISTS `story_types`;
DROP TABLE IF EXISTS `story_type_details`;
DROP TABLE IF EXISTS `save_stories`;
SET foreign_key_checks = 1;
| 18.857143 | 43 | 0.770833 |
73642ea84957fd6bdca600acc69aad2de2afc956 | 1,170 | kt | Kotlin | app/src/main/java/uk/co/jakelee/retrofitexperiments/vogella/vogella/VogellaController.kt | JakeSteam/retrofit-experiments | 151011dcab5bf0dc42579281b57c427c5df99759 | [
"MIT"
] | 1 | 2019-06-16T21:02:05.000Z | 2019-06-16T21:02:05.000Z | app/src/main/java/uk/co/jakelee/retrofitexperiments/vogella/vogella/VogellaController.kt | JakeSteam/retrofit-experiments | 151011dcab5bf0dc42579281b57c427c5df99759 | [
"MIT"
] | null | null | null | app/src/main/java/uk/co/jakelee/retrofitexperiments/vogella/vogella/VogellaController.kt | JakeSteam/retrofit-experiments | 151011dcab5bf0dc42579281b57c427c5df99759 | [
"MIT"
] | null | null | null | package uk.co.jakelee.retrofitexperiments.vogella.vogella
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import retrofit2.Retrofit
import retrofit2.converter.simplexml.SimpleXmlConverterFactory
class VogellaController : Callback<RSSFeed> {
fun start() {
val retrofit = Retrofit.Builder().baseUrl(BASE_URL)
.addConverterFactory(SimpleXmlConverterFactory.create()).build()
val vogellaAPI = retrofit.create(VogellaAPI::class.java)
val call = vogellaAPI.loadRSSFeed()
call.enqueue(this)
}
override fun onResponse(call: Call<RSSFeed>, response: Response<RSSFeed>) {
if (response.isSuccessful) {
val rss = response.body()
println("Channel title: " + rss?.channelTitle!!)
rss.articleList!!.forEach { article -> println("Title: " + article.title + " Link: " + article.link) }
} else {
System.out.println(response.errorBody())
}
}
override fun onFailure(call: Call<RSSFeed>, t: Throwable) {
t.printStackTrace()
}
companion object {
internal val BASE_URL = "http://vogella.com/"
}
} | 31.621622 | 114 | 0.660684 |
573482d7d53ed5a348988188636a958b5d8be1d6 | 442 | h | C | include/SpringBoard/SBLoginAppSceneHosterDelegate-Protocol.h | ItHertzSoGood/DragonBuild | 1aaf6133ab386ba3a5165a4b29c080ca8d814b52 | [
"MIT"
] | 3 | 2020-06-20T02:53:25.000Z | 2020-11-07T08:39:13.000Z | include/SpringBoard/SBLoginAppSceneHosterDelegate-Protocol.h | ItHertzSoGood/DragonBuild | 1aaf6133ab386ba3a5165a4b29c080ca8d814b52 | [
"MIT"
] | null | null | null | include/SpringBoard/SBLoginAppSceneHosterDelegate-Protocol.h | ItHertzSoGood/DragonBuild | 1aaf6133ab386ba3a5165a4b29c080ca8d814b52 | [
"MIT"
] | 1 | 2020-07-26T02:16:06.000Z | 2020-07-26T02:16:06.000Z | //
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Mar 22 2020 01:47:48).
//
// Copyright (C) 1997-2019 Steve Nygard.
//
@class NSString;
@protocol SBLoginAppSceneHosterDelegate
- (void)sceneUpdatedWallpaperMode:(NSUInteger)arg1;
- (void)sceneUpdatedRotationMode:(long long)arg1;
- (void)sceneUpdatedStatusBarUserName:(NSString *)arg1;
- (void)sceneUpdatedIdleTimerMode:(long long)arg1;
- (void)sceneInvalidated;
@end
| 26 | 90 | 0.753394 |
63840569574fc62e75e48dc79b7f6536193e421d | 1,026 | kt | Kotlin | src/main/kotlin/no/nav/tms/utbetalingsoversikt/api/config/JsonConfig.kt | navikt/tms-utbetalingsoversikt-api | 6949518e8e955a299f13fe55424c1a9d01a7bed4 | [
"MIT"
] | null | null | null | src/main/kotlin/no/nav/tms/utbetalingsoversikt/api/config/JsonConfig.kt | navikt/tms-utbetalingsoversikt-api | 6949518e8e955a299f13fe55424c1a9d01a7bed4 | [
"MIT"
] | null | null | null | src/main/kotlin/no/nav/tms/utbetalingsoversikt/api/config/JsonConfig.kt | navikt/tms-utbetalingsoversikt-api | 6949518e8e955a299f13fe55424c1a9d01a7bed4 | [
"MIT"
] | null | null | null | package no.nav.tms.utbetalingsoversikt.api.config
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import kotlinx.serialization.json.Json
import java.time.LocalDate
fun jsonConfig(ignoreUnknownKeys: Boolean = false): Json {
return Json {
this.ignoreUnknownKeys = ignoreUnknownKeys
this.encodeDefaults = true
}
}
class LocalDateSerializer: KSerializer<LocalDate> {
override fun deserialize(decoder: Decoder): LocalDate {
return LocalDate.parse(decoder.decodeString())
}
override val descriptor = PrimitiveSerialDescriptor(
serialName = "no.nav.tms.utbetalingsoversikt.api.config.LocalDateSerializer",
kind = PrimitiveKind.STRING
)
override fun serialize(encoder: Encoder, value: LocalDate) {
encoder.encodeString(value.toString())
}
}
| 31.090909 | 85 | 0.769006 |
bc3a2136544b35027b110762292ae216f2793d09 | 575 | lua | Lua | src/mod/elona/api/aspect/ItemBookOfRachelAspect.lua | Ruin0x11/OpenNefia | 548f1a1442eca704bb1c16b1a1591d982a34919f | [
"MIT"
] | 109 | 2020-04-07T16:56:38.000Z | 2022-02-17T04:05:40.000Z | src/mod/elona/api/aspect/ItemBookOfRachelAspect.lua | Ruin0x11/OpenNefia | 548f1a1442eca704bb1c16b1a1591d982a34919f | [
"MIT"
] | 243 | 2020-04-07T08:25:15.000Z | 2021-10-30T07:22:10.000Z | src/mod/elona/api/aspect/ItemBookOfRachelAspect.lua | Ruin0x11/OpenNefia | 548f1a1442eca704bb1c16b1a1591d982a34919f | [
"MIT"
] | 15 | 2020-04-25T12:28:55.000Z | 2022-02-23T03:20:43.000Z | local IItemBookOfRachel = require("mod.elona.api.aspect.IItemBookOfRachel")
local Rand = require("api.Rand")
local ItemBookOfRachelAspect = class.class("ItemBookOfRachelAspect", { IItemBookOfRachel })
function ItemBookOfRachelAspect:init(item, params)
-- >>>>>>>> shade2/item.hsp:618 if iId(ci)=idBookOfRachel :if iBookOfRachelId(ci)=0:iBookOfRachelId(ci)=i ..
self.book_number = params.book_number or Rand.rnd(4) + 1
-- <<<<<<<< shade2/item.hsp:618 if iId(ci)=idBookOfRachel :if iBookOfRachelId(ci)=0:iBookOfRachelId(ci)=i ..
end
return ItemBookOfRachelAspect
| 44.230769 | 112 | 0.747826 |
4f14364a2304049c1985c180d26fcd3f3d828bc5 | 5,931 | swift | Swift | Sources/SListView/ListViewDelegate.swift | shial4/SListView | 636afa685043a42e88ebc2093c31afe82d35a434 | [
"MIT"
] | 6 | 2018-03-08T03:04:41.000Z | 2020-06-03T07:07:24.000Z | Sources/SListView/ListViewDelegate.swift | shial4/SListView | 636afa685043a42e88ebc2093c31afe82d35a434 | [
"MIT"
] | null | null | null | Sources/SListView/ListViewDelegate.swift | shial4/SListView | 636afa685043a42e88ebc2093c31afe82d35a434 | [
"MIT"
] | null | null | null | //
// ListViewDelegate.swift
// Calendar
//
// Created by Shial on 21/2/18.
// Copyright © 2018 shial. All rights reserved.
//
import Foundation
/// The delegate of a SListView object must adopt the ListViewDelegate protocol. Optional methods of the protocol allow the delegate to manage selections, configure and perform other actions.
public protocol ListViewDelegate: class {
/// Tells the delegate the list view did change present display item.
///
/// - Parameters:
/// - listView: The list-view object informing the delegate of this impending event.
/// - index: An index locating the item in listView.
/// - offset: A integer value that determines scroll offset of a list for given item.
func listView(_ listView: ListView, didChangeDisplayItemAt index: Int, with offset: Int)
/// Tells the delegate the list view is about to draw a cell for a particular item.
///
/// - Parameters:
/// - listView: The list-view object informing the delegate of this impending event.
/// - cell: A list-view cell object that listView is going to use when drawing the row.
/// - index: An index locating the item in listView.
/// - offset: A integer value that determines scroll offset of a list for given item.
func listView(_ listView: ListView, willDisplay cell: ListViewCell, at index: Int, with offset: Int)
/// Tells the delegate that a specified item is about to be selected.
///
/// - Parameters:
/// - listView: The list-view object informing the delegate of this impending event.
/// - index: An index locating the item in listView.
/// - offset: A integer value that determines scroll offset of a list for given item.
func listView(_ listView: ListView, willSelectItemAt index: Int, with offset: Int)
/// Tells the delegate that a specified item is now selected.
///
/// - Parameters:
/// - listView: The list-view object informing the delegate of this impending event.
/// - index: An index locating the item in listView.
/// - offset: A integer value that determines scroll offset of a list for given item.
func listView(_ listView: ListView, didSelectItemAt index: Int, with offset: Int)
/// Tells the delegate that a specified item is about to be deselected.
///
/// - Parameters:
/// - listView: The list-view object informing the delegate of this impending event.
/// - index: An index locating the item in listView.
/// - offset: A integer value that determines scroll offset of a list for given item.
func listView(_ listView: ListView, willDeselectItemAt index: Int, with offset: Int)
/// Tells the delegate that a specified item is now deselected.
///
/// - Parameters:
/// - listView: The list-view object informing the delegate of this impending event.
/// - index: An index locating the item in listView.
/// - offset: A integer value that determines scroll offset of a list for given item.
func listView(_ listView: ListView, didDeselectItemAt index: Int, with offset: Int)
}
extension ListViewDelegate {
/// Tells the delegate the list view did change present display item.
///
/// - Parameters:
/// - listView: The list-view object informing the delegate of this impending event.
/// - index: An index locating the item in listView.
/// - offset: A integer value that determines scroll offset of a list for given item.
public func listView(_ listView: ListView, didChangeDisplayItemAt index: Int, with offset: Int) {}
/// Tells the delegate the list view is about to draw a cell for a particular item.
///
/// - Parameters:
/// - listView: The list-view object informing the delegate of this impending event.
/// - cell: A list-view cell object that listView is going to use when drawing the row.
/// - index: An index locating the item in listView.
/// - offset: A integer value that determines scroll offset of a list for given item.
public func listView(_ listView: ListView, willDisplay cell: ListViewCell, at index: Int, with offset: Int) {}
/// Tells the delegate that a specified item is about to be selected.
///
/// - Parameters:
/// - listView: The list-view object informing the delegate of this impending event.
/// - index: An index locating the item in listView.
/// - offset: A integer value that determines scroll offset of a list for given item.
public func listView(_ listView: ListView, willSelectItemAt index: Int, with offset: Int) {}
/// Tells the delegate that a specified item is now selected.
///
/// - Parameters:
/// - listView: The list-view object informing the delegate of this impending event.
/// - index: An index locating the item in listView.
/// - offset: A integer value that determines scroll offset of a list for given item.
public func listView(_ listView: ListView, didSelectItemAt index: Int, with offset: Int) {}
/// Tells the delegate that a specified item is about to be deselected.
///
/// - Parameters:
/// - listView: The list-view object informing the delegate of this impending event.
/// - index: An index locating the item in listView.
/// - offset: A integer value that determines scroll offset of a list for given item.
public func listView(_ listView: ListView, willDeselectItemAt index: Int, with offset: Int) {}
/// Tells the delegate that a specified item is now deselected.
///
/// - Parameters:
/// - listView: The list-view object informing the delegate of this impending event.
/// - index: An index locating the item in listView.
/// - offset: A integer value that determines scroll offset of a list for given item.
public func listView(_ listView: ListView, didDeselectItemAt index: Int, with offset: Int) {}
}
| 57.582524 | 191 | 0.686394 |
b36ea17008db604ca2d9b586c52e96c563bdecb8 | 1,956 | rb | Ruby | spec/bitcoin/contracthash_spec.rb | apollo-maple/bitcoin-ruby | 54bfd99c0bff4dd3d0aee20923b2472a73453618 | [
"MIT"
] | null | null | null | spec/bitcoin/contracthash_spec.rb | apollo-maple/bitcoin-ruby | 54bfd99c0bff4dd3d0aee20923b2472a73453618 | [
"MIT"
] | null | null | null | spec/bitcoin/contracthash_spec.rb | apollo-maple/bitcoin-ruby | 54bfd99c0bff4dd3d0aee20923b2472a73453618 | [
"MIT"
] | null | null | null | # encoding: ascii-8bit
require_relative 'spec_helper.rb'
# https://github.com/aalness/contracthashtool-ruby
# ruby port of https://github.com/Blockstream/contracthashtool
describe 'Bitcoin::ContractHash' do
it 'should generate and claim' do
Bitcoin::network = :testnet3
# Example parameters from the original tool's usage().
redeem_script_template = '5121038695b28f1649c711aedb1fec8df54874334cfb7ddf31ba3132a94d00bdc9715251ae'
payee_address = 'mqWkEAFeQdrQvyaWNRn5vijPJeiQAjtxL2'
nonce_hex = '3a11be476485a6273fad4a0e09117d42'
private_key_wif = 'cMcpaCT6pHkyS4347i4rSmecaQtLiu1eH28NWmBiePn8bi6N4kzh'
# Someone wanting to send funds to the sidechain would call this
# to calculate a P2SH address to send to. They would then send the
# MDFs (mutually distrusting functionaries) the target address
# and nonce so they are able to locate the subsequent transaction.
# The caller would then send the desired amount of coin to the P2SH
# address to initiate the peg protocol.
nonce, redeem_script, p2sh_address = Bitcoin::ContractHash.generate(redeem_script_template, payee_address, nonce_hex)
nonce.should == "3a11be476485a6273fad4a0e09117d42"
p2sh_address.should == "2MvGPFfDXbJZyH79u187VNZbuCgyRBhcdsw"
redeem_script.should == "512102944aba05d40d8df1724f8ab2f5f3a58d052d26aedc93e175534cb782becc8ff751ae"
# Each MDF would call this to derive a private key to redeem the
# locked transaction.
key = Bitcoin::ContractHash.claim(private_key_wif, payee_address, nonce)
key.to_base58.should == "cSBD8yM62R82RfbugiGK8Lui9gdMB81NtZBckxe5YxRsDSKySwHK"
# Verify homomorphic derivation was successful.
signature = key.sign_message(message="derp")
script = Bitcoin::Script.new([redeem_script].pack("H*"))
pubkey = Bitcoin::Key.new(nil, script.get_multisig_pubkeys.first.unpack("H*").first)
pubkey.verify_message(signature, message).should == true
end
end
| 42.521739 | 121 | 0.776585 |
977d24dee3d64564cf4aab191964a87fc309611b | 772 | asm | Assembly | programs/oeis/209/A209008.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/209/A209008.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/209/A209008.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A209008: Number of 4-bead necklaces labeled with numbers -n..n not allowing reversal, with sum zero and first and second differences in -n..n.
; 1,3,5,10,16,26,38,55,75,101,131,168,210,260,316,381,453,535,625,726,836,958,1090,1235,1391,1561,1743,1940,2150,2376,2616,2873,3145,3435,3741,4066,4408,4770,5150,5551,5971,6413,6875,7360,7866,8396,8948,9525,10125,10751,11401,12078,12780,13510,14266,15051,15863,16705,17575,18476,19406,20368,21360,22385,23441,24531,25653,26810,28000,29226,30486,31783,33115,34485,35891,37336,38818,40340,41900,43501,45141,46823,48545,50310,52116,53966,55858,57795,59775,61801,63871,65988,68150,70360,72616,74921,77273,79675,82125,84626
lpb $0
mov $2,$0
lpb $2
add $1,$2
sub $2,1
lpe
trn $0,2
add $1,1
lpe
add $1,1
mov $0,$1
| 51.466667 | 519 | 0.748705 |
7b9016c072e2399f668fb844ba999928265369e0 | 2,191 | rb | Ruby | db/migrate/20170306121855_convert_comments_to_sti_model.rb | pmtresearch/sci-notes | d24d591277cb981c92e515e62d41ed3157d45868 | [
"MIT"
] | null | null | null | db/migrate/20170306121855_convert_comments_to_sti_model.rb | pmtresearch/sci-notes | d24d591277cb981c92e515e62d41ed3157d45868 | [
"MIT"
] | null | null | null | db/migrate/20170306121855_convert_comments_to_sti_model.rb | pmtresearch/sci-notes | d24d591277cb981c92e515e62d41ed3157d45868 | [
"MIT"
] | 1 | 2019-02-04T19:52:08.000Z | 2019-02-04T19:52:08.000Z | class ConvertCommentsToStiModel < ActiveRecord::Migration[4.2]
def change
add_column :comments, :type, :string
add_column :comments, :associated_id, :integer
add_index :comments, :associated_id
Comment.find_each do |comment|
res = ActiveRecord::Base.connection.execute(
"SELECT my_module_id FROM my_module_comments
WHERE comment_id = #{comment.id}"
)
if res.ntuples > 0
comment.update_columns(type: 'TaskComment')
comment.update_columns(associated_id: res[0]['my_module_id'].to_i)
next
end
res = ActiveRecord::Base.connection.execute(
"SELECT project_id FROM project_comments
WHERE comment_id = #{comment.id}"
)
if res.ntuples > 0
comment.update_columns(type: 'ProjectComment')
comment.update_columns(associated_id: res[0]['project_id'].to_i)
next
end
res = ActiveRecord::Base.connection.execute(
"SELECT result_id FROM result_comments WHERE comment_id = #{comment.id}"
)
if res.ntuples > 0
comment.update_columns(type: 'ResultComment')
comment.update_columns(associated_id: res[0]['result_id'].to_i)
next
end
res = ActiveRecord::Base.connection.execute(
"SELECT step_id FROM step_comments WHERE comment_id = #{comment.id}"
)
if res.ntuples > 0
comment.update_columns(type: 'StepComment')
comment.update_columns(associated_id: res[0]['step_id'].to_i)
next
end
end
drop_table :sample_comments do |t|
t.integer :sample_id, null: false
t.integer :comment_id, null: false
end
drop_table :project_comments do |t|
t.integer :project_id, null: false
t.integer :comment_id, null: false
end
drop_table :my_module_comments do |t|
t.integer :my_module_id, null: false
t.integer :comment_id, null: false
end
drop_table :result_comments do |t|
t.integer :result_id, null: false
t.integer :comment_id, null: false
end
drop_table :step_comments do |t|
t.integer :step_id, null: false
t.integer :comment_id, null: false
end
end
end
| 30.013699 | 80 | 0.653126 |
06ccd07ff1ad6104ec12c4743580cee8d39724f3 | 620 | kt | Kotlin | jvm/src/test/kotlin/org/amshove/kluent/tests/backtickassertions/charsequence/ShouldEndWithTests.kt | rubengees/Kluent | e4b481acb33269b2295a5835469bf7610a681654 | [
"MIT"
] | null | null | null | jvm/src/test/kotlin/org/amshove/kluent/tests/backtickassertions/charsequence/ShouldEndWithTests.kt | rubengees/Kluent | e4b481acb33269b2295a5835469bf7610a681654 | [
"MIT"
] | null | null | null | jvm/src/test/kotlin/org/amshove/kluent/tests/backtickassertions/charsequence/ShouldEndWithTests.kt | rubengees/Kluent | e4b481acb33269b2295a5835469bf7610a681654 | [
"MIT"
] | null | null | null | package org.amshove.kluent.tests.backtickassertions.charsequence
import org.amshove.kluent.`should end with`
import org.jetbrains.spek.api.Spek
import kotlin.test.assertFails
class ShouldEndWithTests : Spek({
given("the should end with method") {
on("checking a string which ends with a substring") {
it("should pass") {
"Hello" `should end with` "llo"
}
}
on("checking for a string which doesn't end with a substring") {
it("should fail") {
assertFails({ "Bye" `should end with` "ay" })
}
}
}
})
| 28.181818 | 72 | 0.58871 |
42009a5d827cd3352756f8738831d3c929690b78 | 3,309 | html | HTML | azar.html | Devs4good/prevenapp | 5e8bca385bb82d98841f2560486556a47f05d885 | [
"MIT"
] | 1 | 2018-12-10T21:05:39.000Z | 2018-12-10T21:05:39.000Z | azar.html | Devs4good/PrevenApp | 5e8bca385bb82d98841f2560486556a47f05d885 | [
"MIT"
] | null | null | null | azar.html | Devs4good/PrevenApp | 5e8bca385bb82d98841f2560486556a47f05d885 | [
"MIT"
] | null | null | null |
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../../../favicon.ico">
<title>PrevenApp</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css"" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/index.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Poppins" rel="stylesheet">
</head>
<body class="text-center">
<div class="cover-container d-flex w-100 h-100 p-3 mx-auto flex-column">
<header class="masthead mb-auto">
<div class="inner">
<h3 class="masthead-brand">PrevenApp</h3>
<nav class="nav nav-masthead justify-content-center">
</nav>
</div>
</header>
<main role="main" class="inner cover">
<div class="card-deck mb-3 text-center" id="azar-trivia">
<div class="card mb-4 shadow-sm">
<div class="card-header">
<h4 class="my-0 font-weight-normal" >Pregunta/afirmación</h4>
</div>
<div class="card-body">
<div id="azar-question-div">
<p id="azar-question"></p>
<div id="azar-question-info"></div>
</div>
<div class="row">
<button id="azar-true" type="button" class="btn btn-lg btn-block btn-outline-secondary">Verdadero</button>
<button id="azar-false" type="button" class="btn btn-lg btn-block btn-outline-secondary">Falso</button>
</div>
</div>
</div>
</div>
<a href="trivia.html" class="btn btn-lg btn-secondary">Otras categorías</a>
<a href="#" class="btn btn-lg btn-secondary" id="azar-next-btn">Siguiente</a>
</main>
<footer class="mastfoot mt-auto">
<div class="inner">
<p> <a href="https://getbootstrap.com/"></a><a href="https://twitter.com/mdo"></a></p>
</div>
<div>
<button id="authorize_button" style="display: none;">Authorize</button>
<button id="signout_button" style="display: none;">Sign Out</button>
</div>
</footer>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-slim.min.js"><\/script>')</script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- <script async defer src="https://apis.google.com/js/api.js"
onload="this.onload=function(){};handleClientLoad()"
onreadystatechange="if (this.readyState === 'complete') this.getResults()">
</script> -->
<script src="js/service/questions.js"></script>
<!-- <script src="js/service/google_sheet_connector.js"></script> -->
<script src="js/service/trivias.js"></script>
</body>
</html>
| 38.929412 | 184 | 0.585071 |
994d41a4f89fd3dfe8cbc2455bf694119ae3ae57 | 5,392 | h | C | cpp/core/src/zxing/bigint/BigUnsignedInABase.h | teokkmb/zxing | 920db80d00797c1ad1f77b2ea86260ac094877d9 | [
"Apache-2.0"
] | null | null | null | cpp/core/src/zxing/bigint/BigUnsignedInABase.h | teokkmb/zxing | 920db80d00797c1ad1f77b2ea86260ac094877d9 | [
"Apache-2.0"
] | null | null | null | cpp/core/src/zxing/bigint/BigUnsignedInABase.h | teokkmb/zxing | 920db80d00797c1ad1f77b2ea86260ac094877d9 | [
"Apache-2.0"
] | 2 | 2020-07-29T12:34:33.000Z | 2021-03-31T09:23:55.000Z | /*
* Author: Matt McCutchen, https://mattmccutchen.net/bigint
* Copyright 2008/2010/2012 ZXing authors All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* The BigInteger library was included in the ZXing C++ library by Hartmut
* Neubauer with the permission of Matt McCutchen because PDF417 uses
* BigIntegers.
*/
#pragma once
#include "BigUnsigned.h" // for BigUnsigned
#include "NumberlikeArray.h" // for NumberlikeArray, NumberlikeArray<>::Index
#include <string>
namespace bigInteger {
/*
* A BigUnsignedInABase object represents a nonnegative integer of size limited
* only by available memory, represented in a user-specified base that can fit
* in an `unsigned short' (most can, and this saves memory).
*
* BigUnsignedInABase is intended as an intermediary class with little
* functionality of its own. BigUnsignedInABase objects can be constructed
* from, and converted to, BigUnsigneds (requiring multiplication, mods, etc.)
* and `std::string's (by switching digit values for appropriate characters).
*
* BigUnsignedInABase is similar to BigUnsigned. Note the following:
*
* (1) They represent the number in exactly the same way, except that
* BigUnsignedInABase uses ``digits'' (or Digit) where BigUnsigned uses
* ``blocks'' (or Blk).
*
* (2) Both use the management features of NumberlikeArray. (In fact, my desire
* to add a BigUnsignedInABase class without duplicating a lot of code led me to
* introduce NumberlikeArray.)
*
* (3) The only arithmetic operation supported by BigUnsignedInABase is an
* equality test. Use BigUnsigned for arithmetic.
*/
class BigUnsignedInABase : protected NumberlikeArray<unsigned short> {
public:
// The digits of a BigUnsignedInABase are unsigned shorts.
typedef unsigned short Digit;
// That's also the type of a base.
typedef Digit Base;
protected:
// The base in which this BigUnsignedInABase is expressed
Base base;
// Creates a BigUnsignedInABase with a capacity; for internal use.
BigUnsignedInABase(int, Index c) : NumberlikeArray<Digit>(0, c) {}
// Decreases len to eliminate any leading zero digits.
void zapLeadingZeros() {
while (len > 0 && blk[len - 1] == 0)
len--;
}
public:
// Constructs zero in base 2.
BigUnsignedInABase() : NumberlikeArray<Digit>(), base(2) {}
// Copy constructor
BigUnsignedInABase(const BigUnsignedInABase &x) : NumberlikeArray<Digit>(x), base(x.base) {}
// Assignment operator
void operator =(const BigUnsignedInABase &x) {
NumberlikeArray<Digit>::operator =(x);
base = x.base;
}
// Constructor that copies from a given array of digits.
BigUnsignedInABase(const Digit *d, Index l, Base base);
// Destructor. NumberlikeArray does the delete for us.
~BigUnsignedInABase() {}
// LINKS TO BIGUNSIGNED
BigUnsignedInABase(const BigUnsigned &x, Base base);
operator BigUnsigned() const;
/* LINKS TO STRINGS
*
* These use the symbols ``0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'' to
* represent digits of 0 through 35. When parsing strings, lowercase is
* also accepted.
*
* All string representations are big-endian (big-place-value digits
* first). (Computer scientists have adopted zero-based counting; why
* can't they tolerate little-endian numbers?)
*
* No string representation has a ``base indicator'' like ``0x''.
*
* An exception is made for zero: it is converted to ``0'' and not the
* empty string.
*
* If you want different conventions, write your own routines to go
* between BigUnsignedInABase and strings. It's not hard.
*/
operator std::string() const;
BigUnsignedInABase(const std::string &s, Base base);
public:
// ACCESSORS
Base getBase() const { return base; }
// Expose these from NumberlikeArray directly.
using NumberlikeArray<Digit>::getCapacity;
using NumberlikeArray<Digit>::getLength;
/* Returns the requested digit, or 0 if it is beyond the length (as if
* the number had 0s infinitely to the left). */
Digit getDigit(Index i) const { return (Digit)(i >= len ? 0 : blk[i]); }
// The number is zero if and only if the canonical length is zero.
bool isZero() const { return NumberlikeArray<Digit>::isEmpty(); }
/* Equality test. For the purposes of this test, two BigUnsignedInABase
* values must have the same base to be equal. */
bool operator ==(const BigUnsignedInABase &x) const {
return base == x.base && NumberlikeArray<Digit>::operator ==(x);
}
bool operator !=(const BigUnsignedInABase &x) const { return !operator ==(x); }
};
}
| 36.680272 | 97 | 0.680453 |
d2b5c6bf7a8e6db64b09aedcfd95e092e99f79da | 1,447 | php | PHP | resources/views/todos.blade.php | dinushjaykody/laravel_list | 13c82e94abfb324a5bbac544f70fcf35d1898624 | [
"MIT"
] | null | null | null | resources/views/todos.blade.php | dinushjaykody/laravel_list | 13c82e94abfb324a5bbac544f70fcf35d1898624 | [
"MIT"
] | null | null | null | resources/views/todos.blade.php | dinushjaykody/laravel_list | 13c82e94abfb324a5bbac544f70fcf35d1898624 | [
"MIT"
] | null | null | null | @extends('layout')
@section('content')
<div class="row">
<div class="col-lg-6 col-lg-offset-3">
<form class="form-horizontal" method="post" action="/create/todo">
{{ csrf_field() }}
<div class="form-group">
<div class="col-sm-10">
<input type="text" class="form-control" id="todo" name="todo" placeholder="Create an item">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Create</button>
</div>
</div>
</form>
</div>
</div>
<hr>
<table class="table table-striped">
<tr>
<th>To Do List</th>
</tr>
@foreach($todos as $todo)
<tr>
<td>{{$todo->todo}} <a href="{{route('todo.delete' , ['id' => $todo->id])}}" class="btn btn-xs btn-danger"> X </a>
<a href="{{route('todo.update' , ['id' => $todo->id])}}" class="btn btn-xs btn-info"> EDIT </a>
@if(!$todo->completed)
<a href="{{route('todos.completed', ['id' => $todo->id ])}}" class="btn btn-xs btn-success">Mark as completed</a>
@else
Completed
@endif
</td>
</tr>
@endforeach
</table>
@endsection | 33.651163 | 133 | 0.446441 |
d0ac4f4c91e98a8f48b9b71cc29b13d56816b584 | 2,808 | swift | Swift | Tests/12.swift | lexrus/LeetCode.swift | 9d87655b2f616cad86f978f5ae8ad1f94b0c8eb5 | [
"Unlicense"
] | 403 | 2015-04-16T09:54:20.000Z | 2022-03-28T15:49:52.000Z | Tests/12.swift | lexrus/LeetCode.swift | 9d87655b2f616cad86f978f5ae8ad1f94b0c8eb5 | [
"Unlicense"
] | 1 | 2016-02-24T12:59:57.000Z | 2016-02-24T12:59:57.000Z | Tests/12.swift | lexrus/LeetCode.swift | 9d87655b2f616cad86f978f5ae8ad1f94b0c8eb5 | [
"Unlicense"
] | 53 | 2015-04-16T15:25:26.000Z | 2021-11-16T13:30:10.000Z | //
// IntegerToRoman.swift
// LeetCodeTests
//
// Created by Lex on 2018/7/2.
// Copyright © 2018 Lex Tang. All rights reserved.
//
// Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.
//
// Symbol Value
// I 1
// V 5
// X 10
// L 50
// C 100
// D 500
// M 1000
// For example, two is written as II in Roman numeral, just two one's added together. Twelve is written as, XII, which is simply X + II. The number twenty seven is written as XXVII, which is XX + V + II.
//
// Roman numerals are usually written largest to smallest from left to right. However, the numeral for four is not IIII. Instead, the number four is written as IV. Because the one is before the five we subtract it making four. The same principle applies to the number nine, which is written as IX. There are six instances where subtraction is used:
//
// I can be placed before V (5) and X (10) to make 4 and 9.
// X can be placed before L (50) and C (100) to make 40 and 90.
// C can be placed before D (500) and M (1000) to make 400 and 900.
// Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999.
import XCTest
// @seealso https://leetcode.com/problems/integer-to-roman/discuss/6274/Simple-Solution
func intToRoman(_ num: Int) -> String {
struct RomanIntegers {
static let I = ["", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"]
static let X = ["", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"]
static let C = ["", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"]
static let M = ["", "M", "MM", "MMM"]
}
if num <= 0 || num > 3999 {
return ""
}
return RomanIntegers.M[num / 1000]
+ RomanIntegers.C[(num % 1000) / 100]
+ RomanIntegers.X[(num % 100) / 10]
+ RomanIntegers.I[num % 10]
}
// @seealso https://leetcode.com/problems/integer-to-roman/discuss/6310/My-java-solution-easy-to-understand
func intToRoman2(_ num: Int) -> String {
let values = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
let strings = ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"]
var n = num
var result = ""
values.enumerated().forEach { i, v in
while n >= v {
n -= v
result += strings[i]
}
}
return result
}
class IntegerToRomanTest: XCTestCase {
func testIntegerToRoman() {
[
3: "III",
4: "IV",
9: "IX",
58: "LVIII",
1994: "MCMXCIV"
].forEach { k, v in
XCTAssertEqual(intToRoman(k), v)
XCTAssertEqual(intToRoman2(k), v)
}
}
}
| 35.544304 | 349 | 0.55698 |
40fbe4ea8abc7bd803bfe7e42f0814470c5ff971 | 320 | py | Python | toontown/coghq/DistributedSellbotHQDoorAI.py | TrueBlueDogemon/Toontown | ebed7fc3f2ef06a529cf02eda7ab46361aceef9d | [
"MIT"
] | 1 | 2021-02-25T06:22:49.000Z | 2021-02-25T06:22:49.000Z | toontown/coghq/DistributedSellbotHQDoorAI.py | journeyfan/toontown-journey | 7a4db507e5c1c38a014fc65588086d9655aaa5b4 | [
"MIT"
] | null | null | null | toontown/coghq/DistributedSellbotHQDoorAI.py | journeyfan/toontown-journey | 7a4db507e5c1c38a014fc65588086d9655aaa5b4 | [
"MIT"
] | 2 | 2020-09-26T20:37:18.000Z | 2020-11-15T20:55:33.000Z | from direct.directnotify import DirectNotifyGlobal
from toontown.coghq.DistributedCogHQDoorAI import DistributedCogHQDoorAI
class DistributedSellbotHQDoorAI(DistributedCogHQDoorAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedSellbotHQDoorAI")
def informPlayer(self, todo0):
pass
| 32 | 86 | 0.834375 |
53cb4f43461ff95656e6175921693ca9d9c09587 | 2,723 | java | Java | GestureBuilder/app/src/main/java/pack/GestureApp/GestureAdapter.java | manangandhi7/Gesture-Builder | 3366c5f74f408502baaeb23954039c1cf2fd2a02 | [
"Apache-2.0"
] | 20 | 2015-10-15T10:12:46.000Z | 2022-01-18T07:05:52.000Z | GestureBuilder/app/src/main/java/pack/GestureApp/GestureAdapter.java | manangandhi7/Gesture-Builder | 3366c5f74f408502baaeb23954039c1cf2fd2a02 | [
"Apache-2.0"
] | null | null | null | GestureBuilder/app/src/main/java/pack/GestureApp/GestureAdapter.java | manangandhi7/Gesture-Builder | 3366c5f74f408502baaeb23954039c1cf2fd2a02 | [
"Apache-2.0"
] | 6 | 2015-11-11T11:52:48.000Z | 2021-09-10T18:15:42.000Z | package pack.GestureApp;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
/**
* Created by manan on 2/2/2015.
*/
public class GestureAdapter extends ArrayAdapter<GestureHolder> {
private static List<GestureHolder> mGestureList;
private Context mContext;
public GestureAdapter(ArrayList<GestureHolder> gestureList, Context context) {
super(context, R.layout.gestures_list, gestureList);
this.mGestureList = gestureList;
this.mContext = context;
}
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
GestureViewHolder holder = new GestureViewHolder();
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = inflater.inflate(R.layout.gesture_list_item, null);
// fill the layout with the right values
TextView idView = (TextView) v.findViewById(R.id.gesture_id);
TextView nameView = (TextView) v.findViewById(R.id.gesture_name);
ImageView gestureImageView = (ImageView) v.findViewById(R.id.gesture_image);
TextView nameViewRef = (TextView) v.findViewById(R.id.gesture_name_ref);
holder.gestureId = idView;
holder.gestureName = nameView;
holder.gestureImage = gestureImageView;
holder.gestureNameRef = nameViewRef;
final ImageView mMenuItemButton = (ImageView)v.findViewById(R.id.menu_item_options);
mMenuItemButton.setClickable(true);
v.setTag(holder);
}
else
holder = (GestureViewHolder) v.getTag();
GestureHolder gestureHolder = mGestureList.get(position);
holder.gestureId.setText(String.valueOf(gestureHolder.getGesture().getID()));
holder.gestureName.setText(gestureHolder.getNaam());
holder.gestureNameRef.setText(gestureHolder.getNaam());
try {
holder.gestureImage.setImageBitmap(gestureHolder.getGesture().toBitmap(30, 30, 3, Color.YELLOW));
} catch (Exception e) {
e.printStackTrace();
}
//holder.gestureImage.setImageResource(R.drawable.ic_launcher);
return v;
}
class GestureViewHolder {
public TextView gestureId;
public TextView gestureName;
public ImageView gestureImage;
public TextView gestureNameRef;
}
}
| 34.0375 | 114 | 0.683437 |
d27b730e80972189b481652148734b1c7b6a26a9 | 458 | php | PHP | test_guill/updateTask.php | katemariam/JqueryGantt | 076d5a4a3eb741cd87c14bd096e1e822372e5e54 | [
"MIT"
] | null | null | null | test_guill/updateTask.php | katemariam/JqueryGantt | 076d5a4a3eb741cd87c14bd096e1e822372e5e54 | [
"MIT"
] | null | null | null | test_guill/updateTask.php | katemariam/JqueryGantt | 076d5a4a3eb741cd87c14bd096e1e822372e5e54 | [
"MIT"
] | null | null | null | <?php
require "db.php";
//STORE IN DB
$chart_id = $_POST["chart_id"];
$start = $_POST["start"];
$end = $_POST["end"];
//CHECK IF RECORD in Database
$sql = "DELETE FROM emp_task WHERE chart_id = $chart_id; UPDATE `jquery_gantt`.`chart_task` SET `end` = '$end', `start` = '$start' WHERE `chart_task`.`id` = $chart_id;";
$query = $conn->multi_query($sql);
if($query) {
echo "Success";
}
else {
echo "Failed";
}
?> | 19.913043 | 174 | 0.574236 |
6e14142b26609eb66f5436e0782444a8f4b188b9 | 2,249 | html | HTML | templates/_index.html | techtolentino/blog | d6b52fe3383222b622499b905285edeeb75176d4 | [
"CC-BY-4.0"
] | null | null | null | templates/_index.html | techtolentino/blog | d6b52fe3383222b622499b905285edeeb75176d4 | [
"CC-BY-4.0"
] | 1 | 2016-01-30T10:15:30.000Z | 2016-01-31T01:49:16.000Z | templates/_index.html | techtolentino/blog | d6b52fe3383222b622499b905285edeeb75176d4 | [
"CC-BY-4.0"
] | null | null | null | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{% if title %}{{ title }} | {% endif %}Snugug</title>
<link rel="icon" href="/images/favicon.png">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="google-site-verification" content="zIeV2B7zZKCtEFP-6vV8rKk0ocpbp035v_g3IRn12Jo" />
<script src="/js/main.js" defer></script>
<link rel="stylesheet" href="/css/style.css">
{% block head %}{% endblock %}
<script id="font-load">
(function () {
'use strict';
var fontURL = '/css/fonts.css?bust={{ "now"|date("MMddyy") }}',
fonts,
req,
style,
fontUrlLS;
window.domCL = false;
window.addEventListener('DOMContentLoaded', function () {
window.domCL = true;
});
if (window.localStorage && document.querySelector && window.XMLHttpRequest) {
fonts = localStorage.getItem('fonts');
fontUrlLS = localStorage.getItem('fontURL');
if (fonts && fontUrlLS === fontURL) {
req = document.querySelector('#font-load');
style = window.document.createElement('style');
style.innerHTML = fonts;
req.parentNode.insertBefore(style, req.nextSibling);
}
else {
window.addEventListener('load', function () {
req = new XMLHttpRequest();
req.open('GET', fontURL);
req.onreadystatechange = function () {
localStorage.setItem('fonts', req.responseText);
localStorage.setItem('fontURL', fontURL);
}
req.send();
});
}
}
})();
</script>
</head>
<body>
{% if draft %}<div class="ribbon">Draft</div>{% endif %}
{% block body %}{% endblock %}
{# Google Analytics #}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-30577396-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>
| 30.808219 | 96 | 0.575367 |
84ad43ece6ce43406ab50f34383815167c6712d9 | 1,515 | h | C | Win32.Ago.c/bnc.h | 010001111/Vx-Suites | 6b4b90a60512cce48aa7b87aec5e5ac1c4bb9a79 | [
"MIT"
] | 2 | 2021-02-04T06:47:45.000Z | 2021-07-28T10:02:10.000Z | Win32.Ago.c/bnc.h | 010001111/Vx-Suites | 6b4b90a60512cce48aa7b87aec5e5ac1c4bb9a79 | [
"MIT"
] | null | null | null | Win32.Ago.c/bnc.h | 010001111/Vx-Suites | 6b4b90a60512cce48aa7b87aec5e5ac1c4bb9a79 | [
"MIT"
] | null | null | null | #ifndef __BNC_H__
#define __BNC_H__
#include "cstring.h"
#include "commands.h"
#include "message.h"
#include "irc.h"
using namespace std;
typedef struct bnc_s
{
unsigned short iPort;
unsigned int iServerNum;
} bnc;
typedef struct bnc_server_s
{
CString sServer;
unsigned short iPort;
unsigned int iServerNum;
} bnc_server;
typedef struct bnc_user_s
{
CString sUsername; // Username
CString sPassword; // Password
CString sHost; // Host
CString sIdentd; // Identd
unsigned int iServerNum;
} bnc_user;
typedef struct bnc_login_s
{
CString sUsername; // Username
CString sIRCUsername; // Username in IRC
CString sHost; // Host
CString sIdentd; // Identd
unsigned int iServerNum;
} bnc_login;
class CBNC : public CCommandHandler
{
public:
CBNC();
void Init();
bool HandleCommand(CMessage *pMsg);
int StartBNC(unsigned long iServerNum, int iPort);
unsigned long iServerNum;
command m_cmdStart, m_cmdStop, m_cmdStopAll, m_cmdList;
protected:
int DeleteLoginById(unsigned long iServerNum, char *szUsername);
int DeleteLoginById(unsigned long iServerNum, bool bAll);
int DeleteUserById(unsigned long iServerNum, char *szUsername);
int DeleteUserById(unsigned long iServerNum, bool bAll);
int DeleteServerById(unsigned long iServerNum, char *szUsername);
int DeleteServerById(unsigned long iServerNum, bool bAll);
private:
list<bnc*> lbStart;
list<bnc_server*> lsStart;
list<bnc_login*> llStart;
list<bnc_user*> luStart;
};
#endif // __BNC_H__
| 21.338028 | 67 | 0.746535 |
3b582ef1030d4b86a495bbf6ad5c72dd44347465 | 660 | c | C | search/linear_search/c/linearsearch.c | CarbonDDR/al-go-rithms | 8e65affbe812931b7dde0e2933eb06c0f44b4130 | [
"CC0-1.0"
] | 1,253 | 2017-06-06T07:19:25.000Z | 2022-03-30T17:07:58.000Z | search/linear_search/c/linearsearch.c | rishabh99-rc/al-go-rithms | 4df20d7ef7598fda4bc89101f9a99aac94cdd794 | [
"CC0-1.0"
] | 554 | 2017-09-29T18:56:01.000Z | 2022-02-21T15:48:13.000Z | search/linear_search/c/linearsearch.c | rishabh99-rc/al-go-rithms | 4df20d7ef7598fda4bc89101f9a99aac94cdd794 | [
"CC0-1.0"
] | 2,226 | 2017-09-29T19:59:59.000Z | 2022-03-25T08:59:55.000Z | #include<stdio.h>
int main()
{
int n,i,x,flag=0;
int a[100100];
scanf("%d",&n); //how many numbers in which you want to search
for(i=0;i<n;i++)
{
scanf("%d",&a[i]); //Taking input from user
}
scanf("%d",&x); // Number which we want to search
for(i=0;i<n;i++)
{
if(a[i]==x)
{
flag=1; //If number is found then set the flag
}
}
if(flag==1)
printf("Yes\n"); //If number is found then print yes.
else
printf("No\n"); // If number is not there then print no.
return 0;
}
| 26.4 | 77 | 0.440909 |
85d9f5373d6254d6bde64f9feb592e72a71cf069 | 417 | h | C | ast/ast.h | IgorFroehner/Verb-Compilator | 2ec6387e6f5b5c40c5eb0a5a1a97116f669d940b | [
"MIT"
] | 3 | 2021-08-28T20:34:11.000Z | 2021-08-29T23:06:39.000Z | ast/ast.h | IgorFroehner/Verb-Compilator | 2ec6387e6f5b5c40c5eb0a5a1a97116f669d940b | [
"MIT"
] | 1 | 2021-08-09T20:12:48.000Z | 2021-08-09T20:12:48.000Z | ast/ast.h | IgorFroehner/Verb-Compilator | 2ec6387e6f5b5c40c5eb0a5a1a97116f669d940b | [
"MIT"
] | 1 | 2021-08-30T17:27:38.000Z | 2021-08-30T17:27:38.000Z | /* interface to the lexer */
// extern int yylineno; /* from lexer */
#ifndef VERB_AST_H
#define VERB_AST_H
typedef struct ast ast;
ast* new_ast(char*, ast*, ast*);
void free_tree(ast *);
void print_tree(ast*, int);
void print_no(ast*, int);
void print_dot_tree(ast *);
void print_dot_node(FILE* , ast *, int*, int , int );
int ast_str_len(ast* );
char* ast_build_str(ast*, int);
char* escape_str(char* );
#endif
| 20.85 | 53 | 0.690647 |
b3e43f6808f94355f9236072281d3a12be562461 | 33 | cql | SQL | pkg/storage/cassandra/migrations/0009_add_pod_events.down.cql | bopopescu/peloton | ac6a2c444bcfc70b5b6f4bdbaef67af68a415ad1 | [
"Apache-2.0"
] | 617 | 2019-03-01T15:25:48.000Z | 2022-03-31T00:24:32.000Z | pkg/storage/cassandra/migrations/0009_add_pod_events.down.cql | bopopescu/peloton | ac6a2c444bcfc70b5b6f4bdbaef67af68a415ad1 | [
"Apache-2.0"
] | 24 | 2019-03-11T03:38:38.000Z | 2021-03-25T22:30:15.000Z | pkg/storage/cassandra/migrations/0009_add_pod_events.down.cql | bopopescu/peloton | ac6a2c444bcfc70b5b6f4bdbaef67af68a415ad1 | [
"Apache-2.0"
] | 64 | 2019-03-11T01:57:10.000Z | 2022-03-13T20:09:23.000Z | DROP TABLE IF EXISTS pod_events;
| 16.5 | 32 | 0.818182 |
264ef695b08e74d44c33cbe02d5443b0ce794e02 | 2,639 | java | Java | java/classes2/com/ziroom/datacenter/remote/responsebody/financial/clean/CleanSupply.java | gaoht/house | b9e63db1a4975b614c422fed3b5b33ee57ea23fd | [
"Apache-2.0"
] | 1 | 2020-05-08T05:35:32.000Z | 2020-05-08T05:35:32.000Z | java/classes2/com/ziroom/datacenter/remote/responsebody/financial/clean/CleanSupply.java | gaoht/house | b9e63db1a4975b614c422fed3b5b33ee57ea23fd | [
"Apache-2.0"
] | null | null | null | java/classes2/com/ziroom/datacenter/remote/responsebody/financial/clean/CleanSupply.java | gaoht/house | b9e63db1a4975b614c422fed3b5b33ee57ea23fd | [
"Apache-2.0"
] | 3 | 2018-09-07T08:15:08.000Z | 2020-05-22T03:59:12.000Z | package com.ziroom.datacenter.remote.responsebody.financial.clean;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
public class CleanSupply
implements Parcelable
{
public static final Parcelable.Creator<CleanSupply> CREATOR = new Parcelable.Creator()
{
public CleanSupply createFromParcel(Parcel paramAnonymousParcel)
{
return new CleanSupply(paramAnonymousParcel);
}
public CleanSupply[] newArray(int paramAnonymousInt)
{
return new CleanSupply[paramAnonymousInt];
}
};
private String a;
private String b;
private String c;
private String d;
private double e;
private String f;
private int g;
public CleanSupply() {}
protected CleanSupply(Parcel paramParcel)
{
this.a = paramParcel.readString();
this.b = paramParcel.readString();
this.c = paramParcel.readString();
this.d = paramParcel.readString();
this.e = paramParcel.readDouble();
this.f = paramParcel.readString();
this.g = paramParcel.readInt();
}
public int describeContents()
{
return 0;
}
public String getDesc()
{
return this.f;
}
public String getGoodsId()
{
return this.a;
}
public String getLargeimgurl()
{
return this.c;
}
public String getName()
{
return this.d;
}
public int getNum()
{
return this.g;
}
public double getPrice()
{
return this.e;
}
public String getSmallimgurl()
{
return this.b;
}
public void setDesc(String paramString)
{
this.f = paramString;
}
public void setGoodsId(String paramString)
{
this.a = paramString;
}
public void setLargeimgurl(String paramString)
{
this.c = paramString;
}
public void setName(String paramString)
{
this.d = paramString;
}
public void setNum(int paramInt)
{
this.g = paramInt;
}
public void setPrice(double paramDouble)
{
this.e = paramDouble;
}
public void setSmallimgurl(String paramString)
{
this.b = paramString;
}
public void writeToParcel(Parcel paramParcel, int paramInt)
{
paramParcel.writeString(this.a);
paramParcel.writeString(this.b);
paramParcel.writeString(this.c);
paramParcel.writeString(this.d);
paramParcel.writeDouble(this.e);
paramParcel.writeString(this.f);
paramParcel.writeInt(this.g);
}
}
/* Location: /Users/gaoht/Downloads/zirom/classes2-dex2jar.jar!/com/ziroom/datacenter/remote/responsebody/financial/clean/CleanSupply.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | 19.69403 | 152 | 0.669193 |
e513bd383ef5d9655370430920cd944d2e0d794d | 3,295 | html | HTML | index.html | ines-marques/hydeout | 03721e746775eb3d95dd0d4eb371f9ef4774c2b2 | [
"MIT"
] | null | null | null | index.html | ines-marques/hydeout | 03721e746775eb3d95dd0d4eb371f9ef4774c2b2 | [
"MIT"
] | null | null | null | index.html | ines-marques/hydeout | 03721e746775eb3d95dd0d4eb371f9ef4774c2b2 | [
"MIT"
] | null | null | null | ---
layout: index
title: Home
---
<h1 id="nimiq-2-0">Nimiq 2.0</h1>
<p><br /></p>
<p>
Nimiq is an easy-to-use and censorship-resistant web payment protocol. It is
an open-source project that focuses on accessibility and usability. Nimiq 2.0
shifts from a proof-of-work to proof-of-stake, intending to reduce the energy
waste that comes with PoS blockchains and now encouraging users to use their
stake as a deposit and thus validate blocks.
</p>
<p>
Albatross, the Nimiq 2.0 consensus algorithm, presents a novel vision on
blockchains inspired by speculative BFT algorithms, focusing on a performance
close to the theoretical maximum for a single chain, and a solid probabilistic
finality.
</p>
<p><br /></p>
<h3 id="albatross-blockchain">Albatross Blockchain</h3>
<p>
<a href="https://github.com/nimiq/albatross-doc/blob/main/BlockFormat.md"
>Block format</a
>: micro and macro blocks format.
</p>
<p>
<a href="https://github.com/nimiq/albatross-doc/blob/main/Slots.md">Slots</a>:
how validators are selected to produce, propose and validate blocks using
slots.
</p>
<p>
<a href="https://github.com/nimiq/albatross-doc/blob/main/Tendermint.md"
>Tendermint</a
>: implemented protocol for macro block proposals.
</p>
<p><br /></p>
<h3 id="albatross-behavior">Albatross behavior</h3>
<p>
<a
href="https://github.com/nimiq/albatross-doc/blob/main/OptimisticAndPessimisticMode.md"
>Optimistic and pessimistic mode</a
>: an overview on the blockchain behavior.
</p>
<p>
<a href="https://github.com/nimiq/albatross-doc/blob/main/ForkProofs.md"
>Fork proofs</a
>: our approach to ending a fork in the chain.
</p>
<p>
<a href="https://github.com/nimiq/albatross-doc/blob/main/ViewChange.md"
>View change</a
>: our approach to preventing delays in block production.
</p>
<p>
<a href="https://github.com/nimiq/albatross-doc/blob/main/Punishments.md"
>Punishments</a
>: details on the punishment sets and how validators get punished.
</p>
<p><br /></p>
<h3 id="blockchain">Blockchain</h3>
<p>
<a href="https://github.com/nimiq/albatross-doc/blob/main/Rewards.md"
>Rewards</a
>: distribution among validators.
</p>
<p>
<a href="https://github.com/nimiq/albatross-doc/blob/main/SupplyFormula.md"
>Supply formula</a
>: dictates the supply at any given moment.
</p>
<p>
<a href="https://github.com/nimiq/albatross-doc/blob/main/VRF.md"
>Verifiable random function</a
>: random seed used to select validators.
</p>
<p><br /></p>
<h3 id="staking-contract">Staking contract</h3>
<p>
<a href="https://github.com/nimiq/albatross-doc/blob/main/StakingContract.md"
>Staking contract</a
>: detailed documentation on the staking contract.
</p>
<p><br /></p>
<h3 id="accounts">Accounts</h3>
<p>
<a href="https://github.com/nimiq/albatross-doc/blob/main/Accounts.md"
>Accounts</a
>: Nimiq’s accounts.
</p>
<p>
<a href="https://github.com/nimiq/albatross-doc/blob/main/Transactions.md"
>Transactions</a
>: communicating with the blockchain.
</p>
<p><br /></p>
<p>
As an open-source project, we welcome our community to read our documentation,
<a href="https://www.nimiq.com/whitepaper/">white paper</a>, and
<a href="https://arxiv.org/pdf/1903.01589.pdf">Albatross</a> technical paper.
</p>
| 31.990291 | 91 | 0.70258 |
86e267cce7dcf5e54f2e58ee87118cc97de80bbc | 7,697 | go | Go | pkg/apiserver/interfaces/api/target.go | phantomnat/kubevela | c8264b8c3419f90d90a0f8f4470e0289a7d075df | [
"Apache-2.0"
] | 27 | 2020-08-06T02:39:48.000Z | 2020-09-08T12:56:43.000Z | pkg/apiserver/interfaces/api/target.go | phantomnat/kubevela | c8264b8c3419f90d90a0f8f4470e0289a7d075df | [
"Apache-2.0"
] | 143 | 2020-07-31T04:23:16.000Z | 2020-09-10T07:15:20.000Z | pkg/apiserver/interfaces/api/target.go | phantomnat/kubevela | c8264b8c3419f90d90a0f8f4470e0289a7d075df | [
"Apache-2.0"
] | 28 | 2020-07-03T06:13:56.000Z | 2020-09-09T09:53:48.000Z | /*
Copyright 2021 The KubeVela Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package api
import (
"context"
"github.com/pkg/errors"
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
restfulspec "github.com/emicklei/go-restful-openapi/v2"
"github.com/emicklei/go-restful/v3"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/model"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/service"
apis "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
)
// NewTargetAPIInterface new Target Interface
func NewTargetAPIInterface() Interface {
return &TargetAPIInterface{}
}
// TargetAPIInterface target web service
type TargetAPIInterface struct {
TargetService service.TargetService `inject:""`
ApplicationService service.ApplicationService `inject:""`
RbacService service.RBACService `inject:""`
}
// GetWebServiceRoute get web service
func (dt *TargetAPIInterface) GetWebServiceRoute() *restful.WebService {
ws := new(restful.WebService)
ws.Path(versionPrefix+"/targets").
Consumes(restful.MIME_XML, restful.MIME_JSON).
Produces(restful.MIME_JSON, restful.MIME_XML).
Doc("api for Target manage")
tags := []string{"Target"}
ws.Route(ws.GET("/").To(dt.listTargets).
Doc("list Target").
Metadata(restfulspec.KeyOpenAPITags, tags).
Filter(dt.RbacService.CheckPerm("target", "list")).
Param(ws.QueryParameter("page", "Page for paging").DataType("integer")).
Param(ws.QueryParameter("pageSize", "PageSize for paging").DataType("integer")).
Param(ws.QueryParameter("project", "list targets by project name").DataType("string")).
Returns(200, "OK", apis.ListTargetResponse{}).
Writes(apis.ListTargetResponse{}).Do(returns200, returns500))
ws.Route(ws.POST("/").To(dt.createTarget).
Doc("create Target").
Metadata(restfulspec.KeyOpenAPITags, tags).
Reads(apis.CreateTargetRequest{}).
Filter(dt.RbacService.CheckPerm("target", "create")).
Returns(200, "create success", apis.DetailTargetResponse{}).
Returns(400, "create failure", bcode.Bcode{}).
Writes(apis.DetailTargetResponse{}).Do(returns200, returns500))
ws.Route(ws.GET("/{targetName}").To(dt.detailTarget).
Doc("detail Target").
Param(ws.PathParameter("targetName", "identifier of the Target.").DataType("string")).
Metadata(restfulspec.KeyOpenAPITags, tags).
Filter(dt.targetCheckFilter).
Filter(dt.RbacService.CheckPerm("target", "detail")).
Returns(200, "create success", apis.DetailTargetResponse{}).
Writes(apis.DetailTargetResponse{}).Do(returns200, returns500))
ws.Route(ws.PUT("/{targetName}").To(dt.updateTarget).
Doc("update application Target config").
Metadata(restfulspec.KeyOpenAPITags, tags).
Filter(dt.targetCheckFilter).
Param(ws.PathParameter("targetName", "identifier of the Target").DataType("string")).
Reads(apis.UpdateTargetRequest{}).
Filter(dt.RbacService.CheckPerm("target", "update")).
Returns(200, "OK", apis.DetailTargetResponse{}).
Writes(apis.DetailTargetResponse{}).Do(returns200, returns500))
ws.Route(ws.DELETE("/{targetName}").To(dt.deleteTarget).
Doc("deletet Target").
Metadata(restfulspec.KeyOpenAPITags, tags).
Filter(dt.targetCheckFilter).
Filter(dt.RbacService.CheckPerm("target", "delete")).
Param(ws.PathParameter("targetName", "identifier of the Target").DataType("string")).
Returns(200, "OK", apis.EmptyResponse{}).
Writes(apis.EmptyResponse{}).Do(returns200, returns500))
ws.Filter(authCheckFilter)
return ws
}
func (dt *TargetAPIInterface) createTarget(req *restful.Request, res *restful.Response) {
// Verify the validity of parameters
var createReq apis.CreateTargetRequest
if err := req.ReadEntity(&createReq); err != nil {
bcode.ReturnError(req, res, err)
return
}
if err := validate.Struct(&createReq); err != nil {
bcode.ReturnError(req, res, err)
return
}
// Call the domain layer code
TargetDetail, err := dt.TargetService.CreateTarget(req.Request.Context(), createReq)
if err != nil {
log.Logger.Errorf("create -target failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
// Write back response data
if err := res.WriteEntity(TargetDetail); err != nil {
bcode.ReturnError(req, res, err)
return
}
}
func (dt *TargetAPIInterface) targetCheckFilter(req *restful.Request, res *restful.Response, chain *restful.FilterChain) {
Target, err := dt.TargetService.GetTarget(req.Request.Context(), req.PathParameter("targetName"))
if err != nil {
bcode.ReturnError(req, res, err)
return
}
req.Request = req.Request.WithContext(context.WithValue(req.Request.Context(), &apis.CtxKeyTarget, Target))
chain.ProcessFilter(req, res)
}
func (dt *TargetAPIInterface) detailTarget(req *restful.Request, res *restful.Response) {
Target := req.Request.Context().Value(&apis.CtxKeyTarget).(*model.Target)
detail, err := dt.TargetService.DetailTarget(req.Request.Context(), Target)
if err != nil {
bcode.ReturnError(req, res, err)
return
}
if err := res.WriteEntity(detail); err != nil {
bcode.ReturnError(req, res, err)
return
}
}
func (dt *TargetAPIInterface) updateTarget(req *restful.Request, res *restful.Response) {
Target := req.Request.Context().Value(&apis.CtxKeyTarget).(*model.Target)
// Verify the validity of parameters
var updateReq apis.UpdateTargetRequest
if err := req.ReadEntity(&updateReq); err != nil {
bcode.ReturnError(req, res, err)
return
}
if err := validate.Struct(&updateReq); err != nil {
bcode.ReturnError(req, res, err)
return
}
detail, err := dt.TargetService.UpdateTarget(req.Request.Context(), Target, updateReq)
if err != nil {
bcode.ReturnError(req, res, err)
return
}
if err := res.WriteEntity(detail); err != nil {
bcode.ReturnError(req, res, err)
return
}
}
func (dt *TargetAPIInterface) deleteTarget(req *restful.Request, res *restful.Response) {
TargetName := req.PathParameter("targetName")
// Target in use, can't be deleted
applications, err := dt.ApplicationService.ListApplications(req.Request.Context(), apis.ListApplicationOptions{TargetName: TargetName})
if err != nil {
if !errors.Is(err, datastore.ErrRecordNotExist) {
bcode.ReturnError(req, res, err)
return
}
}
if applications != nil {
bcode.ReturnError(req, res, bcode.ErrTargetInUseCantDeleted)
return
}
if err := dt.TargetService.DeleteTarget(req.Request.Context(), TargetName); err != nil {
bcode.ReturnError(req, res, err)
return
}
if err := res.WriteEntity(apis.EmptyResponse{}); err != nil {
bcode.ReturnError(req, res, err)
return
}
}
func (dt *TargetAPIInterface) listTargets(req *restful.Request, res *restful.Response) {
page, pageSize, err := utils.ExtractPagingParams(req, minPageSize, maxPageSize)
if err != nil {
bcode.ReturnError(req, res, err)
return
}
Targets, err := dt.TargetService.ListTargets(req.Request.Context(), page, pageSize, req.QueryParameter("project"))
if err != nil {
bcode.ReturnError(req, res, err)
return
}
if err := res.WriteEntity(Targets); err != nil {
bcode.ReturnError(req, res, err)
return
}
}
| 34.828054 | 136 | 0.733922 |
708e50b692022b53ef02b1d78d3c2c44628bf7dc | 1,777 | h | C | source/og-core/og.h | OpenWebGlobe/Application-SDK | b819ca8ccb44b70815f6c5332cfb041ea23dab61 | [
"MIT"
] | 4 | 2015-12-20T01:38:05.000Z | 2019-07-02T11:01:29.000Z | source/og-core/og.h | OpenWebGlobe/Application-SDK | b819ca8ccb44b70815f6c5332cfb041ea23dab61 | [
"MIT"
] | null | null | null | source/og-core/og.h | OpenWebGlobe/Application-SDK | b819ca8ccb44b70815f6c5332cfb041ea23dab61 | [
"MIT"
] | 6 | 2015-01-20T09:18:39.000Z | 2021-02-06T08:19:30.000Z | /*******************************************************************************
Project : i3D OpenGlobe SDK - Reference Implementation
Version : 1.0
Author : Martin Christen, martin.christen@fhnw.ch
Copyright : (c) 2006-2010 by FHNW/IVGI. All Rights Reserved
$License$
*******************************************************************************/
#ifndef _OPENGLOBE_C_H
#define _OPENGLOBE_C_H
#ifdef _MSC_VER
#include "win32/og_config.h"
#pragma warning(disable:4251)
#pragma warning(disable:4275)
#ifndef OPENGLOBE_API
#ifdef BUILD_OPENGLOBELIB
#define OPENGLOBE_API __declspec(dllexport)
#else
#define OPENGLOBE_API __declspec(dllimport)
#endif
#endif
#else
#define OPENGLOBE_API
#endif
#ifndef LLCONST
#ifdef _MSC_EXTENSIONS
typedef __int64 int64;
typedef unsigned __int64 uint64;
#define LLCONST(a) (a##i64)
#define ULLCONST(a) (a##ui64)
//#elif !defined(_MSC_VER)
//typedef int64_t int64;
//typedef uint64_t uint64;
//#define LLCONST(a) (a##i64)
//#define ULLCONST(a) (a##ui64)
#else
typedef long long int64;
typedef unsigned long long uint64;
typedef long long __int64; // do not use
#define LLCONST(a) (a##ll)
#define ULLCONST(a) (a##ull)
#endif
#endif
//------------------------------------------------------------------------------
namespace math
{
template<typename T>
inline T Min(T a, T b) //!< Minimum (a,b)
{
return (a < b ? a : b);
}
//---------------------------------------------------------------------------
template<typename T>
inline T Max(T a, T b) //!< Maximum (a,b)
{
return (a < b ? b : a);
}
};
//------------------------------------------------------------------------------
#include "OpenGlobe.h"
#endif
| 25.753623 | 80 | 0.510974 |
0da28aece56215994ab64bfbc68c2d290b64b705 | 165 | kt | Kotlin | app/src/main/java/com/example/airqualityanalyzer/model/entities/Commune.kt | Blazevarjo/air-quality-analyzer | f5443a16d60337d040d1c5d4e71d1a4abaccfeed | [
"MIT"
] | null | null | null | app/src/main/java/com/example/airqualityanalyzer/model/entities/Commune.kt | Blazevarjo/air-quality-analyzer | f5443a16d60337d040d1c5d4e71d1a4abaccfeed | [
"MIT"
] | null | null | null | app/src/main/java/com/example/airqualityanalyzer/model/entities/Commune.kt | Blazevarjo/air-quality-analyzer | f5443a16d60337d040d1c5d4e71d1a4abaccfeed | [
"MIT"
] | 1 | 2021-05-15T16:49:19.000Z | 2021-05-15T16:49:19.000Z | package com.example.airqualityanalyzer.model.entities
data class Commune (
val communeName: String,
val districtName: String,
val provinceName: String
) | 23.571429 | 53 | 0.763636 |
d44377bb89d2559e8c5c02610d05843ef86e8bd2 | 85 | rs | Rust | crates/lower/src/ty.rs | azdavis/millet | 9ee32a19dd09e27a69b91e339b86e47475568de6 | [
"MIT"
] | 8 | 2020-09-02T22:24:18.000Z | 2021-12-15T03:34:57.000Z | crates/lower/src/ty.rs | azdavis/millet | 9ee32a19dd09e27a69b91e339b86e47475568de6 | [
"MIT"
] | 1 | 2021-01-05T08:57:00.000Z | 2021-01-05T19:22:25.000Z | crates/lower/src/ty.rs | azdavis/millet | 9ee32a19dd09e27a69b91e339b86e47475568de6 | [
"MIT"
] | 3 | 2020-12-24T20:31:42.000Z | 2022-03-07T19:40:57.000Z | use crate::util::Cx;
use syntax::ast::Ty;
pub(crate) fn get(cx: &mut Cx, ty: Ty) {}
| 17 | 41 | 0.611765 |
23afb1e0733f613df1e6934112f5d5a9679a6b04 | 946 | swift | Swift | WavesWallet-iOS/DataLayer/Service/Node/Services/UtilsNodeService.swift | WavesUP/WavesWallet-iOS | f477df585614b55583597e7f3544c61205c6ddc3 | [
"MIT"
] | null | null | null | WavesWallet-iOS/DataLayer/Service/Node/Services/UtilsNodeService.swift | WavesUP/WavesWallet-iOS | f477df585614b55583597e7f3544c61205c6ddc3 | [
"MIT"
] | null | null | null | WavesWallet-iOS/DataLayer/Service/Node/Services/UtilsNodeService.swift | WavesUP/WavesWallet-iOS | f477df585614b55583597e7f3544c61205c6ddc3 | [
"MIT"
] | 1 | 2020-10-22T03:01:07.000Z | 2020-10-22T03:01:07.000Z | //
// UtilsNodeService.swift
// WavesWallet-iOS
//
// Created by Pavel Gubin on 3/12/19.
// Copyright © 2019 Waves Platform. All rights reserved.
//
import Foundation
import Moya
import WavesSDKExtension
import WavesSDKCrypto
extension Node.Service {
struct Utils {
enum Kind {
case time
}
let environment: Environment
let kind: Kind
}
}
extension Node.Service.Utils: NodeTargetType {
private enum Constants {
static let utils = "utils"
static let time = "time"
}
var path: String {
switch kind {
case .time:
return Constants.utils + "/" + Constants.time
}
}
var method: Moya.Method {
switch kind {
case .time:
return .get
}
}
var task: Task {
switch kind {
case .time:
return .requestPlain
}
}
}
| 17.518519 | 57 | 0.536998 |
da0175ac6c7fcc684f9ee7d46d29c8bc9ce3520f | 3,985 | swift | Swift | Twitter/HomeTimelineViewController.swift | xsunsmile/TwitterApp | 0ae3023d60d56422ff0b5feb5f0f320cbaebfdb9 | [
"Apache-2.0"
] | null | null | null | Twitter/HomeTimelineViewController.swift | xsunsmile/TwitterApp | 0ae3023d60d56422ff0b5feb5f0f320cbaebfdb9 | [
"Apache-2.0"
] | 2 | 2015-02-23T07:34:00.000Z | 2015-03-08T01:19:30.000Z | Twitter/HomeTimelineViewController.swift | xsunsmile/TwitterApp | 0ae3023d60d56422ff0b5feb5f0f320cbaebfdb9 | [
"Apache-2.0"
] | null | null | null | //
// HomeTimelineViewController.swift
// Twitter
//
// Created by Hao Sun on 2/21/15.
// Copyright (c) 2015 Hao Sun. All rights reserved.
//
import UIKit
class HomeTimelineViewController: UIViewController,
UITableViewDelegate,
UITableViewDataSource,
TweetsDelegate,
TweetCellDelegate
{
@IBOutlet weak var tableView: UITableView!
var tweets = Tweets()
var homeTimelineTweets: [Tweet] = []
var refreshControl: UIRefreshControl?
@IBAction func openMenu(sender: UIBarButtonItem) {
// var vc = view.superview?.superview as MainViewController
// vc.openMenu()
}
override func viewDidLoad() {
super.viewDidLoad()
navigationController!.navigationBar.barStyle = UIBarStyle.Black
navigationController!.navigationBar.tintColor = UIColor.whiteColor()
navigationController!.navigationBar.barTintColor = UIColor(red: 0.07, green: 0.56, blue: 0.85, alpha: 1.0)
refresh()
tableView.delegate = self
tableView.dataSource = self
tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 200
tweets.delegate = self
refreshControl = UIRefreshControl()
refreshControl?.attributedTitle = NSAttributedString(string: "Pull to refersh")
refreshControl?.addTarget(self, action: "refresh", forControlEvents: UIControlEvents.ValueChanged)
tableView.addSubview(refreshControl!)
NSNotificationCenter.defaultCenter().addObserver(self, selector: "refresh", name: userDidLoginNotification, object: nil)
}
func refresh() {
SVProgressHUD.show()
tweets.getHomeTimeline()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier("TweetCell") as TweetCell
cell.tweet = homeTimelineTweets[indexPath.row]
cell.delegate = self
return cell
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return homeTimelineTweets.count
}
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
tableView.deselectRowAtIndexPath(indexPath, animated: false)
}
func tweetsAreReady(tweets: [Tweet]) {
homeTimelineTweets = tweets
refreshControl?.endRefreshing()
SVProgressHUD.dismiss()
tableView.reloadData()
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "tweetDetailsSegue" {
var vc = segue.destinationViewController as TweetDetailsViewController
let indexPath = tableView.indexPathForCell(sender as UITableViewCell)!
let tweet = homeTimelineTweets[indexPath.row]
vc.tweet = tweet
}
if segue.identifier == "tweetReplySegue" {
var vc = segue.destinationViewController as TweetReplyViewController
let cell = (sender as UIButton).superview!.superview as UITableViewCell
let indexPath = tableView.indexPathForCell(cell)!
let tweet = homeTimelineTweets[indexPath.row]
vc.tweet = tweet
}
if segue.identifier == "showProfileSegue" {
let profileNav = segue.destinationViewController as UINavigationController
let vc = profileNav.childViewControllers[0] as ProfileViewController
let user = sender as User
vc.user = user
}
}
func showUserProfile(user: User) {
performSegueWithIdentifier("showProfileSegue", sender: user)
}
}
| 36.227273 | 128 | 0.648432 |
70d4a40b9c647dbc76d9e96728ef653247405d23 | 1,300 | swift | Swift | Assignment/Libs/Define.swift | BhoopendraVerma/Assignment_ios | 046fa96970afdc282296d6e09f3f245a50db8069 | [
"MIT"
] | null | null | null | Assignment/Libs/Define.swift | BhoopendraVerma/Assignment_ios | 046fa96970afdc282296d6e09f3f245a50db8069 | [
"MIT"
] | null | null | null | Assignment/Libs/Define.swift | BhoopendraVerma/Assignment_ios | 046fa96970afdc282296d6e09f3f245a50db8069 | [
"MIT"
] | null | null | null | //
// Define.swift
// Assignment
//
// Created by Bhoopendra-28 on 02/12/2019.
// Copyright © 2019 Bhoopendra-28. All rights reserved.
//
import Foundation
import UIKit
// This structure is used for print gloabley in whole app
func print_debug <T>(object: T)
{
print(object)
}
// This structure is used for defiine baseUrl
struct ServiceUrl {
static let baseUrl = "https://api.github.com/users"
}
// This structure is used for TableView Cell identifier
struct TableViewIdentifier {
static let userCell = "userCell"
}
// This structure is used for ViewController identifier
struct ViewIdentifier {
static let profileViewId = "UserProfileVC"
static let detailViewId = "UserDetailsVC"
}
// This structure is used for Alert button text and title
struct Alert {
static let titleName = "Assignment-IOS"
static let buttonOk = "OK"
static let message = "Git Path Not found"
}
//This structure is used for all the keys used in service class.All the keys used in service class should be here.
struct ServiceKeys
{
static let status = "status"
}
// This structure is used for all the Date Formats Values used in the app
struct DateFormats {
static let isoFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZZ"
static let orderDateFormatResult = "dd-MM-yyyy"
}
| 23.636364 | 114 | 0.719231 |
26a167b69166a193c2a5f5b81a24212da3a5ff9e | 20,599 | java | Java | src/main/java/uk/ac/sussex/gdsc/smlm/results/TextFilePeakResults.java | aherbert/gdsc-smlm | 193431b9ba2c6e6a2b901c7c3697039aaa00be8c | [
"BSL-1.0"
] | 8 | 2018-12-07T00:40:44.000Z | 2020-07-27T14:10:44.000Z | src/main/java/uk/ac/sussex/gdsc/smlm/results/TextFilePeakResults.java | aherbert/gdsc-smlm | 193431b9ba2c6e6a2b901c7c3697039aaa00be8c | [
"BSL-1.0"
] | 3 | 2020-11-17T18:01:09.000Z | 2021-05-18T19:10:34.000Z | src/main/java/uk/ac/sussex/gdsc/smlm/results/TextFilePeakResults.java | aherbert/gdsc-smlm | 193431b9ba2c6e6a2b901c7c3697039aaa00be8c | [
"BSL-1.0"
] | 2 | 2019-08-13T06:16:24.000Z | 2020-01-29T21:23:10.000Z | /*-
* #%L
* Genome Damage and Stability Centre SMLM ImageJ Plugins
*
* Software for single molecule localisation microscopy (SMLM)
* %%
* Copyright (C) 2011 - 2020 Alex Herbert
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
package uk.ac.sussex.gdsc.smlm.results;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
import java.util.NoSuchElementException;
import java.util.Scanner;
import uk.ac.sussex.gdsc.core.data.utils.ConversionException;
import uk.ac.sussex.gdsc.core.data.utils.Converter;
import uk.ac.sussex.gdsc.core.utils.LocalList;
import uk.ac.sussex.gdsc.core.utils.TextUtils;
import uk.ac.sussex.gdsc.smlm.data.config.ConfigurationException;
import uk.ac.sussex.gdsc.smlm.data.config.UnitProtos.AngleUnit;
import uk.ac.sussex.gdsc.smlm.data.config.UnitProtos.DistanceUnit;
import uk.ac.sussex.gdsc.smlm.data.config.UnitProtos.IntensityUnit;
import uk.ac.sussex.gdsc.smlm.results.procedures.PeakResultProcedure;
/**
* Saves the fit results to file.
*/
public class TextFilePeakResults extends SmlmFilePeakResults {
/** The batch size to write to file in one operation. */
private static final int BATCH_SIZE = 20;
private Gaussian2DPeakResultCalculator calculator;
private PeakResultConversionHelper helper;
private Converter[] converters;
private int recordSize;
private DistanceUnit distanceUnit;
private IntensityUnit intensityUnit;
private AngleUnit angleUnit;
private boolean computePrecision;
private boolean canComputePrecision;
private OutputStreamWriter out;
/**
* Instantiates a new text file peak results.
*
* @param filename the filename
*/
public TextFilePeakResults(String filename) {
super(filename);
}
/**
* Instantiates a new text file peak results.
*
* @param filename the filename
* @param showDeviations Set to true to show deviations
*/
public TextFilePeakResults(String filename, boolean showDeviations) {
super(filename, showDeviations);
}
/**
* Instantiates a new text file peak results.
*
* @param filename the filename
* @param showDeviations Set to true to show deviations
* @param showEndFrame Set to true to show the end frame
*/
public TextFilePeakResults(String filename, boolean showDeviations, boolean showEndFrame) {
super(filename, showDeviations, showEndFrame);
}
/**
* Instantiates a new text file peak results.
*
* @param filename the filename
* @param showDeviations Set to true to show deviations
* @param showEndFrame Set to true to show the end frame
* @param showId Set to true to show the id
*/
public TextFilePeakResults(String filename, boolean showDeviations, boolean showEndFrame,
boolean showId) {
super(filename, showDeviations, showEndFrame, showId);
}
/**
* Instantiates a new text file peak results.
*
* @param filename the filename
* @param showDeviations Set to true to show deviations
* @param showEndFrame Set to true to show the end frame
* @param showId Set to true to show the id
* @param showPrecision Set to true to show the precision
*/
public TextFilePeakResults(String filename, boolean showDeviations, boolean showEndFrame,
boolean showId, boolean showPrecision) {
super(filename, showDeviations, showEndFrame, showId, showPrecision);
}
/**
* Instantiates a new text file peak results.
*
* @param filename the filename
* @param showDeviations Set to true to show deviations
* @param showEndFrame Set to true to show the end frame
* @param showId Set to true to show the id
* @param showPrecision Set to true to show the precision
* @param showCategory Set to true to show the category
*/
public TextFilePeakResults(String filename, boolean showDeviations, boolean showEndFrame,
boolean showId, boolean showPrecision, boolean showCategory) {
super(filename, showDeviations, showEndFrame, showId, showPrecision, showCategory);
}
@Override
protected void openOutput() {
out = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
}
@Override
protected void write(String data) {
try {
out.write(data);
} catch (final IOException ex) {
closeOutput();
}
}
@Override
protected void closeOutput() {
if (fos == null) {
return;
}
try {
// Make sure we close the writer since it may be buffered
out.close();
} catch (final Exception ex) {
// Ignore exception
} finally {
fos = null;
}
}
@Override
public synchronized void begin() {
calculator = null;
canComputePrecision = false;
if (isShowPrecision() && hasCalibration() && computePrecision) {
// Determine if we can compute the precision using the current settings
try {
calculator = Gaussian2DPeakResultHelper.create(getPsf(), getCalibrationReader(),
Gaussian2DPeakResultHelper.LSE_PRECISION);
canComputePrecision = true;
} catch (final ConfigurationException | ConversionException ex) {
// Ignore
}
}
// We must correctly convert all the PSF parameter types
helper = new PeakResultConversionHelper(getCalibration(), getPsf());
helper.setIntensityUnit(intensityUnit);
helper.setDistanceUnit(distanceUnit);
helper.setAngleUnit(angleUnit);
converters = helper.getConverters();
// Update the calibration if converters were created
if (helper.isCalibrationChanged()) {
setCalibration(helper.getCalibration());
}
super.begin();
}
@Override
protected String[] getFieldNames() {
final String[] unitNames = helper.getUnitNames();
// Count the field types: int, float, double
// CHECKSTYLE.OFF: VariableDeclarationUsageDistanceCheck
int ci = 0;
int cf = 0;
int cd = 0;
// CHECKSTYLE.ON: VariableDeclarationUsageDistanceCheck
final ArrayList<String> names = new ArrayList<>(20);
if (isShowId()) {
names.add("Id");
ci++;
}
if (isShowCategory()) {
names.add("Category");
ci++;
}
names.add(peakIdColumnName);
ci++;
if (isShowEndFrame()) {
names.add("End " + peakIdColumnName);
ci++;
}
names.add("origX");
names.add("origY");
ci += 2;
names.add("origValue");
cf++;
names.add("Error");
cd++;
String noiseField = "Noise";
if (!TextUtils.isNullOrEmpty(unitNames[PeakResult.INTENSITY])) {
noiseField += " (" + (unitNames[PeakResult.INTENSITY] + ")");
}
names.add(noiseField);
cf++;
String meanIntensityField = "Mean";
if (!TextUtils.isNullOrEmpty(unitNames[PeakResult.INTENSITY])) {
meanIntensityField += " (" + (unitNames[PeakResult.INTENSITY] + ")");
}
names.add(meanIntensityField);
cf++;
final String[] fields = helper.getNames();
cf += fields.length * (isShowDeviations() ? 2 : 1);
for (int i = 0; i < fields.length; i++) {
String field = fields[i];
// Add units
if (!TextUtils.isNullOrEmpty(unitNames[i])) {
field += " (" + unitNames[i] + ")";
}
names.add(field);
if (isShowDeviations()) {
names.add("+/-");
}
}
if (isShowPrecision()) {
names.add("Precision (nm)");
cf++;
}
// Get the estimate record size.
// Count a tab delimiter for each field and the line separator
recordSize = ci + cf + cd + System.lineSeparator().length();
// Integer fields:
// Integer.toString(Integer.MIN_VALUE).length() == len(-2147483648) == 11
recordSize += ci * 11;
// Float fields:
// Float.toString(-Float.MIN_NORMAL).length() == len(-1.17549435E-38) == 15
recordSize += cf * 15;
// Double fields:
// Double.toString(-Double.MIN_NORMAL).length() == len(-2.2250738585072014E-308) == 24
recordSize += cd * 24;
return names.toArray(new String[0]);
}
@Override
public void add(int peak, int origX, int origY, float origValue, double error, float noise,
float meanIntensity, float[] params, float[] paramsStdDev) {
if (fos == null) {
return;
}
final StringBuilder sb = new StringBuilder(recordSize);
addStandardData(sb, 0, 0, peak, peak, origX, origY, origValue, error, noise, meanIntensity);
// Add the parameters
if (isShowDeviations()) {
if (paramsStdDev != null) {
checkSize(converters.length, params, paramsStdDev);
for (int i = 0; i < converters.length; i++) {
addFloat(sb, converters[i].convert(params[i]));
addFloat(sb, converters[i].convert(paramsStdDev[i]));
}
} else {
checkSize(converters.length, params);
for (int i = 0; i < converters.length; i++) {
addFloat(sb, converters[i].convert(params[i]));
sb.append("\t0");
}
}
} else {
checkSize(converters.length, params);
for (int i = 0; i < converters.length; i++) {
addFloat(sb, converters[i].convert(params[i]));
}
}
if (isShowPrecision()) {
if (canComputePrecision) {
addPrecision(sb, calculator.getLsePrecision(params, noise), true);
} else {
sb.append("\t0");
}
}
sb.append(System.lineSeparator());
writeResult(1, sb.toString());
}
@Override
public void add(PeakResult result) {
if (fos == null) {
return;
}
final StringBuilder sb = new StringBuilder(recordSize);
add(sb, result);
writeResult(1, sb.toString());
}
private void add(StringBuilder sb, PeakResult result) {
addStandardData(sb, result.getId(), result.getCategory(), result.getFrame(),
result.getEndFrame(), result.getOrigX(), result.getOrigY(), result.getOrigValue(),
result.getError(), result.getNoise(), result.getMeanIntensity());
// Add the parameters
final float[] params = result.getParameters();
if (isShowDeviations()) {
final float[] paramsStdDev = result.getParameterDeviations();
if (paramsStdDev != null) {
checkSize(converters.length, params, paramsStdDev);
for (int i = 0; i < converters.length; i++) {
addFloat(sb, converters[i].convert(params[i]));
addFloat(sb, converters[i].convert(paramsStdDev[i]));
}
} else {
checkSize(converters.length, params);
for (int i = 0; i < converters.length; i++) {
addFloat(sb, converters[i].convert(params[i]));
sb.append("\t0");
}
}
} else {
checkSize(converters.length, params);
for (int i = 0; i < converters.length; i++) {
addFloat(sb, converters[i].convert(params[i]));
}
}
if (isShowPrecision()) {
if (result.hasPrecision()) {
addPrecision(sb, result.getPrecision(), false);
} else if (canComputePrecision) {
addPrecision(sb, calculator.getLsePrecision(params, result.getNoise()), true);
} else {
sb.append("\t0");
}
}
sb.append(System.lineSeparator());
}
private void addStandardData(StringBuilder sb, final int id, final int category, final int peak,
final int endPeak, final int origX, final int origY, final float origValue,
final double error, final float noise, float meanIntensity) {
if (isShowId()) {
sb.append(id).append('\t');
}
if (isShowCategory()) {
sb.append(category).append('\t');
}
sb.append(peak);
if (isShowEndFrame()) {
sb.append('\t').append(endPeak);
}
sb.append('\t').append(origX).append('\t').append(origY);
addFloat(sb, origValue);
addDouble(sb, error);
addFloat(sb, converters[PeakResult.INTENSITY].convert(noise));
addFloat(sb, converters[PeakResult.INTENSITY].convert(meanIntensity));
}
private static void addFloat(StringBuilder sb, float value) {
sb.append('\t').append(value);
}
private static void addDouble(StringBuilder sb, double value) {
sb.append('\t').append(value);
}
private static void addPrecision(StringBuilder sb, double value, boolean computed) {
// Cast to a float as the precision is probably limited in significant figures
sb.append('\t').append((float) value);
if (computed) {
sb.append('*');
}
}
@Override
public void addAll(PeakResult[] results) {
if (fos == null) {
return;
}
int count = 0;
final StringBuilder sb = new StringBuilder(BATCH_SIZE * recordSize);
for (final PeakResult result : results) {
add(sb, result);
// Flush the output to allow for very large input lists
if (++count >= BATCH_SIZE) {
writeResult(count, sb.toString());
if (!isActive()) {
return;
}
sb.setLength(0);
count = 0;
}
}
writeResult(count, sb.toString());
}
/**
* Adds all the results from the cluster.
*
* @param cluster the cluster
*/
protected void addAll(Cluster cluster) {
if (!isShowId() || cluster.getId() == 0) {
addAll(cluster.getPoints().toArray());
} else {
// Store the ID from the trace
final int id = cluster.getId();
final ArrayPeakResultStore results2 = new ArrayPeakResultStore(cluster.size());
cluster.getPoints().forEach((PeakResultProcedure) result -> {
if (result.getId() == id) {
results2.add(result);
} else {
// This will maintain the category but change the ID to the cluster id
final AttributePeakResult r = new AttributePeakResult(result);
r.setId(id);
results2.add(r);
}
});
addAll(results2.toArray());
}
}
/**
* Output a cluster to the results file.
*
* <p>Note: This is not synchronised
*
* @param cluster the cluster
*/
public void addCluster(Cluster cluster) {
if (fos == null) {
return;
}
if (cluster.size() > 0) {
final float[] centroid = cluster.getCentroid();
writeResult(0,
String.format("#Cluster %f %f (+/-%f) n=%d%n",
converters[PeakResult.X].convert(centroid[0]),
converters[PeakResult.X].convert(centroid[1]),
converters[PeakResult.X].convert(cluster.getStandardDeviation()), cluster.size()));
addAll(cluster);
}
}
/**
* Output a trace to the results file.
*
* <p>Note: This is not synchronised
*
* @param trace the trace
*/
public void addTrace(Trace trace) {
if (fos == null) {
return;
}
if (trace.size() > 0) {
final float[] centroid = trace.getCentroid();
writeResult(0,
String.format(
"#Trace %f %f (+/-%f) start=%d, end=%d, n=%d, b=%d, on=%f, off=%f, signal= %f%n",
converters[PeakResult.X].convert(centroid[0]),
converters[PeakResult.X].convert(centroid[1]),
converters[PeakResult.X].convert(trace.getStandardDeviation()),
trace.getHead().getFrame(), trace.getTail().getEndFrame(), trace.size(),
trace.getBlinks(), trace.getOnTime(), trace.getOffTime(),
converters[PeakResult.INTENSITY].convert(trace.getSignal())));
addAll(trace);
}
}
/**
* Output a comment to the results file.
*
* <p>Note: This is not synchronised
*
* @param text the text
*/
public void addComment(String text) {
if (fos == null) {
return;
}
// Ensure comments are preceded by the comment character
if (!text.startsWith("#")) {
text = "#" + text;
}
// Remove last line separator
if (text.endsWith(System.lineSeparator())) {
text = text.substring(0, text.length() - System.lineSeparator().length());
}
// Ensure newline in a comment start with '#'
if (text.contains(System.lineSeparator())) {
text = text.replace(System.lineSeparator(), System.lineSeparator() + "#");
}
// Write with a new line
writeResult(0, text + System.lineSeparator());
}
@Override
protected synchronized void writeResult(int count, String result) {
// In case another thread caused the output to close
if (fos == null) {
return;
}
try {
out.write(result);
} catch (final IOException ex) {
closeOutput();
}
size += count;
}
@Override
protected void sort() throws IOException {
final LocalList<Result> results = new LocalList<>(size);
final StringBuilder header = new StringBuilder(2048);
final Path path = Paths.get(filename);
try (BufferedReader input = Files.newBufferedReader(path)) {
// Skip optional columns before the slice
final int skipCount = (isShowId() ? 1 : 0) + (isShowCategory() ? 1 : 0);
String line;
// Skip the header
while ((line = input.readLine()) != null) {
if (!line.isEmpty() && line.charAt(0) != '#') {
// This is the first record
results.add(new Result(line, skipCount));
break;
}
header.append(line).append(System.lineSeparator());
}
while ((line = input.readLine()) != null) {
results.add(new Result(line, skipCount));
}
}
// Sort by slice number
Collections.sort(results, (r1, r2) -> Integer.compare(r1.slice, r2.slice));
try (BufferedWriter output = Files.newBufferedWriter(path)) {
output.write(header.toString());
for (int i = 0; i < results.size(); i++) {
output.write(results.unsafeGet(i).line);
output.newLine();
}
}
}
private static class Result {
String line;
int slice;
Result(String line, int skipCount) {
this.line = line;
try (Scanner scanner = new Scanner(line)) {
scanner.useDelimiter("\t");
// Skip optional columns before the slice
// CHECKSTYLE.OFF: FallThroughCheck
switch (skipCount) {
case 2:
scanner.nextInt();
// FALL-THROUGH
case 1:
scanner.nextInt();
// FALL-THROUGH
default:
slice = scanner.nextInt();
}
// CHECKSTYLE.ON: FallThroughCheck
} catch (final NoSuchElementException ex) {
// Ignore
}
}
}
/**
* Gets the distance unit.
*
* @return the distance unit
*/
public DistanceUnit getDistanceUnit() {
return distanceUnit;
}
/**
* Sets the distance unit.
*
* @param distanceUnit the new distance unit
*/
public void setDistanceUnit(DistanceUnit distanceUnit) {
this.distanceUnit = distanceUnit;
}
/**
* Gets the intensity unit.
*
* @return the intensity unit
*/
public IntensityUnit getIntensityUnit() {
return intensityUnit;
}
/**
* Sets the intensity unit.
*
* @param intensityUnit the new intensity unit
*/
public void setIntensityUnit(IntensityUnit intensityUnit) {
this.intensityUnit = intensityUnit;
}
/**
* Gets the angle unit.
*
* @return the angle unit
*/
public AngleUnit getAngleUnit() {
return angleUnit;
}
/**
* Sets the angle unit.
*
* @param angleUnit the new angle unit
*/
public void setAngleUnit(AngleUnit angleUnit) {
this.angleUnit = angleUnit;
}
/**
* Checks if the precision will be computed if needed. This is only relevant if show precision is
* true (see {@link #isShowPrecision()}).
*
* @return true, if the precision will be computed
*/
public boolean isComputePrecision() {
return computePrecision;
}
/**
* Sets the compute precision flag. This is only relevant if show precision is true (see
* {@link #isShowPrecision()}).
*
* @param computePrecision set to true to compute the precision
*/
public void setComputePrecision(boolean computePrecision) {
this.computePrecision = computePrecision;
}
}
| 29.767341 | 99 | 0.636584 |
93f123c70444af98ecc6284201844365f06b7409 | 10,320 | rs | Rust | src/fem_domain/domain/mesh/p_refinement.rs | jeremiah-corrado/fem_2d | 28cc6d8b8cd9d6ce415596e448e266b0492af1e6 | [
"MIT"
] | null | null | null | src/fem_domain/domain/mesh/p_refinement.rs | jeremiah-corrado/fem_2d | 28cc6d8b8cd9d6ce415596e448e266b0492af1e6 | [
"MIT"
] | 5 | 2022-03-19T00:09:50.000Z | 2022-03-24T06:14:29.000Z | src/fem_domain/domain/mesh/p_refinement.rs | jeremiah-corrado/fem_2d | 28cc6d8b8cd9d6ce415596e448e266b0492af1e6 | [
"MIT"
] | null | null | null | use super::MeshAccessError;
use super::MAX_POLYNOMIAL_ORDER;
use crate::fem_domain::domain::{dof::basis_spec::BasisDir, mesh::space::ParaDir};
use json::{object, JsonValue};
use std::{cmp::Ordering, fmt, ops::AddAssign};
/// The record of polynomial expansion orders associated with an Elem
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct PolyOrders {
/// Maximum u-directed polynomial expansion order
pub ni: u8,
/// Maximum v-directed polynomial expansion order
pub nj: u8,
}
impl PolyOrders {
/// Update the u- and v-directed expansion orders according to a [PRef]
///
/// Return an `Err` if the refinement causes the expansion orders to fall outside of the valid range
pub fn refine(&mut self, refinement: PRef) -> Result<(), PRefError> {
self.ni = refinement.refine_i(self.ni)?;
self.nj = refinement.refine_j(self.nj)?;
Ok(())
}
/// Directly update the u- and v-directed expansion orders to the given values
///
/// Return an `Err` if the given values are out of the valid range
pub fn set(&mut self, [ni, nj]: [u8; 2]) -> Result<(), PRefError> {
if ni > MAX_POLYNOMIAL_ORDER || nj > MAX_POLYNOMIAL_ORDER {
return Err(PRefError::ExceededMaxExpansion);
}
if ni < 1 || nj < 1 {
return Err(PRefError::NegExpansion);
}
self.ni = ni;
self.nj = nj;
Ok(())
}
/// Get the permutations of [i, j] for the u-, v- or w-directed basis functions
///
/// * For u-directed: i ∈ [0, Ni) and j ∈ [0, Nj]
/// * For v-directed: i ∈ [0, Ni] and j ∈ [0, Nj)
/// * For w-directed: i ∈ [0, Ni] and j ∈ [0, Nj]
pub fn permutations(&self, dir: BasisDir) -> Box<dyn Iterator<Item = [u8; 2]> + '_> {
match dir {
BasisDir::U => Box::new(
(0..self.ni)
.flat_map(move |i_order| (0..=self.nj).map(move |j_order| [i_order, j_order])),
),
BasisDir::V => Box::new(
(0..=self.ni)
.flat_map(move |i_order| (0..self.nj).map(move |j_order| [i_order, j_order])),
),
BasisDir::W => Box::new(
(0..=self.ni)
.flat_map(move |i_order| (0..=self.nj).map(move |j_order| [i_order, j_order])),
),
}
}
/// The maximum orders from self and the given orders
pub fn max_with(&self, orders: [u8; 2]) -> [u8; 2] {
[
std::cmp::max(self.ni, orders[0]),
std::cmp::max(self.nj, orders[1]),
]
}
/// Return the expansion orders as an array of `usize`
pub fn as_array(&self) -> [usize; 2] {
[self.ni as usize, self.nj as usize]
}
}
impl Default for PolyOrders {
fn default() -> Self {
Self { ni: 1, nj: 1 }
}
}
#[cfg(feature = "json_export")]
impl From<PolyOrders> for JsonValue {
fn from(orders: PolyOrders) -> Self {
object! {
"u": orders.ni,
"v": orders.nj,
}
}
}
// the internal p-refinement type
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
enum PRefInt {
Increment(u8),
Decrement(u8),
None,
}
impl PRefInt {
fn refine(&self, n: u8) -> Result<u8, PRefError> {
match self {
Self::Increment(delta) => {
if n + *delta > MAX_POLYNOMIAL_ORDER {
Err(PRefError::ExceededMaxExpansion)
} else {
Ok(n + *delta)
}
}
Self::Decrement(delta) => {
if *delta >= n {
Err(PRefError::NegExpansion)
} else {
Ok(n - *delta)
}
}
Self::None => Ok(n),
}
}
pub const fn from_i8(delta: i8) -> Self {
match delta {
0 => PRefInt::None,
d if d > 0 => PRefInt::Increment(d as u8),
d if d < 0 => PRefInt::Decrement(-d as u8),
_ => unreachable!(),
}
}
pub fn as_i8(&self) -> i8 {
match self {
Self::None => 0,
Self::Increment(delta) => *delta as i8,
Self::Decrement(delta) => -1 * (*delta as i8),
}
}
pub fn constrain(&mut self, bounds: [i8; 2]) {
let si = self.as_i8();
if si < bounds[0] {
*self = Self::from_i8(bounds[0]);
} else if si > bounds[1] {
*self = Self::from_i8(bounds[1]);
}
}
pub fn within(&self, bounds: [i8; 2]) -> bool {
let si = self.as_i8();
si >= bounds[0] && si <= bounds[1]
}
}
impl AddAssign for PRefInt {
fn add_assign(&mut self, rhs: Self) {
let sum = match *self {
Self::Increment(s_delta) => match rhs {
Self::Increment(r_delta) => Self::Increment(s_delta + r_delta),
Self::Decrement(r_delta) => match s_delta.cmp(&r_delta) {
Ordering::Equal => Self::None,
Ordering::Greater => Self::Increment(s_delta - r_delta),
Ordering::Less => Self::Decrement(r_delta - s_delta),
},
Self::None => self.clone(),
},
Self::Decrement(s_delta) => match rhs {
Self::Decrement(r_delta) => Self::Decrement(s_delta + r_delta),
Self::Increment(r_delta) => match s_delta.cmp(&r_delta) {
Ordering::Equal => Self::None,
Ordering::Greater => Self::Decrement(s_delta - r_delta),
Ordering::Less => Self::Increment(r_delta - s_delta),
},
Self::None => self.clone(),
},
Self::None => rhs.clone(),
};
*self = sum;
}
}
impl fmt::Display for PRefInt {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
PRefInt::None => write!(f, "0"),
PRefInt::Decrement(delta) => write!(f, "-{}", delta),
PRefInt::Increment(delta) => write!(f, "+{}", delta),
}
}
}
/// The p-Refinement Type
///
/// p-refinements are used to modify the expansion orders associated with an Elem
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct PRef {
di: PRefInt,
dj: PRefInt,
}
impl PRef {
/// Create a new p-refinement with the given deltas for the i and j expansion orders
pub const fn from(delta_i: i8, delta_j: i8) -> Self {
Self {
di: PRefInt::from_i8(delta_i),
dj: PRefInt::from_i8(delta_j),
}
}
/// Create a new p-refinement with the given deltas in a specific parametric direction
pub fn on_dir(dir: ParaDir, delta: i8) -> Self {
match dir {
ParaDir::U => Self::from(delta, 0),
ParaDir::V => Self::from(0, delta),
}
}
/// Get the p-refinement deltas as an array of `i8`s
pub fn as_array(&self) -> [i8; 2] {
[self.di.as_i8(), self.dj.as_i8()]
}
/// Constrict the p-refinement to sit within a given range
pub fn constrained_to(mut self, [u_bounds, v_bounds]: [[i8; 2]; 2]) -> Self {
self.di.constrain(u_bounds);
self.dj.constrain(v_bounds);
self
}
/// Check if the refinement falls within the given bounds
pub fn falls_within(&self, [u_bounds, v_bounds]: [[i8; 2]; 2]) -> bool {
self.di.within(u_bounds) && self.dj.within(v_bounds)
}
fn refine_i(&self, i_current: u8) -> Result<u8, PRefError> {
self.di.refine(i_current)
}
fn refine_j(&self, j_current: u8) -> Result<u8, PRefError> {
self.dj.refine(j_current)
}
}
impl AddAssign for PRef {
fn add_assign(&mut self, rhs: Self) {
self.di += rhs.di;
self.dj += rhs.dj;
}
}
impl fmt::Display for PRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "PRef (i: {}, j: {})", self.di, self.dj)
}
}
/// The Error Type for invalid p-refinements
#[derive(Debug)]
pub enum PRefError {
// Errors caused by internal problems with the Mesh (Should never happen)
NegExpansion,
ExceededMaxExpansion,
// Public Errors
DuplicateElemIds,
ElemDoesNotExist(usize),
RefinementOutOfBounds(usize),
}
impl std::error::Error for PRefError {}
impl fmt::Display for PRefError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Self::NegExpansion => write!(
f,
"Negative p-Refinement results in 0 or negative expansion order; Cannot p-Refine!"
),
Self::ExceededMaxExpansion => write!(
f,
"Positive p-Refinement results in expansion order over maximum; Cannot p-Refine!"
),
Self::DuplicateElemIds => write!(
f,
"Duplicate element ids in p-Refinement; Cannot apply p-Refinement!"
),
Self::ElemDoesNotExist(elem_id) => write!(
f,
"Elem {} does not exist; Cannot apply p-Refinement!",
elem_id
),
Self::RefinementOutOfBounds(elem_id) => write!(
f,
"Refinement out of bounds for Elem {}; Cannot apply p-Refinement!",
elem_id
),
}
}
}
impl From<MeshAccessError> for PRefError {
fn from(err: MeshAccessError) -> Self {
match err {
MeshAccessError::ElemDoesNotExist(elem_id) => Self::ElemDoesNotExist(elem_id),
_ => unreachable!(),
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn p_ref_constraints() {
let pr = PRef::from(4, 6);
let prc = pr.constrained_to([[0, 1], [-2, 5]]).as_array();
assert_eq!(prc[0], 1);
assert_eq!(prc[1], 5);
let pr_neg = PRef::from(-3, -2);
let prc_neg = pr_neg.constrained_to([[-2, 4], [0, 3]]).as_array();
assert_eq!(prc_neg[0], -2);
assert_eq!(prc_neg[1], 0);
}
#[test]
fn p_ref_falls_within() {
let pr = PRef::from(0, 10);
assert!(pr.falls_within([[0, 1], [-2, 10]]));
assert!(!pr.falls_within([[-2, -1], [3, 10]]));
assert!(!pr.falls_within([[-1, 1], [11, 14]]));
}
}
| 30.442478 | 104 | 0.522674 |
fb02afe562d9fbb3a4e2347629d436a43a338d50 | 796 | php | PHP | database/seeds/DanhMucTableSeeder.php | linhfishCR7/laravelWebsite | 1d3b03b4823c9151b393b8e233519d4774d575dc | [
"MIT"
] | null | null | null | database/seeds/DanhMucTableSeeder.php | linhfishCR7/laravelWebsite | 1d3b03b4823c9151b393b8e233519d4774d575dc | [
"MIT"
] | null | null | null | database/seeds/DanhMucTableSeeder.php | linhfishCR7/laravelWebsite | 1d3b03b4823c9151b393b8e233519d4774d575dc | [
"MIT"
] | null | null | null | <?php
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class DanhMucTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$list = [];
$types = ["Cá Betta", "Hoa Lan", "Mỹ Phẩm"];
sort($types);
$today = new DateTime('2021-01-01 00:00:00');
for ($i=1; $i <= count($types); $i++) {
array_push($list, [
'dm_ma' => $i,
'dm_ten' => $types[$i-1],
'dm_trangThai' => random_int(1,2),
'dm_taoMoi' => $today->format('Y-m-d H:i:s'),
'dm_capNhat' => $today->format('Y-m-d H:i:s')
]);
}
DB::table('danhmuc')->insert($list);
}
}
| 23.411765 | 62 | 0.451005 |
863680cf9cf91253edf45191e7e95d505d1bae1e | 115 | kt | Kotlin | app/src/main/java/cz/prague/cvut/fit/steuejan/amtelapp/data/util/Message.kt | hawklike/amtel-app | 1f88ddbcbd8e547158a4677c934b4dbf18ec82e1 | [
"MIT"
] | null | null | null | app/src/main/java/cz/prague/cvut/fit/steuejan/amtelapp/data/util/Message.kt | hawklike/amtel-app | 1f88ddbcbd8e547158a4677c934b4dbf18ec82e1 | [
"MIT"
] | 7 | 2020-02-06T15:55:13.000Z | 2020-04-15T21:23:58.000Z | app/src/main/java/cz/prague/cvut/fit/steuejan/amtelapp/data/util/Message.kt | hawklike/amtel-app | 1f88ddbcbd8e547158a4677c934b4dbf18ec82e1 | [
"MIT"
] | null | null | null | package cz.prague.cvut.fit.steuejan.amtelapp.data.util
data class Message(val title: String, val message: String?) | 38.333333 | 59 | 0.8 |
c3276415c678a012609a43444cd60d0237cf187c | 4,909 | rs | Rust | core/src/lib.rs | c410-f3r/rust-libp2p | 8c119269d620f7de3956590ab45a14c9f5acd266 | [
"MIT"
] | null | null | null | core/src/lib.rs | c410-f3r/rust-libp2p | 8c119269d620f7de3956590ab45a14c9f5acd266 | [
"MIT"
] | null | null | null | core/src/lib.rs | c410-f3r/rust-libp2p | 8c119269d620f7de3956590ab45a14c9f5acd266 | [
"MIT"
] | 1 | 2021-08-30T21:44:45.000Z | 2021-08-30T21:44:45.000Z | // Copyright 2017-2018 Parity Technologies (UK) Ltd.
//
// 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.
//! Transports, upgrades, multiplexing and node handling of *libp2p*.
//!
//! The main concepts of libp2p-core are:
//!
//! - A [`PeerId`] is a unique global identifier for a node on the network.
//! Each node must have a different `PeerId`. Normally, a `PeerId` is the
//! hash of the public key used to negotiate encryption on the
//! communication channel, thereby guaranteeing that they cannot be spoofed.
//! - The [`Transport`] trait defines how to reach a remote node or listen for
//! incoming remote connections. See the `transport` module.
//! - The [`StreamMuxer`] trait is implemented on structs that hold a connection
//! to a remote and can subdivide this connection into multiple substreams.
//! See the `muxing` module.
//! - The [`UpgradeInfo`], [`InboundUpgrade`] and [`OutboundUpgrade`] traits
//! define how to upgrade each individual substream to use a protocol.
//! See the `upgrade` module.
/// Multi-address re-export.
pub use multiaddr;
pub use multistream_select::Negotiated;
mod keys_proto;
mod peer_id;
mod translation;
#[cfg(test)]
mod tests;
pub mod either;
pub mod identity;
pub mod muxing;
pub mod nodes;
pub mod transport;
pub mod upgrade;
pub use multiaddr::Multiaddr;
pub use muxing::StreamMuxer;
pub use peer_id::PeerId;
pub use identity::PublicKey;
pub use transport::Transport;
pub use translation::address_translation;
pub use upgrade::{InboundUpgrade, OutboundUpgrade, UpgradeInfo, UpgradeError, ProtocolName};
pub use nodes::ConnectionInfo;
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum Endpoint {
/// The socket comes from a dialer.
Dialer,
/// The socket comes from a listener.
Listener,
}
impl std::ops::Not for Endpoint {
type Output = Endpoint;
fn not(self) -> Self::Output {
match self {
Endpoint::Dialer => Endpoint::Listener,
Endpoint::Listener => Endpoint::Dialer
}
}
}
impl Endpoint {
/// Is this endpoint a dialer?
pub fn is_dialer(self) -> bool {
if let Endpoint::Dialer = self {
true
} else {
false
}
}
/// Is this endpoint a listener?
pub fn is_listener(self) -> bool {
if let Endpoint::Listener = self {
true
} else {
false
}
}
}
/// How we connected to a node.
#[derive(Debug, Clone)]
pub enum ConnectedPoint {
/// We dialed the node.
Dialer {
/// Multiaddress that was successfully dialed.
address: Multiaddr,
},
/// We received the node.
Listener {
/// Local connection address.
local_addr: Multiaddr,
/// Stack of protocols used to send back data to the remote.
send_back_addr: Multiaddr,
}
}
impl From<&'_ ConnectedPoint> for Endpoint {
fn from(endpoint: &'_ ConnectedPoint) -> Endpoint {
endpoint.to_endpoint()
}
}
impl From<ConnectedPoint> for Endpoint {
fn from(endpoint: ConnectedPoint) -> Endpoint {
endpoint.to_endpoint()
}
}
impl ConnectedPoint {
/// Turns the `ConnectedPoint` into the corresponding `Endpoint`.
pub fn to_endpoint(&self) -> Endpoint {
match self {
ConnectedPoint::Dialer { .. } => Endpoint::Dialer,
ConnectedPoint::Listener { .. } => Endpoint::Listener
}
}
/// Returns true if we are `Dialer`.
pub fn is_dialer(&self) -> bool {
match self {
ConnectedPoint::Dialer { .. } => true,
ConnectedPoint::Listener { .. } => false
}
}
/// Returns true if we are `Listener`.
pub fn is_listener(&self) -> bool {
match self {
ConnectedPoint::Dialer { .. } => false,
ConnectedPoint::Listener { .. } => true
}
}
}
| 30.874214 | 92 | 0.659401 |
8bd732f28501d35f7a9ed79e2552bfd909546328 | 34 | sql | SQL | src/main/resources/sql/mysql-rollback-v7.sql | alunwcom/moany | fcbae339b0f17458482145b30796c4bd0a235aed | [
"MIT"
] | 1 | 2021-04-18T15:31:10.000Z | 2021-04-18T15:31:10.000Z | src/main/resources/sql/mysql-rollback-v7.sql | alunwcom/moany | fcbae339b0f17458482145b30796c4bd0a235aed | [
"MIT"
] | null | null | null | src/main/resources/sql/mysql-rollback-v7.sql | alunwcom/moany | fcbae339b0f17458482145b30796c4bd0a235aed | [
"MIT"
] | null | null | null | -- No rollback for early versions
| 17 | 33 | 0.764706 |
9177f422d4ad9c53d1b0d9bbfe19de12c9902a5d | 1,029 | kt | Kotlin | colors-palette/src/commonMain/kotlin/com.chrynan.colors.palette/Swatch.kt | chRyNaN/colors | b8983dc183d2f31a4a545cc1cdd7bfc2a4d6d55c | [
"Apache-2.0"
] | 8 | 2021-01-03T07:55:23.000Z | 2022-01-21T13:46:11.000Z | colors-palette/src/commonMain/kotlin/com.chrynan.colors.palette/Swatch.kt | chRyNaN/colors | b8983dc183d2f31a4a545cc1cdd7bfc2a4d6d55c | [
"Apache-2.0"
] | null | null | null | colors-palette/src/commonMain/kotlin/com.chrynan.colors.palette/Swatch.kt | chRyNaN/colors | b8983dc183d2f31a4a545cc1cdd7bfc2a4d6d55c | [
"Apache-2.0"
] | null | null | null | package com.chrynan.colors.palette
import com.chrynan.colors.Color
/**
* Represents a color swatch which contains a [color] and the related [primaryOnColor] and
* [secondaryOnColor] which can be used to overlap the [color] with enough contrast. A color
* [Swatch] is typically extracted from an image by looking at it's pixel data.
*
* @property [color] The primary [Color] for this swatch.
* @property [primaryOnColor] The primary color that can be used on top of the [color] value. For
* instance, when displaying text over the [color] value, this value can be used.
* @property [secondaryOnColor] The secondary color that can be used on top of the [color] value.
* For instance, when displaying text over the [color] value, this value can be used.
* @property [population] The number of pixels represented by this swatch in an underlying image.
*/
data class Swatch(
val color: Color,
val primaryOnColor: Color,
val secondaryOnColor: Color,
val population: Int? = null
) {
companion object
}
| 39.576923 | 97 | 0.736638 |