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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ca0d56fd7393e08f648684c8f7a434903a9489c8 | 133 | java | Java | src/main/java/com/github/steveice10/mc/protocol/data/game/inventory/FillStackAction.java | MCMDEV/MCProtocolLib | ede68d02c4cbd2e4001745c76460d99bdf305885 | [
"MIT"
] | 84 | 2020-08-10T09:55:40.000Z | 2022-03-27T18:23:34.000Z | src/main/java/com/github/steveice10/mc/protocol/data/game/inventory/FillStackAction.java | MCMDEV/MCProtocolLib | ede68d02c4cbd2e4001745c76460d99bdf305885 | [
"MIT"
] | 25 | 2021-09-23T20:08:46.000Z | 2022-03-20T23:02:37.000Z | src/main/java/com/github/steveice10/mc/protocol/data/game/inventory/FillStackAction.java | MCMDEV/MCProtocolLib | ede68d02c4cbd2e4001745c76460d99bdf305885 | [
"MIT"
] | 37 | 2020-08-06T09:49:50.000Z | 2022-03-19T20:09:45.000Z | package com.github.steveice10.mc.protocol.data.game.inventory;
public enum FillStackAction implements ContainerAction {
FILL;
}
| 22.166667 | 62 | 0.804511 |
adf2be909e0b5f2a8d3990b53070a64298266b6f | 6,858 | swift | Swift | InternalTestApp/PrebidMobileDemoRendering/AppDelegate.swift | motesp/prebid-mobile-ios | 92b85d9fcf22b4b5f905040f438f34ec10f46610 | [
"Apache-2.0"
] | null | null | null | InternalTestApp/PrebidMobileDemoRendering/AppDelegate.swift | motesp/prebid-mobile-ios | 92b85d9fcf22b4b5f905040f438f34ec10f46610 | [
"Apache-2.0"
] | null | null | null | InternalTestApp/PrebidMobileDemoRendering/AppDelegate.swift | motesp/prebid-mobile-ios | 92b85d9fcf22b4b5f905040f438f34ec10f46610 | [
"Apache-2.0"
] | null | null | null | /* Copyright 2018-2021 Prebid.org, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import UIKit
import CoreLocation
import MoPubSDK
import GoogleMobileAds
import PrebidMobile
import PrebidMobileMoPubAdapters
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var clLocationManager:CLLocationManager!
let consentHelper = IABConsentHelper()
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
{
let processArgumentsParser = ProcessArgumentsParser()
consentHelper.eraseIrrelevantUserDefaults()
processArgumentsParser.addOption("IABConsent_Settings", paramsCount: 1, fireOnce: true) { [consentHelper] params in
consentHelper.parseAndApply(consentSettingsString: params[0])
}
//Set up SDK.
PrebidRenderingConfig.initializeRenderingModule()
// Set up MockServer
processArgumentsParser.addOption("useMockServer", fireOnce: true) { params in
AppConfiguration.shared.useMockServer = true
}
// processArgumentsParser.addOption("EXTRA_NATIVE", paramsCount: 1, fireOnce: true) { params in
// if let nativeConfigData = params[0].data(using: .utf8),
// let nativeConfigObj = try? JSONSerialization.jsonObject(with: nativeConfigData, options: []) as? [String: Any],
// let nativeAdConfig = NativeAdConfiguration(json: nativeConfigObj)
// {
// // TODO: Add error alert(?)
// AppConfiguration.shared.nativeAdConfig = nativeAdConfig
// }
// }
processArgumentsParser.addOption("AD_POSITION", paramsCount: 1, fireOnce: true) { params in
if let adPositionInt = Int(params[0]), let adPosition = AdPosition(rawValue: adPositionInt) {
AppConfiguration.shared.adPosition = adPosition
}
}
processArgumentsParser.addOption("VIDEO_PLACEMENT_TYPE", paramsCount: 1, fireOnce: true) { params in
if let placementTypeInt = Int(params[0]), let placementType = VideoPlacementType(rawValue: placementTypeInt) {
AppConfiguration.shared.videoPlacementType = placementType
}
}
processArgumentsParser.addOption("-keyUITests", fireOnce: true) { params in
//Speed up UI tests by disabling animation
UIView.setAnimationsEnabled(false)
UIApplication.shared.keyWindow?.layer.speed = 200
}
processArgumentsParser.addOption("ADD_USER_DATA", paramsCount: 2) { params in
PrebidRenderingTargeting.shared.addUserData(params[1], forKey: params[0])
}
processArgumentsParser.addOption("ADD_APP_CONTEXT", paramsCount: 2) { params in
PrebidRenderingTargeting.shared.addContextData(params[1], forKey: params[0])
}
processArgumentsParser.addOption("BIDDER_ACCESS_CONTROL_LIST", acceptedParamsRange: (min: 1, max: nil)) { params in
params.forEach(PrebidRenderingTargeting.shared.addBidder(toAccessControlList:))
}
processArgumentsParser.addOption("ADD_ADUNIT_CONTEXT", paramsCount: 2) { params in
let appConfig = AppConfiguration.shared
appConfig.adUnitContext = (appConfig.adUnitContext ?? []) + [(key: params[0], value: params[1])]
}
processArgumentsParser.parseProcessArguments(ProcessInfo.processInfo.arguments)
// MoPub
let mopubConfig = MPMoPubConfiguration(adUnitIdForAppInitialization: "0cde6f47aa6842e49c8575492cf9ee3f")
mopubConfig.loggingLevel = .info
mopubConfig.additionalNetworks = [PrebidMoPubAdapterConfiguration.self]
MoPub.sharedInstance().initializeSdk(with: mopubConfig, completion: GlobalVars.reactiveMoPubInitFlag.markSdkInitialized)
// AdMob
GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = [kGADSimulatorID as! String]
GADMobileAds.sharedInstance().start { (status) in
//Registered so that DownloadHelper gets covered by this
GlobalVars.reactiveGAMInitFlag.markSdkInitialized()
};
PrebidRenderingConfig.shared.logLevel = PBMLogLevel.info
PrebidRenderingConfig.shared.debugLogFileEnabled = true
// Ads may include Open Measurement scripts that sometime require additional time for loading.
PrebidRenderingConfig.shared.creativeFactoryTimeout = 20;
PrebidRenderingConfig.shared.locationUpdatesEnabled = false
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| 48.638298 | 279 | 0.713619 |
769396b4d2602c67000a763fe8297c5b0c03207f | 27,465 | swift | Swift | KofktuSDK/Classes/Components/KUIImageViewController.swift | Kofktu/KofktuSDK | cc077e5d87cff7493c78c397a195281f5d161671 | [
"MIT"
] | 13 | 2017-10-17T07:01:47.000Z | 2019-02-14T07:36:13.000Z | KofktuSDK/Classes/Components/KUIImageViewController.swift | Kofktu/KofktuSDK | cc077e5d87cff7493c78c397a195281f5d161671 | [
"MIT"
] | null | null | null | KofktuSDK/Classes/Components/KUIImageViewController.swift | Kofktu/KofktuSDK | cc077e5d87cff7493c78c397a195281f5d161671 | [
"MIT"
] | 3 | 2018-12-03T13:17:30.000Z | 2020-11-23T11:47:12.000Z | //
// KUIImageViewController.swift
// KofktuSDK
//
// Created by Kofktu on 2016. 9. 9..
// Copyright © 2016년 Kofktu. All rights reserved.
//
import UIKit
import SDWebImage
@objc public protocol KUIImageViewControllerDataSource: class {
// Required
func numberOfImages(_ controller: KUIImageViewController) -> Int
func imageUrlString(at index: Int, controller: KUIImageViewController) -> String?
// Optional
@objc optional func placeholderImage(at index: Int, controller: KUIImageViewController) -> UIImage?
@objc optional func senderView(at index: Int, controller: KUIImageViewController) -> UIView?
}
@objc public protocol KUIImageViewControllerDelegate: class {
// Optional
@objc optional func gestureBegan(_ controller: KUIImageViewController)
@objc optional func gestureChanged(_ controller: KUIImageViewController, translation: CGPoint)
@objc optional func willShow(_ controller: KUIImageViewController)
@objc optional func didShow(_ controller: KUIImageViewController)
@objc optional func willDismiss(_ controller: KUIImageViewController)
@objc optional func didDismiss(_ controller: KUIImageViewController)
@objc optional func willRollback(_ controller: KUIImageViewController)
@objc optional func didRollback(_ controller: KUIImageViewController)
@objc optional func willDisplay(at index: Int, controller: KUIImageViewController, contentView: UIView)
@objc optional func didEndDisplaying(at index: Int, controller: KUIImageViewController, contentView: UIView)
@objc optional func singleTap(at index: Int, controller: KUIImageViewController)
}
open class KUIImageViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, UIGestureRecognizerDelegate, KUIPhotoViewDelegate {
open weak var delegate: KUIImageViewControllerDelegate?
open weak var dataSource: KUIImageViewControllerDataSource?
open weak var senderView: UIView?
fileprivate var panGesture: UIPanGestureRecognizer?
fileprivate var startOrigin: CGPoint = CGPoint.zero
fileprivate weak var fromViewController: UIViewController!
fileprivate lazy var collectionView: UICollectionView = {
let flowLayout = UICollectionViewFlowLayout()
flowLayout.scrollDirection = .horizontal
flowLayout.minimumInteritemSpacing = 0.0
flowLayout.minimumLineSpacing = 0.0
flowLayout.sectionInset = UIEdgeInsets.zero
let collectionView: UICollectionView = UICollectionView(frame: self.view.bounds, collectionViewLayout: flowLayout)
collectionView.backgroundColor = UIColor.clear
collectionView.delegate = self
collectionView.dataSource = self
collectionView.bounces = false
collectionView.isPagingEnabled = true
collectionView.translatesAutoresizingMaskIntoConstraints = false
collectionView.register(KUIImageViewerContentCollectionViewCell.self, forCellWithReuseIdentifier: KUIImageViewerContentCollectionViewCell.reusableIdentifier)
return collectionView
}()
fileprivate lazy var snapshotImgView: UIImageView = {
let snapshotImgView = UIImageView(frame: CGRect.zero)
snapshotImgView.contentMode = .scaleAspectFit
return snapshotImgView
}()
fileprivate var snapshotImage: UIImage? {
return (senderView as? UIImageView)?.image ?? (senderView as? UIButton)?.currentImage ?? senderView?.capture()
}
public private(set) var currentIndex: Int = 0
private let threshold: CGFloat = 100.0
private var originStatusBarStyle: UIStatusBarStyle = .`default`
private var currentStatusBarStyle: UIStatusBarStyle = .`default`
open override var preferredStatusBarStyle: UIStatusBarStyle {
return currentStatusBarStyle
}
open override func loadView() {
super.loadView()
view.insertSubview(collectionView, at: 0)
view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|-0-[view]-0-|", views: ["view": collectionView]))
view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|-0-[view]-0-|", views: ["view": collectionView]))
}
open override func viewDidLoad() {
super.viewDidLoad()
currentStatusBarStyle = UIApplication.shared.statusBarStyle
originStatusBarStyle = currentStatusBarStyle
}
open override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
currentStatusBarStyle = .lightContent
setNeedsStatusBarAppearanceUpdate()
}
open override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
currentStatusBarStyle = .lightContent
setNeedsStatusBarAppearanceUpdate()
}
open override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
currentStatusBarStyle = originStatusBarStyle
setNeedsStatusBarAppearanceUpdate()
}
open override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
currentStatusBarStyle = originStatusBarStyle
setNeedsStatusBarAppearanceUpdate()
}
open func show(_ fromViewController: UIViewController, completion: (() -> Void)? = nil) {
if let senderView = senderView, let window = UIApplication.shared.keyWindow {
snapshotImgView.frame = window.convert(senderView.frame, from: senderView.superview)
snapshotImgView.image = snapshotImage
snapshotImgView.clipsToBounds = senderView.clipsToBounds
snapshotImgView.layer.cornerRadius = senderView.layer.cornerRadius
snapshotImgView.isHidden = false
view.addSubview(snapshotImgView)
senderView.alpha = 0.0
collectionView.alpha = 0.0
}
modalPresentationStyle = .custom
modalPresentationCapturesStatusBarAppearance = true
view.backgroundColor = UIColor(white: 0.0, alpha: 0.0)
delegate?.willShow?(self)
fromViewController.present(self, animated: false, completion: {
UIView.animate(withDuration: 0.25, animations: {
self.snapshotImgView.frame = self.view.convert(self.collectionView.frame, from: self.view)
self.view.backgroundColor = UIColor.black
}, completion: { (finished) in
self.senderView?.alpha = 1.0
self.collectionView.alpha = 1.0
self.collectionView.reloadData()
self.snapshotImgView.layer.cornerRadius = 0.0
self.snapshotImgView.isHidden = true
self.snapshotImgView.removeFromSuperview()
self.fromViewController = fromViewController
self.registerGesture()
self.delegate?.didShow?(self)
completion?()
})
})
}
@objc open func dismiss() {
if self.snapshotImgView.superview == nil {
senderView?.alpha = 0.0
collectionView.alpha = 0.0
collectionView.isScrollEnabled = false
snapshotImgView.image = (collectionView.visibleCells.first as? KUIImageViewerContentCollectionViewCell)?.image
snapshotImgView.frame = collectionView.bounds
snapshotImgView.isHidden = false
view.addSubview(snapshotImgView)
}
panGesture?.isEnabled = false
delegate?.willDismiss?(self)
UIView.animate(withDuration: 0.25, animations: {
if let senderView = self.senderView, let window = UIApplication.shared.keyWindow {
self.snapshotImgView.frame = window.convert(senderView.frame, from: senderView.superview)
self.snapshotImgView.layer.cornerRadius = senderView.layer.cornerRadius
}
self.view.backgroundColor = UIColor(white: 0.0, alpha: 0.0)
}, completion: { (finished) in
self.snapshotImgView.removeFromSuperview()
self.senderView?.alpha = 1.0
self.dismiss(animated: false, completion: {
self.delegate?.didDismiss?(self)
})
})
}
open func reloadData() {
collectionView.reloadData()
}
open func move(at index: Int, animated: Bool = true) {
collectionView.selectItem(at: IndexPath(item: index, section: 0), animated: animated, scrollPosition: .centeredHorizontally)
}
// MARK: - Private
fileprivate func registerGesture() {
unregisterGesture()
panGesture = UIPanGestureRecognizer(target: self, action: #selector(pan(_:)))
panGesture?.delegate = self
panGesture?.cancelsTouchesInView = false
guard let gesture = panGesture else { return }
collectionView.panGestureRecognizer.require(toFail: gesture)
view.addGestureRecognizer(gesture)
}
fileprivate func unregisterGesture() {
defer {
panGesture?.delegate = nil
panGesture = nil
}
guard let gesture = panGesture else { return }
view.removeGestureRecognizer(gesture)
}
fileprivate func rollback() {
panGesture?.isEnabled = false
delegate?.willRollback?(self)
UIView.animate(withDuration: 0.25, animations: {
self.snapshotImgView.y = 0.0
self.view.backgroundColor = UIColor.black
}, completion: { (finished) in
self.snapshotImgView.isHidden = true
self.snapshotImgView.removeFromSuperview()
self.collectionView.alpha = 1.0
self.collectionView.isScrollEnabled = true
self.panGesture?.isEnabled = true
self.delegate?.didRollback?(self)
})
}
// MARK: - Actions
@objc func pan(_ gesture: UIPanGestureRecognizer) {
switch gesture.state{
case .began:
senderView?.alpha = 0.0
collectionView.alpha = 0.0
collectionView.isScrollEnabled = false
snapshotImgView.image = (collectionView.visibleCells.first as? KUIImageViewerContentCollectionViewCell)?.image
snapshotImgView.frame = collectionView.frame
snapshotImgView.isHidden = false
view.addSubview(snapshotImgView)
delegate?.gestureBegan?(self)
case .changed:
let translation = gesture.translation(in: view)
let alpha = 1.0 - abs(translation.y) / view.height
snapshotImgView.y = translation.y
view.backgroundColor = UIColor(white: 0.0, alpha: max(alpha, 0.5))
delegate?.gestureChanged?(self, translation: translation)
default:
let translation = gesture.translation(in: view)
let alpha = 1.0 - abs(translation.y) / view.height
if alpha < 0.8 {
dismiss()
} else {
rollback()
}
}
}
// MARK: - UIScrollViewDelegate
open func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
currentIndex = Int(scrollView.contentOffset.x / scrollView.width)
senderView = dataSource?.senderView?(at: currentIndex, controller: self) ?? senderView
}
// MARK: - UICollectionViewProtocol
open func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return dataSource?.numberOfImages(self) ?? 0
}
open func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(for: indexPath) as KUIImageViewerContentCollectionViewCell
cell.delegate = self
cell.imageUrl = (dataSource?.imageUrlString(at: indexPath.item, controller: self), dataSource?.placeholderImage?(at: indexPath.item, controller: self))
return cell
}
open func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
currentIndex = indexPath.item
senderView = dataSource?.senderView?(at: indexPath.item, controller: self) ?? senderView
delegate?.willDisplay?(at: indexPath.item, controller: self, contentView: cell)
}
open func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
delegate?.didEndDisplaying?(at: indexPath.item, controller: self, contentView: cell)
}
open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return collectionView.size
}
// MARK: - UIGestureRecognizerDelegate
open func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
guard let cell = (collectionView.visibleCells.first as? KUIImageViewerContentCollectionViewCell), !cell.isZooming else { return false }
guard let velocity = (gestureRecognizer as? UIPanGestureRecognizer)?.velocity(in: gestureRecognizer.view), velocity.y != 0 else { return true }
return abs(velocity.y) > abs(velocity.x) + threshold
}
open func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
return gestureRecognizer == panGesture
}
// MARK: - KUIPhotoViewDelegate
open func singleTap(_ photoView: KUIPhotoView) {
delegate?.singleTap?(at: currentIndex, controller: self)
}
}
open class KUIImageViewerContentCollectionViewCell: UICollectionViewCell, UIScrollViewDelegate {
open weak var delegate: KUIPhotoViewDelegate? {
get {
return photoView.photoDelegate
}
set {
photoView.photoDelegate = newValue
}
}
open var isZooming: Bool {
return photoView.zoomScale != photoView.minimumZoomScale
}
open var imageUrl: (String?, UIImage?) {
didSet {
photoView.imageUrl = imageUrl
}
}
open var image: UIImage? {
return photoView.imageView.image
}
fileprivate lazy var photoView: KUIPhotoView = {
let photoView = KUIPhotoView(frame: self.bounds)
return photoView
}()
required public override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = UIColor.clear
addSubviewAtFit(photoView)
}
required public init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override open func prepareForReuse() {
super.prepareForReuse()
photoView.resetZoom()
}
}
@objc public protocol KUIPhotoViewDelegate: class {
@objc optional func singleTap(_ photoView: KUIPhotoView)
}
open class KUIPhotoView: UIScrollView, UIScrollViewDelegate {
open weak var photoDelegate: KUIPhotoViewDelegate?
override open var frame: CGRect {
didSet {
let origin = imageView.origin
contentSize = CGSize(width: frame.width * zoomScale, height: frame.height * zoomScale)
imageView.frame = CGRect(origin: origin, size: contentSize)
}
}
open var imageUrl: (String?, UIImage?) {
willSet {
imageView.clearImage()
}
didSet {
imageView.sd_setImage(with: imageUrl.0.flatMap { URL(string: $0) }, placeholderImage: imageUrl.1)
}
}
lazy open var imageView: SDAnimatedImageView = {
let imageView = SDAnimatedImageView(frame: self.bounds)
imageView.backgroundColor = UIColor.clear
imageView.contentMode = .scaleAspectFit
let indicator = SDWebImageActivityIndicator.white
indicator.indicatorView.hidesWhenStopped = true
imageView.sd_imageIndicator = indicator
imageView.sd_imageIndicator?.stopAnimatingIndicator()
return imageView
}()
required override public init(frame: CGRect) {
super.init(frame: frame)
clipsToBounds = true
delegate = self
scrollsToTop = false
minimumZoomScale = 1.0
maximumZoomScale = 2.5
decelerationRate = UIScrollView.DecelerationRate.fast
backgroundColor = UIColor.clear
addSubview(imageView)
registerGestures()
}
required public init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
open func resetZoom() {
zoom(to: bounds, animated: false)
setZoomScale(minimumZoomScale, animated: false)
contentSize = CGSize(width: frame.width * zoomScale, height: frame.height * zoomScale)
}
@objc func singleTap(_ gesture: UITapGestureRecognizer) {
photoDelegate?.singleTap?(self)
}
@objc func doubleTap(_ gesture: UITapGestureRecognizer) {
guard zoomScale == minimumZoomScale else {
setZoomScale(minimumZoomScale, animated: true)
return
}
let location = gesture.location(in: self)
let zoomRectSize = CGSize(width: frame.width / maximumZoomScale, height: frame.height / maximumZoomScale)
var zoomRect = CGRect(origin: CGPoint(x: max(0.0, location.x - (zoomRectSize.width * 0.5)), y: max(0.0, location.y - (zoomRectSize.height * 0.5))), size: zoomRectSize)
if zoomRect.origin.x + zoomRect.size.width > frame.width {
zoomRect.origin.x = frame.width - zoomRect.size.width
}
if zoomRect.origin.y + zoomRect.size.height > frame.height {
zoomRect.origin.y = frame.height - zoomRect.size.height
}
zoom(to: zoomRect, animated: true)
}
fileprivate func registerGestures() {
let singleTap = UITapGestureRecognizer(target: self, action: #selector(singleTap(_:)))
let doubleTap = UITapGestureRecognizer(target: self, action: #selector(doubleTap(_:)))
doubleTap.numberOfTapsRequired = 2
singleTap.require(toFail: doubleTap)
addGestureRecognizer(singleTap)
addGestureRecognizer(doubleTap)
}
// MARK: - UIScrollViewDelegate
open func viewForZooming(in scrollView: UIScrollView) -> UIView? {
return imageView
}
}
open class KUISimpleImageViewerViewController: KUIImageViewController, KUIImageViewControllerDataSource, KUIImageViewControllerDelegate {
@IBOutlet open weak var closeButton: UIButton!
open var imageUrl: String? {
didSet {
guard isViewLoaded && imageUrl != oldValue else { return }
reloadData()
}
}
open var placeHolderImage: UIImage?
open override func loadView() {
super.loadView()
delegate = self
dataSource = self
if closeButton == nil {
let dismissSelector = #selector(((KUISimpleImageViewerViewController.dismiss) as (KUISimpleImageViewerViewController) -> () -> Void))
let button = UIButton(type: .custom)
button.setImage(UIImage(named: "close"), for: [])
button.addTarget(self, action: dismissSelector, for: .touchUpInside)
button.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(button)
view.addConstraint(NSLayoutConstraint(item: button, attribute: .leading, relatedBy: .equal, toItem: view, attribute: .leading, multiplier: 1.0, constant: 5.0))
view.addConstraint(NSLayoutConstraint(item: button, attribute: .top, relatedBy: .equal, toItem: topLayoutGuide, attribute: .top, multiplier: 1.0, constant: 25.0))
button.addConstraint(NSLayoutConstraint(item: button, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1.0, constant: 40.0))
button.addConstraint(NSLayoutConstraint(item: button, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1.0, constant: 40.0))
closeButton = button
}
}
// MARK: - KUIImageViewControllerDataSource
open func numberOfImages(_ controller: KUIImageViewController) -> Int {
return 1
}
open func imageUrlString(at index: Int, controller: KUIImageViewController) -> String? {
return imageUrl
}
open func placeholderImage(at index: Int, controller: KUIImageViewController) -> UIImage? {
return snapshotImage ?? placeHolderImage
}
open func willShow(_ controller: KUIImageViewController) {
closeButton.alpha = 0.0
}
open func didShow(_ controller: KUIImageViewController) {
closeButton.alpha = 1.0
}
open func willDismiss(_ controller: KUIImageViewController) {
closeButton.alpha = 0.0
}
open func didDismiss(_ controller: KUIImageViewController) {
closeButton.alpha = 1.0
}
open func willRollback(_ controller: KUIImageViewController) {
closeButton.alpha = 0.0
}
open func didRollback(_ controller: KUIImageViewController) {
closeButton.alpha = 1.0
}
open func gestureBegan(_ controller: KUIImageViewController) {
closeButton.alpha = 0.0
}
open func singleTap(at index: Int, controller: KUIImageViewController) {
UIView.animate(withDuration: 0.25, animations: {
if self.closeButton.alpha > 0.0 {
self.closeButton.alpha = 0.0
} else {
self.closeButton.alpha = 1.0
}
})
}
}
@objc public protocol KUIMultiImageViewerViewControllerDelegate: class {
@objc optional func senderView(at index: Int, controller: KUIMultiImageViewerViewController) -> UIView?
}
open class KUIMultiImageViewerViewController: KUIImageViewController, KUIImageViewControllerDataSource, KUIImageViewControllerDelegate {
@IBOutlet open weak var closeButton: UIButton!
@IBOutlet open weak var titleLabel: UILabel!
open weak var multiDelegate: KUIMultiImageViewerViewControllerDelegate?
open var font = UIFont.systemFont(ofSize: 17.0)
open var imageUrls: Array<String>?
open var placeHolderImage: UIImage?
fileprivate var originStatusBarStyle: UIStatusBarStyle = .`default`
open override func loadView() {
super.loadView()
delegate = self
dataSource = self
if closeButton == nil {
let dismissSelector = #selector(((KUIMultiImageViewerViewController.dismiss) as (KUIMultiImageViewerViewController) -> () -> Void))
let button = UIButton(type: .custom)
button.titleLabel?.font = font
button.setTitle("X", for: [])
button.setTitleColor(.white, for: [])
button.addTarget(self, action: dismissSelector, for: .touchUpInside)
button.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(button)
view.addConstraint(NSLayoutConstraint(item: button, attribute: .leading, relatedBy: .equal, toItem: view, attribute: .leading, multiplier: 1.0, constant: 5.0))
view.addConstraint(NSLayoutConstraint(item: button, attribute: .top, relatedBy: .equal, toItem: topLayoutGuide, attribute: .top, multiplier: 1.0, constant: 25.0))
button.addConstraint(NSLayoutConstraint(item: button, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1.0, constant: 40.0))
button.addConstraint(NSLayoutConstraint(item: button, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1.0, constant: 40.0))
closeButton = button
}
if titleLabel == nil {
let label = UILabel(frame: CGRect.zero)
label.font = font
label.textColor = UIColor.white
label.textAlignment = .center
label.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(label)
view.addConstraint(NSLayoutConstraint(item: label, attribute: .centerY, relatedBy: .equal, toItem: closeButton, attribute: .centerY, multiplier: 1.0, constant: 0.0))
view.addConstraint(NSLayoutConstraint(item: label, attribute: .centerX, relatedBy: .equal, toItem: view, attribute: .centerX, multiplier: 1.0, constant: 0.0))
titleLabel = label
}
}
// MARK: - KUIImageViewControllerDataSource
open override func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
super.scrollViewDidEndDecelerating(scrollView)
titleLabel.text = "\(currentIndex + 1) / \(imageUrls?.count ?? 0)"
}
open func numberOfImages(_ controller: KUIImageViewController) -> Int {
return imageUrls?.count ?? 0
}
open func imageUrlString(at index: Int, controller: KUIImageViewController) -> String? {
return imageUrls?[index]
}
open func placeholderImage(at index: Int, controller: KUIImageViewController) -> UIImage? {
guard let senderView = senderView(at: index, controller: self) else { return placeHolderImage }
return (senderView as? UIImageView)?.image ?? (senderView as? UIButton)?.currentImage ?? senderView.capture()
}
open func senderView(at index: Int, controller: KUIImageViewController) -> UIView? {
return multiDelegate?.senderView?(at: index, controller: self)
}
open func willDisplay(at index: Int, controller: KUIImageViewController, contentView: UIView) {
titleLabel.text = "\(index + 1) / \(imageUrls?.count ?? 0)"
}
open func willShow(_ controller: KUIImageViewController) {
closeButton.alpha = 0.0
titleLabel.alpha = 0.0
}
open func didShow(_ controller: KUIImageViewController) {
closeButton.alpha = 1.0
titleLabel.alpha = 1.0
}
open func willDismiss(_ controller: KUIImageViewController) {
closeButton.alpha = 0.0
titleLabel.alpha = 0.0
}
open func didDismiss(_ controller: KUIImageViewController) {
closeButton.alpha = 1.0
titleLabel.alpha = 1.0
}
open func willRollback(_ controller: KUIImageViewController) {
closeButton.alpha = 0.0
titleLabel.alpha = 0.0
}
open func didRollback(_ controller: KUIImageViewController) {
closeButton.alpha = 1.0
titleLabel.alpha = 1.0
}
open func gestureBegan(_ controller: KUIImageViewController) {
closeButton.alpha = 0.0
titleLabel.alpha = 0.0
}
open func singleTap(at index: Int, controller: KUIImageViewController) {
UIView.animate(withDuration: 0.25, animations: {
if self.closeButton.alpha > 0.0 {
self.closeButton.alpha = 0.0
self.titleLabel.alpha = 0.0
} else {
self.closeButton.alpha = 1.0
self.titleLabel.alpha = 0.0
}
})
}
}
| 40.212299 | 194 | 0.660149 |
168c45ec452caeef379c5d91191dfff360519c05 | 9,847 | c | C | src/stratum.c | BlazeWasHere/libstratum | 649e2d196351280943a989e29ade13cb4d1e2a75 | [
"BSL-1.0"
] | null | null | null | src/stratum.c | BlazeWasHere/libstratum | 649e2d196351280943a989e29ade13cb4d1e2a75 | [
"BSL-1.0"
] | null | null | null | src/stratum.c | BlazeWasHere/libstratum | 649e2d196351280943a989e29ade13cb4d1e2a75 | [
"BSL-1.0"
] | null | null | null | // Copyright Blaze 2021.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)
#include <assert.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "libstratum/stratum.h"
#include "libstratum/connection.h"
#include "libstratum/jsmn.h"
#ifdef ENABLE_DEBUG_LOGGING
#define DEBUG_LOG(...) \
printf(__VA_ARGS__); \
puts("");
#else
#define DEBUG_LOG(...)
#endif
#ifdef ENABLE_CRITICAL_LOGGING
#define CRITICAL_LOG(...) warn(__VA_ARGS__)
#else
#define CRITICAL_LOG(...)
#endif
#define BUFSIZE 1024
char *stratum_serialize_data(stratum_data_t *data) {
size_t size =
snprintf(NULL, 0, "{\"id\": %d, \"method\": \"%s\", \"params\": %s}\n",
data->id, data->method, data->params);
char *dumped = calloc(1, size + 1);
snprintf(dumped, size + 1,
"{\"id\": %d, \"method\": \"%s\", \"params\": %s}\n", data->id,
data->method, data->params);
return dumped;
}
static int jsoneq(const char *json, jsmntok_t *tok, const char *s) {
if (tok->type == JSMN_STRING && (int)strlen(s) == tok->end - tok->start &&
strncmp(json + tok->start, s, tok->end - tok->start) == 0)
return 0;
return -1;
}
stratum_response_t *stratum_parse_response(const char *data) {
// Assume data has been split by '\n'.
assert(strchr(data, '\n') == NULL);
stratum_response_t *stratum_data = calloc(1, sizeof(stratum_response_t));
jsmn_parser parser;
jsmntok_t t[128];
jsmn_init(&parser);
int ret =
jsmn_parse(&parser, data, strlen(data), t, sizeof(t) / sizeof(t[0]));
if (ret < 1 || t[0].type != JSMN_OBJECT) {
// failed to parse object
stratum_data->id = -1;
return stratum_data;
}
for (int i = 1; i < ret; i++) {
jsmntok_t *x = &t[i + 1];
size_t size;
char *tmp = NULL;
// printf("key: %.*s ", t[i].end - t[i].start, data + t[i].start);
// printf("value: %.*s\n", x->end - x->start, data + x->start);
if (jsoneq(data, &t[i], "id") == 0) {
size =
snprintf(NULL, 0, "%.*s", x->end - x->start, data + x->start);
tmp = calloc(1, size + 1);
snprintf(tmp, size + 1, "%.*s", x->end - x->start, data + x->start);
if (strncmp(data + x->start, "null", x->end - x->start) == 0)
stratum_data->id = 0;
else
stratum_data->id = strtol(tmp, NULL, 10);
} else if (jsoneq(data, &t[i], "result") == 0) {
if (x->type != JSMN_ARRAY) {
size = snprintf(NULL, 0, "%.*s", x->end - x->start,
data + x->start);
tmp = calloc(1, size + 1);
snprintf(tmp, size + 1, "%.*s", x->end - x->start,
data + x->start);
stratum_data->result[0] = strdup(tmp);
stratum_data->result[1] = NULL;
} else {
for (int j = 0; j < x->size; j++) {
jsmntok_t *g = &t[i + j + 2];
size = snprintf(NULL, 0, "%.*s", g->end - g->start,
data + g->start);
stratum_data->result[j] = calloc(1, size + 1);
snprintf(stratum_data->result[j], size + 1, "%.*s",
g->end - g->start, data + g->start);
}
i += t[i + 1].size + 1;
}
} else if (jsoneq(data, &t[i], "method") == 0) {
size =
snprintf(NULL, 0, "%.*s", x->end - x->start, data + x->start);
tmp = calloc(1, size + 1);
snprintf(tmp, size + 1, "%.*s", x->end - x->start, data + x->start);
stratum_data->method = strdup(tmp);
} else if (jsoneq(data, &t[i], "error") == 0) {
if (x->type != JSMN_ARRAY)
continue; // We expected an array of strings.
for (int j = 0; j < x->size; j++) {
jsmntok_t *g = &t[i + j + 2];
size = snprintf(NULL, 0, "%.*s", g->end - g->start,
data + g->start);
stratum_data->error[j] = calloc(1, size + 1);
snprintf(stratum_data->error[j], size + 1, "%.*s",
g->end - g->start, data + g->start);
}
i += t[i + 1].size + 1;
} else if (jsoneq(data, &t[i], "params") == 0) {
if (x->type != JSMN_ARRAY)
continue; // We expected an array of strings.
for (int j = 0; j < x->size; j++) {
jsmntok_t *g = &t[i + j + 2];
size = snprintf(NULL, 0, "%.*s", g->end - g->start,
data + g->start);
stratum_data->params[j] = calloc(1, size + 1);
snprintf(stratum_data->params[j], size + 1, "%.*s",
g->end - g->start, data + g->start);
}
i += t[i + 1].size + 1;
} else {
if (x->type == JSMN_STRING) {
DEBUG_LOG("Did not match any in parsing switch, got `%.*s`",
x->end - x->start, data + x->start);
}
}
if (tmp != NULL) {
free(tmp);
i++;
}
}
return stratum_data;
}
void stratum_mining_subscribe(int socket, const char *user_agent,
const char *session_id, const char *host,
const char *port, stratum_cb_t cb) {
size_t size = snprintf(NULL, 0, "[\"%s\", \"%s\", \"%s\", %s]", user_agent,
session_id, host, port) +
1;
char *params = calloc(1, size);
snprintf(params, size, "[\"%s\", \"%s\", \"%s\", %s]", user_agent,
session_id, host, port);
stratum_data_t data = {
.id = 1,
.method = "mining.subscribe",
.params = params,
};
stratum_send_and_handle_data(socket, &data, cb);
}
void stratum_mining_authorize(int socket, const char *username,
const char *password, stratum_cb_t cb) {
size_t size = snprintf(NULL, 0, "[\"%s\", \"%s\"]", username, password);
char *params = calloc(1, size + 1);
snprintf(params, size + 1, "[\"%s\", \"%s\"]", username, password);
stratum_data_t data = {
.id = 2,
.method = "mining.authorize",
.params = params,
};
stratum_send_and_handle_data(socket, &data, cb);
}
void stratum_mining_submit(int socket, const char *worker, const char *job_id,
const char *time, const char *nonce_2,
char *solution, stratum_cb_t cb) {
size_t size = snprintf(NULL, 0, "[\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"]",
worker, job_id, time, nonce_2, solution);
char *params = calloc(1, size + 1);
snprintf(params, size + 1, "[\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"]",
worker, job_id, time, nonce_2, solution);
stratum_data_t data = {
.id = 2,
.method = "mining.submit",
.params = params,
};
stratum_send_and_handle_data(socket, &data, cb);
}
void stratum_send_and_handle_data(int socket, stratum_data_t *data,
stratum_cb_t cb) {
char *str = stratum_serialize_data(data);
char *buf = calloc(1, BUFSIZE);
socket_send(socket, str);
socket_read(socket, buf, BUFSIZE);
char *_str, *token;
_str = strdup(buf);
// Split by '\n'.
while ((token = strsep(&_str, "\n"))) {
if (!strlen(token))
continue;
DEBUG_LOG("Parsing %s", token);
stratum_response_t *res = stratum_parse_response(token);
DEBUG_LOG(
"Received: id %ld, method: %s, result: [%s, %s], errors: [%s, "
"%s, %s]",
res->id, res->method, res->result[0], res->result[1], res->error[0],
res->error[1], res->error[2]);
if (res->id == -1) {
// TODO(blaze): resend data?
err(EXIT_FAILURE,
"Failed to parse the response from the server.\n"
"Sent to the server: %s",
str);
} else if (res->id == 0) {
// Params have been given, print them to DEBUG.
DEBUG_LOG("params: [%s, %s, %s, %s, %s, %s, %s, %s]",
res->params[0], res->params[1], res->params[2],
res->params[3], res->params[4], res->params[5],
res->params[6], res->params[7]);
}
if (cb != NULL)
cb(res, socket);
for (int i = 0; i < 2; i++)
if (res->result[i] != NULL)
free(res->result[i]);
for (int i = 0; i < 8; i++)
free(res->params[i]);
free(res->error[0]);
free(res->error[1]);
free(res->error[2]);
free(res->method);
}
free(_str);
free(buf);
}
const char *stratum_error_code_to_string(uint8_t code) {
// https://zips.z.cash/zip-0301#error-objects
assert(code >= 20 && code <= 25);
switch (code) {
case 20:
return "Other/Unknown";
case 21:
return "Stale Job";
case 22:
return "Duplicate Share";
case 23:
return "Low Difficulty Share";
case 24:
return "Unauthorized Worker";
case 25:
return "Not Subscribed";
default:
DEBUG_LOG("Got code: %d which was not handled by `%s()`", code,
__func__);
return "UNKNOWN";
}
}
| 32.60596 | 80 | 0.472428 |
4046635eb7107151b111dcde00bb6254c6eb504b | 50 | py | Python | segnlp/layers/encoders/__init__.py | AxlAlm/SegNLP | 89b8d077952397dfcea089376b373b117bcf6a65 | [
"Apache-2.0"
] | 1 | 2021-01-21T17:16:55.000Z | 2021-01-21T17:16:55.000Z | segnlp/layers/encoders/__init__.py | AxlAlm/SegNLP | 89b8d077952397dfcea089376b373b117bcf6a65 | [
"Apache-2.0"
] | 2 | 2021-01-24T20:07:54.000Z | 2021-01-26T16:59:28.000Z | segnlp/layers/encoders/__init__.py | AxlAlm/SegNLP | 89b8d077952397dfcea089376b373b117bcf6a65 | [
"Apache-2.0"
] | 1 | 2021-01-21T17:16:57.000Z | 2021-01-21T17:16:57.000Z |
from .lstm import LSTM
from .linear import Linear | 16.666667 | 26 | 0.8 |
15d8cba8f31b5321999bc92644785d1d7fb66f1d | 4,030 | ps1 | PowerShell | scripts/install-deps.ps1 | christianparpart/libterminal | 0e6d75a2042437084c9f9880a5c8b5661a02da07 | [
"Apache-2.0"
] | 4 | 2019-08-14T22:29:57.000Z | 2019-09-19T08:57:15.000Z | scripts/install-deps.ps1 | christianparpart/libterminal | 0e6d75a2042437084c9f9880a5c8b5661a02da07 | [
"Apache-2.0"
] | 69 | 2019-08-17T18:57:16.000Z | 2019-09-22T23:25:49.000Z | scripts/install-deps.ps1 | christianparpart/libterminal | 0e6d75a2042437084c9f9880a5c8b5661a02da07 | [
"Apache-2.0"
] | null | null | null | #! /usr/bin/env pwsh
# Let's assume for now, that this script is only invoked from within Windows
# But in the future, I'd like it to support all the others, too.
class ThirdParty {
[ValidateNotNullOrEmpty()] [string] $Folder
[ValidateNotNullOrEmpty()] [string] $Archive
[ValidateNotNullOrEmpty()] [string] $URI
[string] $Macro
}
# Take care, order matters, at least as much as dependencies are of concern.
$ThirdParties =
@(
[ThirdParty]@{
Folder = "GSL-3.1.0";
Archive = "gsl-3.1.0.zip";
URI = "https://github.com/microsoft/GSL/archive/refs/tags/v3.1.0.zip";
Macro = ""
};
[ThirdParty]@{
Folder = "Catch2-2.13.7";
Archive = "Catch2-2.13.7.zip";
URI = "https://github.com/catchorg/Catch2/archive/refs/tags/v2.13.7.zip";
Macro = ""
};
[ThirdParty]@{
Folder = "libunicode-a511f3995cdf708f2e199276c90e21408db00a50";
Archive = "libunicode-a511f3995cdf708f2e199276c90e21408db00a50.zip";
URI = "https://github.com/contour-terminal/libunicode/archive/a511f3995cdf708f2e199276c90e21408db00a50.zip";
Macro = "libunicode"
};
[ThirdParty]@{
Folder = "termbench-pro-cd571e3cebb7c00de9168126b28852f32fb204ed";
Archive = "termbench-pro-cd571e3cebb7c00de9168126b28852f32fb204ed.zip";
URI = "https://github.com/contour-terminal/termbench-pro/archive/cd571e3cebb7c00de9168126b28852f32fb204ed.zip";
Macro = "termbench_pro"
}
)
function Fetch-And-Add {
param (
[Parameter(Mandatory)] [string] $Target,
[Parameter(Mandatory)] [string] $Folder,
[Parameter(Mandatory)] [string] $Archive,
[Parameter(Mandatory)] [string] $URI,
[string] $Macro,
[Parameter(Mandatory)] [string] $CMakeListsFile
)
$DistfilesDir = "${Target}/distfiles"
if (! [System.IO.Directory]::Exists($DistfilesDir)) {
New-Item -ItemType Directory -Force -Path $DistfilesDir
}
$ArchivePath = "${DistfilesDir}/${Archive}"
if (! [System.IO.File]::Exists($ArchivePath)) {
Write-Host "Downloading $Archive to $ArchivePath"
Invoke-WebRequest -Uri $URI -OutFile $ArchivePath
}
else {
Write-Host "Already there: $ArchivePath"
}
if (! [System.IO.Directory]::Exists("$Target/sources/$Folder")) {
Write-Host "Populating ${Folder}"
Expand-Archive $ArchivePath -DestinationPath "${Target}/sources/"
}
else {
Write-Host "Already there ${Folder}"
}
if ($Macro -ne "") {
Add-Content $CMakeListsFile "macro(ContourThirdParties_Embed_${Macro})"
Add-Content $CMakeListsFile " add_subdirectory(`${ContourThirdParties_SRCDIR}/${Folder} EXCLUDE_FROM_ALL)"
Add-Content $CMakeListsFile "endmacro()"
}
else {
Add-Content $CMakeListsFile "add_subdirectory(${Folder} EXCLUDE_FROM_ALL)"
}
}
$option = $args[0]
Write-Host "a) arg0: $option"
function Run {
$ProjectRoot = "${PSScriptRoot}/.."
$ThirsPartiesDir = "${ProjectRoot}/_deps"
$DistfilesDir = "${ThirsPartiesDir}/distfiles"
$SourcesDir = "${ThirsPartiesDir}/sources"
$CMakeListsFile = "${SourcesDir}/CMakeLists.txt"
if (! [System.IO.Directory]::Exists($DistfilesDir)) {
New-Item -ItemType Directory -Force -Path $DistfilesDir
}
if (! [System.IO.Directory]::Exists($SourcesDir)) {
New-Item -ItemType Directory -Force -Path $SourcesDir
}
if ([System.IO.File]::Exists($CMakeListsFile)) {
Clear-Content $CMakeListsFile
}
foreach ($TP in $ThirdParties) {
Fetch-And-Add `
-Folder $TP.Folder `
-Archive $TP.Archive `
-URI $TP.URI `
-Macro $TP.Macro `
-Target $ThirsPartiesDir `
-CMakeListsFile $CMakeListsFile
}
if ($option -ne "--skip-vcpkg") {
vcpkg install freetype fontconfig harfbuzz fmt range-v3 yaml-cpp --triplet x64-windows
# qt5-base
}
}
Run
| 32.764228 | 123 | 0.627543 |
0d6726227c538746c25ad96eb54d94797e30016a | 2,577 | swift | Swift | YEFlyGo/YEFlyGo/Order/Views/OrderDetailController.swift | muyang00/YEFlyGo | a2b2917ff4fc9656bb92ec5073f94ea2f3b41f62 | [
"Apache-2.0"
] | null | null | null | YEFlyGo/YEFlyGo/Order/Views/OrderDetailController.swift | muyang00/YEFlyGo | a2b2917ff4fc9656bb92ec5073f94ea2f3b41f62 | [
"Apache-2.0"
] | null | null | null | YEFlyGo/YEFlyGo/Order/Views/OrderDetailController.swift | muyang00/YEFlyGo | a2b2917ff4fc9656bb92ec5073f94ea2f3b41f62 | [
"Apache-2.0"
] | null | null | null | //
// OrderDetailController.swift
// FeiGou
//
// Created by paralworld-02 on 2016/11/2.
// Copyright © 2016年 like. All rights reserved.
//
import UIKit
class OrderCell: UITableViewCell {
@IBOutlet weak var img: UIImageView!
@IBOutlet weak var name: UILabel!
@IBOutlet weak var status: UILabel!
@IBOutlet weak var productNum: UILabel!
@IBOutlet weak var creatTime: UILabel!
@IBOutlet weak var numberOfProduct: UILabel!
@IBOutlet weak var price: UILabel!
}
class OrderDetailController: UITableViewController {
var status = Int() {
didSet {
FeiGouNetAPI.shareInstance.getOrderList(status: status) { (model) in
self.dataModel = model
self.tableView.reloadData()
}
}
}
var dataModel: OrderListModel!
override func viewDidLoad() {
super.viewDidLoad()
tableView.backgroundColor = UIColor.colorFromHex(0xededed)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
if dataModel != nil {
return (dataModel.orderList?.count)!
}
return 0
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "OrderCell") as! OrderCell
let model = self.dataModel.orderList![indexPath.row]
cell.img.kf.setImage(with: URL.init(string: model.picPath!))
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
print("didSelectRowAt")
}
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView()
view.backgroundColor = UIColor.colorFromHex(0xededed)
return view
}
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if section == 0 {
return 0.001
}
return 8
}
override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0.01
}
}
| 29.284091 | 109 | 0.650757 |
04fa45d4d5e89d6ec26f2aa9f752adada3bb85d7 | 1,847 | java | Java | smartsocket2/app/src/main/java/com/xieyingjie/smartsocket/adapters/RvAdapterLibirary/DeviceRecyclerAdapter.java | xyj222310/smarthome | da0fac17bb67441b3610673fb9efa8572c78d593 | [
"Apache-2.0"
] | null | null | null | smartsocket2/app/src/main/java/com/xieyingjie/smartsocket/adapters/RvAdapterLibirary/DeviceRecyclerAdapter.java | xyj222310/smarthome | da0fac17bb67441b3610673fb9efa8572c78d593 | [
"Apache-2.0"
] | null | null | null | smartsocket2/app/src/main/java/com/xieyingjie/smartsocket/adapters/RvAdapterLibirary/DeviceRecyclerAdapter.java | xyj222310/smarthome | da0fac17bb67441b3610673fb9efa8572c78d593 | [
"Apache-2.0"
] | null | null | null | package com.xieyingjie.smartsocket.adapters.RvAdapterLibirary;
import android.content.Context;
import com.xieyingjie.smartsocket.adapters.RvAdapterLibirary.MultiItemTypeAdapter;
import com.xieyingjie.smartsocket.moudel.DeviceInfo;
import java.util.List;
/**
* 添加多种类的自定义数据类型的item的适配器
*/
//public class DeviceRecyclerAdapter extends MultiItemTypeAdapter<DeviceInfo> {
// public DeviceRecyclerAdapter(Context context, List<DeviceInfo> datas) {
// super(context, datas);
// addItemViewDelegate(new DeviceItemDelegate());
// }
// /**
// *设备recycler的数据list
// */
// private ArrayList<DeviceInfo> mDataSet = new ArrayList<>();
//
// public static class ViewHolder extends RecyclerView.ViewHolder {
// public TextView mDeviceName; //
// public TextView mDeviceState;
// public ImageView mDeviceIcon;
// public SwitchCompat mSwitch;
// public ViewHolder(View v) {
// super(v);
// mDeviceName = (TextView) v.findViewById(R.id.device_name);
// mDeviceState = (TextView) v.findViewById(R.id.device_state);
// mDeviceIcon = (ImageView) v.findViewById(R.id.device_icon);
// mSwitch = (SwitchCompat) v.findViewById(R.id.fragment_demo_switch);
// }
// }
// public DeviceRecyclerAdapter(ArrayList<DeviceInfo> itemsData) {
// mDataSet.clear();
// mDataSet.addAll(itemsData);
// }
//
// @Override
// public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
// View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_item_device, parent, false);
// ViewHolder vh = new ViewHolder(v);
// return vh;
// }
// @Override
// public void onBindViewHolder(ViewHolder holder, int position) {
// holder.mDeviceName.setText(mDataSet.get(position).getName());
// holder.mDeviceState.setText(mDataSet.get(position).getState());
// }
// @Override
// public int getItemCount() {
// return mDataSet.size();
// }
//} | 32.403509 | 106 | 0.735788 |
5fad2d2189e25f71925ad1c50932191d63e0872e | 71,278 | c | C | vcf-mutators.c | auerlab/vcfio | 5f4a544c3677d67c65a656b940901efad4360705 | [
"BSD-2-Clause"
] | null | null | null | vcf-mutators.c | auerlab/vcfio | 5f4a544c3677d67c65a656b940901efad4360705 | [
"BSD-2-Clause"
] | 1 | 2020-02-05T17:06:35.000Z | 2020-02-05T21:45:09.000Z | vcf-mutators.c | auerlab/vcfio | 5f4a544c3677d67c65a656b940901efad4360705 | [
"BSD-2-Clause"
] | null | null | null | /***************************************************************************
* This file is automatically generated by gen-get-set. Be sure to keep
* track of any manual changes.
*
* These generated functions are not expected to be perfect. Check and
* edit as needed before adding to your code.
***************************************************************************/
#include <string.h>
#include <ctype.h>
#include <stdbool.h> // In case of bool
#include <stdint.h> // In case of int64_t, etc
#include <xtend/string.h> // strlcpy() on Linux
#include "vcf.h"
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for an array element of chrom member in a bl_vcf_t
* structure. Use this function to set bl_vcf_ptr->chrom[c]
* in a bl_vcf_t object from non-member functions.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* c Subscript to the chrom array
* new_chrom_element The new value for chrom[c]
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t c;
* char new_chrom_element;
*
* if ( bl_vcf_set_chrom_ae(&bl_vcf, c, new_chrom_element)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_CHROM_AE(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_chrom_ae(bl_vcf_t *bl_vcf_ptr, size_t c, char new_chrom_element)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->chrom[c] = new_chrom_element;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for chrom member in a bl_vcf_t structure.
* Use this function to set chrom in a bl_vcf_t object
* from non-member functions. This function copies the array pointed to
* by new_chrom to bl_vcf_ptr->chrom.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_chrom The new value for chrom
* array_size Size of the chrom array.
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* char new_chrom;
* size_t array_size;
*
* if ( bl_vcf_set_chrom_cpy(&bl_vcf, new_chrom, array_size)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_CHROM(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_chrom_cpy(bl_vcf_t *bl_vcf_ptr, char new_chrom[], size_t array_size)
{
if ( new_chrom == NULL )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
// FIXME: Assuming char array is a null-terminated string
strlcpy(bl_vcf_ptr->chrom, new_chrom, array_size);
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for an array element of id member in a bl_vcf_t
* structure. Use this function to set bl_vcf_ptr->id[c]
* in a bl_vcf_t object from non-member functions.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* c Subscript to the id array
* new_id_element The new value for id[c]
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t c;
* char new_id_element;
*
* if ( bl_vcf_set_id_ae(&bl_vcf, c, new_id_element)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_ID_AE(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_id_ae(bl_vcf_t *bl_vcf_ptr, size_t c, char new_id_element)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->id[c] = new_id_element;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for id member in a bl_vcf_t structure.
* Use this function to set id in a bl_vcf_t object
* from non-member functions. This function copies the array pointed to
* by new_id to bl_vcf_ptr->id.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_id The new value for id
* array_size Size of the id array.
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* char new_id;
* size_t array_size;
*
* if ( bl_vcf_set_id_cpy(&bl_vcf, new_id, array_size)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_ID(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_id_cpy(bl_vcf_t *bl_vcf_ptr, char new_id[], size_t array_size)
{
if ( new_id == NULL )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
// FIXME: Assuming char array is a null-terminated string
strlcpy(bl_vcf_ptr->id, new_id, array_size);
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for an array element of ref member in a bl_vcf_t
* structure. Use this function to set bl_vcf_ptr->ref[c]
* in a bl_vcf_t object from non-member functions.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* c Subscript to the ref array
* new_ref_element The new value for ref[c]
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t c;
* char new_ref_element;
*
* if ( bl_vcf_set_ref_ae(&bl_vcf, c, new_ref_element)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_REF_AE(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_ref_ae(bl_vcf_t *bl_vcf_ptr, size_t c, char new_ref_element)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->ref[c] = new_ref_element;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for ref member in a bl_vcf_t structure.
* Use this function to set ref in a bl_vcf_t object
* from non-member functions. This function copies the array pointed to
* by new_ref to bl_vcf_ptr->ref.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_ref The new value for ref
* array_size Size of the ref array.
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* char new_ref;
* size_t array_size;
*
* if ( bl_vcf_set_ref_cpy(&bl_vcf, new_ref, array_size)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_REF(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_ref_cpy(bl_vcf_t *bl_vcf_ptr, char new_ref[], size_t array_size)
{
if ( new_ref == NULL )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
// FIXME: Assuming char array is a null-terminated string
strlcpy(bl_vcf_ptr->ref, new_ref, array_size);
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for an array element of alt member in a bl_vcf_t
* structure. Use this function to set bl_vcf_ptr->alt[c]
* in a bl_vcf_t object from non-member functions.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* c Subscript to the alt array
* new_alt_element The new value for alt[c]
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t c;
* char new_alt_element;
*
* if ( bl_vcf_set_alt_ae(&bl_vcf, c, new_alt_element)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_ALT_AE(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_alt_ae(bl_vcf_t *bl_vcf_ptr, size_t c, char new_alt_element)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->alt[c] = new_alt_element;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for alt member in a bl_vcf_t structure.
* Use this function to set alt in a bl_vcf_t object
* from non-member functions. This function copies the array pointed to
* by new_alt to bl_vcf_ptr->alt.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_alt The new value for alt
* array_size Size of the alt array.
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* char new_alt;
* size_t array_size;
*
* if ( bl_vcf_set_alt_cpy(&bl_vcf, new_alt, array_size)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_ALT(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_alt_cpy(bl_vcf_t *bl_vcf_ptr, char new_alt[], size_t array_size)
{
if ( new_alt == NULL )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
// FIXME: Assuming char array is a null-terminated string
strlcpy(bl_vcf_ptr->alt, new_alt, array_size);
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for an array element of qual member in a bl_vcf_t
* structure. Use this function to set bl_vcf_ptr->qual[c]
* in a bl_vcf_t object from non-member functions.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* c Subscript to the qual array
* new_qual_element The new value for qual[c]
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t c;
* char new_qual_element;
*
* if ( bl_vcf_set_qual_ae(&bl_vcf, c, new_qual_element)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_QUAL_AE(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_qual_ae(bl_vcf_t *bl_vcf_ptr, size_t c, char new_qual_element)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->qual[c] = new_qual_element;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for qual member in a bl_vcf_t structure.
* Use this function to set qual in a bl_vcf_t object
* from non-member functions. This function copies the array pointed to
* by new_qual to bl_vcf_ptr->qual.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_qual The new value for qual
* array_size Size of the qual array.
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* char new_qual;
* size_t array_size;
*
* if ( bl_vcf_set_qual_cpy(&bl_vcf, new_qual, array_size)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_QUAL(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_qual_cpy(bl_vcf_t *bl_vcf_ptr, char new_qual[], size_t array_size)
{
if ( new_qual == NULL )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
// FIXME: Assuming char array is a null-terminated string
strlcpy(bl_vcf_ptr->qual, new_qual, array_size);
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for an array element of filter member in a bl_vcf_t
* structure. Use this function to set bl_vcf_ptr->filter[c]
* in a bl_vcf_t object from non-member functions.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* c Subscript to the filter array
* new_filter_element The new value for filter[c]
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t c;
* char new_filter_element;
*
* if ( bl_vcf_set_filter_ae(&bl_vcf, c, new_filter_element)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_FILTER_AE(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_filter_ae(bl_vcf_t *bl_vcf_ptr, size_t c, char new_filter_element)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->filter[c] = new_filter_element;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for filter member in a bl_vcf_t structure.
* Use this function to set filter in a bl_vcf_t object
* from non-member functions. This function copies the array pointed to
* by new_filter to bl_vcf_ptr->filter.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_filter The new value for filter
* array_size Size of the filter array.
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* char new_filter;
* size_t array_size;
*
* if ( bl_vcf_set_filter_cpy(&bl_vcf, new_filter, array_size)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_FILTER(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_filter_cpy(bl_vcf_t *bl_vcf_ptr, char new_filter[], size_t array_size)
{
if ( new_filter == NULL )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
// FIXME: Assuming char array is a null-terminated string
strlcpy(bl_vcf_ptr->filter, new_filter, array_size);
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for info member in a bl_vcf_t structure.
* Use this function to set info in a bl_vcf_t object
* from non-member functions. This function performs a direct
* assignment for scalar or pointer structure members. If
* info is a pointer, data previously pointed to should
* be freed before calling this function to avoid memory
* leaks.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_info The new value for info
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* char * new_info;
*
* if ( bl_vcf_set_info(&bl_vcf, new_info)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* (3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_info(bl_vcf_t *bl_vcf_ptr, char * new_info)
{
if ( new_info == NULL )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->info = new_info;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for an array element of info member in a bl_vcf_t
* structure. Use this function to set bl_vcf_ptr->info[c]
* in a bl_vcf_t object from non-member functions.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* c Subscript to the info array
* new_info_element The new value for info[c]
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t c;
* char * new_info_element;
*
* if ( bl_vcf_set_info_ae(&bl_vcf, c, new_info_element)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_INFO_AE(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_info_ae(bl_vcf_t *bl_vcf_ptr, size_t c, char new_info_element)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->info[c] = new_info_element;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for info member in a bl_vcf_t structure.
* Use this function to set info in a bl_vcf_t object
* from non-member functions. This function copies the array pointed to
* by new_info to bl_vcf_ptr->info.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_info The new value for info
* array_size Size of the info array.
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* char * new_info;
* size_t array_size;
*
* if ( bl_vcf_set_info_cpy(&bl_vcf, new_info, array_size)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_INFO(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_info_cpy(bl_vcf_t *bl_vcf_ptr, char * new_info, size_t array_size)
{
if ( new_info == NULL )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
// FIXME: Assuming char array is a null-terminated string
strlcpy(bl_vcf_ptr->info, new_info, array_size);
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for format member in a bl_vcf_t structure.
* Use this function to set format in a bl_vcf_t object
* from non-member functions. This function performs a direct
* assignment for scalar or pointer structure members. If
* format is a pointer, data previously pointed to should
* be freed before calling this function to avoid memory
* leaks.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_format The new value for format
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* char * new_format;
*
* if ( bl_vcf_set_format(&bl_vcf, new_format)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* (3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_format(bl_vcf_t *bl_vcf_ptr, char * new_format)
{
if ( new_format == NULL )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->format = new_format;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for an array element of format member in a bl_vcf_t
* structure. Use this function to set bl_vcf_ptr->format[c]
* in a bl_vcf_t object from non-member functions.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* c Subscript to the format array
* new_format_element The new value for format[c]
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t c;
* char * new_format_element;
*
* if ( bl_vcf_set_format_ae(&bl_vcf, c, new_format_element)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_FORMAT_AE(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_format_ae(bl_vcf_t *bl_vcf_ptr, size_t c, char new_format_element)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->format[c] = new_format_element;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for format member in a bl_vcf_t structure.
* Use this function to set format in a bl_vcf_t object
* from non-member functions. This function copies the array pointed to
* by new_format to bl_vcf_ptr->format.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_format The new value for format
* array_size Size of the format array.
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* char * new_format;
* size_t array_size;
*
* if ( bl_vcf_set_format_cpy(&bl_vcf, new_format, array_size)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_FORMAT(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_format_cpy(bl_vcf_t *bl_vcf_ptr, char * new_format, size_t array_size)
{
if ( new_format == NULL )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
// FIXME: Assuming char array is a null-terminated string
strlcpy(bl_vcf_ptr->format, new_format, array_size);
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for single_sample member in a bl_vcf_t structure.
* Use this function to set single_sample in a bl_vcf_t object
* from non-member functions. This function performs a direct
* assignment for scalar or pointer structure members. If
* single_sample is a pointer, data previously pointed to should
* be freed before calling this function to avoid memory
* leaks.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_single_sample The new value for single_sample
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* char * new_single_sample;
*
* if ( bl_vcf_set_single_sample(&bl_vcf, new_single_sample)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* (3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_single_sample(bl_vcf_t *bl_vcf_ptr, char * new_single_sample)
{
if ( new_single_sample == NULL )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->single_sample = new_single_sample;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for an array element of single_sample member in a bl_vcf_t
* structure. Use this function to set bl_vcf_ptr->single_sample[c]
* in a bl_vcf_t object from non-member functions.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* c Subscript to the single_sample array
* new_single_sample_element The new value for single_sample[c]
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t c;
* char * new_single_sample_element;
*
* if ( bl_vcf_set_single_sample_ae(&bl_vcf, c, new_single_sample_element)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_SINGLE_SAMPLE_AE(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_single_sample_ae(bl_vcf_t *bl_vcf_ptr, size_t c, char new_single_sample_element)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->single_sample[c] = new_single_sample_element;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for single_sample member in a bl_vcf_t structure.
* Use this function to set single_sample in a bl_vcf_t object
* from non-member functions. This function copies the array pointed to
* by new_single_sample to bl_vcf_ptr->single_sample.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_single_sample The new value for single_sample
* array_size Size of the single_sample array.
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* char * new_single_sample;
* size_t array_size;
*
* if ( bl_vcf_set_single_sample_cpy(&bl_vcf, new_single_sample, array_size)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_SINGLE_SAMPLE(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_single_sample_cpy(bl_vcf_t *bl_vcf_ptr, char * new_single_sample, size_t array_size)
{
if ( new_single_sample == NULL )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
// FIXME: Assuming char array is a null-terminated string
strlcpy(bl_vcf_ptr->single_sample, new_single_sample, array_size);
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for multi_samples member in a bl_vcf_t structure.
* Use this function to set multi_samples in a bl_vcf_t object
* from non-member functions. This function performs a direct
* assignment for scalar or pointer structure members. If
* multi_samples is a pointer, data previously pointed to should
* be freed before calling this function to avoid memory
* leaks.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_multi_samples The new value for multi_samples
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* char ** new_multi_samples;
*
* if ( bl_vcf_set_multi_samples(&bl_vcf, new_multi_samples)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* (3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_multi_samples(bl_vcf_t *bl_vcf_ptr, char ** new_multi_samples)
{
if ( new_multi_samples == NULL )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->multi_samples = new_multi_samples;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for an array element of multi_samples member in a bl_vcf_t
* structure. Use this function to set bl_vcf_ptr->multi_samples[c]
* in a bl_vcf_t object from non-member functions.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* c Subscript to the multi_samples array
* new_multi_samples_element The new value for multi_samples[c]
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t c;
* char ** new_multi_samples_element;
*
* if ( bl_vcf_set_multi_samples_ae(&bl_vcf, c, new_multi_samples_element)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_MULTI_SAMPLES_AE(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_multi_samples_ae(bl_vcf_t *bl_vcf_ptr, size_t c, char * new_multi_samples_element)
{
if ( new_multi_samples_element == NULL )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->multi_samples[c] = new_multi_samples_element;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for multi_samples member in a bl_vcf_t structure.
* Use this function to set multi_samples in a bl_vcf_t object
* from non-member functions. This function copies the array pointed to
* by new_multi_samples to bl_vcf_ptr->multi_samples.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_multi_samples The new value for multi_samples
* array_size Size of the multi_samples array.
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* char ** new_multi_samples;
* size_t array_size;
*
* if ( bl_vcf_set_multi_samples_cpy(&bl_vcf, new_multi_samples, array_size)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_MULTI_SAMPLES(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_multi_samples_cpy(bl_vcf_t *bl_vcf_ptr, char ** new_multi_samples, size_t array_size)
{
if ( new_multi_samples == NULL )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
size_t c;
// FIXME: Assuming all elements should be copied
for (c = 0; c < array_size; ++c)
bl_vcf_ptr->multi_samples[c] = new_multi_samples[c];
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for pos member in a bl_vcf_t structure.
* Use this function to set pos in a bl_vcf_t object
* from non-member functions. This function performs a direct
* assignment for scalar or pointer structure members. If
* pos is a pointer, data previously pointed to should
* be freed before calling this function to avoid memory
* leaks.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_pos The new value for pos
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* int64_t new_pos;
*
* if ( bl_vcf_set_pos(&bl_vcf, new_pos)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* (3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_pos(bl_vcf_t *bl_vcf_ptr, int64_t new_pos)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->pos = new_pos;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for info_array_size member in a bl_vcf_t structure.
* Use this function to set info_array_size in a bl_vcf_t object
* from non-member functions. This function performs a direct
* assignment for scalar or pointer structure members. If
* info_array_size is a pointer, data previously pointed to should
* be freed before calling this function to avoid memory
* leaks.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_info_array_size The new value for info_array_size
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t new_info_array_size;
*
* if ( bl_vcf_set_info_array_size(&bl_vcf, new_info_array_size)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* (3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_info_array_size(bl_vcf_t *bl_vcf_ptr, size_t new_info_array_size)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->info_array_size = new_info_array_size;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for info_len member in a bl_vcf_t structure.
* Use this function to set info_len in a bl_vcf_t object
* from non-member functions. This function performs a direct
* assignment for scalar or pointer structure members. If
* info_len is a pointer, data previously pointed to should
* be freed before calling this function to avoid memory
* leaks.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_info_len The new value for info_len
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t new_info_len;
*
* if ( bl_vcf_set_info_len(&bl_vcf, new_info_len)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* (3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_info_len(bl_vcf_t *bl_vcf_ptr, size_t new_info_len)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->info_len = new_info_len;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for format_array_size member in a bl_vcf_t structure.
* Use this function to set format_array_size in a bl_vcf_t object
* from non-member functions. This function performs a direct
* assignment for scalar or pointer structure members. If
* format_array_size is a pointer, data previously pointed to should
* be freed before calling this function to avoid memory
* leaks.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_format_array_size The new value for format_array_size
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t new_format_array_size;
*
* if ( bl_vcf_set_format_array_size(&bl_vcf, new_format_array_size)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* (3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_format_array_size(bl_vcf_t *bl_vcf_ptr, size_t new_format_array_size)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->format_array_size = new_format_array_size;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for format_len member in a bl_vcf_t structure.
* Use this function to set format_len in a bl_vcf_t object
* from non-member functions. This function performs a direct
* assignment for scalar or pointer structure members. If
* format_len is a pointer, data previously pointed to should
* be freed before calling this function to avoid memory
* leaks.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_format_len The new value for format_len
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t new_format_len;
*
* if ( bl_vcf_set_format_len(&bl_vcf, new_format_len)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* (3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_format_len(bl_vcf_t *bl_vcf_ptr, size_t new_format_len)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->format_len = new_format_len;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for single_sample_array_size member in a bl_vcf_t structure.
* Use this function to set single_sample_array_size in a bl_vcf_t object
* from non-member functions. This function performs a direct
* assignment for scalar or pointer structure members. If
* single_sample_array_size is a pointer, data previously pointed to should
* be freed before calling this function to avoid memory
* leaks.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_single_sample_array_size The new value for single_sample_array_size
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t new_single_sample_array_size;
*
* if ( bl_vcf_set_single_sample_array_size(&bl_vcf, new_single_sample_array_size)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* (3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_single_sample_array_size(bl_vcf_t *bl_vcf_ptr, size_t new_single_sample_array_size)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->single_sample_array_size = new_single_sample_array_size;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for single_sample_len member in a bl_vcf_t structure.
* Use this function to set single_sample_len in a bl_vcf_t object
* from non-member functions. This function performs a direct
* assignment for scalar or pointer structure members. If
* single_sample_len is a pointer, data previously pointed to should
* be freed before calling this function to avoid memory
* leaks.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_single_sample_len The new value for single_sample_len
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t new_single_sample_len;
*
* if ( bl_vcf_set_single_sample_len(&bl_vcf, new_single_sample_len)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* (3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_single_sample_len(bl_vcf_t *bl_vcf_ptr, size_t new_single_sample_len)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->single_sample_len = new_single_sample_len;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for multi_sample_pointer_array_size member in a bl_vcf_t structure.
* Use this function to set multi_sample_pointer_array_size in a bl_vcf_t object
* from non-member functions. This function performs a direct
* assignment for scalar or pointer structure members. If
* multi_sample_pointer_array_size is a pointer, data previously pointed to should
* be freed before calling this function to avoid memory
* leaks.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_multi_sample_pointer_array_size The new value for multi_sample_pointer_array_size
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t new_multi_sample_pointer_array_size;
*
* if ( bl_vcf_set_multi_sample_pointer_array_size(&bl_vcf, new_multi_sample_pointer_array_size)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* (3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_multi_sample_pointer_array_size(bl_vcf_t *bl_vcf_ptr, size_t new_multi_sample_pointer_array_size)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->multi_sample_pointer_array_size = new_multi_sample_pointer_array_size;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for multi_sample_count member in a bl_vcf_t structure.
* Use this function to set multi_sample_count in a bl_vcf_t object
* from non-member functions. This function performs a direct
* assignment for scalar or pointer structure members. If
* multi_sample_count is a pointer, data previously pointed to should
* be freed before calling this function to avoid memory
* leaks.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_multi_sample_count The new value for multi_sample_count
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t new_multi_sample_count;
*
* if ( bl_vcf_set_multi_sample_count(&bl_vcf, new_multi_sample_count)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* (3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_multi_sample_count(bl_vcf_t *bl_vcf_ptr, size_t new_multi_sample_count)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->multi_sample_count = new_multi_sample_count;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for multi_sample_array_sizes member in a bl_vcf_t structure.
* Use this function to set multi_sample_array_sizes in a bl_vcf_t object
* from non-member functions. This function performs a direct
* assignment for scalar or pointer structure members. If
* multi_sample_array_sizes is a pointer, data previously pointed to should
* be freed before calling this function to avoid memory
* leaks.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_multi_sample_array_sizes The new value for multi_sample_array_sizes
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t * new_multi_sample_array_sizes;
*
* if ( bl_vcf_set_multi_sample_array_sizes(&bl_vcf, new_multi_sample_array_sizes)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* (3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_multi_sample_array_sizes(bl_vcf_t *bl_vcf_ptr, size_t * new_multi_sample_array_sizes)
{
if ( new_multi_sample_array_sizes == NULL )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->multi_sample_array_sizes = new_multi_sample_array_sizes;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for an array element of multi_sample_array_sizes member in a bl_vcf_t
* structure. Use this function to set bl_vcf_ptr->multi_sample_array_sizes[c]
* in a bl_vcf_t object from non-member functions.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* c Subscript to the multi_sample_array_sizes array
* new_multi_sample_array_sizes_element The new value for multi_sample_array_sizes[c]
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t c;
* size_t * new_multi_sample_array_sizes_element;
*
* if ( bl_vcf_set_multi_sample_array_sizes_ae(&bl_vcf, c, new_multi_sample_array_sizes_element)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_MULTI_SAMPLE_ARRAY_SIZES_AE(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_multi_sample_array_sizes_ae(bl_vcf_t *bl_vcf_ptr, size_t c, size_t new_multi_sample_array_sizes_element)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->multi_sample_array_sizes[c] = new_multi_sample_array_sizes_element;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for multi_sample_array_sizes member in a bl_vcf_t structure.
* Use this function to set multi_sample_array_sizes in a bl_vcf_t object
* from non-member functions. This function copies the array pointed to
* by new_multi_sample_array_sizes to bl_vcf_ptr->multi_sample_array_sizes.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_multi_sample_array_sizes The new value for multi_sample_array_sizes
* array_size Size of the multi_sample_array_sizes array.
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t * new_multi_sample_array_sizes;
* size_t array_size;
*
* if ( bl_vcf_set_multi_sample_array_sizes_cpy(&bl_vcf, new_multi_sample_array_sizes, array_size)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_MULTI_SAMPLE_ARRAY_SIZES(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_multi_sample_array_sizes_cpy(bl_vcf_t *bl_vcf_ptr, size_t * new_multi_sample_array_sizes, size_t array_size)
{
if ( new_multi_sample_array_sizes == NULL )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
size_t c;
// FIXME: Assuming all elements should be copied
for (c = 0; c < array_size; ++c)
bl_vcf_ptr->multi_sample_array_sizes[c] = new_multi_sample_array_sizes[c];
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for multi_sample_lens member in a bl_vcf_t structure.
* Use this function to set multi_sample_lens in a bl_vcf_t object
* from non-member functions. This function performs a direct
* assignment for scalar or pointer structure members. If
* multi_sample_lens is a pointer, data previously pointed to should
* be freed before calling this function to avoid memory
* leaks.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_multi_sample_lens The new value for multi_sample_lens
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t * new_multi_sample_lens;
*
* if ( bl_vcf_set_multi_sample_lens(&bl_vcf, new_multi_sample_lens)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* (3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_multi_sample_lens(bl_vcf_t *bl_vcf_ptr, size_t * new_multi_sample_lens)
{
if ( new_multi_sample_lens == NULL )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->multi_sample_lens = new_multi_sample_lens;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for an array element of multi_sample_lens member in a bl_vcf_t
* structure. Use this function to set bl_vcf_ptr->multi_sample_lens[c]
* in a bl_vcf_t object from non-member functions.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* c Subscript to the multi_sample_lens array
* new_multi_sample_lens_element The new value for multi_sample_lens[c]
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t c;
* size_t * new_multi_sample_lens_element;
*
* if ( bl_vcf_set_multi_sample_lens_ae(&bl_vcf, c, new_multi_sample_lens_element)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_MULTI_SAMPLE_LENS_AE(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_multi_sample_lens_ae(bl_vcf_t *bl_vcf_ptr, size_t c, size_t new_multi_sample_lens_element)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->multi_sample_lens[c] = new_multi_sample_lens_element;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for multi_sample_lens member in a bl_vcf_t structure.
* Use this function to set multi_sample_lens in a bl_vcf_t object
* from non-member functions. This function copies the array pointed to
* by new_multi_sample_lens to bl_vcf_ptr->multi_sample_lens.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_multi_sample_lens The new value for multi_sample_lens
* array_size Size of the multi_sample_lens array.
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t * new_multi_sample_lens;
* size_t array_size;
*
* if ( bl_vcf_set_multi_sample_lens_cpy(&bl_vcf, new_multi_sample_lens, array_size)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_MULTI_SAMPLE_LENS(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_multi_sample_lens_cpy(bl_vcf_t *bl_vcf_ptr, size_t * new_multi_sample_lens, size_t array_size)
{
if ( new_multi_sample_lens == NULL )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
size_t c;
// FIXME: Assuming all elements should be copied
for (c = 0; c < array_size; ++c)
bl_vcf_ptr->multi_sample_lens[c] = new_multi_sample_lens[c];
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for ref_count member in a bl_vcf_t structure.
* Use this function to set ref_count in a bl_vcf_t object
* from non-member functions. This function performs a direct
* assignment for scalar or pointer structure members. If
* ref_count is a pointer, data previously pointed to should
* be freed before calling this function to avoid memory
* leaks.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_ref_count The new value for ref_count
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* unsigned new_ref_count;
*
* if ( bl_vcf_set_ref_count(&bl_vcf, new_ref_count)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* (3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_ref_count(bl_vcf_t *bl_vcf_ptr, unsigned new_ref_count)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->ref_count = new_ref_count;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for alt_count member in a bl_vcf_t structure.
* Use this function to set alt_count in a bl_vcf_t object
* from non-member functions. This function performs a direct
* assignment for scalar or pointer structure members. If
* alt_count is a pointer, data previously pointed to should
* be freed before calling this function to avoid memory
* leaks.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_alt_count The new value for alt_count
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* unsigned new_alt_count;
*
* if ( bl_vcf_set_alt_count(&bl_vcf, new_alt_count)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* (3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_alt_count(bl_vcf_t *bl_vcf_ptr, unsigned new_alt_count)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->alt_count = new_alt_count;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for other_count member in a bl_vcf_t structure.
* Use this function to set other_count in a bl_vcf_t object
* from non-member functions. This function performs a direct
* assignment for scalar or pointer structure members. If
* other_count is a pointer, data previously pointed to should
* be freed before calling this function to avoid memory
* leaks.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_other_count The new value for other_count
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* unsigned new_other_count;
*
* if ( bl_vcf_set_other_count(&bl_vcf, new_other_count)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* (3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_other_count(bl_vcf_t *bl_vcf_ptr, unsigned new_other_count)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->other_count = new_other_count;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for phreds member in a bl_vcf_t structure.
* Use this function to set phreds in a bl_vcf_t object
* from non-member functions. This function performs a direct
* assignment for scalar or pointer structure members. If
* phreds is a pointer, data previously pointed to should
* be freed before calling this function to avoid memory
* leaks.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_phreds The new value for phreds
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* unsigned char * new_phreds;
*
* if ( bl_vcf_set_phreds(&bl_vcf, new_phreds)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* (3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_phreds(bl_vcf_t *bl_vcf_ptr, unsigned char * new_phreds)
{
if ( new_phreds == NULL )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->phreds = new_phreds;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for an array element of phreds member in a bl_vcf_t
* structure. Use this function to set bl_vcf_ptr->phreds[c]
* in a bl_vcf_t object from non-member functions.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* c Subscript to the phreds array
* new_phreds_element The new value for phreds[c]
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t c;
* unsigned char * new_phreds_element;
*
* if ( bl_vcf_set_phreds_ae(&bl_vcf, c, new_phreds_element)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_PHREDS_AE(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_phreds_ae(bl_vcf_t *bl_vcf_ptr, size_t c, unsigned char new_phreds_element)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->phreds[c] = new_phreds_element;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for phreds member in a bl_vcf_t structure.
* Use this function to set phreds in a bl_vcf_t object
* from non-member functions. This function copies the array pointed to
* by new_phreds to bl_vcf_ptr->phreds.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_phreds The new value for phreds
* array_size Size of the phreds array.
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* unsigned char * new_phreds;
* size_t array_size;
*
* if ( bl_vcf_set_phreds_cpy(&bl_vcf, new_phreds, array_size)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* BL_VCF_SET_PHREDS(3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_phreds_cpy(bl_vcf_t *bl_vcf_ptr, unsigned char * new_phreds, size_t array_size)
{
if ( new_phreds == NULL )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
size_t c;
// FIXME: Assuming all elements should be copied
for (c = 0; c < array_size; ++c)
bl_vcf_ptr->phreds[c] = new_phreds[c];
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for phred_count member in a bl_vcf_t structure.
* Use this function to set phred_count in a bl_vcf_t object
* from non-member functions. This function performs a direct
* assignment for scalar or pointer structure members. If
* phred_count is a pointer, data previously pointed to should
* be freed before calling this function to avoid memory
* leaks.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_phred_count The new value for phred_count
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t new_phred_count;
*
* if ( bl_vcf_set_phred_count(&bl_vcf, new_phred_count)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* (3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_phred_count(bl_vcf_t *bl_vcf_ptr, size_t new_phred_count)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->phred_count = new_phred_count;
return BL_VCF_DATA_OK;
}
}
/***************************************************************************
* Library:
* #include <biolibc/vcf.h>
* -lbiolibc -lxtend
*
* Description:
* Mutator for phred_buff_size member in a bl_vcf_t structure.
* Use this function to set phred_buff_size in a bl_vcf_t object
* from non-member functions. This function performs a direct
* assignment for scalar or pointer structure members. If
* phred_buff_size is a pointer, data previously pointed to should
* be freed before calling this function to avoid memory
* leaks.
*
* Arguments:
* bl_vcf_ptr Pointer to the structure to set
* new_phred_buff_size The new value for phred_buff_size
*
* Returns:
* BL_VCF_DATA_OK if the new value is acceptable and assigned
* BL_VCF_DATA_OUT_OF_RANGE otherwise
*
* Examples:
* bl_vcf_t bl_vcf;
* size_t new_phred_buff_size;
*
* if ( bl_vcf_set_phred_buff_size(&bl_vcf, new_phred_buff_size)
* == BL_VCF_DATA_OK )
* {
* }
*
* See also:
* (3)
*
* History:
* Date Name Modification
* 2022-04-24 gen-get-set Auto-generated from vcf.h
***************************************************************************/
int bl_vcf_set_phred_buff_size(bl_vcf_t *bl_vcf_ptr, size_t new_phred_buff_size)
{
if ( false )
return BL_VCF_DATA_OUT_OF_RANGE;
else
{
bl_vcf_ptr->phred_buff_size = new_phred_buff_size;
return BL_VCF_DATA_OK;
}
}
| 29.152556 | 127 | 0.570527 |
754f390b543e53d6f04c6b60505ea93a9e5520a8 | 238 | h | C | openmmapi/include/PyCall.h | chemalot/openmm-py | 256dd76f6dc06ef0b99a11b8dca77588b1d9459e | [
"MIT",
"Unlicense"
] | 1 | 2019-01-25T16:32:19.000Z | 2019-01-25T16:32:19.000Z | openmmapi/include/PyCall.h | chemalot/openmm-py | 256dd76f6dc06ef0b99a11b8dca77588b1d9459e | [
"MIT",
"Unlicense"
] | 1 | 2019-01-18T23:52:51.000Z | 2019-01-18T23:52:51.000Z | openmmapi/include/PyCall.h | chemalot/openmm-py | 256dd76f6dc06ef0b99a11b8dca77588b1d9459e | [
"MIT",
"Unlicense"
] | null | null | null | #ifndef CALLPY_H
#define CALLPY_H
#include <vector>
using namespace std;
class PyCall {
public:
virtual ~PyCall() {};
virtual float computeEnergyAndForces(vector<float> positions, bool includeForces, bool includeEnergy) = 0;
};
| 17 | 109 | 0.743697 |
08df6602a440eb9976b0dd7aeb99cf4a954257d8 | 34 | sql | SQL | src/FirebirdDbComparer.Tests/Compare/ComparerTestsData/Changing/ExceptionMessage_00.Source.sql | cincuranet/FirebirdDbComparer | d12c6c7fda24e6ff290984d00e80a5fb187d1ef1 | [
"MIT"
] | 17 | 2018-07-09T08:32:29.000Z | 2022-02-10T06:50:52.000Z | src/FirebirdDbComparer.Tests/Compare/ComparerTestsData/Changing/ExceptionMessage_00.Source.sql | cincuranet/FirebirdDbComparer | d12c6c7fda24e6ff290984d00e80a5fb187d1ef1 | [
"MIT"
] | 27 | 2019-01-08T14:20:57.000Z | 2022-02-21T10:02:16.000Z | src/FirebirdDbComparer.Tests/Compare/ComparerTestsData/Changing/ExceptionMessage_00.Source.sql | cincuranet/FirebirdDbComparer | d12c6c7fda24e6ff290984d00e80a5fb187d1ef1 | [
"MIT"
] | 4 | 2019-01-09T22:40:44.000Z | 2019-10-19T17:51:45.000Z | create exception e 'new message'; | 34 | 34 | 0.764706 |
c262838baf295167e0f0b9a3686bb4074357c128 | 5,772 | go | Go | controllers/wallet.go | Toflex/Wallet-API | 8ee22618a1a2b28fd075280347b85302a1ece240 | [
"Apache-2.0"
] | null | null | null | controllers/wallet.go | Toflex/Wallet-API | 8ee22618a1a2b28fd075280347b85302a1ece240 | [
"Apache-2.0"
] | null | null | null | controllers/wallet.go | Toflex/Wallet-API | 8ee22618a1a2b28fd075280347b85302a1ece240 | [
"Apache-2.0"
] | null | null | null | package controllers
import (
"fmt"
"github.com/Toflex/Wallet-API/dto"
"github.com/Toflex/Wallet-API/services"
"github.com/Toflex/Wallet-API/utility"
"github.com/gin-gonic/gin"
"github.com/shopspring/decimal"
log "github.com/sirupsen/logrus"
"net/http"
"strconv"
)
// GetWalletBalance get wallet balance
// @Summary Get wallet balance
// @Description Get wallet balance
// @Tags Wallet
// @Param wallet_id path string false "Wallet ID"
// @Produce json
// @Success 200
// @Router /api/v1/wallets/{wallet_id}/balance [GET]
func (c *NewController) GetWalletBalance(ct *gin.Context) {
apiResponse:=utility.NewResponse()
response:= dto.BalanceResponse{}
id := ct.Param("wallet_id")
walletId, err := strconv.Atoi(id)
if err != nil {
log.Errorf("Wallet ID is meant to be a valid integer value. %s, %s", id, err.Error())
ct.JSON(http.StatusBadRequest, apiResponse.Error("Incorrect wallet ID"))
return
}
// Fetch Wallet information from cache
cache, err := c.Repo.GetWalletInformationFromCache(id)
if err != nil {
log.Error("Wallet balance does not exist in cache")
// Get credit wallet info
wallet, walletErr := c.Repo.GetWalletInformation(walletId)
if walletErr != nil {
log.Errorf("Error getting wallet details. %s", walletErr.Message)
ct.JSON(walletErr.Code, apiResponse.Error(walletErr.Message))
return
}
response.Balance = wallet.Balance
ct.JSON(http.StatusOK, response)
return
}
response.Balance = cache
ct.JSON(http.StatusOK, response)
}
// CreditWalletAccount Credit wallet account
// @Summary Credit wallet account
// @Description Credit wallet account
// @Tags Wallet
// @Accept json
// @Produce json
// @Param wallet_id path string false "Wallet ID"
// @Param default body dto.WalletRequest true "Login to account"
// @Success 200 {object} utility.Response
// @Failure 401
// @Router /api/v1/wallets/{wallet_id}/credit [POST]
func (c *NewController) CreditWalletAccount(ct *gin.Context) {
apiResponse:=utility.NewResponse()
walletID := ct.Param("wallet_id")
creditWalletID, err := strconv.Atoi(walletID)
if err != nil {
log.Errorf("Wallet ID is meant to be a valid integer value. %s, %s", walletID, err.Error())
ct.JSON(http.StatusBadRequest, apiResponse.Error("Incorrect wallet ID"))
return
}
requestData:=&dto.WalletRequest{}
if err := ct.ShouldBindJSON(requestData); err != nil {
log.Errorf("Request could not be decoded. %s", err.Error())
ct.JSON(http.StatusBadRequest, apiResponse.ValidationError("Invalid request", err.Error()))
return
}
amount:= decimal.NewFromFloat(requestData.Amount)
// Amount is not less than 0
if services.AmountNotNegative(amount) == false {
log.Errorf("Credit amount is less than 0. %f", requestData.Amount)
ct.JSON(http.StatusNotAcceptable, apiResponse.Error("Amount cannot be negative"))
return
}
// Get credit wallet info
creditWallet, walletErr := c.Repo.GetWalletInformation(creditWalletID)
if walletErr != nil {
log.Errorf("Error getting wallet details. %s", walletErr.Message)
ct.JSON(walletErr.Code, apiResponse.Error(walletErr.Message))
return
}
// Credit wallet
err = c.Repo.CreditWalletBalance(creditWallet, amount)
if err != nil {
log.Errorf("Wallet could not be credited %s", err.Error())
ct.JSON(http.StatusFailedDependency, apiResponse.Error("Wallet could not be credited at the moment, please try again!"))
return
}
ct.JSON(http.StatusOK, apiResponse.PlainSuccess(fmt.Sprintf("Wallet %s has been credited", walletID)))
}
// DebitWalletAccount Debit wallet account
// @Summary Debit wallet account
// @Description Debit wallet account
// @Tags Wallet
// @Accept json
// @Produce json
// @Param wallet_id path string false "Wallet ID"
// @Param default body dto.WalletRequest true "Request param"
// @Success 200 {object} utility.Response
// @Failure 401
// @Router /api/v1/wallets/{wallet_id}/debit [POST]
func (c *NewController) DebitWalletAccount(ct *gin.Context) {
apiResponse:=utility.NewResponse()
walletID := ct.Param("wallet_id")
debitWalletID, err := strconv.Atoi(walletID)
if err != nil {
log.Errorf("Wallet ID is meant to be a valid integer value. %s, %s", walletID, err.Error())
ct.JSON(http.StatusBadRequest, apiResponse.Error("Incorrect wallet ID"))
return
}
requestData:=&dto.WalletRequest{}
if err := ct.ShouldBindJSON(requestData); err != nil {
log.Errorf("Request could not be decoded. %s", err.Error())
ct.JSON(http.StatusBadRequest, apiResponse.ValidationError("Invalid request", err.Error()))
return
}
amount := decimal.NewFromFloat(requestData.Amount)
// Amount is not less than 0
if services.AmountNotNegative(amount) == false {
log.Errorf("Debit amount is less than 0. %.2f", requestData.Amount)
ct.JSON(http.StatusNotAcceptable, apiResponse.Error("Amount cannot be negative"))
return
}
// Get debit wallet info
debitWallet, walletErr := c.Repo.GetWalletInformation(debitWalletID)
if walletErr != nil {
log.Errorf("Error getting wallet details. %s", walletErr.Message)
ct.JSON(walletErr.Code, apiResponse.Error(walletErr.Message))
return
}
// Does debit wallet have enough credit
if services.CanDebitWallet(debitWallet.Balance, amount) == false {
log.Errorf("Insufficient balance, balance cannot be less than zero (0).")
ct.JSON(http.StatusNotAcceptable, apiResponse.Error("Insufficient balance"))
return
}
// Debit wallet
err = c.Repo.DebitWalletBalance(debitWallet, amount)
if err != nil {
log.Errorf("An error occured when debiting wallet. %s", err.Error())
ct.JSON(http.StatusFailedDependency, apiResponse.Error("Wallet could not be debited at the moment, please try again!"))
return
}
ct.JSON(http.StatusOK, apiResponse.PlainSuccess(fmt.Sprintf("Wallet %s has been debited", walletID)))
} | 32.610169 | 122 | 0.730596 |
70d700ae7308ec3148570f7777135ac4001a5269 | 252 | h | C | Pods/ChatSDK/ChatSDKExtras/Reachability/Classes/BReachabilityModule.h | brunomartinezciompi/chatsdk-iOS | 80014858656dbc8d74abc2051053ba0b1d69219a | [
"MIT"
] | null | null | null | Pods/ChatSDK/ChatSDKExtras/Reachability/Classes/BReachabilityModule.h | brunomartinezciompi/chatsdk-iOS | 80014858656dbc8d74abc2051053ba0b1d69219a | [
"MIT"
] | null | null | null | Pods/ChatSDK/ChatSDKExtras/Reachability/Classes/BReachabilityModule.h | brunomartinezciompi/chatsdk-iOS | 80014858656dbc8d74abc2051053ba0b1d69219a | [
"MIT"
] | null | null | null | //
// ReachabilityModule.h
// AFNetworking
//
// Created by Ben on 10/10/18.
//
#import <Foundation/Foundation.h>
#import <ChatSDK/PModule.h>
NS_ASSUME_NONNULL_BEGIN
@interface BReachabilityModule : NSObject<PModule>
@end
NS_ASSUME_NONNULL_END
| 14 | 50 | 0.75 |
964172c919f47b4dadbe8e471ebf4508f8f03c43 | 1,293 | php | PHP | database/seeds/PurchaseRequestSeeder.php | CavlinTsang/ERP_System | 89aaccdd79a46a2f220437f3f74a5df29919864f | [
"MIT"
] | null | null | null | database/seeds/PurchaseRequestSeeder.php | CavlinTsang/ERP_System | 89aaccdd79a46a2f220437f3f74a5df29919864f | [
"MIT"
] | null | null | null | database/seeds/PurchaseRequestSeeder.php | CavlinTsang/ERP_System | 89aaccdd79a46a2f220437f3f74a5df29919864f | [
"MIT"
] | null | null | null | <?php
use Illuminate\Database\Seeder;
class PurchaseRequestSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$collection = array(
['requestID'=>1, 'branchID'=>6, 'createdDate'=>'2020-07-12', 'expectedDeliveryDate'=>'2020-07-31', 'status'=>'Pending for Mapping', 'remarks'=>'Empty'],
['requestID'=>2, 'branchID'=>7, 'createdDate'=>'2020-07-12', 'expectedDeliveryDate'=>'2020-07-31', 'status'=>'Pending for Mapping', 'remarks'=>'Empty'],
['requestID'=>3, 'branchID'=>8, 'createdDate'=>'2020-07-12', 'expectedDeliveryDate'=>'2020-07-31', 'status'=>'Pending for Mapping', 'remarks'=>'Empty'],
['requestID'=>4, 'branchID'=>9, 'createdDate'=>'2020-07-12', 'expectedDeliveryDate'=>'2020-07-31', 'status'=>'Pending for Mapping', 'remarks'=>'Empty'],
['requestID'=>5, 'branchID'=>10, 'createdDate'=>'2020-07-12', 'expectedDeliveryDate'=>'2020-07-31', 'status'=>'Pending for Mapping', 'remarks'=>'Empty'],
);
for($i=0; $i<count($collection); $i++) {
//for debug input data error
//print_r(Arr::get($collection,$i));
DB::table('purchase_request')->insert([Arr::get($collection,$i)]);
}
}
}
| 43.1 | 165 | 0.580046 |
0fd88503add331d4bd7fe628918ed17685e076d2 | 25,109 | sql | SQL | database/db_ppob.sql | Spyder-code/ppob | 1ceeea49e9edfa5fdea87e46a2c2bf973c969036 | [
"MIT"
] | null | null | null | database/db_ppob.sql | Spyder-code/ppob | 1ceeea49e9edfa5fdea87e46a2c2bf973c969036 | [
"MIT"
] | null | null | null | database/db_ppob.sql | Spyder-code/ppob | 1ceeea49e9edfa5fdea87e46a2c2bf973c969036 | [
"MIT"
] | null | null | null | -- phpMyAdmin SQL Dump
-- version 5.1.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 03 Feb 2022 pada 16.02
-- Versi server: 10.4.22-MariaDB
-- Versi PHP: 8.0.13
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
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: `db_ppob`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `failed_jobs`
--
CREATE TABLE `failed_jobs` (
`id` bigint(20) UNSIGNED NOT NULL,
`uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
`queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
`payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`failed_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Struktur dari tabel `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data untuk tabel `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_resets_table', 1),
(3, '2019_08_19_000000_create_failed_jobs_table', 1),
(4, '2019_12_14_000001_create_personal_access_tokens_table', 1),
(5, '2020_10_03_125517_create_table_nominal', 1),
(6, '2020_10_03_125541_create_table_pulsa', 1),
(7, '2020_10_03_125555_create_table_kategori', 1),
(8, '2020_10_03_125611_create_table_data', 1),
(9, '2020_10_03_125622_create_table_paket_data', 1),
(10, '2020_10_03_125637_create_table_pln', 1),
(11, '2020_10_03_125655_create_table_nominal_pln', 1),
(12, '2020_10_03_133410_create_table_provider', 1),
(13, '2020_10_04_054139_create_table_pln_customer', 1),
(14, '2021_11_21_172516_create_riwayat_saldos_table', 1),
(15, '2021_11_24_182147_create_request_saldos_table', 1),
(16, '2021_12_11_065435_create_setting_websites_table', 1),
(17, '2022_02_03_164047_create_rewards_table', 1);
-- --------------------------------------------------------
--
-- Struktur dari tabel `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Struktur dari tabel `personal_access_tokens`
--
CREATE TABLE `personal_access_tokens` (
`id` bigint(20) UNSIGNED NOT NULL,
`tokenable_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`tokenable_id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
`abilities` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`last_used_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Struktur dari tabel `request_saldos`
--
CREATE TABLE `request_saldos` (
`id` bigint(20) UNSIGNED NOT NULL,
`user_id` bigint(20) NOT NULL,
`bukti` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`nominal` int(11) NOT NULL,
`status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Struktur dari tabel `rewards`
--
CREATE TABLE `rewards` (
`id` bigint(20) UNSIGNED NOT NULL,
`outlet_id` bigint(20) UNSIGNED NOT NULL,
`reward` text COLLATE utf8mb4_unicode_ci NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT 0,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Struktur dari tabel `riwayat_saldos`
--
CREATE TABLE `riwayat_saldos` (
`id` bigint(20) UNSIGNED NOT NULL,
`user_id` bigint(20) NOT NULL,
`saldoAfter` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`saldoPlus` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`saldoNow` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Struktur dari tabel `setting_websites`
--
CREATE TABLE `setting_websites` (
`id` bigint(20) UNSIGNED NOT NULL,
`favicon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`logo` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`app_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`footer_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data untuk tabel `setting_websites`
--
INSERT INTO `setting_websites` (`id`, `favicon`, `logo`, `app_name`, `footer_name`, `created_at`, `updated_at`) VALUES
(1, '', '', 'PT Hana Patria Sejati', 'PT Hana Patria Sejati', '2022-02-03 10:56:05', '2022-02-03 10:56:05');
-- --------------------------------------------------------
--
-- Struktur dari tabel `table_kategori`
--
CREATE TABLE `table_kategori` (
`id` bigint(20) UNSIGNED NOT NULL,
`nama_kategori` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data untuk tabel `table_kategori`
--
INSERT INTO `table_kategori` (`id`, `nama_kategori`, `created_at`, `updated_at`) VALUES
(1, 'Pulsa', NULL, NULL),
(2, 'Paket Data', NULL, NULL),
(3, 'PLN', NULL, NULL);
-- --------------------------------------------------------
--
-- Struktur dari tabel `table_nominal_data`
--
CREATE TABLE `table_nominal_data` (
`id` bigint(20) UNSIGNED NOT NULL,
`nama_paket` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`id_provider` int(11) NOT NULL,
`fixed_price` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data untuk tabel `table_nominal_data`
--
INSERT INTO `table_nominal_data` (`id`, `nama_paket`, `id_provider`, `fixed_price`, `created_at`, `updated_at`) VALUES
(1, 'Paket 25 GB 1 Bulan', 2, 100000, '2020-10-03 12:56:45', '2020-10-03 12:56:45'),
(2, '1 GB 1 minggu', 1, 20000, '2020-10-03 12:56:45', '2020-10-03 12:56:45'),
(3, '1.5 GB 1 Minggu', 3, 10000, '2020-10-03 13:33:18', '2020-10-03 13:33:18'),
(4, '3 GB 1 Bulan Unlimited Social Media', 2, 25000, '2020-10-03 13:33:18', '2020-10-03 13:33:18'),
(7, '3 GB 1 Bulan', 1, 25000, '2020-10-03 14:48:11', '2020-10-03 14:48:11'),
(8, '7 GB 1 Bulan', 1, 50000, '2020-10-03 14:48:11', '2020-10-03 14:48:11'),
(9, '10 GB & Unlimited Social Media', 2, 50000, '2020-10-03 14:50:54', '2020-10-03 14:50:54');
-- --------------------------------------------------------
--
-- Struktur dari tabel `table_nominal_pln`
--
CREATE TABLE `table_nominal_pln` (
`id` bigint(20) UNSIGNED NOT NULL,
`paket_pln` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`fixed_price` int(11) NOT NULL,
`daya` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data untuk tabel `table_nominal_pln`
--
INSERT INTO `table_nominal_pln` (`id`, `paket_pln`, `fixed_price`, `daya`, `created_at`, `updated_at`) VALUES
(1, '20Rb', 20200, 0, '2020-10-03 15:29:41', '2020-10-03 15:29:41'),
(2, '50Rb', 50200, 0, '2020-10-03 15:29:41', '2020-10-03 15:29:41'),
(3, '100Rb', 100200, 0, '2020-10-03 15:29:41', '2020-10-03 15:29:41'),
(4, '200Rb', 200200, 0, '2020-10-03 15:29:41', '2020-10-03 15:29:41'),
(5, '500Rb', 500200, 0, '2020-10-03 15:29:41', '2020-10-03 15:29:41'),
(6, '1Jt', 1000200, 0, '2020-10-03 15:29:41', '2020-10-03 15:29:41');
-- --------------------------------------------------------
--
-- Struktur dari tabel `table_nominal_pulsa`
--
CREATE TABLE `table_nominal_pulsa` (
`id` bigint(20) UNSIGNED NOT NULL,
`nominal` int(11) NOT NULL,
`fixed_price` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data untuk tabel `table_nominal_pulsa`
--
INSERT INTO `table_nominal_pulsa` (`id`, `nominal`, `fixed_price`, `created_at`, `updated_at`) VALUES
(1, 5000, 5200, '2020-10-03 02:24:19', '2020-10-03 02:24:19'),
(2, 10000, 10200, '2020-10-03 02:24:19', '2020-10-03 02:24:19'),
(3, 20000, 20200, '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(4, 15000, 15200, '2020-10-03 00:51:55', '2020-10-03 00:51:55'),
(5, 25000, 252000, '2020-10-03 02:52:41', '2020-10-03 02:52:41');
-- --------------------------------------------------------
--
-- Struktur dari tabel `table_paket_data`
--
CREATE TABLE `table_paket_data` (
`id` bigint(20) UNSIGNED NOT NULL,
`outlet_id` bigint(20) UNSIGNED NOT NULL,
`nomor_hp` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`id_paket_data` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`id_provider` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`price` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data untuk tabel `table_paket_data`
--
INSERT INTO `table_paket_data` (`id`, `outlet_id`, `nomor_hp`, `id_paket_data`, `id_provider`, `price`, `created_at`, `updated_at`) VALUES
(1, 1, '083857317946', '2', '3', '20000', '2022-02-03 12:22:27', '2022-02-03 12:22:27');
-- --------------------------------------------------------
--
-- Struktur dari tabel `table_pln`
--
CREATE TABLE `table_pln` (
`id` bigint(20) UNSIGNED NOT NULL,
`outlet_id` bigint(20) UNSIGNED NOT NULL,
`id_customer` int(11) NOT NULL,
`id_paket_pln` int(11) NOT NULL,
`price` int(11) NOT NULL,
`informasi` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data untuk tabel `table_pln`
--
INSERT INTO `table_pln` (`id`, `outlet_id`, `id_customer`, `id_paket_pln`, `price`, `informasi`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 2, 50200, 'pembayaran masuk 1 jam setelah checkout!', '2022-01-03 12:24:31', '2022-02-03 12:24:31');
-- --------------------------------------------------------
--
-- Struktur dari tabel `table_pln_customer`
--
CREATE TABLE `table_pln_customer` (
`id` bigint(20) UNSIGNED NOT NULL,
`nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`id_pelanggan` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`no_meteran` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`batas_daya` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data untuk tabel `table_pln_customer`
--
INSERT INTO `table_pln_customer` (`id`, `nama`, `id_pelanggan`, `no_meteran`, `batas_daya`, `created_at`, `updated_at`) VALUES
(1, 'Andhika', '434234324234', '111212454', '400 VA', '2020-10-03 15:50:14', NULL),
(2, 'Arda', '465467867', '555222111', '1200 VA', '2020-10-03 16:21:22', NULL),
(3, 'Yanto', '46464546456', '888777999', '450 VA', '2020-10-03 16:21:22', NULL);
-- --------------------------------------------------------
--
-- Struktur dari tabel `table_provider`
--
CREATE TABLE `table_provider` (
`id` bigint(20) UNSIGNED NOT NULL,
`nama_provider` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`kode_provider` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data untuk tabel `table_provider`
--
INSERT INTO `table_provider` (`id`, `nama_provider`, `kode_provider`, `created_at`, `updated_at`) VALUES
(1, 'Telkom', '001', '2020-10-03 02:17:48', '2020-10-03 02:17:48'),
(2, 'Indosat Oredooo', '002', '2020-10-03 02:17:48', '2020-10-03 02:17:48'),
(3, 'Tree', '003', '2020-10-03 02:17:48', '2020-10-03 02:17:48');
-- --------------------------------------------------------
--
-- Struktur dari tabel `table_pulsa`
--
CREATE TABLE `table_pulsa` (
`id` bigint(20) UNSIGNED NOT NULL,
`outlet_id` bigint(20) UNSIGNED NOT NULL,
`nomor_hp` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`id_nominal` int(11) NOT NULL,
`id_provider` int(11) NOT NULL,
`price` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data untuk tabel `table_pulsa`
--
INSERT INTO `table_pulsa` (`id`, `outlet_id`, `nomor_hp`, `id_nominal`, `id_provider`, `price`, `created_at`, `updated_at`) VALUES
(1, 1, '083857317946', 2, 2, 10200, '2022-02-03 12:18:34', '2022-02-03 12:18:34');
-- --------------------------------------------------------
--
-- Struktur dari tabel `users`
--
CREATE TABLE `users` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`role` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`gender` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`phone` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`avatar` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`status` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`saldo` int(11) NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email_verified_at` timestamp NULL DEFAULT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data untuk tabel `users`
--
INSERT INTO `users` (`id`, `name`, `role`, `gender`, `phone`, `address`, `avatar`, `status`, `saldo`, `email`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'Admin', 'outlet', '-', '-', NULL, 'admin.jpg', 'active', -80400, 'admin@test.com', '2021-07-09 13:19:13', '$2y$10$u3NhosfLZp6B1rJ/3vsFEOKNAvZ2A5znkk6udLrQWUu11hZ/0Q1W.', 'kpK8gGXS0OUSZ0KAmjHV4ABNJNk0Y9pLk9WDXAKAO7BomKD2uOGZ2BQBpTrk', '2022-02-03 10:56:06', '2022-02-03 12:24:36'),
(2, 'Operator', 'operator', 'Pria', '085767113554', NULL, 'operator.jpg', 'active', 0, 'operator@test.com', '2021-07-09 13:19:13', '$2y$10$LbArttBG7b.wjK4TGkY7AePu9tipEXGjHP6u/7MLBwIwrzeEGtFMO', 'nMNJe7kXnwNv2Uk18WmpcFP0jg8p0pDo6UJeHsGeAw9Yo7ZiTyPXsK1s8h78', '2022-02-03 10:56:06', '2022-02-03 10:56:06'),
(3, 'Outlet', 'outlet', 'Pria', '085767113554', NULL, 'outlet.jpg', 'non-active', 0, 'outlet@test.com', '2021-07-09 13:19:13', '$2y$10$i89Dov7gU33uxSA2MzyjVe2RNWDIHhRc/TPrle6E5ynUghKeA3D9y', 'IUOGkm34WCFnFbcwyVsaB8US9XEk9vB9TtB6HkTQhdGvsy6qcCdicSN5RD6u', '2022-02-03 10:56:06', '2022-02-03 10:56:06'),
(4, 'Outlet2', 'outlet', 'Pria', '085767113554', NULL, 'outlet.jpg', 'non-active', 0, 'outlet2@test.com', '2021-07-09 13:19:13', '$2y$10$l/ZvIWd26RjdI.4d/F26cOtMW1uyAfc8sbNQU6Dgj1U5MVCOE1is6', '8YB0IjIn2wUUEmM671tupclTovlqegdIS2m0w9B7sZP9asiG8P8KPqkBCdyz', '2022-02-03 10:56:06', '2022-02-03 10:56:06'),
(5, 'Outlet3', 'outlet', 'Pria', '085767113554', NULL, 'outlet.jpg', 'non-active', 0, 'outlet3@test.com', '2021-07-09 13:19:13', '$2y$10$b3yK2jgj0Aftsk0EpkmOVuYDKqgaEHoGzOF3EQuShRRQs9TVE46we', 'bIthuhPIN1GpqQbfIWmxf8qUtncYrhhpzL51Pf9geDDCw3WJg86xDR9nmcRw', '2022-02-03 10:56:07', '2022-02-03 10:56:07'),
(6, 'Outlet4', 'outlet', 'Pria', '085767113554', NULL, 'outlet.jpg', 'non-active', 0, 'outlet4@test.com', '2021-07-09 13:19:13', '$2y$10$QsaLszgT8gpYM2Q/A8eBCeyiopNPJyygFqcZAcqYJxvmq9CTFAiZa', '5ZD9u1UqX99LzyyjdcoHwlLwuh0W1Mk9ou08sJPwxYIvL0WAzkjkY2WfeNvt', '2022-02-03 10:56:08', '2022-02-03 10:56:08'),
(7, 'Outlet5', 'outlet', 'Pria', '085767113554', NULL, 'outlet.jpg', 'non-active', 0, 'outlet5@test.com', '2021-07-09 13:19:13', '$2y$10$D1KmlvGCMkOYPm3V3ajLnOiX5z2UQs0exOhoFWKj8jMoRanCpytLW', 'DEEClLDoSYp7PFTGhVyU9GYbPTKTUGMfxDF26zQJU3KYF7G8yiV5biMmKHMq', '2022-02-03 10:56:08', '2022-02-03 10:56:08'),
(8, 'Outlet6', 'outlet', 'Pria', '085767113554', NULL, 'outlet.jpg', 'non-active', 0, 'outlet6@test.com', '2021-07-09 13:19:13', '$2y$10$XOyiksAjdTCtsJEan.o5CuO6/1Ttlaj12jIRlO1v3amIGFyDDfAAW', 'DEfbQCpX7P9Pb0uY7ia5IuhE884gkGa38dRp36g4v5xkDE7ibP2LkiA2m9bL', '2022-02-03 10:56:08', '2022-02-03 10:56:08'),
(9, 'Outlet7', 'outlet', 'Pria', '085767113554', NULL, 'outlet.jpg', 'non-active', 0, 'outlet7@test.com', '2021-07-09 13:19:13', '$2y$10$W3jPoDTu9KIjt6VzbSQ7deLQySDCPvVG6IDfwbSHOyHIm0EwUZZH2', 'IwfFzRvA7kE90CkiOQezCWeeH0A6iClZfb1hqN9PZyFJ1VbXJnoQqxQIoeHZ', '2022-02-03 10:56:08', '2022-02-03 10:56:08'),
(10, 'Outlet8', 'outlet', 'Pria', '085767113554', NULL, 'outlet.jpg', 'non-active', 0, 'outlet8@test.com', '2021-07-09 13:19:13', '$2y$10$QrROpHh.lmdEow7SyGA3j.xhey.CV.1LvjnNJoekBBGrxA9ZfVG2G', 'vl0TipyWejbdJamR1kI5lm4UJqO8dXET06HtL0hwukjCKdYW7xhteU0Z3hx1', '2022-02-03 10:56:08', '2022-02-03 10:56:08'),
(11, 'Outlet9', 'outlet', 'Pria', '085767113554', NULL, 'outlet.jpg', 'non-active', 0, 'outlet9@test.com', '2021-07-09 13:19:13', '$2y$10$onN9vMjJV.n7kUbimda3m.vET2FYAQ7Q6bz0EkzWyd6p2ulE.rpmS', 'F3zDSwJGrydXoNUuUIFZNKf5cGKWrYZlViJzQzxMzvv6EMBhhKXSF9DRvRBv', '2022-02-03 10:56:08', '2022-02-03 10:56:08'),
(12, 'Outlet10', 'outlet', 'Pria', '085767113554', NULL, 'outlet.jpg', 'non-active', 0, 'outlet10@test.com', '2021-07-09 13:19:13', '$2y$10$f.sIpOI6Hhi9s0BxDVA/Se2SLvtCIqm8FFRBhI7hbmNYRmvB45B26', 'EBKH6f1OJyoppvntJ5kPwfqJrOezM4O2bkQJZOAoLNvLJudR1xSFdc0qb8BJ', '2022-02-03 10:56:08', '2022-02-03 10:56:08');
--
-- Indexes for dumped tables
--
--
-- Indeks untuk tabel `failed_jobs`
--
ALTER TABLE `failed_jobs`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);
--
-- Indeks untuk tabel `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indeks untuk tabel `personal_access_tokens`
--
ALTER TABLE `personal_access_tokens`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
ADD KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`);
--
-- Indeks untuk tabel `request_saldos`
--
ALTER TABLE `request_saldos`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `rewards`
--
ALTER TABLE `rewards`
ADD PRIMARY KEY (`id`),
ADD KEY `rewards_outlet_id_foreign` (`outlet_id`);
--
-- Indeks untuk tabel `riwayat_saldos`
--
ALTER TABLE `riwayat_saldos`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `setting_websites`
--
ALTER TABLE `setting_websites`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `table_kategori`
--
ALTER TABLE `table_kategori`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `table_nominal_data`
--
ALTER TABLE `table_nominal_data`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `table_nominal_pln`
--
ALTER TABLE `table_nominal_pln`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `table_nominal_pulsa`
--
ALTER TABLE `table_nominal_pulsa`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `table_paket_data`
--
ALTER TABLE `table_paket_data`
ADD PRIMARY KEY (`id`),
ADD KEY `table_paket_data_outlet_id_foreign` (`outlet_id`);
--
-- Indeks untuk tabel `table_pln`
--
ALTER TABLE `table_pln`
ADD PRIMARY KEY (`id`),
ADD KEY `table_pln_outlet_id_foreign` (`outlet_id`);
--
-- Indeks untuk tabel `table_pln_customer`
--
ALTER TABLE `table_pln_customer`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `table_provider`
--
ALTER TABLE `table_provider`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `table_pulsa`
--
ALTER TABLE `table_pulsa`
ADD PRIMARY KEY (`id`),
ADD KEY `table_pulsa_outlet_id_foreign` (`outlet_id`);
--
-- Indeks untuk tabel `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- AUTO_INCREMENT untuk tabel yang dibuang
--
--
-- AUTO_INCREMENT untuk tabel `failed_jobs`
--
ALTER TABLE `failed_jobs`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;
--
-- AUTO_INCREMENT untuk tabel `personal_access_tokens`
--
ALTER TABLE `personal_access_tokens`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `request_saldos`
--
ALTER TABLE `request_saldos`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `rewards`
--
ALTER TABLE `rewards`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `riwayat_saldos`
--
ALTER TABLE `riwayat_saldos`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `setting_websites`
--
ALTER TABLE `setting_websites`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT untuk tabel `table_kategori`
--
ALTER TABLE `table_kategori`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT untuk tabel `table_nominal_data`
--
ALTER TABLE `table_nominal_data`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT untuk tabel `table_nominal_pln`
--
ALTER TABLE `table_nominal_pln`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT untuk tabel `table_nominal_pulsa`
--
ALTER TABLE `table_nominal_pulsa`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT untuk tabel `table_paket_data`
--
ALTER TABLE `table_paket_data`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT untuk tabel `table_pln`
--
ALTER TABLE `table_pln`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT untuk tabel `table_pln_customer`
--
ALTER TABLE `table_pln_customer`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT untuk tabel `table_provider`
--
ALTER TABLE `table_provider`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT untuk tabel `table_pulsa`
--
ALTER TABLE `table_pulsa`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT untuk tabel `users`
--
ALTER TABLE `users`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
--
-- Ketidakleluasaan untuk tabel pelimpahan (Dumped Tables)
--
--
-- Ketidakleluasaan untuk tabel `rewards`
--
ALTER TABLE `rewards`
ADD CONSTRAINT `rewards_outlet_id_foreign` FOREIGN KEY (`outlet_id`) REFERENCES `users` (`id`);
--
-- Ketidakleluasaan untuk tabel `table_paket_data`
--
ALTER TABLE `table_paket_data`
ADD CONSTRAINT `table_paket_data_outlet_id_foreign` FOREIGN KEY (`outlet_id`) REFERENCES `users` (`id`);
--
-- Ketidakleluasaan untuk tabel `table_pln`
--
ALTER TABLE `table_pln`
ADD CONSTRAINT `table_pln_outlet_id_foreign` FOREIGN KEY (`outlet_id`) REFERENCES `users` (`id`);
--
-- Ketidakleluasaan untuk tabel `table_pulsa`
--
ALTER TABLE `table_pulsa`
ADD CONSTRAINT `table_pulsa_outlet_id_foreign` FOREIGN KEY (`outlet_id`) REFERENCES `users` (`id`);
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 */;
| 36.02439 | 306 | 0.700187 |
90cddf62ebd3ea49e8e364632b7cd590198621a8 | 2,397 | py | Python | py/old.py | timm/misc | 2326989a8b8599283f8f16a6b8595d916850e392 | [
"BSD-2-Clause"
] | null | null | null | py/old.py | timm/misc | 2326989a8b8599283f8f16a6b8595d916850e392 | [
"BSD-2-Clause"
] | null | null | null | py/old.py | timm/misc | 2326989a8b8599283f8f16a6b8595d916850e392 | [
"BSD-2-Clause"
] | 1 | 2019-04-17T02:21:40.000Z | 2019-04-17T02:21:40.000Z | def mu(i, lo=0, hi=None):
hi = hi or len(i.has)
return sum([i.x(i.has[j]) for j in range(lo, hi)]) / (hi - lo)
class Some(o):
"Collect some examples, not all."
hi = 256 # max number of items to collect
def __init__(i, pos=0, txt=" ", inits=[]):
i.pos, i.txt, i.n, i._all, i.sorted = pos, txt, 0, [], False
i.w = -1 if txt[0] == Tab.less else 1
i.nump = txt[0] in Tab.nums
[i.add(x) for x in inits]
def add(i, x):
if x != Tab.skip:
if len(i._all) < Some.hi:
i.update(i._all.append(x))
elif random() < Some.hi / i.n:
i.update(i.replace(x))
return x
def update(i, ignore):
i.sorted = False
i.n += 1
def replace(i, x):
i._all[int(len(i._all) * random())] = x
def all(i):
if not i.sorted:
i._all = sorted(i._all)
i.sorted = True
return i._all
def per(i, p=None, lo=None, hi=None): return per(i.all(), p, lo, hi)
def sd(i, lo=None, hi=None): return sd(i.all(), lo, hi)
def nmusd(i):
return len(i._all), i.per(), i.sd()
def same(i, j):
xn, xmu, xsd = i.nmusd()
yn, ymu, ysd = j.nmusd()
return Ttest(xn, xmu, xsd, yn, ymu, ysd)
class Ttest(o):
small = 0.38 # medium = 1
d = {}
d[95] = [[3, 3.182], [6, 2.447], [12, 2.179],
[24, 2.064], [48, 2.011], [96, 1.985]]
d[99] = [[3, 5.841], [6, 3.707], [12, 3.055],
[24, 2.797], [48, 2.682], [96, 2.625]]
def __init__(i, *lst, conf=95):
xy = Ttest.d[conf]
i.result = i.hedges(Ttest.small, *lst) and i.ttest(xy, *lst)
def hedges(i, threshold, xn, xmu, xsd, yn, ymu, ysd):
# from https://goo.gl/w62iIL
nom = (xn - 1) * xsd ** 2 + (yn - 1) * ysd ** 2
denom = (xn - 1) + (yn - 1)
sp = (nom / denom)**0.5
g = abs(xmu - ymu) / sp
c = 1 - 3.0 / (4 * (xn + yn - 2) - 1)
return g * c > threshold
def ttest(i, xy, xn, xmu, xsd, yn, ymu, ysd, conf=95):
# debugged using https://goo.gl/CRl1Bz
t = (xmu - ymu) / max(10 ** -64, xsd**2 / xn + ysd**2 / yn)**0.5
a = xsd ** 2 / xn
b = ysd ** 2 / yn
df = (a + b)**2 / (10 ** -64 + a**2 / (xn - 1) + b**2 / (yn - 1))
c = i.critical(xy, int(df + 0.5))
return abs(t) > c
def critical(i, xy, df):
x1, y1 = xy[0]
if df < x1:
return y1
for x2, y2 in xy[1:]:
if x1 <= df < x2:
return y1 + (y2 - y1) * (df - x1) / (x2 - x1)
x1, y1 = x2, y2
return y2
| 26.932584 | 70 | 0.493951 |
6a61f033ad1696d3b8ef7d96143b62e35e694c75 | 2,475 | sql | SQL | database/patients.sql | shanmuga-axatech/hospital-patient-management | d938eefeac5de75f838e849e49fe581e786646af | [
"MIT"
] | null | null | null | database/patients.sql | shanmuga-axatech/hospital-patient-management | d938eefeac5de75f838e849e49fe581e786646af | [
"MIT"
] | null | null | null | database/patients.sql | shanmuga-axatech/hospital-patient-management | d938eefeac5de75f838e849e49fe581e786646af | [
"MIT"
] | null | null | null | -- Adminer 4.2.4 MySQL dump
SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
CREATE DATABASE `seva_trust_db` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `seva_trust_db`;
DROP TABLE IF EXISTS `patients`;
CREATE TABLE `patients` (
`patient_id` int(11) NOT NULL AUTO_INCREMENT,
`patient_no` int(11) NOT NULL,
`first_name` varchar(100) NOT NULL,
`last_name` varchar(100) NOT NULL,
`dob` date DEFAULT NULL,
`age` tinyint(4) NOT NULL,
`sex` enum('male','female') NOT NULL,
`address1` varchar(255) DEFAULT NULL,
`address2` varchar(255) DEFAULT NULL,
`contact_no` varchar(100) NOT NULL,
`aadhar_no` varchar(100) DEFAULT NULL,
`city` varchar(100) DEFAULT NULL,
`remarks` varchar(10000) NOT NULL,
`mtime` int(11) NOT NULL,
`doctor_id` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`patient_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `patients` (`patient_id`, `patient_no`, `first_name`, `last_name`, `dob`, `age`, `sex`, `address1`, `address2`, `contact_no`, `aadhar_no`, `city`, `remarks`, `mtime`, `doctor_id`) VALUES
(1, 1, 'SHANMUGA', 'PALANISAMY', '0000-00-00', 29, 'male', 'Greenheart, Manyata Embassy Business Park, Nagavara, Bengaluru, Karnataka 560045', '', '7899995489', '', 'BANGALORE', '- General checkup', 1488454814, 0),
(2, 2, 'SHANMUGA', 'PALANISAMY', '0000-00-00', 29, 'male', 'Greenheart, Manyata Embassy Business Park, Nagavara, Bengaluru, Karnataka 560045', '', '7899995489', '', 'BANGALORE', '- General checkup', 1488454862, 0),
(3, 3, 'SHANMUGA', 'PALANISAMY', '0000-00-00', 29, 'male', 'Greenheart, Manyata Embassy Business Park, Nagavara, Bengaluru, Karnataka 560045', '', '7899995489', '', 'BANGALORE', '- General checkup', 1488455037, 0),
(4, 4, 'SHANMUGA', 'PALANISAMY', '0000-00-00', 29, 'male', 'BTM', '', '7899995489', '', 'BANGALORE', 'testing', 1488455079, 0),
(5, 5, 'SHANMUGA', 'PALANISAMY', '0000-00-00', 29, 'male', 'BTM', '', '7899995489', '', 'BANGALORE', 'testing', 1488455160, 0),
(6, 6, 'SHANMUGA', 'PALANISAMY', '0000-00-00', 29, 'male', 'Greenheart, Manyata Embassy Business Park, Nagavara, Bengaluru, Karnataka 560045', '', '7899995489', '', 'BANGALORE', '- General checkup', 1488455204, 0),
(7, 7, 'SHANMUGA', 'PALANISAMY', '1988-12-04', 29, 'male', 'Greenheart, Manyata Embassy Business Park, Nagavara, Bengaluru, Karnataka 560045', '', '7899995489', '', 'BANGALORE', '- General checkup', 1488455271, 0);
-- 2017-03-24 09:51:50
| 60.365854 | 214 | 0.677576 |
12fe9ec8da68a7625717edf5bb04a9fd4fbf88e4 | 4,165 | html | HTML | node_modules/materialize-css/test.html | Gabehoverman/Senior-Project | 0b79f74d102c0d2e81eea857ed45f5a063bbf0f8 | [
"MIT"
] | 2 | 2019-09-03T11:45:57.000Z | 2021-01-30T22:58:03.000Z | node_modules/materialize-css/test.html | Gabehoverman/Senior-Project | 0b79f74d102c0d2e81eea857ed45f5a063bbf0f8 | [
"MIT"
] | 1 | 2022-02-12T18:50:46.000Z | 2022-02-12T18:50:46.000Z | node_modules/materialize-css/test.html | Gabehoverman/Senior-Project | 0b79f74d102c0d2e81eea857ed45f5a063bbf0f8 | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"/>
<title>Documentation - Materialize</title>
<!-- CSS -->
<link href="bin/materialize.css" type="text/css" rel="stylesheet" media="screen,projection"/>
</head>
<body>
<style type="text/css">
</style>
<!-- Materialize is already included -->
<label class="material-checkbox">
Check
<input type="checkbox">
</label>
<input type="checkbox" id="check">
<label for="check">Check</label>
<p class="flow-text">One common flaw we've seen in many frameworks is a lack of support for truly responsive text. While elements on the page resize fluidly, text still resizes on a fixed basis. To ameliorate this problem, for text heavy pages, we've created a class that fluidly scales text size and line-height to optimize readability for the user. Line length stays between 45-80 characters and line height scales to be larger on smaller screens.
<div class="fixed-action-btn" style="bottom: 45px; right: 24px;">
<a class="btn-floating btn-large red">
<i class="large mdi-editor-mode-edit"></i>
</a>
<ul>
<li><a class="btn-floating red"><i class="large mdi-editor-insert-chart"></i></a></li>
<li><a class="btn-floating yellow darken-1"><i class="large mdi-editor-format-quote"></i></a></li>
<li><a class="btn-floating green"><i class="large mdi-editor-publish"></i></a></li>
<li><a class="btn-floating blue"><i class="large mdi-editor-attach-file"></i></a></li>
</ul>
</div>
</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<!-- Modal Trigger -->
<a class="waves-effect waves-light btn modal-trigger" href="#modal1">Modal</a>
<!-- Modal Structure -->
<div id="modal1" class="modal">
<div class="modal-content">
<h4>Modal Header</h4>
<p>A bunch of text</p>
</div>
<div class="modal-footer">
<a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat">Agree</a>
</div>
</div>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<p>yo</p>
<script src="bin/jquery-2.1.1.min.js"></script>
<!-- <script src="js/jquery.timeago.js"></script> -->
<!-- <script src="js/jquery.easing.1.3.js"></script> -->
<!-- <script src="js/velocity.min.js"></script> -->
<!-- <script src="js/global.js"></script>
<script src="js/hammer.min.js"></script>
<script src="js/tooltip.js"></script>
<script src="js/materialbox.js"></script>
<script src="js/forms.js"></script>
<script src="js/tabs.js"></script>
<script src="js/dropdown.js"></script>
<script src="js/toasts.js"></script>
<script src="js/scrollFire.js"></script> -->
<!-- <script src="js/leanModal.js"></script> -->
<script src="bin/materialize.js"></script>
<!-- <script src="js/init.js"></script> -->
<script type="text/javascript">
$( document ).ready(function() {
// $(".button-collapse").sideNav({
// edge: 'right', menuWidth: 300
// });
// $('.modal-trigger').leanModal({dismissible: false});
// $('select').material_select();
});
</script>
</body>
</html> | 18.67713 | 449 | 0.564466 |
614f6f535bd911c7879bad0a03ede185a4b649b1 | 877 | css | CSS | frontend/widgets/css/photo.css | alexpol001/gobeauty | a643b28d9be3d30d22b08388613c91c4a59dd008 | [
"BSD-3-Clause"
] | null | null | null | frontend/widgets/css/photo.css | alexpol001/gobeauty | a643b28d9be3d30d22b08388613c91c4a59dd008 | [
"BSD-3-Clause"
] | null | null | null | frontend/widgets/css/photo.css | alexpol001/gobeauty | a643b28d9be3d30d22b08388613c91c4a59dd008 | [
"BSD-3-Clause"
] | null | null | null | .image-modal .modal-dialog{
width: 650px;
}
.image-modal .modal-header {
background: #ff6c64;
color: #ffffff;
}
.image-modal .modal-header h3 {
margin: 0;
font-size: 18px;
font-weight: bold;
}
.image-modal .modal-header .close {
color: inherit;
opacity: 1;
}
.image-modal .modal-header:hover {
}
.image-modal .modal-body {
font-size: 16px;
}
.image-modal .modal-body .form-group {
text-align: center;
}
.image-modal .modal-body button {
display: inline-block;
color: #ffffff;
background: #ff6c64;
padding: 15px 30px;
text-transform: uppercase;
border-radius: 8px;
font-weight: bold;
margin-top: 20px;
}
.image-modal .modal-body .image-crop {
position: relative;
font-size: 3em;
text-align: center;
}
.image-modal .modal-body .image-crop img {
max-width: 100%;
height: auto;
}
| 16.54717 | 42 | 0.629418 |
6e301a7c503fda5c1180fb85d8ea97e4dcd6d850 | 22,568 | html | HTML | case-studies.html | codeidiotic/idioticwebsitehtml | 4e645a976d5ca86a9d6ffefb3af75da88dee5555 | [
"Unlicense"
] | null | null | null | case-studies.html | codeidiotic/idioticwebsitehtml | 4e645a976d5ca86a9d6ffefb3af75da88dee5555 | [
"Unlicense"
] | null | null | null | case-studies.html | codeidiotic/idioticwebsitehtml | 4e645a976d5ca86a9d6ffefb3af75da88dee5555 | [
"Unlicense"
] | null | null | null | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Case Studies</title>
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta content="" name="keywords">
<meta content="" name="description">
<!-- Favicon -->
<link href="img/logo/title-icon.png" rel="icon">
<!-- Google Web Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500&family=Roboto:wght@500;700;900&display=swap" rel="stylesheet">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@500&display=swap" rel="stylesheet">
<!-- Icon Font Stylesheet -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.0/css/all.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.4.1/font/bootstrap-icons.css" rel="stylesheet">
<!-- Libraries Stylesheet -->
<link href="lib/animate/animate.min.css" rel="stylesheet">
<link href="lib/owlcarousel/assets/owl.carousel.min.css" rel="stylesheet">
<link href="lib/tempusdominus/css/tempusdominus-bootstrap-4.min.css" rel="stylesheet" />
<link href="lib/slick/slick.css" rel="stylesheet" type="text/css" />
<link href="lib/slick/slick-theme.css" type="text/css" />
<!-- Customized Bootstrap Stylesheet -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Template Stylesheet -->
<link href="css/style.css" rel="stylesheet">
</head>
<body class="bground-light">
<!-- Spinner Start -->
<div id="spinner" class="show bg-white position-fixed translate-middle w-100 vh-100 top-50 start-50 d-flex align-items-center justify-content-center">
<div class="spinner-grow text-primary" style="width: 3rem; height: 3rem;" role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
<!-- Spinner End -->
<!-- Navbar Start -->
<nav class="navbar navbar-expand-lg bg-white navbar-light sticky-top py-3 py-lg-0 wow fadeIn" data-wow-delay="0.1s">
<div class="d-flex flex-nowrap w-100">
<a href="index.html" class="navbar-brand ps-4 px-lg-5">
<img src="./img/logo/idiotic.png">
</a>
<button type="button" class="navbar-toggler ms-auto me-4" data-bs-toggle="collapse" data-bs-target="#navbarCollapse">
<span class="navbar-toggler-icon"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="navbarCollapse">
<div class="navbar-nav ms-auto p-4 p-lg-0">
<a href="index.html" class="nav-item nav-link">home</a>
<a href="influencer.html" class="nav-item nav-link">influencer</a>
<a href="brands.html" class="nav-item nav-link">brands</a>
<a href="aboutus.html" class="nav-item nav-link">about us</a>
<a href="careers.html" class="nav-item nav-link">careers</a>
<a href="case-studies.html" class="nav-item nav-link active">case studies</a>
<a href="contact.html" class="nav-item nav-link">contact us</a>
</div>
</div>
</nav>
<!-- Navbar End -->
<!-- Banner Start -->
<div class="container-fluid case-studies-page-banner position-relative wow fadeIn mb-4" data-wow-delay="0.1s">
<p class="display-5 ff-quicksand text-light text-uppercase position-relative wow fadeInUp" data-wow-delay="0.2s">Case Studies</p>
<p class="text-light fs-5 position-relative wow fadeInUp" data-wow-delay="0.15s">
A look into the stuff we do
</p>
<div class="position-absolute px-3 d-flex gap-5" style="bottom: -5%;">
<select class="form-select fs-6 text-dark wow fadeInUp" data-wow-delay="0.2s">
<option value="1">All Services</option>
<option value="2">Influencer Marketing</option>
<option value="3">Meme Marketing</option>
<option value="4">Content Amplification</option>
<option value="5">Social Media Account Management</option>
</select>
<select class="form-select fs-6 text-dark wow fadeInUp" data-wow-delay="0.2s">
<option value="1">All Channels</option>
<option value="2">Youtube</option>
<option value="3">Instagram</option>
<option value="4">Twitter</option>
<option value="5">Linkedin</option>
</select>
</div>
</div>
<!-- Banner End -->
<!-- Case Studies Cards Start -->
<div class="container py-5" style="padding-left: 2rem; padding-right: 2rem;">
<div class="row justify-content-evenly">
<div class="col-12 col-md-6 col-lg-4 mb-5 casestudy-page-card-container">
<img
src="https://www.idiotic.media/media/cover_image/2022/05/04/CoinDCX_Cover_2_.png"
class="img-fluid"
/>
<p class="text-dark mb-0">CoinDCX</p>
<p class="text-muted">Influencer Marketing</p>
<hr class="w-50 bground-main">
<p class="mb-4">
The objective of the campaign was to create awareness about CoinDCX’s new concept
#CryptoResolution
</p>
<div class="mb-2">
<a href="" class="rounded-2 py-2 px-3 bground-main text-decoration-none text-white">
view case study
</a>
</div>
</div>
<div class="col-12 col-md-6 col-lg-4 mb-5 casestudy-page-card-container">
<img
src="https://www.idiotic.media/media/cover_image/2022/05/09/Groomo_Cover.png"
class="img-fluid"
/>
<p class="text-dark mb-0">Groomo</p>
<p class="text-muted">Meme Marketing</p>
<hr class="w-50 bground-main">
<p class="mb-4">
The campaign was executed on Instagram for Groomo in highlight to their Valentine’s Day
Offers. The activity constituted of promoting their range of products through Static
Memes and Video Memes.
</p>
<div class="mb-2">
<a href="" class="rounded-2 py-2 px-3 bground-main text-decoration-none text-white">
view case study
</a>
</div>
</div>
<div class="col-12 col-md-6 col-lg-4 mb-5 casestudy-page-card-container">
<img
src="https://www.idiotic.media/media/cover_image/2022/05/05/trell_cover.png"
class="img-fluid"
/>
<p class="text-dark mb-0">Trell</p>
<p class="text-muted">Influencer Marketing</p>
<hr class="w-50 bground-main">
<p class="mb-4">
Trell's newest Dance Anthem in support of the Chennai Super Kings’
Team for the IPL was to be grooved to by multiple micro Influencers,
who then joined us to be a part of the world's largest fan movement
</p>
<div class="mb-2">
<a href="" class="rounded-2 py-2 px-3 bground-main text-decoration-none text-white">
view case study
</a>
</div>
</div>
<div class="col-12 col-md-6 col-lg-4 mb-5 casestudy-page-card-container">
<img
src="https://www.idiotic.media/media/cover_image/2022/05/05/the_family_man_.png"
class="img-fluid"
/>
<p class="text-dark mb-0">Prime Video</p>
<p class="text-muted">Influencer Marketing</p>
<hr class="w-50 bground-main">
<p class="mb-4">
The Theme Song for ‘The Family Man’ was promoted on Tiktok. 20 Influencers were opted
for the campaign to create video content with the song inorder to create awareness about
the show and the song.
</p>
<div class="mb-2">
<a href="" class="rounded-2 py-2 px-3 bground-main text-decoration-none text-white">
view case study
</a>
</div>
</div>
<div class="col-12 col-md-6 col-lg-4 mb-5 casestudy-page-card-container">
<img
src="https://www.idiotic.media/media/cover_image/2022/05/09/Groomo_Cover.png"
class="img-fluid"
/>
<p class="text-dark mb-0">Groomo</p>
<p class="text-muted">Meme Marketing</p>
<hr class="w-50 bground-main">
<p class="mb-4">
The campaign was executed on Instagram for Groomo in highlight to their Valentine’s Day
Offers. The activity constituted of promoting their range of products through Static
Memes and Video Memes.
</p>
<div class="mb-2">
<a href="" class="rounded-2 py-2 px-3 bground-main text-decoration-none text-white">
view case study
</a>
</div>
</div>
<div class="col-12 col-md-6 col-lg-4 mb-5 casestudy-page-card-container">
<img
src="https://www.idiotic.media/media/cover_image/2022/05/05/trell_cover.png"
class="img-fluid"
/>
<p class="text-dark mb-0">Trell</p>
<p class="text-muted">Influencer Marketing</p>
<hr class="w-50 bground-main">
<p class="mb-4">
Trell's newest Dance Anthem in support of the Chennai Super Kings’
Team for the IPL was to be grooved to by multiple micro Influencers,
who then joined us to be a part of the world's largest fan movement
</p>
<div class="mb-2">
<a href="" class="rounded-2 py-2 px-3 bground-main text-decoration-none text-white">
view case study
</a>
</div>
</div>
</div>
<!-- <div class="row g-3 g-lg-5 mb-5">
<div class="col-12 col-lg-6 wow fadeInUp" data-wow-delay="0.2s">
<div class="casestudy-page-card" style="background-image: url('https://www.idiotic.media/media/cover_image/2022/05/04/CoinDCX_Cover_2_.png');">
<div class="card rounded-0 ms-0 ms-sm-3">
<div class="card-body px-4 py-3" style="max-height: 20rem; overflow-y: scroll;">
<p class="mb-1 fc-primary fw-bold text-uppercase">OTT Promotion</p>
<p class="mb-1 text-dark ff-quicksand fs-4">Chhalaang</p>
<div class="mb-4">
<p class="mb-0">
the campaign was to promote the film 'Chhalaang' through various
social media platforms to get the maximum output.
</p>
</div>
<div class="mb-1 px-1">
<div class="d-flex flex-wrap justify-content-between">
<div class="">
<p class="text-center ff-quicksand fc-primary fs-3 mb-0">
1.2M+
</p>
<p class="fs-6 text-center text-capitalize">engagements</p>
</div>
<div class="">
<p class="text-center ff-quicksand fc-primary fs-3 mb-0">
103
</p>
<p class="fs-6 text-center text-capitalize">total pages</p>
</div>
</div>
</div>
<div class="">
<a href="" class="btn btn-primary-bg rounded-0 py-2 px-3 fs-small">Full Case Study</a>
</div>
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-6 wow fadeInUp" data-wow-delay="0.2s">
<div class="casestudy-page-card" style="background-image: url('https://www.idiotic.media/media/cover_image/2022/05/05/Zee_cover.png');">
<div class="card rounded-0 ms-0 ms-sm-3">
<div class="card-body px-4 py-3" style="max-height: 20rem; overflow-y: scroll;">
<p class="mb-1 fc-primary fw-bold text-uppercase">Content Amplification</p>
<p class="mb-1 text-dark ff-quicksand fs-4">The Forgotten Army</p>
<div class="mb-4">
<p class="mb-0">
The Campaign was to amplify various show assets like Promo Video,
Song & Guinness world record Video
</p>
</div>
<div class="mb-1 px-1">
<div class="d-flex flex-wrap justify-content-between">
<div class="">
<p class="text-center ff-quicksand fc-primary fs-3 mb-0">
3.5M+
</p>
<p class="fs-6 text-center text-capitalize">views</p>
</div>
</div>
</div>
<div class="">
<a href="" class="btn btn-primary-bg rounded-0 py-2 px-3 fs-small">Full Case Study</a>
</div>
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-6 wow fadeInUp" data-wow-delay="0.3s">
<div class="casestudy-page-card" style="background-image: url('https://www.idiotic.media/media/cover_image/2022/05/10/coolie_no_1_cover.png');">
<div class="card rounded-0 ms-0 ms-sm-3">
<div class="card-body px-4 py-3" style="max-height: 20rem; overflow-y: scroll;">
<p class="mb-1 fc-primary fw-bold text-uppercase">OTT Promotion</p>
<p class="mb-1 text-dark ff-quicksand fs-4">Hostel Daze(Amazon Prime Video)</p>
<div class="mb-4">
<p class="mb-0">
The campaign was done to amplify various assets of the show on relevant Instagram Handles
</p>
</div>
<div class="mb-1 px-1">
<div class="d-flex flex-wrap justify-content-between">
<div class="">
<p class="text-center ff-quicksand fc-primary fs-3 mb-0">
70+
</p>
<p class="fs-6 text-center text-capitalize">total pages</p>
</div>
<div class="">
<p class="text-center ff-quicksand fc-primary fs-3 mb-0">
2.8M+
</p>
<p class="fs-6 text-center text-capitalize">views</p>
</div>
</div>
</div>
<div class="">
<a href="" class="btn btn-primary-bg rounded-0 py-2 px-3 fs-small">Full Case Study</a>
</div>
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-6 wow fadeInUp" data-wow-delay="0.3s">
<div class="casestudy-page-card" style="background-image: url('https://www.idiotic.media/media/cover_image/2022/05/10/Priya_Gold_Cover.png');">
<div class="card rounded-0 ms-0 ms-sm-3" style="max-height: 20rem; overflow-y: scroll;">
<div class="card-body px-4 py-3">
<p class="mb-1 fc-primary fw-bold text-uppercase">Meme Marketing</p>
<p class="mb-1 text-dark ff-quicksand fs-4">MPL(Mobile Premier League)</p>
<div class="mb-4">
<p class="mb-0">The Campaign was done to drive awareness around the MPL(Mobile Premier League) Gaming App.</p>
</div>
<div class="mb-1 px-1">
<div class="d-flex flex-wrap justify-content-between">
<div class="">
<p class="text-center ff-quicksand fc-primary fs-3 mb-0">
200K+
</p>
<p class="fs-6 text-center text-capitalize">engagements</p>
</div>
<div class="">
<p class="text-center ff-quicksand fc-primary fs-3 mb-0">
26M+
</p>
<p class="fs-6 text-center text-capitalize">audience</p>
</div>
<div class="">
<p class="text-center ff-quicksand fc-primary fs-3 mb-0">
34
</p>
<p class="fs-6 text-center text-capitalize">total influencers</p>
</div>
</div>
</div>
<div class="">
<a href="" class="btn btn-primary-bg rounded-0 py-2 px-3 fs-small">Full Case Study</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="text-center">
<a href="" class="btn btn-dark-bg px-3 py-2 rounded-0">
View More
</a>
</div> -->
</div>
<!-- Case Studies Cards End -->
<!-- Footer Start -->
<div class="container-fluid text-light footer wow fadeIn" data-wow-delay="0.1s">
<div class="container py-5">
<div class="row g-5">
<div class="offset-lg-1 col-lg-4 col-md-12">
<img src="./img/logo/idiotic.png" class="img-fluid w-50">
<p class="mt-4 mb-2">India's top influencer marketing platform for campaigns on Instagram, YouTube, TikTok and more.</p>
<div class="d-flex pt-2">
<a class="btn btn-social rounded-circle" href=""><i class="fab fa-twitter"></i></a>
<a class="btn btn-social rounded-circle" href=""><i class="fab fa-facebook-f"></i></a>
<a class="btn btn-social rounded-circle" href=""><i class="fab fa-youtube"></i></a>
<a class="btn btn-social rounded-circle" href=""><i class="fab fa-linkedin-in"></i></a>
</div>
</div>
<div class="col-lg-3 col-md-6">
<h5 class="text-light mb-4">Services</h5>
<a class="btn btn-link" href="">Sign up as Brand</a>
<a class="btn btn-link" href="">Sign up as an Influencer</a>
</div>
<div class="col-lg-3 col-md-6">
<h5 class="text-light mb-4">Quick Links</h5>
<a class="btn btn-link" href="">Home</a>
<a class="btn btn-link" href="">About Us</a>
<a class="btn btn-link" href="">Why us?</a>
<a class="btn btn-link" href="">Influencer Reviews</a>
</div>
</div>
</div>
</div>
<!-- Footer End -->
<!-- Back to Top -->
<a href="#" class="btn btn-lg btn-primary-bg btn-lg-square rounded-circle back-to-top"><i class="bi bi-arrow-up"></i></a>
<!-- JavaScript Libraries -->
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/js/bootstrap.bundle.min.js"></script>
<script src="lib/wow/wow.min.js"></script>
<script src="lib/easing/easing.min.js"></script>
<script src="lib/waypoints/waypoints.min.js"></script>
<script src="lib/counterup/counterup.min.js"></script>
<script src="lib/owlcarousel/owl.carousel.min.js"></script>
<script src="lib/tempusdominus/js/moment.min.js"></script>
<script src="lib/tempusdominus/js/moment-timezone.min.js"></script>
<script src="lib/tempusdominus/js/tempusdominus-bootstrap-4.min.js"></script>
<script src="lib/slick/slick.min.js" type="text/javascript"></script>
<!-- Template Javascript -->
<script src="js/main.js"></script>
</body>
</html> | 55.043902 | 160 | 0.468672 |
acffddcc6e6801a2c87b1c390993b3e74d951687 | 385 | kt | Kotlin | autowired-plugin/src/main/java/com/zyhang/arouter/autowired_plugin/AutowiredContext.kt | izyhang/ARouter-AutowiredTransform | d1cdb9a0c1441a69660afc653cbdfc16e961e3f1 | [
"Apache-2.0"
] | 1 | 2022-03-24T02:01:56.000Z | 2022-03-24T02:01:56.000Z | autowired-plugin/src/main/java/com/zyhang/arouter/autowired_plugin/AutowiredContext.kt | izyhang/ARouter-AutowiredTransform | d1cdb9a0c1441a69660afc653cbdfc16e961e3f1 | [
"Apache-2.0"
] | null | null | null | autowired-plugin/src/main/java/com/zyhang/arouter/autowired_plugin/AutowiredContext.kt | izyhang/ARouter-AutowiredTransform | d1cdb9a0c1441a69660afc653cbdfc16e961e3f1 | [
"Apache-2.0"
] | 1 | 2020-11-24T06:37:44.000Z | 2020-11-24T06:37:44.000Z | package com.zyhang.arouter.autowired_plugin
import com.android.build.gradle.AppExtension
import com.ss.android.ugc.bytex.common.BaseContext
import org.gradle.api.Project
/**
* Created by zyhang on 2020/11/24.09:44
*/
class AutowiredContext(project: Project?, android: AppExtension?, extension: AutowiredExtension?) :
BaseContext<AutowiredExtension>(project, android, extension) | 35 | 99 | 0.8 |
b820e406417c4e475535431186c1e18106733858 | 394 | dart | Dart | krishworks_assignment/lib/features/core/widgets/button.dart | DetainedDeveloper/KrishWorksAssignment | 72dec0b246c5d5f25601ecfcebd036a860f2b146 | [
"MIT"
] | null | null | null | krishworks_assignment/lib/features/core/widgets/button.dart | DetainedDeveloper/KrishWorksAssignment | 72dec0b246c5d5f25601ecfcebd036a860f2b146 | [
"MIT"
] | null | null | null | krishworks_assignment/lib/features/core/widgets/button.dart | DetainedDeveloper/KrishWorksAssignment | 72dec0b246c5d5f25601ecfcebd036a860f2b146 | [
"MIT"
] | null | null | null | import 'package:flutter/material.dart';
class Button extends StatelessWidget {
final String title;
final void Function()? onPressed;
const Button({
Key? key,
required this.title,
required this.onPressed,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return ElevatedButton(
child: Text(title),
onPressed: onPressed,
);
}
}
| 18.761905 | 39 | 0.667513 |
04d722d71f43445f57484251f0946b42a7043af0 | 1,392 | java | Java | src/com/mighty16/json/core/LanguageResolver.java | Mighty16/JSONToKotlinClass | 945738c377ad6ac93d4059ffd667ba59900f69da | [
"MIT"
] | 145 | 2018-02-07T19:06:22.000Z | 2022-02-28T12:40:19.000Z | src/com/mighty16/json/core/LanguageResolver.java | sunshuai212/JSONToKotlinClass | c5d571331db3098d9965f868bf305ccdb38520e6 | [
"MIT"
] | 6 | 2018-02-06T08:16:09.000Z | 2021-12-14T10:53:38.000Z | src/com/mighty16/json/core/LanguageResolver.java | sunshuai212/JSONToKotlinClass | c5d571331db3098d9965f868bf305ccdb38520e6 | [
"MIT"
] | 15 | 2017-12-04T10:33:33.000Z | 2021-07-31T01:53:20.000Z | package com.mighty16.json.core;
import com.mighty16.json.core.models.FieldModel;
public abstract class LanguageResolver {
public static final String TYPE_INTEGER = "Integer";
public static final String TYPE_LONG = "Long";
public static final String TYPE_STRING = "String";
public static final String TYPE_DOUBLE = "Double";
public static final String TYPE_BOOLEAN = "Boolean";
public abstract String resolve(String javaType);
public abstract String getClassName(String jsonKey);
public abstract String getFieldName(String jsonKey);
public abstract String getDefaultValue(String type);
public abstract String getArrayType(String type);
public abstract String getArrayOriginalValue();
public abstract String getObjectOriginalValue();
public abstract String getArrayItemOriginalValue(String type);
public abstract String getModifier(boolean mutable);
public abstract String getFieldTypeAndValue(FieldModel field);
public abstract boolean isModifierMutable(String modifier);
public abstract String getFileName(String className);
public int getNoCharPosition(String name) {
char[] chars = name.toCharArray();
int pos = 0;
for (char c : chars) {
if (!Character.isLetter(c)) {
return pos;
}
pos++;
}
return -1;
}
}
| 28.408163 | 66 | 0.700431 |
47eb5b914d80e6c68f637039b591772f0ee43abd | 835 | css | CSS | src/app/components/home/home.component.css | sushant-kum/aboutme-angular | b71057ad6a09c4bdfb9c32ba41eb5145d13731fb | [
"MIT"
] | null | null | null | src/app/components/home/home.component.css | sushant-kum/aboutme-angular | b71057ad6a09c4bdfb9c32ba41eb5145d13731fb | [
"MIT"
] | 20 | 2019-10-02T15:01:38.000Z | 2022-03-02T03:22:11.000Z | src/app/components/home/home.component.css | sushant-kum/aboutme-angular | b71057ad6a09c4bdfb9c32ba41eb5145d13731fb | [
"MIT"
] | null | null | null | #about-me-parallax,
#about-me,
#my-work-parallax,
#my-work {
font-family: Arial, sans-serif;
/* height: 100%; */
/* color: #707070;
line-height: 1.8; */
}
#header-logo {
height: 53px;
cursor: pointer;
}
/* Create a Parallax Effect */
.bgimg-1,
.bgimg-2 {
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
/* First image (Logo. Full height) */
.bgimg-1 {
background-image: url('/assets/images/bg/about-me-rainy-foggy-min.jpg');
min-height: 100vh;
}
/* Second image (Portfolio) */
.bgimg-2 {
background-image: url('/assets/images/bg/portfolio-rainy-foggy-min.jpg');
min-height: 400px;
}
#profile-img {
width: 100%;
max-width: 175px;
}
/* .rating .rating-bar {
position: absolute;
}
.rating .rating-star {
z-index: 100;
} */
| 17.395833 | 75 | 0.645509 |
af5a8f84042e4e7405eea10bdb0ad775681da6e8 | 1,083 | dart | Dart | lib/pretty.printer.dart | cesarferreira/fpm | 9394f86f4f08224a1179b36742b972efd99f2214 | [
"MIT"
] | 4 | 2020-06-28T15:05:21.000Z | 2021-12-01T03:15:27.000Z | lib/pretty.printer.dart | cesarferreira/fpm | 9394f86f4f08224a1179b36742b972efd99f2214 | [
"MIT"
] | null | null | null | lib/pretty.printer.dart | cesarferreira/fpm | 9394f86f4f08224a1179b36742b972efd99f2214 | [
"MIT"
] | null | null | null | import 'package:ansicolor/ansicolor.dart';
import 'package:fpm/package.dart';
class PrettyPrinter {
static void printLongVersion(List<Package> packages) {
var pen = AnsiPen()..green(bold: true);
var gr = AnsiPen()..gray();
packages.forEach((it) {
print(pen('-> ${it.title} (${it.version})'));
print(' ${it.description}');
print(' - Score: ${it.score}');
print(' - Homepage: ${it.url}');
print(' - Last updated: ${it.updatedAt}');
// print('\n');
print(gr(' dependencies:'));
print(gr(' ${it.title}: ${it.version}'));
print('\n');
});
}
static void printShortVersion(List<Package> packages) {
var pen = AnsiPen()..green(bold: true);
packages.forEach((it) {
print(pen('${it.title}:') +
' (${it.version}) - ${it.description}'); // (updated at: ${it.updatedAt})
});
}
static void displayPackages(List<Package> packages, bool isVerbose) {
if (isVerbose) {
printLongVersion(packages);
} else {
printShortVersion(packages);
}
}
}
| 27.769231 | 84 | 0.562327 |
164430652a82e832ad4816b6e72dc8a1e1d6623f | 2,052 | h | C | OnePointFramework_Lite.framework/Headers/OPGPanel.h | manju3157/OnePointOnlineFramework | 74974fd78b4a7bd4661e145ab2b3a2115c697d90 | [
"MIT"
] | 1 | 2017-09-06T06:24:02.000Z | 2017-09-06T06:24:02.000Z | OnePointFramework_Lite.framework/Headers/OPGPanel.h | manju3157/OnePointOnlineFramework | 74974fd78b4a7bd4661e145ab2b3a2115c697d90 | [
"MIT"
] | 12 | 2019-10-14T10:29:55.000Z | 2020-04-23T10:52:13.000Z | include/OPGSDK/OPGPanel.h | isabella232/OPGFeedbackSDKLite | b31f544a019c3e739100f45f013517484d329999 | [
"MIT"
] | 2 | 2017-09-07T10:05:49.000Z | 2022-03-17T08:46:28.000Z | //
// OPGPanel.h
// OnePointSDK
//
// Created by OnePoint Global on 04/08/16.
// Copyright © 2016 OnePointGlobal. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface OPGPanel : NSObject<NSCoding>
/*!
* @brief panelID : panel ID
*/
@property(nonatomic,strong) NSNumber *panelID;
/*!
* @brief themeTemplateID : theme template ID
*/
@property(nonatomic,strong) NSNumber *themeTemplateID;
/*!
* @brief themeTemplateIDSpecified : bool value of true indicates specified and false indicates it is not specified.
*/
@property(nonatomic,strong) NSNumber *themeTemplateIDSpecified;
/*!
* @brief panelName : panelName
*/
@property(nonatomic,strong) NSString *panelName;
/*!
* @brief description : description
*/
@property(nonatomic,strong) NSString *panelDescription;
/*!
* @brief panelType : 1 indicates Normal and 2 indicates CAPI
*/
@property(nonatomic,strong) NSNumber *panelType;
/*!
* @brief searchTag : search tag
*/
@property(nonatomic,strong) NSString *searchTag;
/*!
* @brief remark : remark
*/
@property(nonatomic,strong) NSString *remark;
/*!
* @brief isDeleted : bool value of true indicates deleted and false indicates not deleted. */
@property(nonatomic,strong) NSNumber *isDeleted;
/*!
* @brief createdDate : created date
*/
@property(nonatomic,strong) NSDate *createdDate;
/*!
* @brief lastUpdatedDate : last updated date
*/
@property(nonatomic,strong) NSDate *lastUpdatedDate;
/*!
* @brief userID : user ID
*/
@property(nonatomic,strong) NSNumber *userID;
/*!
* @brief mediaUrl : URL for the panel media
*/
@property(nonatomic,strong) NSString *mediaUrl;
/*!
* @brief mediaUrl : URL for the panel logo
*/
@property(nonatomic,strong) NSString *logoUrl;
/*!
* @brief mediaID : media ID
*/
@property(nonatomic,strong) NSNumber *mediaID;
/*!
* @brief logoID : logo ID
*/
@property(nonatomic,strong) NSNumber *logoID;
/*!
* @brief mediaIDSpecified : bool value of true indicates specified and false indicates it is not specified.
*/
@property(nonatomic,strong) NSNumber *mediaIDSpecified;
@end
| 25.65 | 116 | 0.723197 |
a48badbf2fa554e64cdee41f26ddfda8159b6288 | 16,279 | dart | Dart | dart_stopwatch/web/packages/polymer/src/build/linter.dart | steveklewis/javascript | 2007928bb2bcd548e59c982ccafca9d0bdcd18a1 | [
"Apache-2.0"
] | 1 | 2015-02-10T03:50:43.000Z | 2015-02-10T03:50:43.000Z | dart_stopwatch/web/packages/polymer/src/build/linter.dart | steveklewis/javascript | 2007928bb2bcd548e59c982ccafca9d0bdcd18a1 | [
"Apache-2.0"
] | null | null | null | dart_stopwatch/web/packages/polymer/src/build/linter.dart | steveklewis/javascript | 2007928bb2bcd548e59c982ccafca9d0bdcd18a1 | [
"Apache-2.0"
] | null | null | null | // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// Logic to validate that developers are correctly using Polymer constructs.
/// This is mainly used to produce warnings for feedback in the editor.
library polymer.src.build.linter;
import 'dart:async';
import 'package:barback/barback.dart';
import 'package:code_transformers/assets.dart';
import 'package:html5lib/dom.dart';
import 'package:html5lib/dom_parsing.dart';
import 'package:source_maps/span.dart';
import 'common.dart';
import 'utils.dart';
/// A linter that checks for common Polymer errors and produces warnings to
/// show on the editor or the command line. Leaves sources unchanged, but
/// creates a new asset containing all the warnings.
class Linter extends Transformer with PolymerTransformer {
final TransformOptions options;
/// Only run on .html files.
final String allowedExtensions = '.html';
Linter(this.options);
Future apply(Transform transform) {
var seen = new Set<AssetId>();
var primary = transform.primaryInput;
var id = primary.id;
transform.addOutput(primary); // this phase is analysis only
seen.add(id);
return readPrimaryAsHtml(transform).then((document) {
return _collectElements(document, id, transform, seen).then((elements) {
bool isEntrypoint = options.isHtmlEntryPoint(id);
new _LinterVisitor(id, transform.logger, elements, isEntrypoint)
.run(document);
});
});
}
/// Collect into [elements] any data about each polymer-element defined in
/// [document] or any of it's imports, unless they have already been [seen].
/// Elements are added in the order they appear, transitive imports are added
/// first.
Future<Map<String, _ElementSummary>> _collectElements(
Document document, AssetId sourceId, Transform transform,
Set<AssetId> seen, [Map<String, _ElementSummary> elements]) {
if (elements == null) elements = <String, _ElementSummary>{};
return _getImportedIds(document, sourceId, transform)
// Note: the import order is relevant, so we visit in that order.
.then((ids) => Future.forEach(ids,
(id) => _readAndCollectElements(id, transform, seen, elements)))
.then((_) {
if (sourceId.package == 'polymer' &&
sourceId.path == 'lib/src/js/polymer/polymer.html' &&
elements['polymer-element'] == null) {
elements['polymer-element'] =
new _ElementSummary('polymer-element', null, null);
}
return _addElements(document, transform.logger, elements);
})
.then((_) => elements);
}
Future _readAndCollectElements(AssetId id, Transform transform,
Set<AssetId> seen, Map<String, _ElementSummary> elements) {
if (id == null || seen.contains(id)) return new Future.value(null);
seen.add(id);
return readAsHtml(id, transform, showWarnings: false).then(
(doc) => _collectElements(doc, id, transform, seen, elements));
}
Future<List<AssetId>> _getImportedIds(
Document document, AssetId sourceId, Transform transform) {
var importIds = [];
var logger = transform.logger;
for (var tag in document.querySelectorAll('link')) {
if (tag.attributes['rel'] != 'import') continue;
var href = tag.attributes['href'];
var span = tag.sourceSpan;
var id = uriToAssetId(sourceId, href, logger, span);
if (id == null) continue;
importIds.add(assetExists(id, transform).then((exists) {
if (exists) return id;
if (sourceId == transform.primaryInput.id) {
logger.warning('couldn\'t find imported asset "${id.path}" in package'
' "${id.package}".', span: span);
}
}));
}
return Future.wait(importIds);
}
void _addElements(Document document, TransformLogger logger,
Map<String, _ElementSummary> elements) {
for (var tag in document.querySelectorAll('polymer-element')) {
var name = tag.attributes['name'];
if (name == null) continue;
var extendsTag = tag.attributes['extends'];
var span = tag.sourceSpan;
var existing = elements[name];
if (existing != null) {
// Report warning only once.
if (existing.hasConflict) continue;
existing.hasConflict = true;
logger.warning('duplicate definition for custom tag "$name".',
span: existing.span);
logger.warning('duplicate definition for custom tag "$name" '
' (second definition).', span: span);
continue;
}
elements[name] = new _ElementSummary(name, extendsTag, tag.sourceSpan);
}
}
}
/// Information needed about other polymer-element tags in order to validate
/// how they are used and extended.
///
/// Note: these are only created for polymer-element, because pure custom
/// elements don't have a declarative form.
class _ElementSummary {
final String tagName;
final String extendsTag;
final Span span;
_ElementSummary extendsType;
bool hasConflict = false;
String get baseExtendsTag {
if (extendsType != null) return extendsType.baseExtendsTag;
if (extendsTag != null && !extendsTag.contains('-')) return extendsTag;
return null;
}
_ElementSummary(this.tagName, this.extendsTag, this.span);
String toString() => "($tagName <: $extendsTag)";
}
class _LinterVisitor extends TreeVisitor {
TransformLogger _logger;
AssetId _sourceId;
bool _inPolymerElement = false;
bool _dartTagSeen = false;
bool _polymerHtmlSeen = false;
bool _polymerExperimentalHtmlSeen = false;
bool _isEntrypoint;
Map<String, _ElementSummary> _elements;
_LinterVisitor(
this._sourceId, this._logger, this._elements, this._isEntrypoint) {
// We normalize the map, so each element has a direct reference to any
// element it extends from.
for (var tag in _elements.values) {
var extendsTag = tag.extendsTag;
if (extendsTag == null) continue;
tag.extendsType = _elements[extendsTag];
}
}
void visitElement(Element node) {
switch (node.localName) {
case 'link': _validateLinkElement(node); break;
case 'element': _validateElementElement(node); break;
case 'polymer-element': _validatePolymerElement(node); break;
case 'script': _validateScriptElement(node); break;
default:
_validateNormalElement(node);
super.visitElement(node);
break;
}
}
void run(Document doc) {
visit(doc);
if (_isEntrypoint && !_dartTagSeen && !_polymerExperimentalHtmlSeen) {
_logger.warning(USE_INIT_DART, span: doc.body.sourceSpan);
}
}
/// Produce warnings for invalid link-rel tags.
void _validateLinkElement(Element node) {
var rel = node.attributes['rel'];
if (rel != 'import' && rel != 'stylesheet') return;
if (rel == 'import' && _dartTagSeen) {
_logger.warning("Move HTML imports above your Dart script tag.",
span: node.sourceSpan);
}
var href = node.attributes['href'];
if (href == null || href == '') {
_logger.warning('link rel="$rel" missing href.', span: node.sourceSpan);
return;
}
if (rel != 'import') return;
if (_inPolymerElement) {
_logger.error(NO_IMPORT_WITHIN_ELEMENT, span: node.sourceSpan);
return;
}
if (href == POLYMER_EXPERIMENTAL_HTML) {
_polymerExperimentalHtmlSeen = true;
}
// TODO(sigmund): warn also if href can't be resolved.
}
/// Produce warnings if using `<element>` instead of `<polymer-element>`.
void _validateElementElement(Element node) {
_logger.warning('<element> elements are not supported, use'
' <polymer-element> instead', span: node.sourceSpan);
}
/// Produce warnings if using `<polymer-element>` in the wrong place or if the
/// definition is not complete.
void _validatePolymerElement(Element node) {
if (!_elements.containsKey('polymer-element')) {
_logger.warning(usePolymerHtmlMessageFrom(_sourceId),
span: node.sourceSpan);
}
if (_inPolymerElement) {
_logger.error('Nested polymer element definitions are not allowed.',
span: node.sourceSpan);
return;
}
var tagName = node.attributes['name'];
var extendsTag = node.attributes['extends'];
if (tagName == null) {
_logger.error('Missing tag name of the custom element. Please include an '
'attribute like \'name="your-tag-name"\'.',
span: node.sourceSpan);
} else if (!isCustomTagName(tagName)) {
_logger.error('Invalid name "$tagName". Custom element names must have '
'at least one dash and can\'t be any of the following names: '
'${invalidTagNames.keys.join(", ")}.',
span: node.sourceSpan);
}
if (_elements[extendsTag] == null && isCustomTagName(extendsTag)) {
_logger.warning('custom element with name "$extendsTag" not found.',
span: node.sourceSpan);
}
var attrs = node.attributes['attributes'];
if (attrs != null) {
var attrsSpan = node.attributeSpans['attributes'];
// names='a b c' or names='a,b,c'
// record each name for publishing
for (var attr in attrs.split(ATTRIBUTES_REGEX)) {
if (!_validateCustomAttributeName(attr.trim(), attrsSpan)) break;
}
}
var oldValue = _inPolymerElement;
_inPolymerElement = true;
super.visitElement(node);
_inPolymerElement = oldValue;
}
/// Checks for multiple Dart script tags in the same page, which is invalid.
void _validateScriptElement(Element node) {
var scriptType = node.attributes['type'];
var isDart = scriptType == 'application/dart';
var src = node.attributes['src'];
if (isDart) {
if (_dartTagSeen) _logger.warning(ONLY_ONE_TAG, span: node.sourceSpan);
if (_isEntrypoint && _polymerExperimentalHtmlSeen) {
_logger.warning(NO_DART_SCRIPT_AND_EXPERIMENTAL, span: node.sourceSpan);
}
_dartTagSeen = true;
}
var isEmpty = node.innerHtml.trim() == '';
if (src == null) {
if (isDart && isEmpty) {
_logger.warning('script tag seems empty.', span: node.sourceSpan);
}
return;
}
if (src.endsWith('.dart') && !isDart) {
_logger.warning('Wrong script type, expected type="application/dart".',
span: node.sourceSpan);
return;
}
if (!src.endsWith('.dart') && isDart) {
_logger.warning('"application/dart" scripts should use the .dart file '
'extension.', span: node.sourceSpan);
return;
}
if (!isEmpty) {
_logger.warning('script tag has "src" attribute and also has script '
'text.', span: node.sourceSpan);
}
}
/// Produces warnings for misuses of on-foo event handlers, and for instanting
/// custom tags incorrectly.
void _validateNormalElement(Element node) {
// Event handlers only allowed inside polymer-elements
node.attributes.forEach((name, value) {
if (name is String && name.startsWith('on')) {
_validateEventHandler(node, name, value);
}
});
// Validate uses of custom-tags
var nodeTag = node.localName;
var hasIsAttribute;
var customTagName;
if (isCustomTagName(nodeTag)) {
// <fancy-button>
customTagName = nodeTag;
hasIsAttribute = false;
} else {
// <button is="fancy-button">
customTagName = node.attributes['is'];
hasIsAttribute = true;
}
if (customTagName == null ||
INTERNALLY_DEFINED_ELEMENTS.contains(customTagName)) {
return;
}
var info = _elements[customTagName];
if (info == null) {
// TODO(jmesserly): this warning is wrong if someone is using raw custom
// elements. Is there another way we can handle this warning that won't
// generate false positives?
_logger.warning('definition for Polymer element with tag name '
'"$customTagName" not found.', span: node.sourceSpan);
return;
}
var baseTag = info.baseExtendsTag;
if (baseTag != null && !hasIsAttribute) {
_logger.warning(
'custom element "$customTagName" extends from "$baseTag", but '
'this tag will not include the default properties of "$baseTag". '
'To fix this, either write this tag as <$baseTag '
'is="$customTagName"> or remove the "extends" attribute from '
'the custom element declaration.', span: node.sourceSpan);
return;
}
if (hasIsAttribute && baseTag == null) {
_logger.warning(
'custom element "$customTagName" doesn\'t declare any type '
'extensions. To fix this, either rewrite this tag as '
'<$customTagName> or add \'extends="$nodeTag"\' to '
'the custom element declaration.', span: node.sourceSpan);
return;
}
if (hasIsAttribute && baseTag != nodeTag) {
_logger.warning(
'custom element "$customTagName" extends from "$baseTag". '
'Did you mean to write <$baseTag is="$customTagName">?',
span: node.sourceSpan);
}
}
/// Validate an attribute on a custom-element. Returns true if valid.
bool _validateCustomAttributeName(String name, FileSpan span) {
if (name.contains('-')) {
var newName = toCamelCase(name);
_logger.warning('PolymerElement no longer recognizes attribute names with '
'dashes such as "$name". Use "$newName" or "${newName.toLowerCase()}" '
'instead (both forms are equivalent in HTML).', span: span);
return false;
}
return true;
}
/// Validate event handlers are used correctly.
void _validateEventHandler(Element node, String name, String value) {
if (!name.startsWith('on-')) return;
if (!_inPolymerElement) {
_logger.warning('Inline event handlers are only supported inside '
'declarations of <polymer-element>.',
span: node.attributeSpans[name]);
return;
}
// Valid bindings have {{ }}, don't look like method calls foo(bar), and are
// non empty.
if (!value.startsWith("{{") || !value.endsWith("}}") || value.contains('(')
|| value.substring(2, value.length - 2).trim() == '') {
_logger.warning('Invalid event handler body "$value". Declare a method '
'in your custom element "void handlerName(event, detail, target)" '
'and use the form $name="{{handlerName}}".',
span: node.attributeSpans[name]);
}
}
}
const String ONLY_ONE_TAG =
'Only one "application/dart" script tag per document is allowed.';
String usePolymerHtmlMessageFrom(AssetId id) {
var segments = id.path.split('/');
var upDirCount = 0;
if (segments[0] == 'lib') {
// lib/foo.html => ../../packages/
upDirCount = segments.length;
} else if (segments.length > 2) {
// web/a/foo.html => ../packages/
upDirCount = segments.length - 2;
}
return usePolymerHtmlMessage(upDirCount);
}
String usePolymerHtmlMessage(int upDirCount) {
var reachOutPrefix = '../' * upDirCount;
return 'Missing definition for <polymer-element>, please add the following '
'HTML import at the top of this file: <link rel="import" '
'href="${reachOutPrefix}packages/polymer/polymer.html">.';
}
const String NO_IMPORT_WITHIN_ELEMENT = 'Polymer.dart\'s implementation of '
'HTML imports are not supported within polymer element definitions, yet. '
'Please move the import out of this <polymer-element>.';
const String USE_INIT_DART =
'To run a polymer application, you need to call "initPolymer". You can '
'either include a generic script tag that does this for you:'
'\'<script type="application/dart">export "package:polymer/init.dart";'
'</script>\' or add your own script tag and call that function. '
'Make sure the script tag is placed after all HTML imports.';
const String NO_DART_SCRIPT_AND_EXPERIMENTAL =
'The experimental bootstrap feature doesn\'t support script tags on '
'the main document (for now).';
const List<String> INTERNALLY_DEFINED_ELEMENTS =
const ['auto-binding-dart', 'polymer-element']; | 35.466231 | 81 | 0.654586 |
e57383b3d40d4db4cc8d76a77c7da2c041ef24f6 | 971 | ts | TypeScript | src/app/main/lifecycle/lifecycle.component.ts | shivanshsinghraghuvanshi/softbook | 32ad7e582676aea7386c343c7e0e3c54a4755381 | [
"MIT"
] | null | null | null | src/app/main/lifecycle/lifecycle.component.ts | shivanshsinghraghuvanshi/softbook | 32ad7e582676aea7386c343c7e0e3c54a4755381 | [
"MIT"
] | 5 | 2020-01-14T15:13:29.000Z | 2022-02-18T18:04:43.000Z | src/app/main/lifecycle/lifecycle.component.ts | shivanshsinghraghuvanshi/softbook | 32ad7e582676aea7386c343c7e0e3c54a4755381 | [
"MIT"
] | null | null | null | import { Component, OnInit } from "@angular/core";
@Component({
selector: "softbook-lifecycle",
templateUrl: "./lifecycle.component.html",
styleUrls: ["./lifecycle.component.scss"]
})
export class LifecycleComponent implements OnInit {
data: number = 100;
constructor() {
console.log(`new - data is ${this.data}`);
}
ngOnChanges() {
console.log(`ngOnChanges - data is ${this.data}`);
}
ngOnInit() {
console.log(`ngOnInit - data is ${this.data}`);
}
ngDoCheck() {
console.log("ngDoCheck");
}
ngAfterContentInit() {
console.log("ngAfterContentInit");
}
ngAfterContentChecked() {
console.log("ngAfterContentChecked");
}
ngAfterViewInit() {
console.log("ngAfterViewInit");
}
ngAfterViewChecked() {
console.log("ngAfterViewChecked");
}
ngOnDestroy() {
console.log("ngOnDestroy");
}
fnAddNumber(): void {
this.data += 100;
}
deleteNumber(): void {
this.data -= 10;
}
}
| 17.981481 | 54 | 0.630278 |
85f96e010a37e7d8b9f16bd9042de8bee9ab1def | 18,054 | h | C | DYAvoidCrash/Swizzling/DYSwizzling.h | ZeroDY/DYAvoidCrashDemo | b440615592643908a4351363875c4d08dff0f151 | [
"MIT"
] | null | null | null | DYAvoidCrash/Swizzling/DYSwizzling.h | ZeroDY/DYAvoidCrashDemo | b440615592643908a4351363875c4d08dff0f151 | [
"MIT"
] | null | null | null | DYAvoidCrash/Swizzling/DYSwizzling.h | ZeroDY/DYAvoidCrashDemo | b440615592643908a4351363875c4d08dff0f151 | [
"MIT"
] | null | null | null | //
// DYSwizzling.h
// ZDY
//
// Created by ZDY on 2019/3/26.
// Copyright © 2019年 ZDY All rights reserved.
//
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
#import "DYMetamacros.h"
#define DYForOCString(_) @#_
#define DYSEL2Str(_) NSStringFromSelector(_)
#define FOREACH_ARGS(MACRO, ...) \
metamacro_if_eq(1,metamacro_argcount(__VA_ARGS__)) \
() \
(metamacro_foreach(MACRO , , metamacro_tail(__VA_ARGS__))) \
#define CREATE_ARGS_DELETE_PAREN(VALUE) ,VALUE
#define CREATE_ARGS(INDEX,VALUE) CREATE_ARGS_DELETE_PAREN VALUE
#define __CREATE_ARGS_DELETE_PAREN(...) \
[type appendFormat:@"%s",@encode(metamacro_head(__VA_ARGS__))];
#define CRATE_TYPE_CODING_DEL_VAR(TYPE) TYPE ,
#define CRATE_TYPE_CODING(INDEX,VALUE) \
__CREATE_ARGS_DELETE_PAREN(CRATE_TYPE_CODING_DEL_VAR VALUE)
#define __DYHookType__void ,
#define __DYHookTypeIsVoidType(...) \
metamacro_if_eq(metamacro_argcount(__VA_ARGS__),2)
#define DYHookTypeIsVoidType(TYPE) \
__DYHookTypeIsVoidType(__DYHookType__ ## TYPE)
// 调用原始函数
#define DYHookOrgin(...) \
__dy_hook_orgin_function \
?__dy_hook_orgin_function(self,__dyHookSel,##__VA_ARGS__) \
:((typeof(__dy_hook_orgin_function))(class_getMethodImplementation(__dyHookSuperClass,__dyHookSel)))(self,__dyHookSel,##__VA_ARGS__)
// 生成真实调用函数
#define __DYHookClassBegin(theHookClass, \
notWorkSubClass, \
addMethod, \
returnValue, \
returnType, \
theSEL, \
theSelfTypeAndVar, \
...) \
\
static char associatedKey; \
__unused Class __dyHookClass = avoid_hook_getClassFromObject(theHookClass); \
__unused Class __dyHookSuperClass = class_getSuperclass(__dyHookClass); \
__unused SEL __dyHookSel = theSEL; \
if (nil == __dyHookClass \
|| objc_getAssociatedObject(__dyHookClass, &associatedKey)) \
{ \
return NO; \
} \
metamacro_if_eq(addMethod,1) \
( \
if (!class_respondsToSelector(__dyHookClass,__dyHookSel)) \
{ \
id _emptyBlock = ^returnType(id self \
FOREACH_ARGS(CREATE_ARGS,1,##__VA_ARGS__ )) \
{ \
Method method = class_getInstanceMethod(__dyHookSuperClass,__dyHookSel); \
if (method) \
{ \
__unused \
returnType(*superFunction)(theSelfTypeAndVar, \
SEL _cmd \
FOREACH_ARGS(CREATE_ARGS,1,##__VA_ARGS__ )) \
= (void*)method_getImplementation(method); \
DYHookTypeIsVoidType(returnType) \
() \
(return ) \
superFunction(self,__dyHookSel,##__VA_ARGS__); \
} \
else \
{ \
DYHookTypeIsVoidType(returnType) \
(return;) \
(return returnValue;) \
} \
}; \
NSMutableString *type = [[NSMutableString alloc] init]; \
[type appendFormat:@"%s@:", @encode(returnType)]; \
FOREACH_ARGS(CRATE_TYPE_CODING,1,##__VA_ARGS__ ) \
class_addMethod(__dyHookClass, \
theSEL, \
(IMP)imp_implementationWithBlock(_emptyBlock), \
type.UTF8String); \
} \
) \
() \
if (!class_respondsToSelector(__dyHookClass,__dyHookSel)) \
{ \
return NO; \
} \
__block __unused \
returnType(*__dy_hook_orgin_function)(theSelfTypeAndVar, \
SEL _cmd \
FOREACH_ARGS(CREATE_ARGS,1,##__VA_ARGS__ )) \
= NULL; \
id newImpBlock = \
^returnType(theSelfTypeAndVar FOREACH_ARGS(CREATE_ARGS,1,##__VA_ARGS__ )) { \
metamacro_if_eq(notWorkSubClass,1) \
(if (!avoid_hook_check_block(object_getClass(self),__dyHookClass,&associatedKey)) \
{ \
DYHookTypeIsVoidType(returnType) \
(DYHookOrgin(__VA_ARGS__ ); return;) \
(return DYHookOrgin(__VA_ARGS__ );) \
}) \
() \
#define __dyHookClassEnd \
}; \
objc_setAssociatedObject(__dyHookClass, \
&associatedKey, \
[newImpBlock copy], \
OBJC_ASSOCIATION_RETAIN_NONATOMIC); \
__dy_hook_orgin_function = avoid_hook_imp_function(__dyHookClass, \
__dyHookSel, \
imp_implementationWithBlock(newImpBlock)); \
\
// 拦截静态类 私有
#define __DYStaticHookClass(theCFunctionName,theHookClassType,selfType,GroupName,returnType,theSEL,... ) \
static BOOL theCFunctionName (); \
static void* metamacro_concat(theCFunctionName, pointer) __attribute__ ((used, section ("__DATA,__sh" # GroupName))) = theCFunctionName; \
static BOOL theCFunctionName () { \
__DYHookClassBegin(theHookClassType, \
0, \
0, \
, \
returnType, \
theSEL, \
selfType self, \
##__VA_ARGS__) \
// 拦截静态类
#define DYStaticHookPrivateClass(theHookClassType,publicType,GroupName,returnType,theSEL,... ) \
__DYStaticHookClass(metamacro_concat(__avoid_hook_auto_load_function_ , __COUNTER__), \
NSClassFromString(@#theHookClassType), \
publicType, \
GroupName, \
returnType, \
theSEL, \
## __VA_ARGS__ ) \
#define DYStaticHookClass(theHookClassType,GroupName,returnType,theSEL,... ) \
__DYStaticHookClass(metamacro_concat(__avoid_hook_auto_load_function_ , __COUNTER__), \
[theHookClassType class], \
theHookClassType*, \
GroupName, \
returnType, \
theSEL, \
## __VA_ARGS__ ) \
#define DYStaticHookMetaClass(theHookClassType,GroupName,returnType,theSEL,... ) \
__DYStaticHookClass(metamacro_concat(__avoid_hook_auto_load_function_ , __COUNTER__), \
object_getClass([theHookClassType class]), \
Class, \
GroupName, \
returnType, \
theSEL, \
## __VA_ARGS__ ) \
#define DYStaticHookPrivateMetaClass(theHookClassType,publicType,GroupName,returnType,theSEL,... ) \
__DYStaticHookClass(metamacro_concat(__avoid_hook_auto_load_function_ , __COUNTER__), \
object_getClass(NSClassFromString(@#theHookClassType)), \
publicType, \
GroupName, \
returnType, \
theSEL, \
## __VA_ARGS__ ) \
#define DYStaticHookEnd __dyHookClassEnd return YES; }
#define DYStaticHookEnd_SaveOri(P) __dyHookClassEnd P = __dy_hook_orgin_function; return YES; } \
#define NSSelectorFromWordsForEach(INDEX,VALUE) \
metamacro_if_eq(metamacro_is_even(INDEX),1) \
(@#VALUE) \
(@"%@")
#define NSSelectorFromWordsForEach2(INDEX,VALUE) \
metamacro_if_eq(metamacro_is_even(INDEX),1) \
() \
(,@#VALUE)
#define NSSelectorFromWords(...) \
NSSelectorFromString( [NSString stringWithFormat:metamacro_foreach(NSSelectorFromWordsForEach,,__VA_ARGS__) \
metamacro_foreach(NSSelectorFromWordsForEach2,,__VA_ARGS__) ])
// 私有 不要手动调用
void * avoid_hook_imp_function(Class clazz,
SEL sel,
void *newFunction);
BOOL avoid_hook_check_block(Class objectClass, Class hookClass,void* associatedKey);
Class avoid_hook_getClassFromObject(id object);
// 启动
void avoid_hook_load_group(NSString* groupName);
BOOL defaultSwizzlingOCMethod(Class self, SEL origSel_, SEL altSel_);
| 79.884956 | 180 | 0.261383 |
9a93616248aa1037e51acd8b3883febab0c648ec | 47 | css | CSS | wicket-jquery-ui-samples/src/main/java/com/googlecode/wicket/jquery/ui/samples/kendoui/scheduler/SingleResourceSchedulerPage.css | solomax/wicket-jquery-ui | 68ba5f6113eac9b5124a978e90f2e5c81d2af279 | [
"Apache-2.0"
] | 54 | 2015-01-13T16:10:08.000Z | 2021-10-06T09:50:54.000Z | wicket-jquery-ui-samples/src/main/java/com/googlecode/wicket/jquery/ui/samples/kendoui/scheduler/SingleResourceSchedulerPage.css | solomax/wicket-jquery-ui | 68ba5f6113eac9b5124a978e90f2e5c81d2af279 | [
"Apache-2.0"
] | 209 | 2015-01-08T01:48:39.000Z | 2022-03-29T12:03:23.000Z | wicket-jquery-ui-samples/src/main/java/com/googlecode/wicket/jquery/ui/samples/kendoui/scheduler/SingleResourceSchedulerPage.css | solomax/wicket-jquery-ui | 68ba5f6113eac9b5124a978e90f2e5c81d2af279 | [
"Apache-2.0"
] | 58 | 2015-01-23T09:49:35.000Z | 2022-02-11T12:02:24.000Z | FORM>.k-multiselect {
display: inline-block
}
| 11.75 | 22 | 0.723404 |
0f76d154749c1be83f9a37e75ff520c9c710eef5 | 361 | kt | Kotlin | data/src/main/java/pe/andres/bairesdev/data/entities/EventsRequestEntity.kt | andres04/bairesdev | 93b5304f6804883ca27e9a8ea150cd039a7f9fa6 | [
"Apache-2.0"
] | null | null | null | data/src/main/java/pe/andres/bairesdev/data/entities/EventsRequestEntity.kt | andres04/bairesdev | 93b5304f6804883ca27e9a8ea150cd039a7f9fa6 | [
"Apache-2.0"
] | null | null | null | data/src/main/java/pe/andres/bairesdev/data/entities/EventsRequestEntity.kt | andres04/bairesdev | 93b5304f6804883ca27e9a8ea150cd039a7f9fa6 | [
"Apache-2.0"
] | null | null | null | package pe.andres.bairesdev.domain.dtos
data class EventsRequestEntity(
val startDate: String,
val endDate: String,
val includeSuggested: String){
companion object {
fun toEntity(dto: EventsRequestDTO): EventsRequestEntity{
return EventsRequestEntity(dto.startDate, dto.endDate, dto.includeSuggested)
}
}
}
| 20.055556 | 88 | 0.695291 |
26f42c5349e326d5c57f989f8b1e8982c1779ee9 | 2,214 | swift | Swift | ReaderSDKSample/Convenience/TextField.swift | GLMBC/reader-sdk-ios-quickstart | 81cc3a8a8c06582882602f88f4f42188d8486d19 | [
"Apache-2.0"
] | 14 | 2018-08-02T15:34:15.000Z | 2020-12-18T07:37:17.000Z | ReaderSDKSample/Convenience/TextField.swift | GLMBC/reader-sdk-ios-quickstart | 81cc3a8a8c06582882602f88f4f42188d8486d19 | [
"Apache-2.0"
] | 11 | 2018-08-14T08:12:05.000Z | 2022-02-20T18:55:34.000Z | ReaderSDKSample/Convenience/TextField.swift | GLMBC/reader-sdk-ios-quickstart | 81cc3a8a8c06582882602f88f4f42188d8486d19 | [
"Apache-2.0"
] | 3 | 2019-07-31T23:55:57.000Z | 2020-11-15T16:30:09.000Z | //
// Copyright © 2018 Square, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import UIKit
class TextField: UITextField {
struct Color {
static let background = #colorLiteral(red: 0.3247028589, green: 0.6497831941, blue: 1, alpha: 1)
static let placeholder = UIColor.white.withAlphaComponent(0.5)
static let text = UIColor.white
}
override var placeholder: String? {
didSet {
guard let newValue = placeholder else { return }
accessibilityLabel = newValue
attributedPlaceholder = NSAttributedString(string: newValue, attributes: [
NSAttributedStringKey.foregroundColor: Color.placeholder
])
}
}
override init(frame: CGRect) {
super.init(frame: frame)
font = UIFont.systemFont(ofSize: 20, weight: .regular)
textAlignment = .left
autocorrectionType = .no
backgroundColor = Color.background
tintColor = .white
textColor = Color.text
layer.cornerRadius = 8
layer.masksToBounds = true
let heightConstraint = heightAnchor.constraint(greaterThanOrEqualToConstant: 64)
heightConstraint.priority = UILayoutPriority.defaultHigh
heightConstraint.isActive = true
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func textRect(forBounds bounds: CGRect) -> CGRect {
return bounds.insetBy(dx: 16.0, dy: 10.0)
}
override func editingRect(forBounds bounds: CGRect) -> CGRect {
return textRect(forBounds: bounds)
}
}
| 33.044776 | 104 | 0.652665 |
1d83d075f6a63956508bb331956a45195180d775 | 678 | swift | Swift | App Review/CustomButtonStyles.swift | StewartLynch/AppReview-Completed | cd7117fbef040b16e7a53c4306f969df0c00c60a | [
"MIT"
] | 6 | 2021-03-10T15:18:38.000Z | 2022-03-01T01:04:43.000Z | App Review/CustomButtonStyles.swift | StewartLynch/AppReview-Completed | cd7117fbef040b16e7a53c4306f969df0c00c60a | [
"MIT"
] | null | null | null | App Review/CustomButtonStyles.swift | StewartLynch/AppReview-Completed | cd7117fbef040b16e7a53c4306f969df0c00c60a | [
"MIT"
] | 1 | 2021-04-30T09:35:11.000Z | 2021-04-30T09:35:11.000Z | //
// CustomButtonStyles.swift
// App Review
//
// Created by Stewart Lynch on 2020-11-02.
//
import SwiftUI
struct FilledRoundedCornerButtonStyle: ButtonStyle {
var font: Font = .title2
var padding: CGFloat = 8
var bgColor = Color.blue
var fgColor = Color.white
var cornerRadius: CGFloat = 8
func makeBody(configuration: Configuration) -> some View {
configuration.label
.font(font)
.padding(padding)
.background(bgColor)
.foregroundColor(fgColor)
.cornerRadius(cornerRadius)
.scaleEffect(configuration.isPressed ? 0.9 : 1.0)
.animation(.spring())
}
}
| 25.111111 | 62 | 0.620944 |
26731b92c7ff36da5735a7fce5d2af89f861b007 | 5,097 | kt | Kotlin | app/src/main/java/com/ml/quaterion/spamo/MainActivity.kt | ashutoshongithub25/Fake-and-Fradulent-Call-Detection-Application | f0e4c9dbe74703eb8fab0465ff7263ac11090c1d | [
"Apache-2.0"
] | 1 | 2021-11-19T14:09:40.000Z | 2021-11-19T14:09:40.000Z | app/src/main/java/com/ml/quaterion/spamo/MainActivity.kt | Radhamohan2/Spam-And-Fraud-Call-Detection-Android-Application | 6026a199fb5d0136097ac22b637ca02677349bd0 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/ml/quaterion/spamo/MainActivity.kt | Radhamohan2/Spam-And-Fraud-Call-Detection-Android-Application | 6026a199fb5d0136097ac22b637ca02677349bd0 | [
"Apache-2.0"
] | null | null | null | package com.ml.quaterion.spamo
import android.app.ProgressDialog
import android.content.Intent
import android.os.Bundle
import android.speech.RecognizerIntent
import android.text.Editable
import android.text.TextUtils
import android.util.Log
import android.view.View
import android.widget.EditText
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*
import org.tensorflow.lite.Interpreter
import java.io.FileInputStream
import java.io.IOException
import java.nio.MappedByteBuffer
import java.nio.channels.FileChannel
import java.util.*
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity() {
// Name of TFLite model ( in /assets folder ).
private val MODEL_ASSETS_PATH = "model.tflite"
var gm = "";
// Max Length of input sequence. The input shape for the model will be ( None , INPUT_MAXLEN ).
private val INPUT_MAXLEN = 100
private var tfLiteInterpreter : Interpreter? = null
private fun getSpeechInput()
{
val intent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH)
intent.putExtra(
RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM
)
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE,
Locale.getDefault())
if (intent.resolveActivity(packageManager) != null)
{
startActivityForResult(intent, 100)
} else
{
Toast.makeText(this,
"Your Device Doesn't Support Speech Input",
Toast.LENGTH_SHORT)
.show()
}
}
override fun onActivityResult(requestCode: Int,
resultCode: Int, data: Intent?)
{
super.onActivityResult(requestCode,
resultCode, data)
when (requestCode) {
100 -> if (resultCode == RESULT_OK &&
data != null)
{
val result =
data.
getStringArrayListExtra(
RecognizerIntent.EXTRA_RESULTS)
fun String.toEditable(): Editable = Editable.Factory.getInstance().newEditable(this)
txvResult.text =result[0].toEditable()
}
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
btnSpeak.setOnClickListener(View.OnClickListener {getSpeechInput()})
// Init the classifier.
val classifier = Classifier( this , "word_dict.json" , INPUT_MAXLEN )
// Init TFLiteInterpreter
tfLiteInterpreter = Interpreter( loadModelFile() )
// Start vocab processing, show a ProgressDialog to the user.
val progressDialog = ProgressDialog( this )
progressDialog.setMessage( "Parsing word_dict.json ..." )
progressDialog.setCancelable( false )
progressDialog.show()
classifier.processVocab( object: Classifier.VocabCallback {
override fun onVocabProcessed() {
// Processing done, dismiss the progressDialog.
progressDialog.dismiss()
}
})
classifyButton.setOnClickListener {
val message = txvResult.text.toString().toLowerCase().trim()
Log.i("value",message)
if ( !TextUtils.isEmpty( message ) ){
// Tokenize and pad the given input text.
val tokenizedMessage = classifier.tokenize( message )
val paddedMessage = classifier.padSequence( tokenizedMessage )
val results = classifySequence( paddedMessage )
val class1 = results[0]
// val class2 = results[1]
result_text.text = "SPAM : $class1 "
}
else{
Toast.makeText( this@MainActivity, "Please enter a message.", Toast.LENGTH_LONG).show();
}
}
}
@Throws(IOException::class)
private fun loadModelFile(): MappedByteBuffer {
val assetFileDescriptor = assets.openFd(MODEL_ASSETS_PATH)
val fileInputStream = FileInputStream(assetFileDescriptor.fileDescriptor)
val fileChannel = fileInputStream.channel
val startOffset = assetFileDescriptor.startOffset
val declaredLength = assetFileDescriptor.declaredLength
return fileChannel.map(FileChannel.MapMode.READ_ONLY, startOffset, declaredLength)
}
// Perform inference, given the input sequence.
private fun classifySequence (sequence : IntArray ): FloatArray {
// Input shape -> ( 1 , INPUT_MAXLEN )
val inputs : Array<FloatArray> = arrayOf( sequence.map { it.toFloat() }.toFloatArray() )
// Output shape -> ( 1 , 2 ) ( as numClasses = 2 )
val outputs : Array<FloatArray> = arrayOf( FloatArray( 1 ) )
tfLiteInterpreter?.run( inputs , outputs )
return outputs[0]
}
}
| 35.894366 | 104 | 0.630959 |
584ba1d1dc0cc574ce6b3264641d9f9460ef4cd9 | 501 | h | C | Raven.CppClient/QueryOperationOptions.h | mlawsonca/ravendb-cpp-client | c3a3d4960c8b810156547f62fa7aeb14a121bf74 | [
"MIT"
] | 3 | 2019-04-24T02:34:53.000Z | 2019-08-01T08:22:26.000Z | Raven.CppClient/QueryOperationOptions.h | mlawsonca/ravendb-cpp-client | c3a3d4960c8b810156547f62fa7aeb14a121bf74 | [
"MIT"
] | 2 | 2019-03-21T09:00:02.000Z | 2021-02-28T23:49:26.000Z | Raven.CppClient/QueryOperationOptions.h | mlawsonca/ravendb-cpp-client | c3a3d4960c8b810156547f62fa7aeb14a121bf74 | [
"MIT"
] | 3 | 2019-03-04T11:58:54.000Z | 2021-03-01T00:25:49.000Z | #pragma once
#include <optional>
#include "chrono"
namespace ravendb::client::documents::queries
{
struct QueryOperationOptions
{
std::optional<int32_t> max_ops_per_second{};
bool allow_stale{};
std::optional<std::chrono::milliseconds> stale_timeout{};
bool retrieve_details{};
explicit QueryOperationOptions(std::optional<int32_t> max_ops_per_sec_ = {}, bool allow_stale_ = false,
std::optional<std::chrono::milliseconds> stale_timeout_ = {}, bool retrieve_details_ = false);
};
}
| 27.833333 | 105 | 0.748503 |
5f907a29c2bebe96fc6007d93083cc415c5a1f86 | 522 | h | C | src/GameEngine.h | dritory/Cog6 | a73afc1edbb5e9c0b9f8d97490f65e48aa167a79 | [
"MIT"
] | null | null | null | src/GameEngine.h | dritory/Cog6 | a73afc1edbb5e9c0b9f8d97490f65e48aa167a79 | [
"MIT"
] | null | null | null | src/GameEngine.h | dritory/Cog6 | a73afc1edbb5e9c0b9f8d97490f65e48aa167a79 | [
"MIT"
] | null | null | null | #pragma once
#include <vector>
#include <SFML/Graphics.hpp>
class GameState;
class GameEngine {
public:
~GameEngine();
void Init();
void Unload();
void ChangeState(GameState* state);
void PushState(GameState* state);
void PopState();
void HandleEvents();
void Update();
void Draw();
bool Running() { return m_running; }
void Quit() { m_running = false; }
static GameEngine *Instance();
sf::RenderWindow *window;
private:
// the stack of states
std::vector<GameState*> states;
bool m_running;
}; | 14.5 | 37 | 0.693487 |
53b6591bda840b8aca586345c99b156d4c01fbdf | 280 | java | Java | src/main/java/org/huey/desiginpattern/simplefactory/Apple.java | tjhuey/design-pattern | 391da7197b4f51931702ced9e7b06b654d35d005 | [
"Apache-2.0"
] | null | null | null | src/main/java/org/huey/desiginpattern/simplefactory/Apple.java | tjhuey/design-pattern | 391da7197b4f51931702ced9e7b06b654d35d005 | [
"Apache-2.0"
] | null | null | null | src/main/java/org/huey/desiginpattern/simplefactory/Apple.java | tjhuey/design-pattern | 391da7197b4f51931702ced9e7b06b654d35d005 | [
"Apache-2.0"
] | null | null | null | package org.huey.desiginpattern.simplefactory;
/**
* @param
* @return
* @description 具体角色
* @author: xiaoying@hexindai.com V1.0 2018/1/5 15:16
*/
public class Apple implements Fruit {
public void getName() {
System.out.println("Apple-------->getName");
}
}
| 18.666667 | 53 | 0.646429 |
98b1e4e5447bd5bfa8ac01ec1afcb477364b34c6 | 17,535 | html | HTML | docs/docsets/.docset/Contents/Resources/Documents/Classes/MongoClient.html | zeionara/Perfect-MongoDB | aeff06cd4b776c6cb5c29e6feacf23e8a8658776 | [
"ECL-2.0",
"Apache-2.0"
] | 64 | 2016-05-12T05:26:04.000Z | 2022-01-29T15:19:17.000Z | docs/docsets/.docset/Contents/Resources/Documents/Classes/MongoClient.html | zeionara/Perfect-MongoDB | aeff06cd4b776c6cb5c29e6feacf23e8a8658776 | [
"ECL-2.0",
"Apache-2.0"
] | 16 | 2016-05-11T14:23:07.000Z | 2020-09-26T08:54:38.000Z | docs/docsets/.docset/Contents/Resources/Documents/Classes/MongoClient.html | zeionara/Perfect-MongoDB | aeff06cd4b776c6cb5c29e6feacf23e8a8658776 | [
"ECL-2.0",
"Apache-2.0"
] | 40 | 2016-05-06T01:04:59.000Z | 2022-01-29T15:19:22.000Z | <!DOCTYPE html>
<html lang="en">
<head>
<title>MongoClient Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/MongoClient" class="dashAnchor"></a>
<a title="MongoClient Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
MongoClient Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/BSON.html">BSON</a>
</li>
<li class="nav-group-task">
<a href="../Classes/MongoClient.html">MongoClient</a>
</li>
<li class="nav-group-task">
<a href="../Classes/MongoClientPool.html">MongoClientPool</a>
</li>
<li class="nav-group-task">
<a href="../Classes/MongoCollection.html">MongoCollection</a>
</li>
<li class="nav-group-task">
<a href="../Classes/MongoCursor.html">MongoCursor</a>
</li>
<li class="nav-group-task">
<a href="../Classes/MongoDatabase.html">MongoDatabase</a>
</li>
<li class="nav-group-task">
<a href="../Classes/MongoIndexOptions.html">MongoIndexOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/MongoIndexOptionsGeo.html">MongoIndexOptionsGeo</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enums</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BSONError.html">BSONError</a>
</li>
<li class="nav-group-task">
<a href="../Enums/MongoClientError.html">MongoClientError</a>
</li>
<li class="nav-group-task">
<a href="../Enums/MongoIndexStorageOptionType.html">MongoIndexStorageOptionType</a>
</li>
<li class="nav-group-task">
<a href="../Enums/MongoInsertFlag.html">MongoInsertFlag</a>
</li>
<li class="nav-group-task">
<a href="../Enums/MongoRemoveFlag.html">MongoRemoveFlag</a>
</li>
<li class="nav-group-task">
<a href="../Enums/MongoResult.html">MongoResult</a>
</li>
<li class="nav-group-task">
<a href="../Enums/MongoUpdateFlag.html">MongoUpdateFlag</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Functions.html">Functions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Functions.html#/s:ZF7MongoDBoi1lFTCS_4BSONS0__Sb"><(_:_:)</a>
</li>
<li class="nav-group-task">
<a href="../Functions.html#/s:ZF7MongoDBoi2eeFTCS_4BSONS0__Sb">==(_:_:)</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structs</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/MongoQueryFlag.html">MongoQueryFlag</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>MongoClient</h1>
<p>Undocumented</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:C7MongoDB11MongoClient6Result"></a>
<a name="//apple_ref/swift/Alias/Result" class="dashAnchor"></a>
<a class="token" href="#/s:C7MongoDB11MongoClient6Result">Result</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Result Status enum for a MongoDB event</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Result</span> <span class="o">=</span> <span class="kt">MongoResult</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FC7MongoDB11MongoClientcFzT3uriSS_S0_"></a>
<a name="//apple_ref/swift/Method/init(uri:)" class="dashAnchor"></a>
<a class="token" href="#/s:FC7MongoDB11MongoClientcFzT3uriSS_S0_">init(uri:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Create new Mongo Client connection</p>
<div class="aside aside-throws">
<p class="aside-title">Throws</p>
MongoClientError <q>Could not parse URI</q> if nil response
</div>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">uri</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="k">throws</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FC7MongoDB11MongoClient5closeFT_T_"></a>
<a name="//apple_ref/swift/Method/close()" class="dashAnchor"></a>
<a class="token" href="#/s:FC7MongoDB11MongoClient5closeFT_T_">close()</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>terminate current Mongo Client connection</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">close</span><span class="p">()</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FC7MongoDB11MongoClient13getCollectionFTSS14collectionNameSS_CS_15MongoCollection"></a>
<a name="//apple_ref/swift/Method/getCollection(_:collectionName:)" class="dashAnchor"></a>
<a class="token" href="#/s:FC7MongoDB11MongoClient13getCollectionFTSS14collectionNameSS_CS_15MongoCollection">getCollection(_:collectionName:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Return the specified MongoCollection from the specified database using current connection</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">getCollection</span><span class="p">(</span><span class="nv">databaseName</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">collectionName</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt">MongoCollection</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>databaseName</em>
</code>
</td>
<td>
<div>
<p>String name of database to be used</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>collectionName</em>
</code>
</td>
<td>
<div>
<p>String name of collection to be retrieved</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>MongoCollection from specified database</p>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FC7MongoDB11MongoClient11getDatabaseFT4nameSS_CS_13MongoDatabase"></a>
<a name="//apple_ref/swift/Method/getDatabase(name:)" class="dashAnchor"></a>
<a class="token" href="#/s:FC7MongoDB11MongoClient11getDatabaseFT4nameSS_CS_13MongoDatabase">getDatabase(name:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Return the named database as a MongoDatabase object</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">getDatabase</span><span class="p">(</span><span class="n">name</span> <span class="nv">databaseName</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt">MongoDatabase</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>name</em>
</code>
</td>
<td>
<div>
<p>String name of database to be retrieved</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>a MongoDatabase object</p>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FC7MongoDB11MongoClient12serverStatusFT_OS_11MongoResult"></a>
<a name="//apple_ref/swift/Method/serverStatus()" class="dashAnchor"></a>
<a class="token" href="#/s:FC7MongoDB11MongoClient12serverStatusFT_OS_11MongoResult">serverStatus()</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Get current Mongo server status</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">serverStatus</span><span class="p">()</span> <span class="o">-></span> <span class="kt">Result</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FC7MongoDB11MongoClient13databaseNamesFT_GSaSS_"></a>
<a name="//apple_ref/swift/Method/databaseNames()" class="dashAnchor"></a>
<a class="token" href="#/s:FC7MongoDB11MongoClient13databaseNamesFT_GSaSS_">databaseNames()</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Build String Array of current database names</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">databaseNames</span><span class="p">()</span> <span class="o">-></span> <span class="p">[</span><span class="kt">String</span><span class="p">]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>© 2016 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2016-05-25)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.6.2</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>
| 45.310078 | 491 | 0.424009 |
408f76626cfdf8c7331c0b5de955a2c2de51a6e2 | 4,608 | py | Python | scripts/rad2json/transformation.py | HenryJanson707/Ignis | f8a3769ecd0fe371993ff2c78e41bb0030d5caa8 | [
"MIT"
] | 6 | 2021-08-19T08:38:37.000Z | 2022-01-26T20:29:24.000Z | scripts/rad2json/transformation.py | HenryJanson707/Ignis | f8a3769ecd0fe371993ff2c78e41bb0030d5caa8 | [
"MIT"
] | 17 | 2021-09-30T19:41:47.000Z | 2022-02-27T11:10:49.000Z | scripts/rad2json/transformation.py | HenryJanson707/Ignis | f8a3769ecd0fe371993ff2c78e41bb0030d5caa8 | [
"MIT"
] | 2 | 2022-01-11T14:45:26.000Z | 2022-01-24T15:38:39.000Z | import copy
import numpy as np
import math
class Transformation:
def __init__(self, is_array = False, num_instances = 1):
# self.tx = 0.0
# self.ty = 0.0
# self.tz = 0.0
# self.rx = 0.0
# self.ry = 0.0
# self.rz = 0.0
# self.sx = 1.0
# self.sy = 1.0
# self.sz = 1.0
self.transformation = np.eye(4)
#variables relevant to xform
self.isArray = is_array
self.num_instances = num_instances
def translate(self, tx_, ty_, tz_):
# self.tx += tx_
# self.ty += ty_
# self.tz += tz_
translation = np.array([[1, 0, 0, tx_],
[0, 1, 0, ty_],
[0, 0, 1, tz_],
[0, 0, 0, 1]])
self.transformation = np.matmul(translation, self.transformation)
# def rotate(self, rx_, ry_, rz_):
# self.rx += rx_
# self.ry += ry_
# self.rz += rz_
def rotate_x(self, rx):
c = math.cos(math.radians(rx))
s = math.sin(math.radians(rx))
rotation = np.array([[1, 0, 0, 0],
[0, c, s, 0],
[0, -s, c, 0],
[0, 0, 0, 1]])
self.transformation = np.matmul(rotation, self.transformation)
def rotate_y(self, ry):
c = math.cos(math.radians(ry))
s = math.sin(math.radians(ry))
rotation = np.array([[c, 0, -s, 0],
[0, 1, 0, 0],
[s, 0, c, 0],
[0, 0, 0, 1]])
self.transformation = np.matmul(rotation, self.transformation)
def rotate_z(self, rz):
c = math.cos(math.radians(rz))
s = math.sin(math.radians(rz))
rotation = np.array([[c, -s, 0, 0],
[s, c, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]])
self.transformation = np.matmul(rotation, self.transformation)
def scale(self, s):
# self.sx *= s
# self.sy *= s
# self.sz *= s
scaling = np.array([[s, 0, 0, 0],
[0, s, 0, 0],
[0, 0, s, 0],
[0, 0, 0, 1]])
self.transformation = np.matmul(scaling, self.transformation)
def mirror_x(self):
# self.sx *= -1
self.transformation[0,0] *= -1
def mirror_y(self):
# self.sy *= -1
self.transformation[1,1] *= -1
def mirror_z(self):
# self.sz *= -1
self.transformation[2,2] *= -1
def transform(self, tform):
# self.tx += tform.tx
# self.ty += tform.ty
# self.tz += tform.tz
# self.rx += tform.rx
# self.ry += tform.ry
# self.rz += tform.rz
# self.sx *= tform.sx
# self.sy *= tform.sy
# self.sz *= tform.sz
self.transformation = np.matmul(tform.transformation, self.transformation)
def expandToList(self):
#take a 'transformation array' (specified by a '-a' flag) and expand it to a separate transformations
#The first object will have zero applications of the transform.
xform_array = []
base_xform = Transformation()
for i in range(self.num_instances):
xform_array.append(copy.deepcopy(base_xform))
base_xform.transform(self)
return xform_array
def __str__(self):
#To print readable object details
return f"Xform(isArray: {self.isArray}, num_instances:{self.num_instances})"
def __repr__(self):
#To print detailed object details
return (
f"Xform(isArray: {self.isArray}, num_instances:{self.num_instances},\n"
# f"tx: {self.tx}, ty:{self.ty}, tz:{self.tz},\n"
# f"rx: {self.rx}, ry:{self.ry}, rz:{self.rz},\n"
# f"sx: {self.sx}, sy:{self.sy}, sz:{self.sz})\n"
"Transformation:\n"
f"{self.transformation[0][0]} {self.transformation[0][1]} {self.transformation[0][2]} {self.transformation[0][3]}\n"
f"{self.transformation[1][0]} {self.transformation[1][1]} {self.transformation[1][2]} {self.transformation[1][3]}\n"
f"{self.transformation[2][0]} {self.transformation[2][1]} {self.transformation[2][2]} {self.transformation[2][3]}\n"
f"{self.transformation[3][0]} {self.transformation[3][1]} {self.transformation[3][2]} {self.transformation[3][3]}\n"
)
| 35.72093 | 128 | 0.488281 |
83035ea08b20342dd6dc25e4fccc3943282f260f | 1,062 | swift | Swift | UserDefault-datePicker/UserDefault-datePicker/ViewController.swift | ByoungilYoun/Coding | 348df0ac04ae74cfe3ccec68a4d783ae187f9119 | [
"MIT"
] | null | null | null | UserDefault-datePicker/UserDefault-datePicker/ViewController.swift | ByoungilYoun/Coding | 348df0ac04ae74cfe3ccec68a4d783ae187f9119 | [
"MIT"
] | null | null | null | UserDefault-datePicker/UserDefault-datePicker/ViewController.swift | ByoungilYoun/Coding | 348df0ac04ae74cfe3ccec68a4d783ae187f9119 | [
"MIT"
] | null | null | null | //
// ViewController.swift
// UserDefault-datePicker
//
// Created by 윤병일 on 2020/05/10.
// Copyright © 2020 Byoungil Youn. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
private struct Key {
static let today = "Today"
static let alarmOn = "AlarmOn"
}
@IBOutlet var datePicker: UIDatePicker!
@IBOutlet var alertSwitch: UISwitch!
@IBAction func saveData(_ sender: UIButton) {
let userDefaults = UserDefaults.standard
userDefaults.set(datePicker.date , forKey : Key.today)
userDefaults.set(alertSwitch.isOn, forKey: Key.alarmOn)
}
@IBAction func loadData(_ sender: UIButton) {
let userDefaults = UserDefaults.standard
let today = (userDefaults.object(forKey: Key.today) as? Date) ?? Date()
let isAlarmOn = userDefaults.bool(forKey: Key.alarmOn)
datePicker.setDate(today, animated: true)
alertSwitch.setOn(isAlarmOn, animated: true)
}
}
| 23.086957 | 79 | 0.626177 |
08e9719a64f559dd46b4000a9b7dfaaaabdc5130 | 700 | dart | Dart | lib/pages/login/login_binding.dart | sleepylee/flutter-survey | 71bd9577f16f31f8030311946141164556eb5356 | [
"MIT"
] | null | null | null | lib/pages/login/login_binding.dart | sleepylee/flutter-survey | 71bd9577f16f31f8030311946141164556eb5356 | [
"MIT"
] | 82 | 2021-03-23T11:14:31.000Z | 2021-09-24T07:54:52.000Z | lib/pages/login/login_binding.dart | sleepylee/flutter-survey | 71bd9577f16f31f8030311946141164556eb5356 | [
"MIT"
] | null | null | null | import 'package:get/get.dart';
import 'package:survey/api/graphql/graphql_client_provider.dart';
import 'package:survey/preferences/shared_preferences.dart';
import 'package:survey/repositories/oauth_repository.dart';
import 'package:survey/use_cases/login_use_case.dart';
class LoginBinding implements Bindings {
@override
void dependencies() {
final oauthRepository = OAuthRepositoryImpl(Get.find());
final sharedPref = Get.find<SharedPreferencesStorage>();
// TODO: create an Authenticator instead of accessing this directly
final graphQLClientProvider = Get.find<GraphQLClientProvider>();
Get.put(LoginUseCase(oauthRepository, sharedPref, graphQLClientProvider));
}
}
| 38.888889 | 78 | 0.788571 |
bd613ff46cc39ecb82345a069cdb01fcbc99becc | 621 | asm | Assembly | oeis/083/A083583.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/083/A083583.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/083/A083583.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A083583: a(n) = (8*3^n - 5*0^n)/3.
; Submitted by Jamie Morken(s1.)
; 1,8,24,72,216,648,1944,5832,17496,52488,157464,472392,1417176,4251528,12754584,38263752,114791256,344373768,1033121304,3099363912,9298091736,27894275208,83682825624,251048476872,753145430616,2259436291848,6778308875544,20334926626632,61004779879896,183014339639688,549043018919064,1647129056757192,4941387170271576,14824161510814728,44472484532444184,133417453597332552,400252360791997656,1200757082375992968,3602271247127978904,10806813741383936712,32420441224151810136,97261323672455430408
sub $0,1
mov $1,3
pow $1,$0
mul $1,8
max $1,1
mov $0,$1
| 56.454545 | 493 | 0.837359 |
131b2a072e1ccde5acc29f9b6049402eeafe0287 | 11,449 | h | C | CombBLAS/SpTuples.h | shoaibkamil/OLD-kdt-specializer | 85074ec1990df980d25096ea8c55dd81350e531e | [
"BSD-3-Clause"
] | 1 | 2021-11-15T02:11:33.000Z | 2021-11-15T02:11:33.000Z | CombBLAS/SpTuples.h | shoaibkamil/OLD-kdt-specializer | 85074ec1990df980d25096ea8c55dd81350e531e | [
"BSD-3-Clause"
] | null | null | null | CombBLAS/SpTuples.h | shoaibkamil/OLD-kdt-specializer | 85074ec1990df980d25096ea8c55dd81350e531e | [
"BSD-3-Clause"
] | null | null | null | /****************************************************************/
/* Parallel Combinatorial BLAS Library (for Graph Computations) */
/* version 1.1 -------------------------------------------------*/
/* date: 12/25/2010 --------------------------------------------*/
/* authors: Aydin Buluc (abuluc@lbl.gov), Adam Lugowski --------*/
/****************************************************************/
#ifndef _SP_TUPLES_H
#define _SP_TUPLES_H
#include <iostream>
#include <fstream>
#include <cmath>
#include <cassert>
#ifdef NOTR1
#include <boost/tr1/tuple.hpp>
#else
#include <tr1/tuple>
#endif
#include "SpMat.h"
#include "SpDefs.h"
#include "StackEntry.h"
#include "Compare.h"
using namespace std;
using namespace std::tr1;
template <class IU, class NU>
class SpDCCols;
template <class IU, class NU>
class Dcsc;
/**
* Triplets are represented using the boost::tuple class of the Boost library
* \remarks Indices start from 0 in this class
* \remarks Sorted with respect to columns (Column-sorted triples)
*/
template <class IT, class NT>
class SpTuples: public SpMat<IT, NT, SpTuples<IT,NT> >
{
public:
// Constructors
SpTuples (IT size, IT nRow, IT nCol);
SpTuples (IT size, IT nRow, IT nCol, tuple<IT, IT, NT> * mytuples);
SpTuples (IT maxnnz, IT nRow, IT nCol, vector<IT> & edges, bool removeloops = true); // Graph500 contructor
SpTuples (IT size, IT nRow, IT nCol, StackEntry<NT, pair<IT,IT> > * & multstack);
SpTuples (const SpTuples<IT,NT> & rhs); // Actual Copy constructor
SpTuples (const SpDCCols<IT,NT> & rhs); // Copy constructor for conversion from SpDCCols
~SpTuples();
SpTuples<IT,NT> & operator=(const SpTuples<IT,NT> & rhs);
IT & rowindex (IT i) { return tr1::get<0>(tuples[i]); }
IT & colindex (IT i) { return tr1::get<1>(tuples[i]); }
NT & numvalue (IT i) { return tr1::get<2>(tuples[i]); }
IT rowindex (IT i) const { return tr1::get<0>(tuples[i]); }
IT colindex (IT i) const { return tr1::get<1>(tuples[i]); }
NT numvalue (IT i) const { return tr1::get<2>(tuples[i]); }
void SortRowBased()
{
if(!SpHelper::is_sorted(tuples, tuples+nnz))
sort(tuples , tuples+nnz); // Default "operator<" for tuples uses lexicographical ordering
}
void SortColBased()
{
ColLexiCompare<IT,NT> collexicogcmp;
if(!SpHelper::is_sorted(tuples, tuples+nnz, collexicogcmp))
sort(tuples , tuples+nnz, collexicogcmp );
}
/**
* @pre {should only be called on diagonal processors (others will remove non-loop nonzeros)}
**/
IT RemoveLoops()
{
IT loop = 0;
for(IT i=0; i< nnz; ++i)
{
if(tr1::get<0>(tuples[i]) == tr1::get<1>(tuples[i])) ++loop;
}
tuple<IT, IT, NT> * ntuples = new tuple<IT,IT,NT>[nnz-loop];
IT ni = 0;
for(IT i=0; i< nnz; ++i)
{
if(tr1::get<0>(tuples[i]) != tr1::get<1>(tuples[i]))
{
ntuples[ni++] = tuples[i];
}
}
delete [] tuples;
tuples = ntuples;
nnz = nnz-loop;
return loop;
}
pair<IT,IT> RowLimits()
{
if(nnz > 0)
{
RowCompare<IT,NT> rowcmp;
tuple<IT,IT,NT> * maxit = max_element(tuples, tuples+nnz, rowcmp);
tuple<IT,IT,NT> * minit = min_element(tuples, tuples+nnz, rowcmp);
return make_pair(tr1::get<0>(*minit), tr1::get<0>(*maxit));
}
else
return make_pair(0,0);
}
pair<IT,IT> ColLimits()
{
if(nnz > 0)
{
ColCompare<IT,NT> colcmp;
tuple<IT,IT,NT> * maxit = max_element(tuples, tuples+nnz, colcmp);
tuple<IT,IT,NT> * minit = min_element(tuples, tuples+nnz, colcmp);
return make_pair(tr1::get<1>(*minit), tr1::get<1>(*maxit));
}
else
return make_pair(0,0);
}
// Performs a balanced merge of the array of SpTuples
template<typename SR, typename IU, typename NU>
friend SpTuples<IU,NU> MergeAll(const vector<SpTuples<IU,NU> *> & ArrSpTups, IU mstar, IU nstar, bool delarrs);
template<typename SR, typename IU, typename NU>
friend SpTuples<IU,NU> * MergeAllRec(const vector<SpTuples<IU,NU> *> & ArrSpTups, IU mstar, IU nstar);
ofstream& put (ofstream& outfile) const;
ifstream& get (ifstream& infile);
bool isZero() const { return (nnz == 0); }
IT getnrow() const { return m; }
IT getncol() const { return n; }
IT getnnz() const { return nnz; }
void PrintInfo();
private:
tuple<IT, IT, NT> * tuples; // boost:tuple
/**
** tuple elements with indices:
** 0) IT * ir ; // array of row indices, size nnz
** 1) IT * jc ; // array of col indices, size nnz
** 2) NT * numx; // array of generic values, size nnz
**/
IT m;
IT n;
IT nnz;
SpTuples (){}; // Default constructor does nothing, hide it
void FillTuples (Dcsc<IT,NT> * mydcsc);
template <class IU, class NU>
friend class SpDCCols;
};
// At this point, complete type of of SpTuples is known, safe to declare these specialization (but macros won't work as they are preprocessed)
template <> struct promote_trait< SpTuples<int,int> , SpTuples<int,int> >
{
typedef SpTuples<int,int> T_promote;
};
template <> struct promote_trait< SpTuples<int,float> , SpTuples<int,float> >
{
typedef SpTuples<int,float> T_promote;
};
template <> struct promote_trait< SpTuples<int,double> , SpTuples<int,double> >
{
typedef SpTuples<int,double> T_promote;
};
template <> struct promote_trait< SpTuples<int,bool> , SpTuples<int,int> >
{
typedef SpTuples<int,int> T_promote;
};
template <> struct promote_trait< SpTuples<int,int> , SpTuples<int,bool> >
{
typedef SpTuples<int,int> T_promote;
};
template <> struct promote_trait< SpTuples<int,int> , SpTuples<int,float> >
{
typedef SpTuples<int,float> T_promote;
};
template <> struct promote_trait< SpTuples<int,float> , SpTuples<int,int> >
{
typedef SpTuples<int,float> T_promote;
};
template <> struct promote_trait< SpTuples<int,int> , SpTuples<int,double> >
{
typedef SpTuples<int,double> T_promote;
};
template <> struct promote_trait< SpTuples<int,double> , SpTuples<int,int> >
{
typedef SpTuples<int,double> T_promote;
};
template <> struct promote_trait< SpTuples<int,unsigned> , SpTuples<int,bool> >
{
typedef SpTuples<int,unsigned> T_promote;
};
template <> struct promote_trait< SpTuples<int,bool> , SpTuples<int,unsigned> >
{
typedef SpTuples<int,unsigned> T_promote;
};
template <> struct promote_trait< SpTuples<int,bool> , SpTuples<int,double> >
{
typedef SpTuples<int,double> T_promote;
};
template <> struct promote_trait< SpTuples<int,bool> , SpTuples<int,float> >
{
typedef SpTuples<int,float> T_promote;
};
template <> struct promote_trait< SpTuples<int,double> , SpTuples<int,bool> >
{
typedef SpTuples<int,double> T_promote;
};
template <> struct promote_trait< SpTuples<int,float> , SpTuples<int,bool> >
{
typedef SpTuples<int,float> T_promote;
};
template <> struct promote_trait< SpTuples<int64_t,int> , SpTuples<int64_t,int> >
{
typedef SpTuples<int64_t,int> T_promote;
};
template <> struct promote_trait< SpTuples<int64_t,float> , SpTuples<int64_t,float> >
{
typedef SpTuples<int64_t,float> T_promote;
};
template <> struct promote_trait< SpTuples<int64_t,double> , SpTuples<int64_t,double> >
{
typedef SpTuples<int64_t,double> T_promote;
};
template <> struct promote_trait< SpTuples<int64_t,int64_t> , SpTuples<int64_t,int64_t> >
{
typedef SpTuples<int64_t,int64_t> T_promote;
};
template <> struct promote_trait< SpTuples<int64_t,bool> , SpTuples<int64_t,int> >
{
typedef SpTuples<int64_t,int> T_promote;
};
template <> struct promote_trait< SpTuples<int64_t,int> , SpTuples<int64_t,bool> >
{
typedef SpTuples<int64_t,int> T_promote;
};
template <> struct promote_trait< SpTuples<int64_t,int> , SpTuples<int64_t,float> >
{
typedef SpTuples<int64_t,float> T_promote;
};
template <> struct promote_trait< SpTuples<int64_t,float> , SpTuples<int64_t,int> >
{
typedef SpTuples<int64_t,float> T_promote;
};
template <> struct promote_trait< SpTuples<int64_t,int> , SpTuples<int64_t,double> >
{
typedef SpTuples<int64_t,double> T_promote;
};
template <> struct promote_trait< SpTuples<int64_t,double> , SpTuples<int64_t,int> >
{
typedef SpTuples<int64_t,double> T_promote;
};
template <> struct promote_trait< SpTuples<int64_t,unsigned> , SpTuples<int64_t,bool> >
{
typedef SpTuples<int64_t,unsigned> T_promote;
};
template <> struct promote_trait< SpTuples<int64_t,bool> , SpTuples<int64_t,unsigned> >
{
typedef SpTuples<int64_t,unsigned> T_promote;
};
template <> struct promote_trait< SpTuples<int64_t,bool> , SpTuples<int64_t,double> >
{
typedef SpTuples<int64_t,double> T_promote;
};
template <> struct promote_trait< SpTuples<int64_t,bool> , SpTuples<int64_t,float> >
{
typedef SpTuples<int64_t,float> T_promote;
};
template <> struct promote_trait< SpTuples<int64_t,double> , SpTuples<int64_t,bool> >
{
typedef SpTuples<int64_t,double> T_promote;
};
template <> struct promote_trait< SpTuples<int64_t,float> , SpTuples<int64_t,bool> >
{
typedef SpTuples<int64_t,float> T_promote;
};
#include "SpTuples.cpp"
#endif
| 38.942177 | 142 | 0.525111 |
0ead2e9fc6d2cefb64b3b26f4eeb0b205e58c9b0 | 130,063 | sql | SQL | DB 01.08.16.sql | RomanStruk/uvg-yii2 | 2e52fb776dc29bf2176a3818a7a7ccdfb8345d69 | [
"BSD-3-Clause"
] | null | null | null | DB 01.08.16.sql | RomanStruk/uvg-yii2 | 2e52fb776dc29bf2176a3818a7a7ccdfb8345d69 | [
"BSD-3-Clause"
] | null | null | null | DB 01.08.16.sql | RomanStruk/uvg-yii2 | 2e52fb776dc29bf2176a3818a7a7ccdfb8345d69 | [
"BSD-3-Clause"
] | null | null | null | -- phpMyAdmin SQL Dump
-- version 4.5.4.1deb2ubuntu2
-- http://www.phpmyadmin.net
--
-- Хост: localhost
-- Час створення: Сер 01 2016 р., 19:59
-- Версія сервера: 5.7.13-0ubuntu0.16.04.2
-- Версія PHP: 7.0.8-0ubuntu0.16.04.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- База даних: `yii2advanced`
--
-- --------------------------------------------------------
--
-- Структура таблиці `auth_assignment`
--
CREATE TABLE `auth_assignment` (
`item_name` varchar(64) NOT NULL,
`user_id` int(11) NOT NULL,
`created_at` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп даних таблиці `auth_assignment`
--
INSERT INTO `auth_assignment` (`item_name`, `user_id`, `created_at`) VALUES
('Admin', 1, 1467930934),
('User', 2, 1468075653);
-- --------------------------------------------------------
--
-- Структура таблиці `auth_item`
--
CREATE TABLE `auth_item` (
`name` varchar(64) NOT NULL,
`type` int(11) NOT NULL,
`description` text,
`rule_name` varchar(64) DEFAULT NULL,
`data` text,
`created_at` int(11) DEFAULT NULL,
`updated_at` int(11) DEFAULT NULL,
`group_code` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп даних таблиці `auth_item`
--
INSERT INTO `auth_item` (`name`, `type`, `description`, `rule_name`, `data`, `created_at`, `updated_at`, `group_code`) VALUES
('/*', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('//*', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('//controller', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('//crud', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('//extension', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('//form', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('//index', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('//model', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('//module', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/asset/*', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/asset/compress', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/asset/template', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/cache/*', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/cache/flush', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/cache/flush-all', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/cache/flush-schema', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/cache/index', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/car/*', 3, NULL, NULL, NULL, 1468012861, 1468012861, NULL),
('/car/create', 3, NULL, NULL, NULL, 1468012861, 1468012861, NULL),
('/car/delete', 3, NULL, NULL, NULL, 1468012861, 1468012861, NULL),
('/car/index', 3, NULL, NULL, NULL, 1468012862, 1468012862, NULL),
('/car/update', 3, NULL, NULL, NULL, 1468012861, 1468012861, NULL),
('/car/view', 3, NULL, NULL, NULL, 1468012862, 1468012862, NULL),
('/debug/*', 3, NULL, NULL, NULL, 1468012862, 1468012862, NULL),
('/debug/default/*', 3, NULL, NULL, NULL, 1468012862, 1468012862, NULL),
('/debug/default/db-explain', 3, NULL, NULL, NULL, 1468012862, 1468012862, NULL),
('/debug/default/download-mail', 3, NULL, NULL, NULL, 1468012862, 1468012862, NULL),
('/debug/default/index', 3, NULL, NULL, NULL, 1468012862, 1468012862, NULL),
('/debug/default/toolbar', 3, NULL, NULL, NULL, 1468012862, 1468012862, NULL),
('/debug/default/view', 3, NULL, NULL, NULL, 1468012862, 1468012862, NULL),
('/fixture/*', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/fixture/load', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/fixture/unload', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/gii/*', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/gii/default/*', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/gii/default/action', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/gii/default/diff', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/gii/default/index', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/gii/default/preview', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/gii/default/view', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/gridview/*', 3, NULL, NULL, NULL, 1468012862, 1468012862, NULL),
('/gridview/export/*', 3, NULL, NULL, NULL, 1468012862, 1468012862, NULL),
('/gridview/export/download', 3, NULL, NULL, NULL, 1468012862, 1468012862, NULL),
('/hello/*', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/hello/index', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/help/*', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/help/index', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/message/*', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/message/config', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/message/config-template', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/message/extract', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/migrate/*', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/migrate/create', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/migrate/down', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/migrate/history', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/migrate/mark', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/migrate/new', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/migrate/redo', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/migrate/to', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/migrate/up', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/rbac/*', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/rbac/init', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/reports/*', 3, NULL, NULL, NULL, 1468012861, 1468012861, NULL),
('/reports/balances', 3, NULL, NULL, NULL, 1468012861, 1468012861, NULL),
('/reports/fuel-all', 3, NULL, NULL, NULL, 1468012861, 1468012861, NULL),
('/reports/fuel-payment', 3, NULL, NULL, NULL, 1468012861, 1468012861, NULL),
('/reports/index', 3, NULL, NULL, NULL, 1468012861, 1468012861, NULL),
('/serve/*', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/serve/index', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/site/*', 3, NULL, NULL, NULL, 1468012860, 1468012860, NULL),
('/site/about', 3, NULL, NULL, NULL, 1468012861, 1468012861, NULL),
('/site/captcha', 3, NULL, NULL, NULL, 1468012861, 1468012861, NULL),
('/site/contact', 3, NULL, NULL, NULL, 1468012861, 1468012861, NULL),
('/site/error', 3, NULL, NULL, NULL, 1468012861, 1468012861, NULL),
('/site/index', 3, NULL, NULL, NULL, 1468012861, 1468012861, NULL),
('/site/login', 3, NULL, NULL, NULL, 1468012861, 1468012861, NULL),
('/site/logout', 3, NULL, NULL, NULL, 1468012861, 1468012861, NULL),
('/transport-car/*', 3, NULL, NULL, NULL, 1468012860, 1468012860, NULL),
('/transport-car/create', 3, NULL, NULL, NULL, 1468012860, 1468012860, NULL),
('/transport-car/delete', 3, NULL, NULL, NULL, 1468012860, 1468012860, NULL),
('/transport-car/index', 3, NULL, NULL, NULL, 1468012860, 1468012860, NULL),
('/transport-car/update', 3, NULL, NULL, NULL, 1468012860, 1468012860, NULL),
('/transport-car/view', 3, NULL, NULL, NULL, 1468012860, 1468012860, NULL),
('/user-management/*', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/user-management/auth-item-group/*', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/auth-item-group/bulk-activate', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/auth-item-group/bulk-deactivate', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/auth-item-group/bulk-delete', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/auth-item-group/create', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/auth-item-group/delete', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/auth-item-group/grid-page-size', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/auth-item-group/grid-sort', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/auth-item-group/index', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/auth-item-group/toggle-attribute', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/auth-item-group/update', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/auth-item-group/view', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/auth/*', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/auth/captcha', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/auth/change-own-password', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/auth/confirm-email', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/auth/confirm-email-receive', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/auth/confirm-registration-email', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/auth/login', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/auth/logout', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/auth/password-recovery', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/auth/password-recovery-receive', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/auth/registration', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/permission/*', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/permission/bulk-activate', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/permission/bulk-deactivate', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/permission/bulk-delete', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/permission/create', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/permission/delete', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/permission/grid-page-size', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/permission/grid-sort', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/permission/index', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/permission/refresh-routes', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/permission/set-child-permissions', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/permission/set-child-routes', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/permission/toggle-attribute', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/permission/update', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/permission/view', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/role/*', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/role/bulk-activate', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/role/bulk-deactivate', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/role/bulk-delete', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/role/create', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/role/delete', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/role/grid-page-size', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/role/grid-sort', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/role/index', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/role/set-child-permissions', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/role/set-child-roles', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/role/toggle-attribute', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/role/update', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/role/view', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user-permission/*', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user-permission/set', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user-permission/set-roles', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user-visit-log/*', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/user-management/user-visit-log/bulk-activate', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user-visit-log/bulk-deactivate', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user-visit-log/bulk-delete', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user-visit-log/create', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user-visit-log/delete', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user-visit-log/grid-page-size', 3, NULL, NULL, NULL, 1467930348, 1467930348, NULL),
('/user-management/user-visit-log/grid-sort', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user-visit-log/index', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user-visit-log/toggle-attribute', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user-visit-log/update', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user-visit-log/view', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user/*', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user/bulk-activate', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user/bulk-deactivate', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user/bulk-delete', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user/change-password', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user/create', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user/delete', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user/grid-page-size', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user/grid-sort', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user/index', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user/toggle-attribute', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user/update', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('/user-management/user/view', 3, NULL, NULL, NULL, 1467930349, 1467930349, NULL),
('Admin', 1, 'Admin', NULL, NULL, 1467930349, 1467930349, NULL),
('assignRolesToUsers', 2, 'Assign roles to users', NULL, NULL, 1467930349, 1467930349, 'userManagement'),
('bindUserToIp', 2, 'Bind user to IP', NULL, NULL, 1467930349, 1467930349, 'userManagement'),
('changeOwnPassword', 2, 'Change own password', NULL, NULL, 1467930349, 1467930349, 'userCommonPermissions'),
('changeUserPassword', 2, 'Change user password', NULL, NULL, 1467930349, 1467930349, 'userManagement'),
('commonPermission', 2, 'Common permission', NULL, NULL, 1467930344, 1467930344, NULL),
('createUsers', 2, 'Create users', NULL, NULL, 1467930349, 1467930349, 'userManagement'),
('deleteUsers', 2, 'Delete users', NULL, NULL, 1467930349, 1467930349, 'userManagement'),
('editUserEmail', 2, 'Edit user email', NULL, NULL, 1467930349, 1467930349, 'userManagement'),
('editUsers', 2, 'Edit users', NULL, NULL, 1467930349, 1467930349, 'userManagement'),
('indexReports', 2, 'Звіти', NULL, NULL, 1468072586, 1468075508, 'userCommonPermissions'),
('User', 1, 'Users', NULL, NULL, 1468075394, 1468075394, NULL),
('viewRegistrationIp', 2, 'View registration IP', NULL, NULL, 1467930349, 1467930349, 'userManagement'),
('viewUserEmail', 2, 'View user email', NULL, NULL, 1467930349, 1467930349, 'userManagement'),
('viewUserRoles', 2, 'View user roles', NULL, NULL, 1467930349, 1467930349, 'userManagement'),
('viewUsers', 2, 'View users', NULL, NULL, 1467930349, 1467930349, 'userManagement'),
('viewVisitLog', 2, 'View visit log', NULL, NULL, 1467930349, 1467930349, 'userManagement');
-- --------------------------------------------------------
--
-- Структура таблиці `auth_item_child`
--
CREATE TABLE `auth_item_child` (
`parent` varchar(64) NOT NULL,
`child` varchar(64) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп даних таблиці `auth_item_child`
--
INSERT INTO `auth_item_child` (`parent`, `child`) VALUES
('indexReports', '/reports/index'),
('changeOwnPassword', '/user-management/auth/change-own-password'),
('assignRolesToUsers', '/user-management/user-permission/set'),
('assignRolesToUsers', '/user-management/user-permission/set-roles'),
('viewVisitLog', '/user-management/user-visit-log/grid-page-size'),
('viewVisitLog', '/user-management/user-visit-log/index'),
('viewVisitLog', '/user-management/user-visit-log/view'),
('editUsers', '/user-management/user/bulk-activate'),
('editUsers', '/user-management/user/bulk-deactivate'),
('deleteUsers', '/user-management/user/bulk-delete'),
('changeUserPassword', '/user-management/user/change-password'),
('createUsers', '/user-management/user/create'),
('deleteUsers', '/user-management/user/delete'),
('viewUsers', '/user-management/user/grid-page-size'),
('viewUsers', '/user-management/user/index'),
('editUsers', '/user-management/user/update'),
('viewUsers', '/user-management/user/view'),
('Admin', 'assignRolesToUsers'),
('Admin', 'bindUserToIp'),
('Admin', 'changeOwnPassword'),
('User', 'changeOwnPassword'),
('Admin', 'changeUserPassword'),
('Admin', 'createUsers'),
('Admin', 'deleteUsers'),
('Admin', 'editUserEmail'),
('Admin', 'editUsers'),
('Admin', 'indexReports'),
('User', 'indexReports'),
('Admin', 'viewRegistrationIp'),
('Admin', 'viewUserEmail'),
('editUserEmail', 'viewUserEmail'),
('assignRolesToUsers', 'viewUserRoles'),
('Admin', 'viewUsers'),
('assignRolesToUsers', 'viewUsers'),
('changeUserPassword', 'viewUsers'),
('createUsers', 'viewUsers'),
('deleteUsers', 'viewUsers'),
('editUsers', 'viewUsers'),
('Admin', 'viewVisitLog');
-- --------------------------------------------------------
--
-- Структура таблиці `auth_item_group`
--
CREATE TABLE `auth_item_group` (
`code` varchar(64) NOT NULL,
`name` varchar(255) NOT NULL,
`created_at` int(11) DEFAULT NULL,
`updated_at` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп даних таблиці `auth_item_group`
--
INSERT INTO `auth_item_group` (`code`, `name`, `created_at`, `updated_at`) VALUES
('userCommonPermissions', 'User common permission', 1467930349, 1467930349),
('userManagement', 'User management', 1467930349, 1467930349);
-- --------------------------------------------------------
--
-- Структура таблиці `auth_rule`
--
CREATE TABLE `auth_rule` (
`name` varchar(64) NOT NULL,
`data` text,
`created_at` int(11) DEFAULT NULL,
`updated_at` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Структура таблиці `drivers`
--
CREATE TABLE `drivers` (
`id` int(6) UNSIGNED NOT NULL,
`name` varchar(255) NOT NULL COMMENT 'Прізвище Імя По батькові',
`telephone` varchar(10) NOT NULL COMMENT 'Номер телефону',
`profession` varchar(255) NOT NULL COMMENT 'Професія',
`count` enum('db','sr') NOT NULL DEFAULT 'sr' COMMENT 'Рахунок',
`info` mediumtext COMMENT 'Додаткова інфа'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Водії';
--
-- Дамп даних таблиці `drivers`
--
INSERT INTO `drivers` (`id`, `name`, `telephone`, `profession`, `count`, `info`) VALUES
(1, 'Комар-Стаховський Василь Йосипович', '0968172108', 'Водій', 'db', '19.11.1968\r\nс. Проходи'),
(2, 'Кух Володимир Іванович', '0954234561', 'Водій', 'sr', '14.02.1966\r\nс. Проходи'),
(3, 'Оласюк Сергій Якович', '0952857657', 'Водій', 'sr', '04.10.1964\r\nс. Проходи'),
(4, 'Фальчик Микола Степанович', '0502074325', 'Електрозварювальник', 'db', '14.05.1976\r\nсмт. Проходи'),
(5, 'Бондар Сергій Іванович', '0508820095', 'Водій', 'db', '01.12.1965\r\nсмт. Любешів'),
(6, 'Масюк Валерій Петрович', '0996429095', 'Водій', 'db', '27.08.1971\r\nсмт. Любешів'),
(8, 'Іванісік Володимир Олександрович', '0663421639', 'Тракторист', 'sr', '18.10.1960\r\nсмт. Любешів'),
(10, 'Божко Анатолій Михайлович', '0990286036', 'Слюсар', 'sr', '07.12.1967\r\n"---"'),
(11, 'Дубольський Григорій Миколайович', '2-18-33', 'Тракторист', 'sr', '01.01.1961\r\nсмт. Любешів'),
(14, 'Струк Роман Миколайович ', '0668514453', 'зав. РММ', 'db', 'РММ'),
(16, 'Зімич Петро Іванович', '0000000000', 'Начальник дільниці', 'db', 'Мала механізація');
-- --------------------------------------------------------
--
-- Структура таблиці `migration`
--
CREATE TABLE `migration` (
`version` varchar(180) NOT NULL,
`apply_time` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп даних таблиці `migration`
--
INSERT INTO `migration` (`version`, `apply_time`) VALUES
('m000000_000000_base', 1467930335),
('m140608_173539_create_user_table', 1467930340),
('m140611_133903_init_rbac', 1467930341),
('m140808_073114_create_auth_item_group_table', 1467930343),
('m140809_072112_insert_superadmin_to_user', 1467930344),
('m140809_073114_insert_common_permisison_to_auth_item', 1467930344),
('m141023_141535_create_user_visit_log', 1467930344),
('m141116_115804_add_bind_to_ip_and_registration_ip_to_user', 1467930346),
('m141121_194858_split_browser_and_os_column', 1467930347),
('m141201_220516_add_email_and_email_confirmed_to_user', 1467930348),
('m141207_001649_create_basic_user_permissions', 1467930349);
-- --------------------------------------------------------
--
-- Структура таблиці `realized_works_truck`
--
CREATE TABLE `realized_works_truck` (
`id` int(11) UNSIGNED NOT NULL,
`route_list` int(6) UNSIGNED NOT NULL,
`dimension` enum('m3','motogod','t','other') NOT NULL DEFAULT 'other',
`freight` float UNSIGNED NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп даних таблиці `realized_works_truck`
--
INSERT INTO `realized_works_truck` (`id`, `route_list`, `dimension`, `freight`) VALUES
(1, 2, 'm3', 0),
(2, 3, 'm3', 8),
(3, 5, 't', 3),
(4, 6, 'm3', 8),
(5, 8, 'm3', 0),
(6, 9, 'm3', 2.4),
(7, 11, 'm3', 2.5),
(8, 12, 'm3', 12),
(9, 14, 't', 0),
(10, 15, 'motogod', 2),
(11, 17, 't', 0),
(12, 18, 'motogod', 3),
(13, 20, 't', 0),
(14, 21, 'motogod', 1),
(15, 23, 't', 5),
(16, 24, 'motogod', 2),
(17, 26, 't', 0),
(18, 27, 'motogod', 4),
(19, 28, 'm3', 8),
(20, 30, 'motogod', 8),
(21, 32, 'motogod', 8),
(22, 34, 't', 20),
(23, 35, 'm3', 50),
(24, 36, 'm3', 0),
(25, 38, 'motogod', 8),
(26, 39, 't', 1),
(27, 41, 'motogod', 7),
(28, 43, 't', 0),
(29, 44, 'motogod', 7),
(30, 46, 't', 0),
(31, 47, 'motogod', 7),
(32, 49, 't', 0),
(33, 50, 'motogod', 0),
(34, 52, 't', 0),
(35, 54, 't', 0),
(36, 56, 'motogod', 4),
(37, 58, 't', 24),
(38, 60, 'motogod', 2),
(39, 62, 't', 1),
(40, 64, 'motogod', 1),
(41, 66, 'm3', 6),
(42, 71, 't', 18),
(43, 73, 't', 4),
(44, 75, 'motogod', 5),
(45, 77, 't', 8),
(46, 78, 'motogod', 1),
(47, 80, 't', 6),
(48, 82, 't', 48),
(49, 84, 't', 24),
(50, 86, 't', 48),
(51, 88, 'motogod', 3),
(52, 90, 't', 80),
(53, 92, 't', 96),
(54, 94, 't', 48),
(55, 95, 't', 28),
(56, 97, 't', 6),
(57, 98, 'motogod', 0),
(58, 100, 't', 28),
(59, 101, 'm3', 0),
(60, 103, 't', 96),
(61, 104, 'm3', 0),
(62, 106, 't', 96),
(63, 107, 'm3', 0),
(64, 109, 't', 30),
(65, 110, 'm3', 0),
(66, 112, 'm3', 0),
(67, 114, 't', 4),
(68, 115, 'm3', 0),
(69, 117, 'm3', 8),
(70, 118, 'm3', 0),
(71, 120, 't', 52),
(72, 121, 'm3', 0),
(73, 123, 't', 1),
(74, 124, 'm3', 0),
(75, 126, 't', 0),
(76, 127, 'm3', 0),
(77, 129, 't', 0),
(78, 130, 'm3', 0),
(79, 132, 't', 16),
(80, 133, 'm3', 0),
(81, 135, 'm3', 0),
(82, 137, 't', 31),
(83, 138, 'm3', 0),
(84, 140, 'm3', 148),
(85, 142, 'm3', 0),
(86, 144, 't', 6),
(87, 145, 'm3', 0),
(88, 147, 't', 2),
(89, 149, 't', 33),
(90, 153, 't', 40),
(91, 155, 't', 12),
(92, 159, 't', 7),
(93, 161, 't', 7);
-- --------------------------------------------------------
--
-- Структура таблиці `routelist`
--
CREATE TABLE `routelist` (
`id` int(11) UNSIGNED NOT NULL,
`number` int(6) UNSIGNED NOT NULL COMMENT 'Номер шляхового листа',
`driver` int(6) DEFAULT NULL,
`transport` int(6) DEFAULT NULL COMMENT 'id транспорту',
`type` enum('car','tractor','truck') NOT NULL COMMENT 'Тип шляхового листа',
`date` datetime DEFAULT NULL COMMENT 'Дата внесення в бд путівки',
`datego` date NOT NULL COMMENT 'Дата путівки',
`fuel` varchar(255) DEFAULT NULL COMMENT 'Заправка',
`mk_fuel` int(6) DEFAULT NULL COMMENT 'Марка палива(дб)',
`dispach` time DEFAULT NULL COMMENT 'Час відправлення',
`return` time DEFAULT NULL COMMENT 'Час повернення',
`oil` varchar(255) NOT NULL DEFAULT '0' COMMENT 'Запарвка масла',
`other_fuel` varchar(255) DEFAULT NULL COMMENT 'Інші паливо маст матеріали',
`other_mk_fuel` varchar(255) DEFAULT NULL COMMENT 'Марка other_fuel (дб)',
`balance_fuel` varchar(255) DEFAULT NULL COMMENT 'Залишок пального при поверненні',
`w_off_fuell` varchar(255) DEFAULT NULL COMMENT 'Списання пального(л)',
`worked` int(6) NOT NULL COMMENT 'Відпрацьовано(год)',
`note` mediumtext COMMENT 'Додаткові відмітки про рух траспорту',
`order` mediumtext COMMENT 'У чиє розпорядження',
`valid` enum('1','0') NOT NULL DEFAULT '1' COMMENT 'Чи дійсна путівка',
`freight` varchar(6) NOT NULL,
`dimension` enum('m3','motogod','t','other') NOT NULL DEFAULT 'other',
`speedometerdeparture` varchar(6) NOT NULL,
`kilometrage` varchar(255) NOT NULL COMMENT 'Кілометраж',
`speedometerreturn` varchar(6) NOT NULL COMMENT 'Показник спідометра при поверненні',
`payment` enum('db','sr','pr') NOT NULL DEFAULT 'sr' COMMENT 'Оплата(с.р., д.б)',
`completed` enum('1','0') NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Шляхові листи';
--
-- Дамп даних таблиці `routelist`
--
INSERT INTO `routelist` (`id`, `number`, `driver`, `transport`, `type`, `date`, `datego`, `fuel`, `mk_fuel`, `dispach`, `return`, `oil`, `other_fuel`, `other_mk_fuel`, `balance_fuel`, `w_off_fuell`, `worked`, `note`, `order`, `valid`, `freight`, `dimension`, `speedometerdeparture`, `kilometrage`, `speedometerreturn`, `payment`, `completed`) VALUES
(1, 0, 5, 4, 'car', '2015-12-31 00:00:00', '2015-12-31', '1', 1, '08:00:00', '17:00:00', '0', '', '0', '1', '0', 0, 'Фіктивна путівка для початку відліку', 'Любешівське УВГ', '1', '', 'm3', '0', '0', '0', 'db', '1'),
(2, 1, 5, 4, 'car', '2016-01-19 15:48:50', '2016-01-04', '20', 1, '08:00:00', '17:15:00', '0', '', '0', '3', '18', 8, 'По любешові', 'Любешівське УВГ', '1', '0', 'other', '0', '104', '104', 'db', '1'),
(3, 0, 3, 3, 'car', '2015-12-31 00:00:00', '2015-12-31', '', 1, '08:00:00', '17:00:00', '', '', '0', '0', '0', 0, 'Фиктивна путівка для старту', 'Любешівське УВГ', '1', '', 'm3', '0', '0', '0', 'sr', '1'),
(4, 2, 3, 3, 'car', '2016-01-19 15:52:51', '2016-01-04', '5', 1, '08:00:00', '17:15:00', '0', '', '0', '0', '5', 8, 'Кузьміч на насосну', 'Любешівське УВГ', '1', '0', 'other', '0', '42', '42', 'db', '1'),
(5, 3, 3, 3, 'car', '2016-01-19 15:53:32', '2016-01-05', '', 1, '08:00:00', '17:15:00', '0', '', '0', '', '', 0, 'Кузьміч', 'Любешівське УВГ', '0', '0', 'm3', '', '', '', 'sr', '1'),
(6, 4, 5, 4, 'car', '2016-01-19 15:54:13', '2016-01-05', '18', 1, '08:00:00', '17:15:00', '0', '', '0', '12', '9', 8, 'По Любешові', 'Любешівське УВГ', '1', '0', 'other', '104', '54', '158', 'db', '1'),
(7, 5, 5, 4, 'car', '2016-01-19 15:54:58', '2016-01-12', '44', 1, '08:00:00', '17:15:00', '0', '', '0', '4', '52', 8, 'По Любешові', 'Любешівське УВГ', '1', '0', 'other', '158', '300', '458', 'db', '1'),
(8, 0, 2, 2, 'truck', '2015-12-31 00:00:00', '2015-12-31', '0', 3, '08:00:00', '17:00:00', '0', '', '0', '0', '0', 0, 'Фіктивна путівка для старту', 'Любешівське УВГ', '1', '0', 'm3', '0', '0', '0', 'sr', '1'),
(9, 0, 1, 1, 'truck', '2015-12-31 00:00:00', '2015-12-31', '5', 3, '08:00:00', '17:00:00', '0', '', '0', '5', '0', 0, 'Фіктивна путівка для старту', 'Любешівське УВГ', '1', '0', 'm3', '0', '0', '0', 'sr', '1'),
(10, 1, 2, 2, 'truck', '2016-01-19 16:02:10', '2016-01-12', '', 3, '08:00:00', '17:15:00', '', '', '0', '', '', 0, 'Перевезення ЕТ-16 з Седлищ', 'Любешівське УВГ', '0', '', 'm3', '', '', '', 'sr', '1'),
(11, 2, 1, 1, 'truck', '2016-01-19 16:02:48', '2016-01-12', '5', 3, '08:00:00', '17:15:00', '0', '', '0', '2', '8', 8, 'Привезення пілетів', 'Любешівське УВГ', '1', '3', 't', '0', '30', '30', 'pr', '1'),
(12, 3, 1, 1, 'truck', '2016-01-19 16:03:50', '2016-01-13', '5', 3, '08:00:00', '17:15:00', '0', '', '0', '0', '7', 8, 'Привезення пілетів 4,3 т', 'Любешівське УВГ', '1', '0', 'm3', '30', '26', '56', 'db', '1'),
(13, 0, 4, 5, 'tractor', '2015-12-31 00:00:00', '2015-12-31', '0', 3, '08:00:00', '17:00:00', '0', '', '0', '0', '0', 0, 'Фіктивна путівка для старту', 'Любешівське УВГ', '1', '0', 'm3', '0', '0', '0', 'sr', '1'),
(14, 1, 4, 5, 'tractor', '2016-01-19 16:07:59', '2016-01-11', '5', 3, '08:00:00', '17:15:00', '0', '', '0', '0', '5', 8, 'Чистка території від снігу', 'Любешівське УВГ', '1', '8', 'm3', '0', '0', '0', 'db', '1'),
(15, 2, 4, 5, 'tractor', '2016-01-19 16:08:36', '2016-01-18', '5', 3, '08:00:00', '17:15:00', '0', '', '0', '0', '5', 8, 'Очистка території від снігу', 'Любешівське УВГ', '1', '8', 'm3', '0', '0', '0', 'db', '1'),
(16, 4, 1, 1, 'truck', '2016-03-02 17:03:08', '2016-02-04', '15', 3, '08:00:00', '17:15:00', '0', '', '0', '0', '15', 8, 'Любешів - Дольськ', 'Любешівське УВГ', '1', '2,5', 'm3', '56', '56', '112', 'sr', '1'),
(17, 10, 1, 1, 'truck', '2016-03-02 17:05:22', '2016-02-09', '10', 3, '08:00:00', '17:15:00', '0', '', '0', '0', '10', 8, 'Любешів - Підкормільська н.с.', 'Любешівське УВГ', '1', '8', 'm3', '168', '40', '208', 'sr', '1'),
(18, 13, 1, 1, 'truck', '2016-03-02 17:06:39', '2016-02-18', '15', 3, '08:00:00', '17:15:00', '0', '', '0', '0', '15', 8, 'Любешів - Дольська н.с', 'Любешівське УВГ', '1', '0', 'm3', '208', '56', '264', 'pr', '1'),
(19, 14, 1, 1, 'truck', '2016-03-02 17:08:17', '2016-02-19', '3', 3, '08:00:00', '17:15:00', '0', '', '0', '0', '3', 8, 'Любешів - Підкормільська н.с.', 'Любешівське УВГ', '1', '1', 't', '264', '11', '275', 'pr', '1'),
(20, 4, 4, 5, 'tractor', '2016-03-02 17:09:47', '2016-02-17', '30', 3, '08:00:00', '17:15:00', '0', '', '0', '0', '30', 8, 'Любешів - Цир - Любешів', 'Любешівське УВГ', '1', '12', 'm3', '0', '0', '0', 'db', '1'),
(21, 12, 5, 4, 'car', '2016-03-02 17:11:15', '2016-02-01', '5', 1, '08:00:00', '17:15:00', '0', '', '0', '9', '10', 8, 'по системі', 'Любешівське УВГ', '1', '0', 'm3', '864', '60', '924', 'db', '1'),
(22, 14, 5, 4, 'car', '2016-03-02 17:12:22', '2016-02-02', '5', 1, '08:00:00', '17:15:00', '0', '', '0', '11', '3', 8, 'Любешівська н.с.', 'Любешівське УВГ', '1', '0', 'm3', '924', '18', '942', 'db', '1'),
(23, 15, 5, 4, 'car', '2016-03-02 17:13:59', '2016-02-03', '10', 1, '08:00:00', '17:15:00', '0', '', '0', '19', '2', 8, 'автозапчастини', 'Любешівське УВГ', '1', '0', 'm3', '942', '12', '954', 'db', '1'),
(24, 16, 5, 4, 'car', '2016-03-02 17:15:19', '2016-02-04', '0', 1, '08:00:00', '17:15:00', '0', '', '0', '14', '5', 8, 'Любешів - Підкормільська н.с.', 'Любешівське УВГ', '1', '0', 'other', '954', '30', '984', 'db', '1'),
(25, 3, 4, 5, 'tractor', '2016-03-03 13:31:56', '2016-01-22', '20', 3, '08:00:00', '17:15:00', '0', '', '0', '0', '20', 8, 'Згортання снігу', 'Любешівське УВГ', '1', '2,4', 'm3', '0', '0', '0', 'db', '1'),
(26, 8, 2, 3, 'car', '2016-03-04 14:40:11', '2016-01-25', '5', 1, '08:00:00', '17:15:00', '0', '', '0', '4', '1', 8, 'Автозапчастини', 'Любешівське УВГ', '1', '0', 'm3', '42', '8', '50', 'db', '1'),
(27, 6, 5, 4, 'car', '2016-03-04 14:46:13', '2016-01-13', '50', 1, '08:00:00', '17:15:00', '0', '', '0', '2', '52', 8, 'Начальнік', 'Любешівське УВГ', '1', '0', 'other', '458', '300', '758', 'db', '1'),
(28, 7, 5, 4, 'car', '2016-03-04 14:47:03', '2016-01-22', '10', 1, '08:00:00', '17:15:00', '0', '', '0', '6', '6', 8, 'Нач', 'Любешівське УВГ', '1', '0', 'm3', '758', '36', '794', 'db', '1'),
(29, 9, 5, 4, 'car', '2016-03-04 14:47:45', '2016-01-25', '5', 1, '08:00:00', '17:15:00', '0', '', '0', '4', '7', 8, 'начч', 'Любешівське УВГ', '1', '0', 'm3', '794', '42', '836', 'db', '1'),
(30, 10, 5, 4, 'car', '2016-03-04 14:48:26', '2016-01-26', '15', 1, '08:00:00', '17:15:00', '0', '', '0', '14', '5', 8, 'нач', 'Любешівське УВГ', '1', '0', 'other', '836', '28', '864', 'db', '1'),
(31, 11, 2, 3, 'car', '2016-03-04 14:55:32', '2016-02-01', '0', 1, '08:00:00', '17:15:00', '0', '', '0', '2', '2', 8, 'Автозапчастини', 'Любешівське УВГ', '1', '0', 'other', '50', '17', '67', 'db', '1'),
(32, 17, 2, 3, 'car', '2016-03-04 14:56:11', '2016-02-04', '0', 1, '08:00:00', '17:15:00', '0', '', '0', '0', '2', 8, 'Автозап', 'Любешівське УВГ', '1', '0', 'm3', '108', '17', '125', 'db', '1'),
(33, 13, 6, 3, 'car', '2016-03-04 14:57:47', '2016-02-02', '5', 1, '08:00:00', '17:15:00', '0', '', '0', '0', '5', 8, 'люб - люблязь кузьміч', 'Любешівське УВГ', '1', '0', 'other', '67', '41', '108', 'db', '1'),
(40, 0, 2, 3, 'car', '2016-03-06 13:58:26', '2015-12-31', '0', 1, '08:00:00', '17:15:00', '0', '', '0', '0', '0', 0, 'Фіктивна путівка', 'Любешівське УВГ', '1', '0', 'other', '0', '0', '0', 'sr', '1'),
(41, 0, 6, 3, 'car', '2016-03-06 17:19:06', '2015-12-31', '0', 1, '08:00:00', '17:15:00', '0', '', '0', '0', '0', 0, 'Фіктивна путівка Масюк Газель', 'Любешівське УВГ', '1', '0', 'other', '0', '0', '0', 'db', '1'),
(50, 8, 1, 1, 'truck', '2016-03-10 21:55:33', '2016-02-04', '15', 3, '08:00:00', '17:15:00', '0', '', '', '0', '15', 8, 'потрібно доповнити', 'Любешівське УВГ', '1', '5', 't', '112', '56', '168', 'pr', '1'),
(51, 0, 6, 6, 'car', '2016-03-10 21:59:21', '2015-12-31', '10', 1, '08:00:00', '17:15:00', '0', '', '', '10', '0', 0, 'фіктивна путівка', 'Любешівське УВГ', '1', '0', 'other', '', '0', '', 'sr', '1'),
(48, 18, 5, 4, 'car', '2016-03-10 17:06:24', '2016-02-05', '5', 1, '08:00:00', '17:15:00', '0', '', '', '17', '2', 8, '1', 'Любешівське УВГ', '1', '0', 'other', '984', '12', '996', 'db', '1'),
(49, 19, 5, 4, 'car', '2016-03-10 17:07:06', '2016-02-08', '10', 1, '08:00:00', '17:15:00', '0', '', '', '18', '9', 8, '1', 'Любешівське УВГ', '1', '0', 'other', '996', '54', '1050', 'db', '1'),
(52, 29, 6, 6, 'car', '2016-03-10 22:00:06', '2016-02-12', '0', 1, '08:00:00', '17:15:00', '0', '', '', '0', '10', 8, 'списання залишку за ратно', 'Любешівське УВГ', '1', '0', 'other', '0', '52', '52', 'db', '1'),
(53, 26, 3, 3, 'car', '2016-03-10 22:09:03', '2016-02-23', '10', 1, '08:00:00', '17:15:00', '0', '', '', '3', '7', 8, 'дописати', 'Любешівське УВГ', '1', '0', 'other', '125', '58', '183', 'db', '1'),
(54, 27, 3, 3, 'car', '2016-03-10 22:09:43', '2016-02-24', '2', 1, '08:00:00', '17:15:00', '0', '', '', '0', '5', 8, 'дописати', 'Любешівське УВГ', '1', '0', 'other', '183', '16', '199', 'db', '1'),
(55, 28, 3, 3, 'car', '2016-03-10 22:10:35', '2016-02-25', '3', 1, '08:00:00', '17:15:00', '0', '', '', '0', '3', 8, 'дописати', 'Любешівське УВГ', '1', '0', 'other', '199', '25', '224', 'db', '1'),
(56, 5, 2, 2, 'truck', '2016-03-10 22:14:31', '2016-02-02', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 8, 'Бас', 'Любешівське УВГ', '1', '0', 't', '0', '40', '40', 'sr', '1'),
(57, 6, 2, 2, 'truck', '2016-03-10 22:15:16', '2016-02-04', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 8, 'Бас', 'Любешівське УВГ', '1', '0', 't', '40', '50', '90', 'sr', '1'),
(58, 7, 2, 2, 'truck', '2016-03-10 22:15:58', '2016-02-05', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 8, 'Бас', 'Любешівське УВГ', '1', '0', 't', '90', '20', '110', 'sr', '1'),
(59, 9, 2, 2, 'truck', '2016-03-10 22:16:47', '2016-02-09', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 8, 'найм', 'Любешівське УВГ', '1', '0', 't', '110', '25', '135', 'sr', '1'),
(60, 12, 2, 2, 'truck', '2016-03-10 22:17:30', '2016-02-17', '20', 3, '08:00:00', '17:15:00', '0', '', '', '0', '20', 8, 'дописати', 'Любешівське УВГ', '1', '20', 't', '135', '56', '191', 'pr', '1'),
(61, 20, 5, 4, 'car', '2016-03-10 22:20:18', '2016-02-09', '0', 1, '08:00:00', '17:15:00', '0', '', '', '15', '3', 8, 'дописати', 'Любешівське УВГ', '1', '0', 'other', '1050', '18', '1068', 'db', '1'),
(62, 21, 5, 4, 'car', '2016-03-10 22:20:58', '2016-02-11', '12', 1, '08:00:00', '17:15:00', '0', '', '', '21', '6', 8, 'дописати', 'Любешівське УВГ', '1', '0', 'other', '1068', '36', '1104', 'db', '1'),
(63, 22, 5, 4, 'car', '2016-03-10 22:21:32', '2016-02-12', '50', 1, '08:00:00', '17:15:00', '0', '', '', '19', '52', 8, 'дописати', 'Любешівське УВГ', '1', '0', 'other', '1104', '300', '1404', 'db', '1'),
(64, 23, 5, 4, 'car', '2016-03-10 22:22:29', '2016-02-15', '10', 1, '08:00:00', '17:15:00', '0', '', '', '18', '11', 8, 'дописати', 'Любешівське УВГ', '1', '0', 'other', '1404', '64', '1468', 'db', '1'),
(65, 24, 5, 4, 'car', '2016-03-10 22:23:13', '2016-02-17', '0', 1, '08:00:00', '17:15:00', '0', '', '', '14', '4', 8, 'дописати', 'Любешівське УВГ', '1', '0', 'other', '1468', '24', '1492', 'db', '1'),
(66, 25, 5, 4, 'car', '2016-03-10 22:23:55', '2016-02-22', '0', 1, '08:00:00', '17:15:00', '0', '', '', '3', '11', 8, 'дописати', 'Любешівське УВГ', '1', '0', 'other', '1492', '64', '1556', 'db', '1'),
(67, 30, 5, 4, 'car', '2016-03-23 15:11:59', '2016-03-01', '10', 1, '08:00:00', '17:15:00', '0', '', '', '5', '8', 8, 'перевірка роботи мнс іотто, визначення стану\r\n\nКрисько В.І.', 'Любешівське УВГ', '1', '0', 'other', '1556', '48', '1604', 'db', '1'),
(68, 31, 5, 4, 'car', '2016-03-23 15:13:28', '2016-03-02', '0', 1, '08:00:00', '17:15:00', '0', '', '', '3', '2', 8, 'УВГ - Любешів нст', 'Любешівське УВГ', '1', '0', 'other', '1604', '12', '1616', 'db', '1'),
(69, 32, 5, 4, 'car', '2016-03-23 15:14:47', '2016-03-03', '0', 1, '08:00:00', '17:15:00', '0', '', '', '1', '2', 8, 'перевірка роботи МНС визначення обємів робіт', 'Любешівське УВГ', '0', '0', 'other', '1616', '12', '1628', 'db', '1'),
(72, 33, 3, 4, 'car', '2016-03-23 15:20:07', '2016-03-04', '10', 1, '08:00:00', '17:15:00', '0', '', '', '0', '10', 12, 'чергування бурштин', 'Любешівське УВГ', '1', '0', 'other', '1616', '57', '1673', 'sr', '1'),
(71, 34, 1, 4, 'car', '2016-03-23 15:18:49', '2016-03-04', '5', 1, '08:00:00', '17:15:00', '0', '', '', '0', '5', 12, 'чергування бурштин (ніч)', 'Любешівське УВГ', '1', '0', 'other', '1673', '29', '1702', 'sr', '1'),
(73, 35, 2, 3, 'car', '2016-03-23 15:24:02', '2016-03-04', '5', 1, '08:00:00', '17:15:00', '0', '', '', '0', '5', 8, 'автозапчастини\r\n\nСтрук', 'Любешівське УВГ', '1', '0', 'other', '224', '41', '265', 'db', '1'),
(74, 36, 1, 4, 'car', '2016-03-23 15:26:13', '2016-03-09', '10', 1, '08:00:00', '17:15:00', '0', '', '', '5', '5', 8, 'чергування судче', 'Любешівське УВГ', '1', '0', 'other', '1702', '28', '1730', 'sr', '1'),
(75, 37, 1, 4, 'car', '2016-03-23 15:27:50', '2016-03-10', '0', 1, '08:00:00', '17:15:00', '0', '', '', '0', '5', 8, 'перевірка роботи МНС\r\n\n', 'Любешівське УВГ', '1', '0', 'other', '1730', '29', '1759', 'db', '1'),
(76, 38, 3, 3, 'car', '2016-03-23 15:29:29', '2016-03-14', '7', 1, '08:00:00', '17:15:00', '0', '', '', '0', '7', 8, 'обстеження тобольської н.с.\r\n\nЗімич П.І.', 'Любешівське УВГ', '1', '0', 'other', '525', '58', '583', 'db', '1'),
(77, 39, 3, 3, 'car', '2016-03-23 15:33:11', '2016-03-15', '2', 1, '08:00:00', '17:15:00', '0', '', '', '0', '2', 8, 'автозапчастини (покришка)\r\n\nСтрук', 'Любешівське УВГ', '1', '0', 'other', '583', '16', '599', 'db', '1'),
(78, 40, 3, 3, 'car', '2016-03-23 15:33:31', '2016-03-16', '0', 1, '08:00:00', '17:15:00', '0', '', '', '0', '0', 0, 'не використана', 'Любешівське УВГ', '0', '0', 'other', '599', '0', '599', 'db', '1'),
(79, 41, 6, 3, 'car', '2016-03-23 15:35:46', '2016-03-11', '40', 1, '08:00:00', '17:15:00', '0', '', '', '9', '31', 8, 'УВГ - Ковель', 'Любешівське УВГ', '1', '0', 'other', '265', '260', '525', 'db', '1'),
(80, 42, 3, 3, 'car', '2016-03-23 15:37:06', '2016-03-17', '10', 1, '08:00:00', '17:15:00', '0', '', '', '2', '8', 8, 'УВГ - Коростинка', 'Любешівське УВГ', '1', '0', 'other', '599', '65', '664', 'db', '1'),
(81, 43, 5, 4, 'car', '2016-03-23 15:38:23', '2016-03-17', '10', 1, '08:00:00', '17:15:00', '0', '', '', '8', '5', 8, 'УВГ - Люблязь', 'Любешівське УВГ', '1', '0', 'other', '1759', '18', '1777', 'db', '1'),
(82, 44, 6, 4, 'car', '2016-03-23 15:39:55', '2016-03-18', '20', 1, '08:00:00', '17:15:00', '0', '', '', '0', '20', 8, 'УВГ - м. Глуша - Цирська н.с - по системі', 'Любешівське УВГ', '1', '0', 'other', '1777', '115', '1892', 'db', '1'),
(83, 45, 3, 3, 'car', '2016-03-23 15:41:50', '2016-03-18', '20', 1, '08:00:00', '17:15:00', '0', '', '', '2', '20', 8, 'УВГ - Підкормільська н.с. - Дольська н.с. - с. Сваловичі...', 'Любешівське УВГ', '1', '0', 'other', '664', '165', '829', 'db', '1'),
(84, 46, 6, 3, 'car', '2016-03-23 15:42:14', '2016-03-18', '', 1, '08:00:00', '00:00:00', '0', '', '', '0', '', 0, 'не використана', 'Любешівське УВГ', '0', '0', 'other', '', '', '', 'db', '0'),
(85, 47, 6, 3, 'car', '2016-03-23 15:43:35', '2016-03-21', '0', 1, '08:00:00', '17:15:00', '0', '', '', '0', '9', 8, 'УВГ - Воля - по системі ...', 'Любешівське УВГ', '1', '0', 'other', '829', '75', '904', 'db', '1'),
(86, 48, 3, 3, 'car', '2016-03-23 15:44:34', '2016-03-22', '10', 1, '08:00:00', '17:15:00', '0', '', '', '7', '5', 8, 'Кульміч за 8 березня', 'Любешівське УВГ', '1', '0', 'other', '904', '41', '945', 'db', '1'),
(87, 49, 5, 4, 'car', '2016-03-23 15:45:52', '2016-03-22', '0', 1, '08:00:00', '17:15:00', '0', '', '', '6', '2', 8, 'УВГ - Любешів н.с.....', 'Любешівське УВГ', '1', '0', 'other', '1892', '12', '1904', 'db', '1'),
(88, 50, 5, 4, 'car', '2016-03-23 15:46:48', '2016-03-23', '0', 1, '08:00:00', '17:15:00', '0', '', '', '4', '2', 8, '...', 'Любешівське УВГ', '1', '0', 'other', '1904', '12', '1916', 'db', '1'),
(89, 15, 1, 1, 'truck', '2016-03-23 15:54:19', '2016-03-01', '12', 3, '08:00:00', '17:15:00', '0', '', '', '0', '12', 8, 'УВГ - Коростинка - Дольськ', 'Любешівське УВГ', '1', '0', 't', '275', '45', '320', 'pr', '1'),
(90, 16, 2, 2, 'truck', '2016-03-23 15:55:34', '2016-03-09', '30', 3, '08:00:00', '17:15:00', '0', '', '', '0', '30', 8, 'Чергування бурштин', 'Любешівське УВГ', '1', '0', 't', '191', '84', '275', 'sr', '1'),
(91, 17, 1, 1, 'truck', '2016-03-23 15:57:20', '2016-03-11', '10', 3, '08:00:00', '17:15:00', '0', '', '', '0', '10', 8, 'увг - партизанська\r\n\nнасоси', 'Любешівське УВГ', '1', '0', 't', '320', '39', '359', 'pr', '1'),
(92, 18, 1, 1, 'truck', '2016-03-23 15:59:12', '2016-03-12', '10', 3, '08:00:00', '17:15:00', '0', '', '', '0', '10', 8, 'перевезення компресора', 'Любешівське УВГ', '1', '0', 't', '359', '39', '398', 'pr', '1'),
(93, 19, 1, 1, 'truck', '2016-03-23 16:00:43', '2016-03-14', '13', 3, '08:00:00', '17:15:00', '0', '', '', '0', '13', 8, '2 насаси \r\n\nУВГ - Коростинка -Дольськ', 'Любешівське УВГ', '1', '0', 't', '398', '51', '449', 'pr', '1'),
(94, 20, 6, 7, 'truck', '2016-03-23 16:02:52', '2016-03-16', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 4, '№ 26 від 15.03.16\r\n\n272 грн\r\n\nМартинчук Г.І.', 'Любешівське УВГ', '1', '4', 'motogod', '', '5', '', 'sr', '1'),
(95, 21, 2, 2, 'truck', '2016-03-23 16:04:58', '2016-03-18', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 2, '№ 35 від 18.03.16\r\n\n2 год\r\n\nМихалюк Г.О.', 'Любешівське УВГ', '1', '24', 't', '275', '20', '295', 'sr', '1'),
(96, 22, 6, 7, 'truck', '2016-03-23 16:06:44', '2016-03-18', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 0, '№ 36\r\n\n1,5 год\r\n\nПанчишин Б.І.', 'Любешівське УВГ', '1', '2', 'motogod', '0', '10', '10', 'sr', '1'),
(97, 23, 1, 1, 'truck', '2016-03-23 16:08:46', '2016-03-18', '0', 3, '08:00:00', '10:00:00', '0', '', '', '0', '0', 0, '№ 36\r\n\n1,5 год\r\n\nПанчишин Б.І.', 'Любешівське УВГ', '1', '1', 't', '449', '10', '459', 'sr', '1'),
(98, 24, 6, 7, 'truck', '2016-03-23 16:11:33', '2016-03-22', '10', 3, '09:00:00', '10:00:00', '0', '', '', '0', '10', 1, '№ 37\r\n\n1 год\r\n\nЛюбешів_комфорт Сервіс', 'Любешівське УВГ', '1', '1', 'motogod', '10', '10', '20', 'sr', '1'),
(99, 25, 3, 1, 'truck', '2016-03-23 16:12:07', '2016-03-23', '20', 3, '08:00:00', '17:15:00', '0', '', '', '0', '20', 0, 'по дрова', 'Любешівське УВГ', '1', '6', 'm3', '459', '81', '540', 'pr', '1'),
(100, 0, 6, 4, 'car', '2016-03-24 22:28:48', '2015-12-31', '0', 1, '08:00:00', '17:15:00', '0', '', '', '0', '0', 0, 'нульова путівка', 'Любешівське УВГ', '1', '0', 'other', '0', '0', '0', 'sr', '1'),
(101, 5, 4, 5, 'tractor', '2016-03-25 12:09:16', '2016-03-18', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 2, '№ 35\r\n\nМихалюк Г.О.', 'Любешівське УВГ', '1', '2', 'motogod', '', '0', '', 'sr', '1'),
(102, 6, 4, 5, 'tractor', '2016-03-25 12:10:59', '2016-03-23', '20', 3, '08:00:00', '17:15:00', '0', '', '', '0', '20', 8, 'Любешів - Підкормільська н.с.\r\n\n6 м3 погрузка грунту 2,4 мгод', 'Любешівське УВГ', '1', '3', 'motogod', '0', '0', '0', 'pr', '1'),
(103, 7, 4, 5, 'tractor', '2016-03-25 12:12:52', '2016-03-25', '2', 3, '08:00:00', '17:15:00', '0', '', '', '0', '2', 5, 'буксирування екскаватора', 'Любешівське УВГ', '1', '1', 'motogod', '', '0', '', 'db', '1'),
(104, 8, 4, 5, 'tractor', '2016-03-25 12:13:56', '2016-03-25', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 2, 'Михалюк\r\n\n2 год х 176 = 352', 'Любешівське УВГ', '1', '2', 'motogod', '', '0', '', 'sr', '1'),
(105, 51, 3, 3, 'car', '2016-03-25 12:18:00', '2016-03-24', '6', 1, '08:00:00', '17:15:00', '0', '', '', '7', '6', 8, 'Шпанчик', 'Любешівське УВГ', '1', '0', 'other', '945', '50', '995', 'sr', '1'),
(106, 52, 5, 4, 'car', '2016-03-25 12:19:52', '2016-03-24', '0', 1, '08:00:00', '17:15:00', '0', '', '', '2', '2', 8, 'любешів - залаззя', 'Любешівське УВГ', '1', '0', 'other', '1916', '12', '1928', 'db', '1'),
(107, 53, 3, 3, 'car', '2016-03-25 12:21:18', '2016-03-25', '0', 1, '08:00:00', '17:15:00', '0', '', '', '2', '5', 8, 'кульміч на 8 березня', 'Любешівське УВГ', '1', '0', 'other', '995', '42', '1037', 'db', '1'),
(108, 54, 5, 4, 'car', '2016-03-25 12:22:12', '2016-03-25', '0', 1, '08:00:00', '17:15:00', '0', '', '', '1', '1', 0, 'УВГ - Любешів н.с', 'Любешівське УВГ', '1', '0', 'other', '1928', '6', '1934', 'db', '1'),
(109, 55, 5, 4, 'car', '2016-03-25 12:22:30', '2016-03-28', '50', 1, '08:00:00', '17:15:00', '0', '', '', '2', '49', 8, 'УВГ - Луцьк', 'Любешівське УВГ', '1', '0', 'other', '1934', '280', '2214', 'sr', '1'),
(110, 0, 1, 4, 'car', '2016-03-30 11:23:42', '2015-12-31', '0', 1, '08:00:00', '17:15:00', '0', '', '', '0', '0', 0, 'нульова путівка', 'Любешівське УВГ', '1', '0', 'other', '0', '0', '0', 'sr', '1'),
(111, 0, 3, 4, 'car', '2016-03-30 11:24:07', '2015-12-31', '0', 1, '08:00:00', '17:15:00', '0', '', '', '0', '0', 0, 'нульова путівка', 'Любешівське УВГ', '1', '0', 'other', '0', '0', '0', 'sr', '1'),
(112, 56, 3, 3, 'car', '2016-04-19 13:37:05', '2016-04-04', '6', 1, '08:00:00', '00:00:00', '0', '', '', '2', '6', 8, '-', 'Любешівське УВГ', '1', '0', 'other', '1037', '50', '1087', 'db', '1'),
(113, 57, 5, 4, 'car', '2016-04-19 13:37:34', '2016-04-04', '50', 1, '08:00:00', '17:15:00', '0', '', '', '2', '50', 8, 'луцьк', 'Любешівське УВГ', '1', '0', 'other', '2214', '290', '2504', 'db', '1'),
(114, 58, 3, 4, 'car', '2016-04-19 13:37:55', '2016-04-05', '40', 1, '08:00:00', '19:15:00', '0', '', '', '0', '40', 0, 'Ратно', 'Любешівське УВГ', '1', '0', 'other', '2504', '228', '2732', 'sr', '1'),
(115, 59, 5, 3, 'car', '2016-04-19 13:38:19', '2016-04-05', '5', 1, '08:00:00', '17:15:00', '0', '', '', '0', '5', 8, 'бучин нс', 'Любешівське УВГ', '1', '0', 'other', '1087', '40', '1127', 'sr', '1'),
(116, 60, 5, 4, 'car', '2016-04-19 13:38:42', '2016-04-06', '5', 1, '08:00:00', '17:15:00', '0', '', '', '5', '2', 8, 'запчастини', 'Любешівське УВГ', '1', '0', 'other', '2732', '12', '2744', 'db', '1'),
(117, 61, 5, 4, 'car', '2016-04-19 13:39:02', '2016-04-08', '0', 1, '08:00:00', '17:15:00', '0', '', '', '1', '4', 8, 'заріка нс', 'Любешівське УВГ', '1', '0', 'other', '2744', '24', '2768', 'db', '1'),
(118, 62, 5, 3, 'car', '2016-04-19 13:39:41', '2016-04-11', '3', 1, '08:00:00', '09:00:00', '0', '', '', '0', '3', 1, 'Воля Любешівська', 'Любешівське УВГ', '1', '0', 'other', '1127', '25', '1152', 'sr', '1'),
(119, 63, 5, 4, 'car', '2016-04-19 13:40:21', '2016-04-12', '50', 1, '08:00:00', '17:15:00', '0', '', '', '2', '49', 8, 'Луцьк(фейкова)', 'Любешівське УВГ', '1', '0', 'other', '2768', '280', '3048', 'db', '1'),
(120, 64, 2, 3, 'car', '2016-04-19 13:41:00', '2016-04-12', '7', 1, '08:00:00', '17:15:00', '0', '', '', '0', '7', 1, 'Любешівська Воля (мусорнік)', 'Любешівське УВГ', '1', '0', 'other', '1152', '58', '1210', 'sr', '1'),
(121, 65, 5, 3, 'car', '2016-04-19 13:41:37', '2016-04-13', '3', 1, '08:00:00', '17:15:00', '0', '', '', '0', '3', 8, 'Любешівська Воля (мусорнік)', 'Любешівське УВГ', '1', '0', 'other', '1210', '25', '1235', 'db', '1'),
(122, 66, 6, 3, 'car', '2016-04-19 13:43:55', '2016-04-15', '2', 1, '08:00:00', '00:00:00', '0', '', '', '0', '2', 8, 'Люб Воля мусорнік за 12.04.16\r\n\nпальне Кузьміча', 'Любешівське УВГ', '1', '0', 'other', '1235', '16', '1251', 'db', '1'),
(123, 67, 5, 4, 'car', '2016-04-19 13:44:22', '2016-04-18', '4', 1, '08:00:00', '17:15:00', '0', '', '', '2', '4', 8, 'курін', 'Любешівське УВГ', '1', '0', 'other', '3048', '23', '3071', 'db', '1'),
(124, 68, 2, 4, 'car', '2016-04-19 13:45:45', '2016-04-19', '6', 1, '08:00:00', '17:15:00', '0', '', '', '3', '3', 1, 'Мусорнік(поїхав своєю) по залишку від бондара', 'Любешівське УВГ', '1', '0', 'other', '3071', '17', '3088', 'sr', '1'),
(125, 69, 6, 3, 'car', '2016-04-19 13:46:28', '2016-04-19', '30', 1, '08:00:00', '17:15:00', '0', '', '', '0', '30', 10, 'Любешівське УВГ - Ратно\r\n\nобмірка роботи', 'Любешівське УВГ', '1', '0', 'other', '1251', '250', '1501', 'db', '1'),
(126, 29, 2, 2, 'truck', '2016-04-19 13:50:15', '2016-04-01', '0', 3, '08:00:00', '00:00:00', '0', '', '', '0', '0', 2, '№', 'Михалюк', '1', '18', 't', '295', '20', '315', 'sr', '1'),
(127, 30, 5, 1, 'truck', '2016-04-19 14:18:49', '2016-04-01', '0', 3, '08:00:00', '09:00:00', '0', '', '', '0', '0', 1, 'Горщар', 'Горщар', '1', '4', 't', '540', '12', '552', 'sr', '1'),
(128, 31, 6, 7, 'truck', '2016-04-19 14:19:41', '2016-04-01', '0', 3, '08:00:00', '09:00:00', '0', '', '', '0', '0', 1, 'за мин міс №44', 'Мартинчук', '1', '5', 'motogod', '20', '5', '25', 'sr', '1'),
(132, 34, 2, 2, 'truck', '2016-04-19 14:22:37', '2016-04-08', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 3, '№ 48\r\n\n№ 49', 'Бондарчук Комзюк', '1', '48', 't', '325', '40', '365', 'sr', '1'),
(130, 32, 2, 2, 'truck', '2016-04-19 14:21:18', '2016-04-06', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 1, '№47', 'Юрашкевич', '1', '8', 't', '315', '10', '325', 'sr', '1'),
(131, 33, 3, 1, 'truck', '2016-04-19 14:21:58', '2016-04-06', '15', 3, '08:00:00', '17:15:00', '0', '', '', '0', '15', 8, 'дрова лобна', 'Любешівське УВГ', '1', '6', 't', '552', '60', '612', 'sr', '1'),
(133, 35, 2, 2, 'truck', '2016-04-19 14:22:54', '2016-04-11', '25', 3, '08:00:00', '17:15:00', '0', '', '', '0', '25', 1, 'мусорнік Воля Любешівська', 'Любешівське УВГ', '1', '24', 't', '365', '9', '374', 'sr', '1'),
(134, 36, 2, 2, 'truck', '2016-04-19 14:23:13', '2016-04-13', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 8, 'міст лісхоз', 'Любешів Лісхоз', '1', '48', 't', '374', '40', '414', 'sr', '1'),
(135, 37, 6, 7, 'truck', '2016-04-19 14:23:56', '2016-04-14', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 3, 'агроліс', 'Любешів Лісгосп', '1', '3', 'motogod', '25', '5', '30', 'sr', '1'),
(136, 38, 2, 2, 'truck', '2016-04-19 14:24:23', '2016-04-14', '30', 3, '08:00:00', '17:15:00', '0', '', '', '0', '30', 8, 'ремонт греблі', 'Любешівське УВГ', '1', '80', 't', '414', '80', '494', 'pr', '1'),
(137, 39, 2, 2, 'truck', '2016-04-19 14:24:36', '2016-04-15', '40', 3, '08:00:00', '17:15:00', '0', '', '', '0', '40', 8, 'селишна асальт', 'Селишна', '1', '96', 't', '494', '112', '606', 'sr', '1'),
(138, 40, 2, 2, 'truck', '2016-04-19 14:24:52', '2016-04-18', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 2, 'Курін мусорнік', 'Курін ', '1', '48', 't', '606', '11', '617', 'sr', '1'),
(139, 41, 5, 1, 'truck', '2016-04-19 14:25:31', '2016-04-19', '20', 3, '08:00:00', '17:15:00', '0', '', '', '0', '20', 8, 'по дрова з шпанчиком', 'Любешівське УВГ', '1', '6', 't', '672', '80', '752', 'sr', '1'),
(140, 9, 4, 5, 'tractor', '2016-04-19 14:27:05', '2016-04-01', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 4, 'Михалюк', 'Любешівське УВГ', '1', '4', 'motogod', '0', '0', '0', 'sr', '1'),
(141, 10, 4, 5, 'tractor', '2016-04-19 14:27:16', '2016-04-13', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 8, 'Лісгосп', 'Любешівське УВГ', '1', '8', 'motogod', '0', '0', '0', 'sr', '1'),
(142, 11, 4, 5, 'tractor', '2016-04-19 14:27:25', '2016-04-14', '12', 3, '08:00:00', '17:15:00', '0', '', '', '0', '12', 8, 'УВГ', 'Любешівське УВГ', '1', '8', 'motogod', '0', '0', '0', 'pr', '1'),
(143, 12, 11, 11, 'tractor', '2016-04-19 14:27:35', '2016-04-14', '18', 3, '08:00:00', '17:15:00', '0', '', '', '0', '18', 8, 'ремонт греблі', 'Любешівське УВГ', '1', '50', 'm3', '0', '0', '0', 'pr', '1'),
(144, 13, 4, 5, 'tractor', '2016-04-19 14:27:43', '2016-04-15', '25', 3, '08:00:00', '17:15:00', '0', '', '', '0', '25', 8, 'ремонт дамби', 'Любешівське УВГ', '1', '8', 'motogod', '0', '0', '0', 'pr', '1'),
(145, 14, 4, 5, 'tractor', '2016-04-28 10:08:37', '2016-04-21', '0', 3, '08:00:00', '16:00:00', '0', '', '', '0', '0', 7, 'Лісгосп', 'Любешівське УВГ', '1', '7', 'motogod', '', '0', '', 'sr', '1'),
(146, 15, 4, 5, 'tractor', '2016-04-28 10:09:23', '2016-04-22', '0', 3, '08:00:00', '16:00:00', '0', '', '', '0', '0', 7, 'Лісгосп', 'Любешівське УВГ', '1', '7', 'motogod', '', '0', '', 'sr', '1'),
(147, 16, 4, 5, 'tractor', '2016-04-28 10:09:58', '2016-04-25', '0', 3, '08:00:00', '16:00:00', '0', '', '', '0', '0', 7, 'лісгосп', 'Любешівське УВГ', '1', '7', 'motogod', '', '0', '', 'sr', '1'),
(148, 42, 2, 2, 'truck', '2016-04-28 10:40:20', '2016-04-21', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 2, 'курін мусорнік', 'Любешівське УВГ', '1', '28', 't', '617', '10', '627', 'sr', '1'),
(149, 43, 2, 2, 'truck', '2016-04-28 10:41:51', '2016-04-22', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 7, 'лісгосп', 'Любешівське УВГ', '1', '96', 't', '627', '80', '707', 'sr', '1'),
(150, 44, 2, 2, 'truck', '2016-04-28 10:42:30', '2016-04-25', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 7, 'лісгосп', 'Любешів Лісгосп', '1', '96', 't', '707', '80', '787', 'sr', '1'),
(151, 45, 2, 2, 'truck', '2016-04-28 10:44:29', '2016-04-26', '15', 3, '08:00:00', '17:15:00', '0', '', '', '0', '15', 2, 'перевезення екскаватора\r\n\nі транспортування трала', 'Любешівське УВГ', '1', '30', 't', '787', '42', '829', 'sr', '1'),
(152, 40, 5, 1, 'truck', '2016-04-28 10:52:35', '2016-04-15', '15', 3, '08:00:00', '17:15:00', '0', '', '', '0', '15', 8, 'перевезення землі', 'Любешівське УВГ', '1', '28', 't', '612', '60', '672', 'pr', '1'),
(153, 76, 3, 3, 'car', '2016-04-28 11:04:19', '2016-04-25', '5', 1, '08:00:00', '17:15:00', '0', '', '', '0', '7', 8, 'мусорнік', 'Любешівське УВГ', '1', '0', 'other', '1861', '58', '1919', 'sr', '1'),
(154, 77, 3, 3, 'car', '2016-04-28 11:05:39', '2016-04-26', '5', 1, '08:00:00', '12:00:00', '0', '', '', '0', '5', 4, 'мусорнік', 'Любешівське УВГ', '1', '0', 'other', '1919', '41', '1960', 'sr', '1'),
(155, 71, 6, 6, 'car', '2016-04-28 11:10:38', '2016-04-20', '5', 1, '08:00:00', '17:15:00', '0', '', '', '0', '5', 8, 'ремонт ЕТ-16', 'Любешівське УВГ', '1', '0', 'other', '52', '26', '78', 'sr', '1'),
(156, 72, 6, 4, 'car', '2016-04-28 11:11:38', '2016-04-21', '10', 1, '08:00:00', '17:15:00', '0', '', '', '2', '8', 8, 'любешів люблязь', 'Любешівське УВГ', '1', '0', 'other', '3105', '50', '3155', 'db', '1'),
(157, 73, 6, 3, 'car', '2016-04-28 11:12:57', '2016-04-22', '3', 1, '08:00:00', '17:15:00', '0', '', '', '-2', '5', 8, 'любешів деревок', 'Любешівське УВГ', '1', '0', 'other', '1831', '30', '1861', 'db', '1'),
(158, 70, 2, 4, 'car', '2016-04-28 11:22:40', '2016-04-20', '0', 1, '08:00:00', '09:00:00', '0', '', '', '0', '3', 1, 'курін', 'Любешівське УВГ', '1', '0', 'other', '3088', '17', '3105', 'sr', '1'),
(159, 75, 5, 4, 'car', '2016-04-28 11:28:23', '2016-04-25', '0', 1, '08:00:00', '17:15:00', '0', '', '', '1', '10', 8, 'хомутинська нс', 'Любешівське УВГ', '1', '0', 'other', '3219', '58', '3277', 'db', '1'),
(160, 74, 5, 4, 'car', '2016-04-28 11:29:09', '2016-04-22', '20', 1, '08:00:00', '17:15:00', '0', '', '', '11', '11', 8, 'цирська нс', 'Любешівське УВГ', '1', '0', 'other', '3155', '64', '3219', 'db', '1'),
(161, 70, 5, 3, 'car', '2016-04-28 11:29:49', '2016-04-20', '40', 1, '08:00:00', '17:15:00', '0', '', '', '0', '40', 8, 'Луцьк', 'Любешівське УВГ', '1', '0', 'other', '1501', '330', '1831', 'db', '1'),
(162, 17, 4, 5, 'tractor', '2016-05-27 13:31:23', '2016-05-10', '30', 3, '08:00:00', '17:15:00', '3', '', '', '0', '30', 8, 'Дольськ', 'Любешівське УВГ', '1', '0', 'motogod', '', '0', '', 'pr', '1'),
(163, 32, 4, 5, 'tractor', '2016-05-27 13:32:07', '2016-05-18', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 1, 'Шоломітський', 'Любешівське УВГ', '1', '1', 'motogod', '', '0', '', 'sr', '1'),
(164, 48, 2, 2, 'truck', '2016-05-27 13:34:02', '2016-05-05', '10', 3, '08:00:00', '17:15:00', '0', '', '', '0', '10', 8, 'дрова', 'Любешівське УВГ', '1', '8', 'm3', '829', '28', '857', 'sr', '1'),
(165, 49, 2, 2, 'truck', '2016-05-27 13:35:47', '2016-05-10', '40', 3, '08:00:00', '17:15:00', '2', '', '', '0', '40', 8, 'Дольськ\r\n\nперевезення екскаваторів', 'Любешівське УВГ', '1', '52', 't', '857', '80', '937', 'sr', '1'),
(166, 51, 2, 2, 'truck', '2016-05-27 13:38:10', '2016-05-12', '10', 3, '08:00:00', '17:15:00', '0', '', '', '0', '10', 8, 'ремонт н.с. Седлище\r\n\nКузьміч', 'Любешівське УВГ', '1', '0', 't', '937', '30', '967', 'sr', '1'),
(167, 52, 2, 2, 'truck', '2016-05-27 13:39:43', '2016-05-24', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 2, 'Кух 2 год №71', 'Любешівське УВГ', '1', '0', 't', '967', '80', '1047', 'sr', '1'),
(168, 47, 6, 1, 'truck', '2016-05-27 13:42:00', '2016-05-04', '5', 3, '08:00:00', '17:15:00', '0', '', '', '0', '5', 8, 'брикети паливні', 'Любешівське УВГ', '1', '4', 't', '752', '20', '772', 'sr', '1'),
(169, 80, 6, 3, 'car', '2016-05-27 13:42:58', '2016-05-06', '3', 1, '08:00:00', '17:15:00', '0', '', '', '-2', '3', 8, 'автозапчастини\r\n\nСтрук', 'Любешівське УВГ', '1', '0', 'other', '2084', '24', '2108', 'db', '1'),
(170, 50, 3, 1, 'truck', '2016-05-27 13:45:02', '2016-05-10', '15', 3, '08:00:00', '17:15:00', '2', '', '', '0', '15', 8, 'перевезеня вагончика Дольськ', 'Любешівське УВГ', '1', '1', 't', '772', '60', '832', 'sr', '1'),
(171, 78, 3, 3, 'car', '2016-05-27 13:46:47', '2016-05-04', '5', 1, '08:00:00', '17:15:00', '0', '', '', '0', '5', 8, 'Люб - Хоцунь\r\n\nЗімич', 'Любешівське УВГ', '1', '0', 'other', '1960', '42', '2002', 'db', '1'),
(172, 79, 3, 3, 'car', '2016-05-27 13:47:52', '2016-05-05', '10', 1, '08:00:00', '17:15:00', '0', '', '', '0', '10', 8, 'Зімич\r\n\nЛюб - В.Глуша', 'Любешівське УВГ', '1', '0', 'other', '2002', '82', '2084', 'db', '1'),
(183, 84, 3, 6, 'car', '2016-05-27 14:06:30', '2016-05-11', '10', 1, '08:00:00', '17:15:00', '0', '', '', '0', '10', 8, 'Любешів - Дольськ', 'Любешівське УВГ', '1', '0', 'other', '78', '83', '161', 'sr', '1'),
(174, 88, 3, 3, 'car', '2016-05-27 13:50:50', '2016-05-16', '10', 1, '08:00:00', '17:15:00', '0', '', '', '0', '10', 8, 'Любешів - Дольськ\r\n\nКузьміч', 'Любешівське УВГ', '1', '0', 'other', '2108', '83', '2191', 'db', '1'),
(175, 89, 3, 3, 'car', '2016-05-27 13:51:44', '2016-05-17', '10', 1, '08:00:00', '17:15:00', '0', '', '', '3', '7', 8, 'Любешів - Дольськ', 'Любешівське УВГ', '1', '0', 'other', '2191', '58', '2249', 'sr', '1'),
(176, 90, 3, 3, 'car', '2016-05-27 13:52:42', '2016-05-18', '5', 1, '08:00:00', '17:15:00', '0', '', '', '0', '8', 8, 'Любешів - Дольськ', 'Любешівське УВГ', '1', '0', 'other', '2249', '66', '2315', 'sr', '1'),
(177, 93, 3, 3, 'car', '2016-05-27 13:53:24', '2016-05-20', '7', 1, '08:00:00', '17:15:00', '0', '', '', '0', '7', 8, 'Любешів - Дольськ', 'Любешівське УВГ', '1', '0', 'other', '2373', '58', '2431', 'sr', '1'),
(178, 95, 3, 3, 'car', '2016-05-27 13:54:31', '2016-05-23', '10', 1, '08:00:00', '17:15:00', '0', '', '', '3', '7', 8, 'Любешів - Дольськ', 'Любешівське УВГ', '1', '0', 'other', '2431', '58', '2489', 'sr', '1'),
(179, 97, 3, 3, 'car', '2016-05-27 13:56:12', '2016-05-24', '20', 1, '08:00:00', '17:15:00', '0', '', '', '0', '23', 9, 'Шпанчик', 'Любешівське УВГ', '1', '0', 'other', '2489', '190', '2679', 'sr', '1'),
(180, 98, 3, 3, 'car', '2016-05-27 13:57:10', '2016-05-25', '10', 1, '08:00:00', '17:15:00', '0', '', '', '3', '7', 8, 'Любешів - Дольськ', 'Любешівське УВГ', '1', '0', 'other', '2679', '58', '2737', 'sr', '1'),
(181, 99, 3, 3, 'car', '2016-05-27 13:57:56', '2016-05-26', '7', 1, '08:00:00', '17:15:00', '0', '', '', '3', '7', 8, 'Любешів - Дольськ', 'Любешівське УВГ', '1', '0', 'other', '2737', '58', '2795', 'sr', '1'),
(182, 101, 3, 3, 'car', '2016-05-27 13:58:26', '2016-05-27', '7', 1, '08:00:00', '17:15:00', '0', '', '', '3', '7', 8, 'Любешів - Дольськ', 'Любешівське УВГ', '1', '0', 'other', '2795', '58', '2853', 'sr', '1'),
(184, 81, 5, 4, 'car', '2016-05-27 14:13:12', '2016-05-06', '5', 1, '08:00:00', '17:15:00', '0', '', '', '1', '5', 8, 'Люб Підкормілля', 'Любешівське УВГ', '1', '0', 'other', '3277', '30', '3307', 'pr', '1'),
(185, 82, 5, 4, 'car', '2016-05-27 14:14:12', '2016-05-10', '25', 1, '08:00:00', '17:15:00', '0', '', '', '14', '12', 8, 'Люб Хоцунь Дольськ', 'Любешівське УВГ', '1', '0', 'other', '3307', '70', '3377', 'db', '1'),
(186, 83, 5, 4, 'car', '2016-05-27 14:15:00', '2016-05-11', '25', 1, '08:00:00', '17:15:00', '0', '', '', '13', '26', 8, 'Любешів - Люблязь', 'Любешівське УВГ', '1', '0', 'other', '3377', '151', '3528', 'db', '1'),
(187, 85, 5, 4, 'car', '2016-05-27 14:16:06', '2016-05-12', '15', 1, '08:00:00', '17:15:00', '0', '', '', '20', '8', 8, 'Люб - Дольськ', 'Любешівське УВГ', '1', '0', 'other', '3528', '54', '3582', 'db', '1'),
(188, 86, 5, 4, 'car', '2016-05-27 14:16:58', '2016-05-13', '0', 1, '08:00:00', '17:15:00', '0', '', '', '15', '5', 8, 'Люб - Седлище', 'Любешівське УВГ', '1', '0', 'other', '3582', '30', '3612', 'db', '1'),
(189, 87, 5, 4, 'car', '2016-05-27 14:17:53', '2016-05-16', '10', 1, '08:00:00', '17:15:00', '0', '', '', '16', '9', 8, 'Люб - Дольськ', 'Любешівське УВГ', '1', '0', 'other', '3612', '54', '3666', 'sr', '1'),
(190, 91, 5, 4, 'car', '2016-05-27 14:18:51', '2016-05-18', '4', 1, '08:00:00', '17:15:00', '0', '', '', '17', '3', 8, 'Люб - Зарудче\r\n\nСтрук', 'Любешівське УВГ', '1', '0', 'other', '3666', '18', '3684', 'db', '1'),
(191, 92, 5, 3, 'car', '2016-05-27 14:19:35', '2016-05-19', '7', 1, '08:00:00', '17:15:00', '0', '', '', '0', '7', 8, 'Любешів - Дольськ', 'Любешівське УВГ', '1', '0', 'other', '2315', '58', '2373', 'sr', '1'),
(192, 94, 5, 4, 'car', '2016-05-27 14:20:43', '2016-05-20', '3', 1, '08:00:00', '17:15:00', '0', '', '', '16', '4', 8, 'Люб - Заріка', 'Любешівське УВГ', '1', '0', 'other', '3684', '24', '3708', 'db', '1'),
(193, 96, 5, 4, 'car', '2016-05-27 14:21:33', '2016-05-23', '2', 1, '08:00:00', '17:15:00', '0', '', '', '8', '10', 8, 'Люб - Цир', 'Любешівське УВГ', '1', '0', 'other', '3708', '58', '3766', 'db', '1'),
(194, 100, 5, 4, 'car', '2016-05-27 14:22:18', '2016-05-26', '47', 1, '08:00:00', '17:15:00', '0', '', '', '15', '40', 8, 'Люб - Ратно', 'Любешівське УВГ', '1', '0', 'other', '3766', '230', '3996', 'db', '1'),
(195, 41, 8, 12, 'tractor', '2016-05-31 13:29:11', '2016-05-25', '10', 3, '08:00:00', '17:15:00', '0', '', '', '0', '10', 8, 'дольськ пот рем\r\n\nшпанчик', 'Любешівське УВГ', '1', '0', 'motogod', '', '0', '', 'pr', '1'),
(196, 102, 5, 4, 'car', '2016-06-24 12:44:14', '2016-06-01', '40', 1, '08:00:00', '17:15:00', '0', '', '', '3', '52', 8, 'Любешів - Луцьк', 'Любешівське УВГ', '1', '0', 'other', '3996', '298', '4294', 'db', '1'),
(197, 104, 5, 4, 'car', '2016-06-24 12:45:14', '2016-06-02', '10', 1, '08:00:00', '17:15:00', '0', '', '', '5', '8', 8, 'Любешів - Цир', 'Любешівське УВГ', '1', '0', 'other', '4294', '46', '4340', 'db', '1'),
(198, 108, 5, 4, 'car', '2016-06-24 12:46:13', '2016-06-03', '0', 1, '08:00:00', '17:15:00', '0', '', '', '3', '2', 8, 'Агроремаш', 'Любешівське УВГ', '1', '0', 'other', '4340', '12', '4352', 'db', '1'),
(199, 109, 5, 4, 'car', '2016-06-24 12:46:50', '2016-06-06', '10', 1, '08:00:00', '17:15:00', '0', '', '', '4', '9', 8, 'Седлище', 'Любешівське УВГ', '1', '0', 'other', '4352', '52', '4404', 'db', '1'),
(200, 120, 5, 4, 'car', '2016-06-24 12:47:42', '2016-06-16', '10', 1, '08:00:00', '17:15:00', '0', '', '', '6', '8', 8, 'Хоцунь', 'Любешівське УВГ', '1', '0', 'other', '4404', '46', '4450', 'db', '1'),
(201, 123, 1, 6, 'car', '2016-06-24 12:49:23', '2016-06-21', '40', 1, '08:00:00', '17:15:00', '0', '', '', '0', '40', 11, 'Ковель', 'Любешівське УВГ', '1', '0', 'other', '275', '208', '483', 'db', '1'),
(202, 118, 1, 6, 'car', '2016-06-24 12:50:55', '2016-06-16', '10', 1, '08:00:00', '17:15:00', '0', '', '', '0', '10', 8, 'Дольськ\r\n\nпо системі', 'Любешівське УВГ', '1', '0', 'other', '213', '52', '265', 'sr', '1'),
(203, 117, 1, 6, 'car', '2016-06-24 12:51:59', '2016-06-15', '10', 1, '08:00:00', '17:15:00', '0', '', '', '0', '10', 8, 'Любешів - Дольськ\r\n\n', 'Любешівське УВГ', '1', '0', 'other', '161', '52', '213', 'sr', '1'),
(204, 63, 1, 1, 'truck', '2016-06-24 12:53:35', '2016-06-10', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 8, 'Бас № 79', 'Бас', '1', '40', 't', '934', '50', '984', 'sr', '1'),
(205, 58, 1, 1, 'truck', '2016-06-24 12:55:39', '2016-06-08', '25', 3, '08:00:00', '17:15:00', '0', '', '', '0', '25', 9, 'Перевезення трансформатора', 'Любешівське УВГ', '1', '6', 't', '832', '102', '934', 'sr', '1'),
(206, 122, 6, 6, 'car', '2016-06-24 12:57:50', '2016-06-17', '2', 1, '08:00:00', '17:15:00', '0', '', '', '0', '2', 8, 'по місту', 'Любешівське УВГ', '1', '0', 'other', '265', '10', '275', 'db', '1'),
(207, 59, 6, 7, 'truck', '2016-06-24 12:59:14', '2016-06-08', '30', 3, '08:00:00', '17:15:00', '0', '', '', '2', '28', 8, 'трансформатор', 'Любешівське УВГ', '1', '2', 't', '30', '40', '70', 'sr', '1'),
(208, 46, 4, 5, 'tractor', '2016-06-24 13:01:00', '2016-06-10', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 8, 'Бас 79', 'Бас', '1', '0', 'm3', '', '0', '', 'sr', '1'),
(209, 49, 4, 5, 'tractor', '2016-06-24 13:01:52', '2016-06-13', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 4, 'Божко АМ', 'Божко А.М.', '1', '0', 'm3', '', '0', '', 'sr', '1'),
(210, 56, 8, 12, 'tractor', '2016-06-24 13:03:48', '2016-06-16', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 4, 'Жилко 84', 'Жилко В.В,', '1', '148', 'm3', '', '0', '', 'sr', '1'),
(211, 54, 8, 12, 'tractor', '2016-06-24 13:05:11', '2016-06-15', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 8, 'Швайко ', 'Швайко', '1', '0', 'm3', '', '0', '', 'sr', '1'),
(212, 51, 8, 12, 'tractor', '2016-06-24 13:06:12', '2016-06-13', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 8, 'Набайчик №81', 'Набайчик', '1', '0', 'm3', '', '0', '', 'sr', '1'),
(213, 68, 2, 2, 'truck', '2016-06-24 13:11:11', '2016-06-16', '15', 3, '08:00:00', '17:15:00', '0', '', '', '0', '15', 8, 'Кух в.І. 1 год\r\n\nШпанчик 1 год', 'Кух В.І. Любешівське УВГ', '1', '7', 't', '1222', '44', '1266', 'sr', '1'),
(214, 67, 2, 2, 'truck', '2016-06-24 13:12:10', '2016-06-15', '13', 3, '08:00:00', '17:15:00', '0', '', '', '0', '13', 8, 'дольськ', 'Любешівське УВГ', '1', '7', 't', '1182', '40', '1222', 'sr', '1'),
(215, 64, 2, 2, 'truck', '2016-06-24 13:14:34', '2016-06-13', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 7, 'Набайчик А.А. №81', 'Набайчик А.А.', '1', '12', 't', '1142', '40', '1182', 'sr', '1'),
(216, 60, 2, 2, 'truck', '2016-06-24 13:15:54', '2016-06-10', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '20', 9, 'с. Віл', 'Любешівське УВГ', '1', '33', 't', '1082', '60', '1142', 'sr', '1'),
(217, 55, 2, 2, 'truck', '2016-06-24 13:16:44', '2016-06-08', '30', 3, '08:00:00', '17:15:00', '0', '', '', '20', '10', 9, 'с.Віл', 'Любешівське УВГ', '1', '31', 't', '1067', '15', '1082', 'sr', '1'),
(218, 53, 2, 2, 'truck', '2016-06-24 13:18:50', '2016-06-01', '0', 3, '08:00:00', '17:15:00', '0', '', '', '0', '0', 2, 'Лебеля Р.І.', 'Лебеля Р.І.', '1', '16', 't', '1047', '20', '1067', 'sr', '1'),
(219, 103, 3, 3, 'car', '2016-06-29 10:41:05', '2016-06-01', '5', 1, '08:00:00', '17:15:00', '0', '', '', '3', '5', 8, '1', 'Любешівське УВГ', '1', '0', 'other', '2853', '41', '2894', 'db', '1'),
(220, 106, 3, 3, 'car', '2016-06-29 10:44:16', '2016-06-02', '0', 1, '08:00:00', '17:15:00', '0', '', '', '0', '3', 8, '1', 'Любешівське УВГ', '1', '0', 'other', '2894', '25', '2919', 'db', '1'),
(221, 107, 3, 3, 'car', '2016-06-29 10:48:35', '2016-06-03', '5', 1, '08:00:00', '17:15:00', '0', '', '', '0', '5', 8, '1', 'Любешівське УВГ', '1', '0', 'other', '2919', '41', '2960', 'db', '1'),
(222, 110, 3, 3, 'car', '2016-06-29 10:49:18', '2016-06-06', '5', 1, '08:00:00', '17:15:00', '0', '', '', '0', '5', 8, '1', 'Любешівське УВГ', '1', '0', 'other', '2960', '41', '3001', 'db', '1'),
(223, 111, 3, 3, 'car', '2016-06-29 10:50:06', '2016-06-08', '5', 1, '08:00:00', '17:15:00', '0', '', '', '0', '5', 8, 'Віл', 'Любешівське УВГ', '1', '0', 'other', '3001', '40', '3041', 'sr', '1'),
(224, 112, 3, 3, 'car', '2016-06-29 10:50:46', '2016-06-09', '5', 1, '08:00:00', '17:15:00', '0', '', '', '0', '5', 8, 'Віл', 'Любешівське УВГ', '1', '0', 'other', '3041', '40', '3081', 'sr', '1'),
(225, 113, 3, 3, 'car', '2016-06-29 10:51:28', '2016-06-10', '5', 1, '08:00:00', '17:15:00', '0', '', '', '0', '5', 8, 'Віл', 'Любешівське УВГ', '1', '0', 'other', '3081', '40', '3121', 'sr', '1'),
(226, 114, 3, 3, 'car', '2016-06-29 10:52:13', '2016-06-13', '2', 1, '08:00:00', '17:15:00', '0', '', '', '0', '2', 8, '1', 'Любешівське УВГ', '1', '0', 'other', '3121', '16', '3137', 'sr', '1'),
(227, 115, 3, 3, 'car', '2016-06-29 10:52:53', '2016-06-14', '2', 1, '08:00:00', '17:15:00', '0', '', '', '0', '2', 8, '1', 'Любешівське УВГ', '1', '0', 'other', '3137', '16', '3153', 'sr', '1'),
(228, 116, 3, 3, 'car', '2016-06-29 10:54:31', '2016-06-15', '8', 1, '08:00:00', '17:15:00', '0', '', '', '1', '7', 8, 'Богдан', 'Любешівське УВГ', '1', '0', 'other', '3153', '58', '3211', 'sr', '1'),
(229, 119, 3, 3, 'car', '2016-06-29 10:55:08', '2016-06-16', '6', 1, '08:00:00', '17:15:00', '0', '', '', '0', '7', 8, 'Богдан', 'Любешівське УВГ', '1', '0', 'other', '3211', '58', '3269', 'sr', '1'),
(230, 121, 3, 3, 'car', '2016-06-29 10:55:42', '2016-06-17', '7', 1, '08:00:00', '17:15:00', '0', '', '', '0', '7', 8, 'Богдан', 'Любешівське УВГ', '1', '0', 'other', '3269', '58', '3327', 'sr', '1'),
(231, 124, 3, 3, 'car', '2016-06-29 10:56:50', '2016-06-22', '10', 1, '08:00:00', '17:15:00', '0', '', '', '3', '7', 8, 'Богдан', 'Любешівське УВГ', '1', '0', 'other', '3327', '58', '3385', 'sr', '1'),
(232, 125, 3, 3, 'car', '2016-06-29 10:57:37', '2016-06-23', '4', 1, '08:00:00', '17:15:00', '0', '', '', '0', '7', 8, 'Богдан', 'Любешівське УВГ', '1', '0', 'other', '3385', '58', '3443', 'sr', '1'),
(233, 126, 3, 3, 'car', '2016-06-29 10:59:52', '2016-06-24', '7', 1, '08:00:00', '17:15:00', '0', '', '', '0', '7', 8, 'Богдан', 'Любешівське УВГ', '1', '0', 'other', '3443', '58', '3501', 'sr', '1'),
(234, 127, 3, 3, 'car', '2016-06-29 11:00:38', '2016-06-29', '1', 1, '08:00:00', '17:15:00', '0', '', '', '0', '1', 8, 'Начальник і Зімиіч і Богдан', 'Любешівське УВГ', '1', '0', 'other', '3501', '8', '3509', 'sr', '1'),
(235, 128, 3, 3, 'car', '2016-06-29 11:01:07', '2016-06-30', '0', 1, '08:00:00', '17:15:00', '0', '', '', '0', '0', 8, 'Без пального', 'Любешівське УВГ', '1', '0', 'other', '3509', '0', '3509', 'sr', '1'),
(236, 0, 1, 6, 'car', '2016-06-29 11:15:15', '2015-12-31', '3', 1, '08:00:00', '17:15:00', '0', '', '', '0', '0', 0, 'Фіктивна путівка', 'Любешівське УВГ', '1', '0', 'other', '0', '0', '0', 'sr', '1'),
(237, 42, 10, 9, 'tractor', '2016-06-30 15:24:54', '2016-06-08', '40', 3, '08:00:00', '17:15:00', '0', '', '', '0', '40', 8, '1', 'Любешівське УВГ', '1', '0', 'm3', '', '0', '', 'sr', '1'),
(238, 43, 11, 11, 'tractor', '2016-06-30 15:30:04', '2016-06-08', '50', 3, '08:00:00', '17:15:00', '1', '', '', '0', '50', 8, '1', 'Любешівське УВГ', '1', '0', 'm3', '', '0', '', 'sr', '1'),
(239, 44, 10, 9, 'tractor', '2016-06-30 15:30:50', '2016-06-09', '40', 3, '08:00:00', '17:15:00', '0', '', '', '0', '40', 8, '1', 'Любешівське УВГ', '1', '0', 'm3', '', '0', '', 'sr', '1'),
(240, 45, 11, 11, 'tractor', '2016-06-30 15:31:32', '2016-06-09', '40', 3, '08:00:00', '17:15:00', '0', '', '', '0', '40', 8, '1', 'Любешівське УВГ', '1', '0', 'm3', '', '0', '', 'sr', '1'),
(241, 47, 11, 11, 'tractor', '2016-06-30 15:32:08', '2016-06-10', '10', 3, '08:00:00', '17:15:00', '0', '', '', '0', '10', 8, '1', 'Любешівське УВГ', '1', '0', 'm3', '', '0', '', 'sr', '1'),
(242, 48, 10, 9, 'tractor', '2016-06-30 15:32:55', '2016-06-10', '20', 3, '08:00:00', '17:15:00', '0', '', '', '0', '20', 8, '1', 'Любешівське УВГ', '1', '0', 'm3', '', '0', '', 'sr', '1'),
(243, 58, 10, 9, 'tractor', '2016-06-30 15:35:21', '2016-06-17', '40', 3, '08:00:00', '17:15:00', '0', '', '', '0', '40', 8, '1', 'Любешівське УВГ', '1', '0', 'm3', '', '0', '', 'sr', '1'),
(244, 57, 10, 9, 'tractor', '2016-06-30 15:35:51', '2016-06-16', '40', 3, '08:00:00', '17:15:00', '0', '', '', '0', '40', 8, '1', 'Любешівське УВГ', '1', '0', 'm3', '', '0', '', 'sr', '1'),
(245, 52, 10, 9, 'tractor', '2016-06-30 15:36:16', '2016-06-15', '40', 3, '08:00:00', '17:15:00', '0', '', '', '0', '40', 8, '1', 'Любешівське УВГ', '1', '0', 'm3', '', '0', '', 'sr', '1'),
(246, 50, 10, 9, 'tractor', '2016-06-30 15:36:44', '2016-06-14', '30', 3, '08:00:00', '17:15:00', '0', '', '', '0', '30', 0, '1', 'Любешівське УВГ', '1', '0', 'm3', '', '0', '', 'sr', '1'),
(247, 55, 11, 11, 'tractor', '2016-06-30 15:37:14', '2016-06-16', '50', 3, '08:00:00', '17:15:00', '0', '', '', '0', '50', 8, '1', 'Любешівське УВГ', '1', '0', 'm3', '', '0', '', 'sr', '1'),
(248, 53, 11, 11, 'tractor', '2016-06-30 15:38:02', '2016-06-15', '47', 3, '08:00:00', '17:15:00', '0', '', '', '0', '47', 8, '1', 'Любешівське УВГ', '1', '0', 'm3', '', '0', '', 'sr', '1');
-- --------------------------------------------------------
--
-- Структура таблиці `route_list`
--
CREATE TABLE `route_list` (
`id` int(11) UNSIGNED NOT NULL,
`number` int(6) UNSIGNED NOT NULL COMMENT 'Номер шляхового листа',
`driver_id` int(6) UNSIGNED NOT NULL COMMENT 'Водій',
`transport_id` int(6) UNSIGNED NOT NULL COMMENT 'Транспорт',
`type` enum('car','tractor','truck') NOT NULL COMMENT 'Тип шляхового листа',
`datego` date NOT NULL COMMENT 'Дата путівки',
`worked` float UNSIGNED NOT NULL COMMENT 'Відпрацьовано(год)',
`speedometerdeparture` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Показник спідометра при виїзді',
`kilometrage` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Кілометраж',
`speedometerreturn` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Показник спідометра при поверненні',
`payment` enum('db','sr','pr') NOT NULL DEFAULT 'sr' COMMENT 'Оплата(с.р., д.б)',
`note` mediumtext COMMENT 'Додаткові відмітки про рух траспорту',
`date` datetime NOT NULL COMMENT 'Дата внесення в бд путівки',
`valid` enum('1','0') NOT NULL DEFAULT '1' COMMENT 'Чи дійсна путівка',
`completed` enum('1','0') NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Шляхові листи';
--
-- Дамп даних таблиці `route_list`
--
INSERT INTO `route_list` (`id`, `number`, `driver_id`, `transport_id`, `type`, `datego`, `worked`, `speedometerdeparture`, `kilometrage`, `speedometerreturn`, `payment`, `note`, `date`, `valid`, `completed`) VALUES
(1, 1, 5, 4, 'car', '2016-01-04', 8, 0, 104, 104, 'db', 'По любешові', '2016-07-20 23:33:22', '1', '1'),
(2, 1, 2, 2, 'truck', '2016-01-12', 0, 0, 0, 0, 'sr', 'Перевезення ЕТ-16 з Седлищ', '2016-07-20 23:33:21', '0', '1'),
(3, 1, 4, 5, 'tractor', '2016-01-11', 8, 0, 0, 0, 'db', 'Чистка території від снігу', '2016-01-19 16:07:59', '1', '1'),
(4, 2, 3, 3, 'car', '2016-01-04', 8, 0, 42, 42, 'db', 'Кузьміч на насосну', '2016-07-20 23:33:21', '1', '1'),
(5, 2, 1, 1, 'truck', '2016-01-12', 8, 0, 30, 30, 'pr', 'Привезення пілетів', '2016-01-19 16:02:48', '1', '1'),
(6, 2, 4, 5, 'tractor', '2016-01-18', 8, 0, 0, 0, 'db', 'Очистка території від снігу', '2016-01-19 16:08:36', '1', '1'),
(7, 3, 3, 3, 'car', '2016-01-05', 0, 42, 0, 42, 'sr', 'Кузьміч', '2016-07-20 23:33:21', '0', '1'),
(8, 3, 1, 1, 'truck', '2016-01-13', 8, 30, 26, 56, 'db', 'Привезення пілетів 4,3 т', '2016-07-20 23:33:21', '1', '1'),
(9, 3, 4, 5, 'tractor', '2016-01-22', 8, 0, 0, 0, 'db', 'Згортання снігу', '2016-03-03 13:31:56', '1', '1'),
(10, 4, 5, 4, 'car', '2016-01-05', 8, 104, 54, 158, 'db', 'По Любешові', '2016-07-20 23:33:22', '1', '1'),
(11, 4, 1, 1, 'truck', '2016-02-04', 8, 56, 56, 112, 'sr', 'Любешів - Дольськ', '2016-07-20 23:33:21', '1', '1'),
(12, 4, 4, 5, 'tractor', '2016-02-17', 8, 0, 0, 0, 'db', 'Любешів - Цир - Любешів', '2016-03-02 17:09:47', '1', '1'),
(13, 5, 5, 4, 'car', '2016-01-12', 8, 158, 300, 458, 'db', 'По Любешові', '2016-07-20 23:33:22', '1', '1'),
(14, 5, 2, 2, 'truck', '2016-02-02', 8, 0, 40, 40, 'sr', 'Бас', '2016-07-20 23:33:21', '1', '1'),
(15, 5, 4, 5, 'tractor', '2016-03-18', 2, 0, 0, 0, 'sr', '№ 35\r\n\nМихалюк Г.О.', '2016-03-25 12:09:16', '1', '1'),
(16, 6, 5, 4, 'car', '2016-01-13', 8, 458, 300, 758, 'db', 'Начальнік', '2016-07-20 23:33:22', '1', '1'),
(17, 6, 2, 2, 'truck', '2016-02-04', 8, 40, 50, 90, 'sr', 'Бас', '2016-07-20 23:33:21', '1', '1'),
(18, 6, 4, 5, 'tractor', '2016-03-23', 8, 0, 0, 0, 'pr', 'Любешів - Підкормільська н.с.\r\n\n6 м3 погрузка грунту 2,4 мгод', '2016-03-25 12:10:59', '1', '1'),
(19, 7, 5, 4, 'car', '2016-01-22', 8, 758, 36, 794, 'db', 'Нач', '2016-07-20 23:33:22', '1', '1'),
(20, 7, 2, 2, 'truck', '2016-02-05', 8, 90, 20, 110, 'sr', 'Бас', '2016-07-20 23:33:21', '1', '1'),
(21, 7, 4, 5, 'tractor', '2016-03-25', 5, 0, 0, 0, 'db', 'буксирування екскаватора', '2016-03-25 12:12:52', '1', '1'),
(22, 8, 2, 3, 'car', '2016-01-25', 8, 42, 8, 50, 'db', 'Автозапчастини', '2016-07-20 23:33:21', '1', '1'),
(23, 8, 1, 1, 'truck', '2016-02-04', 8, 112, 56, 168, 'pr', 'потрібно доповнити', '2016-07-20 23:33:21', '1', '1'),
(24, 8, 4, 5, 'tractor', '2016-03-25', 2, 0, 0, 0, 'sr', 'Михалюк\r\n\n2 год х 176 = 352', '2016-03-25 12:13:56', '1', '1'),
(25, 9, 5, 4, 'car', '2016-01-25', 8, 794, 42, 836, 'db', 'начч', '2016-07-20 23:33:22', '1', '1'),
(26, 9, 2, 2, 'truck', '2016-02-09', 8, 110, 25, 135, 'sr', 'найм', '2016-07-20 23:33:21', '1', '1'),
(27, 9, 4, 5, 'tractor', '2016-04-01', 4, 0, 0, 0, 'sr', 'Михалюк', '2016-04-19 14:27:05', '1', '1'),
(28, 10, 1, 1, 'truck', '2016-02-09', 8, 168, 40, 208, 'sr', 'Любешів - Підкормільська н.с.', '2016-07-20 23:33:21', '1', '1'),
(29, 10, 5, 4, 'car', '2016-01-26', 8, 836, 28, 864, 'db', 'нач', '2016-07-20 23:33:22', '1', '1'),
(30, 10, 4, 5, 'tractor', '2016-04-13', 8, 0, 0, 0, 'sr', 'Лісгосп', '2016-04-19 14:27:16', '1', '1'),
(31, 11, 2, 3, 'car', '2016-02-01', 8, 50, 17, 67, 'db', 'Автозапчастини', '2016-07-20 23:33:21', '1', '1'),
(32, 11, 4, 5, 'tractor', '2016-04-14', 8, 0, 0, 0, 'pr', 'УВГ', '2016-04-19 14:27:25', '1', '1'),
(33, 12, 5, 4, 'car', '2016-02-01', 8, 864, 60, 924, 'db', 'по системі', '2016-07-20 23:33:22', '1', '1'),
(34, 12, 2, 2, 'truck', '2016-02-17', 8, 135, 56, 191, 'pr', 'дописати', '2016-07-20 23:33:21', '1', '1'),
(35, 12, 11, 11, 'tractor', '2016-04-14', 8, 0, 0, 0, 'pr', 'ремонт греблі', '2016-04-19 14:27:35', '1', '1'),
(36, 13, 1, 1, 'truck', '2016-02-18', 8, 208, 56, 264, 'pr', 'Любешів - Дольська н.с', '2016-07-20 23:33:21', '1', '1'),
(37, 13, 6, 3, 'car', '2016-02-02', 8, 67, 41, 108, 'db', 'люб - люблязь кузьміч', '2016-07-20 23:33:22', '1', '1'),
(38, 13, 4, 5, 'tractor', '2016-04-15', 8, 0, 0, 0, 'pr', 'ремонт дамби', '2016-04-19 14:27:43', '1', '1'),
(39, 14, 1, 1, 'truck', '2016-02-19', 8, 264, 11, 275, 'pr', 'Любешів - Підкормільська н.с.', '2016-07-20 23:33:21', '1', '1'),
(40, 14, 5, 4, 'car', '2016-02-02', 8, 924, 18, 942, 'db', 'Любешівська н.с.', '2016-07-20 23:33:22', '1', '1'),
(41, 14, 4, 5, 'tractor', '2016-04-21', 7, 0, 0, 0, 'sr', 'Лісгосп', '2016-04-28 10:08:37', '1', '1'),
(42, 15, 5, 4, 'car', '2016-02-03', 8, 942, 12, 954, 'db', 'автозапчастини', '2016-07-20 23:33:22', '1', '1'),
(43, 15, 1, 1, 'truck', '2016-03-01', 8, 275, 45, 320, 'pr', 'УВГ - Коростинка - Дольськ', '2016-07-20 23:33:21', '1', '1'),
(44, 15, 4, 5, 'tractor', '2016-04-22', 7, 0, 0, 0, 'sr', 'Лісгосп', '2016-04-28 10:09:23', '1', '1'),
(45, 16, 5, 4, 'car', '2016-02-04', 8, 954, 30, 984, 'db', 'Любешів - Підкормільська н.с.', '2016-07-20 23:33:22', '1', '1'),
(46, 16, 2, 2, 'truck', '2016-03-09', 8, 191, 84, 275, 'sr', 'Чергування бурштин', '2016-07-20 23:33:21', '1', '1'),
(47, 16, 4, 5, 'tractor', '2016-04-25', 7, 0, 0, 0, 'sr', 'лісгосп', '2016-04-28 10:09:58', '1', '1'),
(48, 17, 2, 3, 'car', '2016-02-04', 8, 108, 17, 125, 'db', 'Автозап', '2016-07-20 23:33:22', '1', '1'),
(49, 17, 1, 1, 'truck', '2016-03-11', 8, 320, 39, 359, 'pr', 'увг - партизанська\r\n\nнасоси', '2016-07-20 23:33:21', '1', '1'),
(50, 17, 4, 5, 'tractor', '2016-05-10', 8, 0, 0, 0, 'pr', 'Дольськ', '2016-05-27 13:31:23', '1', '1'),
(51, 18, 5, 4, 'car', '2016-02-05', 8, 984, 12, 996, 'db', '1', '2016-07-20 23:33:22', '1', '1'),
(52, 18, 1, 1, 'truck', '2016-03-12', 8, 359, 39, 398, 'pr', 'перевезення компресора', '2016-07-20 23:33:21', '1', '1'),
(53, 19, 5, 4, 'car', '2016-02-08', 8, 996, 54, 1050, 'db', '1', '2016-07-20 23:33:22', '1', '1'),
(54, 19, 1, 1, 'truck', '2016-03-14', 8, 398, 51, 449, 'pr', '2 насаси \r\n\nУВГ - Коростинка -Дольськ', '2016-07-20 23:33:21', '1', '1'),
(55, 20, 5, 4, 'car', '2016-02-09', 8, 1050, 18, 1068, 'db', 'дописати', '2016-07-20 23:33:22', '1', '1'),
(56, 20, 6, 7, 'truck', '2016-03-16', 4, 0, 5, 5, 'sr', '№ 26 від 15.03.16\r\n\r\n272 грн\r\n\r\nМартинчук Г.І.', '2016-07-20 23:33:22', '1', '1'),
(57, 21, 5, 4, 'car', '2016-02-11', 8, 1068, 36, 1104, 'db', 'дописати', '2016-07-20 23:33:22', '1', '1'),
(58, 21, 2, 2, 'truck', '2016-03-18', 2, 275, 20, 295, 'sr', '№ 35 від 18.03.16\r\n\n2 год\r\n\nМихалюк Г.О.', '2016-07-20 23:33:21', '1', '1'),
(59, 22, 5, 4, 'car', '2016-02-12', 8, 1104, 300, 1404, 'db', 'дописати', '2016-07-20 23:33:22', '1', '1'),
(60, 22, 6, 7, 'truck', '2016-03-18', 0, 5, 10, 15, 'sr', '№ 36\r\n\r\n1,5 год\r\n\r\nПанчишин Б.І.', '2016-07-20 23:33:22', '1', '1'),
(61, 23, 5, 4, 'car', '2016-02-15', 8, 1404, 64, 1468, 'db', 'дописати', '2016-07-20 23:33:22', '1', '1'),
(62, 23, 1, 1, 'truck', '2016-03-18', 0, 449, 10, 459, 'sr', '№ 36\r\n\n1,5 год\r\n\nПанчишин Б.І.', '2016-07-20 23:33:21', '1', '1'),
(63, 24, 5, 4, 'car', '2016-02-17', 8, 1468, 24, 1492, 'db', 'дописати', '2016-07-20 23:33:22', '1', '1'),
(64, 24, 6, 7, 'truck', '2016-03-22', 1, 15, 10, 25, 'sr', '№ 37\r\n\r\n1 год\r\n\r\nЛюбешів_комфорт Сервіс', '2016-07-20 23:33:22', '1', '1'),
(65, 25, 5, 4, 'car', '2016-02-22', 8, 1492, 64, 1556, 'db', 'дописати', '2016-07-20 23:33:22', '1', '1'),
(66, 25, 3, 1, 'truck', '2016-03-23', 0, 459, 81, 540, 'pr', 'по дрова', '2016-07-20 23:33:21', '1', '1'),
(67, 26, 3, 3, 'car', '2016-02-23', 8, 125, 58, 183, 'db', 'дописати', '2016-07-20 23:33:22', '1', '1'),
(68, 27, 3, 3, 'car', '2016-02-24', 8, 183, 16, 199, 'db', 'дописати', '2016-07-20 23:33:22', '1', '1'),
(69, 28, 3, 3, 'car', '2016-02-25', 8, 199, 25, 224, 'db', 'дописати', '2016-07-20 23:33:22', '1', '1'),
(70, 29, 6, 6, 'car', '2016-02-12', 8, 0, 52, 52, 'db', 'списання залишку за ратно', '2016-07-20 23:33:22', '1', '1'),
(71, 29, 2, 2, 'truck', '2016-04-01', 2, 295, 20, 315, 'sr', '№', '2016-07-20 23:33:21', '1', '1'),
(72, 30, 5, 4, 'car', '2016-03-01', 8, 1556, 48, 1604, 'db', 'перевірка роботи мнс іотто, визначення стану\r\n\nКрисько В.І.', '2016-07-20 23:33:22', '1', '1'),
(73, 30, 5, 1, 'truck', '2016-04-01', 1, 540, 12, 552, 'sr', 'Горщар', '2016-07-20 23:33:21', '1', '1'),
(74, 31, 5, 4, 'car', '2016-03-02', 8, 1604, 12, 1616, 'db', 'УВГ - Любешів нст', '2016-07-20 23:33:22', '1', '1'),
(75, 31, 6, 7, 'truck', '2016-04-01', 1, 25, 5, 30, 'sr', 'за мин міс №44', '2016-07-20 23:33:22', '1', '1'),
(76, 32, 5, 4, 'car', '2016-03-03', 8, 1616, 12, 1628, 'db', 'перевірка роботи МНС визначення обємів робіт', '2016-07-20 23:33:22', '0', '1'),
(77, 32, 2, 2, 'truck', '2016-04-06', 1, 315, 10, 325, 'sr', '№47', '2016-07-20 23:33:21', '1', '1'),
(78, 32, 4, 5, 'tractor', '2016-05-18', 1, 0, 0, 0, 'sr', 'Шоломітський', '2016-05-27 13:32:07', '1', '1'),
(79, 33, 3, 4, 'car', '2016-03-04', 12, 1628, 57, 1685, 'sr', 'чергування бурштин', '2016-07-20 23:33:22', '1', '1'),
(80, 33, 3, 1, 'truck', '2016-04-06', 8, 552, 60, 612, 'sr', 'дрова лобна', '2016-07-20 23:33:21', '1', '1'),
(81, 34, 1, 4, 'car', '2016-03-04', 12, 1685, 29, 1714, 'sr', 'чергування бурштин (ніч)', '2016-07-20 23:33:22', '1', '1'),
(82, 34, 2, 2, 'truck', '2016-04-08', 3, 325, 40, 365, 'sr', '№ 48\r\n\n№ 49', '2016-07-20 23:33:21', '1', '1'),
(83, 35, 2, 3, 'car', '2016-03-04', 8, 224, 41, 265, 'db', 'автозапчастини\r\n\nСтрук', '2016-07-20 23:33:22', '1', '1'),
(84, 35, 2, 2, 'truck', '2016-04-11', 1, 365, 9, 374, 'sr', 'мусорнік Воля Любешівська', '2016-07-20 23:33:21', '1', '1'),
(85, 36, 1, 4, 'car', '2016-03-09', 8, 1714, 28, 1742, 'sr', 'чергування судче', '2016-07-20 23:33:22', '1', '1'),
(86, 36, 2, 2, 'truck', '2016-04-13', 8, 374, 40, 414, 'sr', 'міст лісхоз', '2016-07-20 23:33:21', '1', '1'),
(87, 37, 1, 4, 'car', '2016-03-10', 8, 1742, 29, 1771, 'db', 'перевірка роботи МНС\r\n\n', '2016-07-20 23:33:22', '1', '1'),
(88, 37, 6, 7, 'truck', '2016-04-14', 3, 30, 5, 35, 'sr', 'агроліс', '2016-07-20 23:33:22', '1', '1'),
(89, 38, 3, 3, 'car', '2016-03-14', 8, 525, 58, 583, 'db', 'обстеження тобольської н.с.\r\n\nЗімич П.І.', '2016-07-20 23:33:22', '1', '1'),
(90, 38, 2, 2, 'truck', '2016-04-14', 8, 414, 80, 494, 'pr', 'ремонт греблі', '2016-07-20 23:33:21', '1', '1'),
(91, 39, 3, 3, 'car', '2016-03-15', 8, 583, 16, 599, 'db', 'автозапчастини (покришка)\r\n\nСтрук', '2016-07-20 23:33:22', '1', '1'),
(92, 39, 2, 2, 'truck', '2016-04-15', 8, 494, 112, 606, 'sr', 'селишна асальт', '2016-07-20 23:33:21', '1', '1'),
(93, 40, 3, 3, 'car', '2016-03-16', 0, 599, 0, 599, 'db', 'не використана', '2016-07-20 23:33:22', '0', '1'),
(94, 40, 2, 2, 'truck', '2016-04-18', 2, 606, 11, 617, 'sr', 'Курін мусорнік', '2016-07-20 23:33:21', '1', '1'),
(95, 40, 5, 1, 'truck', '2016-04-15', 8, 612, 60, 672, 'pr', 'перевезення землі', '2016-07-20 23:33:21', '1', '1'),
(96, 41, 6, 3, 'car', '2016-03-11', 8, 265, 260, 525, 'db', 'УВГ - Ковель', '2016-07-20 23:33:22', '1', '1'),
(97, 41, 5, 1, 'truck', '2016-04-19', 8, 672, 80, 752, 'sr', 'по дрова з шпанчиком', '2016-07-20 23:33:21', '1', '1'),
(98, 41, 8, 12, 'tractor', '2016-05-25', 8, 0, 0, 0, 'pr', 'дольськ пот рем\r\n\nшпанчик', '2016-05-31 13:29:11', '1', '1'),
(99, 42, 3, 3, 'car', '2016-03-17', 8, 599, 65, 664, 'db', 'УВГ - Коростинка', '2016-07-20 23:33:22', '1', '1'),
(100, 42, 2, 2, 'truck', '2016-04-21', 2, 617, 10, 627, 'sr', 'курін мусорнік', '2016-07-20 23:33:21', '1', '1'),
(101, 42, 10, 9, 'tractor', '2016-06-08', 8, 0, 0, 0, 'sr', '1', '2016-06-30 15:24:54', '1', '1'),
(102, 43, 5, 4, 'car', '2016-03-17', 8, 1771, 18, 1789, 'db', 'УВГ - Люблязь', '2016-07-20 23:33:22', '1', '1'),
(103, 43, 2, 2, 'truck', '2016-04-22', 7, 627, 80, 707, 'sr', 'лісгосп', '2016-07-20 23:33:21', '1', '1'),
(104, 43, 11, 11, 'tractor', '2016-06-08', 8, 0, 0, 0, 'sr', '1', '2016-06-30 15:30:04', '1', '1'),
(105, 44, 6, 4, 'car', '2016-03-18', 8, 1789, 115, 1904, 'db', 'УВГ - м. Глуша - Цирська н.с - по системі', '2016-07-20 23:33:22', '1', '1'),
(106, 44, 2, 2, 'truck', '2016-04-25', 7, 707, 80, 787, 'sr', 'лісгосп', '2016-07-20 23:33:21', '1', '1'),
(107, 44, 10, 9, 'tractor', '2016-06-09', 8, 0, 0, 0, 'sr', '1', '2016-06-30 15:30:50', '1', '1'),
(108, 45, 3, 3, 'car', '2016-03-18', 8, 664, 165, 829, 'db', 'УВГ - Підкормільська н.с. - Дольська н.с. - с. Сваловичі...', '2016-07-20 23:33:22', '1', '1'),
(109, 45, 2, 2, 'truck', '2016-04-26', 2, 787, 42, 829, 'sr', 'перевезення екскаватора\r\n\nі транспортування трала', '2016-07-20 23:33:21', '1', '1'),
(110, 45, 11, 11, 'tractor', '2016-06-09', 8, 0, 0, 0, 'sr', '1', '2016-06-30 15:31:32', '1', '1'),
(111, 46, 6, 3, 'car', '2016-03-18', 0, 0, 0, 0, 'db', 'не використана', '2016-03-23 15:42:14', '0', '0'),
(112, 46, 4, 5, 'tractor', '2016-06-10', 8, 0, 0, 0, 'sr', 'Бас 79', '2016-06-24 13:01:00', '1', '1'),
(113, 47, 6, 3, 'car', '2016-03-21', 8, 829, 75, 904, 'db', 'УВГ - Воля - по системі ...', '2016-03-23 15:43:35', '1', '1'),
(114, 47, 6, 1, 'truck', '2016-05-04', 8, 752, 20, 772, 'sr', 'брикети паливні', '2016-07-20 23:33:21', '1', '1'),
(115, 47, 11, 11, 'tractor', '2016-06-10', 8, 0, 0, 0, 'sr', '1', '2016-06-30 15:32:08', '1', '1'),
(116, 48, 3, 3, 'car', '2016-03-22', 8, 904, 41, 945, 'db', 'Кульміч за 8 березня', '2016-03-23 15:44:34', '1', '1'),
(117, 48, 2, 2, 'truck', '2016-05-05', 8, 829, 28, 857, 'sr', 'дрова', '2016-07-20 23:33:21', '1', '1'),
(118, 48, 10, 9, 'tractor', '2016-06-10', 8, 0, 0, 0, 'sr', '1', '2016-06-30 15:32:55', '1', '1'),
(119, 49, 5, 4, 'car', '2016-03-22', 8, 1904, 12, 1916, 'db', 'УВГ - Любешів н.с.....', '2016-07-20 23:33:22', '1', '1'),
(120, 49, 2, 2, 'truck', '2016-05-10', 8, 857, 80, 937, 'sr', 'Дольськ\r\n\r\nперевезення екскаваторів', '2016-07-20 23:33:21', '1', '1'),
(121, 49, 4, 5, 'tractor', '2016-06-13', 4, 0, 0, 0, 'sr', 'Божко АМ', '2016-06-24 13:01:52', '1', '1'),
(122, 50, 5, 4, 'car', '2016-03-23', 8, 1916, 12, 1928, 'db', '...', '2016-07-20 23:33:22', '1', '1'),
(123, 50, 3, 1, 'truck', '2016-05-10', 8, 772, 60, 832, 'sr', 'перевезеня вагончика Дольськ', '2016-07-20 23:33:21', '1', '1'),
(124, 50, 10, 9, 'tractor', '2016-06-14', 0, 0, 0, 0, 'sr', '1', '2016-06-30 15:36:44', '1', '1'),
(125, 51, 3, 3, 'car', '2016-03-24', 8, 945, 50, 995, 'sr', 'Шпанчик', '2016-03-25 12:18:00', '1', '1'),
(126, 51, 2, 2, 'truck', '2016-05-12', 8, 937, 30, 967, 'sr', 'ремонт н.с. Седлище\r\n\nКузьміч', '2016-07-20 23:33:21', '1', '1'),
(127, 51, 8, 12, 'tractor', '2016-06-13', 8, 0, 0, 0, 'sr', 'Набайчик №81', '2016-06-24 13:06:12', '1', '1'),
(128, 52, 5, 4, 'car', '2016-03-24', 8, 1928, 12, 1940, 'db', 'любешів - залаззя', '2016-07-20 23:33:22', '1', '1'),
(129, 52, 2, 2, 'truck', '2016-05-24', 2, 967, 80, 1047, 'sr', 'Кух 2 год №71', '2016-07-20 23:33:21', '1', '1'),
(130, 52, 10, 9, 'tractor', '2016-06-15', 8, 0, 0, 0, 'sr', '1', '2016-06-30 15:36:16', '1', '1'),
(131, 53, 3, 3, 'car', '2016-03-25', 8, 995, 42, 1037, 'db', 'кульміч на 8 березня', '2016-03-25 12:21:18', '1', '1'),
(132, 53, 2, 2, 'truck', '2016-06-01', 2, 1047, 20, 1067, 'sr', 'Лебеля Р.І.', '2016-07-20 23:33:21', '1', '1'),
(133, 53, 11, 11, 'tractor', '2016-06-15', 8, 0, 0, 0, 'sr', '1', '2016-06-30 15:38:02', '1', '1'),
(134, 54, 5, 4, 'car', '2016-03-25', 0, 1940, 6, 1946, 'db', 'УВГ - Любешів н.с', '2016-07-20 23:33:22', '1', '1'),
(135, 54, 8, 12, 'tractor', '2016-06-15', 8, 0, 0, 0, 'sr', 'Швайко ', '2016-06-24 13:05:11', '1', '1'),
(136, 55, 5, 4, 'car', '2016-03-28', 8, 1946, 280, 2226, 'sr', 'УВГ - Луцьк', '2016-07-20 23:33:22', '1', '1'),
(137, 55, 2, 2, 'truck', '2016-06-08', 9, 1067, 15, 1082, 'sr', 'с.Віл', '2016-07-20 23:33:21', '1', '1'),
(138, 55, 11, 11, 'tractor', '2016-06-16', 8, 0, 0, 0, 'sr', '1', '2016-06-30 15:37:14', '1', '1'),
(139, 56, 3, 3, 'car', '2016-04-04', 8, 1037, 50, 1087, 'db', '-', '2016-04-19 13:37:05', '1', '1'),
(140, 56, 8, 12, 'tractor', '2016-06-16', 4, 0, 0, 0, 'sr', 'Жилко 84', '2016-07-17 00:28:25', '1', '1'),
(141, 57, 5, 4, 'car', '2016-04-04', 8, 2226, 290, 2516, 'db', 'луцьк', '2016-07-20 23:33:22', '1', '1'),
(142, 57, 10, 9, 'tractor', '2016-06-16', 8, 0, 0, 0, 'sr', '1', '2016-06-30 15:35:51', '1', '1'),
(143, 58, 3, 4, 'car', '2016-04-05', 0, 2516, 228, 2744, 'sr', 'Ратно', '2016-07-20 23:33:22', '1', '1'),
(144, 58, 1, 1, 'truck', '2016-06-08', 9, 832, 102, 934, 'sr', 'Перевезення трансформатора', '2016-07-20 23:33:21', '1', '1'),
(145, 58, 10, 9, 'tractor', '2016-06-17', 8, 0, 0, 0, 'sr', '1', '2016-06-30 15:35:21', '1', '1'),
(146, 59, 5, 3, 'car', '2016-04-05', 8, 1087, 40, 1127, 'sr', 'бучин нс', '2016-04-19 13:38:19', '1', '1'),
(147, 59, 6, 7, 'truck', '2016-06-08', 8, 35, 40, 75, 'sr', 'трансформатор', '2016-07-20 23:33:22', '1', '1'),
(148, 60, 5, 4, 'car', '2016-04-06', 8, 2744, 12, 2756, 'db', 'запчастини', '2016-07-20 23:33:22', '1', '1'),
(149, 60, 2, 2, 'truck', '2016-06-10', 9, 1082, 60, 1142, 'sr', 'с. Віл', '2016-07-20 23:33:21', '1', '1'),
(150, 61, 5, 4, 'car', '2016-04-08', 8, 2756, 24, 2780, 'db', 'заріка нс', '2016-07-20 23:33:22', '1', '1'),
(151, 62, 5, 3, 'car', '2016-04-11', 1, 1127, 25, 1152, 'sr', 'Воля Любешівська', '2016-04-19 13:39:41', '1', '1'),
(152, 63, 5, 4, 'car', '2016-04-12', 8, 2780, 280, 3060, 'db', 'Луцьк(фейкова)', '2016-07-20 23:33:22', '1', '1'),
(153, 63, 1, 1, 'truck', '2016-06-10', 8, 934, 50, 984, 'sr', 'Бас № 79', '2016-07-20 23:33:21', '1', '1'),
(154, 64, 2, 3, 'car', '2016-04-12', 1, 1152, 58, 1210, 'sr', 'Любешівська Воля (мусорнік)', '2016-04-19 13:41:00', '1', '1'),
(155, 64, 2, 2, 'truck', '2016-06-13', 7, 1142, 40, 1182, 'sr', 'Набайчик А.А. №81', '2016-07-20 23:33:21', '1', '1'),
(156, 65, 5, 3, 'car', '2016-04-13', 8, 1210, 25, 1235, 'db', 'Любешівська Воля (мусорнік)', '2016-04-19 13:41:37', '1', '1'),
(157, 66, 6, 3, 'car', '2016-04-15', 8, 1235, 16, 1251, 'db', 'Люб Воля мусорнік за 12.04.16\r\n\nпальне Кузьміча', '2016-04-19 13:43:55', '1', '1'),
(158, 67, 5, 4, 'car', '2016-04-18', 8, 3060, 23, 3083, 'db', 'курін', '2016-07-20 23:33:22', '1', '1'),
(159, 67, 2, 2, 'truck', '2016-06-15', 8, 1182, 40, 1222, 'sr', 'дольськ', '2016-07-20 23:33:21', '1', '1'),
(160, 68, 2, 4, 'car', '2016-04-19', 1, 3083, 17, 3100, 'sr', 'Мусорнік(поїхав своєю) по залишку від бондара', '2016-07-20 23:33:22', '1', '1'),
(161, 68, 2, 2, 'truck', '2016-06-16', 8, 1222, 44, 1266, 'sr', 'Кух в.І. 1 год\r\n\nШпанчик 1 год', '2016-07-20 23:33:21', '1', '1'),
(162, 69, 6, 3, 'car', '2016-04-19', 10, 1251, 250, 1501, 'db', 'Любешівське УВГ - Ратно\r\n\nобмірка роботи', '2016-04-19 13:46:28', '1', '1'),
(163, 70, 2, 4, 'car', '2016-04-20', 1, 3100, 17, 3117, 'sr', 'курін', '2016-07-20 23:33:22', '1', '1'),
(164, 70, 5, 3, 'car', '2016-04-20', 8, 1501, 330, 1831, 'db', 'Луцьк', '2016-04-28 11:29:49', '1', '1'),
(165, 71, 6, 6, 'car', '2016-04-20', 8, 52, 26, 78, 'sr', 'ремонт ЕТ-16', '2016-07-20 23:33:22', '1', '1'),
(166, 72, 6, 4, 'car', '2016-04-21', 8, 3117, 50, 3167, 'db', 'любешів люблязь', '2016-07-20 23:33:22', '1', '1'),
(167, 73, 6, 3, 'car', '2016-04-22', 8, 1831, 30, 1861, 'db', 'любешів деревок', '2016-04-28 11:12:57', '1', '1'),
(168, 74, 5, 4, 'car', '2016-04-22', 8, 3167, 64, 3231, 'db', 'цирська нс', '2016-07-20 23:33:22', '1', '1'),
(169, 75, 5, 4, 'car', '2016-04-25', 8, 3231, 58, 3289, 'db', 'хомутинська нс', '2016-07-20 23:33:22', '1', '1'),
(170, 76, 3, 3, 'car', '2016-04-25', 8, 1861, 58, 1919, 'sr', 'мусорнік', '2016-04-28 11:04:19', '1', '1'),
(171, 77, 3, 3, 'car', '2016-04-26', 4, 1919, 41, 1960, 'sr', 'мусорнік', '2016-04-28 11:05:39', '1', '1'),
(172, 78, 3, 3, 'car', '2016-05-04', 8, 1960, 42, 2002, 'db', 'Люб - Хоцунь\r\n\nЗімич', '2016-05-27 13:46:47', '1', '1'),
(173, 79, 3, 3, 'car', '2016-05-05', 8, 2002, 82, 2084, 'db', 'Зімич\r\n\nЛюб - В.Глуша', '2016-05-27 13:47:52', '1', '1'),
(174, 80, 6, 3, 'car', '2016-05-06', 8, 2084, 24, 2108, 'db', 'автозапчастини\r\n\nСтрук', '2016-05-27 13:42:58', '1', '1'),
(175, 81, 5, 4, 'car', '2016-05-06', 8, 3289, 30, 3319, 'pr', 'Люб Підкормілля', '2016-07-20 23:33:22', '1', '1'),
(176, 82, 5, 4, 'car', '2016-05-10', 8, 3319, 70, 3389, 'db', 'Люб Хоцунь Дольськ', '2016-07-20 23:33:22', '1', '1'),
(177, 83, 5, 4, 'car', '2016-05-11', 8, 3389, 151, 3540, 'db', 'Любешів - Люблязь', '2016-07-20 23:33:22', '1', '1'),
(178, 84, 3, 6, 'car', '2016-05-11', 8, 78, 83, 161, 'sr', 'Любешів - Дольськ', '2016-07-20 23:33:22', '1', '1'),
(179, 85, 5, 4, 'car', '2016-05-12', 8, 3540, 54, 3594, 'db', 'Люб - Дольськ', '2016-07-20 23:33:22', '1', '1'),
(180, 86, 5, 4, 'car', '2016-05-13', 8, 3594, 30, 3624, 'db', 'Люб - Седлище', '2016-07-20 23:33:22', '1', '1'),
(181, 87, 5, 4, 'car', '2016-05-16', 8, 3624, 54, 3678, 'sr', 'Люб - Дольськ', '2016-07-20 23:33:22', '1', '1'),
(182, 88, 3, 3, 'car', '2016-05-16', 8, 2108, 83, 2191, 'db', 'Любешів - Дольськ\r\n\nКузьміч', '2016-05-27 13:50:50', '1', '1'),
(183, 89, 3, 3, 'car', '2016-05-17', 8, 2191, 58, 2249, 'sr', 'Любешів - Дольськ', '2016-05-27 13:51:44', '1', '1'),
(184, 90, 3, 3, 'car', '2016-05-18', 8, 2249, 66, 2315, 'sr', 'Любешів - Дольськ', '2016-05-27 13:52:42', '1', '1'),
(185, 91, 5, 4, 'car', '2016-05-18', 8, 3678, 18, 3696, 'db', 'Люб - Зарудче\r\n\nСтрук', '2016-07-20 23:33:22', '1', '1'),
(186, 92, 5, 3, 'car', '2016-05-19', 8, 2315, 58, 2373, 'sr', 'Любешів - Дольськ', '2016-05-27 14:19:35', '1', '1'),
(187, 93, 3, 3, 'car', '2016-05-20', 8, 2373, 58, 2431, 'sr', 'Любешів - Дольськ', '2016-05-27 13:53:24', '1', '1'),
(188, 94, 5, 4, 'car', '2016-05-20', 8, 3696, 24, 3720, 'db', 'Люб - Заріка', '2016-07-20 23:33:22', '1', '1'),
(189, 95, 3, 3, 'car', '2016-05-23', 8, 2431, 58, 2489, 'sr', 'Любешів - Дольськ', '2016-05-27 13:54:31', '1', '1'),
(190, 96, 5, 4, 'car', '2016-05-23', 8, 3720, 58, 3778, 'db', 'Люб - Цир', '2016-07-20 23:33:22', '1', '1'),
(191, 97, 3, 3, 'car', '2016-05-24', 9, 2489, 190, 2679, 'sr', 'Шпанчик', '2016-05-27 13:56:12', '1', '1'),
(192, 98, 3, 3, 'car', '2016-05-25', 8, 2679, 58, 2737, 'sr', 'Любешів - Дольськ', '2016-05-27 13:57:10', '1', '1'),
(193, 99, 3, 3, 'car', '2016-05-26', 8, 2737, 58, 2795, 'sr', 'Любешів - Дольськ', '2016-05-27 13:57:56', '1', '1'),
(194, 100, 5, 4, 'car', '2016-05-26', 8, 3778, 230, 4008, 'db', 'Люб - Ратно', '2016-07-20 23:33:22', '1', '1'),
(195, 101, 3, 3, 'car', '2016-05-27', 8, 2795, 58, 2853, 'sr', 'Любешів - Дольськ', '2016-05-27 13:58:26', '1', '1'),
(196, 102, 5, 4, 'car', '2016-06-01', 8, 4008, 298, 4306, 'db', 'Любешів - Луцьк', '2016-07-20 23:33:22', '1', '1'),
(197, 103, 3, 3, 'car', '2016-06-01', 8, 2853, 41, 2894, 'db', '1', '2016-06-29 10:41:05', '1', '1'),
(198, 104, 5, 4, 'car', '2016-06-02', 8, 4306, 46, 4352, 'db', 'Любешів - Цир', '2016-07-20 23:33:22', '1', '1'),
(199, 106, 3, 3, 'car', '2016-06-02', 8, 2894, 25, 2919, 'db', '1', '2016-06-29 10:44:16', '1', '1'),
(200, 107, 3, 3, 'car', '2016-06-03', 8, 2919, 41, 2960, 'db', '1', '2016-06-29 10:48:35', '1', '1'),
(201, 108, 5, 4, 'car', '2016-06-03', 8, 4352, 12, 4364, 'db', 'Агроремаш', '2016-07-20 23:33:22', '1', '1'),
(202, 109, 5, 4, 'car', '2016-06-06', 8, 4364, 52, 4416, 'db', 'Седлище', '2016-07-20 23:33:22', '1', '1'),
(203, 110, 3, 3, 'car', '2016-06-06', 8, 2960, 41, 3001, 'db', '1', '2016-06-29 10:49:18', '1', '1'),
(204, 111, 3, 3, 'car', '2016-06-08', 8, 3001, 40, 3041, 'sr', 'Віл', '2016-06-29 10:50:06', '1', '1'),
(205, 112, 3, 3, 'car', '2016-06-09', 8, 3041, 40, 3081, 'sr', 'Віл', '2016-06-29 10:50:46', '1', '1'),
(206, 113, 3, 3, 'car', '2016-06-10', 8, 3081, 40, 3121, 'sr', 'Віл', '2016-06-29 10:51:28', '1', '1'),
(207, 114, 3, 3, 'car', '2016-06-13', 8, 3121, 16, 3137, 'sr', '1', '2016-06-29 10:52:13', '1', '1'),
(208, 115, 3, 3, 'car', '2016-06-14', 8, 3137, 16, 3153, 'sr', '1', '2016-06-29 10:52:53', '1', '1'),
(209, 116, 3, 3, 'car', '2016-06-15', 8, 3153, 58, 3211, 'sr', 'Богдан', '2016-06-29 10:54:31', '1', '1'),
(210, 117, 1, 6, 'car', '2016-06-15', 8, 161, 52, 213, 'sr', 'Любешів - Дольськ\r\n\n', '2016-07-20 23:33:22', '1', '1'),
(211, 118, 1, 6, 'car', '2016-06-16', 8, 213, 52, 265, 'sr', 'Дольськ\r\n\nпо системі', '2016-07-20 23:33:22', '1', '1'),
(212, 119, 3, 3, 'car', '2016-06-16', 8, 3211, 58, 3269, 'sr', 'Богдан', '2016-06-29 10:55:08', '1', '1'),
(213, 120, 5, 4, 'car', '2016-06-16', 8, 4416, 46, 4462, 'db', 'Хоцунь', '2016-07-20 23:33:22', '1', '1'),
(214, 121, 3, 3, 'car', '2016-06-17', 8, 3269, 58, 3327, 'sr', 'Богдан', '2016-06-29 10:55:42', '1', '1'),
(215, 122, 6, 6, 'car', '2016-06-17', 8, 265, 10, 275, 'db', 'по місту', '2016-07-20 23:33:22', '1', '1'),
(216, 123, 1, 6, 'car', '2016-06-21', 11, 275, 208, 483, 'db', 'Ковель', '2016-07-20 23:33:22', '1', '1'),
(217, 124, 3, 3, 'car', '2016-06-22', 8, 3327, 58, 3385, 'sr', 'Богдан', '2016-06-29 10:56:50', '1', '1'),
(218, 125, 3, 3, 'car', '2016-06-23', 8, 3385, 58, 3443, 'sr', 'Богдан', '2016-06-29 10:57:37', '1', '1'),
(219, 126, 3, 3, 'car', '2016-06-24', 8, 0, 58, 0, 'sr', 'Богдан 1', '2016-06-29 10:59:52', '1', '1'),
(220, 127, 3, 3, 'car', '2016-06-29', 8, 3501, 8, 3509, 'sr', 'Начальник і Зімиіч і Богдан', '2016-06-29 11:00:38', '1', '1'),
(221, 128, 3, 3, 'car', '2016-06-30', 8, 3509, 0, 3509, 'sr', 'Без пального', '2016-06-29 11:01:07', '1', '1');
-- --------------------------------------------------------
--
-- Структура таблиці `transport`
--
CREATE TABLE `transport` (
`id` int(11) NOT NULL,
`type` enum('truck','car','tractor','other') NOT NULL DEFAULT 'other' COMMENT 'Тип авто',
`type_fuel` enum('diesel','gasoline') NOT NULL DEFAULT 'diesel',
`route_list` int(1) UNSIGNED NOT NULL DEFAULT '1',
`driver_id` int(6) UNSIGNED NOT NULL,
`mk` varchar(255) DEFAULT NULL COMMENT 'Марка',
`tk` int(1) UNSIGNED NOT NULL DEFAULT '0',
`number` varchar(255) DEFAULT NULL COMMENT 'Держ номер',
`note` mediumtext COMMENT 'Нотатка',
`fuel100` varchar(255) DEFAULT '-' COMMENT 'Витрата на 100км',
`fuel100t` varchar(255) DEFAULT '-' COMMENT 'Витрата на 100ткм',
`w1` varchar(255) DEFAULT '-' COMMENT '1 год роб',
`w1acs` varchar(255) DEFAULT '-' COMMENT '1 год роб обл',
`size1001` varchar(255) DEFAULT '-' COMMENT '100м3 1гр',
`size1002` varchar(255) DEFAULT '-' COMMENT '100 м3 2гр'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Автотранспорт';
--
-- Дамп даних таблиці `transport`
--
INSERT INTO `transport` (`id`, `type`, `type_fuel`, `route_list`, `driver_id`, `mk`, `tk`, `number`, `note`, `fuel100`, `fuel100t`, `w1`, `w1acs`, `size1001`, `size1002`) VALUES
(1, 'truck', 'diesel', 1, 0, 'ЗІЛ ММЗ 45021', 0, '08185 ВМ', 'Вантажівка 5т.\r\n\nінв. № 10510042\r\n\n1989р.', '24,7', '-', '-', '-', '-', '-'),
(2, 'truck', 'diesel', 1, 0, 'КАМАЗ 5511', 1, 'АС 5152 АВ', '5т.\r\n\nінв.№ 10510031\r\n\n1987р.', '35,7', '', '', '', '', ''),
(3, 'car', 'gasoline', 1, 0, 'ГАЗ 33023', 1, 'АС 2420 АТ', 'інв. № 10510050\r\n\n2008р.', '12,1', '', '', '', '', ''),
(4, 'car', 'gasoline', 1, 0, 'УАЗ 31514', 1, '02651 ВК', 'інв. № 10510045\r\n\n2003р.', '17,5', '', '', '', '', ''),
(5, 'tractor', 'diesel', 1, 0, 'ПЕА-1А', 0, '3803 ВШ', 'Карпатець\r\n\nінв. № 10410025\r\n\n1992р.', '', '', '8,2', '', '', ''),
(6, 'car', 'gasoline', 1, 0, 'УАЗ 3303', 1, 'АС 3746 АВ', 'інв. № 10510037\r\n\n1992р.', '19,2', '', '', '', '', ''),
(7, 'truck', 'gasoline', 1, 0, 'КС 2561 К', 1, 'АС 5156 АВ', 'інв. № 10510036\r\n\n1993р.', '40', '', '', '6', '', ''),
(8, 'tractor', 'diesel', 1, 0, 'ЮМЗ 6', 1, '38-42 ВШ', 'інв. № 10410021\r\n\n1992р.', '', '', '6,9', '', '', ''),
(9, 'tractor', 'diesel', 0, 0, 'ЕТ 16-33-20', 0, '05252 АС', 'Екскаватор гідравлічний\r\n\nінв. № 10410005\r\n\n2008р.', '', '', '7', '', '12', '15,6'),
(10, 'tractor', 'diesel', 0, 0, 'Д-606', 1, '3841 ВШ', 'Бульдозер на широкому ходу\r\n\nінв. № 10410008\r\n\n1991р.', '', '', '8,2', '', '8,4', '10,9'),
(11, 'tractor', 'diesel', 0, 0, 'ДЗ-42', 0, '3844 ВШ', 'Бульдозер на вузькому ходу\r\n\nінв. № 10410016\r\n\n1987р.', '', '', '12,8', '', '8,4', '10,9'),
(12, 'tractor', 'diesel', 1, 0, 'ЕО 3211', 0, '05012 ВК', 'Екскаватор - драглайн\r\n\nінв. № 10410019\r\n\n1992р.', '', '', '5,4', '', '19,4', '23,8'),
(13, 'tractor', 'diesel', 0, 0, 'ЕО 3211', 0, '05011 ВК', 'Екскаватор - драглайн\r\n\nінв. № 10410020\r\n\n1992р.', '', '', '5,4', '', '19,4', '23,8'),
(14, 'truck', 'gasoline', 1, 0, 'ГАЗ 5312', 1, 'АС 5151 АВ', 'Передано в АТО\r\n\nінв. № 10510039\r\n\n1989р.', '26,2', '2,0', '', '', '', ''),
(15, 'other', 'diesel', 0, 0, 'Майстерня', 0, '', 'РММ', '-', '-', '-', '-', '-', '-'),
(16, 'other', 'diesel', 0, 0, 'Бензопили 2 шт.', 0, '', 'Зімич П.І.', '-', '-', '-', '-', '-', '-'),
(17, 'other', 'diesel', 0, 0, 'Кущоріз', 0, '', 'Зімич П.І.', '-', '-', '-', '-', '-', '-');
-- --------------------------------------------------------
--
-- Структура таблиці `user`
--
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`username` varchar(255) NOT NULL,
`auth_key` varchar(32) NOT NULL,
`password_hash` varchar(255) NOT NULL,
`confirmation_token` varchar(255) DEFAULT NULL,
`status` int(11) NOT NULL DEFAULT '1',
`superadmin` smallint(6) DEFAULT '0',
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
`registration_ip` varchar(15) DEFAULT NULL,
`bind_to_ip` varchar(255) DEFAULT NULL,
`email` varchar(128) DEFAULT NULL,
`email_confirmed` smallint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп даних таблиці `user`
--
INSERT INTO `user` (`id`, `username`, `auth_key`, `password_hash`, `confirmation_token`, `status`, `superadmin`, `created_at`, `updated_at`, `registration_ip`, `bind_to_ip`, `email`, `email_confirmed`) VALUES
(1, 'superadmin', 'kk-2lZN0l4A0bpyXoWK8zUGHn0znAqJT', '$2y$13$Y6PpfvaVdcwEFxDGIgIhLOsWFMmnuknRz2uxG.BoqdJsvu6kN4aHm', NULL, 1, 1, 1467930344, 1467930344, NULL, NULL, NULL, 0),
(2, 'User', 'RT8atm0Iv8ExMqnOAObtUXzBcN0nKk0R', '$2y$13$s4ehmt6n8x88QpkrMg2vw.de2Q13JmUOVWIErah8yHQ13akjto50e', NULL, 1, 0, 1468075641, 1468075758, '127.0.0.1', '', '', 0);
-- --------------------------------------------------------
--
-- Структура таблиці `user_visit_log`
--
CREATE TABLE `user_visit_log` (
`id` int(11) NOT NULL,
`token` varchar(255) NOT NULL,
`ip` varchar(15) NOT NULL,
`language` char(2) NOT NULL,
`user_agent` varchar(255) NOT NULL,
`user_id` int(11) DEFAULT NULL,
`visit_time` int(11) NOT NULL,
`browser` varchar(30) DEFAULT NULL,
`os` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп даних таблиці `user_visit_log`
--
INSERT INTO `user_visit_log` (`id`, `token`, `ip`, `language`, `user_agent`, `user_id`, `visit_time`, `browser`, `os`) VALUES
(1, '577ed80cb1fb0', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1467930636, 'Firefox', 'Linux'),
(2, '577ed89b47203', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1467930779, 'Firefox', 'Linux'),
(3, '577ed9ab6e7bf', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1467931051, 'Firefox', 'Linux'),
(4, '577edc7e1f18e', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1467931774, 'Firefox', 'Linux'),
(5, '577fd0a0e8aba', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1467994272, 'Firefox', 'Linux'),
(6, '577fdb5f14792', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1467997023, 'Firefox', 'Linux'),
(7, '578017bfd087b', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468012479, 'Firefox', 'Linux'),
(8, '5781024dd6262', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468072525, 'Firefox', 'Linux'),
(9, '5781034721ac9', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468072775, 'Firefox', 'Linux'),
(10, '57810f0f588bf', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 2, 1468075791, 'Firefox', 'Linux'),
(11, '578116762dbb5', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468077686, 'Firefox', 'Linux'),
(12, '578131e10778d', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468084705, 'Firefox', 'Linux'),
(13, '578156a66b5e5', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468094118, 'Firefox', 'Linux'),
(14, '578237b0d0718', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468151728, 'Firefox', 'Linux'),
(15, '57826240c876c', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468162624, 'Firefox', 'Linux'),
(16, '578274dc36e5f', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468167388, 'Firefox', 'Linux'),
(17, '578284582ea4e', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468171352, 'Firefox', 'Linux'),
(18, '5782a76853723', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468180328, 'Firefox', 'Linux'),
(19, '5782cc3467e58', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468189748, 'Firefox', 'Linux'),
(20, '5783dba7a0984', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468259239, 'Firefox', 'Linux'),
(21, '5783f278ba296', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468265080, 'Firefox', 'Linux'),
(22, '5784814dbd686', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468301645, 'Firefox', 'Linux'),
(23, '5784930e26abd', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468306190, 'Firefox', 'Linux'),
(24, '5784ac0e81c02', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468312590, 'Firefox', 'Linux'),
(25, '5784dc64b70d1', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468324964, 'Firefox', 'Linux'),
(26, '5784f2e39dc25', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468330723, 'Firefox', 'Linux'),
(27, '5784faf3a148b', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468332787, 'Firefox', 'Linux'),
(28, '57852812ae3ff', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468344338, 'Firefox', 'Linux'),
(29, '5786296ad86eb', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468410218, 'Firefox', 'Linux'),
(30, '57863e5aa55c3', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468415578, 'Firefox', 'Linux'),
(31, '578654f43e184', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468421364, 'Firefox', 'Linux'),
(32, '578692b3dae93', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468437171, 'Firefox', 'Linux'),
(33, '5786b0b1560c0', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468444849, 'Firefox', 'Linux'),
(34, '578758b55f9ed', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468487861, 'Firefox', 'Linux'),
(35, '5787824f356b4', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468498511, 'Firefox', 'Linux'),
(36, '5787824f358b2', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468498511, 'Firefox', 'Linux'),
(37, '5787b2f48277d', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468510964, 'Firefox', 'Linux'),
(38, '5787c0dadd4e5', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468514523, 'Firefox', 'Linux'),
(39, '5789f9e410b5f', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468660196, 'Firefox', 'Linux'),
(40, '578a06dd42f79', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468663517, 'Firefox', 'Linux'),
(41, '578a20ad14f33', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468670125, 'Firefox', 'Linux'),
(42, '578a320b70c26', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468674571, 'Firefox', 'Linux'),
(43, '578a97baa941c', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468700602, 'Firefox', 'Linux'),
(44, '578d056b5e885', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468859755, 'Firefox', 'Linux'),
(45, '578d2d3ee89a6', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468869950, 'Firefox', 'Linux'),
(46, '578e7cee25a0f', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1468955886, 'Firefox', 'Linux'),
(47, '578fbfd25f717', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1469038546, 'Firefox', 'Linux'),
(48, '57912ab4eb88d', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1469131444, 'Firefox', 'Linux'),
(49, '57924d82609b0', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1469205890, 'Firefox', 'Linux'),
(50, '579333d693955', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1469264854, 'Firefox', 'Linux'),
(51, '57937245dce74', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1469280837, 'Firefox', 'Linux'),
(52, '579474414412d', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1469346881, 'Firefox', 'Linux'),
(53, '5794a4f664a04', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1469359350, 'Firefox', 'Linux'),
(54, '5795043ea5c67', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1469383742, 'Firefox', 'Linux'),
(55, '57990ec62a406', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1469648582, 'Firefox', 'Linux'),
(56, '579a582153a05', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1469732897, 'Firefox', 'Linux'),
(57, '579c699b12c8c', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1469868443, 'Firefox', 'Linux'),
(58, '579c804787b69', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1469874247, 'Firefox', 'Linux'),
(59, '579c950029ad4', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1469879552, 'Firefox', 'Linux'),
(60, '579cb7a9bd881', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1469888425, 'Firefox', 'Linux'),
(61, '579d117824c41', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1469911416, 'Firefox', 'Linux'),
(62, '579d1502ed95f', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1469912323, 'Firefox', 'Linux'),
(63, '579d99a657e55', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1469946278, 'Firefox', 'Linux'),
(64, '579da56153fd7', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1469949281, 'Firefox', 'Linux'),
(65, '579da5739c2be', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1469949299, 'Firefox', 'Linux'),
(66, '579e5263054fb', '127.0.0.1', 'en', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0', 1, 1469993571, 'Firefox', 'Linux');
-- --------------------------------------------------------
--
-- Структура таблиці `write_off_fuel`
--
CREATE TABLE `write_off_fuel` (
`id` int(11) UNSIGNED NOT NULL,
`route_list` int(11) UNSIGNED NOT NULL,
`type` enum('diesel','gasoline','oil') NOT NULL,
`filled_by` float UNSIGNED NOT NULL DEFAULT '0',
`write_off` float UNSIGNED NOT NULL DEFAULT '0',
`balance` float NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп даних таблиці `write_off_fuel`
--
INSERT INTO `write_off_fuel` (`id`, `route_list`, `type`, `filled_by`, `write_off`, `balance`) VALUES
(1, 1, 'gasoline', 20, 18, 3),
(2, 3, 'diesel', 5, 5, 0),
(3, 4, 'gasoline', 5, 5, 0),
(4, 5, 'diesel', 5, 8, 2),
(5, 6, 'diesel', 5, 5, 0),
(6, 8, 'diesel', 5, 7, 0),
(7, 9, 'diesel', 20, 20, 0),
(8, 10, 'gasoline', 18, 9, 12),
(9, 11, 'diesel', 15, 15, 0),
(10, 12, 'diesel', 30, 30, 0),
(11, 13, 'gasoline', 44, 52, 4),
(12, 14, 'diesel', 0, 0, 0),
(13, 15, 'diesel', 0, 0, 0),
(14, 16, 'gasoline', 50, 52, 2),
(15, 17, 'diesel', 0, 0, 0),
(16, 18, 'diesel', 20, 20, 0),
(17, 19, 'gasoline', 10, 6, 6),
(18, 20, 'diesel', 0, 0, 0),
(19, 21, 'diesel', 2, 2, 0),
(20, 22, 'gasoline', 5, 1, 4),
(21, 23, 'diesel', 15, 15, 0),
(22, 24, 'diesel', 0, 0, 0),
(23, 25, 'gasoline', 5, 7, 4),
(24, 26, 'diesel', 0, 0, 0),
(25, 27, 'diesel', 0, 0, 0),
(26, 28, 'diesel', 10, 10, 0),
(27, 29, 'gasoline', 15, 5, 14),
(28, 30, 'diesel', 0, 0, 0),
(29, 31, 'gasoline', 0, 2, 2),
(30, 32, 'diesel', 12, 12, 0),
(31, 33, 'gasoline', 5, 10, 9),
(32, 34, 'diesel', 20, 20, 0),
(33, 35, 'diesel', 18, 18, 0),
(34, 36, 'diesel', 15, 15, 0),
(35, 37, 'gasoline', 5, 5, 0),
(36, 38, 'diesel', 25, 25, 0),
(37, 39, 'diesel', 3, 3, 0),
(38, 40, 'gasoline', 5, 3, 11),
(39, 41, 'diesel', 0, 0, 0),
(40, 42, 'gasoline', 10, 2, 19),
(41, 43, 'diesel', 12, 12, 0),
(42, 44, 'diesel', 0, 0, 0),
(43, 45, 'gasoline', 0, 5, 14),
(44, 46, 'diesel', 30, 30, 0),
(45, 47, 'diesel', 0, 0, 0),
(46, 48, 'gasoline', 0, 2, 0),
(47, 49, 'diesel', 10, 10, 0),
(48, 50, 'oil', 3, 3, 0),
(49, 50, 'diesel', 30, 30, 0),
(50, 51, 'gasoline', 5, 2, 17),
(51, 52, 'diesel', 10, 10, 0),
(52, 53, 'gasoline', 10, 9, 18),
(53, 54, 'diesel', 13, 13, 0),
(54, 55, 'gasoline', 0, 3, 15),
(55, 56, 'diesel', 0, 0, 0),
(56, 57, 'gasoline', 12, 6, 21),
(57, 58, 'diesel', 0, 0, 0),
(58, 59, 'gasoline', 50, 52, 19),
(59, 60, 'diesel', 0, 0, 0),
(60, 61, 'gasoline', 10, 11, 18),
(61, 62, 'diesel', 0, 0, 0),
(62, 63, 'gasoline', 0, 4, 14),
(63, 64, 'diesel', 0, 0, 0),
(64, 65, 'gasoline', 0, 11, 3),
(65, 66, 'diesel', 20, 20, 0),
(66, 67, 'gasoline', 10, 7, 3),
(67, 68, 'gasoline', 2, 5, 0),
(68, 69, 'gasoline', 3, 3, 0),
(69, 70, 'gasoline', 0, 10, 0),
(70, 71, 'diesel', 0, 0, 0),
(71, 72, 'gasoline', 10, 8, 5),
(72, 73, 'diesel', 0, 0, 0),
(73, 74, 'gasoline', 0, 2, 3),
(74, 75, 'diesel', 0, 0, 0),
(75, 76, 'gasoline', 0, 2, 1),
(76, 77, 'diesel', 0, 0, 0),
(77, 78, 'diesel', 0, 0, 0),
(78, 79, 'gasoline', 10, 10, 0),
(79, 80, 'diesel', 15, 15, 0),
(80, 81, 'gasoline', 5, 5, 0),
(81, 82, 'diesel', 0, 0, 0),
(82, 83, 'gasoline', 5, 5, 0),
(83, 84, 'diesel', 25, 25, 0),
(84, 85, 'gasoline', 10, 5, 5),
(85, 86, 'diesel', 0, 0, 0),
(86, 87, 'gasoline', 0, 5, 0),
(87, 88, 'diesel', 0, 0, 0),
(88, 89, 'gasoline', 7, 7, 0),
(89, 90, 'diesel', 30, 30, 0),
(90, 91, 'gasoline', 2, 2, 0),
(91, 92, 'diesel', 40, 40, 0),
(92, 93, 'gasoline', 0, 0, 0),
(93, 94, 'diesel', 0, 0, 0),
(94, 95, 'diesel', 15, 15, 0),
(95, 96, 'gasoline', 40, 31, 9),
(96, 97, 'diesel', 20, 20, 0),
(97, 98, 'diesel', 10, 10, 0),
(98, 99, 'gasoline', 10, 8, 2),
(99, 100, 'diesel', 0, 0, 0),
(100, 101, 'diesel', 40, 40, 0),
(101, 102, 'gasoline', 10, 5, 8),
(102, 103, 'diesel', 0, 0, 0),
(103, 104, 'oil', 1, 1, 0),
(104, 104, 'diesel', 50, 50, 0),
(105, 105, 'gasoline', 20, 20, 0),
(106, 106, 'diesel', 0, 0, 0),
(107, 107, 'diesel', 40, 40, 0),
(108, 108, 'gasoline', 20, 20, 2),
(109, 109, 'diesel', 15, 15, 0),
(110, 110, 'diesel', 40, 40, 0),
(111, 112, 'diesel', 0, 0, 0),
(112, 113, 'gasoline', 0, 9, 0),
(113, 114, 'diesel', 5, 5, 0),
(114, 115, 'diesel', 10, 10, 0),
(115, 116, 'gasoline', 10, 5, 7),
(116, 117, 'diesel', 10, 10, 0),
(117, 118, 'diesel', 20, 20, 0),
(118, 119, 'gasoline', 0, 2, 6),
(119, 120, 'oil', 2, 2, 0),
(120, 120, 'diesel', 40, 40, 0),
(121, 121, 'diesel', 0, 0, 0),
(122, 122, 'gasoline', 0, 2, 4),
(123, 123, 'oil', 2, 2, 0),
(124, 123, 'diesel', 15, 15, 0),
(125, 124, 'diesel', 30, 30, 0),
(126, 125, 'gasoline', 6, 6, 7),
(127, 126, 'diesel', 10, 10, 0),
(128, 127, 'diesel', 0, 0, 0),
(129, 128, 'gasoline', 0, 2, 2),
(130, 129, 'diesel', 0, 0, 0),
(131, 130, 'diesel', 40, 40, 0),
(132, 131, 'gasoline', 0, 5, 2),
(133, 132, 'diesel', 0, 0, 0),
(134, 133, 'diesel', 47, 47, 0),
(135, 134, 'gasoline', 0, 1, 1),
(136, 135, 'diesel', 0, 0, 0),
(137, 136, 'gasoline', 50, 49, 2),
(138, 137, 'diesel', 30, 10, 20),
(139, 138, 'diesel', 50, 50, 0),
(140, 139, 'gasoline', 6, 6, 2),
(141, 140, 'diesel', 0, 0, 0),
(142, 141, 'gasoline', 50, 50, 2),
(143, 142, 'diesel', 40, 40, 0),
(144, 143, 'gasoline', 40, 40, 0),
(145, 144, 'diesel', 25, 25, 0),
(146, 145, 'diesel', 40, 40, 0),
(147, 146, 'gasoline', 5, 5, 0),
(148, 147, 'gasoline', 30, 28, 2),
(149, 148, 'gasoline', 5, 2, 5),
(150, 149, 'diesel', 0, 20, 0),
(151, 150, 'gasoline', 0, 4, 1),
(152, 151, 'gasoline', 3, 3, 0),
(153, 152, 'gasoline', 50, 49, 2),
(154, 153, 'diesel', 0, 0, 0),
(155, 154, 'gasoline', 7, 7, 0),
(156, 155, 'diesel', 0, 0, 0),
(157, 156, 'gasoline', 3, 3, 0),
(158, 157, 'gasoline', 2, 2, 0),
(159, 158, 'gasoline', 4, 4, 2),
(160, 159, 'diesel', 13, 13, 0),
(161, 160, 'gasoline', 6, 3, 3),
(162, 161, 'diesel', 15, 15, 0),
(163, 162, 'gasoline', 30, 30, 0),
(164, 163, 'gasoline', 0, 3, 0),
(165, 164, 'gasoline', 40, 40, 0),
(166, 165, 'gasoline', 5, 5, 0),
(167, 166, 'gasoline', 8, 8, 0),
(168, 167, 'gasoline', 5, 5, 0),
(169, 168, 'gasoline', 20, 11, 11),
(170, 169, 'gasoline', 0, 10, 1),
(171, 170, 'gasoline', 5, 7, 0),
(172, 171, 'gasoline', 5, 5, 0),
(173, 172, 'gasoline', 5, 5, 0),
(174, 173, 'gasoline', 10, 10, 0),
(175, 174, 'gasoline', 3, 3, 0),
(176, 175, 'gasoline', 5, 5, 1),
(177, 176, 'gasoline', 25, 12, 14),
(178, 177, 'gasoline', 25, 26, 13),
(179, 178, 'gasoline', 10, 10, 0),
(180, 179, 'gasoline', 15, 8, 20),
(181, 180, 'gasoline', 0, 5, 15),
(182, 181, 'gasoline', 10, 9, 16),
(183, 182, 'gasoline', 10, 10, 0),
(184, 183, 'gasoline', 10, 7, 3),
(185, 184, 'gasoline', 5, 8, 0),
(186, 185, 'gasoline', 4, 3, 17),
(187, 186, 'gasoline', 7, 7, 0),
(188, 187, 'gasoline', 7, 7, 0),
(189, 188, 'gasoline', 3, 4, 16),
(190, 189, 'gasoline', 10, 7, 3),
(191, 190, 'gasoline', 2, 10, 8),
(192, 191, 'gasoline', 20, 23, 0),
(193, 192, 'gasoline', 10, 7, 3),
(194, 193, 'gasoline', 7, 7, 3),
(195, 194, 'gasoline', 47, 40, 15),
(196, 195, 'gasoline', 7, 7, 3),
(197, 196, 'gasoline', 40, 52, 3),
(198, 197, 'gasoline', 5, 5, 3),
(199, 198, 'gasoline', 10, 8, 5),
(200, 199, 'gasoline', 0, 3, 0),
(201, 200, 'gasoline', 5, 5, 0),
(202, 201, 'gasoline', 0, 2, 3),
(203, 202, 'gasoline', 10, 9, 4),
(204, 203, 'gasoline', 5, 5, 0),
(205, 204, 'gasoline', 5, 5, 0),
(206, 205, 'gasoline', 5, 5, 0),
(207, 206, 'gasoline', 5, 5, 0),
(208, 207, 'gasoline', 2, 2, 0),
(209, 208, 'gasoline', 2, 2, 0),
(210, 209, 'gasoline', 8, 7, 1),
(211, 210, 'gasoline', 10, 10, 3),
(212, 211, 'gasoline', 10, 10, 3),
(213, 212, 'gasoline', 6, 7, 0),
(214, 213, 'gasoline', 10, 8, 6),
(215, 214, 'gasoline', 7, 7, 0),
(216, 215, 'gasoline', 2, 2, 0),
(217, 216, 'gasoline', 40, 40, 3),
(218, 217, 'gasoline', 10, 7, 3),
(219, 218, 'gasoline', 4, 7, 0),
(220, 219, 'gasoline', 7, 7, 0),
(221, 220, 'gasoline', 1, 1, 0),
(222, 221, 'gasoline', 0, 0, 0),
(235, 140, 'gasoline', 0, 0, 0),
(236, 140, 'oil', 0, 0, 0),
(245, 167, 'diesel', 0, 0, 0),
(246, 167, 'oil', 0, 0, 0),
(247, 166, 'diesel', 0, 0, 0),
(248, 166, 'oil', 0, 0, 0),
(249, 56, 'gasoline', 0, 0, 0),
(250, 56, 'oil', 0, 0, 0),
(251, 60, 'gasoline', 0, 0, 0),
(252, 60, 'oil', 0, 0, 0),
(253, 75, 'gasoline', 0, 0, 0),
(254, 75, 'oil', 0, 0, 0),
(255, 64, 'gasoline', 10, 10, 0),
(256, 64, 'oil', 0, 0, 0),
(257, 88, 'gasoline', 0, 0, 0),
(258, 88, 'oil', 0, 0, 0),
(259, 138, 'gasoline', 2, 0, 0),
(260, 138, 'oil', 0, 0, 0);
--
-- Індекси збережених таблиць
--
--
-- Індекси таблиці `auth_assignment`
--
ALTER TABLE `auth_assignment`
ADD PRIMARY KEY (`item_name`,`user_id`),
ADD KEY `user_id` (`user_id`);
--
-- Індекси таблиці `auth_item`
--
ALTER TABLE `auth_item`
ADD PRIMARY KEY (`name`),
ADD KEY `rule_name` (`rule_name`),
ADD KEY `idx-auth_item-type` (`type`),
ADD KEY `fk_auth_item_group_code` (`group_code`);
--
-- Індекси таблиці `auth_item_child`
--
ALTER TABLE `auth_item_child`
ADD PRIMARY KEY (`parent`,`child`),
ADD KEY `child` (`child`);
--
-- Індекси таблиці `auth_item_group`
--
ALTER TABLE `auth_item_group`
ADD PRIMARY KEY (`code`);
--
-- Індекси таблиці `auth_rule`
--
ALTER TABLE `auth_rule`
ADD PRIMARY KEY (`name`);
--
-- Індекси таблиці `drivers`
--
ALTER TABLE `drivers`
ADD PRIMARY KEY (`id`);
--
-- Індекси таблиці `migration`
--
ALTER TABLE `migration`
ADD PRIMARY KEY (`version`);
--
-- Індекси таблиці `realized_works_truck`
--
ALTER TABLE `realized_works_truck`
ADD PRIMARY KEY (`id`);
--
-- Індекси таблиці `routelist`
--
ALTER TABLE `routelist`
ADD PRIMARY KEY (`id`),
ADD KEY `transport` (`transport`);
--
-- Індекси таблиці `route_list`
--
ALTER TABLE `route_list`
ADD PRIMARY KEY (`id`),
ADD KEY `transport` (`transport_id`),
ADD KEY `driver_id` (`driver_id`);
--
-- Індекси таблиці `transport`
--
ALTER TABLE `transport`
ADD PRIMARY KEY (`id`);
--
-- Індекси таблиці `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`);
--
-- Індекси таблиці `user_visit_log`
--
ALTER TABLE `user_visit_log`
ADD PRIMARY KEY (`id`),
ADD KEY `user_id` (`user_id`);
--
-- Індекси таблиці `write_off_fuel`
--
ALTER TABLE `write_off_fuel`
ADD PRIMARY KEY (`id`),
ADD KEY `route_list` (`route_list`);
--
-- AUTO_INCREMENT для збережених таблиць
--
--
-- AUTO_INCREMENT для таблиці `drivers`
--
ALTER TABLE `drivers`
MODIFY `id` int(6) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
--
-- AUTO_INCREMENT для таблиці `realized_works_truck`
--
ALTER TABLE `realized_works_truck`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=94;
--
-- AUTO_INCREMENT для таблиці `routelist`
--
ALTER TABLE `routelist`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=249;
--
-- AUTO_INCREMENT для таблиці `route_list`
--
ALTER TABLE `route_list`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=232;
--
-- AUTO_INCREMENT для таблиці `transport`
--
ALTER TABLE `transport`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;
--
-- AUTO_INCREMENT для таблиці `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT для таблиці `user_visit_log`
--
ALTER TABLE `user_visit_log`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=67;
--
-- AUTO_INCREMENT для таблиці `write_off_fuel`
--
ALTER TABLE `write_off_fuel`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=261;
--
-- Обмеження зовнішнього ключа збережених таблиць
--
--
-- Обмеження зовнішнього ключа таблиці `auth_assignment`
--
ALTER TABLE `auth_assignment`
ADD CONSTRAINT `auth_assignment_ibfk_1` FOREIGN KEY (`item_name`) REFERENCES `auth_item` (`name`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `auth_assignment_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Обмеження зовнішнього ключа таблиці `auth_item`
--
ALTER TABLE `auth_item`
ADD CONSTRAINT `auth_item_ibfk_1` FOREIGN KEY (`rule_name`) REFERENCES `auth_rule` (`name`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `fk_auth_item_group_code` FOREIGN KEY (`group_code`) REFERENCES `auth_item_group` (`code`) ON DELETE SET NULL ON UPDATE CASCADE;
--
-- Обмеження зовнішнього ключа таблиці `auth_item_child`
--
ALTER TABLE `auth_item_child`
ADD CONSTRAINT `auth_item_child_ibfk_1` FOREIGN KEY (`parent`) REFERENCES `auth_item` (`name`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `auth_item_child_ibfk_2` FOREIGN KEY (`child`) REFERENCES `auth_item` (`name`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Обмеження зовнішнього ключа таблиці `user_visit_log`
--
ALTER TABLE `user_visit_log`
ADD CONSTRAINT `user_visit_log_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
/*!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 */;
| 79.355095 | 349 | 0.547558 |
2654dc7b816bb024255e018089d92bb4301aab4f | 16,166 | java | Java | clients/java/client/src/main/java/org/camunda/bpm/client/task/ExternalTaskService.java | mlehotsky13/camunda-bpm-platform | c6851f63dcaf42305ad7584815884c190d89eb95 | [
"Apache-2.0"
] | 1 | 2021-07-23T15:50:16.000Z | 2021-07-23T15:50:16.000Z | clients/java/client/src/main/java/org/camunda/bpm/client/task/ExternalTaskService.java | mlehotsky13/camunda-bpm-platform | c6851f63dcaf42305ad7584815884c190d89eb95 | [
"Apache-2.0"
] | 63 | 2021-05-10T03:23:00.000Z | 2022-03-25T10:28:07.000Z | clients/java/client/src/main/java/org/camunda/bpm/client/task/ExternalTaskService.java | mlehotsky13/camunda-bpm-platform | c6851f63dcaf42305ad7584815884c190d89eb95 | [
"Apache-2.0"
] | 1 | 2021-05-22T07:11:18.000Z | 2021-05-22T07:11:18.000Z | /*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership. Camunda licenses this file to you under the Apache License,
* Version 2.0; you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.camunda.bpm.client.task;
import org.camunda.bpm.client.exception.ConnectionLostException;
import org.camunda.bpm.client.exception.NotAcquiredException;
import org.camunda.bpm.client.exception.NotFoundException;
import org.camunda.bpm.client.exception.NotResumedException;
import org.camunda.bpm.client.exception.ValueMapperException;
import java.util.Map;
/**
* <p>Service that provides possibilities to interact with fetched and locked tasks.</p>
*
* @author Tassilo Weidner
*/
public interface ExternalTaskService {
/**
* Locks a task by a given amount of time.
*
* Note: This method should be used to lock external tasks
* that have been obtained without using the fetch & lock API.
*
* @param externalTaskId the id of the external task whose lock will be extended
* @param lockDuration specifies the lock duration in milliseconds
*
* @throws NotFoundException if the task has been canceled and therefore does not exist anymore
* @throws NotAcquiredException if the task's most recent lock could not be acquired
* @throws ConnectionLostException if the connection could not be established
*/
void lock(String externalTaskId, long lockDuration);
/**
* Locks a task by a given amount of time.
*
* Note: This method should be used to lock external tasks
* that have been obtained without using the fetch & lock API.
*
* @param externalTask which lock will be extended
* @param lockDuration specifies the lock duration in milliseconds
*
* @throws NotFoundException if the task has been canceled and therefore does not exist anymore
* @throws NotAcquiredException if the task's most recent lock could not be acquired
* @throws ConnectionLostException if the connection could not be established
*/
void lock(ExternalTask externalTask, long lockDuration);
/**
* Unlocks a task and clears the tasks lock expiration time and worker id.
*
* @param externalTask which will be unlocked
*
* @throws NotFoundException if the task has been canceled and therefore does not exist anymore
* @throws ConnectionLostException if the connection could not be established
*/
void unlock(ExternalTask externalTask);
/**
* Completes a task.
*
* @param externalTask which will be completed
*
* @throws NotFoundException if the task has been canceled and therefore does not exist anymore
* @throws NotAcquiredException if the tasks most recent lock could not be acquired
* @throws NotResumedException if the corresponding process instance could not be resumed
* @throws ConnectionLostException if the connection could not be established
* @throws ValueMapperException
* <ul>
* <li> if an object cannot be serialized
* <li> if no 'objectTypeName' is provided for non-null value
* <li> if value is of type abstract
* <li> if no suitable serializer could be found
* </ul>
*/
void complete(ExternalTask externalTask);
/**
* Completes a task.
*
* @param externalTask which will be completed
* @param variables are set in the tasks ancestor execution hierarchy The key and the value represent
* the variable name and its value. Map can consist of both typed and untyped variables.
*
* @throws NotFoundException if the task has been canceled and therefore does not exist anymore
* @throws NotAcquiredException if the task's most recent lock could not be acquired
* @throws NotResumedException if the corresponding process instance could not be resumed
* @throws ConnectionLostException if the connection could not be established
* @throws ValueMapperException
* <ul>
* <li> if an object cannot be serialized
* <li> if no 'objectTypeName' is provided for non-null value
* <li> if value is of type abstract
* <li> if no suitable serializer could be found
* </ul>
*/
void complete(ExternalTask externalTask, Map<String, Object> variables);
/**
* Completes a task.
*
* @param externalTask which will be completed
* @param variables are set in the tasks ancestor execution hierarchy. The key and the value represent
* the variable name and its value. Map can consist of both typed and untyped variables.
* @param localVariables are set in the execution of the external task instance. The key and the value represent
* the variable name and its value. Map can consist of both typed and untyped variables.
*
* @throws NotFoundException if the task has been canceled and therefore does not exist anymore
* @throws NotAcquiredException if the task's most recent lock could not be acquired
* @throws NotResumedException if the corresponding process instance could not be resumed
* @throws ConnectionLostException if the connection could not be established
* @throws ValueMapperException
* <ul>
* <li> if an object cannot be serialized
* <li> if no 'objectTypeName' is provided for non-null value
* <li> if value is of type abstract
* <li> if no suitable serializer could be found
* </ul>
*/
void complete(ExternalTask externalTask, Map<String, Object> variables, Map<String, Object> localVariables);
/**
* Completes a task.
*
* @param externalTaskId the id of the external task which will be completed
* @param variables are set in the tasks ancestor execution hierarchy. The key and the value represent
* the variable name and its value. Map can consist of both typed and untyped variables.
* @param localVariables are set in the execution of the external task instance. The key and the value represent
* the variable name and its value. Map can consist of both typed and untyped variables.
*/
void complete(String externalTaskId, Map<String, Object> variables, Map<String, Object> localVariables);
/**
* Reports a failure to execute a task. A number of retries and a timeout until
* the task can be specified. If the retries are set to 0, an incident for this
* task is created.
*
* @param externalTask external task for which a failure will be reported
* @param errorMessage indicates the reason of the failure.
* @param errorDetails provides a detailed error description.
* @param retries specifies how often the task should be retried. Must be >= 0.
* If 0, an incident is created and the task cannot be fetched anymore
* unless the retries are increased again. The incident's message is set
* to the errorMessage parameter.
* @param retryTimeout specifies a timeout in milliseconds before the external task
* becomes available again for fetching. Must be >= 0.
*
* @throws NotFoundException if the task has been canceled and therefore does not exist anymore
* @throws NotAcquiredException if the task's most recent lock could not be acquired
* @throws NotResumedException if the corresponding process instance could not be resumed
* @throws ConnectionLostException if the connection could not be established
*/
void handleFailure(ExternalTask externalTask, String errorMessage, String errorDetails, int retries, long retryTimeout);
/**
* Reports a failure to execute a task. A number of retries and a timeout until
* the task can be specified. If the retries are set to 0, an incident for this
* task is created.
*
* @param externalTaskId the id of the external task for which a failure will be reported
* @param errorMessage indicates the reason of the failure.
* @param errorDetails provides a detailed error description.
* @param retries specifies how often the task should be retried. Must be >= 0.
* If 0, an incident is created and the task cannot be fetched anymore
* unless the retries are increased again. The incident's message is set
* to the errorMessage parameter.
* @param retryTimeout specifies a timeout in milliseconds before the external task
* becomes available again for fetching. Must be >= 0.
*
* @throws NotFoundException if the task has been canceled and therefore does not exist anymore
* @throws NotAcquiredException if the task's most recent lock could not be acquired
* @throws NotResumedException if the corresponding process instance could not be resumed
* @throws ConnectionLostException if the connection could not be established
*/
void handleFailure(String externalTaskId, String errorMessage, String errorDetails, int retries, long retryTimeout);
/**
* Reports a failure to execute a task. A number of retries and a timeout until
* the task can be specified. If the retries are set to 0, an incident for this
* task is created.
*
* @param externalTaskId the id of the external task for which a failure will be reported
* @param errorMessage indicates the reason of the failure.
* @param errorDetails provides a detailed error description.
* @param retries specifies how often the task should be retried. Must be >= 0.
* If 0, an incident is created and the task cannot be fetched anymore
* unless the retries are increased again. The incident's message is set
* to the errorMessage parameter.
* @param retryTimeout specifies a timeout in milliseconds before the external task
* becomes available again for fetching. Must be >= 0.
* @param variables a map of variables to set on the execution the external task is assigned to
* @param localVariables a map of variables to set on the execution locally
*
* @throws NotFoundException if the task has been canceled and therefore does not exist anymore
* @throws NotAcquiredException if the task's most recent lock could not be acquired
* @throws NotResumedException if the corresponding process instance could not be resumed
* @throws ConnectionLostException if the connection could not be established
*/
void handleFailure(String externalTaskId, String errorMessage, String errorDetails, int retries, long retryTimeout, Map<String, Object> variables, Map<String, Object> localVariables);
/**
* Reports a business error in the context of a running task.
* The error code must be specified to identify the BPMN error handler.
*
* @param externalTask external task for which a BPMN error will be reported
* @param errorCode that indicates the predefined error. The error code
* is used to identify the BPMN error handler.
*
* @throws NotFoundException if the task has been canceled and therefore does not exist anymore
* @throws NotAcquiredException if the task's most recent lock could not be acquired
* @throws NotResumedException if the corresponding process instance could not be resumed
* @throws ConnectionLostException if the connection could not be established
*/
void handleBpmnError(ExternalTask externalTask, String errorCode);
/**
* Reports a business error in the context of a running task.
* The error code must be specified to identify the BPMN error handler.
*
* @param externalTask external task for which a BPMN error will be reported
* @param errorCode that indicates the predefined error. The error code
* is used to identify the BPMN error handler.
* @param errorMessage which will be passed when the BPMN error is caught
*
* @throws NotFoundException if the task has been canceled and therefore does not exist anymore
* @throws NotAcquiredException if the task's most recent lock could not be acquired
* @throws NotResumedException if the corresponding process instance could not be resumed
* @throws ConnectionLostException if the connection could not be established
*/
void handleBpmnError(ExternalTask externalTask, String errorCode, String errorMessage);
/**
* Reports a business error in the context of a running task.
* The error code must be specified to identify the BPMN error handler.
*
* @param externalTask external task for which a BPMN error will be reported
* @param errorCode that indicates the predefined error. The error code
* is used to identify the BPMN error handler.
* @param errorMessage which will be passed when the BPMN error is caught
* @param variables which will be passed to the execution when the BPMN error is caught
*
* @throws NotFoundException if the task has been canceled and therefore does not exist anymore
* @throws NotAcquiredException if the task's most recent lock could not be acquired
* @throws NotResumedException if the corresponding process instance could not be resumed
* @throws ConnectionLostException if the connection could not be established
*/
void handleBpmnError(ExternalTask externalTask, String errorCode, String errorMessage, Map<String, Object> variables);
/**
* Reports a business error in the context of a running task.
* The error code must be specified to identify the BPMN error handler.
*
* @param externalTaskId the id of the external task for which a BPMN error will be reported
* @param errorCode that indicates the predefined error. The error code
* is used to identify the BPMN error handler.
* @param errorMessage which will be passed when the BPMN error is caught
* @param variables which will be passed to the execution when the BPMN error is caught
*
* @throws NotFoundException if the task has been canceled and therefore does not exist anymore
* @throws NotAcquiredException if the task's most recent lock could not be acquired
* @throws NotResumedException if the corresponding process instance could not be resumed
* @throws ConnectionLostException if the connection could not be established
*/
void handleBpmnError(String externalTaskId, String errorCode, String errorMessage, Map<String, Object> variables);
/**
* Extends the timeout of the lock by a given amount of time.
*
* @param externalTask which lock will be extended
* @param newDuration specifies the the new lock duration in milliseconds
*
* @throws NotFoundException if the task has been canceled and therefore does not exist anymore
* @throws NotAcquiredException if the task's most recent lock could not be acquired
* @throws ConnectionLostException if the connection could not be established
*/
void extendLock(ExternalTask externalTask, long newDuration);
/**
* Extends the timeout of the lock by a given amount of time.
*
* @param externalTaskId the id of the external task which lock will be extended
* @param newDuration specifies the the new lock duration in milliseconds
*
* @throws NotFoundException if the task has been canceled and therefore does not exist anymore
* @throws NotAcquiredException if the task's most recent lock could not be acquired
* @throws ConnectionLostException if the connection could not be established
*/
void extendLock(String externalTaskId, long newDuration);
}
| 52.830065 | 185 | 0.72671 |
48faa7411503cfd9527ef8fdf600fcb71d8ffb8e | 61,572 | c | C | ruby-win32/lib/ruby/gems/1.8/gems/win32-service-0.5.2-x86-mswin32/lib/win32/service.c | mura303/pritter-proj | 02126c9ca1d5e84e5b33e13cb410f333ba04b7d0 | [
"MIT"
] | null | null | null | ruby-win32/lib/ruby/gems/1.8/gems/win32-service-0.5.2-x86-mswin32/lib/win32/service.c | mura303/pritter-proj | 02126c9ca1d5e84e5b33e13cb410f333ba04b7d0 | [
"MIT"
] | null | null | null | ruby-win32/lib/ruby/gems/1.8/gems/win32-service-0.5.2-x86-mswin32/lib/win32/service.c | mura303/pritter-proj | 02126c9ca1d5e84e5b33e13cb410f333ba04b7d0 | [
"MIT"
] | null | null | null | #include "ruby.h"
#include <windows.h>
#include <string.h>
#include <stdlib.h>
#include <malloc.h>
#include <tchar.h>
#include "service.h"
#ifndef UNICODE
#define UNICODE
#endif
static VALUE cServiceError;
static VALUE cDaemonError;
static VALUE v_service_struct, v_service_status_struct;
static HANDLE hStartEvent;
static HANDLE hStopEvent;
static HANDLE hStopCompletedEvent;
static SERVICE_STATUS_HANDLE ssh;
static DWORD dwServiceState;
static TCHAR error[1024];
static VALUE EventHookHash;
static VALUE thread_group;
static int cAdd;
static int cList;
static int cSize;
CRITICAL_SECTION csControlCode;
// I happen to know from looking in the header file
// that 0 is not a valid service control code
// so we will use it, the value does not matter
// as long as it will never show up in ServiceCtrl
// - Patrick Hurley
#define IDLE_CONTROL_CODE 0
static int waiting_control_code = IDLE_CONTROL_CODE;
static VALUE service_close(VALUE);
void WINAPI Service_Main(DWORD dwArgc, LPTSTR *lpszArgv);
void WINAPI Service_Ctrl(DWORD dwCtrlCode);
void ErrorStopService();
void SetTheServiceStatus(DWORD dwCurrentState,DWORD dwWin32ExitCode,
DWORD dwCheckPoint, DWORD dwWaitHint);
// Called by the service control manager after the call to
// StartServiceCtrlDispatcher.
void WINAPI Service_Main(DWORD dwArgc, LPTSTR *lpszArgv)
{
int i;
// Obtain the name of the service.
LPTSTR lpszServiceName = lpszArgv[0];
// Register the service ctrl handler.
ssh = RegisterServiceCtrlHandler(lpszServiceName,
(LPHANDLER_FUNCTION)Service_Ctrl);
if(ssh == (SERVICE_STATUS_HANDLE)0){
ErrorStopService();
rb_raise(cDaemonError,"RegisterServiceCtrlHandler failed");
}
// wait for sevice initialization
for(i=1;TRUE;i++)
{
if(WaitForSingleObject(hStartEvent, 1000) == WAIT_OBJECT_0)
break;
SetTheServiceStatus(SERVICE_START_PENDING, 0, i, 1000);
}
// The service has started.
SetTheServiceStatus(SERVICE_RUNNING, NO_ERROR, 0, 0);
// Main loop for the service.
while(WaitForSingleObject(hStopEvent, 1000) != WAIT_OBJECT_0)
{
}
// Stop the service.
SetTheServiceStatus(SERVICE_STOPPED, NO_ERROR, 0, 0);
}
VALUE Service_Event_Dispatch(VALUE val)
{
VALUE func,self;
VALUE result = Qnil;
if(val!=Qnil) {
self = RARRAY(val)->ptr[0];
func = NUM2INT(RARRAY(val)->ptr[1]);
result = rb_funcall(self,func,0);
}
return result;
}
VALUE Ruby_Service_Ctrl()
{
while (WaitForSingleObject(hStopEvent,0) == WAIT_TIMEOUT)
{
__try
{
EnterCriticalSection(&csControlCode);
// Check to see if anything interesting has been signaled
if (waiting_control_code != IDLE_CONTROL_CODE)
{
// if there is a code, create a ruby thread to deal with it
// this might be over engineering the solution, but I don't
// want to block Service_Ctrl longer than necessary and the
// critical section will block it.
VALUE val = rb_hash_aref(EventHookHash, INT2NUM(waiting_control_code));
if(val!=Qnil) {
VALUE thread = rb_thread_create(Service_Event_Dispatch, (void*) val);
rb_funcall(thread_group, cAdd, 1, thread);
}
// some seriously ugly flow control going on in here
if (waiting_control_code == SERVICE_CONTROL_STOP)
break;
waiting_control_code = IDLE_CONTROL_CODE;
}
}
__finally
{
LeaveCriticalSection(&csControlCode);
}
// This is an ugly polling loop, be as polite as possible
rb_thread_polling();
}
for (;;)
{
VALUE list = rb_funcall(thread_group, cList, 0);
VALUE size = rb_funcall(list, cSize, 0);
if (NUM2INT(size) == 0)
break;
// This is another ugly polling loop, be as polite as possible
rb_thread_polling();
}
SetEvent(hStopCompletedEvent);
return Qnil;
}
// Handles control signals from the service control manager.
void WINAPI Service_Ctrl(DWORD dwCtrlCode)
{
DWORD dwState = SERVICE_RUNNING;
// hard to image this code ever failing, so we probably
// don't need the __try/__finally wrapper
__try
{
EnterCriticalSection(&csControlCode);
waiting_control_code = dwCtrlCode;
}
__finally
{
LeaveCriticalSection(&csControlCode);
}
switch(dwCtrlCode)
{
case SERVICE_CONTROL_STOP:
dwState = SERVICE_STOP_PENDING;
break;
case SERVICE_CONTROL_SHUTDOWN:
dwState = SERVICE_STOP_PENDING;
break;
case SERVICE_CONTROL_PAUSE:
dwState = SERVICE_PAUSED;
break;
case SERVICE_CONTROL_CONTINUE:
dwState = SERVICE_RUNNING;
break;
case SERVICE_CONTROL_INTERROGATE:
break;
default:
break;
}
// Set the status of the service.
SetTheServiceStatus(dwState, NO_ERROR, 0, 0);
// Tell service_main thread to stop.
if ((dwCtrlCode == SERVICE_CONTROL_STOP) ||
(dwCtrlCode == SERVICE_CONTROL_SHUTDOWN))
{
// how long should we give ruby to clean up?
// right now we give it forever :-)
while (WaitForSingleObject(hStopCompletedEvent, 500) == WAIT_TIMEOUT)
{
SetTheServiceStatus(dwState, NO_ERROR, 0, 0);
}
if (!SetEvent(hStopEvent))
ErrorStopService();
// Raise an error here?
}
}
// Wraps SetServiceStatus.
void SetTheServiceStatus(DWORD dwCurrentState, DWORD dwWin32ExitCode,
DWORD dwCheckPoint, DWORD dwWaitHint)
{
SERVICE_STATUS ss; // Current status of the service.
// Disable control requests until the service is started.
if (dwCurrentState == SERVICE_START_PENDING){
ss.dwControlsAccepted = 0;
}
else{
ss.dwControlsAccepted =
SERVICE_ACCEPT_STOP|SERVICE_ACCEPT_SHUTDOWN|
SERVICE_ACCEPT_PAUSE_CONTINUE|SERVICE_ACCEPT_SHUTDOWN;
}
// Initialize ss structure.
ss.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
ss.dwServiceSpecificExitCode = 0;
ss.dwCurrentState = dwCurrentState;
ss.dwWin32ExitCode = dwWin32ExitCode;
ss.dwCheckPoint = dwCheckPoint;
ss.dwWaitHint = dwWaitHint;
dwServiceState = dwCurrentState;
// Send status of the service to the Service Controller.
if(!SetServiceStatus(ssh, &ss)){
ErrorStopService();
}
}
// Handle API errors or other problems by ending the service
void ErrorStopService(){
// If you have threads running, tell them to stop. Something went
// wrong, and you need to stop them so you can inform the SCM.
SetEvent(hStopEvent);
// Stop the service.
SetTheServiceStatus(SERVICE_STOPPED, GetLastError(), 0, 0);
}
DWORD WINAPI ThreadProc(LPVOID lpParameter){
SERVICE_TABLE_ENTRY ste[] =
{{TEXT(""),(LPSERVICE_MAIN_FUNCTION)Service_Main}, {NULL, NULL}};
if (!StartServiceCtrlDispatcher(ste)){
ErrorStopService();
strcpy(error,ErrorDescription(GetLastError()));
// Very questionable here, we should generate an event
// and be polling in a green thread for the event, but
// this really should not happen so here we go
rb_raise(cDaemonError,error);
}
return 0;
}
static VALUE daemon_allocate(VALUE klass){
EventHookHash = rb_hash_new();
thread_group = rb_class_new_instance(0, 0,
rb_const_get(rb_cObject, rb_intern("ThreadGroup")));
return Data_Wrap_Struct(klass, 0, 0, 0);
}
/*
* This is the method that actually puts your code into a loop and allows it
* to run as a service. The code that is actually run while in the mainloop
* is what you defined in your own Daemon#service_main method.
*/
static VALUE
daemon_mainloop(VALUE self)
{
DWORD ThreadId;
HANDLE hThread;
dwServiceState = 0;
// Save a couple symbols
cAdd = rb_intern("add");
cList = rb_intern("list");
cSize = rb_intern("size");
// Event hooks
if(rb_respond_to(self,rb_intern("service_stop"))){
rb_hash_aset(EventHookHash,INT2NUM(SERVICE_CONTROL_STOP),
rb_ary_new3(2,self,INT2NUM(rb_intern("service_stop"))));
}
if(rb_respond_to(self,rb_intern("service_pause"))){
rb_hash_aset(EventHookHash,INT2NUM(SERVICE_CONTROL_PAUSE),
rb_ary_new3(2,self,INT2NUM(rb_intern("service_pause"))));
}
if(rb_respond_to(self,rb_intern("service_resume"))){
rb_hash_aset(EventHookHash,INT2NUM(SERVICE_CONTROL_CONTINUE),
rb_ary_new3(2,self,INT2NUM(rb_intern("service_resume"))));
}
if(rb_respond_to(self,rb_intern("service_interrogate"))){
rb_hash_aset(EventHookHash,INT2NUM(SERVICE_CONTROL_INTERROGATE),
rb_ary_new3(2,self,INT2NUM(rb_intern("service_interrogate"))));
}
if(rb_respond_to(self,rb_intern("service_shutdown"))){
rb_hash_aset(EventHookHash,INT2NUM(SERVICE_CONTROL_SHUTDOWN),
rb_ary_new3(2,self,INT2NUM(rb_intern("service_shutdown"))));
}
#ifdef SERVICE_CONTROL_PARAMCHANGE
if(rb_respond_to(self,rb_intern("service_paramchange"))){
rb_hash_aset(EventHookHash,INT2NUM(SERVICE_CONTROL_PARAMCHANGE),
rb_ary_new3(2,self,INT2NUM(rb_intern("service_paramchange"))));
}
#endif
#ifdef SERVICE_CONTROL_NETBINDADD
if(rb_respond_to(self,rb_intern("service_netbindadd"))){
rb_hash_aset(EventHookHash,INT2NUM(SERVICE_CONTROL_NETBINDADD),
rb_ary_new3(2,self,INT2NUM(rb_intern("service_netbindadd"))));
}
#endif
#ifdef SERVICE_CONTROL_NETBINDREMOVE
if(rb_respond_to(self,rb_intern("service_netbindremove"))){
rb_hash_aset(EventHookHash,INT2NUM(SERVICE_CONTROL_NETBINDREMOVE),
rb_ary_new3(2,self,INT2NUM(rb_intern("service_netbindremove"))));
}
#endif
#ifdef SERVICE_CONTROL_NETBINDENABLE
if(rb_respond_to(self,rb_intern("service_netbindenable"))){
rb_hash_aset(EventHookHash,INT2NUM(SERVICE_CONTROL_NETBINDENABLE),
rb_ary_new3(2,self,INT2NUM(rb_intern("service_netbindenable"))));
}
#endif
#ifdef SERVICE_CONTROL_NETBINDDISABLE
if(rb_respond_to(self,rb_intern("service_netbinddisable"))){
rb_hash_aset(EventHookHash,INT2NUM(SERVICE_CONTROL_NETBINDDISABLE),
rb_ary_new3(2,self,INT2NUM(rb_intern("service_netbinddisable"))));
}
#endif
// Create the event to signal the service to start.
hStartEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
if(hStartEvent == NULL){
strcpy(error,ErrorDescription(GetLastError()));
ErrorStopService();
rb_raise(cDaemonError,error);
}
// Create the event to signal the service to stop.
hStopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
if(hStopEvent == NULL){
strcpy(error,ErrorDescription(GetLastError()));
ErrorStopService();
rb_raise(cDaemonError,error);
}
// Create the event to signal the service that stop has completed
hStopCompletedEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
if(hStopCompletedEvent == NULL){
strcpy(error,ErrorDescription(GetLastError()));
ErrorStopService();
rb_raise(cDaemonError,error);
}
// Create the green thread to poll for Service_Ctrl events
rb_thread_create(Ruby_Service_Ctrl, 0);
// Create Thread for service main
hThread = CreateThread(NULL,0,ThreadProc,0,0,&ThreadId);
if(hThread == INVALID_HANDLE_VALUE){
strcpy(error,ErrorDescription(GetLastError()));
ErrorStopService();
rb_raise(cDaemonError,error);
}
if(rb_respond_to(self,rb_intern("service_init"))){
rb_funcall(self,rb_intern("service_init"),0);
}
SetEvent(hStartEvent);
// Call service_main method
if(rb_respond_to(self,rb_intern("service_main"))){
rb_funcall(self,rb_intern("service_main"),0);
}
while(WaitForSingleObject(hStopEvent, 1000) != WAIT_OBJECT_0)
{
}
// Close the event handle and the thread handle.
if(!CloseHandle(hStopEvent)){
strcpy(error,ErrorDescription(GetLastError()));
ErrorStopService();
rb_raise(cDaemonError,error);
}
// Wait for Thread service main
WaitForSingleObject(hThread, INFINITE);
return self;
}
/*
* Returns the state of the service (as an constant integer) which can be any
* of the service status constants, e.g. RUNNING, PAUSED, etc.
*
* This method is typically used within your service_main method to setup the
* loop. For example:
*
* class MyDaemon < Daemon
* def service_main
* while state == RUNNING || state == PAUSED || state == IDLE
* # Your main loop here
* end
* end
* end
*
* See the Daemon#running? method for an abstraction of the above code.
*/
static VALUE daemon_state(VALUE self){
return UINT2NUM(dwServiceState);
}
/*
* Returns whether or not the service is in a running state, i.e. the service
* status is either RUNNING, PAUSED or IDLE.
*
* This is typically used within your service_main method to setup the main
* loop. For example:
*
* class MyDaemon < Daemon
* def service_main
* while running?
* # Your main loop here
* end
* end
* end
*/
static VALUE daemon_is_running(VALUE self){
VALUE v_bool = Qfalse;
if(
(dwServiceState == SERVICE_RUNNING) ||
(dwServiceState == SERVICE_PAUSED) ||
(dwServiceState == 0)
){
v_bool = Qtrue;
}
return v_bool;
}
static VALUE service_allocate(VALUE klass){
SvcStruct* ptr = malloc(sizeof(SvcStruct));
return Data_Wrap_Struct(klass,0,service_free,ptr);
}
/* call-seq:
* Service.new(host=nil, desired_access=nil)
* Service.new(host=nil, desired_access=nil){ |svc| ... }
*
* Creates and returns a new Win32::Service handle on +host+ with the
* +desired_access+. If no host is specified, your local machine is
* used. If no desired access is specified, then
* Service::MANAGER_CREATE_SERVICE is used.
*
* If a block is provided then the object is yielded back to the block and
* automatically closed at the end of the block.
*/
static VALUE service_init(int argc, VALUE *argv, VALUE self){
VALUE v_machine_name, v_desired_access;
TCHAR* lpMachineName;
DWORD dwDesiredAccess;
SvcStruct* ptr;
Data_Get_Struct(self, SvcStruct, ptr);
rb_scan_args(argc, argv, "02", &v_machine_name, &v_desired_access);
if(NIL_P(v_machine_name)){
lpMachineName = NULL;
}
else{
SafeStringValue(v_machine_name);
lpMachineName = TEXT(StringValuePtr(v_machine_name));
}
if(NIL_P(v_desired_access))
dwDesiredAccess = SC_MANAGER_CREATE_SERVICE;
else
dwDesiredAccess = NUM2INT(v_desired_access);
ptr->hSCManager = OpenSCManager(
lpMachineName,
NULL,
dwDesiredAccess
);
if(!ptr->hSCManager)
rb_raise(cServiceError,ErrorDescription(GetLastError()));
rb_iv_set(self, "@machine_name", v_machine_name);
rb_iv_set(self, "@desired_access", v_desired_access);
rb_iv_set(self, "@service_type",
INT2FIX(SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS));
rb_iv_set(self, "@start_type", INT2FIX(SERVICE_DEMAND_START));
rb_iv_set(self, "@error_control", INT2FIX(SERVICE_ERROR_NORMAL));
if(rb_block_given_p())
rb_ensure(rb_yield, self, service_close, self);
return self;
}
/*
* call-seq:
* Service#close
*
* Closes the service handle. This is the polite way to do things, although
* the service handle should automatically be closed when it goes out of
* scope.
*/
static VALUE service_close(VALUE self){
SvcStruct* ptr;
int rv;
Data_Get_Struct(self, SvcStruct, ptr);
rv = CloseServiceHandle(ptr->hSCManager);
if(ptr->hSCManager){
if(0 == rv){
rb_raise(cServiceError, ErrorDescription(GetLastError()));
}
}
return self;
}
/*
* call-seq:
* Service#configure_service{ |service| ... }
*
* Configures the service object. Valid methods for the service object are
* as follows:
*
* * desired_access=
* * service_name=
* * display_name=
* * service_type=
* * start_type=
* * error_control=
* * tag_id=
* * binary_path_name=
* * load_order_group=
* * start_name=
* * password=
* * dependencies=
* * service_description=
*
* See the docs for individual instance methods for more details.
*/
static VALUE service_configure(VALUE self){
SvcStruct* ptr;
SC_HANDLE hSCService;
DWORD dwServiceType, dwStartType, dwErrorControl;
TCHAR* lpServiceName;
TCHAR* lpDisplayName;
TCHAR* lpBinaryPathName;
TCHAR* lpLoadOrderGroup;
TCHAR* lpServiceStartName;
TCHAR* lpPassword;
TCHAR* lpDependencies;
int rv;
Data_Get_Struct(self,SvcStruct,ptr);
rb_yield(self); /* block is mandatory */
if(NIL_P(rb_iv_get(self, "@service_name"))){
rb_raise(cServiceError, "No service name specified");
}
else{
VALUE v_tmp = rb_iv_get(self, "@service_name");
lpServiceName = TEXT(StringValuePtr(v_tmp));
}
hSCService = OpenService(
ptr->hSCManager,
lpServiceName,
SERVICE_CHANGE_CONFIG
);
if(!hSCService)
rb_raise(cServiceError, ErrorDescription(GetLastError()));
if(NIL_P(rb_iv_get(self, "@service_type")))
dwServiceType = SERVICE_NO_CHANGE;
else
dwServiceType = NUM2INT(rb_iv_get(self, "@service_type"));
if(NIL_P(rb_iv_get(self, "@start_type")))
dwStartType = SERVICE_NO_CHANGE;
else
dwStartType = NUM2INT(rb_iv_get(self, "@start_type"));
if(NIL_P(rb_iv_get(self, "@error_control")))
dwErrorControl = SERVICE_NO_CHANGE;
else
dwErrorControl = NUM2INT(rb_iv_get(self, "@error_control"));
if(NIL_P(rb_iv_get(self, "@binary_path_name"))){
lpBinaryPathName = NULL;
}
else{
VALUE v_tmp = rb_iv_get(self, "@binary_path_name");
lpBinaryPathName = TEXT(StringValuePtr(v_tmp));
}
if(NIL_P(rb_iv_get(self, "@load_order_group"))){
lpLoadOrderGroup = NULL;
}
else{
VALUE v_tmp = rb_iv_get(self, "@load_order_group");
lpLoadOrderGroup = TEXT(StringValuePtr(v_tmp));
}
/* There are 3 possibilities for dependencies - Some, none, or unchanged:
*
* null => don't change
* empty array => no dependencies (deletes any existing dependencies)
* array => sets dependencies (deletes any existing dependencies)
*/
if(NIL_P(rb_iv_get(self, "@dependencies"))){
lpDependencies = NULL;
}
else{
int i,size=1;
TCHAR* ptr;
VALUE rbDepArray = rb_iv_get(self, "@dependencies");
if(0 == RARRAY(rbDepArray)->len){
lpDependencies = TEXT("");
}
else{
for(i = 0; i< RARRAY(rbDepArray)->len; i++)
{
size += strlen(StringValueCStr(RARRAY(rbDepArray)->ptr[i]))+1;
}
lpDependencies = malloc(size);
memset(lpDependencies, 0x00, size);
ptr = lpDependencies;
for(i = 0; i < RARRAY(rbDepArray)->len; i++){
VALUE v_tmp = rb_ary_entry(rbDepArray,i);
TCHAR* string = TEXT(StringValuePtr(v_tmp));
memcpy(ptr,string,strlen(string));
ptr+=strlen(string)+1;
}
}
}
if(NIL_P(rb_iv_get(self, "@start_name"))){
lpServiceStartName = NULL;
}
else{
VALUE v_tmp = rb_iv_get(self, "@start_name");
lpServiceStartName = TEXT(StringValuePtr(v_tmp));
}
if(NIL_P(rb_iv_get(self, "@password"))){
lpPassword = NULL;
}
else{
VALUE v_tmp = rb_iv_get(self, "@password");
lpPassword = TEXT(StringValuePtr(v_tmp));
}
if(NIL_P(rb_iv_get(self, "@display_name"))){
lpDisplayName = NULL;
}
else{
VALUE v_tmp = rb_iv_get(self, "@display_name");
lpDisplayName = TEXT(StringValuePtr(v_tmp));
}
rv = ChangeServiceConfig(
hSCService,
dwServiceType,
dwStartType,
dwErrorControl,
lpBinaryPathName,
lpLoadOrderGroup,
NULL, // TagID
lpDependencies,
lpServiceStartName,
lpPassword,
lpDisplayName
);
if(lpDependencies)
free(lpDependencies);
if(0 == rv){
strcpy(error,ErrorDescription(GetLastError()));
CloseServiceHandle(hSCService);
rb_raise(cServiceError,error);
}
if(!NIL_P(rb_iv_get(self, "@service_description"))){
SERVICE_DESCRIPTION servDesc;
VALUE v_desc = rb_iv_get(self, "@service_description");
servDesc.lpDescription = TEXT(StringValuePtr(v_desc));
if(!ChangeServiceConfig2(
hSCService,
SERVICE_CONFIG_DESCRIPTION,
&servDesc
)){
rb_raise(cServiceError,ErrorDescription(GetLastError()));
}
}
CloseServiceHandle(hSCService);
return self;
}
/*
* call-seq:
* Service#create_service{ |service| ... }
*
* Creates the specified service. In order for this to work, the
* 'service_name' and 'binary_path_name' attributes must be defined
* or ServiceError will be raised.
* See the Service#configure_service method for a list of valid methods to
* pass to the service object. See the individual methods for more
* information, including default values.
*/
static VALUE service_create(VALUE self){
VALUE v_tmp;
SvcStruct* ptr;
SC_HANDLE hSCService;
DWORD dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl;
TCHAR* lpMachineName;
TCHAR* lpServiceName;
TCHAR* lpDisplayName;
TCHAR* lpBinaryPathName;
TCHAR* lpLoadOrderGroup;
TCHAR* lpServiceStartName;
TCHAR* lpPassword;
TCHAR* lpDependencies;
if(rb_block_given_p())
rb_yield(self);
Data_Get_Struct(self, SvcStruct, ptr);
// The service name and exe name must be set to create a service
if(NIL_P(rb_iv_get(self, "@service_name")))
rb_raise(cServiceError, "Service Name must be defined");
if(NIL_P(rb_iv_get(self, "@binary_path_name")))
rb_raise(cServiceError, "Executable Name must be defined");
// If the display name is not set, set it to the same as the service name
if(NIL_P(rb_iv_get(self, "@display_name")))
rb_iv_set(self,"@display_name", rb_iv_get(self,"@service_name"));
v_tmp = rb_iv_get(self, "@service_name");
lpServiceName = TEXT(StringValuePtr(v_tmp));
v_tmp = rb_iv_get(self, "@display_name");
lpDisplayName = TEXT(StringValuePtr(v_tmp));
v_tmp = rb_iv_get(self, "@binary_path_name");
lpBinaryPathName = TEXT(StringValuePtr(v_tmp));
if(NIL_P(rb_iv_get(self, "@machine_name"))){
lpMachineName = NULL;
}
else{
v_tmp = rb_iv_get(self, "@machine_name");
lpMachineName = TEXT(StringValuePtr(v_tmp));
}
if(NIL_P(rb_iv_get(self, "@load_order_group"))){
lpLoadOrderGroup = NULL;
}
else{
v_tmp = rb_iv_get(self, "@load_order_group");
lpLoadOrderGroup = TEXT(StringValuePtr(v_tmp));
}
if(NIL_P(rb_iv_get(self, "@start_name"))){
lpServiceStartName = NULL;
}
else{
v_tmp = rb_iv_get(self,"@start_name");
lpServiceStartName =
TEXT(StringValuePtr(v_tmp));
}
if(NIL_P(rb_iv_get(self, "@password"))){
lpPassword = NULL;
}
else{
v_tmp = rb_iv_get(self,"@password");
lpPassword = TEXT(StringValuePtr(v_tmp));
}
// There are 3 possibilities for dependencies - Some, none, or unchanged
// null = don't change
// empty array = no dependencies (deletes any existing dependencies)
// array = sets dependencies (deletes any existing dependencies)
if(NIL_P(rb_iv_get(self, "@dependencies"))){
lpDependencies = NULL;
}
else{
int i,size=1;
TCHAR* ptr;
VALUE rbDepArray = rb_iv_get(self, "@dependencies");
if(0 == RARRAY(rbDepArray)->len){
lpDependencies = TEXT("");
}
else{
for(i = 0; i< RARRAY(rbDepArray)->len; i++)
{
size += strlen(StringValueCStr(RARRAY(rbDepArray)->ptr[i]))+1;
}
lpDependencies = malloc(size);
memset(lpDependencies,0x00,size);
ptr = lpDependencies;
for(i = 0; i < RARRAY(rbDepArray)->len; i++){
VALUE v_tmp = rb_ary_entry(rbDepArray,i);
TCHAR* string = TEXT(StringValuePtr(v_tmp));
memcpy(ptr,string,strlen(string));
ptr+=strlen(string)+1;
}
}
}
if(NIL_P(rb_iv_get(self, "@desired_access"))){
dwDesiredAccess = SERVICE_ALL_ACCESS;
}
else{
dwDesiredAccess = NUM2INT(rb_iv_get(self, "@desired_access"));
}
if(NIL_P(rb_iv_get(self,"@service_type"))){
dwServiceType = SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS;
}
else{
dwServiceType = NUM2INT(rb_iv_get(self, "@service_type"));
}
if(NIL_P(rb_iv_get(self,"@start_type"))){
dwStartType = SERVICE_DEMAND_START;
}
else{
dwStartType = NUM2INT(rb_iv_get(self, "@start_type"));
}
if(NIL_P(rb_iv_get(self, "@error_control"))){
dwErrorControl = SERVICE_ERROR_NORMAL;
}
else{
dwErrorControl = NUM2INT(rb_iv_get(self, "@error_control"));
}
// Add support for tag id and dependencies
hSCService = CreateService(
ptr->hSCManager,
lpServiceName,
lpDisplayName,
dwDesiredAccess,
dwServiceType,
dwStartType,
dwErrorControl,
lpBinaryPathName,
lpLoadOrderGroup,
NULL, // Tag ID
lpDependencies,
lpServiceStartName,
lpPassword
);
if(lpDependencies)
free(lpDependencies);
if(!hSCService)
rb_raise(cServiceError, ErrorDescription(GetLastError()));
// Set the description after the fact if specified, since we can't set it
// in CreateService().
if(!NIL_P(rb_iv_get(self, "@service_description"))){
SERVICE_DESCRIPTION servDesc;
VALUE v_desc = rb_iv_get(self, "@service_description");
servDesc.lpDescription = TEXT(StringValuePtr(v_desc));
if(!ChangeServiceConfig2(
hSCService,
SERVICE_CONFIG_DESCRIPTION,
&servDesc
)){
rb_raise(cServiceError,ErrorDescription(GetLastError()));
}
}
CloseServiceHandle(hSCService);
return self;
}
// CLASS METHODS
/*
* call-seq:
* Service.delete(name, host=localhost)
*
* Deletes the service +name+ from +host+, or the localhost if none is
* provided.
*/
static VALUE service_delete(int argc, VALUE *argv, VALUE klass)
{
SC_HANDLE hSCManager, hSCService;
TCHAR* lpMachineName;
TCHAR* lpServiceName;
VALUE v_service_name, v_machine_name;
rb_scan_args(argc, argv, "11", &v_service_name, &v_machine_name);
SafeStringValue(v_service_name);
lpServiceName = TEXT(StringValuePtr(v_service_name));
if(NIL_P(v_machine_name)){
lpMachineName = NULL;
}
else{
SafeStringValue(v_machine_name);
lpMachineName = TEXT(StringValuePtr(v_machine_name));
}
hSCManager = OpenSCManager(
lpMachineName,
NULL,
SC_MANAGER_CREATE_SERVICE
);
if(!hSCManager)
rb_raise(cServiceError,ErrorDescription(GetLastError()));
hSCService = OpenService(
hSCManager,
lpServiceName,
DELETE
);
if(!hSCService){
strcpy(error,ErrorDescription(GetLastError()));
CloseServiceHandle(hSCManager);
rb_raise(cServiceError,error);
}
if(!DeleteService(hSCService)){
strcpy(error,ErrorDescription(GetLastError()));
CloseServiceHandle(hSCService);
CloseServiceHandle(hSCManager);
rb_raise(cServiceError,error);
}
CloseServiceHandle(hSCService);
CloseServiceHandle(hSCManager);
return klass;
}
/*
* call-seq:
* Service.services(host=nil, group=nil){ |struct| ... }
*
* Enumerates over a list of service types on host, or the local
* machine if no host is specified, yielding a Win32Service struct for each
* service.
*
* If a 'group' is specified, then only those services that belong to
* that group are enumerated. If an empty string is provided, then only
* services that do not belong to any group are enumerated. If this parameter
* is nil, group membership is ignored and all services are enumerated.
*
* The 'group' option is only available on Windows 2000 or later, and only
* if compiled with VC++ 7.0 or later, or the .NET SDK.
*
* The Win32 service struct contains the following members.
*
* * service_name
* * display_name
* * service_type
* * current_state
* * controls_accepted
* * win32_exit_code
* * service_specific_exit_code
* * check_point
* * wait_hint
* * binary_path_name
* * start_type
* * error_control
* * load_order_group
* * tag_id
* * start_name
* * dependencies
* * description
* * interactive
* * pid (Win2k or later)
* * service_flags (Win2k or later)
*/
static VALUE service_services(int argc, VALUE *argv, VALUE klass)
{
SC_HANDLE hSCManager = NULL;
SC_HANDLE hSCService = NULL;
DWORD dwBytesNeeded = 0;
DWORD dwServicesReturned = 0;
DWORD dwResumeHandle = 0;
LPQUERY_SERVICE_CONFIG lpqscConf;
LPSERVICE_DESCRIPTION lpqscDesc;
TCHAR* lpMachineName;
VALUE v_machine_name = Qnil;
VALUE v_dependencies = Qnil;
VALUE v_struct;
VALUE v_array = Qnil;
int rv = 0;
#ifdef HAVE_ENUMSERVICESSTATUSEX
TCHAR* pszGroupName;
VALUE v_group = Qnil;
ENUM_SERVICE_STATUS_PROCESS svcArray[MAX_SERVICES];
rb_scan_args(argc, argv, "02", &v_machine_name, &v_group);
#else
ENUM_SERVICE_STATUS svcArray[MAX_SERVICES];
rb_scan_args(argc, argv, "01", &v_machine_name);
#endif
// If no block is provided, return an array of struct's.
if(!rb_block_given_p())
v_array = rb_ary_new();
if(NIL_P(v_machine_name)){
lpMachineName = NULL;
}
else{
SafeStringValue(v_machine_name);
lpMachineName = TEXT(StringValuePtr(v_machine_name));
}
#ifdef HAVE_ENUMSERVICESSTATUSEX
if(NIL_P(v_group)){
pszGroupName = NULL;
}
else{
SafeStringValue(v_group);
pszGroupName = TEXT(StringValuePtr(v_group));
}
#endif
hSCManager = OpenSCManager(
lpMachineName,
NULL,
SC_MANAGER_ENUMERATE_SERVICE
);
if(NULL == hSCManager){
sprintf(error, "OpenSCManager() call failed: %s",
ErrorDescription(GetLastError()));
rb_raise(cServiceError,error);
}
lpqscConf = (LPQUERY_SERVICE_CONFIG) LocalAlloc(LPTR, MAX_BUF_SIZE);
lpqscDesc = (LPSERVICE_DESCRIPTION) LocalAlloc(LPTR, MAX_BUF_SIZE);
#ifdef HAVE_ENUMSERVICESSTATUSEX
rv = EnumServicesStatusEx(
hSCManager, // SC Manager
SC_ENUM_PROCESS_INFO, // Info level (only possible value)
SERVICE_WIN32 | SERVICE_DRIVER, // Service type
SERVICE_STATE_ALL, // Service state
(LPBYTE)svcArray, // Array of structs
sizeof(svcArray),
&dwBytesNeeded,
&dwServicesReturned,
&dwResumeHandle,
pszGroupName
);
#else
rv = EnumServicesStatus(
hSCManager, // SC Manager
SERVICE_WIN32 | SERVICE_DRIVER, // Service type
SERVICE_STATE_ALL, // Service state
svcArray, // Array of structs
sizeof(svcArray),
&dwBytesNeeded,
&dwServicesReturned,
&dwResumeHandle
);
#endif
if(rv != 0)
{
unsigned i;
int rv;
VALUE v_service_type, v_current_state, v_controls_accepted;
VALUE v_binary_path_name, v_error_control, v_load_order_group;
VALUE v_start_type, v_service_start_name, v_description, v_interactive;
for(i = 0; i < dwServicesReturned; i++){
DWORD dwBytesNeeded;
v_controls_accepted = rb_ary_new();
v_interactive = Qfalse;
hSCService = OpenService(
hSCManager,
svcArray[i].lpServiceName,
SERVICE_QUERY_CONFIG
);
if(!hSCService){
sprintf(error, "OpenService() call failed: %s",
ErrorDescription(GetLastError()));
CloseServiceHandle(hSCManager);
rb_raise(cServiceError, error);
}
// Retrieve a QUERY_SERVICE_CONFIG structure for the Service, from
// which we can gather the service type, start type, etc.
rv = QueryServiceConfig(
hSCService,
lpqscConf,
MAX_BUF_SIZE,
&dwBytesNeeded
);
if(0 == rv){
sprintf(error, "QueryServiceConfig() call failed: %s",
ErrorDescription(GetLastError()));
CloseServiceHandle(hSCManager);
rb_raise(cServiceError, error);
}
// Get the description for the Service
rv = QueryServiceConfig2(
hSCService,
SERVICE_CONFIG_DESCRIPTION,
(LPBYTE)lpqscDesc,
MAX_BUF_SIZE,
&dwBytesNeeded
);
if(0 == rv){
sprintf(error,"QueryServiceConfig2() call failed: %s",
ErrorDescription(GetLastError()));
CloseServiceHandle(hSCManager);
rb_raise(cServiceError, error);
}
#ifdef HAVE_ENUMSERVICESSTATUSEX
if(svcArray[i].ServiceStatusProcess.dwServiceType
& SERVICE_INTERACTIVE_PROCESS){
v_interactive = Qtrue;
}
#else
if(svcArray[i].ServiceStatus.dwServiceType
& SERVICE_INTERACTIVE_PROCESS){
v_interactive = Qtrue;
}
#endif
#ifdef HAVE_ENUMSERVICESSTATUSEX
v_service_type =
rb_get_service_type(svcArray[i].ServiceStatusProcess.dwServiceType);
v_current_state =
rb_get_current_state(
svcArray[i].ServiceStatusProcess.dwCurrentState);
v_controls_accepted =
rb_get_controls_accepted(
svcArray[i].ServiceStatusProcess.dwControlsAccepted);
#else
v_service_type =
rb_get_service_type(svcArray[i].ServiceStatus.dwServiceType);
v_current_state =
rb_get_current_state(svcArray[i].ServiceStatus.dwCurrentState);
v_controls_accepted =
rb_get_controls_accepted(
svcArray[i].ServiceStatus.dwControlsAccepted);
#endif
if(_tcslen(lpqscConf->lpBinaryPathName) > 0)
v_binary_path_name = rb_str_new2(lpqscConf->lpBinaryPathName);
else
v_binary_path_name = Qnil;
if(_tcslen(lpqscConf->lpLoadOrderGroup) > 0)
v_load_order_group = rb_str_new2(lpqscConf->lpLoadOrderGroup);
else
v_load_order_group = Qnil;
if(_tcslen(lpqscConf->lpServiceStartName) > 0)
v_service_start_name = rb_str_new2(lpqscConf->lpServiceStartName);
else
v_service_start_name = Qnil;
if(lpqscDesc->lpDescription != NULL)
v_description = rb_str_new2(lpqscDesc->lpDescription);
else
v_description = Qnil;
v_start_type = rb_get_start_type(lpqscConf->dwStartType);
v_error_control = rb_get_error_control(lpqscConf->dwErrorControl);
v_dependencies = rb_get_dependencies(lpqscConf->lpDependencies);
CloseServiceHandle(hSCService);
#ifdef HAVE_ENUMSERVICESSTATUSEX
v_struct = rb_struct_new(v_service_struct,
rb_str_new2(svcArray[i].lpServiceName),
rb_str_new2(svcArray[i].lpDisplayName),
v_service_type,
v_current_state,
v_controls_accepted,
INT2FIX(svcArray[i].ServiceStatusProcess.dwWin32ExitCode),
INT2FIX(svcArray[i].ServiceStatusProcess.dwServiceSpecificExitCode),
INT2FIX(svcArray[i].ServiceStatusProcess.dwCheckPoint),
INT2FIX(svcArray[i].ServiceStatusProcess.dwWaitHint),
v_binary_path_name,
v_start_type,
v_error_control,
v_load_order_group,
INT2FIX(lpqscConf->dwTagId),
v_service_start_name,
v_dependencies,
v_description,
v_interactive,
INT2FIX(svcArray[i].ServiceStatusProcess.dwProcessId),
INT2FIX(svcArray[i].ServiceStatusProcess.dwServiceFlags)
);
#else
v_struct = rb_struct_new(v_service_struct,
rb_str_new2(svcArray[i].lpServiceName),
rb_str_new2(svcArray[i].lpDisplayName),
v_service_type,
v_current_state,
v_controls_accepted,
INT2FIX(svcArray[i].ServiceStatus.dwWin32ExitCode),
INT2FIX(svcArray[i].ServiceStatus.dwServiceSpecificExitCode),
INT2FIX(svcArray[i].ServiceStatus.dwCheckPoint),
INT2FIX(svcArray[i].ServiceStatus.dwWaitHint),
v_binary_path_name,
v_start_type,
v_error_control,
v_load_order_group,
INT2FIX(lpqscConf->dwTagId),
v_service_start_name,
v_dependencies,
v_description,
v_interactive
);
#endif
if(rb_block_given_p()){
rb_yield(v_struct);
}
else{
rb_ary_push(v_array, v_struct);
}
}
}
else{
sprintf(error,"EnumServiceStatus() call failed: %s",
ErrorDescription(GetLastError()));
LocalFree(lpqscConf);
LocalFree(lpqscDesc);
CloseServiceHandle(hSCManager);
rb_raise(cServiceError,error);
}
LocalFree(lpqscConf);
LocalFree(lpqscDesc);
CloseServiceHandle(hSCManager);
return v_array; // Nil if a block was given
}
/*
* call-seq:
* Service.stop(name, host=localhost)
*
* Stop a service. Attempting to stop an already stopped service raises
* a ServiceError.
*/
static VALUE service_stop(int argc, VALUE *argv, VALUE klass)
{
SC_HANDLE hSCManager, hSCService;
TCHAR* lpMachineName;
TCHAR* lpServiceName;
SERVICE_STATUS serviceStatus;
VALUE v_service_name, v_machine_name;
int rv;
rb_scan_args(argc, argv, "11", &v_service_name, &v_machine_name);
SafeStringValue(v_service_name);
lpServiceName = TEXT(StringValuePtr(v_service_name));
if(NIL_P(v_machine_name)){
lpMachineName = NULL;
}
else{
SafeStringValue(v_machine_name);
lpMachineName = TEXT(StringValuePtr(v_machine_name));
}
hSCManager = OpenSCManager(
lpMachineName,
NULL,
SC_MANAGER_CONNECT
);
if(!hSCManager)
rb_raise(cServiceError,ErrorDescription(GetLastError()));
hSCService = OpenService(
hSCManager,
lpServiceName,
SERVICE_STOP
);
if(!hSCService){
strcpy(error,ErrorDescription(GetLastError()));
CloseServiceHandle(hSCManager);
rb_raise(cServiceError,error);
}
rv = ControlService(
hSCService,
SERVICE_CONTROL_STOP,
&serviceStatus
);
if(0 == rv){
strcpy(error,ErrorDescription(GetLastError()));
CloseServiceHandle(hSCService);
CloseServiceHandle(hSCManager);
rb_raise(cServiceError,error);
}
CloseServiceHandle(hSCService);
CloseServiceHandle(hSCManager);
return klass;
}
/*
* call-seq:
* Service.pause(name, host=localhost)
*
* Pause a service. Attempting to pause an already paused service will raise
* a ServiceError.
*
* Note that not all services are configured to accept a pause (or resume)
* command.
*/
static VALUE service_pause(int argc, VALUE *argv, VALUE klass)
{
SC_HANDLE hSCManager, hSCService;
TCHAR* lpMachineName;
TCHAR* lpServiceName;
SERVICE_STATUS serviceStatus;
VALUE v_service_name, v_machine_name;
int rv;
rb_scan_args(argc, argv, "11", &v_service_name, &v_machine_name);
SafeStringValue(v_service_name);
lpServiceName = TEXT(StringValuePtr(v_service_name));
if(NIL_P(v_machine_name)){
lpMachineName = NULL;
}
else{
SafeStringValue(v_machine_name);
lpMachineName = TEXT(StringValuePtr(v_machine_name));
}
hSCManager = OpenSCManager(
lpMachineName,
NULL,
SC_MANAGER_CONNECT
);
if(!hSCManager)
rb_raise(cServiceError,ErrorDescription(GetLastError()));
hSCService = OpenService(
hSCManager,
lpServiceName,
SERVICE_PAUSE_CONTINUE
);
if(!hSCService){
strcpy(error,ErrorDescription(GetLastError()));
CloseServiceHandle(hSCManager);
rb_raise(cServiceError,error);
}
rv = ControlService(
hSCService,
SERVICE_CONTROL_PAUSE,
&serviceStatus
);
if(0 == rv){
strcpy(error,ErrorDescription(GetLastError()));
CloseServiceHandle(hSCService);
CloseServiceHandle(hSCManager);
rb_raise(cServiceError,error);
}
CloseServiceHandle(hSCService);
CloseServiceHandle(hSCManager);
return klass;
}
/*
* call-seq:
* Service.resume(name, host=localhost)
*
* Resume a service. Attempting to resume a service that isn't paused will
* raise a ServiceError.
*
* Note that not all services are configured to accept a resume (or pause)
* command. In that case, a ServiceError will be raised.
*/
static VALUE service_resume(int argc, VALUE *argv, VALUE klass)
{
SC_HANDLE hSCManager, hSCService;
TCHAR* lpMachineName;
TCHAR* lpServiceName;
SERVICE_STATUS serviceStatus;
VALUE v_service_name, v_machine_name;
int rv;
rb_scan_args(argc, argv, "11", &v_service_name, &v_machine_name);
SafeStringValue(v_service_name);
lpServiceName = TEXT(StringValuePtr(v_service_name));
if(NIL_P(v_machine_name)){
lpMachineName = NULL;
}
else{
SafeStringValue(v_machine_name);
lpMachineName = TEXT(StringValuePtr(v_machine_name));
}
hSCManager = OpenSCManager(
lpMachineName,
NULL,
SC_MANAGER_CONNECT
);
if(!hSCManager){
rb_raise(cServiceError,ErrorDescription(GetLastError()));
}
hSCService = OpenService(
hSCManager,
lpServiceName,
SERVICE_PAUSE_CONTINUE
);
if(!hSCService){
strcpy(error,ErrorDescription(GetLastError()));
CloseServiceHandle(hSCManager);
rb_raise(cServiceError,error);
}
rv = ControlService(
hSCService,
SERVICE_CONTROL_CONTINUE,
&serviceStatus
);
if(0 == rv){
strcpy(error,ErrorDescription(GetLastError()));
CloseServiceHandle(hSCService);
CloseServiceHandle(hSCManager);
rb_raise(cServiceError,error);
}
CloseServiceHandle(hSCService);
CloseServiceHandle(hSCManager);
return klass;
}
/*
* call-seq:
* Service.start(name, host=localhost, args=nil)
*
* Attempts to start service +name+ on +host+, or the local machine if no
* host is provided. If +args+ are provided, they are passed to the service's
* Service_Main() function.
*
*-- Note that the WMI interface does not allow you to pass arguments to the
*-- Service_Main function.
*/
static VALUE service_start(int argc, VALUE *argv, VALUE klass){
SC_HANDLE hSCManager, hSCService;
TCHAR* lpMachineName;
TCHAR* lpServiceName;
TCHAR** lpServiceArgVectors;
VALUE v_service_name, v_machine_name, rbArgs;
int rv;
rb_scan_args(argc, argv, "11*", &v_service_name, &v_machine_name, &rbArgs);
SafeStringValue(v_service_name);
lpServiceName = TEXT(StringValuePtr(v_service_name));
if(NIL_P(v_machine_name)){
lpMachineName = NULL;
}
else{
SafeStringValue(v_machine_name);
lpMachineName = TEXT(StringValuePtr(v_machine_name));
}
if( (NIL_P(rbArgs)) || (RARRAY(rbArgs)->len == 0) ){
lpServiceArgVectors = NULL;
}
else{
int i;
lpServiceArgVectors =
malloc(RARRAY(rbArgs)->len * sizeof(*lpServiceArgVectors));
for(i = 0; i < RARRAY(rbArgs)->len; i++){
VALUE v_tmp = rb_ary_entry(rbArgs, i);
TCHAR* string = TEXT(StringValuePtr(v_tmp));
lpServiceArgVectors[i] = malloc(*string);
lpServiceArgVectors[i] = string;
}
}
hSCManager = OpenSCManager(
lpMachineName,
NULL,
SC_MANAGER_CONNECT
);
if(!hSCManager)
rb_raise(cServiceError,ErrorDescription(GetLastError()));
hSCService = OpenService(
hSCManager,
lpServiceName,
SERVICE_START
);
if(!hSCService){
strcpy(error,ErrorDescription(GetLastError()));
CloseServiceHandle(hSCManager);
rb_raise(cServiceError,error);
}
rv = StartService(
hSCService,
0,
lpServiceArgVectors
);
if(0 == rv){
strcpy(error,ErrorDescription(GetLastError()));
CloseServiceHandle(hSCManager);
CloseServiceHandle(hSCService);
if(lpServiceArgVectors){
free(lpServiceArgVectors);
}
rb_raise(cServiceError,error);
}
CloseServiceHandle(hSCManager);
CloseServiceHandle(hSCService);
if(lpServiceArgVectors)
free(lpServiceArgVectors);
return klass;
}
/*
* call-seq:
* Service.getservicename(display_name, host=localhost)
*
* Returns the service name for the corresponding +display_name+ on +host+, or
* the local machine if no host is specified.
*/
static VALUE service_get_service_name(int argc, VALUE *argv, VALUE klass)
{
SC_HANDLE hSCManager;
TCHAR* lpMachineName;
TCHAR* lpDisplayName;
TCHAR szRegKey[MAX_PATH];
DWORD dwKeySize = sizeof(szRegKey);
VALUE v_machine_name, rbDisplayName;
int rv;
rb_scan_args(argc, argv, "11", &rbDisplayName, &v_machine_name);
SafeStringValue(rbDisplayName);
lpDisplayName = TEXT(StringValuePtr(rbDisplayName));
if(NIL_P(v_machine_name)){
lpMachineName = NULL;
}
else{
SafeStringValue(v_machine_name);
lpMachineName = TEXT(StringValuePtr(v_machine_name));
}
hSCManager = OpenSCManager(
lpMachineName,
NULL,
SC_MANAGER_CONNECT
);
if(!hSCManager)
rb_raise(rb_eArgError,ErrorDescription(GetLastError()));
rv = GetServiceKeyName(
hSCManager,
lpDisplayName,
szRegKey,
&dwKeySize
);
if(0 == rv){
strcpy(error,ErrorDescription(GetLastError()));
CloseServiceHandle(hSCManager);
rb_raise(rb_eArgError,error);
}
CloseServiceHandle(hSCManager);
return rb_str_new2(szRegKey);
}
/*
* call-seq:
* Service.getdisplayname(service_name, host=localhost)
*
* Returns the display name for the service +service_name+ on +host+, or the
* localhost if no host is specified.
*/
static VALUE service_get_display_name(int argc, VALUE *argv, VALUE klass)
{
SC_HANDLE hSCManager;
TCHAR* lpMachineName;
TCHAR* lpServiceName;
TCHAR szRegKey[MAX_PATH];
DWORD dwKeySize = sizeof(szRegKey);
VALUE v_machine_name, v_service_name;
int rv;
rb_scan_args(argc, argv, "11", &v_service_name, &v_machine_name);
SafeStringValue(v_service_name);
lpServiceName = TEXT(StringValuePtr(v_service_name));
if(NIL_P(v_machine_name)){
lpMachineName = NULL;
}
else{
SafeStringValue(v_machine_name);
lpMachineName = TEXT(StringValuePtr(v_machine_name));
}
hSCManager = OpenSCManager(
lpMachineName,
NULL,
SC_MANAGER_CONNECT
);
if(!hSCManager)
rb_raise(rb_eArgError,ErrorDescription(GetLastError()));
rv = GetServiceDisplayName(
hSCManager,
lpServiceName,
szRegKey,
&dwKeySize
);
if(0 == rv){
strcpy(error,ErrorDescription(GetLastError()));
CloseServiceHandle(hSCManager);
rb_raise(rb_eArgError,error);
}
CloseServiceHandle(hSCManager);
return rb_str_new2(szRegKey);
}
/*
* Sets the dependencies for the given service. Use this when you call
* Service.create_service, if desired.
*/
static VALUE service_set_dependencies(VALUE self, VALUE array)
{
Check_Type(array, T_ARRAY);
rb_iv_set(self, "@dependencies", array);
return self;
}
/*
* Returns an array of dependencies for the given service, or nil if there
* aren't any dependencies.
*/
static VALUE service_get_dependencies(VALUE self){
return rb_iv_get(self, "@dependencies");
}
/*
* call-seq:
* Service.status(name, host=localhost)
*
* Returns a ServiceStatus struct indicating the status of service +name+ on
* +host+, or the localhost if none is provided.
*
* The ServiceStatus struct contains the following members:
*
* * service_type
* * current_state
* * controls_accepted
* * win32_exit_code
* * service_specific_exit_code
* * check_point
* * wait_hint
* * pid (Win2k or later)
* * service_flags (Win2k or later)
*/
static VALUE service_status(int argc, VALUE *argv, VALUE klass){
SC_HANDLE hSCManager, hSCService;
VALUE v_service_name, v_machine_name;
VALUE v_service_type, v_current_state, v_controls_accepted;
VALUE v_interactive = Qfalse;
TCHAR* lpMachineName;
TCHAR* lpServiceName;
DWORD dwBytesNeeded;
int rv;
#ifdef HAVE_QUERYSERVICESTATUSEX
SERVICE_STATUS_PROCESS ssProcess;
#else
SERVICE_STATUS ssProcess;
#endif
rb_scan_args(argc, argv, "11", &v_service_name, &v_machine_name);
SafeStringValue(v_service_name);
lpServiceName = TEXT(StringValuePtr(v_service_name));
if(NIL_P(v_machine_name)){
lpMachineName = NULL;
}
else{
SafeStringValue(v_machine_name);
lpMachineName = TEXT(StringValuePtr(v_machine_name));
}
hSCManager = OpenSCManager(
lpMachineName,
NULL,
SC_MANAGER_ENUMERATE_SERVICE
);
if(!hSCManager)
rb_raise(cServiceError,ErrorDescription(GetLastError()));
hSCService = OpenService(
hSCManager,
lpServiceName,
SERVICE_QUERY_STATUS
);
if(!hSCService){
strcpy(error,ErrorDescription(GetLastError()));
CloseServiceHandle(hSCManager);
rb_raise(cServiceError,error);
}
#ifdef HAVE_QUERYSERVICESTATUSEX
rv = QueryServiceStatusEx(
hSCService,
SC_STATUS_PROCESS_INFO,
(LPBYTE)&ssProcess,
sizeof(SERVICE_STATUS_PROCESS),
&dwBytesNeeded
);
#else
rv = QueryServiceStatus(
hSCService,
&ssProcess
);
#endif
v_service_type = rb_get_service_type(ssProcess.dwServiceType);
v_current_state = rb_get_current_state(ssProcess.dwCurrentState);
v_controls_accepted = rb_get_controls_accepted(ssProcess.dwControlsAccepted);
if(ssProcess.dwServiceType & SERVICE_INTERACTIVE_PROCESS){
v_interactive = Qtrue;
}
CloseServiceHandle(hSCService);
CloseServiceHandle(hSCManager);
return rb_struct_new(v_service_status_struct,
v_service_type,
v_current_state,
v_controls_accepted,
INT2FIX(ssProcess.dwWin32ExitCode),
INT2FIX(ssProcess.dwServiceSpecificExitCode),
INT2FIX(ssProcess.dwCheckPoint),
INT2FIX(ssProcess.dwWaitHint),
v_interactive
#ifdef HAVE_QUERYSERVICESTATUSEX
,INT2FIX(ssProcess.dwProcessId)
,INT2FIX(ssProcess.dwServiceFlags)
#endif
);
}
/* call-seq:
* Service.exists?(name, host=localhost)
*
* Returns whether or not the service +name+ exists on +host+, or the localhost
* if none is provided.
*/
static VALUE service_exists(int argc, VALUE *argv, VALUE klass){
SC_HANDLE hSCManager, hSCService;
TCHAR* lpMachineName;
TCHAR* lpServiceName;
VALUE v_service_name, v_machine_name;
VALUE rbExists = Qtrue;
rb_scan_args(argc, argv, "11", &v_service_name, &v_machine_name);
SafeStringValue(v_service_name);
lpServiceName = TEXT(StringValuePtr(v_service_name));
if(NIL_P(v_machine_name)){
lpMachineName = NULL;
}
else{
SafeStringValue(v_machine_name);
lpMachineName = TEXT(StringValuePtr(v_machine_name));
}
hSCManager = OpenSCManager(
lpMachineName,
NULL,
SC_MANAGER_ENUMERATE_SERVICE
);
if(!hSCManager)
rb_raise(cServiceError,ErrorDescription(GetLastError()));
hSCService = OpenService(
hSCManager,
lpServiceName,
SERVICE_QUERY_STATUS
);
if(!hSCService)
rbExists = Qfalse;
CloseServiceHandle(hSCService);
CloseServiceHandle(hSCManager);
return rbExists;
}
/*
* call-seq:
* Service.open(service_name, host=nil, desired_access=nil)
* Service.open(service_name, host=nil, desired_access=nil){ |svc| ... }
*
* Opens and returns a new Service object based on +service_name+ from +host+
* or the local machine if no host is specified. If a block is provided, the
* object is automatically closed at the end of the block.
*
* Note that the default desired access for the returned object is
* Service::SERVICE_QUERY_CONFIG. You will probably need to change that in
* order to configure or delete an existing service using the returned object.
*/
static VALUE service_open(int argc, VALUE* argv, VALUE klass){
VALUE self, v_service_name, v_host, v_desired_access;
SvcStruct* ptr;
SC_HANDLE hSCService;
TCHAR* lpMachineName;
LPQUERY_SERVICE_CONFIG lpConf;
LPSERVICE_DESCRIPTION lpDesc;
DWORD dwDesiredAccess = SERVICE_QUERY_CONFIG;
DWORD dwBytesNeeded, rv;
rb_scan_args(argc, argv, "12", &v_service_name, &v_host, &v_desired_access);
self = Data_Make_Struct(klass, SvcStruct, 0, service_free, ptr);
/* Set the host name, or use the localhost if no host is specified */
if(NIL_P(v_host)){
TCHAR name[MAX_PATH];
lpMachineName = NULL;
if(gethostname(name, MAX_PATH))
rb_raise(cServiceError, "gethostname() failed");
v_host = rb_str_new2(name);
}
else{
lpMachineName = TEXT(StringValuePtr(v_host));
}
/* Set the desired access level. Default to SERVICE_QUERY_CONFIG */
if(NIL_P(v_desired_access))
v_desired_access = INT2FIX(SERVICE_QUERY_CONFIG);
else
dwDesiredAccess = NUM2INT(v_desired_access);
ptr->hSCManager = OpenSCManager(
lpMachineName,
NULL,
dwDesiredAccess
);
if(!ptr->hSCManager)
rb_raise(cServiceError, ErrorDescription(GetLastError()));
lpConf = (LPQUERY_SERVICE_CONFIG) LocalAlloc(LPTR, MAX_BUF_SIZE);
lpDesc = (LPSERVICE_DESCRIPTION) LocalAlloc(LPTR, MAX_BUF_SIZE);
hSCService = OpenService(
ptr->hSCManager,
TEXT(StringValuePtr(v_service_name)),
SERVICE_QUERY_CONFIG
);
if(!hSCService)
rb_raise(cServiceError, ErrorDescription(GetLastError()));
rv = QueryServiceConfig(
hSCService,
lpConf,
MAX_BUF_SIZE,
&dwBytesNeeded
);
if(0 == rv){
sprintf(error, "QueryServiceConfig() call failed: %s",
ErrorDescription(GetLastError()));
CloseServiceHandle(ptr->hSCManager);
rb_raise(cServiceError, error);
}
rv = QueryServiceConfig2(
hSCService,
SERVICE_CONFIG_DESCRIPTION,
(LPBYTE)lpDesc,
MAX_BUF_SIZE,
&dwBytesNeeded
);
if(0 == rv){
sprintf(error, "QueryServiceConfig2() call failed: %s",
ErrorDescription(GetLastError()));
CloseServiceHandle(ptr->hSCManager);
rb_raise(cServiceError,error);
}
CloseServiceHandle(hSCService);
/* Designer's note: the original plan to convert integer constants was
* abandoned because methods like Service#configure expect a number.
*/
rb_iv_set(self, "@machine_name", v_host);
rb_iv_set(self, "@desired_access", v_desired_access);
rb_iv_set(self, "@service_name", v_service_name);
rb_iv_set(self, "@display_name", rb_str_new2(lpConf->lpDisplayName));
rb_iv_set(self, "@service_type", INT2FIX(lpConf->dwServiceType));
rb_iv_set(self, "@start_type", INT2FIX(lpConf->dwStartType));
rb_iv_set(self, "@binary_path_name", rb_str_new2(lpConf->lpBinaryPathName));
rb_iv_set(self, "@tag_id", INT2FIX(lpConf->dwTagId));
rb_iv_set(self, "@start_name", rb_str_new2(lpConf->lpServiceStartName));
rb_iv_set(self, "@service_description", rb_str_new2(lpDesc->lpDescription));
rb_iv_set(self, "@error_control", INT2FIX(lpConf->dwErrorControl));
if(lpConf->lpLoadOrderGroup){
rb_iv_set(self, "@load_order_group",
rb_str_new2(lpConf->lpLoadOrderGroup));
}
rb_iv_set(self, "@dependencies",
rb_get_dependencies(lpConf->lpDependencies));
if(rb_block_given_p()){
rb_ensure(rb_yield, self, service_close, self);
return Qnil;
}
else{
return self;
}
}
void Init_service()
{
VALUE mWin32, cService, cDaemon;
int i = 0;
// Modules and classes
mWin32 = rb_define_module("Win32");
cService = rb_define_class_under(mWin32, "Service", rb_cObject);
cDaemon = rb_define_class_under(mWin32, "Daemon", rb_cObject);
cServiceError = rb_define_class_under(
mWin32, "ServiceError", rb_eStandardError);
cDaemonError = rb_define_class_under(
mWin32, "DaemonError", rb_eStandardError);
// Service class and instance methods
rb_define_alloc_func(cService,service_allocate);
rb_define_method(cService, "initialize", service_init, -1);
rb_define_method(cService, "close", service_close, 0);
rb_define_method(cService, "create_service", service_create, 0);
rb_define_method(cService, "configure_service", service_configure, 0);
// We do type checking for these two methods, so they're defined
// indepedently.
rb_define_method(cService, "dependencies=", service_set_dependencies, 1);
rb_define_method(cService, "dependencies", service_get_dependencies, 0);
rb_define_singleton_method(cService, "open", service_open, -1);
rb_define_singleton_method(cService, "delete", service_delete, -1);
rb_define_singleton_method(cService, "start", service_start, -1);
rb_define_singleton_method(cService, "stop", service_stop, -1);
rb_define_singleton_method(cService, "pause", service_pause, -1);
rb_define_singleton_method(cService, "resume", service_resume, -1);
rb_define_singleton_method(cService, "services", service_services, -1);
rb_define_singleton_method(cService, "status", service_status, -1);
rb_define_singleton_method(cService, "exists?", service_exists, -1);
rb_define_singleton_method(cService, "getdisplayname",
service_get_display_name, -1);
rb_define_singleton_method(cService, "getservicename",
service_get_service_name, -1);
// Daemon class and instance methods
rb_define_alloc_func(cDaemon, daemon_allocate);
rb_define_method(cDaemon, "mainloop", daemon_mainloop, 0);
rb_define_method(cDaemon, "state", daemon_state, 0);
rb_define_method(cDaemon, "running?", daemon_is_running, 0);
// Intialize critical section used by green polling thread
InitializeCriticalSection(&csControlCode);
// Constants
rb_define_const(cService, "VERSION", rb_str_new2(WIN32_SERVICE_VERSION));
rb_define_const(cDaemon, "VERSION", rb_str_new2(WIN32_SERVICE_VERSION));
set_service_constants(cService);
set_daemon_constants(cDaemon);
// Structs
v_service_status_struct = rb_struct_define("Win32ServiceStatus",
"service_type", "current_state", "controls_accepted", "win32_exit_code",
"service_specific_exit_code", "check_point", "wait_hint",
"interactive"
#ifdef HAVE_QUERYSERVICESTATUSEX
,"pid", "service_flags"
#endif
,0);
v_service_struct = rb_struct_define("Win32Service", "service_name",
"display_name", "service_type", "current_state", "controls_accepted",
"win32_exit_code", "service_specific_exit_code", "check_point",
"wait_hint", "binary_path_name", "start_type", "error_control",
"load_order_group", "tag_id", "start_name", "dependencies",
"description", "interactive"
#ifdef HAVE_ENUMSERVICESSTATUSEX
,"pid", "service_flags"
#endif
,0);
// Create an attr_accessor for each valid instance method
for(i = 0; i < sizeof(keys)/sizeof(char*); i++){
rb_define_attr(cService,keys[i],1,1);
}
} | 28.893477 | 84 | 0.651238 |
9ba1becbd64e8964170e22320ffa11f4fca20700 | 1,687 | js | JavaScript | src/templates/react-app/react/base/src/components/common/ConfirmDialog.js | pheintzelman/appily | 7aa8023067a8fe0298c1a3644271c0ee812310d9 | [
"MIT"
] | 2 | 2021-06-02T05:22:18.000Z | 2021-06-04T14:28:31.000Z | src/templates/react-app/react/base/src/components/common/ConfirmDialog.js | pheintzelman/appily | 7aa8023067a8fe0298c1a3644271c0ee812310d9 | [
"MIT"
] | 1 | 2021-06-12T14:42:57.000Z | 2021-06-12T14:42:57.000Z | src/templates/react-app/react/base/src/components/common/ConfirmDialog.js | pheintzelman/create-app | 7aa8023067a8fe0298c1a3644271c0ee812310d9 | [
"MIT"
] | null | null | null | import { forwardRef } from "react";
import Button from "@material-ui/core/Button";
import Dialog from "@material-ui/core/Dialog";
import DialogActions from "@material-ui/core/DialogActions";
import DialogContent from "@material-ui/core/DialogContent";
import DialogContentText from "@material-ui/core/DialogContentText";
import DialogTitle from "@material-ui/core/DialogTitle";
import Slide from "@material-ui/core/Slide";
const Transition = forwardRef(function Transition(props, ref) {
return <Slide direction="up" ref={ref} {...props} />;
});
function handleConfirm(setOpen, onConfirm) {
return () => {
if (onConfirm) {
onConfirm();
}
setOpen(false);
};
}
function handleCancel(setOpen, onCancel) {
return () => {
setOpen(false);
if (onCancel) {
onCancel();
}
};
}
export function ConfirmDialog({
open,
setOpen,
onConfirm,
onCancel,
text,
title,
}) {
return (
<Dialog
open={open}
TransitionComponent={Transition}
keepMounted
onClose={handleCancel(setOpen, onCancel)}
aria-labelledby="alert-dialog-slide-title"
aria-describedby="alert-dialog-slide-description"
>
<DialogTitle id="alert-dialog-slide-title">{title}</DialogTitle>
<DialogContent>
<DialogContentText id="alert-dialog-slide-description">
{text}
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={handleCancel(setOpen, onCancel)} color="primary">
Cancel
</Button>
<Button onClick={handleConfirm(setOpen, onConfirm)} color="primary">
Delete
</Button>
</DialogActions>
</Dialog>
);
}
| 25.179104 | 76 | 0.655009 |
413158df026c78d4f8e7ed583c56ea326711fd69 | 2,975 | swift | Swift | Academia/Controllers/View Controllers/UserSelfIdentifyViewController.swift | guatambu/academia | 15f7a3adf13f4d76e178f17408fb39fdd71aa713 | [
"MIT"
] | null | null | null | Academia/Controllers/View Controllers/UserSelfIdentifyViewController.swift | guatambu/academia | 15f7a3adf13f4d76e178f17408fb39fdd71aa713 | [
"MIT"
] | null | null | null | Academia/Controllers/View Controllers/UserSelfIdentifyViewController.swift | guatambu/academia | 15f7a3adf13f4d76e178f17408fb39fdd71aa713 | [
"MIT"
] | null | null | null | //
// UserSelfIdentifyViewController.swift
// Academia
//
// Created by Michael Guatambu Davis on 8/20/18.
// Copyright © 2018 DunDak, LLC. All rights reserved.
//
import UIKit
class UserSelfIdentifyViewController: UIViewController {
// MARK: - Properties
@IBOutlet weak var iAmOwnerButtonOutlet: UIButton!
@IBOutlet weak var iAmStudentButtonOutlet: UIButton!
@IBOutlet weak var confirmStudentButtonOutlet: UIButton!
@IBOutlet weak var confirmOwnerButtonOutlet: UIButton!
var isOwner = false
// MARK: ViewController Lifecycle Functions
override func viewWillAppear(_ animated: Bool) {
confirmOwnerButtonOutlet.isHidden = true
confirmStudentButtonOutlet.isHidden = true
confirmOwnerButtonOutlet.isEnabled = false
confirmStudentButtonOutlet.isEnabled = false
}
override func viewDidLoad() {
super.viewDidLoad()
}
// MARK: - Actions
@IBAction func ownerButtonTapped(_ sender: UIButton) {
confirmOwnerButtonOutlet.isHidden = false
confirmOwnerButtonOutlet.isEnabled = true
confirmStudentButtonOutlet.isHidden = true
confirmStudentButtonOutlet.isEnabled = false
isOwner = true
print(isOwner)
}
@IBAction func studentButtonTapped(_ sender: UIButton) {
confirmStudentButtonOutlet.isHidden = false
confirmStudentButtonOutlet.isEnabled = true
confirmOwnerButtonOutlet.isHidden = true
confirmOwnerButtonOutlet.isEnabled = false
isOwner = false
print(isOwner)
}
@IBAction func confirmStudentButtonTapped(_ sender: UIButton) {
print(self.isOwner)
}
@IBAction func confirmOwnerButtonTapped(_ sender: UIButton) {
print(self.isOwner)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
if segue.identifier == "studentSegue" {
guard let destinationVC = segue.destination as? SignUpLoginViewController else {
return
}
// Pass the selected object to the new view controller.
destinationVC.isOwner = self.isOwner
print("self: \(self.isOwner)")
print("dest: \(String(describing: destinationVC.isOwner))")
}
// Get the new view controller using segue.destinationViewController.
if segue.identifier == "ownerSegue" {
guard let destinationVC = segue.destination as? SignUpLoginViewController else {
return
}
// Pass the selected object to the new view controller.
destinationVC.isOwner = self.isOwner
print("self: \(self.isOwner)")
print("dest: \(String(describing: destinationVC.isOwner))")
}
}
}
| 29.75 | 92 | 0.637983 |
ddc94df8321019fd0f625ad1af62047d473184f6 | 570 | sql | SQL | importer/src/main/resources/scripts/file-centric/file-centric-snapshot-simple-map-unique-id.sql | aehrc/release-validation-framework | 8d003f95128f36b48890ab75df817a9b6318d20e | [
"Apache-2.0"
] | 1 | 2021-04-22T00:04:25.000Z | 2021-04-22T00:04:25.000Z | importer/src/main/resources/scripts/file-centric/file-centric-snapshot-simple-map-unique-id.sql | aehrc/release-validation-framework | 8d003f95128f36b48890ab75df817a9b6318d20e | [
"Apache-2.0"
] | null | null | null | importer/src/main/resources/scripts/file-centric/file-centric-snapshot-simple-map-unique-id.sql | aehrc/release-validation-framework | 8d003f95128f36b48890ab75df817a9b6318d20e | [
"Apache-2.0"
] | null | null | null |
/********************************************************************************
file-centric-snapshot-simple-map-unique-id
Assertion:
ID is unique in the SIMPLEMAP REFSET snapshot.
********************************************************************************/
insert into qa_result (runid, assertionuuid, concept_id, details)
select
<RUNID>,
'<ASSERTIONUUID>',
a.referencedcomponentid,
concat('SM RS: id=',a.id, ':Non unique id in current SIMPLEMAP REFSET snapshot file.')
from curr_simplemaprefset_s a
group by a.id
having count(a.id) > 1; | 33.529412 | 90 | 0.521053 |
ab91cc6e36668a40c02bbfb960d7e6adbd8c38de | 752 | kt | Kotlin | compiler/testData/codegen/bytecodeText/partMembersCall.kt | qussarah/declare | c83b764c7394efa3364915d973ae79c4ebed2437 | [
"Apache-2.0"
] | 45,293 | 2015-01-01T06:23:46.000Z | 2022-03-31T21:55:51.000Z | compiler/testData/codegen/bytecodeText/partMembersCall.kt | qussarah/declare | c83b764c7394efa3364915d973ae79c4ebed2437 | [
"Apache-2.0"
] | 3,386 | 2015-01-12T13:28:50.000Z | 2022-03-31T17:48:15.000Z | compiler/testData/codegen/bytecodeText/partMembersCall.kt | qussarah/declare | c83b764c7394efa3364915d973ae79c4ebed2437 | [
"Apache-2.0"
] | 6,351 | 2015-01-03T12:30:09.000Z | 2022-03-31T20:46:54.000Z | // FILE: otherFile.kt
@file:[JvmName("Util") JvmMultifileClass]
package test
internal fun internalInOtherFile() {}
public fun publicInOtherFile() {}
// FILE: thisFile.kt
@file:[JvmName("Util") JvmMultifileClass]
package test
fun foo() {
privateInThisFile()
internalInThisFile()
publicInThisFile()
internalInOtherFile()
publicInOtherFile()
}
private fun privateInThisFile() {}
internal fun internalInThisFile() {}
public fun publicInThisFile() {}
// @test/Util__ThisFileKt.class:
// 1 INVOKESTATIC test/Util__ThisFileKt.privateInThisFile
// 1 INVOKESTATIC test/Util.internalInThisFile
// 1 INVOKESTATIC test/Util.publicInThisFile
// 1 INVOKESTATIC test/Util.internalInOtherFile
// 1 INVOKESTATIC test/Util.publicInOtherFile
| 22.117647 | 57 | 0.763298 |
0e5d3a5b28c8ddd0f956162bff1f87d638cfe30d | 1,913 | html | HTML | index.html | veerreshr/accelerometer-demo | ec5245afe17ab1c87571a8d33da5fb00f3e92b67 | [
"MIT"
] | null | null | null | index.html | veerreshr/accelerometer-demo | ec5245afe17ab1c87571a8d33da5fb00f3e92b67 | [
"MIT"
] | null | null | null | index.html | veerreshr/accelerometer-demo | ec5245afe17ab1c87571a8d33da5fb00f3e92b67 | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, shrink-to-fit=no"
/>
<title>Accelerometer demo</title>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css"
/>
<link rel="stylesheet" href="/assets/css/styles.min.css" />
</head>
<body>
<div class="alert alert-success alert-danger" role="alert">
<span><strong id="error"></strong></span>
</div>
<div class="container">
<div class="card">
<div class="card-body">
<h4 class="card-title">Accelerometer Sensor</h4>
<p class="card-text">
Frequency : <span id="frequency">__</span>
</p>
<p class="card-text">
Sensor activated : <span id="activated">False</span>
</p>
<p class="card-text">x : <span id="x">0</span></p>
<p class="card-text">y : <span id="y">0</span></p>
<p class="card-text">z : <span id="z">0</span></p>
</div>
</div>
</div>
<!-- Start: Footer Basic -->
<footer class="footer-basic">
<!-- Start: Center Div -->
<div class="text-center">
<p>
React out to me at
<a href="veerreshr@gmail.com" target="_blank">veerreshr@gmail.com</a>
and
<a href="https://veereshr.netlify.app" target="_blank"
>https://veereshr.netlify.app</a
>
</p>
</div>
<!-- End: Center Div -->
<!-- Start: Copyright -->
<p class="copyright">Veeresh Raavipaati© 2021</p>
<!-- End: Copyright -->
</footer>
<!-- End: Footer Basic -->
<script src="./main.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
| 31.360656 | 104 | 0.535285 |
d364c61465b169c12833cd7cfcbf661149ac724b | 933 | sql | SQL | schema/verify/roles/sequencing-lab.sql | UWIT-IAM/uw-redcap-client | 38a1eb426fa80697446df7a466a41e0305382606 | [
"MIT"
] | 21 | 2019-04-19T22:45:22.000Z | 2022-01-28T01:32:09.000Z | schema/verify/roles/sequencing-lab.sql | sonali-mhihim/id3c | 1e3967d6c24e9cadb34cae1c5e1e79415a2250dc | [
"MIT"
] | 219 | 2019-04-19T21:42:24.000Z | 2022-03-29T21:41:04.000Z | schema/verify/roles/sequencing-lab.sql | sonali-mhihim/id3c | 1e3967d6c24e9cadb34cae1c5e1e79415a2250dc | [
"MIT"
] | 9 | 2020-03-11T20:07:26.000Z | 2022-03-05T00:36:11.000Z | -- Verify seattleflu/schema:roles/sequencing-lab on pg
begin;
select 1/pg_catalog.has_database_privilege('sequencing-lab', :'DBNAME', 'connect')::int;
select 1/pg_catalog.has_schema_privilege('sequencing-lab', 'receiving', 'usage')::int;
select 1/pg_catalog.has_column_privilege('sequencing-lab', 'receiving.sequence_read_set', 'document', 'insert')::int;
select 1/(not pg_catalog.has_column_privilege('sequencing-lab', 'receiving.sequence_read_set', 'sequence_read_set_id', 'select,insert,update'))::int;
select 1/(not pg_catalog.has_column_privilege('sequencing-lab', 'receiving.sequence_read_set', 'document', 'select,update'))::int;
select 1/(not pg_catalog.has_column_privilege('sequencing-lab', 'receiving.sequence_read_set', 'received', 'select,insert,update'))::int;
select 1/(not pg_catalog.has_column_privilege('sequencing-lab', 'receiving.sequence_read_set', 'processing_log', 'select,insert,update'))::int;
rollback;
| 62.2 | 149 | 0.78135 |
2693c021468f1ba8a9f8afe229b9c59f8707db81 | 1,171 | java | Java | microconfig-core/src/main/java/io/microconfig/core/properties/resolvers/placeholder/strategies/component/properties/ComponentProperties.java | ekuzmichev/microconfig | b35d0c4eda071521482732bd649082f7c945f786 | [
"Apache-2.0"
] | 256 | 2019-02-11T22:15:49.000Z | 2022-03-05T15:25:43.000Z | microconfig-core/src/main/java/io/microconfig/core/properties/resolvers/placeholder/strategies/component/properties/ComponentProperties.java | ekuzmichev/microconfig | b35d0c4eda071521482732bd649082f7c945f786 | [
"Apache-2.0"
] | 38 | 2019-03-29T16:31:12.000Z | 2021-08-18T17:25:46.000Z | microconfig-core/src/main/java/io/microconfig/core/properties/resolvers/placeholder/strategies/component/properties/ComponentProperties.java | ekuzmichev/microconfig | b35d0c4eda071521482732bd649082f7c945f786 | [
"Apache-2.0"
] | 16 | 2019-04-29T08:09:39.000Z | 2022-02-02T04:45:48.000Z | package io.microconfig.core.properties.resolvers.placeholder.strategies.component.properties;
import io.microconfig.core.environments.EnvironmentRepository;
import io.microconfig.core.properties.repository.ComponentGraph;
import io.microconfig.core.properties.resolvers.placeholder.strategies.component.ComponentProperty;
import lombok.RequiredArgsConstructor;
import java.io.File;
import java.util.Map;
import static java.util.function.Function.identity;
import static java.util.stream.Collectors.toMap;
import static java.util.stream.Stream.of;
@RequiredArgsConstructor
public class ComponentProperties {
private final ComponentGraph componentGraph;
private final EnvironmentRepository environmentRepository;
private final File rootDir;
private final File destinationComponentDir;
public Map<String, ComponentProperty> get() {
return of(
new NameProperty(),
new ConfigDirProperty(componentGraph, environmentRepository),
new ResultDirProperty(destinationComponentDir),
new ConfigRootDirProperty(rootDir)
).collect(toMap(ComponentProperty::key, identity()));
}
} | 39.033333 | 99 | 0.775406 |
11e3e07e9f9c1a55af59b3df1c9569dad12fa8f4 | 13,074 | html | HTML | v6/pxf/intro_pxf.html | greenplum-db/gpdb-docs-cn | f46f1a7a874bf1994e45cb8dae3aea2e39dcf23a | [
"Apache-2.0"
] | 1 | 2020-08-26T01:44:09.000Z | 2020-08-26T01:44:09.000Z | v6/pxf/intro_pxf.html | greenplum-db/gpdb-docs-cn | f46f1a7a874bf1994e45cb8dae3aea2e39dcf23a | [
"Apache-2.0"
] | null | null | null | v6/pxf/intro_pxf.html | greenplum-db/gpdb-docs-cn | f46f1a7a874bf1994e45cb8dae3aea2e39dcf23a | [
"Apache-2.0"
] | 3 | 2020-08-26T01:44:11.000Z | 2022-03-11T05:44:20.000Z | <!doctype html>
<html>
<head>
<meta charset="utf-8">
<!-- Always force latest IE rendering engine or request Chrome Frame -->
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,300italic,400italic,400,600' rel='stylesheet' type='text/css'>
<!-- Use title if it's in the page YAML frontmatter -->
<title>
PXF介绍 |
Greenplum Database Docs
</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/stylesheets/all.css" rel="stylesheet" media="screen, print" />
<link href="/stylesheets/print.css" rel="stylesheet" media="print" />
<link href='/images/favicon.ico' rel='shortcut icon'>
<script src="/javascripts/all.js"></script>
</head>
<body class="x6-0 x6-0_pxf x6-0_pxf_intro_pxf has-subnav">
<div class="viewport">
<div class='wrap'>
<script type="text/javascript">
document.domain = "greenplum.org";
</script>
<header class="header header-layout">
<h1 class="logo">
<a href="/">Greenplum Database Documentation</a>
</h1>
<div class="header-links js-bar-links">
<div class="btn-menu" data-behavior="MenuMobile"></div>
<div class="header-item"><a href="https://greenplum.org">Back to Greenplum Database</a></div>
<div class="header-item">
<a href="https://github.com/greenplum-db/gpdb/wiki">Wiki</a>
</div>
</div>
</header>
<div class="container">
<!--googleoff: index-->
<div id="sub-nav" class="js-sidenav nav-container" role="navigation">
<a class="sidenav-title" data-behavior="SubMenuMobile"> Doc Index</a>
<div class="nav-content">
<ul>
<li>
<a href="/v6/homenav.html">Greenplum数据库® 6.0文档</a>
</li>
<li><a href="/v6/pxf/overview_pxf.html" format="markdown">Greenplum平台扩展框架(PXF)</a></li>
<li class="has_submenu">
<a href="/v6/pxf/intro_pxf.html" format="markdown">PXF介绍</a>
<ul>
<li><a href="/v6/pxf/filter_push.html" format="markdown">PXF谓词下推</a></li>
<li><a href="/v6/pxf/col_project.html" format="markdown">PXF列投影</a></li>
</ul>
</li>
<li class="has_submenu">
<span>PXF管理手册</span>
<ul>
<li class="has_submenu">
<a href="/v6/pxf/instcfg_pxf.html" format="markdown">配置PXF</a>
<ul>
<li><a href="/v6/pxf/about_pxf_dir.html" format="markdown">PXF安装和配置目录</a></li>
<li><a href="/v6/pxf/install_java.html" format="markdown">为PXF安装JAVA环境</a></li>
<li><a href="/v6/pxf/init_pxf.html" format="markdown">初始化PXF</a></li>
<li><a href="/v6/pxf/cfg_server.html" format="markdown">配置PXF服务器</a></li>
<li class="has_submenu">
<a href="/v6/pxf/client_instcfg.html" format="markdown">配置PXF HADOOP连接器(可选)</a>
<ul>
<li>
<a href="/v6/pxf/pxfuserimpers.html">配置用户模拟和代理</a>
</li>
<li>
<a href="/v6/pxf/pxf_kerbhdfs.html" format="markdown">为安全HDFS配置PXF</a>
</li>
</ul>
</li>
<li><a href="/v6/pxf/s3_objstore_cfg.html" format="markdown">配置Minio和S3对象存储的连接器(可选)</a> </li>
<li><a href="/v6/pxf/objstore_cfg.html" format="markdown">配置Azure和Google云端存储的连接器(可选)</a> </li>
<li><a href="/v6/pxf/jdbc_cfg.html" format="markdown">配置JDBC连接器(可选)</a> </li>
<li><a href="/v6/pxf/cfghostport.html" format="markdown">配置PXF客户端主机和端口(可选)</a> </li>
</ul>
</lie>
<li><a href="/v6/pxf/upgrade_pxf.html" format="markdown">升级PXF</a></li>
<li><a href="/v6/pxf/cfginitstart_pxf.html" format="markdown">PXF的启动、停止和重启</a></li>
<li><a href="/v6/pxf/using_pxf.html" format="markdown">授权用户访问PXF</a></li>
<li><a href="/v6/pxf/reg_jar_depend.html" format="markdown">注册PXF的jar依赖</a></li>
<li><a href="/v6/pxf/monitor_pxf.html" format="markdown">监控PXF</a></li>
</ul>
</li>
<li class="has_submenu">
<a href="/v6/pxf/access_hdfs.html" format="markdown">使用PXF访问hadoop</a>
<ul>
<li><a href="/v6/pxf/hdfs_text.html" format="markdown">读写文本数据</a></li>
<li><a href="/v6/pxf/hdfs_avro.html" format="markdown">读取Avro数据</a></li>
<li><a href="/v6/pxf/hdfs_json.html" format="markdown">读取JSON数据</a></li>
<li><a href="/v6/pxf/hdfs_parquet.html" format="markdown">读写Parquet数据</a></li>
<li><a href="/v6/pxf/hdfs_seqfile.html" format="markdown">读写SequenceFile数据</a></li>
<li><a href="/v6/pxf/hdfs_fileasrow.html" format="markdown">将多行文本文件读入单个表行</a></li>
<li><a href="/v6/pxf/hive_pxf.html" format="markdown">读取Hive表数据</a></li>
<li><a href="/v6/pxf/hbase_pxf.html" format="markdown">读取HBase表数据</a></li>
</ul>
</li>
<li class="has_submenu">
<a href="/v6/pxf/access_objstore.html" format="markdown">使用PXF访问Azure,Google云端存储,Minio和S3对象存储</a>
<ul>
<li><a href="/v6/pxf/access_s3.html" format="markdown">About Accessing the S3 Object Store</a></li>
<li><a href="/v6/pxf/objstore_text.html" format="markdown">读取和写入文本数据</a></li>
<li><a href="/v6/pxf/objstore_avro.html" format="markdown">读取Avro数据</a></li>
<li><a href="/v6/pxf/objstore_json.html" format="markdown">读取JSON数据</a></li>
<li><a href="/v6/pxf/objstore_parquet.html" format="markdown">读写Parquet数据</a></li>
<li><a href="/v6/pxf/objstore_seqfile.html" format="markdown">读写SequenceFile数据</a></li>
<li><a href="/v6/pxf/objstore_fileasrow.html" format="markdown">将多行文本文件读入单个表行</a></li>
<li><a href="/v6/pxf/read_s3_s3select.html" format="markdown">使用S3 Select从S3读取CSV和Parquet数据</a></li>
</ul>
</li>
<li><a href="/v6/pxf/jdbc_pxf.html" format="markdown">使用PXF访问SQL数据库(JDBC)</a></li>
<li><a href="/v6/pxf/troubleshooting_pxf.html" format="markdown">PXF故障排除</a></li>
<li class="has_submenu">
<a href="/v6/pxf/ref/pxf-ref.html" format="markdown">PXF实用程序手册</a>
<ul>
<li><a href="/v6/pxf/ref/pxf-cluster.html" format="markdown">pxf cluster</a></li>
<li><a href="/v6/pxf/ref/pxf.html" format="markdown">pxf</a></li>
</ul>
</li>
<!--li class="has_submenu">
<a href="/v6/pxf/sdk/dev_overview.html" format="markdown">Using the PXF Java SDK</a>
<ul>
<li>
<a href="/v6/pxf/sdk/dev_concepts.html" format="markdown">PXF Developer Concepts</a>
</li>
<li>
<a href="/v6/pxf/sdk/pxfapi.html" format="markdown">Introducing the PXF API</a>
</li>
<li>
<a href="/v6/pxf/sdk/build_conn.html" format="markdown">Building a Connector</a>
</li>
<li class="has_submenu">
<a href="/v6/pxf/sdk/deploy_conn.html" format="markdown">Deploying a Connector</a>
<ul>
<li>
<a href="/v6/pxf/sdk/deploy_profile.html" format="markdown">Deploying a Profile</a>
</li>
</ul>
</li>
</ul>
</li-->
<li>
<a href="/v6/admin_guide/external/pxf-overview.html" format="dita" scope="peer">Back to the Administrator Guide</a>
</li>
</ul>
</div>
</div>
<!--end of sub-nav-->
<!--googleon: index-->
<main class="content content-layout" id="js-content" role="main">
<a id="top"></a>
<h1 class="title-container" >
PXF介绍
</h1>
<div id="js-quick-links" >
<div class="quick-links"><ul>
<li><a href="#arch">架构概述</a></li>
<li><a href="#more">连接器(Connector),服务器(Servers)和配置文件(Profiles)</a></li>
<li><a href="#create_external_table">创建一个外部表</a></li>
<li><a href="#other">PXF的其他特性</a></li>
</ul></div>
</div>
<div class="to-top" id="js-to-top">
<a href="#top" title="back to top"></a>
</div>
<p>Greenplum Platform Extension Framework(PXF)提供的连接器(connectors)可以用于访问存储在Greenplum数据库外部源中的数据。这些连接器将外部数据源映射到Greenplum数据库的外部表(external table)中。创建Greenplum数据库外部表时,你可以通过在命令中提供服务器名称和配置文件名称来标识外部数据存储和数据格式。</p>
<p>您可以通过Greenplum数据库查询外部表引用的数据,您也可以使用外部表将数据加载到Greenplum数据库中以获得更高的性能。</p>
<h2 id="-架构概述"><a id="arch"></a> 架构概述</h2>
<p>GPDB集群包含一个master节点(master node)和多个segment主机(segment host)。GPDB segment主机上的PXF客户端进程为对外部表进行查询的每个segment instance分配工作线程。多个segment主机的PXF代理与外部数据存储并行通信。</p>
<h2 id="-连接器(connector),服务器(servers)和配置文件(profiles)"><a id="more"></a> 连接器(Connector),服务器(Servers)和配置文件(Profiles)</h2>
<p>连接器是一个通用的术语,他封装了读取和写入外部数据存储所需要的实现细节。PXF提供创建了与Hadoop (HDFS,Hive,Hbase),对象存储(Azure,Google Cloud Storage, Minio, S3)和sql数据库(通过jdbc)的连接器。</p>
<p>PXF服务器是连接器的命名配置。服务器定义提供PXF访问外部数据源所需的信息。此配置信息是特定于数据存储的,并且可以包括服务器位置,访问凭据和其他相关属性。</p>
<p>Greenplum数据库管理员将为每个允许Greenplum数据库用户访问的外部数据存储配置至少一个服务器定义,并在适当时发布可用的服务器名称。</p>
<p>默认的PXF服务是default(保留),在没有配置SERVER=<server_name>时提供外部数据源的位置和访问信息。
创建外部表时,可以指定<code>SERVER=<server_name></code>设置,以标识从中获取配置的服务器配置和访问外部数据存储的凭据。</p>
<p>GPDB数据库管理员将为每个允许GPDB用户访问的外部数据存储配置至少一个服务定义,并将根据需求发布可用的服务名。
默认的PXF服务器名为<code>default</code>(保留),在配置后,如果没有<code>SERVER=<server_name></code>设置,则将提供外部数据源的位置和访问信息。</p>
<p>最后,PXF配置文件是一个命名映射,用于标识特定外部数据存储支持的特定数据格式或协议。PXF支持text,Avro,JSON,RCFile,Parquet,SequenceFile和ORC数据格式以及JDBC协议,并提供了一些内置配置文件,如以下部分所述。</p>
<h2 id="-创建一个外部表"><a id="create_external_table"></a> 创建一个外部表</h2>
<p>PXF实现了一个叫做pxf的GPDB协议,你可以使用这个协议去创建一个外部表。指定pxf协议的<a href="/v6/ref_guide/sql_commands/CREATE_EXTERNAL_TABLE.html"><code>CREATE EXTERNAL TABLE</code></a>命令语法如下:</p>
<pre class="highlight sql"><code><span class="k">CREATE</span> <span class="p">[</span><span class="n">WRITABLE</span><span class="p">]</span> <span class="k">EXTERNAL</span> <span class="k">TABLE</span> <span class="o"><</span><span class="k">table_name</span><span class="o">></span>
<span class="p">(</span> <span class="o"><</span><span class="k">column_name</span><span class="o">></span> <span class="o"><</span><span class="n">data_type</span><span class="o">></span> <span class="p">[,</span> <span class="p">...]</span> <span class="o">|</span> <span class="k">LIKE</span> <span class="o"><</span><span class="n">other_table</span><span class="o">></span> <span class="p">)</span>
<span class="k">LOCATION</span><span class="p">(</span><span class="s1">'pxf://<path-to-data>?PROFILE=<profile_name>[&SERVER=<server_name>][&<custom-option>=<value>[...]]'</span><span class="p">)</span>
<span class="n">FORMAT</span> <span class="s1">'[TEXT|CSV|CUSTOM]'</span> <span class="p">(</span><span class="o"><</span><span class="n">formatting</span><span class="o">-</span><span class="n">properties</span><span class="o">></span><span class="p">);</span>
</code></pre>
<p>在创建语句<code>CREATE EXTERNAL TABLE</code>中的<code>LOCATION</code>子句是一个URI。这个URI标识描述外部数据位置的路径和其他信息。例如:如果外部数据存储的是HDFS,则<path-to-data>填写指定HDFS文件的绝对路径。如果外部数据存储的是HIVE,则<path-to-data>需要指定符合模式的HIVE表名称。</p>
<p>使用问号(?)引入的URI的查询部分来标识PXF服务器和配置文件名称。</p>
<p>PXF可能需要额外的信息来读取和写入某些数据格式,可以使用LOCATION字符串的可选组件<custom-option> = <value>来提供配置文件的信息,并通过字符串的<formatting-properties>组件提供格式信息。</p>
<p><caption><span class="tablecap">Table 1. CREATE EXTERNAL TABLE参数值和描述</span></caption></p>
<p><a id="creatinganexternaltable__table_pfy_htz_4p"></a></p>
<table><thead>
<tr>
<th>Keyword</th>
<th>Value and Description</th>
</tr>
</thead><tbody>
<tr>
<td><path‑to‑data></td>
<td>目录,文件名,通配符模式,表名等。<path-to-data>的语法取决于外部数据源</td>
</tr>
<tr>
<td>PROFILE=<profile_name></td>
<td>PXF用于访问数据的配置文件。 PXF支持<a href="/v6/pxf/access_hdfs.html">Hadoop services</a>, <a href="/v6/pxf/access_objstore.html">object stores</a>, and <a href="/v6/pxf/jdbc_pxf.html">other SQL databases</a>.</td>
</tr>
<tr>
<td>SERVER=<server_name></td>
<td>PXF用于访问数据的命名服务器配置。可选的; 如果未指定,PXF将使用<code>default</code>服务器。</td>
</tr>
<tr>
<td><custom‑option>=<value></td>
<td>配置文件或服务器支持的其他选项及其值 </td>
</tr>
<tr>
<td>FORMAT <value></td>
<td>PXF支持<code>TEXT</code>,<code>CSV</code>和<code>CUSTOM</code>格式</td>
</tr>
<tr>
<td><formatting‑properties></td>
<td>格式化配置文件支持的属性; 例如, <code>FORMATTER</code>或<code>delimiter</code></td>
</tr>
</tbody></table>
<p><strong>Note:</strong> 创建PXF外部表时,不能在格式化程序规范中使用HEADER选项</p>
<h2 id="-pxf的其他特性"><a id="other"></a> PXF的其他特性</h2>
<p>某些PXF连接器和配置文件支持谓词下推和列投影。 有关此支持的详细信息,请参阅以下主题:
- <a href="/v6/pxf/filter_push.html">About PXF Filter Pushdown</a>
- <a href="/v6/pxf/col_project.html">About Column Projection in PXF</a></p>
</main>
</div>
</div>
</div>
<div id="scrim"></div>
<div class="container">
<footer class="site-footer-links">
</footer>
</div><!--end of container-->
</body>
</html>
| 45.713287 | 429 | 0.629264 |
b1e0fa1c5986ba03e1589f6d023d2a4569a15bc3 | 920 | h | C | Extensions/UIColor+HexString/UIColor+HexString.h | MessuKilkain/MKUtilsObjC | c8f4a9d2eb5b0007c20926468ffe4fcdabaee293 | [
"MIT"
] | null | null | null | Extensions/UIColor+HexString/UIColor+HexString.h | MessuKilkain/MKUtilsObjC | c8f4a9d2eb5b0007c20926468ffe4fcdabaee293 | [
"MIT"
] | null | null | null | Extensions/UIColor+HexString/UIColor+HexString.h | MessuKilkain/MKUtilsObjC | c8f4a9d2eb5b0007c20926468ffe4fcdabaee293 | [
"MIT"
] | null | null | null |
/*
Origianl Code from https://github.com/JohnEstropia/JEToolkit/blob/master/JEToolkit/JEToolkit/Categories/UIColor%2BJEToolkit.m
*/
#import <UIKit/UIKit.h>
@interface UIColor (HexString)
/*! Creates a color from a color hex string.
@param hexString The RGB-hex formatted NSString to convert a color from
@return A color from the hex formatted NSString
*/
+ (nullable UIColor *)colorWithHexString:(nonnull NSString *)hexString;
+ (nullable UIColor *)colorWithHexString:(nullable NSString *)hexString orDefault:(nullable UIColor*)defaultColor;
/*! Creates a color from a RGB integer value.
@param RGBInt The RGB integer value to convert from
@param alpha The extracted color's alpha value
@return a color from the RGB integer
*/
+ (nonnull UIColor *)colorWithInt:(NSUInteger)RGBInt alpha:(CGFloat)alpha;
/*! Creates a random color.
@return a random opaque color
*/
+ (nonnull UIColor *)randomColor;
@end
| 30.666667 | 126 | 0.76413 |
83f907600894219482ecb649a690f3ab1a89d426 | 794 | asm | Assembly | oeis/045/A045389.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/045/A045389.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/045/A045389.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A045389: Primes congruent to {2, 6} mod 7.
; Submitted by Jamie Morken(w1)
; 2,13,23,37,41,79,83,97,107,139,149,163,167,181,191,223,233,251,293,307,317,331,349,359,373,401,419,433,443,457,461,499,503,541,569,587,601,643,653,709,727,751,769,797,811,821,839,853,863,877,881,919,937,947,1021,1031,1049,1063,1087,1091,1129,1171,1213,1217,1231,1259,1283,1297,1301,1367,1381,1399,1409,1423,1427,1451,1483,1493,1511,1549,1553,1567,1609,1619,1637,1693,1721,1759,1777,1787,1801,1847,1861,1871,1889,1913,1931,1973,1987,1997
mov $1,2
mov $2,332202
mov $5,5
mov $6,1
lpb $2
mov $3,$6
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,1
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
sub $2,18
add $5,$1
gcd $1,6
mov $6,$5
lpe
mov $0,$6
add $0,1
| 31.76 | 438 | 0.685139 |
d5bcaf79f35e84ed6ac06338ddd616dc4c21e8b5 | 187 | c | C | src/readline.c | Romain7426/Mouton1 | 2c4dd036a5eb9b35884027e8959d07adec10ac91 | [
"ISC"
] | 2 | 2020-05-24T16:02:51.000Z | 2020-05-24T17:53:15.000Z | src/readline.c | Romain7426/Mouton1 | 2c4dd036a5eb9b35884027e8959d07adec10ac91 | [
"ISC"
] | null | null | null | src/readline.c | Romain7426/Mouton1 | 2c4dd036a5eb9b35884027e8959d07adec10ac91 | [
"ISC"
] | null | null | null | #include "global.h"
#include "readline.h"
char * readline(const char * prompt) {
assert(false);
return NULL;
};
void add_history(const char * line) {
assert(false);
};
| 13.357143 | 39 | 0.625668 |
6a20200c477f3e895a06e7f21a4ed3a5c4b19658 | 1,389 | swift | Swift | NHS-COVID-19/Core/Sources/Integration/SelfDiagnosisOrderFlowState.swift | faberga/covid-19-app-ios-ag-public | ee43e47aa1c082ea0bbfb0a971327dea807e4533 | [
"MIT"
] | 135 | 2020-08-13T12:37:37.000Z | 2021-02-12T06:07:22.000Z | NHS-COVID-19/Core/Sources/Integration/SelfDiagnosisOrderFlowState.swift | faberga/covid-19-app-ios-ag-public | ee43e47aa1c082ea0bbfb0a971327dea807e4533 | [
"MIT"
] | 15 | 2020-09-21T11:47:19.000Z | 2021-01-11T17:08:29.000Z | NHS-COVID-19/Core/Sources/Integration/SelfDiagnosisOrderFlowState.swift | faberga/covid-19-app-ios-ag-public | ee43e47aa1c082ea0bbfb0a971327dea807e4533 | [
"MIT"
] | 17 | 2020-08-13T13:37:38.000Z | 2020-12-25T20:13:20.000Z | //
// Copyright © 2021 DHSC. All rights reserved.
//
import Combine
import Common
import Domain
import Foundation
import Interface
enum SelfDiagnosisOrderFlowState {
case selfDiagnosis(SelfDiagnosisFlowViewController.Interacting)
case testOrdering(VirologyTestingFlowViewController.Interacting)
static func makeState(context: RunningAppContext, acknowledge: (() -> Void)? = nil) -> AnyPublisher<SelfDiagnosisOrderFlowState, Never> {
let testOrdering = CurrentValueSubject<Bool, Never>(false)
return testOrdering
.map { value in
if value {
return .testOrdering(VirologyTestingFlowInteractor(
virologyTestOrderInfoProvider: context.virologyTestingManager,
openURL: context.openURL,
acknowledge: acknowledge
))
} else {
return .selfDiagnosis(SelfDiagnosisFlowInteractor(
selfDiagnosisManager: context.selfDiagnosisManager,
orderTest: {
testOrdering.send(true)
},
openURL: context.openURL,
initialIsolationState: context.isolationState.currentValue
))
}
}.eraseToAnyPublisher()
}
}
| 36.552632 | 141 | 0.581713 |
90866c02673410bdc808592f63ffbf041e989bce | 523 | py | Python | test/test_bch.py | timoi-Lucypher/npCrypto | 10156482d70503fa01880421aba4a4a3d171bd98 | [
"MIT"
] | null | null | null | test/test_bch.py | timoi-Lucypher/npCrypto | 10156482d70503fa01880421aba4a4a3d171bd98 | [
"MIT"
] | null | null | null | test/test_bch.py | timoi-Lucypher/npCrypto | 10156482d70503fa01880421aba4a4a3d171bd98 | [
"MIT"
] | null | null | null | import numpy as np
from npcrypto.codes.bch import BCH
from npcrypto.codes.poly_gf2 import a2p, strip_zeros
def test_encode():
#http://www.comlab.hut.fi/studies/3410/slides_08_6_4.pdf
n = 7
m = 3
k = 3
t = 2
msg = np.array([1,0,1], dtype=np.uint8)
expected = np.array([1, 1, 0, 0, 1, 0, 1], dtype=np.uint8)
bch = BCH(n, m, k, t)
gen = np.array([1, 0, 1, 1, 1], dtype=np.uint8)
bch.set_generator(gen)
cdw = bch.encode(msg)
assert np.all(strip_zeros(cdw) == expected)
| 24.904762 | 62 | 0.609943 |
9e91bb7c83cfba5e37076aeb59e23ece53e37ebf | 420 | kt | Kotlin | app/src/main/java/com/coinninja/coinkeeper/ui/home/HomePagerAdapterProvider.kt | coinninjadev/dropbit-android | d67d7c0b9cad27db94470231073c5d6cdda83cd0 | [
"MIT"
] | 6 | 2019-03-16T04:07:09.000Z | 2020-04-16T00:08:12.000Z | app/src/main/java/com/coinninja/coinkeeper/ui/home/HomePagerAdapterProvider.kt | coinninjadev/dropbit-android | d67d7c0b9cad27db94470231073c5d6cdda83cd0 | [
"MIT"
] | 2 | 2019-12-14T01:37:32.000Z | 2021-05-27T22:58:13.000Z | app/src/main/java/com/coinninja/coinkeeper/ui/home/HomePagerAdapterProvider.kt | coinninjadev/dropbit-android | d67d7c0b9cad27db94470231073c5d6cdda83cd0 | [
"MIT"
] | 1 | 2020-02-10T16:44:55.000Z | 2020-02-10T16:44:55.000Z | package com.coinninja.coinkeeper.ui.home
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
import androidx.viewpager.widget.PagerAdapter
import app.dropbit.annotations.Mockable
@Mockable
class HomePagerAdapterProvider {
fun provide(fragmentManager: FragmentManager, state: Lifecycle.State): HomePagerAdapter {
return HomePagerAdapter(fragmentManager, state.ordinal)
}
}
| 28 | 93 | 0.819048 |
3e6b2ac69e4cb2f45bd63a1fbf26e646a3826eaf | 4,037 | ps1 | PowerShell | Automation/PasswordExpiryNotification.ps1 | shortthirdman/MicrosoftWindows10 | aa3ab7434f184e423906e330a9ce6c3c5cb8a080 | [
"MIT"
] | 2 | 2021-06-22T14:16:30.000Z | 2021-11-17T06:04:03.000Z | Automation/PasswordExpiryNotification.ps1 | shortthirdman/MicrosoftWindows10 | aa3ab7434f184e423906e330a9ce6c3c5cb8a080 | [
"MIT"
] | null | null | null | Automation/PasswordExpiryNotification.ps1 | shortthirdman/MicrosoftWindows10 | aa3ab7434f184e423906e330a9ce6c3c5cb8a080 | [
"MIT"
] | null | null | null | #Add the Quest PowerShell snapin
Add-PsSnapIn Quest.ActiveRoles.ADManagement -ErrorAction SilentlyContinue
$logdate = Get-Date -format yyyyMMdd
$logfile = "E:\scripts\logs\passwordlog"+$logdate+".txt"
Get-QADUser -SizeLimit 0 | Select-Object samAccountName,mail,PasswordStatus,FirstName,name |
Where-Object {$_.PasswordStatus -ne "Password never expires" -and $_.PasswordStatus -ne "Expired" -and $_.PasswordStatus -ne "User must change password at next logon." -and $_.mail -ne $null} |
ForEach-Object {
$today = Get-Date
$name = $_.name
$samaccountname = $_.samAccountName
$mail = $_.mail
$passwordstatus = $_.PasswordStatus
$passwordexpiry = $passwordstatus.Replace("Expires at: ","")
$passwordexpirydate = Get-Date $passwordexpiry
$daystoexpiry = ($passwordexpirydate - $today).Days
$smtpserver = "XXXXXXXXXXXXXXX"
#$attachment = "X:\Instructions\PasswordChange.doc"
$emailFrom = "XXXXXXXXXXXXXXX@XXXXXXXXX.XXX"
$body =
"Dear $($_.FirstName),
Your Domain password will expire in $daystoexpiry days. Please change it soon to avoid losing access to your computer, email, and the network.
After changing the password on your computer, you will also need to enter your password in Outlook and update it on your mobile devices.
Outlook (on Windows and Mac) will pop up and prompt you to enter a new password. For email, your username is $mail. Check mark the box to save remember your password.
Update your account information on any mobile devices you use (phone or tablet). Each mobile device differs on settings. In general, go to Settings and find the section for accounts. Change the password in the settings for your email account.
To change your password, follow one of the methods below:
1. On your Windows computer
a. If you have a laptop, plug into the wired network in your office. If you are not in the office, logon and connect to VPN.
b. If you have a desktop, logon as usual.
c. Press Ctrl-Alt-Del and click on ""Change Password"".
d. Fill in your old password and set a new password. See the password requirements below.
e. Press OK to return to your desktop.
2. On your Macintosh computer
a. If you have a laptop, plug into the wired network in your office. If you are not in the office, logon and connect to VPN.
b. If you have a desktop, logon as usual.
c. Open ""System Preferences""
d. Under Systems, click on ""Users & Groups""
e. Click ""Change Password""
f. Fill in your old password and set a new password. See the password requirements below.
g. Click ""Change Password"" again to save.
The new password must meet the minimum requirements set forth in our corporate policies including:
1. It must be at least 8 characters long.
2. It must contain at least one character from 3 of the 4 following groups of characters:
a. Uppercase letters (A-Z)
b. Lowercase letters (a-z)
c. Numbers (0-9)
d. Symbols (!@#$%^&*...)
3. It cannot match any of your past 24 passwords.
4. It cannot contain characters which match 3 or more consecutive characters of your username.
5. You cannot change your password more often than once in a 24 hour period.
If you have any questions please contact the Global Service Desk at "
# This is the logic for who to send the email to. it MUST go smallest to largest (1, 5, 14 etc)
if (($daystoexpiry -eq 1) -or ($daystoexpiry -eq 5) -or ($daystoexpiry -eq 14)) {
$emailTo = "$mail"
$subject = "Your Network password will expire in $daystoexpiry day(s)."
Send-MailMessage -To $emailTo -From $emailFrom -Subject $subject -Body $body -SmtpServer $smtpserver
Write-Host "Email was sent to $mail on $today"
Add-Content $logfile "Password expiration email was sent to $name, $mail on $today. Their password expires $passwordexpiry"
}
}
Send-MailMessage -To "XXXXXXXXX@XXXX.org" -CC "XXXX@XXXXX.org" -From "GlobalServiceDesk@XXXX.org" -Subject "Password expiration log for $today" -Body "Here is the Password Expiration log from $today" -Attachments $logfile -SmtpServer $smtpserver | 55.30137 | 246 | 0.740401 |
fb1979ac1209ffd63987d575be4e3988691ad744 | 355 | h | C | XQQWeiboProj/XQQWeiboProj/other/XQQSendToolbar.h | xiaogehenjimo/XQQSinaProj | 1c8483cb830594abdff3d72dc07f0f1e4cdf9003 | [
"MIT"
] | 4 | 2017-02-06T03:15:13.000Z | 2019-09-23T09:01:29.000Z | XQQWeiboProj/XQQWeiboProj/other/XQQSendToolbar.h | xiaogehenjimo/XQQSinaProj | 1c8483cb830594abdff3d72dc07f0f1e4cdf9003 | [
"MIT"
] | null | null | null | XQQWeiboProj/XQQWeiboProj/other/XQQSendToolbar.h | xiaogehenjimo/XQQSinaProj | 1c8483cb830594abdff3d72dc07f0f1e4cdf9003 | [
"MIT"
] | null | null | null | //
// XQQSendToolbar.h
// XQQWeiboProj
//
// Created by XQQ on 16/9/6.
// Copyright © 2016年 UIP. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface XQQSendToolbar : UIToolbar
/**
* 按钮点击事件
*/
@property (nonatomic, copy) void(^buttonDidPress)(NSInteger btnTag);
/**
* 记录表情的按钮
*/
@property(nonatomic, strong) UIButton * faceBtn;
@end
| 16.904762 | 69 | 0.664789 |
75516c11d8b09f712bf9e0e4d00d1a17419515b1 | 146 | h | C | Tutorial 5 - Game Scene Background/Classes/Definitions.h | harunpehlivan/Cocos2d-x-C-Flappy-Bird-Udemy | a6cf21488f40d6044ac19e90f0704317e3b9654b | [
"Unlicense"
] | 5 | 2017-11-14T09:02:10.000Z | 2020-05-21T23:04:53.000Z | Tutorial 5 - Game Scene Background/Classes/Definitions.h | harunpehlivan/Cocos2d-x-C-Flappy-Bird-Udemy | a6cf21488f40d6044ac19e90f0704317e3b9654b | [
"Unlicense"
] | null | null | null | Tutorial 5 - Game Scene Background/Classes/Definitions.h | harunpehlivan/Cocos2d-x-C-Flappy-Bird-Udemy | a6cf21488f40d6044ac19e90f0704317e3b9654b | [
"Unlicense"
] | 6 | 2017-11-24T03:14:11.000Z | 2019-07-07T06:48:42.000Z | #ifndef __DEFINITIONS_H__
#define __DEFINITIONS_H__
#define DISPLAY_TIME_SPLASH_SCENE 2
#define TRANSITION_TIME 0.5
#endif // __DEFINITIONS_H__
| 18.25 | 35 | 0.842466 |
20b9a34d58596dec5a3980cff02cc093c3dbf736 | 562 | psm1 | PowerShell | CommonTasks/DscResources/WaitForAllNodes/WaitForAllNodes.schema.psm1 | raandree/CommonTasks | 462f645025f3dc407ebf6027f08c32e197f4ef7a | [
"MIT"
] | 22 | 2020-04-21T12:39:14.000Z | 2022-03-16T10:01:51.000Z | CommonTasks/DscResources/WaitForAllNodes/WaitForAllNodes.schema.psm1 | raandree/CommonTasks | 462f645025f3dc407ebf6027f08c32e197f4ef7a | [
"MIT"
] | 31 | 2020-06-18T12:51:48.000Z | 2022-03-22T11:12:35.000Z | CommonTasks/DscResources/WaitForAllNodes/WaitForAllNodes.schema.psm1 | raandree/CommonTasks | 462f645025f3dc407ebf6027f08c32e197f4ef7a | [
"MIT"
] | 27 | 2020-06-23T07:47:13.000Z | 2022-03-11T10:00:26.000Z | configuration WaitForAllNodes {
param (
[Parameter()]
[hashtable[]]
$Items
)
<#
NodeName = [string[]]
ResourceName = [string]
[DependsOn = [string[]]]
[PsDscRunAsCredential = [PSCredential]]
[RetryCount = [UInt32]]
[RetryIntervalSec = [UInt64]]
[ThrottleLimit = [UInt32]]
#>
foreach ($item in $items) {
$executionName = $item.ResourceName
(Get-DscSplattedResource -ResourceName WaitForAll -ExecutionName $executionName -Properties $item -NoInvoke).Invoke($item)
}
}
| 22.48 | 130 | 0.606762 |
fbb206570ff7d310d7811d03977655c9e45b5089 | 294 | java | Java | Singleton/src/singleton/Singleton.java | FGRCL/SOEN344_2020 | 2f0ae25b90158fbd89a6f4025278a5d4633e26d3 | [
"MIT"
] | 11 | 2020-01-14T18:18:03.000Z | 2020-10-28T14:14:03.000Z | Singleton/src/singleton/Singleton.java | FGRCL/SOEN344_2020 | 2f0ae25b90158fbd89a6f4025278a5d4633e26d3 | [
"MIT"
] | null | null | null | Singleton/src/singleton/Singleton.java | FGRCL/SOEN344_2020 | 2f0ae25b90158fbd89a6f4025278a5d4633e26d3 | [
"MIT"
] | 6 | 2020-01-09T18:59:41.000Z | 2022-01-05T17:58:32.000Z | package singleton;
import java.util.Map;
public enum Singleton {
INSTANCE;
private Map<String, String> cache;
public String addToCache(String key, String value) {
return cache.put(key, value);
}
public String getValue(String key) {
return cache.get(key);
}
}
| 16.333333 | 54 | 0.670068 |
022c1e07c97234537c94c2df3c33c8f1db6b501e | 76 | sql | SQL | samples/features/in-memory/ticket-reservations/TicketReservations/dbo/Stored Procedures/Demo_Reset.sql | miyamam/sql-server-samples-JP | 6e44fa46c42beab8d9bda834e03f30f82492d5a8 | [
"MIT"
] | 1 | 2021-01-09T13:37:00.000Z | 2021-01-09T13:37:00.000Z | samples/features/in-memory/ticket-reservations/TicketReservations/dbo/Stored Procedures/Demo_Reset.sql | miyamam/sql-server-samples-JP | 6e44fa46c42beab8d9bda834e03f30f82492d5a8 | [
"MIT"
] | null | null | null | samples/features/in-memory/ticket-reservations/TicketReservations/dbo/Stored Procedures/Demo_Reset.sql | miyamam/sql-server-samples-JP | 6e44fa46c42beab8d9bda834e03f30f82492d5a8 | [
"MIT"
] | 1 | 2021-02-05T23:46:42.000Z | 2021-02-05T23:46:42.000Z |
create proc Demo_Reset
as
TRUNCATE TABLE dbo.TicketReservationDetail;
| 15.2 | 44 | 0.802632 |
c47d93575784790726222c59643136b3e58ce045 | 5,356 | swift | Swift | Yelp/BusinessesViewController.swift | jessicathrasher/yelp-search | b8a53b7a7e100b5874e643dd6a377191ba8f95dc | [
"Apache-2.0"
] | null | null | null | Yelp/BusinessesViewController.swift | jessicathrasher/yelp-search | b8a53b7a7e100b5874e643dd6a377191ba8f95dc | [
"Apache-2.0"
] | 1 | 2017-04-10T06:54:19.000Z | 2017-04-10T06:54:19.000Z | Yelp/BusinessesViewController.swift | jessicathrasher/yelp-search | b8a53b7a7e100b5874e643dd6a377191ba8f95dc | [
"Apache-2.0"
] | null | null | null | //
// BusinessesViewController.swift
// Yelp
//
// Created by Timothy Lee on 4/23/15.
// Copyright (c) 2015 Timothy Lee. All rights reserved.
//
import UIKit
class BusinessesViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, FiltersViewControllerDelegate, UISearchBarDelegate {
@IBOutlet weak var businessesTableView: UITableView!
var businesses: [Business]!
override func viewDidLoad() {
super.viewDidLoad()
let searchBar = UISearchBar()
searchBar.sizeToFit()
navigationItem.titleView = searchBar
searchBar.delegate = self
businessesTableView.dataSource = self
businessesTableView.delegate = self
businessesTableView.rowHeight = UITableViewAutomaticDimension
businessesTableView.estimatedRowHeight = 80
Business.searchWithTerm(term: "", completion: { (businesses: [Business]?, error: Error?) -> Void in
self.businesses = businesses
self.businessesTableView.reloadData()
}
)
/* Example of Yelp search with more search options specified
Business.searchWithTerm("Restaurants", sort: .Distance, categories: ["asianfusion", "burgers"], deals: true) { (businesses: [Business]!, error: NSError!) -> Void in
self.businesses = businesses
for business in businesses {
print(business.name!)
print(business.address!)
}
}
*/
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if let businesses = businesses {
return businesses.count
} else {
return 0
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "BusinessCell", for: indexPath) as! BusinessCell
cell.business = businesses[indexPath.row]
return cell
}
func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
Business.searchWithTerm(term: searchText, completion: { (businesses: [Business]?, error: Error?) -> Void in
self.businesses = businesses
self.businessesTableView.reloadData()
}
)
}
func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) {
searchBar.showsCancelButton = true
}
func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
searchBar.showsCancelButton = false
searchBar.text = ""
searchBar.resignFirstResponder()
Business.searchWithTerm(term: "", completion: { (businesses: [Business]?, error: Error?) -> Void in
self.businesses = businesses
self.businessesTableView.reloadData()
}
)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let navigationController = segue.destination as? UINavigationController {
if let filtersViewController = navigationController.topViewController as? FiltersViewController {
filtersViewController.delegate = self
}
if let mapViewController = navigationController.topViewController as? MapViewController {
mapViewController.businesses = businesses
}
}
}
func filtersViewController(filtersViewController: FiltersViewController, didUpdateFilters filters: [String : AnyObject]) {
// Offer
let offeringDeal = filters["offeringDeal"] as! Bool
// Categories
let categories = filters["categories"] as? [String]
// Sort
let sortFilter = filters["sortFilter"] as? String
var sort = YelpSortMode.bestMatched
if let yelpSort = sortFilter {
switch yelpSort {
case "Distance":
sort = YelpSortMode.distance
case "Highest Rated":
sort = YelpSortMode.highestRated
default:
sort = YelpSortMode.bestMatched
}
}
// Distance
var distance = 0
if let distanceFilter = filters["distanceFilter"] as? String {
switch distanceFilter {
case "0.3 miles":
distance = 482
case "1 mile":
distance = 1609
case "5 miles":
distance = 8046
case "20 miles":
distance = 32186
default:
distance = 0
}
}
Business.searchWithTerm(term: "", sort: sort, categories: categories, deals: offeringDeal, distance: distance, completion: { (businesses: [Business]?, error: Error?) -> Void in
self.businesses = businesses
self.businessesTableView.reloadData()
})
}
}
| 33.267081 | 184 | 0.598394 |
a46cb6728bf368fbdcf626d0be31c01f4fd74e88 | 186 | sql | SQL | mysql/tb_teacher.sql | AunSmile-Orpheus/ThinkPHP5-Project | 8d0615a56e3b0e3f067bdb4ee622fbdb4b89d9d7 | [
"Apache-2.0"
] | 1 | 2021-07-10T19:20:58.000Z | 2021-07-10T19:20:58.000Z | mysql/tb_teacher.sql | AunSmile-Orpheus/ThinkPHP5-Project | 8d0615a56e3b0e3f067bdb4ee622fbdb4b89d9d7 | [
"Apache-2.0"
] | null | null | null | mysql/tb_teacher.sql | AunSmile-Orpheus/ThinkPHP5-Project | 8d0615a56e3b0e3f067bdb4ee622fbdb4b89d9d7 | [
"Apache-2.0"
] | null | null | null | create table tb_teacher(
teacher_id int not null auto_increment,
openid varchar(20) not null,
username varchar(30),
picture varchar(20),
PRIMARY KEY(teacher_id)
)
| 23.25 | 43 | 0.698925 |
5e834e1dfb165e9f3cdef2d0c1aad5c58edd3ab3 | 1,174 | swift | Swift | Sources/YMKit/Extensions/UIKit/UITableView+Extensions.swift | yakovmanshin/YMKit | 6301b4ee5e671c726a66ecc6fce87a6ade488ef3 | [
"Apache-2.0"
] | 3 | 2019-09-04T05:42:25.000Z | 2019-09-14T17:08:30.000Z | Sources/YMKit/Extensions/UIKit/UITableView+Extensions.swift | yakovmanshin/YMKit | 6301b4ee5e671c726a66ecc6fce87a6ade488ef3 | [
"Apache-2.0"
] | 34 | 2019-08-26T23:08:39.000Z | 2021-06-05T10:16:35.000Z | Sources/YMKit/Extensions/UIKit/UITableView+Extensions.swift | yakovmanshin/YMKit | 6301b4ee5e671c726a66ecc6fce87a6ade488ef3 | [
"Apache-2.0"
] | null | null | null | //
// UITableView+Extensions.swift
// YMKit
//
// Created by Yakov Manshin on 7/29/19.
// Copyright © 2019 Yakov Manshin. All rights reserved.
//
import UIKit
// MARK: - Header and Footer Configuration
extension UITableView {
private static func adjustHeight(of view: UIView) {
let targetSize = view.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize)
guard view.frame.size.height != targetSize.height else { return }
view.frame.size.height = targetSize.height
}
/// Automatically adjusts height of the header view to fit the content.
public func adjustHeaderViewHeight() {
guard let headerView = self.tableHeaderView else { return }
UITableView.adjustHeight(of: headerView)
// iOS 9 only
self.layoutIfNeeded()
}
/// Automatically adjusts height of the footer view to fit the content.
public func adjustFooterViewHeight() {
guard let footerView = self.tableFooterView else { return }
UITableView.adjustHeight(of: footerView)
// iOS 9 only
self.layoutIfNeeded()
}
}
| 26.681818 | 89 | 0.643101 |
1801911f146fc92ce2b12244328cbfb84e3bcd47 | 1,956 | dart | Dart | lib/page/widget/widget_page.dart | chenyuecathy/GXFlutterDemo | 31796e24fc872d6e254a34578a3ca9ab26dd04d2 | [
"MIT"
] | null | null | null | lib/page/widget/widget_page.dart | chenyuecathy/GXFlutterDemo | 31796e24fc872d6e254a34578a3ca9ab26dd04d2 | [
"MIT"
] | null | null | null | lib/page/widget/widget_page.dart | chenyuecathy/GXFlutterDemo | 31796e24fc872d6e254a34578a3ca9ab26dd04d2 | [
"MIT"
] | null | null | null | import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong/latlong.dart';
class WidgetPage extends StatefulWidget {
WidgetPage({Key key}) : super(key: key);
_WidgetPageState createState() => _WidgetPageState();
}
class _WidgetPageState extends State<WidgetPage> with AutomaticKeepAliveClientMixin {
var markers = <Marker>[
Marker(
width: 80.0,
height: 80.0,
point: LatLng(51.5, -0.09),
builder: (ctx) => Container(
child: FlutterLogo(),
),
),
Marker(
width: 80.0,
height: 80.0,
point: LatLng(53.3498, -6.2603),
builder: (ctx) => Container(
child: FlutterLogo(
colors: Colors.green,
),
),
),
Marker(
width: 80.0,
height: 80.0,
point: LatLng(48.8566, 2.3522),
builder: (ctx) => Container(
child: FlutterLogo(colors: Colors.purple),
),
),
];
@override
bool get wantKeepAlive => true;
@override
Widget build(BuildContext context) {
return FlutterMap(
options: MapOptions(
center: LatLng(39.9088230000, 116.3974700000),
zoom: 13,
// plugins: [
// MarkerClusterPlugin(),
// ],
),
layers: [
TileLayerOptions(
urlTemplate:
"http://webrd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}",
// urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
// subdomains: ['a', 'b', 'c'],
),
MarkerLayerOptions(
markers: [
Marker(
width: 40,
height: 40,
point: LatLng(39.9088230000, 116.3974700000),
builder: (ctx) => Container(
child: new FlutterLogo(),
),
),
],
),
],
);
}
}
| 25.076923 | 112 | 0.519939 |
2d1fa8af205b89bd99c4e44cf0e4eda47880b050 | 1,636 | sql | SQL | src/main/resources/db/changelog/FMS-1/09-subscribe-details.sql | ivaninkv/flights-meta-subscriber | af30623aa2819da9f01b4533d2293c01dba39441 | [
"MIT"
] | null | null | null | src/main/resources/db/changelog/FMS-1/09-subscribe-details.sql | ivaninkv/flights-meta-subscriber | af30623aa2819da9f01b4533d2293c01dba39441 | [
"MIT"
] | 12 | 2021-12-11T09:54:29.000Z | 2022-01-30T05:48:01.000Z | src/main/resources/db/changelog/FMS-1/09-subscribe-details.sql | ivaninkv/flights-meta-subscriber | af30623aa2819da9f01b4533d2293c01dba39441 | [
"MIT"
] | null | null | null | create table if not exists subscribe_details
(
subscribe_id integer not null
constraint subscribe_details_subscribe_id_fk
references subscribe
on update cascade on delete set null,
id integer not null,
date date,
from_country varchar(3) not null
constraint subscribe_details_country_code_fk
references country
on update cascade on delete set null,
from_city varchar(3) not null,
from_airport varchar(3),
to_country varchar(3) not null
constraint subscribe_details_country_code_fk_2
references country
on update cascade on delete set null,
to_city varchar(3) not null,
to_airport varchar(3),
is_active boolean not null default true,
constraint subscribe_details_pk
primary key (subscribe_id, id),
constraint subscribe_details_airport_country_code_city_code_code_fk
foreign key (from_country, from_city, from_airport) references airport
on update cascade on delete set null,
constraint subscribe_details_airport_country_code_city_code_code_fk_2
foreign key (from_country, from_city, from_airport) references airport
on update cascade on delete set null,
constraint subscribe_details_city_country_code_code_fk
foreign key (from_country, from_city) references city
on update cascade on delete set null,
constraint subscribe_details_city_country_code_code_fk_2
foreign key (from_country, from_city) references city
on update cascade on delete set null
);
| 44.216216 | 78 | 0.708435 |
ccc361bae353c1ca5474b6ec71c9190f4d6cc589 | 743 | asm | Assembly | programs/oeis/312/A312933.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/312/A312933.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/312/A312933.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A312933: Coordination sequence Gal.6.131.3 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; 1,4,9,13,18,22,27,32,36,41,45,50,54,58,63,67,72,76,81,86,90,95,99,104,108,112,117,121,126,130,135,140,144,149,153,158,162,166,171,175,180,184,189,194,198,203,207,212,216,220
mov $2,$0
add $2,1
mov $5,$0
lpb $2,1
mov $0,$5
sub $2,1
sub $0,$2
mov $3,$0
mov $6,$0
lpb $0,1
div $3,2
mov $4,$0
add $6,$0
add $0,4
pow $3,2
sub $3,$0
pow $4,2
add $4,2
sub $4,$6
sub $3,$4
add $3,1
div $3,3
gcd $3,2
mov $0,$3
mov $6,2
lpe
add $0,$6
mul $0,2
mov $6,$0
div $6,2
add $6,1
add $1,$6
lpe
| 20.081081 | 177 | 0.572005 |
76b4d6d952b442a04068f7a89e51cba4677783e9 | 21,071 | asm | Assembly | test_t.asm | GkHabib/OS_Lab_project3 | 3b9b0fe7129ad0153f0636700269a36b2d2f5316 | [
"MIT-0"
] | null | null | null | test_t.asm | GkHabib/OS_Lab_project3 | 3b9b0fe7129ad0153f0636700269a36b2d2f5316 | [
"MIT-0"
] | null | null | null | test_t.asm | GkHabib/OS_Lab_project3 | 3b9b0fe7129ad0153f0636700269a36b2d2f5316 | [
"MIT-0"
] | 1 | 2020-02-22T21:27:08.000Z | 2020-02-22T21:27:08.000Z |
_test_t: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "fcntl.h"
#define NUMOFCHILDS 10
int main(int argc, char const *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 53 push %ebx
e: 51 push %ecx
int pid;
ticketlockinit();
pid = fork();
f: bb 0a 00 00 00 mov $0xa,%ebx
{
14: 83 ec 10 sub $0x10,%esp
ticketlockinit();
17: e8 b6 03 00 00 call 3d2 <ticketlockinit>
pid = fork();
1c: e8 e9 02 00 00 call 30a <fork>
21: 89 45 f4 mov %eax,-0xc(%ebp)
24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for (int i=0; i<NUMOFCHILDS; i++)
{
if(pid > 0) pid = fork();
28: 85 c0 test %eax,%eax
2a: 7e 08 jle 34 <main+0x34>
2c: e8 d9 02 00 00 call 30a <fork>
31: 89 45 f4 mov %eax,-0xc(%ebp)
for (int i=0; i<NUMOFCHILDS; i++)
34: 83 eb 01 sub $0x1,%ebx
37: 75 ef jne 28 <main+0x28>
}
if (pid < 0)
39: 85 c0 test %eax,%eax
3b: 78 6d js aa <main+0xaa>
3d: bb 0a 00 00 00 mov $0xa,%ebx
{
write(2, "fork error!\n", 12);
}
else if (pid == 0)
42: 74 2c je 70 <main+0x70>
44: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
}
else
{
for (int i=0; i<NUMOFCHILDS; i++)
{
wait();
48: e8 cd 02 00 00 call 31a <wait>
for (int i=0; i<NUMOFCHILDS; i++)
4d: 83 eb 01 sub $0x1,%ebx
50: 75 f6 jne 48 <main+0x48>
}
write(1, "program finished!\n", 18);
52: 50 push %eax
53: 6a 12 push $0x12
55: 68 11 04 00 00 push $0x411
5a: 6a 01 push $0x1
5c: e8 d1 02 00 00 call 332 <write>
61: 83 c4 10 add $0x10,%esp
}
return 0;
}
64: 8d 65 f8 lea -0x8(%ebp),%esp
67: 31 c0 xor %eax,%eax
69: 59 pop %ecx
6a: 5b pop %ebx
6b: 5d pop %ebp
6c: 8d 61 fc lea -0x4(%ecx),%esp
6f: c3 ret
write(1, "child", 5);
70: 52 push %edx
71: 6a 05 push $0x5
73: 68 ef 03 00 00 push $0x3ef
78: 6a 01 push $0x1
7a: e8 b3 02 00 00 call 332 <write>
write(1, &pid, 1);
7f: 8d 45 f4 lea -0xc(%ebp),%eax
82: 83 c4 0c add $0xc,%esp
85: 6a 01 push $0x1
87: 50 push %eax
88: 6a 01 push $0x1
8a: e8 a3 02 00 00 call 332 <write>
write(1, "adding to shared number...\n", 46);
8f: 83 c4 0c add $0xc,%esp
92: 6a 2e push $0x2e
94: 68 f5 03 00 00 push $0x3f5
99: 6a 01 push $0x1
9b: e8 92 02 00 00 call 332 <write>
ticketlocktest();
a0: e8 35 03 00 00 call 3da <ticketlocktest>
a5: 83 c4 10 add $0x10,%esp
a8: eb ba jmp 64 <main+0x64>
write(2, "fork error!\n", 12);
aa: 51 push %ecx
ab: 6a 0c push $0xc
ad: 68 e2 03 00 00 push $0x3e2
b2: 6a 02 push $0x2
b4: e8 79 02 00 00 call 332 <write>
b9: 83 c4 10 add $0x10,%esp
bc: eb a6 jmp 64 <main+0x64>
be: 66 90 xchg %ax,%ax
000000c0 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
c0: 55 push %ebp
c1: 89 e5 mov %esp,%ebp
c3: 53 push %ebx
c4: 8b 45 08 mov 0x8(%ebp),%eax
c7: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
ca: 89 c2 mov %eax,%edx
cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
d0: 83 c1 01 add $0x1,%ecx
d3: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
d7: 83 c2 01 add $0x1,%edx
da: 84 db test %bl,%bl
dc: 88 5a ff mov %bl,-0x1(%edx)
df: 75 ef jne d0 <strcpy+0x10>
;
return os;
}
e1: 5b pop %ebx
e2: 5d pop %ebp
e3: c3 ret
e4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
ea: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
000000f0 <strcmp>:
int
strcmp(const char *p, const char *q)
{
f0: 55 push %ebp
f1: 89 e5 mov %esp,%ebp
f3: 53 push %ebx
f4: 8b 55 08 mov 0x8(%ebp),%edx
f7: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
fa: 0f b6 02 movzbl (%edx),%eax
fd: 0f b6 19 movzbl (%ecx),%ebx
100: 84 c0 test %al,%al
102: 75 1c jne 120 <strcmp+0x30>
104: eb 2a jmp 130 <strcmp+0x40>
106: 8d 76 00 lea 0x0(%esi),%esi
109: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
110: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
113: 0f b6 02 movzbl (%edx),%eax
p++, q++;
116: 83 c1 01 add $0x1,%ecx
119: 0f b6 19 movzbl (%ecx),%ebx
while(*p && *p == *q)
11c: 84 c0 test %al,%al
11e: 74 10 je 130 <strcmp+0x40>
120: 38 d8 cmp %bl,%al
122: 74 ec je 110 <strcmp+0x20>
return (uchar)*p - (uchar)*q;
124: 29 d8 sub %ebx,%eax
}
126: 5b pop %ebx
127: 5d pop %ebp
128: c3 ret
129: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
130: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
132: 29 d8 sub %ebx,%eax
}
134: 5b pop %ebx
135: 5d pop %ebp
136: c3 ret
137: 89 f6 mov %esi,%esi
139: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000140 <strlen>:
uint
strlen(const char *s)
{
140: 55 push %ebp
141: 89 e5 mov %esp,%ebp
143: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
146: 80 39 00 cmpb $0x0,(%ecx)
149: 74 15 je 160 <strlen+0x20>
14b: 31 d2 xor %edx,%edx
14d: 8d 76 00 lea 0x0(%esi),%esi
150: 83 c2 01 add $0x1,%edx
153: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
157: 89 d0 mov %edx,%eax
159: 75 f5 jne 150 <strlen+0x10>
;
return n;
}
15b: 5d pop %ebp
15c: c3 ret
15d: 8d 76 00 lea 0x0(%esi),%esi
for(n = 0; s[n]; n++)
160: 31 c0 xor %eax,%eax
}
162: 5d pop %ebp
163: c3 ret
164: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
16a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000170 <memset>:
void*
memset(void *dst, int c, uint n)
{
170: 55 push %ebp
171: 89 e5 mov %esp,%ebp
173: 57 push %edi
174: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
177: 8b 4d 10 mov 0x10(%ebp),%ecx
17a: 8b 45 0c mov 0xc(%ebp),%eax
17d: 89 d7 mov %edx,%edi
17f: fc cld
180: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
182: 89 d0 mov %edx,%eax
184: 5f pop %edi
185: 5d pop %ebp
186: c3 ret
187: 89 f6 mov %esi,%esi
189: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000190 <strchr>:
char*
strchr(const char *s, char c)
{
190: 55 push %ebp
191: 89 e5 mov %esp,%ebp
193: 53 push %ebx
194: 8b 45 08 mov 0x8(%ebp),%eax
197: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
19a: 0f b6 10 movzbl (%eax),%edx
19d: 84 d2 test %dl,%dl
19f: 74 1d je 1be <strchr+0x2e>
if(*s == c)
1a1: 38 d3 cmp %dl,%bl
1a3: 89 d9 mov %ebx,%ecx
1a5: 75 0d jne 1b4 <strchr+0x24>
1a7: eb 17 jmp 1c0 <strchr+0x30>
1a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1b0: 38 ca cmp %cl,%dl
1b2: 74 0c je 1c0 <strchr+0x30>
for(; *s; s++)
1b4: 83 c0 01 add $0x1,%eax
1b7: 0f b6 10 movzbl (%eax),%edx
1ba: 84 d2 test %dl,%dl
1bc: 75 f2 jne 1b0 <strchr+0x20>
return (char*)s;
return 0;
1be: 31 c0 xor %eax,%eax
}
1c0: 5b pop %ebx
1c1: 5d pop %ebp
1c2: c3 ret
1c3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
1c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000001d0 <gets>:
char*
gets(char *buf, int max)
{
1d0: 55 push %ebp
1d1: 89 e5 mov %esp,%ebp
1d3: 57 push %edi
1d4: 56 push %esi
1d5: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
1d6: 31 f6 xor %esi,%esi
1d8: 89 f3 mov %esi,%ebx
{
1da: 83 ec 1c sub $0x1c,%esp
1dd: 8b 7d 08 mov 0x8(%ebp),%edi
for(i=0; i+1 < max; ){
1e0: eb 2f jmp 211 <gets+0x41>
1e2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
cc = read(0, &c, 1);
1e8: 8d 45 e7 lea -0x19(%ebp),%eax
1eb: 83 ec 04 sub $0x4,%esp
1ee: 6a 01 push $0x1
1f0: 50 push %eax
1f1: 6a 00 push $0x0
1f3: e8 32 01 00 00 call 32a <read>
if(cc < 1)
1f8: 83 c4 10 add $0x10,%esp
1fb: 85 c0 test %eax,%eax
1fd: 7e 1c jle 21b <gets+0x4b>
break;
buf[i++] = c;
1ff: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
203: 83 c7 01 add $0x1,%edi
206: 88 47 ff mov %al,-0x1(%edi)
if(c == '\n' || c == '\r')
209: 3c 0a cmp $0xa,%al
20b: 74 23 je 230 <gets+0x60>
20d: 3c 0d cmp $0xd,%al
20f: 74 1f je 230 <gets+0x60>
for(i=0; i+1 < max; ){
211: 83 c3 01 add $0x1,%ebx
214: 3b 5d 0c cmp 0xc(%ebp),%ebx
217: 89 fe mov %edi,%esi
219: 7c cd jl 1e8 <gets+0x18>
21b: 89 f3 mov %esi,%ebx
break;
}
buf[i] = '\0';
return buf;
}
21d: 8b 45 08 mov 0x8(%ebp),%eax
buf[i] = '\0';
220: c6 03 00 movb $0x0,(%ebx)
}
223: 8d 65 f4 lea -0xc(%ebp),%esp
226: 5b pop %ebx
227: 5e pop %esi
228: 5f pop %edi
229: 5d pop %ebp
22a: c3 ret
22b: 90 nop
22c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
230: 8b 75 08 mov 0x8(%ebp),%esi
233: 8b 45 08 mov 0x8(%ebp),%eax
236: 01 de add %ebx,%esi
238: 89 f3 mov %esi,%ebx
buf[i] = '\0';
23a: c6 03 00 movb $0x0,(%ebx)
}
23d: 8d 65 f4 lea -0xc(%ebp),%esp
240: 5b pop %ebx
241: 5e pop %esi
242: 5f pop %edi
243: 5d pop %ebp
244: c3 ret
245: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
249: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000250 <stat>:
int
stat(const char *n, struct stat *st)
{
250: 55 push %ebp
251: 89 e5 mov %esp,%ebp
253: 56 push %esi
254: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
255: 83 ec 08 sub $0x8,%esp
258: 6a 00 push $0x0
25a: ff 75 08 pushl 0x8(%ebp)
25d: e8 f0 00 00 00 call 352 <open>
if(fd < 0)
262: 83 c4 10 add $0x10,%esp
265: 85 c0 test %eax,%eax
267: 78 27 js 290 <stat+0x40>
return -1;
r = fstat(fd, st);
269: 83 ec 08 sub $0x8,%esp
26c: ff 75 0c pushl 0xc(%ebp)
26f: 89 c3 mov %eax,%ebx
271: 50 push %eax
272: e8 f3 00 00 00 call 36a <fstat>
close(fd);
277: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
27a: 89 c6 mov %eax,%esi
close(fd);
27c: e8 b9 00 00 00 call 33a <close>
return r;
281: 83 c4 10 add $0x10,%esp
}
284: 8d 65 f8 lea -0x8(%ebp),%esp
287: 89 f0 mov %esi,%eax
289: 5b pop %ebx
28a: 5e pop %esi
28b: 5d pop %ebp
28c: c3 ret
28d: 8d 76 00 lea 0x0(%esi),%esi
return -1;
290: be ff ff ff ff mov $0xffffffff,%esi
295: eb ed jmp 284 <stat+0x34>
297: 89 f6 mov %esi,%esi
299: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000002a0 <atoi>:
int
atoi(const char *s)
{
2a0: 55 push %ebp
2a1: 89 e5 mov %esp,%ebp
2a3: 53 push %ebx
2a4: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
2a7: 0f be 11 movsbl (%ecx),%edx
2aa: 8d 42 d0 lea -0x30(%edx),%eax
2ad: 3c 09 cmp $0x9,%al
n = 0;
2af: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
2b4: 77 1f ja 2d5 <atoi+0x35>
2b6: 8d 76 00 lea 0x0(%esi),%esi
2b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
2c0: 8d 04 80 lea (%eax,%eax,4),%eax
2c3: 83 c1 01 add $0x1,%ecx
2c6: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
while('0' <= *s && *s <= '9')
2ca: 0f be 11 movsbl (%ecx),%edx
2cd: 8d 5a d0 lea -0x30(%edx),%ebx
2d0: 80 fb 09 cmp $0x9,%bl
2d3: 76 eb jbe 2c0 <atoi+0x20>
return n;
}
2d5: 5b pop %ebx
2d6: 5d pop %ebp
2d7: c3 ret
2d8: 90 nop
2d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000002e0 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
2e0: 55 push %ebp
2e1: 89 e5 mov %esp,%ebp
2e3: 56 push %esi
2e4: 53 push %ebx
2e5: 8b 5d 10 mov 0x10(%ebp),%ebx
2e8: 8b 45 08 mov 0x8(%ebp),%eax
2eb: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
2ee: 85 db test %ebx,%ebx
2f0: 7e 14 jle 306 <memmove+0x26>
2f2: 31 d2 xor %edx,%edx
2f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
2f8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
2fc: 88 0c 10 mov %cl,(%eax,%edx,1)
2ff: 83 c2 01 add $0x1,%edx
while(n-- > 0)
302: 39 d3 cmp %edx,%ebx
304: 75 f2 jne 2f8 <memmove+0x18>
return vdst;
}
306: 5b pop %ebx
307: 5e pop %esi
308: 5d pop %ebp
309: c3 ret
0000030a <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
30a: b8 01 00 00 00 mov $0x1,%eax
30f: cd 40 int $0x40
311: c3 ret
00000312 <exit>:
SYSCALL(exit)
312: b8 02 00 00 00 mov $0x2,%eax
317: cd 40 int $0x40
319: c3 ret
0000031a <wait>:
SYSCALL(wait)
31a: b8 03 00 00 00 mov $0x3,%eax
31f: cd 40 int $0x40
321: c3 ret
00000322 <pipe>:
SYSCALL(pipe)
322: b8 04 00 00 00 mov $0x4,%eax
327: cd 40 int $0x40
329: c3 ret
0000032a <read>:
SYSCALL(read)
32a: b8 05 00 00 00 mov $0x5,%eax
32f: cd 40 int $0x40
331: c3 ret
00000332 <write>:
SYSCALL(write)
332: b8 10 00 00 00 mov $0x10,%eax
337: cd 40 int $0x40
339: c3 ret
0000033a <close>:
SYSCALL(close)
33a: b8 15 00 00 00 mov $0x15,%eax
33f: cd 40 int $0x40
341: c3 ret
00000342 <kill>:
SYSCALL(kill)
342: b8 06 00 00 00 mov $0x6,%eax
347: cd 40 int $0x40
349: c3 ret
0000034a <exec>:
SYSCALL(exec)
34a: b8 07 00 00 00 mov $0x7,%eax
34f: cd 40 int $0x40
351: c3 ret
00000352 <open>:
SYSCALL(open)
352: b8 0f 00 00 00 mov $0xf,%eax
357: cd 40 int $0x40
359: c3 ret
0000035a <mknod>:
SYSCALL(mknod)
35a: b8 11 00 00 00 mov $0x11,%eax
35f: cd 40 int $0x40
361: c3 ret
00000362 <unlink>:
SYSCALL(unlink)
362: b8 12 00 00 00 mov $0x12,%eax
367: cd 40 int $0x40
369: c3 ret
0000036a <fstat>:
SYSCALL(fstat)
36a: b8 08 00 00 00 mov $0x8,%eax
36f: cd 40 int $0x40
371: c3 ret
00000372 <link>:
SYSCALL(link)
372: b8 13 00 00 00 mov $0x13,%eax
377: cd 40 int $0x40
379: c3 ret
0000037a <mkdir>:
SYSCALL(mkdir)
37a: b8 14 00 00 00 mov $0x14,%eax
37f: cd 40 int $0x40
381: c3 ret
00000382 <chdir>:
SYSCALL(chdir)
382: b8 09 00 00 00 mov $0x9,%eax
387: cd 40 int $0x40
389: c3 ret
0000038a <dup>:
SYSCALL(dup)
38a: b8 0a 00 00 00 mov $0xa,%eax
38f: cd 40 int $0x40
391: c3 ret
00000392 <getpid>:
SYSCALL(getpid)
392: b8 0b 00 00 00 mov $0xb,%eax
397: cd 40 int $0x40
399: c3 ret
0000039a <sbrk>:
SYSCALL(sbrk)
39a: b8 0c 00 00 00 mov $0xc,%eax
39f: cd 40 int $0x40
3a1: c3 ret
000003a2 <sleep>:
SYSCALL(sleep)
3a2: b8 0d 00 00 00 mov $0xd,%eax
3a7: cd 40 int $0x40
3a9: c3 ret
000003aa <uptime>:
SYSCALL(uptime)
3aa: b8 0e 00 00 00 mov $0xe,%eax
3af: cd 40 int $0x40
3b1: c3 ret
000003b2 <invoked_syscalls>:
SYSCALL(invoked_syscalls)
3b2: b8 16 00 00 00 mov $0x16,%eax
3b7: cd 40 int $0x40
3b9: c3 ret
000003ba <sort_syscalls>:
SYSCALL(sort_syscalls)
3ba: b8 17 00 00 00 mov $0x17,%eax
3bf: cd 40 int $0x40
3c1: c3 ret
000003c2 <get_count>:
SYSCALL(get_count)
3c2: b8 18 00 00 00 mov $0x18,%eax
3c7: cd 40 int $0x40
3c9: c3 ret
000003ca <log_syscalls>:
SYSCALL(log_syscalls)
3ca: b8 19 00 00 00 mov $0x19,%eax
3cf: cd 40 int $0x40
3d1: c3 ret
000003d2 <ticketlockinit>:
SYSCALL(ticketlockinit)
3d2: b8 1a 00 00 00 mov $0x1a,%eax
3d7: cd 40 int $0x40
3d9: c3 ret
000003da <ticketlocktest>:
SYSCALL(ticketlocktest)
3da: b8 1b 00 00 00 mov $0x1b,%eax
3df: cd 40 int $0x40
3e1: c3 ret
| 31.449254 | 58 | 0.412937 |
85cdb772e3be2fd24cb1a0e7275720dea09164f3 | 3,003 | js | JavaScript | node_modules/koa-generic-session-mongo/tests/test.js | lanzhi/program-three | af7c2ccbb5fa198364ba1a238e236086f09957ca | [
"MIT"
] | null | null | null | node_modules/koa-generic-session-mongo/tests/test.js | lanzhi/program-three | af7c2ccbb5fa198364ba1a238e236086f09957ca | [
"MIT"
] | null | null | null | node_modules/koa-generic-session-mongo/tests/test.js | lanzhi/program-three | af7c2ccbb5fa198364ba1a238e236086f09957ca | [
"MIT"
] | null | null | null | 'use strict';
import {MongoClient} from 'mongodb';
import MongoStore from '../src/store';
import thunkify from 'thunkify';
const clone = (obj) => {
return JSON.parse(JSON.stringify(obj));
};
const describeStore = (msg, storeOptions, options={}) => {
const {cleanDb=false} = options;
let store;
describe(msg, function() {
const sess = {cookie: {maxAge: 2000}, name: 'name'};
before(function (done) {
store = new MongoStore(typeof storeOptions === 'function' ? storeOptions() : storeOptions)
.on('connect', function (conn) {
cleanDb && conn.db.dropDatabase();
done();
})
.on('error', done);
});
it('should save session to db', function *() {
const result = yield store.set('123', clone(sess));
//noinspection BadExpressionStatementJS
expect(result).to.be.ok;
});
it('should return saved session', function *() {
const result = yield store.get('123');
expect(result).to.deep.equal(sess);
});
it('should destroy session', function *() {
yield store.destroy('123');
const result = yield store.get('123');
//noinspection BadExpressionStatementJS
expect(result).to.not.ok;
});
});
};
describeStore('store from url', {url: 'mongodb://127.0.0.1:27017/test'}, {cleanDb: true});
describe('test auth', function() {
let db;
before(function *() {
db = yield thunkify(MongoClient.connect)('mongodb://127.0.0.1:27017/testauth');
});
it('should add user', function *() {
try {
yield thunkify(db.removeUser.bind(db))('han');
} catch (err) {
//skip error
}
let user = yield thunkify(db.addUser.bind(db))('han', 'solo');
});
describeStore('store from db object', () => {return {db}}, {cleanDb: true});
describeStore('auth store', {user: 'han', password: 'solo', db: 'testauth'});
});
describe('closed db', function() {
let db, store;
before(function *() {
db = yield thunkify(MongoClient.connect)('mongodb://127.0.0.1:27017/test');
yield thunkify(db.close.bind(db))();
store = new MongoStore({db})
});
it('should crush', function *() {
let throwsError;
try {
yield store.get('123');
} catch (err) {
throwsError = true;
}
assert(throwsError, 'should throw error');
});
});
describe('url info exclusive', function () {
it('should fail if host and url provided', function *() {
assert.throw(() => {new MongoStore({url: 'mongodb://127.0.0.1:27017', host: 'localhost'})});
});
it('should fail if port and url provided', function *() {
assert.throw(() => {new MongoStore({url: 'mongodb://127.0.0.1:27017', port: '27017'})});
});
it('should fail if db and url provided', function *() {
assert.throw(() => {new MongoStore({url: 'mongodb://127.0.0.1:27017', db: 'admin'})});
});
it('should fail if ssl and url provided', function *() {
assert.throw(() => {new MongoStore({url: 'mongodb://127.0.0.1:27017', ssl: true})});
});
});
| 28.6 | 96 | 0.59707 |
a534a76c4d2d86324b2333006977229bc2dca7a5 | 4,193 | asm | Assembly | animal3D SDK/source/animal3D-A3DM/a3math/a3sqrt_a.asm | connorramsden/advanced-realtime-rendering | 973c23816093a22fc4f30de512df832a30ae75d6 | [
"Apache-2.0"
] | 1 | 2021-02-11T22:40:47.000Z | 2021-02-11T22:40:47.000Z | animal3D SDK/source/animal3D-A3DM/a3math/a3sqrt_a.asm | connorramsden/advanced-realtime-rendering | 973c23816093a22fc4f30de512df832a30ae75d6 | [
"Apache-2.0"
] | null | null | null | animal3D SDK/source/animal3D-A3DM/a3math/a3sqrt_a.asm | connorramsden/advanced-realtime-rendering | 973c23816093a22fc4f30de512df832a30ae75d6 | [
"Apache-2.0"
] | null | null | null | COMMENT @
/*
Copyright 2011-2021 Daniel S. Buckstein
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.
*/
/*
animal3D SDK: Minimal 3D Animation Framework
animal3D Math (A3DM) SDK
By Daniel S. Buckstein
a3sqrt_a.asm
Assembly definitions of ultra fast sqrt function for all configs.
Help:
https://stackoverflow.com/questions/4548763/compiling-assembly-in-visual-studio
http://lallouslab.net/2016/01/11/introduction-to-writing-x64-assembly-in-visual-studio/
http://rayseyfarth.com/asm/pdf/ch11-floating-point.pdf
Info:
<op>ss scalar single: one float in the register (quarter of xmm [e.g. xmm0])
<op>ps packed single: four floats in the register (all of xmm)
<op>sd scalar double: one double in the register (half of xmm)
<op>pd packed double: two doubles in the register (all of xmm)
THIS CODE IS ASSEMBLED USING THE ASSEMBLER...
WINDOWS: masm
LINUX: nasm, clang, as (new); (could use gas)
MAC: clang; gcc is deprecated
Summary:
-add ASM file to project
-right click project > build dependencies > build customizations
-enable MASM
-right click ASM file > properties > item type > microsoft macro assembler
*/
@
;//////////////////////////////////////////////////////////////////////////////
; 64-bit defined if rax register exists
IFDEF RAX
.data
one EQU 1.0 ; effectively the same as define macro
fs1 dd one ; constant single (float) set to 1
fd1 dq one ; constant double set to 1
.code
a3sqrtf PROC
sqrtss xmm0, xmm0 ; do scalar single sqrt on xmm0 (already contains arg from function setup)
ret ; exit function
a3sqrtf ENDP
a3sqrtfInverse PROC
; rsqrt is handy but does not give correct result; only ss available
; rsqrtss xmm0, xmm0 ; do scalar single recip sqrt on xmm0
; result is not correct with recip either, closer when recip is first; only ss available
; rcpss xmm0, xmm0 ; do reciprocal on xmm0
; DO RECIP MANUALLY
movss xmm1, [fs1] ; copy constant to register xmm1
divss xmm1, xmm0 ; do reciprocal of xmm0, store in xmm1
sqrtss xmm0, xmm1 ; do scalar single sqrt on xmm1, store in xmm0
ret ; exit
a3sqrtfInverse ENDP
a3sqrtd PROC
sqrtsd xmm0, xmm0 ; do scalar double sqrt on xmm0
ret ; exit function
a3sqrtd ENDP
a3sqrtdInverse PROC
movsd xmm1, [fd1] ; copy constant to register xmm1
divsd xmm1, xmm0 ; do reciprocal of xmm0, store in xmm1
sqrtsd xmm0, xmm1 ; do scalar double sqrt on xmm1, store in xmm0
ret ; exit
a3sqrtdInverse ENDP
;//////////////////////////////////////////////////////////////////////////////
; 32-bit
ELSE ; !RAX
.model flat, c
.code
a3sqrtf PROC
fld dword ptr [esp+4] ; load input to float stack (st0) as float (int size); arg is 4 bytes past return address (which is int size)
fsqrt ; do sqrt on top of float stack (st0)
ret ; exit function
a3sqrtf ENDP
a3sqrtfInverse PROC
fld1 ; load 1 to float stack (st0)
fld dword ptr [esp+4] ; load input to float stack (st0), pushes previously loaded '1' to st1
fdivp ; divide st1 by st0, store in st1 and pop
fsqrt ; do sqrt on top of stack
ret ; exit
a3sqrtfInverse ENDP
a3sqrtd PROC
fld qword ptr [esp+4] ; load input to float stack (st0) as double (large int size)
fsqrt ; do sqrt on top of float stack (st0)
ret ; exit function
a3sqrtd ENDP
a3sqrtdInverse PROC
fld1 ; load 1 to float stack (st0)
fld qword ptr [esp+4] ; load input to float stack (st0), pushes previously loaded '1' to st1
fdivp ; divide st1 by st0, store in st1 and pop
fsqrt ; do sqrt on top of stack
ret ; exit
a3sqrtdInverse ENDP
;//////////////////////////////////////////////////////////////////////////////
; done
ENDIF
; required at end (no newline)
END | 31.291045 | 133 | 0.680897 |
0bb772b71b62deb036a62cbbe9b4a26f66b35b31 | 3,722 | sql | SQL | CareDB/Scripts.sql | vash47/care-app | e0ebbf3b8ef7b07267cb4ce7023e3fcf1a7f1c15 | [
"Apache-2.0"
] | 1 | 2020-07-06T15:19:17.000Z | 2020-07-06T15:19:17.000Z | CareDB/Scripts.sql | gpuma/care-app | e0ebbf3b8ef7b07267cb4ce7023e3fcf1a7f1c15 | [
"Apache-2.0"
] | null | null | null | CareDB/Scripts.sql | gpuma/care-app | e0ebbf3b8ef7b07267cb4ce7023e3fcf1a7f1c15 | [
"Apache-2.0"
] | null | null | null | INSERT [dbo].[Usuario] ([Nombre], [Apellido], [Username], [Password], [Tipo], [Cuidante], [Telefono]) VALUES (N'Rocío', N'Puma', N'chio', N'chio', 0, N'vash', N'+51054470160')
GO
INSERT [dbo].[Usuario] ([Nombre], [Apellido], [Username], [Password], [Tipo], [Cuidante], [Telefono]) VALUES (N'Elvis', N'Puma', N'elvis', N'elvis', 0, N'vash', N'+51054470160')
GO
INSERT [dbo].[Usuario] ([Nombre], [Apellido], [Username], [Password], [Tipo], [Cuidante], [Telefono]) VALUES (N'Hernán', N'Puma', N'hernan', N'hernan', 0, N'vash', N'+51054470160')
GO
INSERT [dbo].[Usuario] ([Nombre], [Apellido], [Username], [Password], [Tipo], [Cuidante], [Telefono]) VALUES (N'juanito', N'perez', N'juan', N'juan', 1, NULL, N'12312')
GO
INSERT [dbo].[Usuario] ([Nombre], [Apellido], [Username], [Password], [Tipo], [Cuidante], [Telefono]) VALUES (N'pedrito', N'yepez', N'pedro', N'pdero', 0, N'juan', N'69')
GO
INSERT [dbo].[Usuario] ([Nombre], [Apellido], [Username], [Password], [Tipo], [Cuidante], [Telefono]) VALUES (N'Silvia', N'Tejada', N'silvia', N'silvia', 0, N'vash', N'+51958554460')
GO
INSERT [dbo].[Usuario] ([Nombre], [Apellido], [Username], [Password], [Tipo], [Cuidante], [Telefono]) VALUES (N'hector', N'beltran', N'thor', N'thor', 1, NULL, N'666')
GO
INSERT [dbo].[Usuario] ([Nombre], [Apellido], [Username], [Password], [Tipo], [Cuidante], [Telefono]) VALUES (N'Gustavo', N'Puma', N'vash', N'vash', 1, NULL, N'+51921302769')
GO
select * from TipoEmergencia
delete from TipoEmergencia
insert into TipoEmergencia values(0,'ProximidadPorPeriodo','Emergencia por proximidad')
insert into TipoEmergencia values(1,'ProximidadPorPeriodoAHora','Emergencia por proximidad a hora')
insert into TipoEmergencia values(2,'CruceRapido','Emergencia por cruce rápido')
insert into TipoEmergencia values(3,'CruceIncompleto','Emergencia por cruce incompleto')
insert into Usuario values ('Gustavo','Puma','vash','vash',1,'vash','+51921302769')
insert into Usuario values ('Elvis','Puma','elvis','elvis',0,'vash','+51054470160')
insert into Usuario values ('Rocío','Puma','chio','chio',0,'vash','+51054470160')
insert into Usuario values ('Hernán','Puma','hernan','hernan',0,'vash','+51054470160')
insert into Usuario values ('Silvia','Tejada','silvia','silvia',0,'vash','+51958554460')
select * from Configuracion
insert into Configuracion values (1,'chio',0,28927,null,1,2000,'baño')
insert into Configuracion values (2,'chio',2,40796,53847,1,10000,'escaleras')
declare @p1 int
set @p1=59
exec sp_prepexec @p1 output,N'@P1 nvarchar(19),@P2 int,@P3 nvarchar(3),@P4 int,@P5 int,@P6 int,@P7 int,@P8 nvarchar(6)',N'SELECT TOP 1 [Configuracion].[Id] AS [Configuracion_Id], [Configuracion].[Paciente] AS [Configuracion_Paciente], [Configuracion].[Tipo] AS [Configuracion_Tipo], [Configuracion].[BeaconId1] AS [Configuracion_BeaconId1], [Configuracion].[BeaconId2] AS [Configuracion_BeaconId2], [Configuracion].[Rango] AS [Configuracion_Rango], [Configuracion].[Tiempo] AS [Configuracion_Tiempo], [Configuracion].[Nombre] AS [Configuracion_Nombre], [Configuracion].[Hora] AS [Configuracion_Hora] FROM [Configuracion] WHERE [Configuracion].[Hora] = @P1 AND [Configuracion].[Tiempo] = @P2 AND [Configuracion].[Paciente] = @P3 AND [Configuracion].[Tipo] = @P4 AND [Configuracion].[BeaconId1] = @P5 AND [Configuracion].[BeaconId2] = @P6 AND [Configuracion].[Rango] = @P7 AND [Configuracion].[Nombre] = @P8',N'0001-01-01T00:00:00',10000,N'emi',0,40796,0,1,N'prueba'
select @p1
go
select * from Configuracion
delete from Configuracion
select * from Usuario
update Usuario where Username
update Configuracion set Paciente= 'silvia' where nombre='prueba'
delete from Usuario
insert into Configuracion values ('emi',0,40796,null,0,10,'prueba', null)
| 74.44 | 964 | 0.709833 |
045dbabd9e423e6164aec3e3a3dd886bf6e97959 | 3,571 | java | Java | app/src/main/java/com/lemon/reader/api/UriHelper.java | flylzd/RelaxedReader | 8e8738a78e05a04b2b1d65cb92831c643ae342f8 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/lemon/reader/api/UriHelper.java | flylzd/RelaxedReader | 8e8738a78e05a04b2b1d65cb92831c643ae342f8 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/lemon/reader/api/UriHelper.java | flylzd/RelaxedReader | 8e8738a78e05a04b2b1d65cb92831c643ae342f8 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright (c) 2015 [1076559197@qq.com | tchen0707@gmail.com]
*
* Licensed under the Apache License, Version 2.0 (the "License”);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.lemon.reader.api;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
public class UriHelper {
private static volatile UriHelper instance = null;
/**
* 20 datas per page
*/
public static final int PAGE_LIMIT = 20;
public static final String URL_MUSICS_LIST_CHANNEL_ID = "0";
private UriHelper() {
}
public static UriHelper getInstance() {
if (null == instance) {
synchronized (UriHelper.class) {
if (null == instance) {
instance = new UriHelper();
}
}
}
return instance;
}
public int calculateTotalPages(int totalNumber) {
if (totalNumber > 0) {
return totalNumber % PAGE_LIMIT != 0 ? (totalNumber / PAGE_LIMIT + 1) : totalNumber / PAGE_LIMIT;
} else {
return 0;
}
}
public String getImagesListUrl(String category, int pageNum) {
StringBuffer sb = new StringBuffer();
sb.append(ApiConstants.Urls.BAIDU_IMAGES_URLS);
sb.append("?col=");
try {
sb.append(URLEncoder.encode(category, "UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
sb.append("&tag=");
try {
sb.append(URLEncoder.encode("全部", "UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
sb.append("&pn=");
sb.append(pageNum * PAGE_LIMIT);
sb.append("&rn=");
sb.append(PAGE_LIMIT);
sb.append("&from=1");
return sb.toString();
}
public String getVideosListUrl(String category, int pageNum) {
StringBuffer sb = new StringBuffer();
sb.append(ApiConstants.Urls.YOUKU_VIDEOS_URLS);
sb.append("?keyword=");
try {
sb.append(URLEncoder.encode(category, "UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
sb.append("&page=");
sb.append(pageNum);
sb.append("&count=");
sb.append(PAGE_LIMIT);
sb.append("&public_type=all&paid=0&period=today&orderby=published&client_id=6ecd6970268b4c53");
return sb.toString().trim();
}
public String getVideoUserUrl(int userId) {
StringBuffer sb = new StringBuffer();
sb.append(ApiConstants.Urls.YOUKU_USER_URLS);
sb.append("?user_id=");
sb.append(userId);
sb.append("&client_id=6ecd6970268b4c53");
return sb.toString().trim();
}
public String getDoubanPlayListUrl(String channelId) {
StringBuffer sb = new StringBuffer();
sb.append(ApiConstants.Urls.DOUBAN_PLAY_LIST_URLS);
sb.append("?channel=");
sb.append(channelId);
sb.append("&app_name=radio_desktop_win&version=100&type=&sid=0");
return sb.toString().trim();
}
}
| 31.60177 | 109 | 0.611033 |
90ce7724a71b2e126bf75be62b6855badf85103c | 34,742 | py | Python | train.py | malarinv/seq2seq-keyphrase-pytorch | 14350477867bbaafe285d6ac0e7a814f4cda1bdf | [
"Apache-2.0"
] | 1 | 2018-12-24T05:53:07.000Z | 2018-12-24T05:53:07.000Z | train.py | malarinv/seq2seq-keyphrase-pytorch | 14350477867bbaafe285d6ac0e7a814f4cda1bdf | [
"Apache-2.0"
] | null | null | null | train.py | malarinv/seq2seq-keyphrase-pytorch | 14350477867bbaafe285d6ac0e7a814f4cda1bdf | [
"Apache-2.0"
] | 1 | 2018-12-24T05:40:41.000Z | 2018-12-24T05:40:41.000Z | # -*- coding: utf-8 -*-
"""
Python File Template
"""
import json
import os
import logging
import numpy as np
from torch.optim import Adam
import evaluate
import utils
import copy
import torch
from beam_search import SequenceGenerator
from evaluate import evaluate_beam_search, get_match_result, self_redundancy
from pykp.dataloader import KeyphraseDataLoader
from utils import Progbar, plot_learning_curve_and_write_csv
from config import init_logging, init_opt
import pykp
from pykp.io import KeyphraseDataset
from pykp.model import Seq2SeqLSTMAttention, Seq2SeqLSTMAttentionCascading
import time
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()
def to_cpu_list(input):
assert isinstance(input, list)
output = [int(item.data.cpu().numpy()) for item in input]
return output
def time_usage(func):
# argnames = func.func_code.co_varnames[:func.func_code.co_argcount]
fname = func.__name__
def wrapper(*args, **kwargs):
beg_ts = time.time()
retval = func(*args, **kwargs)
end_ts = time.time()
print(fname, "elapsed time: %f" % (end_ts - beg_ts))
return retval
return wrapper
__author__ = "Rui Meng"
__email__ = "rui.meng@pitt.edu"
@time_usage
def _valid_error(data_loader, model, criterion, epoch, opt):
progbar = Progbar(title='Validating', target=len(data_loader), batch_size=data_loader.batch_size,
total_examples=len(data_loader.dataset))
model.eval()
losses = []
# Note that the data should be shuffled every time
for i, batch in enumerate(data_loader):
# if i >= 100:
# break
one2many_batch, one2one_batch = batch
src, trg, trg_target, trg_copy_target, src_ext, oov_lists = one2one_batch
if torch.cuda.is_available():
src = src.cuda()
trg = trg.cuda()
trg_target = trg_target.cuda()
trg_copy_target = trg_copy_target.cuda()
src_ext = src_ext.cuda()
decoder_log_probs, _, _ = model.forward(src, trg, src_ext)
if not opt.copy_attention:
loss = criterion(
decoder_log_probs.contiguous().view(-1, opt.vocab_size),
trg_target.contiguous().view(-1)
)
else:
loss = criterion(
decoder_log_probs.contiguous().view(-1, opt.vocab_size + opt.max_unk_words),
trg_copy_target.contiguous().view(-1)
)
losses.append(loss.data[0])
progbar.update(epoch, i, [('valid_loss', loss.data[0]), ('PPL', loss.data[0])])
return losses
def train_ml(one2one_batch, model, optimizer, criterion, opt):
src, src_len, trg, trg_target, trg_copy_target, src_oov, oov_lists = one2one_batch
max_oov_number = max([len(oov) for oov in oov_lists])
print("src size - ", src.size())
print("target size - ", trg.size())
if torch.cuda.is_available():
src = src.cuda()
trg = trg.cuda()
trg_target = trg_target.cuda()
trg_copy_target = trg_copy_target.cuda()
src_oov = src_oov.cuda()
optimizer.zero_grad()
decoder_log_probs, _, _ = model.forward(src, src_len, trg, src_oov, oov_lists)
# simply average losses of all the predicitons
# IMPORTANT, must use logits instead of probs to compute the loss, otherwise it's super super slow at the beginning (grads of probs are small)!
start_time = time.time()
if not opt.copy_attention:
loss = criterion(
decoder_log_probs.contiguous().view(-1, opt.vocab_size),
trg_target.contiguous().view(-1)
)
else:
loss = criterion(
decoder_log_probs.contiguous().view(-1, opt.vocab_size + max_oov_number),
trg_copy_target.contiguous().view(-1)
)
if opt.train_rl:
loss = loss * (1 - opt.loss_scale)
print("--loss calculation- %s seconds ---" % (time.time() - start_time))
start_time = time.time()
loss.backward()
print("--backward- %s seconds ---" % (time.time() - start_time))
if opt.max_grad_norm > 0:
pre_norm = torch.nn.utils.clip_grad_norm_(model.parameters(), opt.max_grad_norm)
after_norm = (sum([p.grad.data.norm(2) ** 2 for p in model.parameters() if p.grad is not None])) ** (1.0 / 2)
# logging.info('clip grad (%f -> %f)' % (pre_norm, after_norm))
optimizer.step()
if torch.cuda.is_available():
loss_value = loss.cpu().data.numpy()
else:
loss_value = loss.data.numpy()
return loss_value, decoder_log_probs
def train_rl_0(one2many_batch, model, optimizer, generator, opt):
src_list, src_len, trg_list, _, trg_copy_target_list, src_oov_map_list, oov_list = one2many_batch
if torch.cuda.is_available():
src_list = src_list.cuda()
src_oov_map_list = src_oov_map_list.cuda()
# Baseline sequences for self-critic
baseline_seqs_list = generator.sample(src_list, src_len, src_oov_map_list, oov_list, opt.word2id, k=5, is_greedy=True)
# Sample number_batch*beam_size sequences
sampled_seqs_list = generator.sample(src_list, src_len, src_oov_map_list, oov_list, opt.word2id, k=5, is_greedy=False)
policy_loss = []
policy_rewards = []
# Compute their rewards and losses
for seq_i, (src, trg, trg_copy, sampled_seqs, baseline_seqs, oov) in enumerate(zip(src_list, trg_list, trg_copy_target_list, sampled_seqs_list, baseline_seqs_list, oov_list)):
# convert to string sequences
baseline_str_seqs = [[opt.id2word[x] if x < opt.vocab_size else oov[x - opt.vocab_size] for x in to_cpu_list(seq.sentence)] for seq in baseline_seqs]
baseline_str_seqs = [seq[:seq.index(pykp.io.EOS_WORD) + 1] if pykp.io.EOS_WORD in seq else seq for seq in baseline_str_seqs]
sampled_str_seqs = [[opt.id2word[x] if x < opt.vocab_size else oov[x - opt.vocab_size] for x in to_cpu_list(seq.sentence)] for seq in sampled_seqs]
sampled_str_seqs = [seq[:seq.index(pykp.io.EOS_WORD) + 1] if pykp.io.EOS_WORD in seq else seq for seq in sampled_str_seqs]
# pad trg seqs with EOS to the same length
trg_seqs = [[opt.id2word[x] if x < opt.vocab_size else oov[x - opt.vocab_size] for x in seq] for seq in trg_copy]
# trg_seqs = [seq + [pykp.IO.EOS_WORD] * (opt.max_sent_length - len(seq)) for seq in trg_seqs]
# local rewards (bleu)
bleu_baselines = get_match_result(true_seqs=trg_seqs, pred_seqs=baseline_str_seqs, type='bleu')
bleu_samples = get_match_result(true_seqs=trg_seqs, pred_seqs=sampled_str_seqs, type='bleu')
# global rewards
match_baselines = get_match_result(true_seqs=trg_seqs, pred_seqs=baseline_str_seqs, type='exact')
match_samples = get_match_result(true_seqs=trg_seqs, pred_seqs=sampled_str_seqs, type='exact')
_, _, fscore_baselines = evaluate.evaluate(match_baselines, baseline_str_seqs, trg_seqs, topk=5)
_, _, fscore_samples = evaluate.evaluate(match_samples, sampled_str_seqs, trg_seqs, topk=5)
# compute the final rewards
alpha = 0.0
baseline = alpha * np.average(bleu_baselines) + (1.0 - alpha) * fscore_baselines
rewards = alpha * np.asarray(bleu_samples) + (1.0 - alpha) * fscore_samples
"""
print('*' * 20 + ' ' + str(seq_i) + ' ' + '*' * 20)
print('Target Sequences:\n\t\t %s' % str(trg_seqs))
print('Baseline Sequences:')
for pred_seq, reward in zip(baseline_str_seqs, baselines):
print('\t\t[%f] %s' % (reward, ' '.join(pred_seq)))
print('Predict Sequences:')
for pred_seq, reward in zip(sampled_str_seqs, rewards):
print('\t\t[%f] %s' % (reward, ' '.join(pred_seq)))
"""
[policy_loss.append(-torch.stack(seq.logprobs, dim=0) * float(reward - baseline)) for seq, reward in zip(sampled_seqs, rewards)]
[policy_rewards.append(reward) for reward in rewards]
optimizer.zero_grad()
policy_loss = torch.cat(policy_loss).sum() * (1 - opt.loss_scale)
policy_loss.backward()
if opt.max_grad_norm > 0:
pre_norm = torch.nn.utils.clip_grad_norm(model.parameters(), opt.max_grad_norm)
after_norm = (sum([p.grad.data.norm(2) ** 2 for p in model.parameters() if p.grad is not None])) ** (1.0 / 2)
# logging.info('clip grad (%f -> %f)' % (pre_norm, after_norm))
optimizer.step()
return np.average(policy_rewards)
class RewardCache(object):
def __init__(self, capacity=2000):
# vanilla replay memory
self.capacity = capacity
self.memory = []
self.reset()
def push(self, stuff):
if len(self.memory) == self.capacity:
self.memory = self.memory[1:]
self.memory.append(stuff)
def get_average(self):
if len(self.memory) == 0:
return 0
return np.mean(np.array(self.memory))
def reset(self):
self.memory = []
def __len__(self):
return len(self.memory)
def train_rl_1(one2many_batch, model, optimizer, generator, opt, reward_cache):
src_list, src_len, trg_list, _, trg_copy_target_list, src_oov_map_list, oov_list = one2many_batch
if torch.cuda.is_available():
src_list = src_list.cuda()
src_oov_map_list = src_oov_map_list.cuda()
# Sample number_batch sequences
sampled_seqs_list = generator.sample(src_list, src_len, src_oov_map_list, oov_list, opt.word2id, k=5, is_greedy=False)
policy_loss = []
policy_rewards = []
# Compute their rewards and losses
for seq_i, (src, trg, trg_copy, sampled_seqs, oov) in enumerate(zip(src_list, trg_list, trg_copy_target_list, sampled_seqs_list, oov_list)):
# convert to string sequences
sampled_str_seqs = [[opt.id2word[x] if x < opt.vocab_size else oov[x - opt.vocab_size] for x in to_cpu_list(seq.sentence)] for seq in sampled_seqs]
sampled_str_seqs = [seq[:seq.index(pykp.io.EOS_WORD) + 1] if pykp.io.EOS_WORD in seq else seq for seq in sampled_str_seqs]
# pad trg seqs with EOS to the same length
trg_seqs = [[opt.id2word[x] if x < opt.vocab_size else oov[x - opt.vocab_size] for x in seq] for seq in trg_copy]
# trg_seqs = [seq + [pykp.IO.EOS_WORD] * (opt.max_sent_length - len(seq)) for seq in trg_seqs]
# local rewards (bleu)
bleu_samples = get_match_result(true_seqs=trg_seqs, pred_seqs=sampled_str_seqs, type='bleu')
# global rewards
match_samples = get_match_result(true_seqs=trg_seqs, pred_seqs=sampled_str_seqs, type='exact')
_, _, fscore_samples = evaluate.evaluate(match_samples, sampled_str_seqs, trg_seqs, topk=5)
# compute the final rewards
alpha = 0.0
rewards = alpha * np.asarray(bleu_samples) + (1.0 - alpha) * fscore_samples
baseline = reward_cache.get_average()
for reward in rewards:
reward_cache.push(float(reward))
[policy_loss.append(-torch.stack(seq.logprobs, dim=0).sum() * float(reward - baseline)) for seq, reward in zip(sampled_seqs, rewards)]
[policy_rewards.append(reward) for reward in rewards]
optimizer.zero_grad()
policy_loss = torch.stack(policy_loss).mean() * (1 - opt.loss_scale)
policy_loss.backward()
if opt.max_grad_norm > 0:
pre_norm = torch.nn.utils.clip_grad_norm(model.parameters(), opt.max_grad_norm)
after_norm = (sum([p.grad.data.norm(2) ** 2 for p in model.parameters() if p.grad is not None])) ** (1.0 / 2)
# logging.info('clip grad (%f -> %f)' % (pre_norm, after_norm))
optimizer.step()
return np.average(policy_rewards)
def train_rl_2(one2many_batch, model, optimizer, generator, opt, reward_cache):
src_list, src_len, trg_list, _, trg_copy_target_list, src_oov_map_list, oov_list = one2many_batch
if torch.cuda.is_available():
src_list = src_list.cuda()
src_oov_map_list = src_oov_map_list.cuda()
# Sample number_batch sequences
sampled_seqs_list = generator.sample(src_list, src_len, src_oov_map_list, oov_list, opt.word2id, k=5, is_greedy=False)
policy_loss = []
policy_rewards = []
# Compute their rewards and losses
for seq_i, (src, trg, trg_copy, sampled_seqs, oov) in enumerate(zip(src_list, trg_list, trg_copy_target_list, sampled_seqs_list, oov_list)):
# convert to string sequences
sampled_str_seqs = [[opt.id2word[x] if x < opt.vocab_size else oov[x - opt.vocab_size] for x in to_cpu_list(seq.sentence)] for seq in sampled_seqs]
sampled_str_seqs = [seq[:seq.index(pykp.io.EOS_WORD) + 1] if pykp.io.EOS_WORD in seq else seq for seq in sampled_str_seqs]
redundancy = self_redundancy(sampled_str_seqs)
reward = 1.0 - redundancy # the less redundant, the better
baseline = reward_cache.get_average()
reward_cache.push(float(reward))
[policy_loss.append(-torch.stack(seq.logprobs, dim=0).sum() * float(reward - baseline)) for seq in sampled_seqs]
policy_rewards.append(reward)
optimizer.zero_grad()
policy_loss = torch.stack(policy_loss).mean() * (1 - opt.loss_scale)
policy_loss.backward()
if opt.max_grad_norm > 0:
pre_norm = torch.nn.utils.clip_grad_norm(model.parameters(), opt.max_grad_norm)
after_norm = (sum([p.grad.data.norm(2) ** 2 for p in model.parameters() if p.grad is not None])) ** (1.0 / 2)
# logging.info('clip grad (%f -> %f)' % (pre_norm, after_norm))
optimizer.step()
return np.average(policy_rewards)
def train_rl(one2many_batch, model, optimizer, generator, opt, reward_cache):
if opt.rl_method == 0:
return train_rl_0(one2many_batch, model, optimizer, generator, opt)
elif opt.rl_method == 1:
return train_rl_1(one2many_batch, model, optimizer, generator, opt, reward_cache)
elif opt.rl_method == 2:
return train_rl_2(one2many_batch, model, optimizer, generator, opt, reward_cache)
def brief_report(epoch, batch_i, one2one_batch, loss_ml, decoder_log_probs, opt):
logging.info('====================== %d =========================' % (batch_i))
logging.info('Epoch : %d Minibatch : %d, Loss=%.5f' % (epoch, batch_i, np.mean(loss_ml)))
sampled_size = 2
logging.info('Printing predictions on %d sampled examples by greedy search' % sampled_size)
src, _, trg, trg_target, trg_copy_target, src_ext, oov_lists = one2one_batch
if torch.cuda.is_available():
src = src.data.cpu().numpy()
decoder_log_probs = decoder_log_probs.data.cpu().numpy()
max_words_pred = decoder_log_probs.argmax(axis=-1)
trg_target = trg_target.data.cpu().numpy()
trg_copy_target = trg_copy_target.data.cpu().numpy()
else:
src = src.data.numpy()
decoder_log_probs = decoder_log_probs.data.numpy()
max_words_pred = decoder_log_probs.argmax(axis=-1)
trg_target = trg_target.data.numpy()
trg_copy_target = trg_copy_target.data.numpy()
sampled_trg_idx = np.random.random_integers(low=0, high=len(trg) - 1, size=sampled_size)
src = src[sampled_trg_idx]
oov_lists = [oov_lists[i] for i in sampled_trg_idx]
max_words_pred = [max_words_pred[i] for i in sampled_trg_idx]
decoder_log_probs = decoder_log_probs[sampled_trg_idx]
if not opt.copy_attention:
trg_target = [trg_target[i] for i in
sampled_trg_idx] # use the real target trg_loss (the starting <BOS> has been removed and contains oov ground-truth)
else:
trg_target = [trg_copy_target[i] for i in sampled_trg_idx]
for i, (src_wi, pred_wi, trg_i, oov_i) in enumerate(
zip(src, max_words_pred, trg_target, oov_lists)):
nll_prob = -np.sum([decoder_log_probs[i][l][pred_wi[l]] for l in range(len(trg_i))])
find_copy = np.any([x >= opt.vocab_size for x in src_wi])
has_copy = np.any([x >= opt.vocab_size for x in trg_i])
sentence_source = [opt.id2word[x] if x < opt.vocab_size else oov_i[x - opt.vocab_size] for x in
src_wi]
sentence_pred = [opt.id2word[x] if x < opt.vocab_size else oov_i[x - opt.vocab_size] for x in
pred_wi]
sentence_real = [opt.id2word[x] if x < opt.vocab_size else oov_i[x - opt.vocab_size] for x in
trg_i]
sentence_source = sentence_source[:sentence_source.index(
'<pad>')] if '<pad>' in sentence_source else sentence_source
sentence_pred = sentence_pred[
:sentence_pred.index('<pad>')] if '<pad>' in sentence_pred else sentence_pred
sentence_real = sentence_real[
:sentence_real.index('<pad>')] if '<pad>' in sentence_real else sentence_real
logging.info('==================================================')
logging.info('Source: %s ' % (' '.join(sentence_source)))
logging.info('\t\tPred : %s (%.4f)' % (' '.join(sentence_pred), nll_prob) + (
' [FIND COPY]' if find_copy else ''))
logging.info('\t\tReal : %s ' % (' '.join(sentence_real)) + (
' [HAS COPY]' + str(trg_i) if has_copy else ''))
def train_model(model, optimizer_ml, optimizer_rl, criterion, train_data_loader, valid_data_loader, test_data_loader, opt):
generator = SequenceGenerator(model,
eos_id=opt.word2id[pykp.io.EOS_WORD],
beam_size=opt.beam_size,
max_sequence_length=opt.max_sent_length
)
logging.info('====================== Checking GPU Availability =========================')
if torch.cuda.is_available():
if isinstance(opt.device_ids, int):
opt.device_ids = [opt.device_ids]
logging.info('Running on GPU! devices=%s' % str(opt.device_ids))
# model = nn.DataParallel(model, device_ids=opt.device_ids)
model = model.cuda()
else:
logging.info('Running on CPU!')
logging.info('====================== Start Training =========================')
checkpoint_names = []
train_ml_history_losses = []
train_rl_history_losses = []
valid_history_losses = []
test_history_losses = []
# best_loss = sys.float_info.max # for normal training/testing loss (likelihood)
best_loss = 0.0 # for f-score
stop_increasing = 0
train_ml_losses = []
train_rl_losses = []
total_batch = -1
early_stop_flag = False
if opt.train_rl:
reward_cache = RewardCache(2000)
if False: # opt.train_from:
state_path = opt.train_from.replace('.model', '.state')
logging.info('Loading training state from: %s' % state_path)
if os.path.exists(state_path):
(epoch, total_batch, best_loss, stop_increasing, checkpoint_names, train_ml_history_losses, train_rl_history_losses, valid_history_losses,
test_history_losses) = torch.load(open(state_path, 'rb'))
opt.start_epoch = epoch
for epoch in range(opt.start_epoch, opt.epochs):
if early_stop_flag:
break
progbar = Progbar(logger=logging, title='Training', target=len(train_data_loader), batch_size=train_data_loader.batch_size,
total_examples=len(train_data_loader.dataset.examples))
for batch_i, batch in enumerate(train_data_loader):
model.train()
total_batch += 1
one2many_batch, one2one_batch = batch
report_loss = []
# Training
if opt.train_ml:
loss_ml, decoder_log_probs = train_ml(one2one_batch, model, optimizer_ml, criterion, opt)
train_ml_losses.append(loss_ml)
report_loss.append(('train_ml_loss', loss_ml))
report_loss.append(('PPL', loss_ml))
# Brief report
if batch_i % opt.report_every == 0:
brief_report(epoch, batch_i, one2one_batch, loss_ml, decoder_log_probs, opt)
# do not apply rl in 0th epoch, need to get a resonable model before that.
if opt.train_rl:
if epoch >= opt.rl_start_epoch:
loss_rl = train_rl(one2many_batch, model, optimizer_rl, generator, opt, reward_cache)
else:
loss_rl = 0.0
train_rl_losses.append(loss_rl)
report_loss.append(('train_rl_loss', loss_rl))
progbar.update(epoch, batch_i, report_loss)
# Validate and save checkpoint
if (opt.run_valid_every == -1 and batch_i == len(train_data_loader) - 1) or\
(opt.run_valid_every > -1 and total_batch > 1 and total_batch % opt.run_valid_every == 0):
logging.info('*' * 50)
logging.info('Run validing and testing @Epoch=%d,#(Total batch)=%d' % (epoch, total_batch))
# valid_losses = _valid_error(valid_data_loader, model, criterion, epoch, opt)
# valid_history_losses.append(valid_losses)
valid_score_dict = evaluate_beam_search(generator, valid_data_loader, opt, title='Validating, epoch=%d, batch=%d, total_batch=%d' % (epoch, batch_i, total_batch), epoch=epoch, predict_save_path=opt.pred_path + '/epoch%d_batch%d_total_batch%d' % (epoch, batch_i, total_batch))
# test_score_dict = evaluate_beam_search(generator, test_data_loader, opt, title='Testing, epoch=%d, batch=%d, total_batch=%d' % (epoch, batch_i, total_batch), epoch=epoch, predict_save_path=opt.pred_path + '/epoch%d_batch%d_total_batch%d' % (epoch, batch_i, total_batch))
checkpoint_names.append('epoch=%d-batch=%d-total_batch=%d' % (epoch, batch_i, total_batch))
curve_names = []
scores = []
if opt.train_ml:
train_ml_history_losses.append(copy.copy(train_ml_losses))
scores += [train_ml_history_losses]
curve_names += ['Training ML Error']
train_ml_losses = []
if opt.train_rl:
train_rl_history_losses.append(copy.copy(train_rl_losses))
scores += [train_rl_history_losses]
curve_names += ['Training RL Reward']
train_rl_losses = []
valid_history_losses.append(valid_score_dict)
# test_history_losses.append(test_score_dict)
scores += [[result_dict[name] for result_dict in valid_history_losses] for name in opt.report_score_names]
curve_names += ['Valid-' + name for name in opt.report_score_names]
# scores += [[result_dict[name] for result_dict in test_history_losses] for name in opt.report_score_names]
# curve_names += ['Test-' + name for name in opt.report_score_names]
#
scores = [np.asarray(s) for s in scores]
# Plot the learning curve
plot_learning_curve_and_write_csv(scores=scores,
curve_names=curve_names,
checkpoint_names=checkpoint_names,
title='Training Validation & Test',
save_path=opt.exp_path + '/[epoch=%d,batch=%d,total_batch=%d]train_valid_test_curve.png' % (epoch, batch_i, total_batch))
'''
determine if early stop training (whether f-score increased, before is if valid error decreased)
'''
valid_loss = np.average(valid_history_losses[-1][opt.report_score_names[0]])
is_best_loss = valid_loss > best_loss
rate_of_change = float(valid_loss - best_loss) / float(best_loss) if float(best_loss) > 0 else 0.0
# valid error doesn't increase
if rate_of_change <= 0:
stop_increasing += 1
else:
stop_increasing = 0
if is_best_loss:
logging.info('Validation: update best loss (%.4f --> %.4f), rate of change (ROC)=%.2f' % (
best_loss, valid_loss, rate_of_change * 100))
else:
logging.info('Validation: best loss is not updated for %d times (%.4f --> %.4f), rate of change (ROC)=%.2f' % (
stop_increasing, best_loss, valid_loss, rate_of_change * 100))
best_loss = max(valid_loss, best_loss)
# only store the checkpoints that make better validation performances
if total_batch > 1 and (total_batch % opt.save_model_every == 0 or is_best_loss): # epoch >= opt.start_checkpoint_at and
# Save the checkpoint
logging.info('Saving checkpoint to: %s' % os.path.join(opt.model_path, '%s.epoch=%d.batch=%d.total_batch=%d.error=%f' % (opt.exp, epoch, batch_i, total_batch, valid_loss) + '.model'))
torch.save(
model.state_dict(),
open(os.path.join(opt.model_path, '%s.epoch=%d.batch=%d.total_batch=%d' % (opt.exp, epoch, batch_i, total_batch) + '.model'), 'wb')
)
torch.save(
(epoch, total_batch, best_loss, stop_increasing, checkpoint_names, train_ml_history_losses, train_rl_history_losses, valid_history_losses, test_history_losses),
open(os.path.join(opt.model_path, '%s.epoch=%d.batch=%d.total_batch=%d' % (opt.exp, epoch, batch_i, total_batch) + '.state'), 'wb')
)
if stop_increasing >= opt.early_stop_tolerance:
logging.info('Have not increased for %d epoches, early stop training' % stop_increasing)
early_stop_flag = True
break
logging.info('*' * 50)
def load_data_vocab(opt, load_train=True):
logging.info("Loading vocab from disk: %s" % (opt.vocab))
word2id, id2word, vocab = torch.load(opt.vocab, 'rb')
pin_memory = torch.cuda.is_available()
# one2one data loader
logging.info("Loading train and validate data from '%s'" % opt.data)
logging.info('====================== Dataset =========================')
# one2many data loader
if load_train:
train_one2many = torch.load(opt.data + '.train.one2many.pt', 'rb')
train_one2many_dataset = KeyphraseDataset(train_one2many, word2id=word2id, id2word=id2word, type='one2many')
train_one2many_loader = KeyphraseDataLoader(dataset=train_one2many_dataset,
collate_fn=train_one2many_dataset.collate_fn_one2many,
num_workers=opt.batch_workers,
max_batch_example=1024,
max_batch_pair=opt.batch_size,
pin_memory=pin_memory,
shuffle=True)
logging.info('#(train data size: #(one2many pair)=%d, #(one2one pair)=%d, #(batch)=%d, #(average examples/batch)=%.3f' % (len(train_one2many_loader.dataset), train_one2many_loader.one2one_number(), len(train_one2many_loader), train_one2many_loader.one2one_number() / len(train_one2many_loader)))
else:
train_one2many_loader = None
valid_one2many = torch.load(opt.data + '.valid.one2many.pt', 'rb')
test_one2many = torch.load(opt.data + '.test.one2many.pt', 'rb')
# !important. As it takes too long to do beam search, thus reduce the size of validation and test datasets
valid_one2many = valid_one2many[:2000]
# test_one2many = test_one2many[:2000]
valid_one2many_dataset = KeyphraseDataset(valid_one2many, word2id=word2id, id2word=id2word, type='one2many', include_original=True)
test_one2many_dataset = KeyphraseDataset(test_one2many, word2id=word2id, id2word=id2word, type='one2many', include_original=True)
"""
# temporary code, exporting test data for Theano model
for e_id, e in enumerate(test_one2many_dataset.examples):
with open(os.path.join('data', 'new_kp20k_for_theano_model', 'text', '%d.txt' % e_id), 'w') as t_file:
t_file.write(' '.join(e['src_str']))
with open(os.path.join('data', 'new_kp20k_for_theano_model', 'keyphrase', '%d.txt' % e_id), 'w') as t_file:
t_file.writelines([(' '.join(t))+'\n' for t in e['trg_str']])
exit()
"""
valid_one2many_loader = KeyphraseDataLoader(dataset=valid_one2many_dataset,
collate_fn=valid_one2many_dataset.collate_fn_one2many,
num_workers=opt.batch_workers,
max_batch_example=opt.beam_search_batch_example,
max_batch_pair=opt.beam_search_batch_size,
pin_memory=pin_memory,
shuffle=False)
test_one2many_loader = KeyphraseDataLoader(dataset=test_one2many_dataset,
collate_fn=test_one2many_dataset.collate_fn_one2many,
num_workers=opt.batch_workers,
max_batch_example=opt.beam_search_batch_example,
max_batch_pair=opt.beam_search_batch_size,
pin_memory=pin_memory,
shuffle=False)
opt.word2id = word2id
opt.id2word = id2word
opt.vocab = vocab
logging.info('#(valid data size: #(one2many pair)=%d, #(one2one pair)=%d, #(batch)=%d' % (len(valid_one2many_loader.dataset), valid_one2many_loader.one2one_number(), len(valid_one2many_loader)))
logging.info('#(test data size: #(one2many pair)=%d, #(one2one pair)=%d, #(batch)=%d' % (len(test_one2many_loader.dataset), test_one2many_loader.one2one_number(), len(test_one2many_loader)))
logging.info('#(vocab)=%d' % len(vocab))
logging.info('#(vocab used)=%d' % opt.vocab_size)
return train_one2many_loader, valid_one2many_loader, test_one2many_loader, word2id, id2word, vocab
def init_optimizer_criterion(model, opt):
"""
mask the PAD <pad> when computing loss, before we used weight matrix, but not handy for copy-model, change to ignore_index
:param model:
:param opt:
:return:
"""
'''
if not opt.copy_attention:
weight_mask = torch.ones(opt.vocab_size).cuda() if torch.cuda.is_available() else torch.ones(opt.vocab_size)
else:
weight_mask = torch.ones(opt.vocab_size + opt.max_unk_words).cuda() if torch.cuda.is_available() else torch.ones(opt.vocab_size + opt.max_unk_words)
weight_mask[opt.word2id[pykp.IO.PAD_WORD]] = 0
criterion = torch.nn.NLLLoss(weight=weight_mask)
optimizer = Adam(params=filter(lambda p: p.requires_grad, model.parameters()), lr=opt.learning_rate)
# optimizer = torch.optim.Adadelta(model.parameters(), lr=0.1)
# optimizer = torch.optim.RMSprop(model.parameters(), lr=0.1)
'''
criterion = torch.nn.NLLLoss(ignore_index=opt.word2id[pykp.io.PAD_WORD])
if opt.train_ml:
optimizer_ml = Adam(params=filter(lambda p: p.requires_grad, model.parameters()), lr=opt.learning_rate)
else:
optimizer_ml = None
if opt.train_rl:
optimizer_rl = Adam(params=filter(lambda p: p.requires_grad, model.parameters()), lr=opt.learning_rate_rl)
else:
optimizer_rl = None
if torch.cuda.is_available():
criterion = criterion.cuda()
return optimizer_ml, optimizer_rl, criterion
def init_model(opt):
logging.info('====================== Model Parameters =========================')
if opt.cascading_model:
model = Seq2SeqLSTMAttentionCascading(opt)
else:
if opt.copy_attention:
logging.info('Train a Seq2Seq model with Copy Mechanism')
else:
logging.info('Train a normal Seq2Seq model')
model = Seq2SeqLSTMAttention(opt)
if opt.train_from:
logging.info("loading previous checkpoint from %s" % opt.train_from)
# train_from_model_dir = opt.train_from[:opt.train_from.rfind('model/') + 6]
# load the saved the meta-model and override the current one
# model = torch.load(
# open(os.path.join(opt.model_path, opt.exp + '.initial.model'), 'rb')
# )
if torch.cuda.is_available():
checkpoint = torch.load(open(opt.train_from, 'rb'))
else:
checkpoint = torch.load(
open(opt.train_from, 'rb'), map_location=lambda storage, loc: storage
)
# some compatible problems, keys are started with 'module.'
# checkpoint = dict([(k[7:], v) if k.startswith('module.') else (k, v) for k, v in checkpoint.items()])
model.load_state_dict(checkpoint)
else:
# dump the meta-model
torch.save(
model.state_dict(),
open(os.path.join(opt.train_from[: opt.train_from.find('.epoch=')], 'initial.model'), 'wb')
)
utils.tally_parameters(model)
return model
def main():
# load settings for training
opt = init_opt(description='train.py')
logging = init_logging(logger_name='train.py', log_file=opt.log_file, redirect_to_stdout=False)
logging.info('EXP_PATH : ' + opt.exp_path)
logging.info('Parameters:')
[logging.info('%s : %s' % (k, str(v))) for k, v in opt.__dict__.items()]
logging.info('====================== Checking GPU Availability =========================')
if torch.cuda.is_available():
if isinstance(opt.device_ids, int):
opt.device_ids = [opt.device_ids]
logging.info('Running on %s! devices=%s' % ('MULTIPLE GPUs' if len(opt.device_ids) > 1 else '1 GPU', str(opt.device_ids)))
else:
logging.info('Running on CPU!')
try:
train_data_loader, valid_data_loader, test_data_loader, word2id, id2word, vocab = load_data_vocab(opt)
model = init_model(opt)
optimizer_ml, optimizer_rl, criterion = init_optimizer_criterion(model, opt)
train_model(model, optimizer_ml, optimizer_rl, criterion, train_data_loader, valid_data_loader, test_data_loader, opt)
except Exception as e:
logging.error(e, exc_info=True)
raise
if __name__ == '__main__':
main()
| 46.076923 | 303 | 0.626302 |
c0c0600107ae81a57dc3e3f29111647dfeab8666 | 3,014 | kt | Kotlin | app/src/main/java/manwithandroid/learnit/activity/CreateLessonProfileActivity.kt | LearnIt-Datathon-Group/Learin-It---Android | 0b9d4f7bb3ca5aa81055a1ac635b1e9f4e2951ef | [
"Apache-2.0"
] | 4 | 2018-03-29T11:40:36.000Z | 2020-05-30T17:15:09.000Z | app/src/main/java/manwithandroid/learnit/activity/CreateLessonProfileActivity.kt | LearnIt-Datathon-Group/Learin-It---Android | 0b9d4f7bb3ca5aa81055a1ac635b1e9f4e2951ef | [
"Apache-2.0"
] | null | null | null | app/src/main/java/manwithandroid/learnit/activity/CreateLessonProfileActivity.kt | LearnIt-Datathon-Group/Learin-It---Android | 0b9d4f7bb3ca5aa81055a1ac635b1e9f4e2951ef | [
"Apache-2.0"
] | null | null | null | package manwithandroid.learnit.activity
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import com.google.firebase.remoteconfig.FirebaseRemoteConfig
import kotlinx.android.synthetic.main.activity_create_lesson_profile.*
import manwithandroid.learnit.R
import manwithandroid.learnit.models.ClassProfile
/**
* Created by Roi Amiel on 20/01/2018.
*/
class CreateLessonProfileActivity : AppCompatActivity() {
private val maximumPercent = FirebaseRemoteConfig.getInstance().getLong("lesson_profile_max_percent").toInt()
private val minimumPercent = FirebaseRemoteConfig.getInstance().getLong("lesson_profile_min_percent").toInt()
private var valueReturned = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_create_lesson_profile)
supportActionBar?.title = resources.getString(R.string.create_lesson_profile_title)
textsPercentSeekBar.max = maximumPercent
videosPercentSeekBar.max = maximumPercent
simulationPercentSeekBar.max = maximumPercent
textsPercentSeekBar.min = minimumPercent
videosPercentSeekBar.min = minimumPercent
simulationPercentSeekBar.min = minimumPercent
continueButton.setOnClickListener {
val profile = createLessonProfile()
valueReturned = true
createLessonProfileListener(profile)
finish()
}
}
private fun createLessonProfile(): ClassProfile {
val loveRate = loveRateSpinner.selectedItemPosition
val lessonDuration = lessonDurationSpinner.selectedItemPosition
val timesInWeek = timesInWeekSpinner.selectedItemPosition
val goodRate = goodRateSpinner.selectedItemPosition
val textsPercent = textsPercentSeekBar.progress
val videosPercent = videosPercentSeekBar.progress
val simulationPercent = simulationPercentSeekBar.progress
val lessonProfile = ClassProfile()
lessonProfile.loveRate = loveRate
lessonProfile.lessonDuration = lessonDuration
lessonProfile.timesInWeek = timesInWeek
lessonProfile.goodRate = goodRate
lessonProfile.textsPercent = textsPercent
lessonProfile.videosPercent = videosPercent
lessonProfile.simulationPercent = simulationPercent
return lessonProfile
}
override fun onDestroy() {
if (!valueReturned) {
createLessonProfileListener(null)
}
super.onDestroy()
}
companion object {
private lateinit var createLessonProfileListener: (classProfile: ClassProfile?) -> Unit
fun createIntent(context: Context, onCreateProfileListener: (classProfile: ClassProfile?) -> Unit): Intent {
createLessonProfileListener = onCreateProfileListener
return Intent(context, CreateLessonProfileActivity::class.java)
}
}
} | 35.458824 | 116 | 0.736894 |
a71acf100b532631a67ab675afa884cc9c9d86c3 | 1,744 | kt | Kotlin | app/src/main/java/com/nobodysapps/septimanapp/dialog/MessageAndCheckboxDialogFragment.kt | BananaNosh/Septimanapp | 3e18e32bcfbe8888a89207c4f98f7cc32de2cb84 | [
"MIT"
] | null | null | null | app/src/main/java/com/nobodysapps/septimanapp/dialog/MessageAndCheckboxDialogFragment.kt | BananaNosh/Septimanapp | 3e18e32bcfbe8888a89207c4f98f7cc32de2cb84 | [
"MIT"
] | 20 | 2019-08-04T19:32:22.000Z | 2022-03-03T20:58:09.000Z | app/src/main/java/com/nobodysapps/septimanapp/dialog/MessageAndCheckboxDialogFragment.kt | BananaNosh/Septimanapp | 3e18e32bcfbe8888a89207c4f98f7cc32de2cb84 | [
"MIT"
] | 2 | 2019-08-05T08:13:33.000Z | 2019-08-09T18:45:41.000Z | package com.nobodysapps.septimanapp.dialog
import android.annotation.SuppressLint
import android.app.AlertDialog
import android.app.Dialog
import android.os.Bundle
import android.widget.CheckBox
import android.widget.TextView
import androidx.fragment.app.DialogFragment
import com.nobodysapps.septimanapp.R
open class MessageAndCheckboxDialogFragment: DialogFragment() {
var listener: Listener? = null
private var textView: TextView? = null
protected var checkBox: CheckBox? = null
@SuppressLint("InflateParams")
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return activity?.let {
val builder = AlertDialog.Builder(it)
val dialogView = it.layoutInflater.inflate(R.layout.dialog_with_checkbox, null)
checkBox = dialogView.findViewById(R.id.dialogCB)
textView = dialogView.findViewById(R.id.dialogTV)
builder
.setView(dialogView)
.setPositiveButton(
R.string.ok
) { _, _ ->
listener?.onOkClicked(checkBox?.isChecked ?: false)
}
builder.create()
} ?: throw IllegalStateException("Activity cannot be null")
}
protected fun setMessage(@Suppress("SameParameterValue") id: Int) {
textView?.setText(id)
}
@Suppress("unused")
protected fun setMessage(text: CharSequence) {
textView?.text = text
}
protected fun setCheckboxText(id: Int) {
checkBox?.setText(id)
}
@Suppress("unused")
protected fun setCheckboxText(text: CharSequence) {
checkBox?.text = text
}
interface Listener {
fun onOkClicked(isChecked: Boolean)
}
} | 30.596491 | 91 | 0.65539 |
2be22f6eb44f75d0b9c24886ba093f5234dc3371 | 2,541 | ps1 | PowerShell | azure/cohesity-azurepipeline-db-protect.ps1 | jussi-cohesity/cohesity-scripts | d63052b04cc49b377bcb1a663268b941f0ccce55 | [
"Unlicense"
] | null | null | null | azure/cohesity-azurepipeline-db-protect.ps1 | jussi-cohesity/cohesity-scripts | d63052b04cc49b377bcb1a663268b941f0ccce55 | [
"Unlicense"
] | 1 | 2021-09-28T18:24:07.000Z | 2021-09-28T18:24:07.000Z | azure/cohesity-azurepipeline-db-protect.ps1 | jussi-cohesity/cohesity-scripts | d63052b04cc49b377bcb1a663268b941f0ccce55 | [
"Unlicense"
] | 1 | 2020-04-09T06:02:14.000Z | 2020-04-09T06:02:14.000Z | ### Sample script for Azure Pipeline Cohesity integration to protect MSSQL DB- Jussi Jaurola <jussi@cohesity.com>
$cohesityUsername = "" # Cohesity Cluster Username
$cohesityPassword = "" #Cohesity Cluster Password
$cohesityCluster = "" # Cohesity Cluster to connect
$retainDays = "30" # How long backup is kept
### Get required module
$module = Get-Module -ListAvailable -Name Cohesity*
if ($module) {
Get-Module -ListAvailable -Name Cohesity* | Import-Module
} else {
Install-Module -Name Cohesity.PowerShell -Scope CurrentUser -Force
Get-Module -ListAvailable -Name Cohesity* | Import-Module
}
try {
Connect-CohesityCluster -Server $cohesityCluster -Credential (New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $cohesityUsername, (ConvertTo-SecureString -AsPlainText $cohesityPassword -Force))
} catch {
Write-Error "Cannot connect to Cohesity cluster $($cohesityCluster)"
}
Get-CohesityProtectionSource -Environments kSQL | ForEach-Object { Update-CohesityProtectionSource -Id $_.protectionSource.Id}
$databaseName = "$(dbName)"
### Create protection policy for object
$storageDomain = Get-CohesityStorageDomain -Names DefaultStorageDomain
$policyName = "pipeline-" + "$(dbName)"
$policy = New-CohesityProtectionPolicy -PolicyName $policyName -BackupInHours 14 -RetainInDays $retainDays -Confirm:$false
### Find DB to protect
$databaseObject = Get-CohesityProtectionSourceObject -Environments kSQL | Where-Object { $_.name -match $databaseName } | Select-Object -First 1
### Create job to protect database
$databaseProtectionJob = New-CohesityProtectionJob -Name $databaseName -PolicyName $policyName -SourceIds $($databaseObject.ParentId) -StorageDomainName 'DefaultStorageDomain' -Environment kSQL -ParentSourceId $($databaseObject.ParentId)
### Run Protection Jobs
Get-CohesityProtectionJob -Names $databaseName | Start-CohesityProtectionJob -RunType KFull
### Wait until jobs are finished
Start-Sleep 60
$sleepCount = 0
While ($true) {
$statusDatabaseRun = (Get-CohesityProtectionJobRun -JobName $database)[0].backupRun.status
if ($statusDatabaseRun -eq 'kSuccess'){
break
} elseif ($sleepCount -gt '30') {
Write-Error "Running protection groups takes too long. Failing!"
} else {
Start-Sleep 60
$sleepCount++
}
}
### Remove job and policy but keep backups
Remove-CohesityProtectionJob -Id $($databaseProtectionJob.id) -KeepSnapshots -Confirm:$false
Remove-CohesityProtectionPolicy -Id $($policy.id) -Confirm:$false
| 40.333333 | 237 | 0.758363 |
4f9f5afcc2492d7df94413544d34d079e295d645 | 2,682 | kt | Kotlin | src/main/kotlin/nyway/nd4j/samples/iris/IrisClassifierSample.kt | fbrunacci/deeplearning4j-samples | d63386a44c103d6317f8ee9a7877632542204195 | [
"Apache-2.0"
] | null | null | null | src/main/kotlin/nyway/nd4j/samples/iris/IrisClassifierSample.kt | fbrunacci/deeplearning4j-samples | d63386a44c103d6317f8ee9a7877632542204195 | [
"Apache-2.0"
] | null | null | null | src/main/kotlin/nyway/nd4j/samples/iris/IrisClassifierSample.kt | fbrunacci/deeplearning4j-samples | d63386a44c103d6317f8ee9a7877632542204195 | [
"Apache-2.0"
] | null | null | null | package nyway.nd4j.samples.iris
import krangl.DataFrame
import krangl.head
import krangl.readDelim
import krangl.shuffle
import org.deeplearning4j.nn.conf.NeuralNetConfiguration
import org.deeplearning4j.nn.conf.graph.MergeVertex
import org.deeplearning4j.nn.conf.layers.DenseLayer
import org.deeplearning4j.nn.conf.layers.OutputLayer
import org.deeplearning4j.nn.graph.ComputationGraph
import org.deeplearning4j.nn.multilayer.MultiLayerNetwork
import org.deeplearning4j.nn.weights.WeightInit
import org.deeplearning4j.optimize.listeners.ScoreIterationListener
import org.nd4j.evaluation.classification.Evaluation
import org.nd4j.linalg.activations.Activation
import org.nd4j.linalg.api.ndarray.INDArray
import org.nd4j.linalg.dataset.DataSet
import org.nd4j.linalg.dataset.MultiDataSet
import org.nd4j.linalg.dataset.api.preprocessor.DataNormalization
import org.nd4j.linalg.dataset.api.preprocessor.NormalizerStandardize
import org.nd4j.linalg.factory.Nd4j
import org.nd4j.linalg.indexing.NDArrayIndex
import org.nd4j.linalg.learning.config.Nadam
import org.nd4j.linalg.lossfunctions.LossFunctions
import java.io.StringReader
import java.util.*
object IrisClassifierSample {
@Throws(Exception::class)
@JvmStatic
fun main(args: Array<String>) {
println(IrisClassifier.data.head())
val dataIn = Nd4j.create(IrisClassifier.fullMatrix)
val dataOut = Nd4j.create(IrisClassifier.twodimLabel)
val model = MultiLayerNetwork(IrisClassifier.neuralNetConf(dataIn.columns()))
val fullDataSet = DataSet(dataIn, dataOut)
fullDataSet.shuffle(IrisClassifier.seed)
val splitedSet = fullDataSet.splitTestAndTrain(0.90)
val trainingData = splitedSet.train;
val testData = splitedSet.test;
//We need to normalize our data. We'll use NormalizeStandardize (which gives us mean 0, unit variance):
val normalizer: DataNormalization = NormalizerStandardize()
normalizer.fit(trainingData) //Collect the statistics (mean/stdev) from the training data. This does not modify the input data
normalizer.transform(trainingData) //Apply normalization to the training data
normalizer.transform(testData) //Apply normalization to the test data. This is using statistics calculated from the *training* set
// train the network
model.setListeners(ScoreIterationListener(100))
for (l in 0..2000) {
model.fit(trainingData)
}
// evaluate the network
val eval = Evaluation()
val output: INDArray = model.output(testData.features)
eval.eval(testData.labels, output)
println("Score " + eval.stats())
}
} | 41.90625 | 138 | 0.763609 |
21b5c47712dc1fec9ed0cb255e268c69246c0d3e | 2,046 | rs | Rust | src/path/uri.rs | qiuchengxuan/rs-swagger-utils | 07d842fc1baf3534af3362c2ba50cd8fb5f0fdd1 | [
"Apache-2.0"
] | null | null | null | src/path/uri.rs | qiuchengxuan/rs-swagger-utils | 07d842fc1baf3534af3362c2ba50cd8fb5f0fdd1 | [
"Apache-2.0"
] | null | null | null | src/path/uri.rs | qiuchengxuan/rs-swagger-utils | 07d842fc1baf3534af3362c2ba50cd8fb5f0fdd1 | [
"Apache-2.0"
] | null | null | null | use std::iter::Iterator;
use super::{In, Operation, Parameter};
use common::TypeDefinition;
use validator::integer::IntegerValidator;
use validator::string::StringValidator;
pub enum Segment<'a> {
Fixed(&'a str),
Text(StringValidator),
Number(IntegerValidator),
}
pub struct SegmentIter<'a> {
tokens: Vec<&'a str>,
parameters: &'a Option<Vec<Parameter>>,
token_index: usize,
}
impl<'a> Iterator for SegmentIter<'a> {
type Item = Segment<'a>;
fn next(&mut self) -> Option<Segment<'a>> {
if self.token_index >= self.tokens.len() {
return None;
}
let token = self.tokens[self.token_index];
self.token_index += 1;
if !token.starts_with("{") || !token.ends_with("}") {
return Some(Segment::Fixed(token));
}
let token = &token[1..token.len() - 1];
let parameters = match self.parameters {
Some(parameters) => parameters,
None => return Some(Segment::Fixed(token)),
};
for parameter in parameters.iter() {
if parameter.name != token || parameter.in_ != In::Path {
continue;
}
return match parameter.attribute.definition.as_ref().unwrap() {
TypeDefinition::Integer(integer_type) => {
Some(Segment::Number(IntegerValidator::from(integer_type)))
}
TypeDefinition::String(string_type) => {
Some(Segment::Text(StringValidator::from(string_type)))
}
_ => Some(Segment::Text(StringValidator::default())),
};
}
return None;
}
}
impl<'a> From<(&'a String, &'a Operation)> for SegmentIter<'a> {
fn from(tuple: (&'a String, &'a Operation)) -> Self {
let (path, operation) = tuple;
let tokens: Vec<&str> = path[1..].split("/").collect();
SegmentIter {
tokens,
parameters: &operation.parameters,
token_index: 0,
}
}
}
| 30.088235 | 79 | 0.549853 |
64f69d6a5e74c1001fb7eaf004c6c1f281f98ec4 | 946 | java | Java | src/test/java/dhbwka/wwi/fridgeshare/jpa/ProduktTest.java | schanne/FridgeShare | 5f3bc65549f21a2b455936514b96851d6ace78c6 | [
"CC-BY-4.0"
] | null | null | null | src/test/java/dhbwka/wwi/fridgeshare/jpa/ProduktTest.java | schanne/FridgeShare | 5f3bc65549f21a2b455936514b96851d6ace78c6 | [
"CC-BY-4.0"
] | null | null | null | src/test/java/dhbwka/wwi/fridgeshare/jpa/ProduktTest.java | schanne/FridgeShare | 5f3bc65549f21a2b455936514b96851d6ace78c6 | [
"CC-BY-4.0"
] | 1 | 2019-05-05T18:00:12.000Z | 2019-05-05T18:00:12.000Z | package dhbwka.wwi.fridgeshare.jpa;
import org.junit.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
*
* @author maxwi
*/
public class ProduktTest {
Produkt produkt = new Produkt("Apfel", "3" , dhbwka.wwi.fridgeshare.jpa.ProduktKategorie.Obst, ProduktMaßeinheit.ml, "K", "max");
@Test
public void testGetOwner() {
System.out.println("getOwner");
String expResult = "max";
String result = produkt.getOwner() ;
assertEquals(expResult, result);
}
@Test
public void testgetName(){
System.out.println("getName");
String expResult = "Apfel";
String result = produkt.getName();
assertEquals(expResult, result);
}
@Test
public void testgetOrt(){
System.out.println("getOrt");
String expResult = "K";
String result = produkt.getOrt();
assertEquals(expResult, result);
}
}
| 24.894737 | 133 | 0.61945 |
bf6e398991c5cb0dfc590fb0c900cb77c60e2ab8 | 130 | kt | Kotlin | vk-api/src/main/kotlin/name/alatushkin/api/vk/generated/groups/SubjectItem.kt | alatushkin/kotlin-vk-api | 123bd61b24be70f9bbf044328b98a3901523cb1b | [
"MIT"
] | 10 | 2018-11-27T09:44:37.000Z | 2020-01-18T11:00:40.000Z | vk-api/src/main/kotlin/name/alatushkin/api/vk/generated/groups/SubjectItem.kt | alatushkin/kotlin-vk-api | 123bd61b24be70f9bbf044328b98a3901523cb1b | [
"MIT"
] | 4 | 2018-11-30T09:45:24.000Z | 2018-12-10T16:14:29.000Z | vk-api/src/main/kotlin/name/alatushkin/api/vk/generated/groups/SubjectItem.kt | alatushkin/kotlin-vk-api | 123bd61b24be70f9bbf044328b98a3901523cb1b | [
"MIT"
] | 3 | 2018-11-30T09:39:21.000Z | 2020-05-13T19:09:23.000Z | package name.alatushkin.api.vk.generated.groups
open class SubjectItem(
val id: Long? = null,
val name: String? = null
) | 18.571429 | 47 | 0.7 |
97dcacb4d0256b9c198e4d5e6c97ea55aef9997d | 10,174 | dart | Dart | test/directory_test.dart | MichaelRFairhurst/test_descriptor | 3470bcc599fee8e32fd993e1fcf0ad54829f8068 | [
"BSD-3-Clause"
] | null | null | null | test/directory_test.dart | MichaelRFairhurst/test_descriptor | 3470bcc599fee8e32fd993e1fcf0ad54829f8068 | [
"BSD-3-Clause"
] | null | null | null | test/directory_test.dart | MichaelRFairhurst/test_descriptor | 3470bcc599fee8e32fd993e1fcf0ad54829f8068 | [
"BSD-3-Clause"
] | null | null | null | // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@TestOn('vm')
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:path/path.dart' as p;
import 'package:term_glyph/term_glyph.dart' as term_glyph;
import 'package:test/test.dart';
import 'package:test_descriptor/test_descriptor.dart' as d;
import 'utils.dart';
void main() {
group("create()", () {
test("creates a directory and its contents", () async {
await d.dir('dir', [
d.dir('subdir', [
d.file('subfile1.txt', 'subcontents1'),
d.file('subfile2.txt', 'subcontents2')
]),
d.file('file1.txt', 'contents1'),
d.file('file2.txt', 'contents2')
]).create();
expect(new File(p.join(d.sandbox, 'dir', 'file1.txt')).readAsString(),
completion(equals('contents1')));
expect(new File(p.join(d.sandbox, 'dir', 'file2.txt')).readAsString(),
completion(equals('contents2')));
expect(
new File(p.join(d.sandbox, 'dir', 'subdir', 'subfile1.txt'))
.readAsString(),
completion(equals('subcontents1')));
expect(
new File(p.join(d.sandbox, 'dir', 'subdir', 'subfile2.txt'))
.readAsString(),
completion(equals('subcontents2')));
});
test("works if the directory already exists", () async {
await d.dir('dir').create();
await d.dir('dir', [d.file('name.txt', 'contents')]).create();
expect(new File(p.join(d.sandbox, 'dir', 'name.txt')).readAsString(),
completion(equals('contents')));
});
});
group("validate()", () {
test("completes successfully if the filesystem matches the descriptor",
() async {
var dirPath = p.join(d.sandbox, 'dir');
var subdirPath = p.join(dirPath, 'subdir');
await new Directory(subdirPath).create(recursive: true);
await new File(p.join(dirPath, 'file1.txt')).writeAsString('contents1');
await new File(p.join(dirPath, 'file2.txt')).writeAsString('contents2');
await new File(p.join(subdirPath, 'subfile1.txt'))
.writeAsString('subcontents1');
await new File(p.join(subdirPath, 'subfile2.txt'))
.writeAsString('subcontents2');
await d.dir('dir', [
d.dir('subdir', [
d.file('subfile1.txt', 'subcontents1'),
d.file('subfile2.txt', 'subcontents2')
]),
d.file('file1.txt', 'contents1'),
d.file('file2.txt', 'contents2')
]).validate();
});
test("fails if the directory doesn't exist", () async {
var dirPath = p.join(d.sandbox, 'dir');
await new Directory(dirPath).create();
await new File(p.join(dirPath, 'file1.txt')).writeAsString('contents1');
await new File(p.join(dirPath, 'file2.txt')).writeAsString('contents2');
expect(
d.dir('dir', [
d.dir('subdir', [
d.file('subfile1.txt', 'subcontents1'),
d.file('subfile2.txt', 'subcontents2')
]),
d.file('file1.txt', 'contents1'),
d.file('file2.txt', 'contents2')
]).validate(),
throwsA(toString(
equals('Directory not found: "${p.join('dir', 'subdir')}".'))));
});
test("emits an error for each child that fails to validate", () async {
var dirPath = p.join(d.sandbox, 'dir');
var subdirPath = p.join(dirPath, 'subdir');
await new Directory(subdirPath).create(recursive: true);
await new File(p.join(dirPath, 'file1.txt')).writeAsString('contents1');
await new File(p.join(subdirPath, 'subfile2.txt'))
.writeAsString('subwrongtents2');
var errors = 0;
var controller = new StreamController<String>();
runZoned(() {
d.dir('dir', [
d.dir('subdir', [
d.file('subfile1.txt', 'subcontents1'),
d.file('subfile2.txt', 'subcontents2')
]),
d.file('file1.txt', 'contents1'),
d.file('file2.txt', 'contents2')
]).validate();
},
onError: expectAsync1((error) {
errors++;
controller.add(error.toString());
if (errors == 3) controller.close();
}, count: 3));
expect(
controller.stream.toList(),
completion(allOf([
contains(
'File not found: "${p.join('dir', 'subdir', 'subfile1.txt')}".'),
contains('File not found: "${p.join('dir', 'file2.txt')}".'),
contains(
startsWith('File "${p.join('dir', 'subdir', 'subfile2.txt')}" '
'should contain:')),
])));
});
});
group("load()", () {
test("loads a file", () {
var dir = d.dir('dir',
[d.file('name.txt', 'contents'), d.file('other.txt', 'wrong')]);
expect(UTF8.decodeStream(dir.load('name.txt')),
completion(equals('contents')));
});
test("loads a deeply-nested file", () {
var dir = d.dir('dir', [
d.dir('subdir',
[d.file('name.txt', 'subcontents'), d.file('other.txt', 'wrong')]),
d.dir('otherdir', [d.file('other.txt', 'wrong')]),
d.file('name.txt', 'contents')
]);
expect(UTF8.decodeStream(dir.load('subdir/name.txt')),
completion(equals('subcontents')));
});
test("fails to load a nested directory", () {
var dir = d.dir('dir', [
d.dir('subdir', [
d.dir('subsubdir', [d.file('name.txt', 'subcontents')])
]),
d.file('name.txt', 'contents')
]);
expect(
dir.load('subdir/subsubdir').toList(),
throwsA(toString(equals('Couldn\'t find a file descriptor named '
'"subsubdir" within "dir/subdir".'))));
});
test("fails to load an absolute path", () {
var dir = d.dir('dir', [d.file('name.txt', 'contents')]);
expect(() => dir.load('/name.txt'), throwsArgumentError);
});
test("fails to load '..'", () {
var dir = d.dir('dir', [d.file('name.txt', 'contents')]);
expect(() => dir.load('..'), throwsArgumentError);
});
test("fails to load a file that doesn't exist", () {
var dir = d.dir('dir', [
d.dir('subdir', [d.file('name.txt', 'contents')])
]);
expect(
dir.load('subdir/not-name.txt').toList(),
throwsA(toString(equals('Couldn\'t find a file descriptor named '
'"not-name.txt" within "dir/subdir".'))));
});
test("fails to load a file that exists multiple times", () {
var dir = d.dir('dir', [
d.dir('subdir',
[d.file('name.txt', 'contents'), d.file('name.txt', 'contents')])
]);
expect(
dir.load('subdir/name.txt').toList(),
throwsA(toString(equals('Found multiple file descriptors named '
'"name.txt" within "dir/subdir".'))));
});
test("loads a file next to a subdirectory with the same name", () {
var dir = d.dir('dir', [
d.file('name', 'contents'),
d.dir('name', [d.file('subfile', 'contents')])
]);
expect(
UTF8.decodeStream(dir.load('name')), completion(equals('contents')));
});
});
group("describe()", () {
bool oldAscii;
setUpAll(() {
oldAscii = term_glyph.ascii;
term_glyph.ascii = true;
});
tearDownAll(() {
term_glyph.ascii = oldAscii;
});
test("lists the contents of the directory", () {
var dir = d.dir('dir',
[d.file('file1.txt', 'contents1'), d.file('file2.txt', 'contents2')]);
expect(
dir.describe(),
equals("dir\n"
"+-- file1.txt\n"
"'-- file2.txt"));
});
test("lists the contents of nested directories", () {
var dir = d.dir('dir', [
d.file('file1.txt', 'contents1'),
d.dir('subdir', [
d.file('subfile1.txt', 'subcontents1'),
d.file('subfile2.txt', 'subcontents2'),
d.dir('subsubdir', [d.file('subsubfile.txt', 'subsubcontents')])
]),
d.file('file2.txt', 'contents2')
]);
expect(
dir.describe(),
equals("dir\n"
"+-- file1.txt\n"
"+-- subdir\n"
"| +-- subfile1.txt\n"
"| +-- subfile2.txt\n"
"| '-- subsubdir\n"
"| '-- subsubfile.txt\n"
"'-- file2.txt"));
});
test("with no contents returns the directory name", () {
expect(d.dir('dir').describe(), equals('dir'));
});
});
group("fromFilesystem()", () {
test("creates a descriptor based on the physical filesystem", () async {
var dir = d.dir('dir', [
d.dir('subdir', [
d.file('subfile1.txt', 'subcontents1'),
d.file('subfile2.txt', 'subcontents2')
]),
d.file('file1.txt', 'contents1'),
d.file('file2.txt', 'contents2')
]);
await dir.create();
var descriptor = new d.DirectoryDescriptor.fromFilesystem(
"dir", p.join(d.sandbox, 'dir'));
await descriptor.create(p.join(d.sandbox, 'dir2'));
await dir.validate(p.join(d.sandbox, 'dir2'));
});
test("ignores hidden files", () async {
await d.dir('dir', [
d.dir('subdir', [
d.file('subfile1.txt', 'subcontents1'),
d.file('.hidden', 'subcontents2')
]),
d.file('file1.txt', 'contents1'),
d.file('.DS_Store', 'contents2')
]).create();
var descriptor = new d.DirectoryDescriptor.fromFilesystem(
"dir2", p.join(d.sandbox, 'dir'));
await descriptor.create();
await d.dir('dir2', [
d.dir('subdir',
[d.file('subfile1.txt', 'subcontents1'), d.nothing('.hidden')]),
d.file('file1.txt', 'contents1'),
d.nothing('.DS_Store')
]).validate();
});
});
test("io refers to the directory within the sandbox", () {
expect(d.file('dir').io.path, equals(p.join(d.sandbox, 'dir')));
});
}
| 33.032468 | 81 | 0.53391 |
810c61c48f8ba3f8bc29055c4f7d606604fcd950 | 1,821 | kt | Kotlin | app/src/main/java/com/gregory/ideabox/views/ideas/IdeasFragment.kt | videogreg93/IdeaBox | 698ef499989350f927ea2cb64340a390711031e9 | [
"MIT"
] | null | null | null | app/src/main/java/com/gregory/ideabox/views/ideas/IdeasFragment.kt | videogreg93/IdeaBox | 698ef499989350f927ea2cb64340a390711031e9 | [
"MIT"
] | 5 | 2019-03-04T01:57:18.000Z | 2019-03-07T17:33:38.000Z | app/src/main/java/com/gregory/ideabox/views/ideas/IdeasFragment.kt | videogreg93/IdeaBox | 698ef499989350f927ea2cb64340a390711031e9 | [
"MIT"
] | null | null | null | package com.gregory.ideabox.views.ideas
import android.os.Bundle
import android.support.v4.app.Fragment
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ArrayAdapter
import com.gregory.ideabox.R
import com.gregory.ideabox.models.Category
import com.gregory.ideabox.models.Idea
import com.gregory.ideabox.views.categories.CategoriesFragment
import kotlinx.android.synthetic.main.fragment_ideas.*
import kotlinx.android.synthetic.main.fragment_ideas.view.*
class IdeasFragment : Fragment(), IdeasContract.View {
override lateinit var presenter: IdeasContract.Presenter
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_ideas, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
IdeasPresenter(this)
add_idea_button?.visibility = View.VISIBLE
add_idea_button?.setOnClickListener {
// TODO add idea
presenter.addIdea(Idea("Test Idea", "Movies"))
}
// TODO link up to viewmodel to get ideas
getIdeas()
}
private fun getIdeas() {
val ideas: Array<Idea> = arguments?.get(CategoriesFragment.IDEA_ARG) as Array<Idea>
list?.adapter = ArrayAdapter<Idea>(requireContext(), R.layout.support_simple_spinner_dropdown_item, ideas)
}
override fun onIdeaAdded() {
// TODO not do this because we'll be linked to viewmodel
getIdeas()
}
override fun onError() {
Log.e("IdeasFragment", "Could not get ideas")
}
}
| 30.864407 | 114 | 0.713893 |
3322558b16b9e4d86a91248106c527a75ff6b943 | 2,350 | py | Python | miyamoto/test/mocks.py | caedesvvv/miyamoto | d781dffeb0b2af3ce679f13114f47e6965d1cdb1 | [
"MIT"
] | 1 | 2015-01-20T17:32:19.000Z | 2015-01-20T17:32:19.000Z | miyamoto/test/mocks.py | caedesvvv/miyamoto | d781dffeb0b2af3ce679f13114f47e6965d1cdb1 | [
"MIT"
] | null | null | null | miyamoto/test/mocks.py | caedesvvv/miyamoto | d781dffeb0b2af3ce679f13114f47e6965d1cdb1 | [
"MIT"
] | null | null | null | from twisted.web import server, resource
class MockSubscriber(resource.Resource):
isLeaf = True
def render_GET(self, request):
if request.path.endswith('/callback'):
return request.args.get('hub.challenge', [''])[0]
else:
return "Huh?"
class MockPublisher(resource.Resource):
isLeaf = True
def render(self, request):
host = '%s:%s' % (request.host.host, request.host.port)
if request.path.endswith('/happycats.xml'):
request.setHeader('content-type', 'application/atom+xml')
return """<?xml version="1.0"?>
<feed>
<!-- Normally here would be source, title, etc ... -->
<link rel="hub" href="http://%s/" />
<link rel="self" href="http://%s%s" />
<updated>2008-08-11T02:15:01Z</updated>
<!-- Example of a full entry. -->
<entry>
<title>Heathcliff</title>
<link href="http://publisher.example.com/happycat25.xml" />
<id>http://publisher.example.com/happycat25.xml</id>
<updated>2008-08-11T02:15:01Z</updated>
<content>
What a happy cat. Full content goes here.
</content>
</entry>
<!-- Example of an entity that isn't full/is truncated. This is implied
by the lack of a <content> element and a <summary> element instead. -->
<entry >
<title>Heathcliff</title>
<link href="http://publisher.example.com/happycat25.xml" />
<id>http://publisher.example.com/happycat25.xml</id>
<updated>2008-08-11T02:15:01Z</updated>
<summary>
What a happy cat!
</summary>
</entry>
<!-- Meta-data only; implied by the lack of <content> and
<summary> elements. -->
<entry>
<title>Garfield</title>
<link rel="alternate" href="http://publisher.example.com/happycat24.xml" />
<id>http://publisher.example.com/happycat25.xml</id>
<updated>2008-08-11T02:15:01Z</updated>
</entry>
<!-- Context entry that's meta-data only and not new. Implied because the
update time on this entry is before the //atom:feed/updated time. -->
<entry>
<title>Nermal</title>
<link rel="alternate" href="http://publisher.example.com/happycat23s.xml" />
<id>http://publisher.example.com/happycat25.xml</id>
<updated>2008-07-10T12:28:13Z</updated>
</entry>
</feed>""" % (host, host, request.path)
else:
return 'Huh?' | 33.098592 | 80 | 0.625106 |
6c008ada9afd47d81c55ba159aefea1149e57b89 | 747 | go | Go | main.go | go-T/fileserver | 3abda08a89dfa30d8bef317450f1b495d86be83d | [
"MIT"
] | null | null | null | main.go | go-T/fileserver | 3abda08a89dfa30d8bef317450f1b495d86be83d | [
"MIT"
] | null | null | null | main.go | go-T/fileserver | 3abda08a89dfa30d8bef317450f1b495d86be83d | [
"MIT"
] | null | null | null | package main
import (
"flag"
"fmt"
"net/http"
"time"
)
var (
flagV = flag.Bool("v", true, "verbose")
flagBind = flag.String("bind", ":8000", "http listen address")
flagRoot = flag.String("root", ".", "document root dir")
)
func main() {
if *flagV {
fmt.Printf("run file server on address %s dir %s\n", *flagBind, *flagRoot)
}
var handler http.Handler = http.FileServer(http.Dir(*flagRoot))
if *flagV {
next := handler
handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
start := time.Now()
next.ServeHTTP(w, r)
fmt.Printf("%s - %s %s - %v\n", r.RemoteAddr, r.Method, r.RequestURI, time.Since(start))
})
}
err := http.ListenAndServe(*flagBind, handler)
if err != nil {
panic(err)
}
}
| 20.75 | 91 | 0.631861 |
b4168cc0dacbba962614743147d8c183d4eac7b0 | 970 | asm | Assembly | 9/01.asm | Changlon/x86Assembly | f363aaad6231f27d2e27e05be2c765e7be34099c | [
"MIT"
] | null | null | null | 9/01.asm | Changlon/x86Assembly | f363aaad6231f27d2e27e05be2c765e7be34099c | [
"MIT"
] | null | null | null | 9/01.asm | Changlon/x86Assembly | f363aaad6231f27d2e27e05be2c765e7be34099c | [
"MIT"
] | null | null | null | ; @author Changlon <changlong.a2@gmail.com>
; @github https://github.com/Changlon
; @date 2022-02-14 18:29:57
;指令的组成 = 操作码 + ModR/M SIB
; ModR/M字段的组成
; mod (7-6) reg/opcode (5-3) r/m (2-0)
; 11 -> [EAX/AX/AL..] 001 ->[cx/cl/ecx..] 000 -> mod 11
; 88 11001000 -> 88c8
; mov al, cl 字节码 -> 88C8
; 88 -> 为8位操作主码, c8是 ModR/M 一个字节
; SIB 字段组成
; 倍率 scal 索引寄存器编号 index 基址寄存器编号 base
; add edx,[eax + ebx*2]
; ADD r32 r/m32
; 操作码 = 03 reg = 010 mod = 00 r/m 100
; base = 000 index = 011 scal = 01 (2^scal)
; 03 0001 0100 0101 1000
; 机器码 = 03 14 58
;练习
; 默认操作尺寸为16的前提下编译的机器指令
; bits 16
; mov al,dl 88D0
; mov ax,dx 89D0
; mov eax,edx 6689D0 当 bits 32时指令为 89D0
; mov [bx+di],dh 8831
; mov [bx+ di],si 8931
; mov [bx+di],esi 668931
; mov [ecx],esi 66678931
; mov [ecx],si 678931
;movsb A4
;movsw A5
;movsd 66A5
| 15.645161 | 74 | 0.525773 |
aeaa6ab7ae3d78a4aa948a05b68928ef416059da | 1,103 | sql | SQL | db/migrate/000390_community_closed_reason.sql | DjordjeVucinac82/crunchbutton | 48359c89252c4729998cdeb87e8c623a09718dda | [
"MIT"
] | 92 | 2017-04-25T19:56:23.000Z | 2021-12-10T20:22:49.000Z | db/migrate/000390_community_closed_reason.sql | DjordjeVucinac82/crunchbutton | 48359c89252c4729998cdeb87e8c623a09718dda | [
"MIT"
] | 24 | 2017-04-18T01:53:34.000Z | 2021-01-10T18:10:41.000Z | db/migrate/000390_community_closed_reason.sql | DjordjeVucinac82/crunchbutton | 48359c89252c4729998cdeb87e8c623a09718dda | [
"MIT"
] | 54 | 2017-04-14T00:21:34.000Z | 2022-01-22T07:57:06.000Z | CREATE TABLE `community_closed_reason` (
`id_community_closed_reason` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_admin` int(11) unsigned DEFAULT NULL,
`id_driver` int(11) unsigned DEFAULT NULL,
`id_community` int(11) unsigned DEFAULT NULL,
`date` datetime DEFAULT NULL,
`type` enum('all_restaurants','close_3rd_party_delivery_restaurants') DEFAULT NULL,
`reason` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id_community_closed_reason`),
KEY `community_closed_reason_ibfk_1` (`id_community`),
KEY `community_closed_reason_ibfk_2` (`id_admin`),
KEY `community_closed_reason_ibfk_3` (`id_driver`),
CONSTRAINT `community_closed_reason_ibfk_1` FOREIGN KEY (`id_community`) REFERENCES `community` (`id_community`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `community_closed_reason_ibfk_2` FOREIGN KEY (`id_admin`) REFERENCES `admin` (`id_admin`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `community_closed_reason_ibfk_3` FOREIGN KEY (`id_driver`) REFERENCES `admin` (`id_admin`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; | 68.9375 | 151 | 0.788758 |
3837afd05fe7df5041c851851c29d088b664f1a7 | 558 | swift | Swift | Sources/Service/HTTP/ServiceRunnable.swift | Naamio/palvelu | ea88ea57dd893409f3562fb19ad4454509d8e714 | [
"MIT"
] | null | null | null | Sources/Service/HTTP/ServiceRunnable.swift | Naamio/palvelu | ea88ea57dd893409f3562fb19ad4454509d8e714 | [
"MIT"
] | null | null | null | Sources/Service/HTTP/ServiceRunnable.swift | Naamio/palvelu | ea88ea57dd893409f3562fb19ad4454509d8e714 | [
"MIT"
] | null | null | null | import Kitura
/// # ServiceRunnable
///
/// Represents an executable service runtime. This should be
/// a high-level wrapper around a standard HTTP process, with
/// routable capabilities.
public protocol ServiceRunnable {
var port: Int { get }
/// Router assigned to the HTTP process.
var router: Router? { get set }
/// Initializes a new `ServiceRunnable` object with a specified
/// port.
///
/// - Parameters:
/// - withPort: Port number to use for the runnable process.
///
init(withPort port: Int)
} | 25.363636 | 67 | 0.648746 |
38acb4b7a9a227db62dd2224f527e21064f17718 | 3,971 | h | C | RealtimeStreaming/Source/Shared/NetworkMediaSink.h | matealex/MixedRealityCompanionKit | cbd61ca6b2a45f8dd6855995bf539cbdfe194ea7 | [
"MIT"
] | 204 | 2017-08-12T12:57:26.000Z | 2019-04-25T20:22:12.000Z | RealtimeStreaming/Source/Shared/NetworkMediaSink.h | matealex/MixedRealityCompanionKit | cbd61ca6b2a45f8dd6855995bf539cbdfe194ea7 | [
"MIT"
] | 159 | 2017-08-12T09:38:46.000Z | 2019-04-25T17:04:50.000Z | RealtimeStreaming/Source/Shared/NetworkMediaSink.h | matealex/MixedRealityCompanionKit | cbd61ca6b2a45f8dd6855995bf539cbdfe194ea7 | [
"MIT"
] | 159 | 2017-08-13T22:51:09.000Z | 2019-05-02T02:32:55.000Z | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#pragma once
#include "Media.NetworkMediaSink.g.h"
#include <mfapi.h>
#include <mfidl.h>
#include <mferror.h>
namespace winrt::RealtimeStreaming::Media::implementation
{
struct NetworkMediaSink : NetworkMediaSinkT<NetworkMediaSink, IMFMediaSink, IMFClockStateSink>
{
public:
NetworkMediaSink(_In_ RealtimeStreaming::Network::Connection connection);
virtual ~NetworkMediaSink();
// IMediaExtension
void SetProperties(Windows::Foundation::Collections::IPropertySet const& configuration) {};
// IMFMediaSink methods
IFACEMETHOD(GetCharacteristics)(
_Out_ DWORD* pdwCharacteristics);
IFACEMETHOD(AddStreamSink)(
_In_ DWORD dwStreamSinkIdentifier,
_In_opt_ IMFMediaType* pMediaType,
_COM_Outptr_opt_ IMFStreamSink** ppStreamSink);
IFACEMETHOD(RemoveStreamSink)(
_In_ DWORD dwStreamSinkIdentifier);
IFACEMETHOD(GetStreamSinkCount)(
_Out_ DWORD* pcStreamSinkCount);
IFACEMETHOD(GetStreamSinkByIndex)(
_In_ DWORD dwIndex,
_COM_Outptr_opt_ IMFStreamSink** ppStreamSink);
IFACEMETHOD(GetStreamSinkById)(
_In_ DWORD dwIdentifier,
_COM_Outptr_opt_ IMFStreamSink** ppStreamSink);
IFACEMETHOD(SetPresentationClock)(
_In_opt_ IMFPresentationClock* pPresentationClock);
IFACEMETHOD(GetPresentationClock)(
_COM_Outptr_opt_ IMFPresentationClock** ppPresentationClock);
IFACEMETHOD(Shutdown)();
// IMFClockStateSink methods
IFACEMETHOD(OnClockStart)(
_In_ MFTIME hnsSystemTime,
_In_ LONGLONG llClockStartOffset);
IFACEMETHOD(OnClockStop)(
_In_ MFTIME hnsSystemTime);
IFACEMETHOD(OnClockPause)(
_In_ MFTIME hnsSystemTime);
IFACEMETHOD(OnClockRestart)(
_In_ MFTIME hnsSystemTime);
IFACEMETHOD(OnClockSetRate)(
_In_ MFTIME hnsSystemTime,
_In_ float flRate);
// NetworkMediaSink
void StartNetwork();
void StopNetwork();
winrt::event_token NetworkMediaSink::Closed(Windows::Foundation::EventHandler<bool> const& handler);
void NetworkMediaSink::Closed(winrt::event_token const& token);
private:
winrt::fire_and_forget SendStreamReady();
winrt::fire_and_forget SendStreamStopped();
winrt::fire_and_forget SendDescription();
void OnDataReceived(
//_In_ Network::Connection const& sender,
_In_ IInspectable const& sender,
_In_ Network::DataBundleArgs const& args);
HRESULT HandleError(_In_ HRESULT hr);
HRESULT CheckShutdown()
{
NULL_CHK_HR(m_connection, MF_E_SHUTDOWN);
//IFT(_cStreamsEnded == 0 ? S_OK : MF_E_SHUTDOWN);
return S_OK;
}
private:
slim_mutex m_lock;
LONGLONG m_llStartTime;
winrt::com_ptr<IMFPresentationClock> m_presentationClock; // Presentation clock.
std::vector<winrt::com_ptr<IMFStreamSink> > m_streams;
RealtimeStreaming::Network::Connection m_connection{ nullptr };
winrt::event_token m_bundleReceivedEventToken;
winrt::event<Windows::Foundation::EventHandler<bool>> m_evtClosed;
};
}
namespace winrt::RealtimeStreaming::Media::factory_implementation
{
struct NetworkMediaSink : NetworkMediaSinkT<NetworkMediaSink, implementation::NetworkMediaSink>
{
};
}
| 36.431193 | 112 | 0.625031 |
39efef0f5f826327a53625e5d822320d101e817f | 989 | java | Java | src/com/codingpractice/codingBlocks/RecursionPrint/PrintBoardPath.java | bhupendra11/CodingPractice | 4a795842d38a9f8231e4a883c1b0d2f34c1c760d | [
"MIT"
] | null | null | null | src/com/codingpractice/codingBlocks/RecursionPrint/PrintBoardPath.java | bhupendra11/CodingPractice | 4a795842d38a9f8231e4a883c1b0d2f34c1c760d | [
"MIT"
] | null | null | null | src/com/codingpractice/codingBlocks/RecursionPrint/PrintBoardPath.java | bhupendra11/CodingPractice | 4a795842d38a9f8231e4a883c1b0d2f34c1c760d | [
"MIT"
] | null | null | null | package com.codingpractice.codingBlocks.RecursionPrint;
public class PrintBoardPath {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Count board path = "+countBoardpath(0, 10));
printBoardPath(0, 10, "");
}
public static void printBoardPath(int curr, int end, String soFar) {
if(curr > end) {
return;
}
if( curr==end) {
System.out.println(soFar);
return;
}
for(int dice=1; dice<=6; dice++) {
printBoardPath(curr+dice, end, soFar+dice);
}
}
public static int countBoardpath(int curr, int end) {
if(curr==end) {
return 1;
}
if(curr > end) {
return 0;
}
int count =0;
for(int dice=1; dice<=6 ;dice++) {
count += countBoardpath(curr+dice, end);
}
return count;
}
}
| 4.3 | 69 | 0.50455 |
04490c37b796be21e75833746eb7da99c7ef27bb | 2,763 | java | Java | jmetal-core/src/main/java/org/uma/jmetal/solution/AbstractSolution.java | OptMLCao/jMetal | b05e5a7f6e92ca0ef87f9a71841a717d0fc521bd | [
"MIT"
] | null | null | null | jmetal-core/src/main/java/org/uma/jmetal/solution/AbstractSolution.java | OptMLCao/jMetal | b05e5a7f6e92ca0ef87f9a71841a717d0fc521bd | [
"MIT"
] | 1 | 2022-03-11T08:48:37.000Z | 2022-03-11T08:48:39.000Z | jmetal-core/src/main/java/org/uma/jmetal/solution/AbstractSolution.java | OptMLCao/jMetal | b05e5a7f6e92ca0ef87f9a71841a717d0fc521bd | [
"MIT"
] | 1 | 2022-03-11T08:48:31.000Z | 2022-03-11T08:48:31.000Z | package org.uma.jmetal.solution;
import org.uma.jmetal.util.errorchecking.JMetalException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Abstract class representing a generic solution
*
* @author Antonio J. Nebro <antonio@lcc.uma.es>
*/
@SuppressWarnings("serial")
public abstract class AbstractSolution<T> implements Solution<T> {
private double[] objectives;
private List<T> variables;
private double[] constraints;
protected Map<Object, Object> attributes;
@Override
public List<T> variables() {
return variables;
}
@Override
public double[] objectives() {
return objectives;
}
@Override
public double[] constraints() {
return constraints;
}
@Override
public Map<Object, Object> attributes() {
return attributes;
}
/**
* Constructor
*/
protected AbstractSolution(int numberOfVariables, int numberOfObjectives) {
this(numberOfVariables, numberOfObjectives, 0);
}
/**
* Constructor
*/
protected AbstractSolution(
int numberOfVariables, int numberOfObjectives, int numberOfConstraints) {
attributes = new HashMap<>();
variables = new ArrayList<>(numberOfVariables);
for (int i = 0; i < numberOfVariables; i++) {
variables.add(i, null);
}
objectives = new double[numberOfObjectives];
for (int i = 0; i < numberOfObjectives; i++) {
objectives[i] = 0.0;
}
constraints = new double[numberOfConstraints];
for (int i = 0; i < numberOfConstraints; i++) {
constraints[i] = 0.0;
}
attributes = new HashMap<Object, Object>();
}
@Override
public String toString() {
StringBuilder result = new StringBuilder("Variables: ");
for (T var : variables) {
result.append(var).append(" ");
}
result.append("Objectives: ");
for (Double obj : objectives) {
result.append(obj).append(" ");
}
result.append("Constraints: ");
for (Double obj : constraints) {
result.append(obj).append(" ");
}
result.append("\t");
result.append("AlgorithmAttributes: ").append(attributes).append("\n");
return result.toString();
}
@Override
public boolean equals(Object o) {
if (o == null) {
throw new JMetalException("The solution to compare is null");
}
Solution<T> solution = (Solution<T>) o;
return this.variables().equals(solution.variables());
}
@Override
public int hashCode() {
return variables.hashCode();
}
}
| 25.118182 | 85 | 0.596091 |
0437103495f058351fbe1f8f5fea6801c745fc75 | 5,869 | java | Java | core/src/main/java/org/apache/druid/data/input/impl/JsonReader.java | natsumehu/druid | 2b32d86f3bcbee83b800614f9862f7130635cd92 | [
"Apache-2.0"
] | 1 | 2022-03-24T12:25:09.000Z | 2022-03-24T12:25:09.000Z | core/src/main/java/org/apache/druid/data/input/impl/JsonReader.java | natsumehu/druid | 2b32d86f3bcbee83b800614f9862f7130635cd92 | [
"Apache-2.0"
] | 3 | 2022-01-06T00:44:22.000Z | 2022-03-18T00:59:31.000Z | core/src/main/java/org/apache/druid/data/input/impl/JsonReader.java | ustcldf/druid | 033989eb1d8f4f91268b2d7d4d3dc73af7bf2c3f | [
"Apache-2.0"
] | 2 | 2022-01-17T22:37:05.000Z | 2022-02-16T21:51:00.000Z | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.druid.data.input.impl;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MappingIterator;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.Iterators;
import org.apache.commons.io.IOUtils;
import org.apache.druid.data.input.InputEntity;
import org.apache.druid.data.input.InputRow;
import org.apache.druid.data.input.InputRowSchema;
import org.apache.druid.data.input.IntermediateRowParsingReader;
import org.apache.druid.java.util.common.CloseableIterators;
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.java.util.common.parsers.CloseableIterator;
import org.apache.druid.java.util.common.parsers.JSONFlattenerMaker;
import org.apache.druid.java.util.common.parsers.JSONPathSpec;
import org.apache.druid.java.util.common.parsers.ObjectFlattener;
import org.apache.druid.java.util.common.parsers.ObjectFlatteners;
import org.apache.druid.java.util.common.parsers.ParseException;
import org.apache.druid.utils.CollectionUtils;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* In constract to {@link JsonLineReader} which processes input text line by line independently,
* this class tries to parse the input text as a whole to an array of objects.
*
* The input text can be:
* 1. a JSON string of an object in a line or multiple lines(such as pretty-printed JSON text)
* 2. multiple JSON object strings concated by white space character(s)
*
* For case 2, what should be noticed is that if an exception is thrown when parsing one JSON string,
* the rest JSON text will all be ignored
*
* For more information, see: https://github.com/apache/druid/pull/10383
*/
public class JsonReader extends IntermediateRowParsingReader<String>
{
private final ObjectFlattener<JsonNode> flattener;
private final ObjectMapper mapper;
private final InputEntity source;
private final InputRowSchema inputRowSchema;
private final JsonFactory jsonFactory;
JsonReader(
InputRowSchema inputRowSchema,
InputEntity source,
JSONPathSpec flattenSpec,
ObjectMapper mapper,
boolean keepNullColumns
)
{
this.inputRowSchema = inputRowSchema;
this.source = source;
this.flattener = ObjectFlatteners.create(flattenSpec, new JSONFlattenerMaker(keepNullColumns));
this.mapper = mapper;
this.jsonFactory = new JsonFactory();
}
@Override
protected CloseableIterator<String> intermediateRowIterator() throws IOException
{
return CloseableIterators.withEmptyBaggage(
Iterators.singletonIterator(IOUtils.toString(source.open(), StringUtils.UTF8_STRING))
);
}
@Override
protected List<InputRow> parseInputRows(String intermediateRow) throws IOException, ParseException
{
final List<InputRow> inputRows;
try (JsonParser parser = jsonFactory.createParser(intermediateRow)) {
final MappingIterator<JsonNode> delegate = mapper.readValues(parser, JsonNode.class);
inputRows = FluentIterable.from(() -> delegate)
.transform(jsonNode -> MapInputRowParser.parse(inputRowSchema, flattener.flatten(jsonNode)))
.toList();
}
catch (RuntimeException e) {
//convert Jackson's JsonParseException into druid's exception for further processing
//JsonParseException will be thrown from MappingIterator#hasNext or MappingIterator#next when input json text is ill-formed
if (e.getCause() instanceof JsonParseException) {
throw new ParseException(intermediateRow, e, "Unable to parse row [%s]", intermediateRow);
}
//throw unknown exception
throw e;
}
if (CollectionUtils.isNullOrEmpty(inputRows)) {
throw new ParseException(
intermediateRow,
"Unable to parse [%s] as the intermediateRow resulted in empty input row",
intermediateRow
);
}
return inputRows;
}
@Override
protected List<Map<String, Object>> toMap(String intermediateRow) throws IOException
{
try (JsonParser parser = jsonFactory.createParser(intermediateRow)) {
final MappingIterator<Map> delegate = mapper.readValues(parser, Map.class);
return FluentIterable.from(() -> delegate)
.transform(map -> (Map<String, Object>) map)
.toList();
}
catch (RuntimeException e) {
//convert Jackson's JsonParseException into druid's exception for further processing
//JsonParseException will be thrown from MappingIterator#hasNext or MappingIterator#next when input json text is ill-formed
if (e.getCause() instanceof JsonParseException) {
throw new ParseException(intermediateRow, e, "Unable to parse row [%s]", intermediateRow);
}
//throw unknown exception
throw e;
}
}
}
| 40.756944 | 129 | 0.742034 |
c7f6bd8087e33d171126f2aca954e1ce2fac1bd0 | 26,461 | py | Python | cloudify_libvirt/tests/test_volume.py | 0lvin-cfy/cloudify-libvirt-plugin | 90e77da5bf086dfb7ad20604a25b769badee1bb7 | [
"Apache-2.0"
] | 2 | 2017-11-29T18:21:19.000Z | 2020-06-19T03:25:23.000Z | cloudify_libvirt/tests/test_volume.py | 0lvin-cfy/cloudify-libvirt-plugin | 90e77da5bf086dfb7ad20604a25b769badee1bb7 | [
"Apache-2.0"
] | 13 | 2018-01-29T16:25:54.000Z | 2020-07-01T08:03:38.000Z | cloudify_libvirt/tests/test_volume.py | 0lvin-cfy/cloudify-libvirt-plugin | 90e77da5bf086dfb7ad20604a25b769badee1bb7 | [
"Apache-2.0"
] | 2 | 2017-11-19T15:04:39.000Z | 2020-06-19T03:25:25.000Z | # Copyright (c) 2016-2019 Cloudify Platform Ltd. 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.
import mock
import unittest
from cloudify.state import current_ctx
from cloudify.mocks import MockCloudifyContext
from cloudify.exceptions import NonRecoverableError
from cloudify_common_sdk._compat import builtins_open
from cloudify_libvirt.tests.test_common_base import LibVirtCommonTest
import cloudify_libvirt.volume_tasks as volume_tasks
class TestVolumeTasks(LibVirtCommonTest):
def _create_ctx(self):
_ctx = MockCloudifyContext(
'node_name',
properties={
'libvirt_auth': {'a': 'c'},
'params': {'pool': 'pool_name'},
},
runtime_properties={
'libvirt_auth': {'a': 'd'}
}
)
current_ctx.set(_ctx)
return _ctx
def _test_empty_connection_backup(self, func):
# check correct handle exception with empty connection
_ctx = self._create_ctx()
_ctx.instance.runtime_properties['resource_id'] = 'resource'
self._check_correct_connect(
"cloudify_libvirt.volume_tasks.libvirt.open",
func, [], {'ctx': _ctx, "snapshot_name": "backup"})
def _test_empty_volume_backup(self, func):
# check correct handle exception with empty volume
_ctx = self._create_ctx()
_ctx.instance.runtime_properties['resource_id'] = 'resource'
_ctx.instance.runtime_properties['params'] = {'pool': 'pool_name'}
self._check_no_such_object_volume(
"cloudify_libvirt.volume_tasks.libvirt.open",
func, [], {'ctx': _ctx, "snapshot_name": "backup"}, 'resource')
def _test_empty_volume(self, func):
# check correct handle exception with empty volume
_ctx = self._create_ctx()
_ctx.instance.runtime_properties['resource_id'] = 'resource'
_ctx.instance.runtime_properties['params'] = {'pool': 'pool_name'}
self._check_no_such_object_volume(
"cloudify_libvirt.volume_tasks.libvirt.open",
func, [], {'ctx': _ctx}, 'resource')
def _create_fake_volume_backup(self):
volume = mock.Mock()
volume.XMLDesc = mock.Mock(return_value="<volume/>")
volume.isActive = mock.Mock(return_value=1)
volume.name = mock.Mock(return_value="volume_name")
pool = mock.Mock()
pool.XMLDesc = mock.Mock(return_value="<pool/>")
pool.isActive = mock.Mock(return_value=1)
pool.name = mock.Mock(return_value="pool_name")
pool.storageVolLookupByName = mock.Mock(return_value=volume)
connect = self._create_fake_connection()
connect.storagePoolLookupByName = mock.Mock(return_value=pool)
_ctx = self._create_ctx()
_ctx.instance.runtime_properties['resource_id'] = 'resource'
_ctx.instance.runtime_properties['params'] = {'pool': 'pool_name'}
_ctx.node.properties['params'] = {}
_ctx.instance.runtime_properties["backups"] = {
"node_name-backup": "<xml/>"}
return _ctx, connect, pool, volume
def test_snapshot_apply(self):
self._test_no_resource_id(volume_tasks.snapshot_apply,
"No volume for restore")
self._test_no_snapshot_name(
self._create_ctx(),
"cloudify_libvirt.volume_tasks.libvirt.open",
volume_tasks.snapshot_apply)
self._test_empty_connection_backup(volume_tasks.snapshot_apply)
self._test_empty_volume_backup(volume_tasks.snapshot_apply)
# no such snapshot
_ctx, connect, pool, volume = self._create_fake_volume_backup()
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
with self.assertRaisesRegexp(
NonRecoverableError,
"No snapshots found with name: node_name-backup!."
):
volume_tasks.snapshot_apply(
ctx=_ctx, snapshot_name="backup!",
snapshot_incremental=True)
# we have such snapshot
_ctx, connect, pool, volume = self._create_fake_volume_backup()
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
volume_tasks.snapshot_apply(
ctx=_ctx, snapshot_name="backup",
snapshot_incremental=True)
# no such backup
_ctx, connect, pool, volume = self._create_fake_volume_backup()
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
with mock.patch(
"os.path.isfile",
mock.Mock(return_value=False)
):
with self.assertRaisesRegexp(
NonRecoverableError,
"No backups found with name: node_name-backup!."
):
volume_tasks.snapshot_apply(
ctx=_ctx, snapshot_name="backup!",
snapshot_incremental=False)
# have backup
_ctx, connect, pool, volume = self._create_fake_volume_backup()
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
with mock.patch(
"os.path.isfile",
mock.Mock(return_value=True)
):
fake_file = mock.mock_open()
fake_file().read.return_value = "<volume/>"
with mock.patch(
builtins_open, fake_file
):
volume_tasks.snapshot_apply(
ctx=_ctx, snapshot_name="backup!",
snapshot_incremental=False)
fake_file.assert_called_with('./backup!/resource.xml', 'r')
def test_snapshot_create(self):
self._test_no_resource_id(volume_tasks.snapshot_create,
"No volume for backup")
self._test_no_snapshot_name(
self._create_ctx(),
"cloudify_libvirt.volume_tasks.libvirt.open",
volume_tasks.snapshot_create)
self._test_empty_connection_backup(volume_tasks.snapshot_create)
self._test_empty_volume_backup(volume_tasks.snapshot_create)
# check create snapshot with error, already exists
_ctx, connect, pool, volume = self._create_fake_volume_backup()
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
with self.assertRaisesRegexp(
NonRecoverableError,
"Snapshot node_name-backup already exists."
):
volume_tasks.snapshot_create(ctx=_ctx, snapshot_name="backup",
snapshot_incremental=True)
connect.storagePoolLookupByName.assert_called_with('pool_name')
pool.storageVolLookupByName.assert_called_with('resource')
# no such snapshots
_ctx.instance.runtime_properties["backups"] = {}
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
volume_tasks.snapshot_create(ctx=_ctx, snapshot_name="backup",
snapshot_incremental=True)
self.assertEqual(
_ctx.instance.runtime_properties["backups"],
{"node_name-backup": "<volume/>"})
# check create snapshot
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
with mock.patch(
"os.path.isdir",
mock.Mock(return_value=True)
):
fake_file = mock.mock_open()
fake_file().read.return_value = "!!!!"
with mock.patch(
builtins_open, fake_file
):
# with error, already exists
with mock.patch(
"os.path.isfile",
mock.Mock(return_value=True)
):
with self.assertRaisesRegexp(
NonRecoverableError,
"Backup node_name-backup already exists."
):
volume_tasks.snapshot_create(
ctx=_ctx, snapshot_name="backup",
snapshot_incremental=False)
# without error
with mock.patch(
"os.path.isfile",
mock.Mock(return_value=False)
):
volume_tasks.snapshot_create(
ctx=_ctx, snapshot_name="backup",
snapshot_incremental=False)
fake_file().write.assert_called_with("<volume/>")
def test_snapshot_delete(self):
self._test_no_resource_id(volume_tasks.snapshot_delete,
"No volume for backup delete")
self._test_no_snapshot_name(
self._create_ctx(),
"cloudify_libvirt.volume_tasks.libvirt.open",
volume_tasks.snapshot_delete)
# no such snapshots
_ctx, connect, pool, volume = self._create_fake_volume_backup()
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
with self.assertRaisesRegexp(
NonRecoverableError,
"No snapshots found with name: node_name-backup!."
):
volume_tasks.snapshot_delete(
ctx=_ctx, snapshot_name="backup!",
snapshot_incremental=True)
self.assertEqual(
_ctx.instance.runtime_properties["backups"],
{'node_name-backup': "<xml/>"})
# remove snapshot
_ctx, connect, pool, volume = self._create_fake_volume_backup()
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
volume_tasks.snapshot_delete(ctx=_ctx, snapshot_name="backup",
snapshot_incremental=True)
self.assertEqual(_ctx.instance.runtime_properties["backups"], {})
# no such backup
_ctx, connect, pool, volume = self._create_fake_volume_backup()
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
with mock.patch(
"os.path.isfile",
mock.Mock(return_value=False)
):
with self.assertRaisesRegexp(
NonRecoverableError,
"No backups found with name: node_name-backup!."
):
volume_tasks.snapshot_delete(
ctx=_ctx, snapshot_name="backup!",
snapshot_incremental=False)
# remove backup
_ctx, connect, pool, volume = self._create_fake_volume_backup()
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
with mock.patch(
"os.path.isfile",
mock.Mock(return_value=True)
):
fake_file = mock.mock_open()
fake_file().read.return_value = "!!!!"
remove_mock = mock.Mock()
with mock.patch(
"os.remove",
remove_mock
):
with mock.patch(
builtins_open, fake_file
):
volume_tasks.snapshot_delete(
ctx=_ctx, snapshot_name="backup!",
snapshot_incremental=False)
fake_file.assert_called_with('./backup!/resource.xml', 'r')
remove_mock.assert_called_with('./backup!/resource.xml')
def test_create(self):
# check correct handle exception with empty connection
self._check_correct_connect(
"cloudify_libvirt.volume_tasks.libvirt.open",
volume_tasks.create, [], {'ctx': self._create_ctx()})
# check error with create volume image
self._check_create_object(
'Failed to find the pool',
"cloudify_libvirt.volume_tasks.libvirt.open",
volume_tasks.create, [], {'ctx': self._create_ctx(),
'params': {'pool': 'empty'}})
# successful create
_ctx = self._create_ctx()
_ctx.get_resource = mock.Mock(return_value='<somexml/>')
volume = mock.Mock()
volume.name = mock.Mock(return_value="volume_name")
pool = mock.Mock()
pool.createXML = mock.Mock(return_value=volume)
connect = self._create_fake_connection()
connect.storagePoolLookupByName = mock.Mock(return_value=pool)
# without params
_ctx.instance.runtime_properties['params'] = {}
_ctx.node.properties['params'] = {}
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
volume_tasks.create(ctx=_ctx,
template_resource="template_resource",
params={'pool': 'empty'})
pool.createXML.assert_called_with('<somexml/>')
self.assertEqual(
_ctx.instance.runtime_properties['resource_id'], "volume_name"
)
# failed check size of download
_ctx.instance.runtime_properties['resource_id'] = None
_ctx.instance.runtime_properties['params'] = {}
_ctx.node.properties['params'] = {}
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
# empty
head_response = mock.Mock()
head_response.headers = {'Content-Length': 0}
with mock.patch(
"cloudify_libvirt.volume_tasks.requests.head",
mock.Mock(return_value=head_response)
):
with self.assertRaisesRegexp(
NonRecoverableError,
"Failed to download volume."
):
volume_tasks.create(
ctx=_ctx,
template_resource="template_resource",
params={
'pool': 'empty',
'url': "https://fake.org/centos.iso"})
# sucessful check size of download
_ctx.instance.runtime_properties['resource_id'] = None
_ctx.instance.runtime_properties['params'] = {}
_ctx.node.properties['params'] = {}
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
head_response = mock.Mock()
head_response.headers = {'Content-Length': 512,
'Accept-Ranges': 'bytes'}
with mock.patch(
"cloudify_libvirt.volume_tasks.requests.head",
mock.Mock(return_value=head_response)
):
volume_tasks.create(
ctx=_ctx,
template_resource="template_resource",
params={
'pool': 'empty',
'url': "https://fake.org/centos.iso"})
# failed on create
_ctx.instance.runtime_properties['resource_id'] = None
_ctx.instance.runtime_properties['params'] = {}
_ctx.node.properties['params'] = {}
pool.createXML = mock.Mock(return_value=None)
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
with self.assertRaisesRegexp(
NonRecoverableError,
'Failed to create a virtual volume'
):
volume_tasks.create(ctx=_ctx,
template_resource="template_resource",
params={'pool': 'empty'})
def test_reuse_volume_create_not_exist(self):
# check correct handle exception with empty network
_ctx = self._create_ctx()
_ctx.instance.runtime_properties['params'] = {'pool': 'pool_name'}
self._check_no_such_object_volume(
"cloudify_libvirt.volume_tasks.libvirt.open",
volume_tasks.create, [], {
'ctx': _ctx,
"resource_id": 'resource',
"use_external_resource": True,
}, 'resource')
def test_reuse_volume_create_exist(self):
# check that we can use network
_ctx = self._create_ctx()
_ctx.instance.runtime_properties['params'] = {'pool': 'pool_name'}
volume = mock.Mock()
volume.name = mock.Mock(return_value="volume")
pool = mock.Mock()
pool.name = mock.Mock(return_value="pool")
pool.storageVolLookupByName = mock.Mock(return_value=volume)
connect = self._create_fake_connection()
connect.storagePoolLookupByName = mock.Mock(return_value=pool)
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
volume_tasks.create(ctx=_ctx,
resource_id='resource',
use_external_resource=True)
connect.storagePoolLookupByName.assert_called_with('pool_name')
pool.storageVolLookupByName.assert_called_with('resource')
self.assertEqual(
_ctx.instance.runtime_properties['resource_id'], 'volume'
)
self.assertTrue(
_ctx.instance.runtime_properties['use_external_resource']
)
def test_start(self):
# check correct handle exception with empty connection
self._test_check_correct_connect_action(
"cloudify_libvirt.volume_tasks.libvirt.open",
volume_tasks.start)
self._test_empty_volume(volume_tasks.start)
self._test_reused_object(
"cloudify_libvirt.volume_tasks.libvirt.open",
volume_tasks.start)
self._test_no_resource_id(volume_tasks.start)
def test_start_wipe(self):
# zero wipe
_ctx = self._create_ctx()
_ctx.instance.runtime_properties['resource_id'] = 'volume'
_ctx.instance.runtime_properties['params'] = {'pool': 'pool_name'}
volume = mock.Mock()
volume.name = mock.Mock(return_value="volume")
volume.upload = mock.Mock()
pool = mock.Mock()
pool.name = mock.Mock(return_value="pool")
pool.storageVolLookupByName = mock.Mock(return_value=volume)
connect = self._create_fake_connection()
connect.storagePoolLookupByName = mock.Mock(return_value=pool)
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
volume_tasks.start(ctx=_ctx,
params={
'zero_wipe': True,
'allocation': 1
})
def test_start_download(self):
# download
_ctx = self._create_ctx()
_ctx.instance.runtime_properties['resource_id'] = 'volume'
_ctx.instance.runtime_properties['params'] = {'pool': 'pool_name'}
volume = mock.Mock()
volume.name = mock.Mock(return_value="volume")
volume.upload = mock.Mock()
pool = mock.Mock()
pool.name = mock.Mock(return_value="pool")
pool.storageVolLookupByName = mock.Mock(return_value=volume)
connect = self._create_fake_connection()
connect.storagePoolLookupByName = mock.Mock(return_value=pool)
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
# empty
head_response = mock.Mock()
head_response.headers = {'Content-Length': 0}
with mock.patch(
"cloudify_libvirt.volume_tasks.requests.head",
mock.Mock(return_value=head_response)
):
with self.assertRaisesRegexp(
NonRecoverableError,
"Failed to download volume."
):
volume_tasks.start(
ctx=_ctx,
params={
'url': "https://fake.org/centos.iso"})
# 512 for download
head_response = mock.Mock()
head_response.headers = {'Content-Length': 512,
'Accept-Ranges': 'bytes'}
head_response.iter_content = mock.Mock(return_value=["\0" * 256])
with mock.patch(
"cloudify_libvirt.volume_tasks.requests.head",
mock.Mock(return_value=head_response)
):
with mock.patch(
"cloudify_libvirt.volume_tasks.requests.get",
mock.Mock(return_value=head_response)
):
volume_tasks.start(
ctx=_ctx,
params={
'url': "https://fake.org/centos.iso"})
def test_stop(self):
# check correct handle exception with empty connection
self._test_check_correct_connect_action(
"cloudify_libvirt.volume_tasks.libvirt.open",
volume_tasks.stop)
self._test_empty_volume(volume_tasks.stop)
self._test_reused_object(
"cloudify_libvirt.volume_tasks.libvirt.open",
volume_tasks.stop)
self._test_no_resource_id(volume_tasks.stop)
def test_stop_wipe(self):
# failed to wipe/error ignored
_ctx = self._create_ctx()
_ctx.instance.runtime_properties['resource_id'] = 'volume'
_ctx.instance.runtime_properties['params'] = {'pool': 'pool_name'}
volume = mock.Mock()
volume.name = mock.Mock(return_value="volume")
volume.wipe = mock.Mock(
side_effect=volume_tasks.libvirt.libvirtError("e"))
pool = mock.Mock()
pool.name = mock.Mock(return_value="pool")
pool.storageVolLookupByName = mock.Mock(return_value=volume)
connect = self._create_fake_connection()
connect.storagePoolLookupByName = mock.Mock(return_value=pool)
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
volume_tasks.stop(ctx=_ctx)
# failed to wipe/wrong response
volume.wipe = mock.Mock(return_value=-1)
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
with mock.patch(
"cloudify_libvirt.volume_tasks.time.sleep",
mock.Mock(return_value=mock.Mock())
):
volume_tasks.stop(ctx=_ctx)
# correctly wiped
volume.wipe = mock.Mock(return_value=0)
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
volume_tasks.stop(ctx=_ctx)
def test_delete(self):
# check correct handle exception with empty connection
self._test_check_correct_connect_action(
"cloudify_libvirt.volume_tasks.libvirt.open",
volume_tasks.delete)
self._test_empty_volume(volume_tasks.delete)
self._test_reused_object(
"cloudify_libvirt.volume_tasks.libvirt.open",
volume_tasks.delete)
self._test_no_resource_id(volume_tasks.delete)
# failed to remove
_ctx = self._create_ctx()
_ctx.instance.runtime_properties['resource_id'] = 'volume'
_ctx.instance.runtime_properties['params'] = {'pool': 'pool_name'}
volume = mock.Mock()
volume.name = mock.Mock(return_value="volume")
volume.delete = mock.Mock(return_value=-1)
pool = mock.Mock()
pool.name = mock.Mock(return_value="pool")
pool.storageVolLookupByName = mock.Mock(return_value=volume)
connect = self._create_fake_connection()
connect.storagePoolLookupByName = mock.Mock(return_value=pool)
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
with self.assertRaisesRegexp(
NonRecoverableError,
'Can not undefine volume.'
):
volume_tasks.delete(ctx=_ctx)
# sucessful remove
volume.delete = mock.Mock(return_value=0)
with mock.patch(
"cloudify_libvirt.volume_tasks.libvirt.open",
mock.Mock(return_value=connect)
):
volume_tasks.delete(ctx=_ctx)
self.assertEqual(
_ctx.instance.runtime_properties,
{
'backups': {},
'libvirt_auth': {'a': 'd'},
'params': {},
'resource_id': None
}
)
if __name__ == '__main__':
unittest.main()
| 39.850904 | 79 | 0.571483 |
39ff3d3586ce3e1d1c5788e3e8f65ab321933b78 | 817 | asm | Assembly | data/mapObjects/oakslab.asm | etdv-thevoid/pokemon-rgb-enhanced | 5b244c1cf46aab98b9c820d1b7888814eb7fa53f | [
"MIT"
] | 1 | 2022-01-09T05:28:52.000Z | 2022-01-09T05:28:52.000Z | data/mapObjects/oakslab.asm | ETDV-TheVoid/pokemon-rgb-enhanced | 5b244c1cf46aab98b9c820d1b7888814eb7fa53f | [
"MIT"
] | null | null | null | data/mapObjects/oakslab.asm | ETDV-TheVoid/pokemon-rgb-enhanced | 5b244c1cf46aab98b9c820d1b7888814eb7fa53f | [
"MIT"
] | null | null | null | OaksLabObject:
db $3 ; border block
db $2 ; warps
db $b, $4, $2, $ff
db $b, $5, $2, $ff
db $0 ; signs
db $b ; objects
object SPRITE_BLUE, $4, $3, STAY, NONE, $1, OPP_RIVAL1, $1
object SPRITE_BALL, $6, $3, STAY, NONE, $2 ; person
object SPRITE_BALL, $7, $3, STAY, NONE, $3 ; person
object SPRITE_BALL, $8, $3, STAY, NONE, $4 ; person
object SPRITE_OAK, $5, $2, STAY, DOWN, $5 ; person
object SPRITE_BOOK_MAP_DEX, $2, $1, STAY, NONE, $6 ; person
object SPRITE_BOOK_MAP_DEX, $3, $1, STAY, NONE, $7 ; person
object SPRITE_OAK, $5, $a, STAY, UP, $8 ; person
object SPRITE_GIRL, $1, $9, WALK, $1, $9 ; person
object SPRITE_OAK_AIDE, $2, $a, STAY, NONE, $a ; person
object SPRITE_OAK_AIDE, $8, $a, STAY, NONE, $b ; person
; warp-to
EVENT_DISP OAKS_LAB_WIDTH, $b, $4
EVENT_DISP OAKS_LAB_WIDTH, $b, $5
| 31.423077 | 60 | 0.637699 |
6e0fc3fc4031a68dddff59b2357dbd3c93a1fbea | 1,332 | sql | SQL | db/ospos_people.sql | johanC2x/Sysve_v1 | 1601ee61b543728f08132670d0719806ce019b4d | [
"MIT"
] | null | null | null | db/ospos_people.sql | johanC2x/Sysve_v1 | 1601ee61b543728f08132670d0719806ce019b4d | [
"MIT"
] | null | null | null | db/ospos_people.sql | johanC2x/Sysve_v1 | 1601ee61b543728f08132670d0719806ce019b4d | [
"MIT"
] | null | null | null | /*
Navicat MySQL Data Transfer
Source Server : localhost
Source Server Version : 50524
Source Host : localhost:3306
Source Database : ysumma
Target Server Type : MYSQL
Target Server Version : 50524
File Encoding : 65001
Date: 2018-03-25 16:50:27
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for ospos_people
-- ----------------------------
DROP TABLE IF EXISTS `ospos_people`;
CREATE TABLE `ospos_people` (
`first_name` varchar(255) NOT NULL,
`last_name` varchar(255) NOT NULL,
`phone_number` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`address_1` varchar(255) DEFAULT NULL,
`address_2` varchar(255) DEFAULT NULL,
`city` varchar(255) DEFAULT NULL,
`state` varchar(255) DEFAULT NULL,
`zip` varchar(255) DEFAULT NULL,
`country` varchar(255) DEFAULT NULL,
`comments` text,
`person_id` int(10) NOT NULL AUTO_INCREMENT,
`birthplace` varchar(255) DEFAULT NULL,
`birthdate` date DEFAULT NULL,
`type_person_id` varchar(255) DEFAULT NULL,
`num_passport` varchar(255) DEFAULT NULL,
`has_passport` varchar(255) DEFAULT NULL,
`date_passport` date DEFAULT NULL,
`nationality` varchar(255) DEFAULT NULL,
PRIMARY KEY (`person_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2147483647 DEFAULT CHARSET=utf8;
SET FOREIGN_KEY_CHECKS=1;
| 29.6 | 63 | 0.690691 |
d987579e41c8eb6bc14eb0068dd80d8e87bfe9be | 70 | sql | SQL | db/schema.sql | mwpx777/Tech-Blog-1 | ba4cddebebf6207f3e0d826c57dbe071aa6f9854 | [
"ISC"
] | null | null | null | db/schema.sql | mwpx777/Tech-Blog-1 | ba4cddebebf6207f3e0d826c57dbe071aa6f9854 | [
"ISC"
] | null | null | null | db/schema.sql | mwpx777/Tech-Blog-1 | ba4cddebebf6207f3e0d826c57dbe071aa6f9854 | [
"ISC"
] | null | null | null |
DROP DATABASE IF EXISTS tech_blog_db;
CREATE DATABASE tech_blog_db; | 17.5 | 38 | 0.828571 |