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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6a7edf90b21356785e8e6c866ff95bd25891cc98
| 203 |
lua
|
Lua
|
MMOCoreORB/bin/scripts/object/custom_content/intangible/beast/bm_baz_nitch.lua
|
V-Fib/FlurryClone
|
40e0ca7245ec31b3815eb6459329fd9e70f88936
|
[
"Zlib",
"OpenSSL"
] | 18 |
2017-02-09T15:36:05.000Z
|
2021-12-21T04:22:15.000Z
|
MMOCoreORB/bin/scripts/object/custom_content/intangible/beast/bm_baz_nitch.lua
|
V-Fib/FlurryClone
|
40e0ca7245ec31b3815eb6459329fd9e70f88936
|
[
"Zlib",
"OpenSSL"
] | 61 |
2016-12-30T21:51:10.000Z
|
2021-12-10T20:25:56.000Z
|
MMOCoreORB/bin/scripts/object/custom_content/intangible/beast/bm_baz_nitch.lua
|
V-Fib/FlurryClone
|
40e0ca7245ec31b3815eb6459329fd9e70f88936
|
[
"Zlib",
"OpenSSL"
] | 71 |
2017-01-01T05:34:38.000Z
|
2022-03-29T01:04:00.000Z
|
object_intangible_beast_bm_baz_nitch = object_intangible_beast_shared_bm_baz_nitch:new {
}
ObjectTemplates:addTemplate(object_intangible_beast_bm_baz_nitch, "object/intangible/beast/bm_baz_nitch.iff")
| 33.833333 | 109 | 0.8867 |
c22fdc05406f2f44fa7cee86f52afe44cb33e6b7
| 746 |
swift
|
Swift
|
source/cardsmobile/Models/Certificate.swift
|
SergeyKolokolnikov/cardsmobile
|
fe55f6f1d19afdade7a293f940f50bc3fa4f43ee
|
[
"MIT"
] | null | null | null |
source/cardsmobile/Models/Certificate.swift
|
SergeyKolokolnikov/cardsmobile
|
fe55f6f1d19afdade7a293f940f50bc3fa4f43ee
|
[
"MIT"
] | null | null | null |
source/cardsmobile/Models/Certificate.swift
|
SergeyKolokolnikov/cardsmobile
|
fe55f6f1d19afdade7a293f940f50bc3fa4f43ee
|
[
"MIT"
] | null | null | null |
import Foundation
struct Certificate: Codable, Hashable {
let value: Double
let expireDate: String
private enum CodingKeys: String, CodingKey {
case value
case expireDate
}
func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: Certificate.CodingKeys.self)
try container.encode(expireDate, forKey: .expireDate)
try container.encode(value, forKey: .value)
}
init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: Certificate.CodingKeys.self)
self.expireDate = try container.decode(String.self, forKey: .expireDate)
self.value = try container.decode(Double.self, forKey: .value)
}
}
| 28.692308 | 83 | 0.679625 |
0c97d3a32db9b335bffe637b1d619f3774455b40
| 2,930 |
py
|
Python
|
createExeWindows.py
|
intel/RAAD
|
9cca9e72ff61658191e30756bb260173d5600102
|
[
"Intel",
"Apache-2.0"
] | null | null | null |
createExeWindows.py
|
intel/RAAD
|
9cca9e72ff61658191e30756bb260173d5600102
|
[
"Intel",
"Apache-2.0"
] | null | null | null |
createExeWindows.py
|
intel/RAAD
|
9cca9e72ff61658191e30756bb260173d5600102
|
[
"Intel",
"Apache-2.0"
] | null | null | null |
# !/usr/bin/python3
# -*- coding: utf-8 -*-
# *****************************************************************************/
# * Authors: Daniel Garces, Joseph Tarango
# *****************************************************************************/
import os, datetime, traceback, optparse, shutil
import PyInstaller.__main__
def main():
##############################################
# Main function, Options
##############################################
parser = optparse.OptionParser()
parser.add_option("--installer", dest='installer', action='store_true',
default=False, help='Boolean to create installer executable. If false, GUI executable is created '
'instead')
(options, args) = parser.parse_args()
if options.installer is True:
print("Generating Installer...")
pwd = os.getcwd()
dirPath = os.path.join(pwd, 'data/installer')
if os.path.exists(dirPath) and os.path.isdir(dirPath):
print("Previous executable exists. Removing it before generating the new one")
shutil.rmtree(dirPath)
PyInstaller.__main__.run([
'src/installer.py',
'--onefile',
'--clean',
'--debug=all',
# '--windowed',
'--key=RAADEngineTesting123456',
'--workpath=data/installer/temp',
'--distpath=data/installer',
'--specpath=data/installer'
])
else:
print("Generating main GUI...")
pwd = os.getcwd()
dirPath = os.path.join(pwd, 'data/binary')
if os.path.exists(dirPath) and os.path.isdir(dirPath):
print("Previous executable exists. Removing it before generating the new one")
shutil.rmtree(dirPath)
logoLocation = '{0}/src/software/{1}'.format(os.getcwd(), 'Intel_IntelligentSystems.png')
newLocation = '{0}/data/binary/software'.format(os.getcwd())
PyInstaller.__main__.run([
'src/software/gui.py',
'--onefile',
'--clean',
'--debug=all',
# '--windowed',
'--add-data=' + logoLocation + os.pathsep + ".",
'--key=RAADEngineTesting123456',
'--workpath=data/binary/temp',
'--distpath=data/binary',
'--specpath=data/binary',
])
os.mkdir(newLocation)
shutil.copyfile(logoLocation, newLocation + '/Intel_IntelligentSystems.png')
if __name__ == '__main__':
"""Performs execution delta of the process."""
pStart = datetime.datetime.now()
try:
main()
except Exception as errorMain:
print("Fail End Process: {0}".format(errorMain))
traceback.print_exc()
qStop = datetime.datetime.now()
print("Execution time: " + str(qStop - pStart))
| 39.594595 | 121 | 0.509556 |
c44cca53509015e783e56c79b8cc086bd931f5cd
| 682 |
h
|
C
|
src/core/SkThreadPriv.h
|
quanganh2627/bytm-x64-L-w05-2015_external_chromium_org_third_party_skia
|
90b3f9b82dbad266f960601d2120082bb841fb97
|
[
"BSD-3-Clause"
] | 111 |
2015-01-13T22:01:50.000Z
|
2021-06-10T15:32:48.000Z
|
src/core/SkThreadPriv.h
|
quanganh2627/bytm-x64-L-w05-2015_external_chromium_org_third_party_skia
|
90b3f9b82dbad266f960601d2120082bb841fb97
|
[
"BSD-3-Clause"
] | 129 |
2015-01-14T16:07:02.000Z
|
2020-03-11T19:44:42.000Z
|
src/core/SkThreadPriv.h
|
quanganh2627/bytm-x64-L-w05-2015_external_chromium_org_third_party_skia
|
90b3f9b82dbad266f960601d2120082bb841fb97
|
[
"BSD-3-Clause"
] | 64 |
2015-01-14T16:45:39.000Z
|
2021-09-08T11:16:05.000Z
|
/*
* Copyright 2014 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkThreadPriv_DEFINED
#define SkThreadPriv_DEFINED
#include "SkTypes.h"
// SK_ATOMICS_PLATFORM_H must provide inline implementations for the following declarations.
/** Atomic compare and set, for pointers.
* If *addr == before, set *addr to after. Always returns previous value of *addr.
* This must issue a release barrier on success, acquire on failure, and always a compiler barrier.
*/
static void* sk_atomic_cas(void** addr, void* before, void* after);
#include SK_ATOMICS_PLATFORM_H
#endif//SkThreadPriv_DEFINED
| 28.416667 | 100 | 0.755132 |
ab0c0827a14a2814fe83255c1609703518d3e13e
| 3,225 |
kt
|
Kotlin
|
common/src/main/java/com/kai/common/utils/RxNetworkObserver.kt
|
pressureKai/FreeRead
|
73edc5e8b838f9ba89e5ac717051c15871120673
|
[
"Apache-2.0"
] | null | null | null |
common/src/main/java/com/kai/common/utils/RxNetworkObserver.kt
|
pressureKai/FreeRead
|
73edc5e8b838f9ba89e5ac717051c15871120673
|
[
"Apache-2.0"
] | null | null | null |
common/src/main/java/com/kai/common/utils/RxNetworkObserver.kt
|
pressureKai/FreeRead
|
73edc5e8b838f9ba89e5ac717051c15871120673
|
[
"Apache-2.0"
] | 1 |
2021-05-31T08:40:06.000Z
|
2021-05-31T08:40:06.000Z
|
package com.kai.common.utils
import android.annotation.SuppressLint
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.net.ConnectivityManager
import android.os.Handler
import io.reactivex.rxjava3.disposables.Disposable
import io.reactivex.rxjava3.subjects.PublishSubject
import java.util.concurrent.TimeUnit
/**
* 网络监听观察者
* 使用Subject来实现观察者,回调网络状态数据。
*/
@SuppressLint("StaticFieldLeak")
object RxNetworkObserver {
/**
* 网络断开连接
*/
const val NET_STATE_DISCONNECT = -1
/**
* WIFI网络
*/
const val NET_STATE_WIFI = 0
/**
* 移动网络
*/
const val NET_STATE_MOBILE = 1
var subject: PublishSubject<Int> = PublishSubject.create<Int>()
private var receiver: NetWorkReceiver? = null
private var context: Context? = null
private var handler = Handler()
private var type = NET_STATE_MOBILE
private fun init(context: Context) {
subject = PublishSubject.create()
receiver =
NetWorkReceiver(context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager)
this.context = context
context.registerReceiver(receiver, IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION))
type = getNetWorkType(context)
}
fun register(context: Context) {
init(context)
}
/**
* 解注册
*/
fun unregister() {
subject.onComplete()
context?.unregisterReceiver(receiver)
}
/**
* 订阅(过滤1秒内网络切换过程中状态的变化)
*/
fun subscribe(onNext: (Int) -> Unit): Disposable? {
val d = subject.debounce(1, TimeUnit.SECONDS).subscribe {
handler.post { onNext(it) }
}
subject.onNext(type)
context = null
return d
}
/**
* 广播接收者
*/
class NetWorkReceiver(private var conn: ConnectivityManager) : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent?) {
val networkInfo = conn.activeNetworkInfo
when {
networkInfo == null -> {
type = NET_STATE_DISCONNECT
}
networkInfo.type == ConnectivityManager.TYPE_WIFI -> {
type = NET_STATE_WIFI
}
networkInfo.type == ConnectivityManager.TYPE_MOBILE -> {
type = NET_STATE_MOBILE
}
}
subject.onNext(type)
}
}
private fun getNetWorkType(context: Context): Int {
var netWorkType = -1
val manager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
val networkInfo = manager.activeNetworkInfo
if (networkInfo != null && networkInfo.isConnected) {
val typeName = networkInfo.typeName
if (typeName.equals("WIFI", ignoreCase = true)) {
netWorkType = NET_STATE_WIFI
} else if (typeName.equals("MOBILE", ignoreCase = true)) {
netWorkType = NET_STATE_MOBILE
}
} else {
netWorkType = NET_STATE_DISCONNECT
}
return netWorkType
}
}
| 27.801724 | 106 | 0.618295 |
6e95b522dac3e1bca9cce8b1c8715637ed5a459c
| 212 |
swift
|
Swift
|
VIPER/Common/TitlableView.swift
|
ChrisAU/WireframeNavigation
|
1d6c9745aaf74ec32e975539dc3ce440b336085e
|
[
"MIT"
] | 4 |
2018-03-01T14:33:46.000Z
|
2019-05-16T18:21:13.000Z
|
VIPER/Common/TitlableView.swift
|
ChrisAU/WireframeNavigation
|
1d6c9745aaf74ec32e975539dc3ce440b336085e
|
[
"MIT"
] | null | null | null |
VIPER/Common/TitlableView.swift
|
ChrisAU/WireframeNavigation
|
1d6c9745aaf74ec32e975539dc3ce440b336085e
|
[
"MIT"
] | null | null | null |
import UIKit
protocol TitlableView {
func setTitle(_ title: String)
}
extension TitlableView where Self: UIViewController {
func setTitle(_ title: String) {
navigationItem.title = title
}
}
| 17.666667 | 53 | 0.70283 |
cbf4bc03993a899cec261ca8b69e224c02761c97
| 1,793 |
go
|
Go
|
service/acfunLiveService.go
|
muzihuaner/liveproxy
|
4349d6d93db8d2e4e9f51d89d7100ae0580b79e5
|
[
"Apache-2.0"
] | 16 |
2020-07-28T04:42:54.000Z
|
2021-10-06T15:55:45.000Z
|
service/acfunLiveService.go
|
ixinshang/liveproxy
|
4349d6d93db8d2e4e9f51d89d7100ae0580b79e5
|
[
"Apache-2.0"
] | 1 |
2021-05-06T01:14:59.000Z
|
2021-05-07T07:06:29.000Z
|
service/acfunLiveService.go
|
ixinshang/liveproxy
|
4349d6d93db8d2e4e9f51d89d7100ae0580b79e5
|
[
"Apache-2.0"
] | 1 |
2022-01-24T13:07:38.000Z
|
2022-01-24T13:07:38.000Z
|
package service
import (
"errors"
"github.com/asmcos/requests"
jsoniter "github.com/json-iterator/go"
)
type AcFunLiveService struct {
}
func (s *AcFunLiveService) GetPlayUrl(key string) (string, error) {
roomUrl := "https://id.app.acfun.cn/rest/app/visitor/login"
headers := requests.Header{
"content-type": "application/x-www-form-urlencoded",
"cookie": "_did=H5_",
"referer": "https://m.acfun.cn/",
}
datas := requests.Datas{
"sid": "acfun.api.visitor",
}
res, err := requests.Post(roomUrl, datas, headers)
if err != nil {
return "", err
}
json := jsoniter.ConfigCompatibleWithStandardLibrary
userId := json.Get([]byte(res.Text()), "userId").ToString()
visitorSt := json.Get([]byte(res.Text()), "acfun.api.visitor_st").ToString()
playUrl := "https://api.kuaishouzt.com/rest/zt/live/web/startPlay"
params := requests.Params{
"subBiz": "mainApp",
"kpn": "ACFUN_APP",
"kpf": "PC_WEB",
"userId": userId,
"did": "H5_",
"acfun.api.visitor_st": visitorSt,
}
datas = requests.Datas{
"authorId": key,
"pullStreamType": "FLV",
}
res, err = requests.Post(playUrl, params, datas, headers)
if err != nil {
return "", err
}
resText := res.Text()
result := json.Get([]byte(resText), "result").ToInt()
if result != 1 {
return "", errors.New("直播已关闭")
}
data := json.Get([]byte(resText), "data")
liveAdaptiveManifest := json.Get([]byte(data.Get("videoPlayRes").ToString()), "liveAdaptiveManifest", 0)
realUrl := liveAdaptiveManifest.Get("adaptationSet", "representation", liveAdaptiveManifest.Get("adaptationSet", "representation").Size()-1, "url").ToString()
return realUrl, nil
}
func init() {
RegisterService("acfun", new(AcFunLiveService))
}
| 29.393443 | 159 | 0.639152 |
62fe9bd6e2b161d4ec3e95d8b19daf6db91165a0
| 8,612 |
rs
|
Rust
|
src/diagnostics/sampler/tests/test_topology.rs
|
Prajwal-Koirala/fuchsia
|
ca7ae6c143cd4c10bad9aa1869ffcc24c3e4b795
|
[
"BSD-2-Clause"
] | 2 |
2021-12-29T10:11:08.000Z
|
2022-01-04T15:37:09.000Z
|
src/diagnostics/sampler/tests/test_topology.rs
|
PlugFox/fuchsia
|
39afe5230d41628b3c736a6e384393df954968c8
|
[
"BSD-2-Clause"
] | 2 |
2021-09-19T21:55:09.000Z
|
2021-12-19T03:34:53.000Z
|
src/diagnostics/sampler/tests/test_topology.rs
|
PlugFox/fuchsia
|
39afe5230d41628b3c736a6e384393df954968c8
|
[
"BSD-2-Clause"
] | null | null | null |
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use crate::mocks;
use anyhow::Error;
use cm_rust;
use fidl_fuchsia_io2 as fio2;
use fuchsia_component::server::ServiceFs;
use fuchsia_component_test::{
mock::MockHandles, ChildOptions, Event, Moniker, RealmBuilder, RealmInstance, RouteBuilder,
RouteEndpoint,
};
use futures::{channel::mpsc, lock::Mutex, StreamExt};
use std::sync::Arc;
const MOCK_COBALT_URL: &str = "#meta/mock_cobalt.cm";
const SINGLE_COUNTER_URL: &str = "#meta/single_counter_test_component.cm";
const SAMPLER_URL: &str = "#meta/sampler-for-test.cm";
const ARCHIVIST_URL: &str = "#meta/archivist-for-embedding.cm";
pub async fn create() -> Result<RealmInstance, Error> {
let builder = RealmBuilder::new().await?;
builder
.add_mock_child(
"mocks-server",
move |mock_handles| Box::pin(serve_mocks(mock_handles)),
ChildOptions::new(),
)
.await?
.add_child("wrapper/mock_cobalt", MOCK_COBALT_URL, ChildOptions::new())
.await?
.add_child("wrapper/single_counter", SINGLE_COUNTER_URL, ChildOptions::new())
.await?
.add_child("wrapper/sampler", SAMPLER_URL, ChildOptions::new())
.await?
.add_child("wrapper/test_case_archivist", ARCHIVIST_URL, ChildOptions::new())
.await?
.add_route(
RouteBuilder::protocol("fuchsia.cobalt.test.LoggerQuerier")
.source(RouteEndpoint::component("wrapper/mock_cobalt"))
.targets(vec![RouteEndpoint::AboveRoot]),
)
.await?
.add_route(
RouteBuilder::protocol("fuchsia.samplertestcontroller.SamplerTestController")
.source(RouteEndpoint::component("wrapper/single_counter"))
.targets(vec![RouteEndpoint::AboveRoot]),
)
.await?
.add_route(
RouteBuilder::protocol("fuchsia.cobalt.LoggerFactory")
.source(RouteEndpoint::component("wrapper/mock_cobalt"))
.targets(vec![RouteEndpoint::component("wrapper/sampler")]),
)
.await?
.add_route(
RouteBuilder::protocol("fuchsia.metrics.MetricEventLoggerFactory")
.source(RouteEndpoint::component("wrapper/mock_cobalt"))
.targets(vec![RouteEndpoint::component("wrapper/sampler")]),
)
.await?
.add_route(
RouteBuilder::protocol(
"fuchsia.hardware.power.statecontrol.RebootMethodsWatcherRegister",
)
.source(RouteEndpoint::component("mocks-server"))
.targets(vec![RouteEndpoint::component("wrapper/sampler")]),
)
.await?
.add_route(
RouteBuilder::protocol("fuchsia.mockrebootcontroller.MockRebootController")
.source(RouteEndpoint::component("mocks-server"))
.targets(vec![RouteEndpoint::AboveRoot]),
)
.await?
.add_route(
RouteBuilder::protocol("fuchsia.logger.LogSink")
.source(RouteEndpoint::AboveRoot)
.targets(vec![
RouteEndpoint::component("wrapper/test_case_archivist"),
RouteEndpoint::component("wrapper/mock_cobalt"),
RouteEndpoint::component("wrapper/sampler"),
RouteEndpoint::component("wrapper/single_counter"),
]),
)
.await?
.add_route(
RouteBuilder::directory("config-data", "", fio2::R_STAR_DIR)
.source(RouteEndpoint::AboveRoot)
.targets(vec![RouteEndpoint::component("wrapper/sampler")]),
)
.await?
// TODO(fxbug.dev/76599): refactor these tests to use the single test archivist and remove
// this archivist. We can also remove the `wrapper` realm when this is done. The
// ArchiveAccessor and Log protocols routed here would be routed from AboveRoot instead. To
// do so, uncomment the following routes and delete all the routes after this comment
// involving "wrapper/test_case_archivist":
// .add_route(RouteBuilder::protocol("fuchsia.diagnostics.ArchiveAccessor")
// .source(RouteEndpoint::AboveRoot)
// .targets(vec![RouteEndpoint::component("wrapper/sampler")])
// }).await?
// .add_route(RouteBuilder::protocol("fuchsia.logger.Log")
// .source(RouteEndpoint::AboveRoot)
// .targets(vec![RouteEndpoint::component("wrapper/sampler")])
// }).await?
.add_route(
RouteBuilder::protocol("fuchsia.sys2.EventSource")
.source(RouteEndpoint::AboveRoot)
.targets(vec![RouteEndpoint::component("wrapper/test_case_archivist")]),
)
.await?
.add_route(
RouteBuilder::protocol("fuchsia.diagnostics.ArchiveAccessor")
.source(RouteEndpoint::component("wrapper/test_case_archivist"))
.targets(vec![RouteEndpoint::component("wrapper/sampler")]),
)
.await?
.add_route(
RouteBuilder::protocol("fuchsia.logger.Log")
.source(RouteEndpoint::component("wrapper/test_case_archivist"))
.targets(vec![RouteEndpoint::component("wrapper/sampler")]),
)
.await?
.add_route(
RouteBuilder::event(Event::Started, cm_rust::EventMode::Async)
.source(RouteEndpoint::component("wrapper"))
.targets(vec![RouteEndpoint::component("wrapper/test_case_archivist")]),
)
.await?
.add_route(
RouteBuilder::event(Event::Stopped, cm_rust::EventMode::Async)
.source(RouteEndpoint::component("wrapper"))
.targets(vec![RouteEndpoint::component("wrapper/test_case_archivist")]),
)
.await?
.add_route(
RouteBuilder::event(Event::Running, cm_rust::EventMode::Async)
.source(RouteEndpoint::component("wrapper"))
.targets(vec![RouteEndpoint::component("wrapper/test_case_archivist")]),
)
.await?
.add_route(
RouteBuilder::event(Event::directory_ready("diagnostics"), cm_rust::EventMode::Async)
.source(RouteEndpoint::component("wrapper"))
.targets(vec![RouteEndpoint::component("wrapper/test_case_archivist")]),
)
.await?
.add_route(
RouteBuilder::event(
Event::capability_requested("fuchsia.logger.LogSink"),
cm_rust::EventMode::Async,
)
.source(RouteEndpoint::component("wrapper"))
.targets(vec![RouteEndpoint::component("wrapper/test_case_archivist")]),
)
.await?;
// TODO(fxbug.dev/82734): RealmBuilder currently doesn't support renaming capabilities, so we
// need to manually do it here.
let mut wrapper_decl = builder.get_decl("wrapper").await.unwrap();
wrapper_decl.exposes.push(cm_rust::ExposeDecl::Protocol(cm_rust::ExposeProtocolDecl {
source: cm_rust::ExposeSource::Child("sampler".into()),
target: cm_rust::ExposeTarget::Parent,
source_name: "fuchsia.component.Binder".into(),
target_name: "fuchsia.component.SamplerBinder".into(),
}));
builder.set_decl("wrapper", wrapper_decl).await.unwrap();
let mut root_decl = builder.get_decl(Moniker::root()).await.unwrap();
root_decl.exposes.push(cm_rust::ExposeDecl::Protocol(cm_rust::ExposeProtocolDecl {
source: cm_rust::ExposeSource::Child("wrapper".into()),
target: cm_rust::ExposeTarget::Parent,
source_name: "fuchsia.component.SamplerBinder".into(),
target_name: "fuchsia.component.SamplerBinder".into(),
}));
builder.set_decl(Moniker::root(), root_decl).await.unwrap();
let instance = builder.build().await?;
Ok(instance)
}
async fn serve_mocks(mock_handles: MockHandles) -> Result<(), Error> {
let mut fs = ServiceFs::new();
let (snd, rcv) = mpsc::channel(1);
let rcv = Arc::new(Mutex::new(rcv));
fs.dir("svc")
.add_fidl_service(move |stream| {
mocks::serve_reboot_server(stream, snd.clone());
})
.add_fidl_service(move |stream| {
mocks::serve_reboot_controller(stream, rcv.clone());
});
fs.serve_connection(mock_handles.outgoing_dir.into_channel())?;
fs.collect::<()>().await;
Ok(())
}
| 43.06 | 99 | 0.617743 |
e0f9b48d7d2c0ddfe755a2a490c43f6d7acb8dd8
| 4,558 |
asm
|
Assembly
|
45/beef/drv/kbd/inc/kbd_ibm.asm
|
minblock/msdos
|
479ffd237d9bb7cc83cb06361db2c4ef42dfbac0
|
[
"Apache-2.0"
] | null | null | null |
45/beef/drv/kbd/inc/kbd_ibm.asm
|
minblock/msdos
|
479ffd237d9bb7cc83cb06361db2c4ef42dfbac0
|
[
"Apache-2.0"
] | null | null | null |
45/beef/drv/kbd/inc/kbd_ibm.asm
|
minblock/msdos
|
479ffd237d9bb7cc83cb06361db2c4ef42dfbac0
|
[
"Apache-2.0"
] | null | null | null |
;*
;* CW : Character Windows
;*
;* kbd_ibm.asm : standard IBM procedures (and helpers)
ifndef MkGetShiftStates_NonDefault
;*****************************************************************************
;********** MkGetShiftStatesKbd **********
;* * KBD entry point (see documentation for interface)
;* * return MK values from last saved shift states
cProc MkGetShiftStatesKbd, <FAR, PUBLIC, ATOMIC>
cBegin MkGetShiftStatesKbd
mov bx,OFF_lpwDataKbd
xor ax,ax
mov dx,[bx].ssOld
test dl,SS_SHIFT
jz not_mk_shift
Assert <MK_SHIFT LT 100H>
or ax,MK_SHIFT
not_mk_shift:
test dl,SS_CONTROL
jz not_mk_control
Assert <MK_CONTROL LT 100H>
or ax,MK_CONTROL
not_mk_control:
test dl,SS_ALT
jz not_mk_menu
Assert <MK_MENU GE 100H>
or ah,HIGH MK_MENU
not_mk_menu:
cEnd MkGetShiftStatesKbd
;*****************************************************************************
endif ;* MkGetShiftStates_NonDefault
;*****************************************************************************
;* * HELPER ROUTINES *
;********** DoShift **********
;* entry : ssNew = shift state
;* DS:DI => driver data
;* * set the new shift state
;* exit : n/a
cProc DoShift, <NEAR, ATOMIC, PUBLIC>
parmW ssNew
cBegin DoShift
AssertEQ di,OFF_lpwDataKbd
;{{
; if (ssNew == ssOld)
; return;
;}}
mov ax,ssNew
mov dx,[di].ssOld
cmp ax,dx
je end_do_shift
;{{
; kkNew = KkOfSs(ssNew);
; kkOld = KkOfSs(ssOld);
; if (kkNew != kkOld)
; // special message for change in shift states
; KeyboardMessage(0, kkOld, kkNew, TRUE);
;}}
cCall KkOfSs, <ax>
mov cx,ax ;* cx = kkNew
cCall KkOfSs, <dx> ;* ax = kkOld, dx = ssOld
cmp ax,cx
je done_update_shift_kk
mov bx,[di].pinkbCur
push dx ;* save ssOld
push ax ;* save kkOld
xor dx,dx
IFDEF KANJI
cCall [bx].lpfnKeyboardMessageInkb, <dx, dx, ax, cx, sp>
ELSE
cCall [bx].lpfnKeyboardMessageInkb, <dx, ax, cx, sp>
ENDIF ; KANJI
pop ax
pop dx
done_update_shift_kk: ;* ax = kkOld, dx = ssOld
;{{
; /* check for shift event up or down */
; ssDelta = ssOld ^ ssNew;
; if (ssDelta & SS_ALT)
; {
; KeyboardMessage(VwOfVk(VK_MENU), VwOfVk(VK_MENU), KkOfSs(ssNew),
; ~ssNew & SS_ALT);
; }
; if ((ssDelta & SS_SPACE) && !(ssNew & SS_SPACE))
; {
; /* releasing SPACE key */
; KeyboardMessage(VwOfVk(VK_SPACE), VwOfVk(VK_SPACE),
; KkOfSs(ssNew), TRUE);
; }
;}}
mov ax,ssNew
xor dx,ax ;* dx = ssDelta
test dx,SS_ALT
jz not_ss_menu
mov bx,ax
not bx
and bx,SS_ALT ;* ssMask & ~ssNew
mov cl,VwOfVk(VK_MENU)
cCall KeyboardMessageShort
not_ss_menu:
test dx,SS_SPACE
jz not_ss_space
test ax,SS_SPACE
jnz not_ss_space
mov cl,VwOfVk(VK_SPACE)
mov bx,sp ;* fUp = TRUE
cCall KeyboardMessageShort
not_ss_space:
;{{
; ssOld = ssNew;
;}}
mov ax,ssNew
mov [di].ssOld,ax
end_do_shift:
cEnd DoShift
;********** KeyboardMessageShort **********
;* entry : cl = vw
;* bx = fUp
;* ax = ssNew
;* DS:DI => driver data
;* * Call KeyboardMessage
;* exit : n/a
;* RETAINS : ax, dx
cProc KeyboardMessageShort, <NEAR>, <AX, DX>
cBegin KeyboardMessageShort
AssertEQ di,OFF_lpwDataKbd
IFDEF KANJI
xor dx,dx
push dx ;* sc
ENDIF ; KANJI
xor ch,ch
push cx ;* vw
inc ch ;* vw -> vk
push cx ;* vk
cCall KkOfSs, <ax> ;* KkOfSs(ssNew)
push ax
push bx ; fUp
mov bx,[di].pinkbCur
cCall [bx].lpfnKeyboardMessageInkb
cEnd KeyboardMessageShort
;********** KkOfSs() **********
;* entry : ssParm contains shift states
;* * convert ss to kk values
;* exit : AX = kk
;* * TRASHES only AX
cProc KkOfSs, <NEAR, ATOMIC, PUBLIC>
parmW ssParm
cBegin KkOfSs
mov ax,(ssParm)
;* * the following code assumes the SS_ and KK_ values !!!
Assert <SS_SHIFT EQ 3> ;* lower 2 bits
Assert <SS_CONTROL EQ 4>
Assert <SS_ALT EQ 8>
Assert <SS_SCRLOCK EQ 10H>
Assert <SS_NUMLOCK EQ 20H>
Assert <SS_CAPLOCK EQ 40H>
Assert <SS_LSHIFT EQ HIGH(KK_SHIFT)>
Assert <SS_CONTROL EQ HIGH(KK_CONTROL)>
Assert <SS_ALT EQ HIGH(KK_ALT)>
Assert <SS_SCRLOCK EQ HIGH(KK_SCRLOCK)>
Assert <SS_NUMLOCK EQ HIGH(KK_NUMLOCK)>
Assert <SS_CAPLOCK EQ HIGH(KK_CAPLOCK)>
test al,SS_RSHIFT
jz not_rshift
or al,SS_LSHIFT ;* set lshift to reflect total shift
not_rshift:
and al,SS_CAPLOCK OR SS_NUMLOCK OR SS_SCRLOCK OR SS_ALT OR SS_CONTROL OR SS_LSHIFT
xchg al,ah ;* convert ss to kk
ifdef KANJI
test al,HIGH(SS_EXTENDED)
jz no_extend
or ah,HIGH(KK_EXTENDED)
no_extend:
and al,KJ_KANA
else
and al,HIGH(SS_EXTENDED)
jz no_extend
xor al,al
or ah,HIGH(KK_EXTENDED)
no_extend:
endif
cEnd KkOfSs
;*****************************************************************************
| 19.991228 | 83 | 0.634708 |
1661c8ce2aee04964a72118d5e4f853629801d5b
| 1,728 |
c
|
C
|
badger/tests/crc_selfcheck.c
|
FelixVi/Bedrock
|
82072341902048e5b37022512909d209efb243d6
|
[
"RSA-MD"
] | 17 |
2019-09-29T14:52:18.000Z
|
2022-03-28T21:16:25.000Z
|
badger/tests/crc_selfcheck.c
|
FelixVi/Bedrock
|
82072341902048e5b37022512909d209efb243d6
|
[
"RSA-MD"
] | null | null | null |
badger/tests/crc_selfcheck.c
|
FelixVi/Bedrock
|
82072341902048e5b37022512909d209efb243d6
|
[
"RSA-MD"
] | 4 |
2019-12-04T17:30:38.000Z
|
2021-11-01T01:52:13.000Z
|
/* crc-selfcheck.c */
/* Larry Doolittle, LBNL */
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "crc32.h"
#define ETH_MAXLEN 1500 /* maximum line length */
struct pbuf {
char buf[ETH_MAXLEN+12];
int cur, len;
};
static int ethernet_check(char *packet, unsigned len)
{
char *p=packet;
unsigned int nout, u;
int mismatch=0;
char given_crc[4];
printf("scanning preamble");
while (*p==0x55 && p<(packet+len)) { printf("."); p++; }
printf("\n");
if ((*p & 0xff) != 0xd5) {
printf("missing SFD (%2.2x %2.2x)\n",
packet[0], *p);
return 2;
}
nout=packet+len-(p+5);
if ((p+5)>(packet+len) || check_crc32(p+1, nout)==0) {
printf("CRC check failed, packet length=%u\n",nout);
return 2;
}
/* Overwrite CRC given in file */
for (u=0; u<4; u++) given_crc[u]=packet[nout+u];
append_crc32(p+1,nout);
for (u=0; u<4; u++) mismatch |= given_crc[u]!=packet[nout+u];
if (mismatch) {
printf("generated CRC mismatch\n");
return 2;
}
printf("PASS packet length=%u\n", nout);
return 0;
}
/* Crude analog of Verilog's $readmemh */
static unsigned int readmemh(FILE *f, char *buff, size_t avail)
{
size_t u;
int rc;
for (u=0; u<avail; u++) {
unsigned int h;
rc=fscanf(f, "%x", &h);
if (rc!=1) break;
buff[u]=h;
}
return u;
}
int main(int argc, char *argv[])
{
FILE *f;
unsigned int l;
char buff[ETH_MAXLEN];
const char *fname;
if (argc > 2) {
fprintf(stderr,"Usage\n");
return 1;
}
if (argc == 2) {
fname = argv[1];
f = fopen(fname,"r");
if (f==NULL) {
perror(fname);
return 1;
}
} else {
f = stdin;
fname = "(stdin)";
}
l = readmemh(f, buff, ETH_MAXLEN);
printf("Read %u octets from file %s\n",l,fname);
return ethernet_check(buff,l);
}
| 19.636364 | 63 | 0.605903 |
9c250a7ee687b62ec9f735be8767db81d1ad00dd
| 6,582 |
js
|
JavaScript
|
Practica 3/entrega2/Prototipo/papelDigital_JustinMind/review/screens/07431c30-0c3f-44bd-b7aa-28e0ec175514.js
|
carlostorralba/practicasDES_2021-22
|
60a6da025d558c43f68ad216b45b084d3906e136
|
[
"MIT"
] | null | null | null |
Practica 3/entrega2/Prototipo/papelDigital_JustinMind/review/screens/07431c30-0c3f-44bd-b7aa-28e0ec175514.js
|
carlostorralba/practicasDES_2021-22
|
60a6da025d558c43f68ad216b45b084d3906e136
|
[
"MIT"
] | null | null | null |
Practica 3/entrega2/Prototipo/papelDigital_JustinMind/review/screens/07431c30-0c3f-44bd-b7aa-28e0ec175514.js
|
carlostorralba/practicasDES_2021-22
|
60a6da025d558c43f68ad216b45b084d3906e136
|
[
"MIT"
] | null | null | null |
var content='<div class="ui-page" deviceName="iphonex" deviceType="mobile" deviceWidth="375" deviceHeight="565">\
<div id="t-f39803f7-df02-4169-93eb-7547fb8c961a" class="template growth-both devMobile devIOS canvas firer commentable non-processed" alignment="left" name="Template 1" width="375" height="812">\
<div id="backgroundBox"><div class="colorLayer"></div><div class="imageLayer"></div></div>\
<div id="alignmentBox">\
<link type="text/css" rel="stylesheet" href="./resources/templates/f39803f7-df02-4169-93eb-7547fb8c961a-1641828890786.css" />\
<!--[if IE]><link type="text/css" rel="stylesheet" href="./resources/templates/f39803f7-df02-4169-93eb-7547fb8c961a-1641828890786-ie.css" /><![endif]-->\
<!--[if lte IE 8]><![endif]-->\
<div class="freeLayout">\
</div>\
\
</div>\
<div id="loadMark"></div>\
</div>\
\
<div id="s-07431c30-0c3f-44bd-b7aa-28e0ec175514" class="screen growth-vertical devMobile devIOS canvas PORTRAIT firer ie-background commentable non-processed" alignment="center" name="productosReservados" width="375" height="565">\
<div id="backgroundBox"><div class="colorLayer"></div><div class="imageLayer"></div></div>\
<div id="alignmentBox">\
<link type="text/css" rel="stylesheet" href="./resources/screens/07431c30-0c3f-44bd-b7aa-28e0ec175514-1641828890786.css" />\
<!--[if IE]><link type="text/css" rel="stylesheet" href="./resources/screens/07431c30-0c3f-44bd-b7aa-28e0ec175514-1641828890786-ie.css" /><![endif]-->\
<!--[if lte IE 8]><link type="text/css" rel="stylesheet" href="./resources/screens/07431c30-0c3f-44bd-b7aa-28e0ec175514-1641828890786-ie8.css" /><![endif]-->\
<div class="freeLayout">\
<div id="s-Image_1" class="pie image firer ie-background commentable non-processed" customid="Image 1" datasizewidth="375.0px" datasizeheight="810.0px" dataX="0.0" dataY="0.0" alt="image">\
<div class="borderLayer">\
<div class="imageViewport">\
<img src="./images/4cc9d225-10c3-46b7-82bf-7a0896aac4a1.jpg" />\
</div>\
</div>\
</div>\
\
<div id="s-Hotspot" class="imagemap firer click ie-background commentable non-processed" customid="Hotspot" datasizewidth="100.0px" datasizeheight="114.0px" dataX="275.0" dataY="0.4" >\
<div class="clickableSpot"></div>\
</div>\
<div id="s-Hotspot_1" class="imagemap firer click ie-background commentable non-processed" customid="Hotspot" datasizewidth="375.0px" datasizeheight="187.9px" dataX="0.0" dataY="176.5" >\
<div class="clickableSpot"></div>\
</div>\
\
<div id="s-Image_2" class="pie image firer ie-background commentable hidden non-processed" customid="Image" datasizewidth="287.5px" datasizeheight="384.0px" dataX="53.8" dataY="247.0" alt="image">\
<div class="borderLayer">\
<div class="imageViewport">\
<img src="./images/149c543f-399a-4a95-9d1a-2aeaed3e2044.jpg" />\
</div>\
</div>\
</div>\
\
<div id="s-Hotspot_2" class="imagemap firer click ie-background commentable hidden non-processed" customid="Hotspot" datasizewidth="43.8px" datasizeheight="27.4px" dataX="281.3" dataY="243.0" >\
<div class="clickableSpot"></div>\
</div>\
<div id="s-Hotspot_3" class="imagemap firer click ie-background commentable hidden non-processed" customid="Hotspot" datasizewidth="203.0px" datasizeheight="80.0px" dataX="122.0" dataY="526.0" >\
<div class="clickableSpot"></div>\
</div>\
<div id="s-Hotspot_4" class="imagemap firer click ie-background commentable hidden non-processed" customid="Hotspot" datasizewidth="205.6px" datasizeheight="100.8px" dataX="97.5" dataY="405.0" >\
<div class="clickableSpot"></div>\
</div>\
\
<div id="s-Image_3" class="pie image firer ie-background commentable hidden non-processed" customid="Image" datasizewidth="237.5px" datasizeheight="122.0px" dataX="481.0" dataY="283.0" alt="image">\
<div class="borderLayer">\
<div class="imageViewport">\
<img src="./images/d7d161e0-32ab-44fb-9d99-a622b2bb3683.jpg" />\
</div>\
</div>\
</div>\
\
<div id="s-Hotspot_5" class="imagemap firer click ie-background commentable hidden non-processed" customid="Hotspot" datasizewidth="43.8px" datasizeheight="45.9px" dataX="281.3" dataY="270.4" >\
<div class="clickableSpot"></div>\
</div>\
<div id="s-Dynamic_Panel_1" class="pie dynamicpanel firer ie-background commentable non-processed" customid="Dynamic Panel 1" datasizewidth="273.0px" datasizeheight="80.0px" dataX="87.0" dataY="714.0" >\
<div id="s-Panel_1" class="pie panel default firer ie-background commentable non-processed" customid="Panel 1" datasizewidth="273.0px" datasizeheight="80.0px" >\
<div class="backgroundLayer">\
<div class="colorLayer"></div>\
<div class="imageLayer"></div>\
</div>\
<div class="borderLayer">\
<div class="layoutWrapper scrollable">\
<div class="paddingLayer">\
<div class="freeLayout">\
<div id="s-Hotspot_6" class="imagemap firer click ie-background commentable non-processed" customid="Hotspot" datasizewidth="69.0px" datasizeheight="80.0px" dataX="0.0" dataY="0.0" >\
<div class="clickableSpot"></div>\
</div>\
<div id="s-Hotspot_7" class="imagemap firer click ie-background commentable non-processed" customid="Hotspot" datasizewidth="69.0px" datasizeheight="80.0px" dataX="76.0" dataY="0.0" >\
<div class="clickableSpot"></div>\
</div>\
<div id="s-Hotspot_8" class="imagemap firer click ie-background commentable non-processed" customid="Hotspot" datasizewidth="68.0px" datasizeheight="80.0px" dataX="145.0" dataY="0.0" >\
<div class="clickableSpot"></div>\
</div>\
<div id="s-Hotspot_9" class="imagemap firer click ie-background commentable non-processed" customid="Hotspot" datasizewidth="60.0px" datasizeheight="80.0px" dataX="213.0" dataY="0.0" >\
<div class="clickableSpot"></div>\
</div>\
</div>\
\
</div>\
</div>\
</div>\
</div>\
</div>\
</div>\
\
</div>\
<div id="loadMark"></div>\
</div>\
\
</div>\
';
document.getElementById("chromeTransfer").innerHTML = content;
| 63.902913 | 235 | 0.631875 |
b308f238547e9775a37e65882b89d0df73b0abae
| 378 |
rb
|
Ruby
|
app/decorators/user_decorator.rb
|
subvisual/blog.subvisual.co
|
271c481bbf9b2a40639c0e899b160df052f5985b
|
[
"MIT"
] | 3 |
2015-07-02T08:13:27.000Z
|
2018-01-29T18:31:48.000Z
|
app/decorators/user_decorator.rb
|
subvisual/blog.subvisual.co
|
271c481bbf9b2a40639c0e899b160df052f5985b
|
[
"MIT"
] | 45 |
2015-07-21T19:42:26.000Z
|
2017-01-30T11:22:47.000Z
|
app/decorators/user_decorator.rb
|
subvisual/blog.subvisual.co
|
271c481bbf9b2a40639c0e899b160df052f5985b
|
[
"MIT"
] | null | null | null |
class UserDecorator < Draper::Decorator
delegate :first_name, :last_name, :email, :bio, :has_twitter?, :twitter_handle, :name
def photo_url(suffix = "")
h.image_url(photo_name(suffix))
end
def twitter_url
"https://twitter.com/#{twitter_handle}"
end
private
def photo_name(suffix = "")
"authors/#{name.downcase.parameterize}#{suffix}.png"
end
end
| 21 | 87 | 0.693122 |
d93904b82123461b44fd917cf7fdcf26e9c5d2d7
| 9,711 |
sql
|
SQL
|
assets/content-files/create_tables.sql
|
Sevitec/oneconnexx-docs
|
1763255c5c4996105a3cb5b8659327ba9f6ca1e5
|
[
"MIT"
] | 4 |
2016-10-26T19:50:10.000Z
|
2017-09-22T10:56:12.000Z
|
assets/content-files/create_tables.sql
|
Sevitec/oneconnexx-docs
|
1763255c5c4996105a3cb5b8659327ba9f6ca1e5
|
[
"MIT"
] | 1 |
2016-12-23T21:00:46.000Z
|
2017-06-01T14:02:34.000Z
|
assets/content-files/create_tables.sql
|
Sevitec/oneconnexx-docs
|
1763255c5c4996105a3cb5b8659327ba9f6ca1e5
|
[
"MIT"
] | 1 |
2016-12-16T12:24:23.000Z
|
2016-12-16T12:24:23.000Z
|
/*
OneConnexx Datenbank Tabellen
Stand Mai 2019, OneConnexx Version 1.4.4
*/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Alert](
[Id] [int] IDENTITY(1,1) NOT NULL,
[InterfaceId] [int] NULL,
[Endpoint] [nvarchar](255) NULL,
[OnlyAtRuleViolation] [bit] NOT NULL,
[Recipient] [nvarchar](511) NOT NULL,
[Subject] [nvarchar](255) NOT NULL,
[Body] [nvarchar](max) NOT NULL,
[IsHtml] [bit] NOT NULL,
[Enabled] [bit] NOT NULL,
CONSTRAINT [PK_Alert] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Instance](
[Id] [uniqueidentifier] NOT NULL,
[Name] [nvarchar](255) NOT NULL,
[AddIn] [nvarchar](255) NOT NULL,
[AddInType] [nchar](1) NOT NULL,
[InterfaceId] [int] NULL,
[InstallationId] [uniqueidentifier] NOT NULL,
CONSTRAINT [PK_Instance] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[InstanceActivity](
[InstanceActivityId] [bigint] IDENTITY(1,1) NOT NULL,
[InstanceId] [uniqueidentifier] NOT NULL,
[ActivityStart] [datetime] NOT NULL,
[ActivityEnd] [datetime] NOT NULL,
CONSTRAINT [PK__Instance] PRIMARY KEY CLUSTERED
(
[InstanceActivityId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Interface](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](255) NOT NULL,
CONSTRAINT [PK_Interface] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MailHistory](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Timestamp] [datetime] NOT NULL,
[Recipient] [nvarchar](511) NOT NULL,
[Subject] [nvarchar](255) NOT NULL,
CONSTRAINT [PK_MailHistory] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MailQueue](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Recipient] [nvarchar](511) NOT NULL,
[Subject] [nvarchar](255) NOT NULL,
[Body] [nvarchar](max) NOT NULL,
[IsHtml] [bit] NOT NULL,
CONSTRAINT [PK_MailQueue] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Rule](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](255) NOT NULL,
[InterfaceId] [int] NOT NULL,
[Endpoint] [nvarchar](255) NULL,
[Timeout] [int] NOT NULL,
[LastAlert] [datetime] NULL,
[RepeatAfter] [int] NOT NULL,
[Enabled] [bit] NOT NULL,
[ExecutionTime] [time](7) NULL,
[LimitMode] [int] NULL,
[TransactionCount] [int] NULL,
[DaysOfWeek] [int] NULL,
[DaysOfMonth] [nvarchar](100) NULL,
CONSTRAINT [PK_Rule] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Statistic](
[Id] [int] IDENTITY(1,1) NOT NULL,
[InstallationId] [uniqueidentifier] NOT NULL,
[Name] [nvarchar](255) NOT NULL,
[DiagramType] [int] NOT NULL,
[Sql] [nvarchar](max) NOT NULL,
[Height] [int] NOT NULL,
[Width] [int] NOT NULL,
[DataJson] [nvarchar](max) NOT NULL,
[LegendLabels] [nvarchar](255) NULL,
[StatisticAreaId] [int] NULL,
[SortOrder] [int] NULL,
CONSTRAINT [PK_Statistic] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StatisticArea](
[Id] [int] IDENTITY(1,1) NOT NULL,
[InstallationId] [uniqueidentifier] NOT NULL,
[StatisticAreaName] [nvarchar](255) NOT NULL,
CONSTRAINT [PK_StatisticArea] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Transaction](
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[Timestamp] [datetime] NOT NULL,
[InterfaceId] [int] NOT NULL,
[Endpoint] [nvarchar](255) NULL,
[Success] [bit] NOT NULL,
[Message] [nvarchar](1023) NOT NULL,
[InstanceName] [nvarchar](255) NULL,
CONSTRAINT [PK_Transaction] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TransactionCache](
[InterfaceId] [int] NOT NULL,
[Endpoint] [nvarchar](255) NOT NULL,
[Success] [bit] NOT NULL,
[Message] [nvarchar](1023) NOT NULL,
[Timestamp] [datetime] NOT NULL,
CONSTRAINT [PK_TransactionCache] PRIMARY KEY CLUSTERED
(
[InterfaceId] ASC,
[Endpoint] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
CREATE NONCLUSTERED INDEX [IX_Enabled_InterfaceId_Endpoint] ON [dbo].[Alert]
(
[Enabled] ASC,
[InterfaceId] ASC,
[Endpoint] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_InstallationId] ON [dbo].[Instance]
(
[InstallationId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IDX_InstanceId] ON [dbo].[InstanceActivity]
(
[InstanceId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
CREATE NONCLUSTERED INDEX [IX_Interface_Endpoint_Timestamp] ON [dbo].[Transaction]
(
[InterfaceId] ASC,
[Endpoint] ASC,
[Timestamp] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
CREATE NONCLUSTERED INDEX [IX_Success_Interface_Endpoint_Timestamp] ON [dbo].[Transaction]
(
[Success] ASC,
[InterfaceId] ASC,
[Endpoint] ASC,
[Timestamp] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_Timestamp] ON [dbo].[Transaction]
(
[Timestamp] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Alert] ADD CONSTRAINT [DF__Alert__OnlyAtRul__2DB1C7EE] DEFAULT ((0)) FOR [OnlyAtRuleViolation]
GO
ALTER TABLE [dbo].[MailHistory] ADD CONSTRAINT [DF_MailHistory_Timestamp] DEFAULT (getdate()) FOR [Timestamp]
GO
ALTER TABLE [dbo].[Statistic] ADD CONSTRAINT [DF__Statistic__DataJ__7BE56230] DEFAULT ('') FOR [DataJson]
GO
ALTER TABLE [dbo].[Transaction] ADD CONSTRAINT [DF_Transaction_Timestamp] DEFAULT (getdate()) FOR [Timestamp]
GO
ALTER TABLE [dbo].[Alert] WITH CHECK ADD CONSTRAINT [FK_Alert_Interface] FOREIGN KEY([InterfaceId])
REFERENCES [dbo].[Interface] ([Id])
GO
ALTER TABLE [dbo].[Alert] CHECK CONSTRAINT [FK_Alert_Interface]
GO
ALTER TABLE [dbo].[Instance] WITH CHECK ADD CONSTRAINT [FK_Instance_Interface] FOREIGN KEY([InterfaceId])
REFERENCES [dbo].[Interface] ([Id])
GO
ALTER TABLE [dbo].[Instance] CHECK CONSTRAINT [FK_Instance_Interface]
GO
ALTER TABLE [dbo].[InstanceActivity] WITH CHECK ADD CONSTRAINT [FK_AddinActivity_Instance] FOREIGN KEY([InstanceId])
REFERENCES [dbo].[Instance] ([Id])
GO
ALTER TABLE [dbo].[InstanceActivity] CHECK CONSTRAINT [FK_AddinActivity_Instance]
GO
ALTER TABLE [dbo].[Rule] WITH CHECK ADD CONSTRAINT [FK_Rule_Interface] FOREIGN KEY([InterfaceId])
REFERENCES [dbo].[Interface] ([Id])
GO
ALTER TABLE [dbo].[Rule] CHECK CONSTRAINT [FK_Rule_Interface]
GO
ALTER TABLE [dbo].[Statistic] WITH CHECK ADD CONSTRAINT [FK_Statistic_StatisticArea] FOREIGN KEY([StatisticAreaId])
REFERENCES [dbo].[StatisticArea] ([Id])
GO
ALTER TABLE [dbo].[Statistic] CHECK CONSTRAINT [FK_Statistic_StatisticArea]
GO
ALTER TABLE [dbo].[Transaction] WITH CHECK ADD CONSTRAINT [FK_Transaction_Interface] FOREIGN KEY([InterfaceId])
REFERENCES [dbo].[Interface] ([Id])
GO
ALTER TABLE [dbo].[Transaction] CHECK CONSTRAINT [FK_Transaction_Interface]
GO
| 34.931655 | 169 | 0.721038 |
0ca263d5ceb8c0df9da68a027a9e2c49d50656ac
| 268 |
py
|
Python
|
data/landice-5g/tiff_to_shp.py
|
scottsfarley93/IceSheetsViz
|
f4af84f16af875c5753dca6b8c173c253d9218d4
|
[
"MIT"
] | null | null | null |
data/landice-5g/tiff_to_shp.py
|
scottsfarley93/IceSheetsViz
|
f4af84f16af875c5753dca6b8c173c253d9218d4
|
[
"MIT"
] | 1 |
2017-02-28T18:49:04.000Z
|
2017-02-28T18:49:55.000Z
|
data/landice-5g/tiff_to_shp.py
|
scottsfarley93/IceSheetsViz
|
f4af84f16af875c5753dca6b8c173c253d9218d4
|
[
"MIT"
] | null | null | null |
import os
for filename in os.listdir("rasters"):
print filename
f = filename.replace(".tiff", "")
tiff = "rasters/" + filename
out = "shapefiles/" + f + ".shp"
cmd = "gdal_polygonize.py " + tiff + " -f 'ESRI Shapefile' " + out
os.system(cmd)
| 24.363636 | 70 | 0.589552 |
2300f9213ee25751ff612e179f5b6d0f5e386017
| 7,708 |
swift
|
Swift
|
mindfull WatchKit Extension/BLManager.swift
|
muswolf432/mindfull
|
ffee1d59d39c6df19810dfa78f38af72e3a4506e
|
[
"MIT"
] | null | null | null |
mindfull WatchKit Extension/BLManager.swift
|
muswolf432/mindfull
|
ffee1d59d39c6df19810dfa78f38af72e3a4506e
|
[
"MIT"
] | null | null | null |
mindfull WatchKit Extension/BLManager.swift
|
muswolf432/mindfull
|
ffee1d59d39c6df19810dfa78f38af72e3a4506e
|
[
"MIT"
] | null | null | null |
//
// BLManager.swift
// mindfull WatchKit Extension
//
// Created by Mustafa Iqbal on 01/07/2021.
// Copyright © 2021 Apple. All rights reserved.
//
import Foundation
import CoreBluetooth
import WatchKit
let heartRateServiceCBUUID = CBUUID(string: "0x180D")
let heartRateMeasurementCharacteristicCBUUID = CBUUID(string: "2A37")
class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeripheralDelegate {
var myCentral: CBCentralManager!
var heartRatePeripheral: CBPeripheral!
@Published var isConnected = false
@Published var peripheralName : String = ""
@Published var blBPM : Int = 0
@Published var accHRSamples = [Int]()
@Published var RRArray = [Double]()
@Published var timeMilliSeconds = [Int64]()
@Published var invalidMeasurements: Int = 0
var RRlast: Double = 0
override init() {
super.init()
myCentral = CBCentralManager(delegate: self, queue: nil)
myCentral.delegate = self
}
func centralManagerDidUpdateState(_ central: CBCentralManager) {
if central.state == .poweredOn {
myCentral.scanForPeripherals(withServices: [heartRateServiceCBUUID])
}
else {
}
}
func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
print(peripheral)
heartRatePeripheral = peripheral
heartRatePeripheral.delegate = self
myCentral.stopScan()
myCentral.connect(heartRatePeripheral)
}
func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) {
print("Connected!")
WKInterfaceDevice.current().play(.success) // Notify user
self.isConnected = true
self.peripheralName = peripheral.name!
heartRatePeripheral.discoverServices([heartRateServiceCBUUID])
}
func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {
guard let services = peripheral.services else { return }
for service in services {
print(service)
peripheral.discoverCharacteristics(nil, for: service)
}
}
func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {
guard let characteristics = service.characteristics else { return }
for characteristic in characteristics {
print(characteristic)
if characteristic.properties.contains(.read) {
print("\(characteristic.uuid): properties contains .read")
peripheral.readValue(for: characteristic)
}
if characteristic.properties.contains(.notify) {
print("\(characteristic.uuid): properties contains .notify")
peripheral.setNotifyValue(true, for: characteristic)
}
}
}
func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
switch characteristic.uuid {
case heartRateMeasurementCharacteristicCBUUID:
let bpm = heartRate(from: characteristic)
let RR = RR(from: characteristic)
let tol = 0.2 // Tolerance
self.blBPM = bpm
if RRlast > 0 { // If we have some RR data
if RR > 100 && ((RR - RRlast) / RRlast).magnitude <= tol { // Only append RR interval if larger than 100ms, otherwise 0ms can be appended, artificially increasing the variance; second condition corrects for ectopic beats/noise/motion (only append if differs by less than 20% from last measurement
self.RRArray.append(RR)
print("Appending ", RR)
RRlast = RR // update RR last
}
if RR > 100 && ((RR - RRlast) / RRlast).magnitude > tol { // Track the number of invalid measurements
print("Invalid measurement!", RR)
self.invalidMeasurements += 1
RRlast = RR // update RR last
}
}
else if RR > 800 && RR < 1200 { // Grab ~ 1000ms for first measurement, otherwise if grab 500ms is bad
self.RRArray.append(RR)
print("Appending without correction", RR)
RRlast = RR
}
// Append data here, also need the time
self.accHRSamples.append(bpm)
self.timeMilliSeconds.append(Date().millisecondsSince1970) // measured in ms since 1970
default:
print("Unhandled Characteristic UUID: \(characteristic.uuid)")
}
}
private func heartRate(from characteristic: CBCharacteristic) -> Int {
guard let characteristicData = characteristic.value else { return -1 }
let byteArray = [UInt8](characteristicData)
// See: https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.heart_rate_measurement.xml
// The heart rate mesurement is in the 2nd, or in the 2nd and 3rd bytes, i.e. one one or in two bytes
// The first byte of the first bit specifies the length of the heart rate data, 0 == 1 byte, 1 == 2 bytes
let firstBitValue = byteArray[0] & 0x01
if firstBitValue == 0 {
// Heart Rate Value Format is in the 2nd byte
return Int(byteArray[1])
} else {
// Heart Rate Value Format is in the 2nd and 3rd bytes
return (Int(byteArray[1]) << 8) + Int(byteArray[2])
}
}
private func RR(from characteristic: CBCharacteristic) -> Double {
guard let characteristicData = characteristic.value else { return -1 }
let byteArray = [UInt8](characteristicData)
var rawRRinterval = 0
//if fifth bit (index 4) is set -> RR-Inteval present (00010000 = 16)
if (byteArray[0] & 16) != 0 {
// print("One or more RR-Interval values are present.")
switch byteArray[0] {
case 16,18,20,22:
//rr-value in [2] und [3]
rawRRinterval = Int(byteArray[2]) + (Int(byteArray[3]) << 8)
case 17,19,21,23:
//rr-value in [3] und [4]
rawRRinterval = Int(byteArray[3]) + (Int(byteArray[4]) << 8)
case 24,26,28,30:
//rr-value in [4] und [5]
rawRRinterval = Int(byteArray[4]) + (Int(byteArray[5]) << 8)
case 25,27,29,31:
//rr-value in [5] und [6]
rawRRinterval = Int(byteArray[4]) + (Int(byteArray[5]) << 8)
default:
print("No bytes found")
}}
else {
// print("RR-Interval values are not present.")
}
//Resolution of 1/1024 second
let rrInSeconds: Double = Double(rawRRinterval)/1024
// print("💢 rrInSeconds: \(rrInSeconds)")
let rrInMilSeconds: Double = Double(rrInSeconds) * 1000
// print("💢 rrInMilSeconds: \(rrInMilSeconds)")
let value = (Double(rawRRinterval) / 1024.0 ) * 1000.0
// print("💢 value: \(value)")
return rrInMilSeconds
}
}
extension Date {
var millisecondsSince1970:Int64 {
return Int64((self.timeIntervalSince1970 * 1000.0).rounded())
}
init(milliseconds:Int64) {
self = Date(timeIntervalSince1970: TimeInterval(milliseconds) / 1000)
}
}
| 40.145833 | 308 | 0.594577 |
bd566ddbb44a57719cb5cdea82dc1b763c388789
| 5,070 |
rs
|
Rust
|
rust/loqui_connection/src/framed_io.rs
|
NorthIsUp/loqui
|
8d394a7951fd3a82d109becc1aebbd9e7ccc894a
|
[
"MIT"
] | 147 |
2017-10-02T18:16:52.000Z
|
2020-03-16T03:26:40.000Z
|
rust/loqui_connection/src/framed_io.rs
|
NorthIsUp/loqui
|
8d394a7951fd3a82d109becc1aebbd9e7ccc894a
|
[
"MIT"
] | 14 |
2017-09-19T16:13:32.000Z
|
2019-06-25T21:18:47.000Z
|
rust/loqui_connection/src/framed_io.rs
|
NorthIsUp/loqui
|
8d394a7951fd3a82d109becc1aebbd9e7ccc894a
|
[
"MIT"
] | 25 |
2017-10-01T20:10:31.000Z
|
2020-03-19T14:00:20.000Z
|
use crate::error::{LoquiError, LoquiErrorCode};
use bytesize::ByteSize;
use failure::Error;
use futures::sink::SinkExt;
use futures::stream::StreamExt;
use futures::stream::{SplitSink, SplitStream};
use loqui_protocol::{
codec::Codec,
error::ProtocolError,
frames::{GoAway, LoquiFrame},
};
use std::net::Shutdown;
use tokio::net::TcpStream;
use tokio_util::codec::Framed;
/// Used to read frames off the tcp socket.
pub type Reader = SplitStream<Framed<TcpStream, Codec>>;
/// Used to write frames to the tcp socket.
pub struct Writer {
inner: SplitSink<Framed<TcpStream, Codec>, LoquiFrame>,
/// If true, send a go away when the socket is closed.
send_go_away: bool,
}
impl Writer {
/// Create a new `Writer` that can write frames to a tcp socket.
///
/// # Arguments
///
/// * `writer` - framed sink
/// * `send_go_away` - whether or not to send a go away when the connection closes
pub fn new(
writer: SplitSink<Framed<TcpStream, Codec>, LoquiFrame>,
send_go_away: bool,
) -> Self {
Self {
inner: writer,
send_go_away,
}
}
/// Tries to write a `LoquiFrame` to the socket. Returns an error if the socket has closed.
pub async fn write<F: Into<LoquiFrame>>(mut self, frame: F) -> Result<Self, LoquiError> {
match self.inner.send(frame.into()).await {
Ok(()) => Ok(self),
Err(_error) => Err(LoquiError::TcpStreamClosed),
}
}
/// Gracefully closes the socket. Optionally sends a `GoAway` frame before closing.
pub async fn close(mut self, error: Option<&Error>, reader: Option<Reader>) {
if !self.send_go_away {
debug!("Closing. Not sending GoAway. error={:?}", error);
return;
}
let go_away = GoAway {
flags: 0,
code: go_away_code(error) as u16,
payload: vec![],
};
debug!("Closing. Sending GoAway. go_away={:?}", go_away);
match self.inner.send(go_away.into()).await {
Ok(()) => {
if let Some(reader) = reader {
if let Ok(tcp_stream) =
self.inner.reunite(reader).map(|framed| framed.into_inner())
{
let _result = tcp_stream.shutdown(Shutdown::Both);
}
}
}
Err(_error) => {
error!("Error when writing close frame. error={:?}", error);
}
}
}
}
/// Determines the go away code that should be sent.
///
/// # Arguments
///
/// * `error` - optional error to determine the code from
fn go_away_code(error: Option<&Error>) -> LoquiErrorCode {
match error {
None => LoquiErrorCode::Normal,
Some(error) => {
if let Some(protocol_error) = error.downcast_ref::<ProtocolError>() {
let error_code = match protocol_error {
ProtocolError::InvalidOpcode { .. } => LoquiErrorCode::InvalidOpcode,
ProtocolError::PayloadTooLarge { .. }
| ProtocolError::InvalidPayload { .. } => LoquiErrorCode::InternalServerError,
};
return error_code;
}
if let Some(loqui_error) = error.downcast_ref::<LoquiError>() {
return loqui_error.code();
}
LoquiErrorCode::InternalServerError
}
}
}
pub struct ReaderWriter {
pub reader: Reader,
writer: Writer,
}
impl ReaderWriter {
/// Create a new `ReaderWriter` that can read and write frames to a tcp socket.
///
/// # Arguments
///
/// * `tcp_stream` - raw tcp socket
/// * `max_payload_size` - the maximum bytes a frame payload can be
/// * `send_go_away` - whether or not to send a go away when the connection closes
pub fn new(tcp_stream: TcpStream, max_payload_size: ByteSize, send_go_away: bool) -> Self {
let framed_socket = Framed::new(tcp_stream, Codec::new(max_payload_size));
let (writer, reader) = framed_socket.split();
let writer = Writer::new(writer, send_go_away);
Self { reader, writer }
}
/// Tries to write a `LoquiFrame` to the socket. Returns an error if the socket has closed.
pub async fn write<F: Into<LoquiFrame>>(mut self, frame: F) -> Result<Self, LoquiError> {
match self.writer.write(frame.into()).await {
Ok(new_writer) => {
self.writer = new_writer;
Ok(self)
}
Err(_error) => Err(LoquiError::TcpStreamClosed),
}
}
/// Split this `ReaderWriter`, returning the `Reader` and `Writer` parts.
pub fn split(self) -> (Reader, Writer) {
let ReaderWriter { reader, writer } = self;
(reader, writer)
}
/// Gracefully closes the socket. Optionally sends a `GoAway` frame before closing.
pub async fn close(self, error: Option<&Error>) {
self.writer.close(error, Some(self.reader)).await
}
}
| 34.256757 | 98 | 0.57929 |
57a7711fd21db6344f3ff5016def527cca094279
| 4,832 |
lua
|
Lua
|
scene/ragdogLib.lua
|
sedrew/Medals-and-Ordens-USSR
|
73e2e97a9bd5e47f612b6789bd5e5cc521dc7c11
|
[
"MIT"
] | 1 |
2020-09-22T11:30:50.000Z
|
2020-09-22T11:30:50.000Z
|
scene/ragdogLib.lua
|
Aidar3456/Medals-and-Ordens-USSR
|
2293a8a8ebdef666503294f488705f3a87ab2c05
|
[
"MIT"
] | null | null | null |
scene/ragdogLib.lua
|
Aidar3456/Medals-and-Ordens-USSR
|
2293a8a8ebdef666503294f488705f3a87ab2c05
|
[
"MIT"
] | 1 |
2020-09-22T11:30:55.000Z
|
2020-09-22T11:30:55.000Z
|
------------------------------------------------------------------------
---This library contains a few functions that we're gonna use in several
---parts of this template.
---We use various functions throughout our games and apps to speed up
---the most common practices.
---Each template only contains a handful of these (the one useful to it)
---but we're planning on a release that will contain all our functions
---revised and polished up.
---Made by Ragdog Studios SRL in 2013 http://www.ragdogstudios.com
------------------------------------------------------------------------
local ragdogLib = {};
ragdogLib.applyMaskFromPolygon = function(object, polygon, maskName)
--we use these to scale down the mask so that it looks exactly the same on any device
local pixelWidth, pixelHeight;
local contentWidth, contentHeight = display.contentWidth-(display.screenOriginX*2), display.contentHeight-(display.screenOriginY*2);
if contentWidth > contentHeight then
pixelWidth = display.pixelHeight;
pixelHeight = display.pixelWidth;
else
pixelWidth = display.pixelWidth;
pixelHeight = display.pixelHeight;
end
local maskGroup = display.newGroup();
--create a rect with width and height higher than polygon and rounded up to 2^)
local rectWidth, rectHeight = 1, 1;
while (rectWidth < polygon.contentWidth) do
rectWidth = rectWidth*2;
end
while (rectHeight < polygon.contentHeight) do
rectHeight = rectHeight*2;
end
local blackRect = display.newRect(maskGroup, 0, 0, rectWidth, rectHeight);
blackRect:setFillColor(0, 0, 0);
maskGroup:insert(polygon);
polygon.x, polygon.y = 0, 0;
polygon:setFillColor(1, 1, 1, 1);
maskGroup.x, maskGroup.y = display.contentCenterX, display.contentCenterY;
display.save(maskGroup, maskName or "mask.jpg");
local mask = graphics.newMask(maskName or "mask.jpg", system.DocumentsDirectory);
object:setMask(mask);
--here we scale down the mask to make it consistent across devices
object.maskScaleX = contentWidth/pixelWidth;
object.maskScaleY = object.maskScaleX;
maskGroup:removeSelf();
end
ragdogLib.createPieChart = function(data)
local group = display.newGroup();
-- local brush = { type="image", filename="brush.png"};
local values = data.values;
local mSin, mCos = math.sin, math.cos;
local toRad = math.pi/180;
local currAngle = -90;
local strokesSlices = {};
for i = #values, 1, -1 do
if values[i].percentage <= 0 then
table.remove(values, i);
elseif values[i].percentage == 100 then
values[i].percentage = 99.9;
end
end
for i = 1, #values do
local newAngle = values[i].percentage*360*0.01;
local midAngle1, midAngle2;
local shape;
if newAngle > 180 then
newAngle = currAngle+newAngle;
midAngle1 = currAngle+(newAngle-180-currAngle)*.5;
midAngle2 = midAngle1+(newAngle-90-midAngle1)*.5;
midAngle3 = midAngle2+(newAngle-90-midAngle2)*.5;
midAngle4 = midAngle3+(newAngle-midAngle3)*.5;
shape = {0, 0, mCos(currAngle*toRad)*data.radius*2, mSin(currAngle*toRad)*data.radius*2, mCos(midAngle1*toRad)*data.radius*2, mSin(midAngle1*toRad)*data.radius*2, mCos(midAngle2*toRad)*data.radius*2, mSin(midAngle2*toRad)*data.radius*2,
mCos(midAngle3*toRad)*data.radius*2, mSin(midAngle3*toRad)*data.radius*2, mCos(midAngle4*toRad)*data.radius*2, mSin(midAngle4*toRad)*data.radius*2, mCos(newAngle*toRad)*data.radius*2, mSin(newAngle*toRad)*data.radius*2};
else
newAngle = currAngle+newAngle;
midAngle1 = currAngle+(newAngle-currAngle)*.5;
shape = {0, 0, mCos(currAngle*toRad)*data.radius*2, mSin(currAngle*toRad)*data.radius*2, mCos(midAngle1*toRad)*data.radius*2, mSin(midAngle1*toRad)*data.radius*2, mCos(newAngle*toRad)*data.radius*2, mSin(newAngle*toRad)*data.radius*2};
end
currAngle = newAngle;
local slice = display.newPolygon(group, 0, 0, shape);
slice:setFillColor(unpack(values[i].color));
slice.stroke = brush;
slice.strokeWidth = 2;
slice:setStrokeColor(unpack(values[i].color));
local lowerPointX, higherPointX, lowerPointY, higherPointY = 10000, -10000, 10000, -10000;
for i = 1, #shape, 2 do
if shape[i] < lowerPointX then
lowerPointX = shape[i];
end
if shape[i] > higherPointX then
higherPointX = shape[i];
end
if shape[i+1] < lowerPointY then
lowerPointY = shape[i+1];
end
if shape[i+1] > higherPointY then
higherPointY = shape[i+1];
end
end
slice.x = lowerPointX+(higherPointX-lowerPointX)*.5;
slice.y = lowerPointY+(higherPointY-lowerPointY)*.5;
end
local circle = display.newCircle(0, 0, data.radius)
circle.stroke = brush;
circle.strokeWidth = 2;
ragdogLib.applyMaskFromPolygon(group, circle);
return group;
end
return ragdogLib;
| 37.169231 | 242 | 0.683568 |
a663d20be8843c136d667e0b727e173f3a8c8cb5
| 78 |
sql
|
SQL
|
src/test/resources/sql/insert/027849d1.sql
|
Shuttl-Tech/antlr_psql
|
fcf83192300abe723f3fd3709aff5b0c8118ad12
|
[
"MIT"
] | 66 |
2018-06-15T11:34:03.000Z
|
2022-03-16T09:24:49.000Z
|
src/test/resources/sql/insert/027849d1.sql
|
Shuttl-Tech/antlr_psql
|
fcf83192300abe723f3fd3709aff5b0c8118ad12
|
[
"MIT"
] | 13 |
2019-03-19T11:56:28.000Z
|
2020-08-05T04:20:50.000Z
|
src/test/resources/sql/insert/027849d1.sql
|
Shuttl-Tech/antlr_psql
|
fcf83192300abe723f3fd3709aff5b0c8118ad12
|
[
"MIT"
] | 28 |
2019-01-05T19:59:02.000Z
|
2022-03-24T11:55:50.000Z
|
-- file:date.sql ln:22 expect:true
INSERT INTO DATE_TBL VALUES ('2040-04-10')
| 26 | 42 | 0.730769 |
85b8bd3d8a271723958a0ed86292d3e0c487ca4d
| 4,600 |
js
|
JavaScript
|
pages/register.js
|
UNIZAR-30226-2022-04/Web
|
9d6b01903cdf8e15c4f5563c94e171b1d393fb21
|
[
"MIT"
] | 2 |
2022-02-24T11:42:24.000Z
|
2022-02-28T11:04:50.000Z
|
pages/register.js
|
UNIZAR-30226-2022-04/Web
|
9d6b01903cdf8e15c4f5563c94e171b1d393fb21
|
[
"MIT"
] | null | null | null |
pages/register.js
|
UNIZAR-30226-2022-04/Web
|
9d6b01903cdf8e15c4f5563c94e171b1d393fb21
|
[
"MIT"
] | 2 |
2022-02-24T11:41:46.000Z
|
2022-02-24T12:45:00.000Z
|
import { useState, useEffect } from "react";
import { useRouter } from "next/router";
import Link from "next/link";
import Image from "next/image";
import Layout from "components/Layout";
import Meta from "components/Meta";
//import Lottie from 'react-lottie'
//import registerLottie from '/public/lottie/register.json'
var sha512 = require(`sha512`);
var SecureRandom = require("securerandom");
export default function Register() {
const [name, setName] = useState("");
const [mail, setMail] = useState("");
const [password, setPassword] = useState("");
const [passwordR, setPasswordR] = useState("");
const router = useRouter();
return (
<Layout noInfo={true}>
<Meta title="Crear cuenta" />
<div className="background">
<div className="flex flex-col items-center justify-center w-full h-full -mt-10">
<Image src={"/frankenstory.png"} height={150} width={600} />
<Image
src={"/animated/register.gif"}
height={120}
width={120}
alt={"login gif"}
/>
<div className="flex flex-row items-center justify-center">
<form
className="flex flex-col items-center justify-center"
onSubmit={(e) =>
onSubmit(
e,
name,
mail,
password,
passwordR,
router
)
}
>
<h1 className="commonTitle font-arial-b">
REGISTER
</h1>
<div className="flex flex-col w-96 space-y-2">
<div>
<div className="commonSubtitle">
Nombre de usuario
</div>
<input
className="w-full p-2 bg-white rounded-lg"
type="text"
value={name}
placeholder="Nombre de usuario"
onChange={(e) =>
setName(e.target.value)
}
/>
</div>
<div>
<div className="commonSubtitle">Email</div>
<input
className="w-full p-2 bg-white rounded-lg"
type="email"
value={mail}
placeholder="Email"
onChange={(e) =>
setMail(e.target.value)
}
/>
</div>
<div>
<div className="commonSubtitle">
Contraseña
</div>
<input
className="w-full p-2 bg-white rounded-lg"
type="password"
value={password}
placeholder="Contraseña"
onChange={(e) =>
setPassword(e.target.value)
}
/>
</div>
<div>
<div className="commonSubtitle">
Repita la contraseña
</div>
<input
className="w-full p-2 bg-white rounded-lg"
type="password"
value={passwordR}
placeholder="Repita la contraseña"
onChange={(e) =>
setPasswordR(e.target.value)
}
/>
</div>
<button
className="commonButton bg-verde_top mt-2 hover:bg-emerald-600"
type="submit"
>
Crear cuenta
</button>
</div>
</form>
</div>
<button
className="static bottom-0 left-0 m-10 commonButton bg-verde_top hover:bg-emerald-600"
onClick={() => router.push("/login")}
>
🡄 Iniciar Sesión
</button>
</div>
</div>
</Layout>
);
}
const tryRegister = async (user, pass, mail) => {
var salt = SecureRandom.hex(16);
const info = {
username: user,
password: sha512(pass + salt).toString("hex"),
email: mail,
salt: salt,
};
const options = {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify(info),
};
const res = await fetch(
`${process.env.NEXT_PUBLIC_URL}/api/general/register`,
options
);
return res.json();
};
async function onSubmit(e, name, mail, password, passwordR, router) {
e.preventDefault();
if (name == "") {
alert("Introduce un nombre de usuario");
} else if (mail == "") {
alert("Introduce un correo electronico");
} else if (password == "") {
alert("Introduce una contraseña");
} else if (password != passwordR) {
alert("Las contraseñas introducidas no coinciden");
} else {
const res = await tryRegister(name, password, mail);
if (res.result == "success") {
window.location = `${process.env.NEXT_PUBLIC_URL}/profile`;
} else {
if (res.reason == "user_already_registered") {
alert("El nombre de usuario introducido ya esta en uso");
} else if (res.reason == "email_already_registered") {
alert("El correo introducido ya esta en uso");
} else {
alert("Error desconocido");
}
}
}
}
| 25.988701 | 92 | 0.566957 |
ed922f89614121e902cd59b0dce0a453932ca2f7
| 375 |
swift
|
Swift
|
Pitch Perfect/RecordedAudio.swift
|
mcberros/Pitch-Perfect
|
f7c27eb7ed5f40fa1777c849f9b5ae1d1c68bf05
|
[
"MIT"
] | null | null | null |
Pitch Perfect/RecordedAudio.swift
|
mcberros/Pitch-Perfect
|
f7c27eb7ed5f40fa1777c849f9b5ae1d1c68bf05
|
[
"MIT"
] | null | null | null |
Pitch Perfect/RecordedAudio.swift
|
mcberros/Pitch-Perfect
|
f7c27eb7ed5f40fa1777c849f9b5ae1d1c68bf05
|
[
"MIT"
] | null | null | null |
//
// RecordedAudio.swift
// Pitch Perfect
//
// Created by Carmen Berros on 25/10/15.
// Copyright © 2015 mcberros. All rights reserved.
//
import Foundation
final class RecordedAudio: NSObject{
var filePathURL: NSURL!
var title: String!
init(filePathURL: NSURL, title: String){
self.filePathURL = filePathURL
self.title = title
}
}
| 18.75 | 51 | 0.661333 |
8309b6c332955a84f75a704d2d5a6aa67519ad57
| 548 |
rs
|
Rust
|
http/src/json.rs
|
arcanebot/twilight
|
92edb1b734cbae8c0bf6a6ed8bb3efa36f9c2480
|
[
"0BSD"
] | 1 |
2021-10-31T10:53:46.000Z
|
2021-10-31T10:53:46.000Z
|
http/src/json.rs
|
arcanebot/twilight
|
92edb1b734cbae8c0bf6a6ed8bb3efa36f9c2480
|
[
"0BSD"
] | null | null | null |
http/src/json.rs
|
arcanebot/twilight
|
92edb1b734cbae8c0bf6a6ed8bb3efa36f9c2480
|
[
"0BSD"
] | null | null | null |
#[cfg(not(feature = "simd-json"))]
pub use serde_json::to_vec;
#[cfg(feature = "simd-json")]
pub use simd_json::to_vec;
use serde::Deserialize;
#[cfg(not(feature = "simd-json"))]
use serde_json::{from_slice as inner_from_slice, Result as JsonResult};
#[cfg(feature = "simd-json")]
use simd_json::{from_slice as inner_from_slice, Result as JsonResult};
// Function will automatically cast mutable references to immutable for
// `serde_json`.
pub fn from_slice<'a, T: Deserialize<'a>>(s: &'a mut [u8]) -> JsonResult<T> {
inner_from_slice(s)
}
| 30.444444 | 77 | 0.713504 |
45a9e49c3ab842209f0a225c20500e5d0fa2c0be
| 4,385 |
rs
|
Rust
|
crates/toql_derive/src/to_tokens/query_fields.rs
|
roy-ganz/toql
|
09104e16e921173d03f4a10410d311c939df1581
|
[
"MIT"
] | 47 |
2019-05-15T18:17:40.000Z
|
2022-03-09T09:49:33.000Z
|
crates/toql_derive/src/to_tokens/query_fields.rs
|
roy-ganz/toql
|
09104e16e921173d03f4a10410d311c939df1581
|
[
"MIT"
] | 8 |
2021-09-20T16:08:29.000Z
|
2022-03-21T15:46:30.000Z
|
crates/toql_derive/src/to_tokens/query_fields.rs
|
roy-ganz/toql
|
09104e16e921173d03f4a10410d311c939df1581
|
[
"MIT"
] | 1 |
2020-11-01T03:21:18.000Z
|
2020-11-01T03:21:18.000Z
|
use heck::SnakeCase;
use proc_macro2::{Span, TokenStream};
use quote::quote;
use syn::Ident;
use crate::parsed::{field::field_kind::FieldKind, parsed_struct::ParsedStruct};
pub(crate) fn to_tokens(parsed_struct: &ParsedStruct, tokens: &mut TokenStream) {
let mut builder_fields = Vec::new();
let mut key_composite_predicates = Vec::new();
let struct_vis = &parsed_struct.vis;
for (name, _arg) in &parsed_struct.predicates {
let fnc_name = &name.to_snake_case();
let fnc_ident = Ident::new(fnc_name, Span::call_site());
let toql_field = name.as_str().trim_start_matches("r#");
builder_fields.push(quote!(
#struct_vis fn #fnc_ident (mut self) -> toql :: query :: predicate :: Predicate {
self . 0 . push_str ( #toql_field ) ;
toql :: query :: predicate :: Predicate :: from ( self . 0 )
}
));
}
for field in &parsed_struct.fields {
if field.skip {
continue;
}
let field_name_ident = &field.field_name;
let key_index = syn::Index::from(key_composite_predicates.len());
match &field.kind {
FieldKind::Regular(ref regular_kind) => {
let toql_field = &field.toql_query_name;
builder_fields.push(quote!(
#struct_vis fn #field_name_ident (mut self) -> toql :: query :: field:: Field {
self . 0 . push_str ( #toql_field ) ;
toql :: query :: field:: Field :: from ( self . 0 )
}
));
if regular_kind.key {
key_composite_predicates.push(quote! {
.and(toql::query::field::Field::from(
format!("{}{}{}", path, if path.is_empty() || path.ends_with("_") {""}else {"_"}, #toql_field)
).eq( &self . #key_index))
});
}
}
x => {
let toql_field = &field.toql_query_name;
if let FieldKind::Join(join_attrs) = x {
if join_attrs.key {
key_composite_predicates.push(quote!(
.and( toql::query::QueryPredicate::predicate(&self. #key_index, #toql_field))
//.and(&self. #key_index)
));
}
}
let toql_path = format!("{}_", toql_field);
let field_base_type = &field.field_base_type;
let path_fields_struct =
quote!( < #field_base_type as toql::query_fields::QueryFields>::FieldsType);
builder_fields.push(quote!(
#struct_vis fn #field_name_ident (mut self) -> #path_fields_struct {
self.0.push_str(#toql_path);
#path_fields_struct ::from_path(self.0)
}
));
}
};
}
// Generate token stream
let builder_fields = &builder_fields;
let struct_name_ident = &parsed_struct.struct_name;
let builder_fields_struct =
syn::Ident::new(&format!("{}Fields", struct_name_ident), Span::call_site());
let builder = quote!(
impl toql::query_fields::QueryFields for #struct_name_ident {
type FieldsType = #builder_fields_struct ;
fn fields ( ) -> #builder_fields_struct { #builder_fields_struct :: new ( ) }
fn fields_from_path ( path : String ) -> #builder_fields_struct { #builder_fields_struct :: from_path ( path ) }
}
#struct_vis struct #builder_fields_struct ( String ) ;
impl toql::query_path::QueryPath for #builder_fields_struct {
fn into_path(self) -> String {
self.0
}
}
impl #builder_fields_struct {
#struct_vis fn new ( ) -> Self { Self :: from_path ( String :: from ( "" ) ) }
#struct_vis fn from_path ( path : String ) -> Self { Self ( path ) }
#struct_vis fn into_name ( self) -> String { self.0}
#(#builder_fields)*
}
);
log::debug!(
"Source code for `{}`:\n{}",
&struct_name_ident,
builder.to_string()
);
tokens.extend(builder);
}
| 39.151786 | 124 | 0.519498 |
9c72f2fd16ae89337dae62697a243a9f11f56cf2
| 1,265 |
js
|
JavaScript
|
src/matches.actions.js
|
garretjames/react-flux-dating-interface
|
85e1555a77ba7f6de99bf156bd0684c3586fa5a0
|
[
"MIT"
] | null | null | null |
src/matches.actions.js
|
garretjames/react-flux-dating-interface
|
85e1555a77ba7f6de99bf156bd0684c3586fa5a0
|
[
"MIT"
] | null | null | null |
src/matches.actions.js
|
garretjames/react-flux-dating-interface
|
85e1555a77ba7f6de99bf156bd0684c3586fa5a0
|
[
"MIT"
] | null | null | null |
import { altUtils as alt } from "./alt.utils";
const BASE_URL = "https://randomuser.me/api/?";
const INIT_PARAMS =
"inc=id,gender,name,picture,phone,cell,email,dob&nat=US&results=50&seed=initMatches";
class MatchesActions {
getInitMatches() {
return dispatch => {
const requestOptions = {
method: "GET"
};
return fetch(`${BASE_URL}${INIT_PARAMS}`, requestOptions).then(res => {
return res.text().then(text => {
const data = text && JSON.parse(text);
if (!res.ok) {
const error = (data && data.message) || res.statusText;
return this.matchesFailed(error);
}
dispatch(data.results);
});
});
};
}
matchesFailed(errMsg) {
return errMsg;
}
getFilteredMatches(res, opts) {
let filteredResults = [];
return dispatch => {
res.map(match => {
if (match.dob.age < opts.ageMin || match.dob.age > opts.ageMax) {
} else {
if (opts.gender === "any" || opts.gender === match.gender)
filteredResults.push(match);
}
});
dispatch(filteredResults);
};
}
resetMatches() {
return dispatch => dispatch();
}
}
export default alt.createActions(MatchesActions);
| 24.803922 | 87 | 0.56917 |
0808e9c3dabc7ecae5f0d72924cd146b60d54b3d
| 9,656 |
asm
|
Assembly
|
tools-src/gnu/gcc/gcc/config/rs6000/eabi.asm
|
enfoTek/tomato.linksys.e2000.nvram-mod
|
2ce3a5217def49d6df7348522e2bfda702b56029
|
[
"FSFAP"
] | 80 |
2015-01-02T10:14:04.000Z
|
2021-06-07T06:29:49.000Z
|
tools-src/gnu/gcc/gcc/config/rs6000/eabi.asm
|
unforgiven512/tomato
|
96f09fab4929c6ddde5c9113f1b2476ad37133c4
|
[
"FSFAP"
] | 9 |
2015-05-14T11:03:12.000Z
|
2018-01-04T07:12:58.000Z
|
tools-src/gnu/gcc/gcc/config/rs6000/eabi.asm
|
unforgiven512/tomato
|
96f09fab4929c6ddde5c9113f1b2476ad37133c4
|
[
"FSFAP"
] | 69 |
2015-01-02T10:45:56.000Z
|
2021-09-06T07:52:13.000Z
|
/*
* Special support for eabi and SVR4
*
* Copyright (C) 1995, 1996, 1998, 2000, 2001 Free Software Foundation, Inc.
* Written By Michael Meissner
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* In addition to the permissions in the GNU General Public License, the
* Free Software Foundation gives you unlimited permission to link the
* compiled version of this file with other programs, and to distribute
* those programs without any restriction coming from the use of this
* file. (The General Public License restrictions do apply in other
* respects; for example, they cover modification of the file, and
* distribution when not linked into another program.)
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* As a special exception, if you link this library with files
* compiled with GCC to produce an executable, this does not cause
* the resulting executable to be covered by the GNU General Public License.
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*/
/* Do any initializations needed for the eabi environment */
.file "eabi.asm"
.section ".text"
#include "ppc-asm.h"
#ifndef __powerpc64__
.section ".got2","aw"
.align 2
.LCTOC1 = . /* +32768 */
/* Table of addresses */
.Ltable = .-.LCTOC1
.long .LCTOC1 /* address we are really at */
.Lsda = .-.LCTOC1
.long _SDA_BASE_ /* address of the first small data area */
.Lsdas = .-.LCTOC1
.long __SDATA_START__ /* start of .sdata/.sbss section */
.Lsdae = .-.LCTOC1
.long __SBSS_END__ /* end of .sdata/.sbss section */
.Lsda2 = .-.LCTOC1
.long _SDA2_BASE_ /* address of the second small data area */
.Lsda2s = .-.LCTOC1
.long __SDATA2_START__ /* start of .sdata2/.sbss2 section */
.Lsda2e = .-.LCTOC1
.long __SBSS2_END__ /* end of .sdata2/.sbss2 section */
#ifdef _RELOCATABLE
.Lgots = .-.LCTOC1
.long __GOT_START__ /* Global offset table start */
.Lgotm1 = .-.LCTOC1
.long _GLOBAL_OFFSET_TABLE_-4 /* end of GOT ptrs before BLCL + 3 reserved words */
.Lgotm2 = .-.LCTOC1
.long _GLOBAL_OFFSET_TABLE_+12 /* start of GOT ptrs after BLCL + 3 reserved words */
.Lgote = .-.LCTOC1
.long __GOT_END__ /* Global offset table end */
.Lgot2s = .-.LCTOC1
.long __GOT2_START__ /* -mrelocatable GOT pointers start */
.Lgot2e = .-.LCTOC1
.long __GOT2_END__ /* -mrelocatable GOT pointers end */
.Lfixups = .-.LCTOC1
.long __FIXUP_START__ /* start of .fixup section */
.Lfixupe = .-.LCTOC1
.long __FIXUP_END__ /* end of .fixup section */
.Lctors = .-.LCTOC1
.long __CTOR_LIST__ /* start of .ctor section */
.Lctore = .-.LCTOC1
.long __CTOR_END__ /* end of .ctor section */
.Ldtors = .-.LCTOC1
.long __DTOR_LIST__ /* start of .dtor section */
.Ldtore = .-.LCTOC1
.long __DTOR_END__ /* end of .dtor section */
.Lexcepts = .-.LCTOC1
.long __EXCEPT_START__ /* start of .gcc_except_table section */
.Lexcepte = .-.LCTOC1
.long __EXCEPT_END__ /* end of .gcc_except_table section */
.Linit = .-.LCTOC1
.long .Linit_p /* address of variable to say we've been called */
.text
.align 2
.Lptr:
.long .LCTOC1-.Laddr /* PC relative pointer to .got2 */
#endif
.data
.align 2
.Linit_p:
.long 0
.text
FUNC_START(__eabi)
/* Eliminate -mrelocatable code if not -mrelocatable, so that this file can
be assembled with other assemblers than GAS. */
#ifndef _RELOCATABLE
addis 10,0,.Linit_p@ha /* init flag */
addis 11,0,.LCTOC1@ha /* load address of .LCTOC1 */
lwz 9,.Linit_p@l(10) /* init flag */
addi 11,11,.LCTOC1@l
cmplwi 2,9,0 /* init flag != 0? */
bnelr 2 /* return now, if we've been called already */
stw 1,.Linit_p@l(10) /* store a non-zero value in the done flag */
#else /* -mrelocatable */
mflr 0
bl .Laddr /* get current address */
.Laddr:
mflr 12 /* real address of .Laddr */
lwz 11,(.Lptr-.Laddr)(12) /* linker generated address of .LCTOC1 */
add 11,11,12 /* correct to real pointer */
lwz 12,.Ltable(11) /* get linker's idea of where .Laddr is */
lwz 10,.Linit(11) /* address of init flag */
subf. 12,12,11 /* calculate difference */
lwzx 9,10,12 /* done flag */
cmplwi 2,9,0 /* init flag != 0? */
mtlr 0 /* restore in case branch was taken */
bnelr 2 /* return now, if we've been called already */
stwx 1,10,12 /* store a non-zero value in the done flag */
beq+ 0,.Lsdata /* skip if we don't need to relocate */
/* We need to relocate the .got2 pointers. */
lwz 3,.Lgot2s(11) /* GOT2 pointers start */
lwz 4,.Lgot2e(11) /* GOT2 pointers end */
add 3,12,3 /* adjust pointers */
add 4,12,4
bl FUNC_NAME(__eabi_convert) /* convert pointers in .got2 section */
/* Fixup the .ctor section for static constructors */
lwz 3,.Lctors(11) /* constructors pointers start */
lwz 4,.Lctore(11) /* constructors pointers end */
bl FUNC_NAME(__eabi_convert) /* convert constructors */
/* Fixup the .dtor section for static destructors */
lwz 3,.Ldtors(11) /* destructors pointers start */
lwz 4,.Ldtore(11) /* destructors pointers end */
bl FUNC_NAME(__eabi_convert) /* convert destructors */
/* Fixup the .gcc_except_table section for G++ exceptions */
lwz 3,.Lexcepts(11) /* exception table pointers start */
lwz 4,.Lexcepte(11) /* exception table pointers end */
bl FUNC_NAME(__eabi_convert) /* convert exceptions */
/* Fixup the addresses in the GOT below _GLOBAL_OFFSET_TABLE_-4 */
lwz 3,.Lgots(11) /* GOT table pointers start */
lwz 4,.Lgotm1(11) /* GOT table pointers below _GLOBAL_OFFSET_TABLE-4 */
bl FUNC_NAME(__eabi_convert) /* convert lower GOT */
/* Fixup the addresses in the GOT above _GLOBAL_OFFSET_TABLE_+12 */
lwz 3,.Lgotm2(11) /* GOT table pointers above _GLOBAL_OFFSET_TABLE+12 */
lwz 4,.Lgote(11) /* GOT table pointers end */
bl FUNC_NAME(__eabi_convert) /* convert lower GOT */
/* Fixup any user initialized pointers now (the compiler drops pointers to */
/* each of the relocs that it does in the .fixup section). */
.Lfix:
lwz 3,.Lfixups(11) /* fixup pointers start */
lwz 4,.Lfixupe(11) /* fixup pointers end */
bl FUNC_NAME(__eabi_uconvert) /* convert user initialized pointers */
.Lsdata:
mtlr 0 /* restore link register */
#endif /* _RELOCATABLE */
/* Only load up register 13 if there is a .sdata and/or .sbss section */
lwz 3,.Lsdas(11) /* start of .sdata/.sbss section */
lwz 4,.Lsdae(11) /* end of .sdata/.sbss section */
cmpw 1,3,4 /* .sdata/.sbss section non-empty? */
beq- 1,.Lsda2l /* skip loading r13 */
lwz 13,.Lsda(11) /* load r13 with _SDA_BASE_ address */
/* Only load up register 2 if there is a .sdata2 and/or .sbss2 section */
.Lsda2l:
lwz 3,.Lsda2s(11) /* start of .sdata/.sbss section */
lwz 4,.Lsda2e(11) /* end of .sdata/.sbss section */
cmpw 1,3,4 /* .sdata/.sbss section non-empty? */
beq+ 1,.Ldone /* skip loading r2 */
lwz 2,.Lsda2(11) /* load r2 with _SDA2_BASE_ address */
/* Done adjusting pointers, return by way of doing the C++ global constructors. */
.Ldone:
b FUNC_NAME(__init) /* do any C++ global constructors (which returns to caller) */
FUNC_END(__eabi)
/* Special subroutine to convert a bunch of pointers directly.
r0 has original link register
r3 has low pointer to convert
r4 has high pointer to convert
r5 .. r10 are scratch registers
r11 has the address of .LCTOC1 in it.
r12 has the value to add to each pointer
r13 .. r31 are unchanged */
FUNC_START(__eabi_convert)
cmplw 1,3,4 /* any pointers to convert? */
subf 5,3,4 /* calculate number of words to convert */
bclr 4,4 /* return if no pointers */
srawi 5,5,2
addi 3,3,-4 /* start-4 for use with lwzu */
mtctr 5
.Lcvt:
lwzu 6,4(3) /* pointer to convert */
cmpi 0,6,0
beq- .Lcvt2 /* if pointer is null, don't convert */
add 6,6,12 /* convert pointer */
stw 6,0(3)
.Lcvt2:
bdnz+ .Lcvt
blr
FUNC_END(__eabi_convert)
/* Special subroutine to convert the pointers the user has initialized. The
compiler has placed the address of the initialized pointer into the .fixup
section.
r0 has original link register
r3 has low pointer to convert
r4 has high pointer to convert
r5 .. r10 are scratch registers
r11 has the address of .LCTOC1 in it.
r12 has the value to add to each pointer
r13 .. r31 are unchanged */
FUNC_START(__eabi_uconvert)
cmplw 1,3,4 /* any pointers to convert? */
subf 5,3,4 /* calculate number of words to convert */
bclr 4,4 /* return if no pointers */
srawi 5,5,2
addi 3,3,-4 /* start-4 for use with lwzu */
mtctr 5
.Lucvt:
lwzu 6,4(3) /* next pointer to pointer to convert */
add 6,6,12 /* adjust pointer */
lwz 7,0(6) /* get the pointer it points to */
stw 6,0(3) /* store adjusted pointer */
add 7,7,12 /* adjust */
stw 7,0(6)
bdnz+ .Lucvt
blr
FUNC_END(__eabi_uconvert)
#endif
| 32.186667 | 85 | 0.669739 |
5837ecbc3eb342f94ffa7fcc36085a9a489bc01c
| 1,291 |
kt
|
Kotlin
|
HiltSimple/app/src/main/java/com/hi/dhl/hilt/ui/HiltViewModel2.kt
|
zicen/AndroidX-Jetpack-Practice
|
fce9bba00f5b405fbbd1c020ca3c987aea516ba8
|
[
"Apache-2.0"
] | null | null | null |
HiltSimple/app/src/main/java/com/hi/dhl/hilt/ui/HiltViewModel2.kt
|
zicen/AndroidX-Jetpack-Practice
|
fce9bba00f5b405fbbd1c020ca3c987aea516ba8
|
[
"Apache-2.0"
] | null | null | null |
HiltSimple/app/src/main/java/com/hi/dhl/hilt/ui/HiltViewModel2.kt
|
zicen/AndroidX-Jetpack-Practice
|
fce9bba00f5b405fbbd1c020ca3c987aea516ba8
|
[
"Apache-2.0"
] | null | null | null |
package com.hi.dhl.hilt.ui
import androidx.hilt.lifecycle.ViewModelInject
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.liveData
import com.hi.dhl.paging3.data.local.PersonDao
import com.hi.dhl.paging3.data.local.PersonEntity
/**
* <pre>
* author: dhl
* date : 2020/6/24
* desc :
* </pre>
*/
class HiltViewModel2 @ViewModelInject constructor(
val personDao: PersonDao
) : ViewModel() {
private val _mAdressLiveData = MutableLiveData<String>()
val mAdressLiveData: LiveData<String> = _mAdressLiveData
/**
* 在 LifeCycle 2.2.0 之后,可以用更精简的方法来完成,使用 LiveData 协程构造方法 (coroutine builder)。
* liveData 协程构造方法提供了一个协程代码块,产生的是一个不可变的 LiveData,emit() 方法则用来更新 LiveData 的数据。
*
* 具体可以查看之前写的这篇文章 [https://juejin.im/post/5ee998e8e51d4573d65df02b#heading-10] 有详细介绍
*/
val mHitLiveData = liveData {
emit("i am a ViewModelInject2")
}
fun insert() {
// 为了保持项目的简单,这里仅仅做测试用,实际开发的时候,不能在这里进行数据库的操作
AppExecutors.disIO {
personDao.insert(PersonEntity(name = "dhl", updateTime = System.currentTimeMillis()))
}
}
fun passArgument(address: String) {
_mAdressLiveData.value = address
}
}
| 26.895833 | 97 | 0.697909 |
82a95512db5721e2e69f5cad6927e5643bdec58d
| 820 |
kt
|
Kotlin
|
weatherapp/app/src/main/kotlin/fr/ekito/myweatherapp/view/detail/DetailPresenter.kt
|
Ekito/2018-android-architecture-components-workshop
|
28b3dbddf6bb8002d1658b31bd08acf01f873f6e
|
[
"CC-BY-4.0"
] | 37 |
2018-03-15T20:17:44.000Z
|
2018-10-18T15:22:31.000Z
|
app/src/main/kotlin/fr/ekito/myweatherapp/view/detail/DetailPresenter.kt
|
KotlinAndroidWorkshops/2019-android-architecture-components-workshop
|
efdba4e28bee049888aa1110d22a76a6590b6138
|
[
"CC-BY-4.0"
] | 1 |
2018-11-12T14:31:58.000Z
|
2018-11-12T14:31:58.000Z
|
app/src/main/kotlin/fr/ekito/myweatherapp/view/detail/DetailPresenter.kt
|
KotlinAndroidWorkshops/2019-android-architecture-components-workshop
|
efdba4e28bee049888aa1110d22a76a6590b6138
|
[
"CC-BY-4.0"
] | 7 |
2018-04-24T12:36:49.000Z
|
2018-10-18T14:16:47.000Z
|
package fr.ekito.myweatherapp.view.detail
import fr.ekito.myweatherapp.domain.repository.DailyForecastRepository
import fr.ekito.myweatherapp.util.mvp.RxPresenter
import fr.ekito.myweatherapp.util.rx.SchedulerProvider
import fr.ekito.myweatherapp.util.rx.with
class DetailPresenter(
private val dailyForecastRepository: DailyForecastRepository,
private val schedulerProvider: SchedulerProvider
) : RxPresenter<DetailContract.View>(), DetailContract.Presenter {
override var view: DetailContract.View? = null
override fun getDetail(id: String) {
launch {
dailyForecastRepository.getWeatherDetail(id).with(schedulerProvider).subscribe(
{ detail ->
view?.showDetail(detail)
}, { error -> view?.showError(error) })
}
}
}
| 35.652174 | 91 | 0.718293 |
077b1d19f24097c6ec8117d62d1c4c78f0b43fd7
| 842 |
swift
|
Swift
|
Swift-Paper/Swift-Paper/Helper/Bubble/CustomShapeView.swift
|
shafiullakhan/Swift-Paper
|
8e6e9abcad0f6724a412f5f45e40b7f9d737dfd1
|
[
"MIT"
] | 1 |
2017-06-08T08:10:58.000Z
|
2017-06-08T08:10:58.000Z
|
Swift-Paper/Swift-Paper/Helper/Bubble/CustomShapeView.swift
|
shafiullakhan/Swift-Paper
|
8e6e9abcad0f6724a412f5f45e40b7f9d737dfd1
|
[
"MIT"
] | null | null | null |
Swift-Paper/Swift-Paper/Helper/Bubble/CustomShapeView.swift
|
shafiullakhan/Swift-Paper
|
8e6e9abcad0f6724a412f5f45e40b7f9d737dfd1
|
[
"MIT"
] | null | null | null |
//
// CustomShapeView.swift
// Swift-Paper
//
// Created by Shaf on 8/5/15.
// Copyright (c) 2015 Shaffiulla. All rights reserved.
//
import UIKit
class CustomShapeView: UIView {
var shapeLayer:CAShapeLayer {
get {
return self.layer as! CAShapeLayer;
}
}
override var backgroundColor: UIColor?{
get {
return UIColor(CGColor: self.shapeLayer.fillColor);
}
set{
self.shapeLayer.fillColor = UIColor.whiteColor().CGColor;//self.backgroundColor!.CGColor;
}
}
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
required override init(frame: CGRect) {
super.init(frame: frame)
}
override class func layerClass() -> AnyClass {
return CustomShapeLayer.self
}
}
| 21.589744 | 101 | 0.598575 |
d5ab147f9b5f0c1f2181de6060b501518d916560
| 212 |
sql
|
SQL
|
9 - SQL/2738.sql
|
andrematte/uri-submissions
|
796e7fee56650d9e882880318d6e7734038be2dc
|
[
"MIT"
] | 1 |
2020-09-09T12:48:09.000Z
|
2020-09-09T12:48:09.000Z
|
9 - SQL/2738.sql
|
andrematte/uri-submissions
|
796e7fee56650d9e882880318d6e7734038be2dc
|
[
"MIT"
] | null | null | null |
9 - SQL/2738.sql
|
andrematte/uri-submissions
|
796e7fee56650d9e882880318d6e7734038be2dc
|
[
"MIT"
] | null | null | null |
-- URI Online Judge 2738
SELECT
candidate.name,
ROUND(((2.0*math) + (3.0*specific) + (5.0*project_plan))/10 ,2) AS avg
FROM candidate
JOIN score ON candidate.id = score.candidate_id
ORDER BY avg DESC
| 26.5 | 72 | 0.688679 |
85e88bc80ea37c58b539d69761e2d337465a88a4
| 2,639 |
h
|
C
|
src/test/benchmark/hyproBenchmark/supportFunction/benchmark_sf.h
|
hypro/hypro
|
52ae4ffe0a8427977fce8d7979fffb82a1bc28f6
|
[
"MIT"
] | 22 |
2016-10-05T12:19:01.000Z
|
2022-01-23T09:14:41.000Z
|
src/test/benchmark/hyproBenchmark/supportFunction/benchmark_sf.h
|
hypro/hypro
|
52ae4ffe0a8427977fce8d7979fffb82a1bc28f6
|
[
"MIT"
] | 23 |
2017-05-08T15:02:39.000Z
|
2021-11-03T16:43:39.000Z
|
src/test/benchmark/hyproBenchmark/supportFunction/benchmark_sf.h
|
hypro/hypro
|
52ae4ffe0a8427977fce8d7979fffb82a1bc28f6
|
[
"MIT"
] | 12 |
2017-06-07T23:51:09.000Z
|
2022-01-04T13:06:21.000Z
|
#pragma once
#include "../Clock.h"
#include "../Results.h"
#include "../Settings.h"
#include "../types.h"
#include <hypro/flags.h>
#include <future>
#include <iostream>
#include <queue>
#include <random>
#include <hypro/representations/GeometricObjectBase.h>
namespace benchmark {
namespace sf {
Results<std::size_t> intersectHalfspace( const Settings& settings );
Results<std::size_t> affineTransformation( const Settings& settings );
void affineTrafoCreator( std::map<std::size_t, std::vector<hypro::matrix_t<::benchmark::Number>>>& matricesMap,
std::map<std::size_t, std::vector<hypro::vector_t<::benchmark::Number>>>& vectorsMap,
std::map<std::size_t, std::vector<hypro::vector_t<::benchmark::Number>>>& directionsMap,
const Settings& settings );
template <typename SFSettings>
Results<std::size_t> affineTrafoHelper(
const std::vector<hypro::matrix_t<::benchmark::Number>>& matrices,
const std::vector<hypro::vector_t<::benchmark::Number>>& vectors,
const std::vector<hypro::vector_t<::benchmark::Number>>& directions, std::size_t dimension, std::string name,
const Settings& settings,
const hypro::SupportFunctionT<::benchmark::Number, hypro::Converter<::benchmark::Number>, SFSettings>& sf ) {
Results<std::size_t> ress;
// for all configurations, i.e. all combinations of dimension, multiplications and evaluations run #instances many
// experiments.
for ( std::size_t m = 0; m < settings.multiplications; m += settings.stepSizeMultiplications ) {
for ( std::size_t e = 0; e < settings.evaluations; e += settings.stepSizeEvaluations ) {
Timer runTimerHyPro;
for ( std::size_t i = 0; i < settings.iterations; ++i ) {
auto tmp = sf;
for ( std::size_t mCounter = 0; mCounter < m; ++mCounter ) {
tmp = tmp.affineTransformation( matrices[i], vectors[i] );
}
for ( std::size_t eCounter = 0; eCounter < e; ++eCounter ) {
tmp.evaluate( directions[i] );
}
}
auto runningTime = runTimerHyPro.elapsed();
std::vector<std::size_t> data;
data.push_back( m );
data.push_back( e );
ress.emplace_back( {name, runningTime / settings.iterations, static_cast<int>( dimension ), data} );
// std::cout << "Dimension " << d << ", m " << m << ", e "<< e << ": Running took " << runningTime.count()
// << " sec." << std::endl;
}
}
return ress;
}
Results<std::size_t> affineTransformationEvaluation( const Settings& settings );
Results<std::size_t> unite( const Settings& settings );
Results<std::size_t> intersect( const Settings& settings );
Results<std::size_t> run( const Settings& settings );
} // namespace sf
} // namespace benchmark
| 39.984848 | 115 | 0.687382 |
8753e9a62f297f27c4bfcf9e3f75862bf0fc1ed6
| 11,626 |
rs
|
Rust
|
src/bezier/offset_scaling.rs
|
Logicalshift/flo_curves
|
fb0741dcb5c27a74e793df317d97971788a3079c
|
[
"Apache-2.0"
] | 53 |
2019-01-31T03:05:00.000Z
|
2022-03-15T05:50:37.000Z
|
src/bezier/offset_scaling.rs
|
Logicalshift/flo_curves
|
fb0741dcb5c27a74e793df317d97971788a3079c
|
[
"Apache-2.0"
] | 17 |
2020-09-12T20:45:12.000Z
|
2022-02-14T23:57:22.000Z
|
src/bezier/offset_scaling.rs
|
Logicalshift/flo_curves
|
fb0741dcb5c27a74e793df317d97971788a3079c
|
[
"Apache-2.0"
] | 5 |
2018-12-02T20:41:45.000Z
|
2022-02-07T12:49:07.000Z
|
use super::curve::*;
use super::normal::*;
use super::characteristics::*;
use crate::geo::*;
use crate::line::*;
use crate::bezier::{CurveSection};
use smallvec::*;
use itertools::*;
// This is loosely based on the algorithm described at: https://pomax.github.io/bezierinfo/#offsetting,
// with numerous changes to allow for variable-width offsets and consistent behaviour (in particular,
// a much more reliable method of subdividing the curve)
//
// This algorithm works by subdividing the original curve into arches. We use the characteristics of the
// curve to do this: by subdividing a curve at its inflection point, we turn it into a series of arches.
// Arches have a focal point that the normal vectors along the curve roughly converge to, so we can
// scale around this point to generate an approximate offset curve (every point of the curve will move
// away from the focal point along its normal axis).
//
// As the focal point is approximate, using the start and end points to compute its location ensures that
// the offset is exact at the start and end of the curve.
//
// Edge cases: curves with inflection points at the start or end, arches where the normal vectors at the
// start and end are in parallel.
//
// Not all arches have normal vectors that converge (close to) a focal point. We can spot these quickly
// because the focal point of any two points is in general not equidistant from those two points: this
// also results in uneven scaling of the start and end points.
//
// TODO: we currently assume that 't' maps to 'length' which is untrue, so this can produce 'lumpy' curves
// when varying the width.
//
// It might be possible to use the canonical curve to better identify how to subdivide curves for the
// best results.
///
/// Computes a series of curves that approximate an offset curve from the specified origin curve.
///
/// This uses a scaling algorithm to compute the offset curve, which is fast but which can produce
/// errors, especially if the initial and final offsets are very different from one another.
///
pub fn offset_scaling<Curve>(curve: &Curve, initial_offset: f64, final_offset: f64) -> Vec<Curve>
where Curve: BezierCurveFactory+NormalCurve,
Curve::Point: Normalize+Coordinate2D {
// Split at the location of any features the curve might have
let sections: SmallVec<[_; 4]> = match features_for_curve(curve, 0.01) {
CurveFeatures::DoubleInflectionPoint(t1, t2) => {
let t1 = if t1 > 0.9999 { 1.0 } else if t1 < 0.0001 { 0.0 } else { t1 };
let t2 = if t2 > 0.9999 { 1.0 } else if t2 < 0.0001 { 0.0 } else { t2 };
if t2 > t1 {
smallvec![(0.0, t1), (t1, t2), (t2, 1.0)]
} else {
smallvec![(0.0, t2), (t2, t1), (t1, 1.0)]
}
}
CurveFeatures::Loop(t1, t3) => {
let t1 = if t1 > 0.9999 { 1.0 } else if t1 < 0.0001 { 0.0 } else { t1 };
let t3 = if t3 > 0.9999 { 1.0 } else if t3 < 0.0001 { 0.0 } else { t3 };
let t2 = (t1+t3)/2.0;
if t3 > t1 {
smallvec![(0.0, t1), (t1, t2), (t2, t3), (t3, 1.0)]
} else {
smallvec![(0.0, t3), (t3, t2), (t2, t1), (t1, 1.0)]
}
}
CurveFeatures::SingleInflectionPoint(t) => {
if t > 0.0001 && t < 0.9999 {
smallvec![(0.0, t), (t, 1.0)]
} else {
smallvec![(0.0, 1.0)]
}
}
_ => { smallvec![(0.0, 1.0)] }
};
let sections = sections.into_iter()
.filter(|(t1, t2)| t1 != t2)
.map(|(t1, t2)| curve.section(t1, t2))
.collect::<SmallVec<[_; 8]>>();
// Offset the set of curves that we retrieved
let offset_distance = final_offset-initial_offset;
sections.into_iter()
.flat_map(|section| {
// Compute the offsets for this section (TODO: use the curve length, not the t values)
let (t1, t2) = section.original_curve_t_values();
let (offset1, offset2) = (t1*offset_distance+initial_offset, t2*offset_distance+initial_offset);
subdivide_offset(§ion, offset1, offset2, 0)
})
.collect()
}
///
/// Attempts a simple offset of a curve, and subdivides it if the midpoint is too far away from the expected distance
///
fn subdivide_offset<'a, CurveIn, CurveOut>(curve: &CurveSection<'a, CurveIn>, initial_offset: f64, final_offset: f64, depth: usize) -> SmallVec<[CurveOut; 2]>
where CurveIn: NormalCurve+BezierCurve,
CurveOut: BezierCurveFactory<Point=CurveIn::Point>,
CurveIn::Point: Coordinate2D+Normalize {
const MAX_DEPTH: usize = 5;
// Fetch the original points
let start = curve.start_point();
let end = curve.end_point();
// The normals at the start and end of the curve define the direction we should move in
let normal_start = curve.normal_at_pos(0.0);
let normal_end = curve.normal_at_pos(1.0);
let normal_start = normal_start.to_unit_vector();
let normal_end = normal_end.to_unit_vector();
// If we can we want to scale the control points around the intersection of the normals
let intersect_point = ray_intersects_ray(&(start, start+normal_start), &(end, end+normal_end));
if intersect_point.is_none() {
if characterize_curve(curve) != CurveCategory::Linear && depth < MAX_DEPTH {
// Collinear normals
let divide_point = 0.5;
let mid_offset = initial_offset + (final_offset - initial_offset) * divide_point;
let left_curve = curve.subsection(0.0, divide_point);
let right_curve = curve.subsection(divide_point, 1.0);
let left_offset = subdivide_offset(&left_curve, initial_offset, mid_offset, depth+1);
let right_offset = subdivide_offset(&right_curve, mid_offset, final_offset, depth+1);
return left_offset.into_iter()
.chain(right_offset)
.collect();
}
}
if let Some(intersect_point) = intersect_point {
// Subdivide again if the intersection point is too close to one or other of the normals
let start_distance = intersect_point.distance_to(&start);
let end_distance = intersect_point.distance_to(&end);
let distance_ratio = start_distance.min(end_distance) / start_distance.max(end_distance);
// TODO: the closer to 1 this value is, the better the quality of the offset (0.99 produces good results)
// but the number of subdivisions tends to be too high: we need to find either a way to generate a better offset
// curve for an arch with a non-centered intersection point, or a better way to pick the subdivision point
if distance_ratio < 0.995 && depth < MAX_DEPTH {
// Try to subdivide at the curve's extremeties
let mut extremeties = curve.find_extremities();
extremeties.retain(|item| item > &0.01 && item < &0.99);
if extremeties.len() == 0 || true {
// No extremeties (or they're all too close to the edges)
let divide_point = 0.5;
let mid_offset = initial_offset + (final_offset - initial_offset) * divide_point;
let left_curve = curve.subsection(0.0, divide_point);
let right_curve = curve.subsection(divide_point, 1.0);
let left_offset = subdivide_offset(&left_curve, initial_offset, mid_offset, depth+1);
let right_offset = subdivide_offset(&right_curve, mid_offset, final_offset, depth+1);
left_offset.into_iter()
.chain(right_offset)
.collect()
} else {
let mut extremeties = extremeties;
extremeties.insert(0, 0.0);
extremeties.push(1.0);
extremeties
.into_iter()
.tuple_windows()
.flat_map(|(t1, t2)| {
let subsection = curve.subsection(t1, t2);
let offset1 = initial_offset + (final_offset - initial_offset) * t1;
let offset2 = initial_offset + (final_offset - initial_offset) * t2;
let res = subdivide_offset(&subsection, offset1, offset2, depth+1);
res
})
.collect()
}
} else {
// Event intersection point
smallvec![offset_by_scaling(curve, initial_offset, final_offset, intersect_point, normal_start, normal_end)]
}
} else {
// No intersection point
smallvec![offset_by_moving(curve, initial_offset, final_offset, normal_start, normal_end)]
}
}
///
/// Offsets a curve by scaling around a central point
///
#[inline]
fn offset_by_scaling<CurveIn, CurveOut>(curve: &CurveIn, initial_offset: f64, final_offset: f64, intersect_point: CurveIn::Point, unit_normal_start: CurveIn::Point, unit_normal_end: CurveIn::Point) -> CurveOut
where CurveIn: NormalCurve+BezierCurve,
CurveOut: BezierCurveFactory<Point=CurveIn::Point>,
CurveIn::Point: Coordinate2D+Normalize {
let start = curve.start_point();
let end = curve.end_point();
let (cp1, cp2) = curve.control_points();
// The control points point at an intersection point. We want to scale around this point so that start and end wind up at the appropriate offsets
let new_start = start + (unit_normal_start * initial_offset);
let new_end = end + (unit_normal_end * final_offset);
let start_scale = (intersect_point.distance_to(&new_start))/(intersect_point.distance_to(&start));
let end_scale = (intersect_point.distance_to(&new_end))/(intersect_point.distance_to(&end));
// When the scale is changing, the control points are effectively 1/3rd and 2/3rds of the way along the curve
let cp1_scale = (end_scale - start_scale) * (1.0/3.0) + start_scale;
let cp2_scale = (end_scale - start_scale) * (2.0/3.0) + start_scale;
let new_cp1 = ((cp1-intersect_point) * cp1_scale) + intersect_point;
let new_cp2 = ((cp2-intersect_point) * cp2_scale) + intersect_point;
CurveOut::from_points(new_start, (new_cp1, new_cp2), new_end)
}
///
/// Given a curve where the start and end normals do not intersect at a point, calculates the offset (by moving the start and end points along the normal)
///
#[inline]
fn offset_by_moving<CurveIn, CurveOut>(curve: &CurveIn, initial_offset: f64, final_offset: f64, unit_normal_start: CurveIn::Point, unit_normal_end: CurveIn::Point) -> CurveOut
where CurveIn: NormalCurve+BezierCurve,
CurveOut: BezierCurveFactory<Point=CurveIn::Point>,
CurveIn::Point: Coordinate2D+Normalize {
let start = curve.start_point();
let end = curve.end_point();
let (cp1, cp2) = curve.control_points();
// Offset start & end by the specified amounts to create the first approximation of a curve
let new_start = start + (unit_normal_start * initial_offset);
let new_cp1 = cp1 + (unit_normal_start * initial_offset);
let new_cp2 = cp2 + (unit_normal_end * final_offset);
let new_end = end + (unit_normal_end * final_offset);
CurveOut::from_points(new_start, (new_cp1, new_cp2), new_end)
}
| 47.453061 | 209 | 0.627387 |
55984ec8371a6c9bc0cbd82f3a590ff4d95b1f80
| 784 |
html
|
HTML
|
manuscript/page-188/body.html
|
marvindanig/chronicles-of-avonlea
|
2e00d6ff1154f974bb38c6ec24ce42a87d2f6776
|
[
"CECILL-B"
] | null | null | null |
manuscript/page-188/body.html
|
marvindanig/chronicles-of-avonlea
|
2e00d6ff1154f974bb38c6ec24ce42a87d2f6776
|
[
"CECILL-B"
] | null | null | null |
manuscript/page-188/body.html
|
marvindanig/chronicles-of-avonlea
|
2e00d6ff1154f974bb38c6ec24ce42a87d2f6776
|
[
"CECILL-B"
] | null | null | null |
<div class="leaf flex"><div class="inner justify"><p> and Naomi lay on it, with a lamp burning at her head and another at her side, although it was not yet dark. A great dread of darkness had always been one of Naomi’s peculiarities.</p><p>She was tossing restlessly on her poor couch, while Maggie crouched on a box at the foot. Mr. Leonard had not seen her for five years, and he was shocked at the change in her. She was much wasted; her clear-cut, aquiline features had been of the type which becomes indescribably witch-like in old age, and, though Naomi Clark was barely sixty, she looked as if she might be a hundred. Her hair streamed over the pillow in white, uncared-for tresses, and the hands that plucked at the bed-clothes were like wrinkled claws.</p></div> </div>
| 784 | 784 | 0.767857 |
e8f09f4acc1e578e6bbb291e4f8a3a87b3a0b297
| 908 |
py
|
Python
|
chat/views.py
|
xiaoqiao99/chat
|
ca65ed25fbc277828390b890a50ecadf4675cfb4
|
[
"MIT"
] | 2 |
2019-06-21T10:30:18.000Z
|
2019-07-12T07:46:25.000Z
|
chat/views.py
|
xiaoqiao99/chat
|
ca65ed25fbc277828390b890a50ecadf4675cfb4
|
[
"MIT"
] | 8 |
2020-06-05T19:56:53.000Z
|
2022-03-11T23:41:44.000Z
|
chat/views.py
|
xiaoqiao99/chat
|
ca65ed25fbc277828390b890a50ecadf4675cfb4
|
[
"MIT"
] | 3 |
2020-03-13T03:22:40.000Z
|
2020-07-03T03:03:02.000Z
|
from django.shortcuts import render
# Create your views here.
# chat/views.py
from django.shortcuts import render
from django.utils.safestring import mark_safe
import json
from chat.models import Room
def index(request):
# from channels.layers import get_channel_layer
# from asgiref.sync import async_to_sync
# channel_layer = get_channel_layer()
# async_to_sync(channel_layer.group_send)(
# "chat_lobby",
# {
# 'type': 'chat.message',
# 'message': "6666666yyyyy66666666"
# }
# )
# r = Room.objects.filter(id=46).update(name="33333333") # 如果信号中使用post_save 此更新不会出发信号机制
r = Room()
r.name = "xiao"
r.label = "qq "
r.save()
return render(request, 'chat/index.html', {})
def room(request, room_name):
return render(request, 'chat/room.html', {
'room_name_json': mark_safe(json.dumps(room_name))
})
| 27.515152 | 93 | 0.654185 |
0e5262bc6aaa8c59da3cb6300746a937be5a4edb
| 127 |
html
|
HTML
|
docs/anchor.html
|
petrbouchal/urednici
|
f5f21bf5dbbcb8a6b46df25eec0b7085b6c1a83c
|
[
"MIT"
] | 1 |
2020-04-04T11:27:48.000Z
|
2020-04-04T11:27:48.000Z
|
docs/anchor.html
|
petrbouchal/urednici
|
f5f21bf5dbbcb8a6b46df25eec0b7085b6c1a83c
|
[
"MIT"
] | null | null | null |
docs/anchor.html
|
petrbouchal/urednici
|
f5f21bf5dbbcb8a6b46df25eec0b7085b6c1a83c
|
[
"MIT"
] | null | null | null |
<script src='https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.2.0/anchor.js'></script>
<script>
anchors.add();
</script>
| 25.4 | 88 | 0.685039 |
e73f3782a3ae8b0ce126a092c6ebcb2645912fc1
| 2,140 |
js
|
JavaScript
|
cypress/integration/behavioural/rulesDisabled.spec.js
|
terencejeong/schematik-forms
|
93588672a847784cf1b1ed38a7fd8de56ee625b3
|
[
"BSD-3-Clause"
] | 5 |
2019-04-24T01:01:15.000Z
|
2020-08-12T06:07:26.000Z
|
cypress/integration/behavioural/rulesDisabled.spec.js
|
terencejeong/schematik-forms
|
93588672a847784cf1b1ed38a7fd8de56ee625b3
|
[
"BSD-3-Clause"
] | 10 |
2019-04-28T00:31:44.000Z
|
2022-02-17T21:58:29.000Z
|
cypress/integration/behavioural/rulesDisabled.spec.js
|
terencejeong/schematik-forms
|
93588672a847784cf1b1ed38a7fd8de56ee625b3
|
[
"BSD-3-Clause"
] | 3 |
2020-02-12T21:23:39.000Z
|
2021-01-14T10:16:03.000Z
|
context('Sanity check - Disabled property rule', () => {
beforeEach(() => {
cy.visit('http://localhost:8080/rules/disabled');
});
it('should enable the text input intially', () => {
cy.get('[name="group.second"]').should('to.have.prop', 'disabled', false);
});
it('disable the text input when `yes` is selected', () => {
cy.get('[name="group.second"]').should('to.have.prop', 'disabled', false);
cy.get('[name="group.first"]').first().check();
cy.get('[name="group.second"]').should('to.have.prop', 'disabled', true);
});
it('should enable the text input when `no` is selected', () => {
cy.get('[name="group.second"]').should('to.have.prop', 'disabled', false);
cy.get('[name="group.first"]').last().check();
cy.get('[name="group.second"]').should('to.have.prop', 'disabled', false);
});
it('should handle toggling back and forth between `yes` and `no`', () => {
cy.get('[name="group.second"]').should('to.have.prop', 'disabled', false);
cy.get('[name="group.first"]').last().check();
cy.get('[name="group.second"]').should('to.have.prop', 'disabled', false);
cy.get('[name="group.first"]').first().check();
cy.get('[name="group.second"]').should('to.have.prop', 'disabled', true);
cy.get('[name="group.first"]').first().check();
cy.get('[name="group.second"]').should('to.have.prop', 'disabled', true);
cy.get('[name="group.first"]').last().check();
cy.get('[name="group.second"]').should('to.have.prop', 'disabled', false);
cy.get('[name="group.first"]').first().check();
cy.get('[name="group.second"]').should('to.have.prop', 'disabled', true);
});
it('should respect the fields disabled property', () => {
cy.get('[name="alwaysdisabled"]').should('to.have.prop', 'disabled', true);
});
it('should not depend on the order of fields', () => {
cy.get('[name="order.one"]').should('to.have.prop', 'disabled', false);
cy.get('[name="order.two"]').last().check();
cy.get('[name="order.one"]').should('to.have.prop', 'disabled', true);
cy.get('[name="order.two"]').first().check();
cy.get('[name="order.one"]').should('to.have.prop', 'disabled', false);
});
});
| 36.271186 | 77 | 0.607009 |
6526bd14e91e02ab2897caf04024aa618b204008
| 956 |
py
|
Python
|
automon/integrations/slack/config.py
|
TheShellLand/automonisaur
|
b5f304a44449b8664c93d8a8a3c3cf2d73aa0ce9
|
[
"MIT"
] | 2 |
2021-09-15T18:35:44.000Z
|
2022-01-18T05:36:54.000Z
|
automon/integrations/slack/config.py
|
TheShellLand/automonisaur
|
b5f304a44449b8664c93d8a8a3c3cf2d73aa0ce9
|
[
"MIT"
] | 16 |
2021-08-29T22:51:53.000Z
|
2022-03-09T16:08:19.000Z
|
automon/integrations/slack/config.py
|
TheShellLand/automonisaur
|
b5f304a44449b8664c93d8a8a3c3cf2d73aa0ce9
|
[
"MIT"
] | null | null | null |
import os
from automon.log import Logging
log = Logging(name=__name__, level=Logging.ERROR)
class ConfigSlack:
slack_name = os.getenv('SLACK_USER') or ''
slack_webhook = os.getenv('SLACK_WEBHOOK') or ''
slack_proxy = os.getenv('SLACK_PROXY') or ''
slack_token = os.getenv('SLACK_TOKEN') or ''
SLACK_DEFAULT_CHANNEL = os.getenv('SLACK_DEFAULT_CHANNEL') or ''
SLACK_INFO_CHANNEL = os.getenv('SLACK_INFO_CHANNEL') or ''
SLACK_DEBUG_CHANNEL = os.getenv('SLACK_DEBUG_CHANNEL') or ''
SLACK_ERROR_CHANNEL = os.getenv('SLACK_ERROR_CHANNEL') or ''
SLACK_CRITICAL_CHANNEL = os.getenv('SLACK_CRITICAL_CHANNEL') or ''
SLACK_WARN_CHANNEL = os.getenv('SLACK_WARN_CHANNEL') or ''
SLACK_TEST_CHANNEL = os.getenv('SLACK_TEST_CHANNEL') or ''
if not slack_token:
log.warn(f'missing SLACK_TOKEN')
def __init__(self, slack_name: str = ''):
self.slack_name = os.getenv('SLACK_USER') or slack_name or ''
| 35.407407 | 70 | 0.707113 |
ca8e49938c670e49eeda7ded2bf25dbda3f67818
| 1,540 |
sql
|
SQL
|
evo-X-Scriptdev2/sql/Updates/0.0.2/r634_scriptdev2.sql
|
Gigelf-evo-X/evo-X
|
d0e68294d8cacfc7fb3aed5572f51d09a47136b9
|
[
"OpenSSL"
] | 1 |
2019-01-19T06:35:40.000Z
|
2019-01-19T06:35:40.000Z
|
src/bindings/Scriptdev2/sql/Updates/0.0.2/r634_scriptdev2.sql
|
mfooo/wow
|
3e5fad4cfdf0fd1c0a2fd7c9844e6f140a1bb32d
|
[
"OpenSSL"
] | null | null | null |
src/bindings/Scriptdev2/sql/Updates/0.0.2/r634_scriptdev2.sql
|
mfooo/wow
|
3e5fad4cfdf0fd1c0a2fd7c9844e6f140a1bb32d
|
[
"OpenSSL"
] | null | null | null |
DROP TABLE IF EXISTS `script_texts`;
CREATE TABLE `script_texts` (
`ScriptName` varchar(255) NOT NULL default '',
`Id` int(11) unsigned NOT NULL default '0',
`Sound` int(11) unsigned NOT NULL default '0',
`Type` int(11) unsigned NOT NULL default '0',
`Language` int(11) unsigned NOT NULL default '0',
`Text` varchar(255) NOT NULL default '',
`Comment` varchar(255) NOT NULL default '',
PRIMARY KEY (`ScriptName`,`Id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Texts';
DROP TABLE IF EXISTS `script_localized_texts`;
CREATE TABLE `script_localized_texts` (
`id` int(11) unsigned NOT NULL auto_increment COMMENT 'Identifier',
`locale_1` varchar(255) NOT NULL default '',
`locale_2` varchar(255) NOT NULL default '',
`locale_3` varchar(255) NOT NULL default '',
`locale_4` varchar(255) NOT NULL default '',
`locale_5` varchar(255) NOT NULL default '',
`locale_6` varchar(255) NOT NULL default '',
`locale_7` varchar(255) NOT NULL default '',
`locale_8` varchar(255) NOT NULL default '',
`comment` varchar(255) NOT NULL default '' COMMENT 'Text Comment',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Localized Script Text';
DROP TABLE IF EXISTS `eventai_texts`;
CREATE TABLE `eventai_texts` AS SELECT `id`, `locale_0` AS `text`, `comment` FROM `localized_texts`;
TRUNCATE TABLE `localized_texts`;
DROP TABLE IF EXISTS `eventai_localized_texts`;
ALTER TABLE `localized_texts` RENAME TO `eventai_localized_texts`;
ALTER TABLE `eventai_localized_texts` DROP COLUMN `locale_0`;
| 42.777778 | 100 | 0.748701 |
b81c02d0ec4733d2f1797b5117dad4f50fa2e730
| 5,692 |
kt
|
Kotlin
|
plugins/grazie/src/main/kotlin/com/intellij/grazie/ide/ui/grammar/tabs/rules/component/GrazieTreeComponent.kt
|
06needhamt/intellij-community
|
63d7b8030e4fdefeb4760e511e289f7e6b3a5c5b
|
[
"Apache-2.0"
] | null | null | null |
plugins/grazie/src/main/kotlin/com/intellij/grazie/ide/ui/grammar/tabs/rules/component/GrazieTreeComponent.kt
|
06needhamt/intellij-community
|
63d7b8030e4fdefeb4760e511e289f7e6b3a5c5b
|
[
"Apache-2.0"
] | null | null | null |
plugins/grazie/src/main/kotlin/com/intellij/grazie/ide/ui/grammar/tabs/rules/component/GrazieTreeComponent.kt
|
06needhamt/intellij-community
|
63d7b8030e4fdefeb4760e511e289f7e6b3a5c5b
|
[
"Apache-2.0"
] | null | null | null |
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.grazie.ide.ui.grammar.tabs.rules.component
import com.intellij.grazie.GrazieConfig
import com.intellij.grazie.ide.ui.components.GrazieUIComponent
import com.intellij.grazie.ide.ui.components.dsl.panel
import com.intellij.grazie.ide.ui.grammar.tabs.rules.component.rules.GrazieRulesTreeCellRenderer
import com.intellij.grazie.ide.ui.grammar.tabs.rules.component.rules.GrazieRulesTreeFilter
import com.intellij.grazie.ide.ui.grammar.tabs.rules.component.rules.GrazieRulesTreeNode
import com.intellij.grazie.jlanguage.Lang
import com.intellij.grazie.text.Rule
import com.intellij.grazie.text.TextChecker
import com.intellij.ide.CommonActionsManager
import com.intellij.ide.DefaultTreeExpander
import com.intellij.openapi.Disposable
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.actionSystem.DefaultActionGroup
import com.intellij.ui.*
import com.intellij.util.ui.JBUI
import java.awt.BorderLayout
import javax.swing.ScrollPaneConstants
import javax.swing.tree.DefaultMutableTreeNode
import javax.swing.tree.DefaultTreeModel
internal class GrazieTreeComponent(onSelectionChanged: (meta: Any) -> Unit) : CheckboxTree(GrazieRulesTreeCellRenderer(), GrazieRulesTreeNode()),
Disposable, GrazieUIComponent {
private val disabledRules = hashSetOf<String>()
private val enabledRules = hashSetOf<String>()
private val filterComponent: GrazieRulesTreeFilter = GrazieRulesTreeFilter(this)
init {
selectionModel.addTreeSelectionListener { event ->
val meta = (event?.path?.lastPathComponent as DefaultMutableTreeNode).userObject
if (meta != null) onSelectionChanged(meta)
}
addCheckboxTreeListener(object : CheckboxTreeListener {
override fun nodeStateChanged(node: CheckedTreeNode) {
val meta = node.userObject
if (meta is Rule) {
val id = meta.globalId
enabledRules.remove(id)
disabledRules.remove(id)
if (node.isChecked != meta.isEnabledByDefault) {
(if (node.isChecked) enabledRules else disabledRules).add(id)
}
}
}
})
}
override fun installSpeedSearch() {
TreeSpeedSearch(this) { (it.lastPathComponent as GrazieRulesTreeNode).nodeText }
}
override val component by lazy {
panel tree@{
panel(constraint = BorderLayout.NORTH) {
border = JBUI.Borders.emptyBottom(2)
DefaultActionGroup().apply {
val actionManager = CommonActionsManager.getInstance()
val treeExpander = DefaultTreeExpander(this@GrazieTreeComponent)
add(actionManager.createExpandAllAction(treeExpander, this@GrazieTreeComponent))
add(actionManager.createCollapseAllAction(treeExpander, this@GrazieTreeComponent))
val toolbar = ActionManager.getInstance().createActionToolbar("GrazieRulesTab", this, true)
toolbar.setTargetComponent(this@tree)
add(toolbar.component, BorderLayout.WEST)
}
add(filterComponent, BorderLayout.CENTER)
}
panel(constraint = BorderLayout.CENTER) {
add(ScrollPaneFactory.createScrollPane(this@GrazieTreeComponent,
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER))
}
}
}
override fun isModified(state: GrazieConfig.State): Boolean {
return state.userEnabledRules != enabledRules || state.userDisabledRules != disabledRules
}
override fun reset(state: GrazieConfig.State) {
enabledRules.clear(); enabledRules.addAll(state.userEnabledRules)
disabledRules.clear(); disabledRules.addAll(state.userDisabledRules)
filterComponent.filter()
if (isSelectionEmpty) setSelectionRow(0)
}
override fun apply(state: GrazieConfig.State): GrazieConfig.State {
return state.copy(
userEnabledRules = HashSet(enabledRules),
userDisabledRules = HashSet(disabledRules)
)
}
override fun dispose() {
filterComponent.dispose()
}
fun filter(str: String) {
filterComponent.filter = str
filterComponent.filter()
}
fun getCurrentFilterString(): String? = filterComponent.filter
fun resetTreeModel(rules: Map<Lang, List<Rule>>) {
val root = GrazieRulesTreeNode()
val model = model as DefaultTreeModel
rules.entries.sortedBy { it.key.nativeName }.forEach { (lang, rules) ->
val langNode = GrazieRulesTreeNode(lang)
model.insertNodeInto(langNode, root, root.childCount)
rules.groupBy { it.category }.entries.sortedBy { it.key }.forEach { (category, rules) ->
val categoryNode = GrazieRulesTreeNode(category)
model.insertNodeInto(categoryNode, langNode, langNode.childCount)
rules.sortedBy { it.presentableName }.forEach { rule ->
model.insertNodeInto(GrazieRulesTreeNode(rule), categoryNode, categoryNode.childCount)
}
}
}
model.setRoot(root)
root.resetMark(apply(GrazieConfig.get()))
model.nodeChanged(root)
}
}
internal fun allRules(state: GrazieConfig.State = GrazieConfig.get()): Map<Lang, List<Rule>> {
val result = hashMapOf<Lang, List<Rule>>()
state.enabledLanguages.forEach { lang ->
val jLanguage = lang.jLanguage
if (jLanguage != null) {
val rules = TextChecker.allCheckers().flatMap { it.getRules(jLanguage.locale) }
if (rules.isNotEmpty()) {
result[lang] = rules
}
}
}
return result
}
| 38.459459 | 145 | 0.713457 |
087d43e504eed5975fd5efcd08bd7e051d15465b
| 646 |
go
|
Go
|
cmd/gen_static_prelude/prep.go
|
gijit/gi-minimal
|
1aa4cc82ef6d45ce43cbf1744d50740fe8aff803
|
[
"MIT"
] | 313 |
2018-01-13T22:09:53.000Z
|
2022-01-01T21:50:51.000Z
|
cmd/gen_static_prelude/prep.go
|
gijit/gi-minimal
|
1aa4cc82ef6d45ce43cbf1744d50740fe8aff803
|
[
"MIT"
] | 57 |
2018-01-13T19:50:21.000Z
|
2021-04-09T19:00:05.000Z
|
cmd/gen_static_prelude/prep.go
|
gijit/gi-minimal
|
1aa4cc82ef6d45ce43cbf1744d50740fe8aff803
|
[
"MIT"
] | 19 |
2018-02-09T15:34:45.000Z
|
2020-10-03T19:57:49.000Z
|
// prep the prelude for static inclusion with the
// `gi` binary.
package main
import (
"fmt"
"net/http"
"os"
"github.com/shurcooL/vfsgen"
)
func main() {
gopath := os.Getenv("GOPATH")
compiler := gopath + "/src/github.com/gijit/gi/pkg/compiler"
prelude := compiler + "/prelude"
gentarget := compiler + "/prelude_static.go"
var fs http.FileSystem = http.Dir(prelude)
err := vfsgen.Generate(fs, vfsgen.Options{
Filename: gentarget,
PackageName: "compiler",
//BuildTags: "!dev",
VariableName: "preludeFiles",
})
if err != nil {
panic(err)
}
fmt.Printf("gen_static_prelude '%s' ->\n '%s'\n", prelude, gentarget)
}
| 19.575758 | 72 | 0.659443 |
f44636b7708bb11326b4a2351cc870d521565341
| 331 |
swift
|
Swift
|
weather/weather/Extensions/FileManager.swift
|
LinKeymy/weather
|
e941291e2618a483c27f9abcec70a67eab5c3cbc
|
[
"MIT"
] | null | null | null |
weather/weather/Extensions/FileManager.swift
|
LinKeymy/weather
|
e941291e2618a483c27f9abcec70a67eab5c3cbc
|
[
"MIT"
] | null | null | null |
weather/weather/Extensions/FileManager.swift
|
LinKeymy/weather
|
e941291e2618a483c27f9abcec70a67eab5c3cbc
|
[
"MIT"
] | null | null | null |
//
// FileManager.swift
// Weather
//
// Created by SteveLin on 2018/2/12.
// Copyright © 2018年 alin. All rights reserved.
//
import Foundation
extension FileManager {
static var documentsDir: URL {
return FileManager.default.urls(
for: .documentDirectory,
in: .userDomainMask)[0]
}
}
| 18.388889 | 48 | 0.63142 |
701bdd8ff43ab646b0ed9416eb9287d60fac2ed7
| 4,254 |
go
|
Go
|
src/ws/api/ws_market_client.go
|
xiaomingping/huobi_contract_golang
|
fc48de28904f598d8aca8d5a818907f8f6d6ec7b
|
[
"Apache-2.0"
] | 1 |
2022-03-18T16:19:42.000Z
|
2022-03-18T16:19:42.000Z
|
src/ws/api/ws_market_client.go
|
xiaomingping/huobi_contract_golang
|
fc48de28904f598d8aca8d5a818907f8f6d6ec7b
|
[
"Apache-2.0"
] | 1 |
2022-03-19T10:01:58.000Z
|
2022-03-20T12:21:01.000Z
|
src/ws/api/ws_market_client.go
|
xiaomingping/huobi_contract_golang
|
fc48de28904f598d8aca8d5a818907f8f6d6ec7b
|
[
"Apache-2.0"
] | 1 |
2022-03-18T16:19:49.000Z
|
2022-03-18T16:19:49.000Z
|
package api
import (
"encoding/json"
"fmt"
"github.com/xiaomingping/huobi_contract_golang/src/config"
"github.com/xiaomingping/huobi_contract_golang/src/ws/request"
"github.com/xiaomingping/huobi_contract_golang/src/ws/response"
"reflect"
)
type WSMarketClient struct {
WebSocketOp
}
func (wsMk *WSMarketClient) Init(host string, callback closeChanCallback) *WSMarketClient {
if host == "" {
host = config.LINEAR_SWAP_DEFAULT_HOST
}
wsMk.open("/linear-swap-ws", host, "", "", callback)
return wsMk
}
/**
【通用】订阅KLine 数据
*/
type OnSubKLineResponse func(*response.SubKLineResponse)
type OnReqKLineResponse func(*response.ReqKLineResponse)
func (wsMk *WSMarketClient) SubKLine(contractCode string, period string, callbackFun OnSubKLineResponse, id string) {
if id == "" {
id = config.DEFAULT_ID
}
ch := fmt.Sprintf("market.%s.kline.%s", contractCode, period)
subData := request.WSSubData{Sub: ch, Id: id}
data, _ := json.Marshal(subData)
wsMk.sub(data, ch, callbackFun, reflect.TypeOf(response.SubKLineResponse{}))
}
/**
【通用】请求 KLine 数据
*/
func (wsMk *WSMarketClient) ReqKLine(contractCode string, period string, callbackFun OnReqKLineResponse, from int64, to int64, id string) {
if id == "" {
id = config.DEFAULT_ID
}
ch := fmt.Sprintf("market.%s.kline.%s", contractCode, period)
subData := request.WSReqData{Req: ch, From: from, To: to, Id: id}
data, _ := json.Marshal(subData)
wsMk.req(data, ch, callbackFun, reflect.TypeOf(response.ReqKLineResponse{}))
}
/**
【通用】订阅 Market Depth 数据
*/
type OnSubDepthResponse func(*response.SubDepthResponse)
func (wsMk *WSMarketClient) SubDepth(contractCode string, fcType string, callbackFun OnSubDepthResponse, id string) {
if id == "" {
id = config.DEFAULT_ID
}
ch := fmt.Sprintf("market.%s.depth.%s", contractCode, fcType)
subData := request.WSSubData{Sub: ch, Id: id}
data, _ := json.Marshal(subData)
wsMk.sub(data, ch, callbackFun, reflect.TypeOf(response.SubDepthResponse{}))
}
/**
【通用】订阅Market Depth增量数据
*/
func (wsMk *WSMarketClient) SubIncrementalDepth(contractCode string, size string, callbackFun OnSubDepthResponse, id string) {
if id == "" {
id = config.DEFAULT_ID
}
ch := fmt.Sprintf("market.%s.depth.size_%s.high_freq", contractCode, size)
subData := request.WSSubData{Sub: ch, Id: id}
data, _ := json.Marshal(subData)
wsMk.sub(data, ch, callbackFun, reflect.TypeOf(response.SubDepthResponse{}))
}
/**
【通用】订阅 Market Detail 数据
*/
type OnSubDetailResponse func(*response.SubKLineResponse)
func (wsMk *WSMarketClient) SubDetail(contractCode string, callbackFun OnSubDetailResponse, id string) {
if id == "" {
id = config.DEFAULT_ID
}
ch := fmt.Sprintf("market.%s.detail", contractCode)
subData := request.WSSubData{Sub: ch, Id: id}
data, _ := json.Marshal(subData)
wsMk.sub(data, ch, callbackFun, reflect.TypeOf(response.SubKLineResponse{}))
}
/**
【通用】订阅买一卖一逐笔行情推送
*/
type OnSubBBOResponse func(*response.SubBBOResponse)
func (wsMk *WSMarketClient) SubBBO(contractCode string, callbackFun OnSubBBOResponse, id string) {
if id == "" {
id = config.DEFAULT_ID
}
ch := fmt.Sprintf("market.%s.bbo", contractCode)
subData := request.WSSubData{Sub: ch, Id: id}
data, _ := json.Marshal(subData)
wsMk.sub(data, ch, callbackFun, reflect.TypeOf(response.SubBBOResponse{}))
}
type OnSubTradeDetailResponse func(*response.SubTradeDetailResponse)
type OnReqTradeDetailResponse func(*response.ReqTradeDetailResponse)
/**
【通用】订阅 Trade Detail 数据
*/
func (wsMk *WSMarketClient) SubTradeDetail(contractCode string, callbackFun OnSubTradeDetailResponse, id string) {
if id == "" {
id = config.DEFAULT_ID
}
ch := fmt.Sprintf("market.%s.trade.detail", contractCode)
subData := request.WSSubData{Sub: ch, Id: id}
data, _ := json.Marshal(subData)
wsMk.sub(data, ch, callbackFun, reflect.TypeOf(response.SubTradeDetailResponse{}))
}
/**
【通用】请求 Trade Detail 数据
*/
func (wsMk *WSMarketClient) ReqTradeDetail(contractCode string, callbackFun OnReqTradeDetailResponse, id string) {
if id == "" {
id = config.DEFAULT_ID
}
ch := fmt.Sprintf("market.%s.trade.detail", contractCode)
subData := request.WSReqData{Req: ch, Id: id}
data, _ := json.Marshal(subData)
wsMk.req(data, ch, callbackFun, reflect.TypeOf(response.ReqTradeDetailResponse{}))
}
| 30.604317 | 139 | 0.734603 |
9ae6b773df04f53dade34cba83c4fb2ad5a4d419
| 281 |
css
|
CSS
|
addons/ewei_shopv2/plugin/open_farm/static/mobile/css/points.css
|
TransferStation/eweishop
|
c077ca187ebc2845becc08375352a85165ff6364
|
[
"BSD-3-Clause"
] | null | null | null |
addons/ewei_shopv2/plugin/open_farm/static/mobile/css/points.css
|
TransferStation/eweishop
|
c077ca187ebc2845becc08375352a85165ff6364
|
[
"BSD-3-Clause"
] | null | null | null |
addons/ewei_shopv2/plugin/open_farm/static/mobile/css/points.css
|
TransferStation/eweishop
|
c077ca187ebc2845becc08375352a85165ff6364
|
[
"BSD-3-Clause"
] | null | null | null |
.points{
width: 100vw;
height: 100vh;
}
.prompt_box{
width: 70%;
margin: 0 auto;
height: 2rem;
background-color: #E6F7FF;
color: rgba(0, 0, 0, 0.65);
text-align: center;
border: 1px solid #91D5FF ;
font-size: 0.8rem;
line-height: 2rem;
}
| 18.733333 | 31 | 0.580071 |
0bbef143aadcae5c58d413377ab1531838539dab
| 2,744 |
tab
|
SQL
|
tests/naif_pds4_bundler/data/regression/ladee_spice/miscellaneous/checksum/checksum_v001.tab
|
NASA-PDS/naif-pds4-bundler
|
bd7207d157ec9cae60f42cb9ea387ac194b1671c
|
[
"Apache-2.0"
] | null | null | null |
tests/naif_pds4_bundler/data/regression/ladee_spice/miscellaneous/checksum/checksum_v001.tab
|
NASA-PDS/naif-pds4-bundler
|
bd7207d157ec9cae60f42cb9ea387ac194b1671c
|
[
"Apache-2.0"
] | null | null | null |
tests/naif_pds4_bundler/data/regression/ladee_spice/miscellaneous/checksum/checksum_v001.tab
|
NASA-PDS/naif-pds4-bundler
|
bd7207d157ec9cae60f42cb9ea387ac194b1671c
|
[
"Apache-2.0"
] | null | null | null |
38c10339833e7a6d898182203b426915 bundle_ladee_spice_v001.xml
223794728ab1b085b3b9fb168a9d81ac document/collection_document_inventory_v001.csv
3fbe10479a061fdb5747c852f23c16dc document/collection_document_v001.xml
3befd718bcd83e3ca2d43b75f3bb7359 document/spiceds_v001.html
188aa9a0e5046a0e09b86df16d2896da document/spiceds_v001.xml
0a6aa36b99d460949dc997dceaad0e25 miscellaneous/collection_miscellaneous_inventory_v001.csv
d13e002cbab735f6e3f776b57e7d52c8 miscellaneous/collection_miscellaneous_v001.xml
b3bc1cf148704879c61c752c5ebb6515 readme.txt
b71bd64f8a9e206aba4b7b75283ef3d5 spice_kernels/ck/ladee_14030_14108_v04.bc
98b1953b2f66419ef972a2f3ece0c0eb spice_kernels/ck/ladee_14030_14108_v04.xml
80401daf7604470716a7448ec25490be spice_kernels/collection_spice_kernels_inventory_v001.csv
25460a2318bc3ecc70257198541dcaa8 spice_kernels/collection_spice_kernels_v001.xml
6a0e5de3ad26e16d056fb6614a726217 spice_kernels/fk/ladee_frames_2021140_v01.tf
737cd81394bc84b91ed9be9e2fcd2768 spice_kernels/fk/ladee_frames_2021140_v01.xml
93b7d5f7c2c3678590149a652e9d8835 spice_kernels/fk/moon_080317.tf
d321990d181bd1ba42031ca844e70331 spice_kernels/fk/moon_080317.xml
66ccc7b3e9b71abc5553d63c187b20d1 spice_kernels/fk/moon_assoc_me.tf
51615c34c2be4df19ed9fb027c9ebe99 spice_kernels/fk/moon_assoc_me.xml
34df617c314fca26896b3cda2208599e spice_kernels/ik/ladee_ldex_v01.ti
8c01de4c7760af64c8874764500d8e54 spice_kernels/ik/ladee_ldex_v01.xml
e99806c863a1f6308d669ba24f423127 spice_kernels/ik/ladee_nms_v00.ti
20dff7bd388236840fcd6e5dff9e5b28 spice_kernels/ik/ladee_nms_v00.xml
3ec542b88ca9028efc42f3457e37f17b spice_kernels/ik/ladee_uvs_v00.ti
8a8c78808fe3f0f7783d11b8d19b91e2 spice_kernels/ik/ladee_uvs_v00.xml
60c2d3847686f7b0757adc4c468b377d spice_kernels/lsk/naif0010.tls
1ad892cd843ec042d283c637059375ad spice_kernels/lsk/naif0010.xml
bf086c247ef2db77cf7d6180eae9ed5e spice_kernels/mk/ladee_v01.tm
4b3d843c5586efc14a598fd6a7d60bc9 spice_kernels/mk/ladee_v01.xml
da153641f7346bd5b6a1226778e0d51b spice_kernels/pck/pck00010.tpc
5635591388fd1e2f3b0bca7478efd3fd spice_kernels/pck/pck00010.xml
7801d274bdcf6e82ebf5f78d4da7492a spice_kernels/sclk/ladee_clkcor_13250_14108_v01.tsc
a6302c6d4b8e88774c1edbe68d709b89 spice_kernels/sclk/ladee_clkcor_13250_14108_v01.xml
642fe1b887e8fff9da52220fb41072de spice_kernels/sclk/ladee_clkcor_2013015_v01.tsc
4bb4ff03e69477c64ab2239fe0f117eb spice_kernels/sclk/ladee_clkcor_2013015_v01.xml
a1bbdd2e71578a8c7fd41a976146192a spice_kernels/spk/de432s.bsp
34e4725db50a505c55e07ff6dfccb284 spice_kernels/spk/de432s.xml
53a65e3feba57a20cc791e3748da110f spice_kernels/spk/ladee_r_13325_14108_sci_v01.bsp
c5a0a4ea25479bedb7d246256ef52f5a spice_kernels/spk/ladee_r_13325_14108_sci_v01.xml
| 70.358974 | 91 | 0.921283 |
ac38b34ca1cf1c50e3ba6de45f68d8caf9ee0cb7
| 11,520 |
sql
|
SQL
|
powa--3.1.2--3.2.0.sql
|
ppetrov91/powa-archivist
|
3f582813c9bad2e98b7c1d2b7d2ca232fde68f5f
|
[
"PostgreSQL"
] | null | null | null |
powa--3.1.2--3.2.0.sql
|
ppetrov91/powa-archivist
|
3f582813c9bad2e98b7c1d2b7d2ca232fde68f5f
|
[
"PostgreSQL"
] | null | null | null |
powa--3.1.2--3.2.0.sql
|
ppetrov91/powa-archivist
|
3f582813c9bad2e98b7c1d2b7d2ca232fde68f5f
|
[
"PostgreSQL"
] | null | null | null |
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
--\echo Use "ALTER EXTENSION powa" to load this file. \quit
/* pg_wait_sampling integration - part 1 */
CREATE TYPE public.wait_sampling_type AS (
ts timestamptz,
count bigint
);
/* pg_wait_sampling operator support */
CREATE TYPE wait_sampling_diff AS (
intvl interval,
count bigint
);
CREATE OR REPLACE FUNCTION wait_sampling_mi(
a wait_sampling_type,
b wait_sampling_type)
RETURNS wait_sampling_diff AS
$_$
DECLARE
res wait_sampling_diff;
BEGIN
res.intvl = a.ts - b.ts;
res.count = a.count - b.count;
return res;
END;
$_$
LANGUAGE plpgsql IMMUTABLE STRICT;
CREATE OPERATOR - (
PROCEDURE = wait_sampling_mi,
LEFTARG = wait_sampling_type,
RIGHTARG = wait_sampling_type
);
CREATE TYPE wait_sampling_rate AS (
sec integer,
count_per_sec double precision
);
CREATE OR REPLACE FUNCTION wait_sampling_div(
a wait_sampling_type,
b wait_sampling_type)
RETURNS wait_sampling_rate AS
$_$
DECLARE
res wait_sampling_rate;
sec integer;
BEGIN
res.sec = extract(EPOCH FROM (a.ts - b.ts));
IF res.sec = 0 THEN
sec = 1;
ELSE
sec = res.sec;
END IF;
res.count_per_sec = (a.count - b.count)::double precision / sec;
return res;
END;
$_$
LANGUAGE plpgsql IMMUTABLE STRICT;
CREATE OPERATOR / (
PROCEDURE = wait_sampling_div,
LEFTARG = wait_sampling_type,
RIGHTARG = wait_sampling_type
);
/* end of pg_wait_sampling operator support */
CREATE TABLE public.powa_wait_sampling_history (
coalesce_range tstzrange NOT NULL,
queryid bigint NOT NULL,
dbid oid NOT NULL,
event_type text NOT NULL,
event text NOT NULL,
records public.wait_sampling_type[] NOT NULL,
mins_in_range public.wait_sampling_type NOT NULL,
maxs_in_range public.wait_sampling_type NOT NULL,
PRIMARY KEY (coalesce_range, queryid, dbid, event_type, event)
);
CREATE INDEX ON public.powa_wait_sampling_history (queryid);
CREATE TABLE public.powa_wait_sampling_history_db (
coalesce_range tstzrange NOT NULL,
dbid oid NOT NULL,
event_type text NOT NULL,
event text NOT NULL,
records public.wait_sampling_type[] NOT NULL,
mins_in_range public.wait_sampling_type NOT NULL,
maxs_in_range public.wait_sampling_type NOT NULL,
PRIMARY KEY (coalesce_range, dbid, event_type, event)
);
CREATE TABLE public.powa_wait_sampling_history_current (
queryid bigint NOT NULL,
dbid oid NOT NULL,
event_type text NOT NULL,
event text NOT NULL,
record wait_sampling_type NOT NULL
);
CREATE TABLE public.powa_wait_sampling_history_current_db (
dbid oid NOT NULL,
event_type text NOT NULL,
event text NOT NULL,
record wait_sampling_type NOT NULL
);
/* end of pg_wait_sampling integration - part 1 */
SELECT pg_catalog.pg_extension_config_dump('powa_wait_sampling_history','');
SELECT pg_catalog.pg_extension_config_dump('powa_wait_sampling_history_db','');
SELECT pg_catalog.pg_extension_config_dump('powa_wait_sampling_history_current','');
SELECT pg_catalog.pg_extension_config_dump('powa_wait_sampling_history_current_db','');
CREATE OR REPLACE FUNCTION public.powa_check_created_extensions()
RETURNS event_trigger
LANGUAGE plpgsql
AS $_$
DECLARE
BEGIN
/* We have for now no way for a proper handling of this event,
* as we don't have a table with the list of supported extensions.
* So just call every powa_*_register() function we know each time an
* extension is created. Powa should be in a dedicated database and the
* register function handle to be called several time, so it's not critical
*/
PERFORM public.powa_kcache_register();
PERFORM public.powa_qualstats_register();
PERFORM public.powa_track_settings_register();
PERFORM public.powa_wait_sampling_register();
END;
$_$; /* end of powa_check_created_extensions */
/* end pg_track_settings integration */
/* pg_wait_sampling integration - part 2 */
/*
* register pg_wait_sampling extension
*/
CREATE OR REPLACE function public.powa_wait_sampling_register() RETURNS bool AS
$_$
DECLARE
v_func_present bool;
v_ext_present bool;
BEGIN
SELECT COUNT(*) = 1 INTO v_ext_present FROM pg_extension WHERE extname = 'pg_wait_sampling';
IF ( v_ext_present ) THEN
SELECT COUNT(*) > 0 INTO v_func_present FROM public.powa_functions WHERE module = 'pg_wait_sampling';
IF ( NOT v_func_present) THEN
PERFORM powa_log('registering pg_wait_sampling');
INSERT INTO powa_functions (module, operation, function_name, added_manually, enabled)
VALUES ('pg_wait_sampling', 'snapshot', 'powa_wait_sampling_snapshot', false, true),
('pg_wait_sampling', 'aggregate', 'powa_wait_sampling_aggregate', false, true),
('pg_wait_sampling', 'unregister', 'powa_wait_sampling_unregister', false, true),
('pg_wait_sampling', 'purge', 'powa_wait_sampling_purge', false, true),
('pg_wait_sampling', 'reset', 'powa_wait_sampling_reset', false, true);
END IF;
END IF;
RETURN true;
END;
$_$
language plpgsql; /* end of powa_wait_sampling_register */
/*
* unregister pg_wait_sampling extension
*/
CREATE OR REPLACE function public.powa_wait_sampling_unregister() RETURNS bool AS
$_$
BEGIN
PERFORM powa_log('unregistering pg_wait_sampling');
DELETE FROM public.powa_functions WHERE module = 'pg_wait_sampling';
RETURN true;
END;
$_$
language plpgsql;
/*
* powa_wait_sampling snapshot collection.
*/
CREATE OR REPLACE FUNCTION powa_wait_sampling_snapshot() RETURNS void as $PROC$
DECLARE
result bool;
v_funcname text := 'powa_wait_sampling_snapshot';
v_rowcount bigint;
BEGIN
PERFORM powa_log(format('running %I', v_funcname));
WITH capture AS (
-- the various background processes report wait events but don't have
-- associated queryid. Gather them all under a fake 0 dbid
SELECT COALESCE(pgss.dbid, 0) AS dbid, s.event_type, s.event, s.queryid,
sum(s.count) as count
FROM pg_wait_sampling_profile s
-- pg_wait_sampling doesn't offer a per (userid, dbid, queryid) view,
-- only per pid, but pid can be reused for different databases or users
-- so we cannot deduce db or user from it. However, queryid should be
-- unique across differet databases, so we retrieve the dbid this way.
LEFT JOIN pg_stat_statements(false) pgss ON pgss.queryid = s.queryid
WHERE event_type IS NOT NULL AND event IS NOT NULL
GROUP BY pgss.dbid, s.event_type, s.event, s.queryid
),
by_query AS (
INSERT INTO powa_wait_sampling_history_current (queryid, dbid,
event_type, event, record)
SELECT queryid, dbid, event_type, event, (now(), count)::wait_sampling_type
FROM capture
),
by_database AS (
INSERT INTO powa_wait_sampling_history_current_db (dbid,
event_type, event, record)
SELECT dbid, event_type, event, (now(), sum(count))::wait_sampling_type
FROM capture
GROUP BY dbid, event_type, event
)
SELECT COUNT(*) into v_rowcount
FROM capture;
perform powa_log(format('%I - rowcount: %s',
v_funcname, v_rowcount));
result := true;
END
$PROC$ language plpgsql; /* end of powa_wait_sampling_snapshot */
/*
* powa_wait_sampling aggregation
*/
CREATE OR REPLACE FUNCTION powa_wait_sampling_aggregate() RETURNS void AS $PROC$
DECLARE
result bool;
v_funcname text := 'powa_wait_sampling_aggregate';
v_rowcount bigint;
BEGIN
PERFORM powa_log(format('running %I', v_funcname));
-- aggregate history table
LOCK TABLE powa_wait_sampling_history_current IN SHARE MODE; -- prevent any other update
INSERT INTO powa_wait_sampling_history (coalesce_range, queryid, dbid,
event_type, event, records, mins_in_range, maxs_in_range)
SELECT tstzrange(min((record).ts), max((record).ts),'[]'),
queryid, dbid, event_type, event, array_agg(record),
ROW(min((record).ts),
min((record).count))::wait_sampling_type,
ROW(max((record).ts),
max((record).count))::wait_sampling_type
FROM powa_wait_sampling_history_current
GROUP BY queryid, dbid, event_type, event;
GET DIAGNOSTICS v_rowcount = ROW_COUNT;
perform powa_log(format('%I (powa_wait_sampling_history) - rowcount: %s',
v_funcname, v_rowcount));
TRUNCATE powa_wait_sampling_history_current;
-- aggregate history_db table
LOCK TABLE powa_wait_sampling_history_current_db IN SHARE MODE; -- prevent any other update
INSERT INTO powa_wait_sampling_history_db (coalesce_range, dbid,
event_type, event, records, mins_in_range, maxs_in_range)
SELECT tstzrange(min((record).ts), max((record).ts),'[]'), dbid,
event_type, event, array_agg(record),
ROW(min((record).ts),
min((record).count))::wait_sampling_type,
ROW(max((record).ts),
max((record).count))::wait_sampling_type
FROM powa_wait_sampling_history_current_db
GROUP BY dbid, event_type, event;
GET DIAGNOSTICS v_rowcount = ROW_COUNT;
perform powa_log(format('%I (powa_wait_sampling_history_db) - rowcount: %s',
v_funcname, v_rowcount));
TRUNCATE powa_wait_sampling_history_current_db;
END
$PROC$ language plpgsql; /* end of powa_wait_sampling_aggregate */
/*
* powa_wait_sampling purge
*/
CREATE OR REPLACE FUNCTION powa_wait_sampling_purge() RETURNS void as $PROC$
DECLARE
v_funcname text := 'powa_wait_sampling_purge';
v_rowcount bigint;
BEGIN
PERFORM powa_log(format('running %I', v_funcname));
DELETE FROM powa_wait_sampling_history WHERE upper(coalesce_range) < (now() - current_setting('powa.retention')::interval);
GET DIAGNOSTICS v_rowcount = ROW_COUNT;
perform powa_log(format('%I (powa_wait_sampling_history) - rowcount: %s',
v_funcname, v_rowcount));
DELETE FROM powa_wait_sampling_history_db WHERE upper(coalesce_range) < (now() - current_setting('powa.retention')::interval);
GET DIAGNOSTICS v_rowcount = ROW_COUNT;
perform powa_log(format('%I (powa_wait_sampling_history_db) - rowcount: %s',
v_funcname, v_rowcount));
END;
$PROC$ language plpgsql; /* end of powa_wait_sampling_purge */
/*
* powa_wait_sampling reset
*/
CREATE OR REPLACE FUNCTION powa_wait_sampling_reset() RETURNS void as $PROC$
DECLARE
v_funcname text := 'powa_wait_sampling_reset';
v_rowcount bigint;
BEGIN
PERFORM powa_log('running powa_wait_sampling_reset');
PERFORM powa_log('truncating powa_wait_sampling_history');
TRUNCATE TABLE powa_wait_sampling_history;
PERFORM powa_log('truncating powa_wait_sampling_history_db');
TRUNCATE TABLE powa_wait_sampling_history_db;
PERFORM powa_log('truncating powa_wait_sampling_history_current');
TRUNCATE TABLE powa_wait_sampling_history_current;
PERFORM powa_log('truncating powa_wait_sampling_history_current_db');
TRUNCATE TABLE powa_wait_sampling_history_current_db;
END;
$PROC$ language plpgsql; /* end of powa_wait_sampling_reset */
-- By default, try to register pg_wait_sampling, in case it's alreay here
SELECT * FROM public.powa_wait_sampling_register();
/* end of pg_wait_sampling integration - part 2 */
| 33.882353 | 130 | 0.715799 |
a2c07b164dd0e066437570048e470d72e1e0aea5
| 557 |
asm
|
Assembly
|
oeis/010/A010059.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 11 |
2021-08-22T19:44:55.000Z
|
2022-03-20T16:47:57.000Z
|
oeis/010/A010059.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 9 |
2021-08-29T13:15:54.000Z
|
2022-03-09T19:52:31.000Z
|
oeis/010/A010059.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 3 |
2021-08-22T20:56:47.000Z
|
2021-09-29T06:26:12.000Z
|
; A010059: Another version of the Thue-Morse sequence: let A_k denote the first 2^k terms; then A_0 = 1 and for k >= 0, A_{k+1} = A_k B_k, where B_k is obtained from A_k by interchanging 0's and 1's.
; Submitted by Christian Krause
; 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1
seq $0,120 ; 1's-counting sequence: number of 1's in binary expansion of n (or the binary weight of n).
add $0,1
mod $0,2
| 69.625 | 201 | 0.635548 |
e8e693322ca4748ac11e7ad6f26ec9749c3ce95e
| 904 |
py
|
Python
|
Python Notebook/Python files/data_utility.py
|
wilfy9249/Capstone-Fall-18
|
832632eb00a10240e0ad16c364449d5020814c83
|
[
"MIT"
] | 2 |
2018-10-24T21:32:17.000Z
|
2019-02-19T21:15:29.000Z
|
Python Notebook/Python files/data_utility.py
|
wilfy9249/Capstone-Fall-18
|
832632eb00a10240e0ad16c364449d5020814c83
|
[
"MIT"
] | null | null | null |
Python Notebook/Python files/data_utility.py
|
wilfy9249/Capstone-Fall-18
|
832632eb00a10240e0ad16c364449d5020814c83
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
import pandas as pd
import os
# In[2]:
#function to get current directory
def getCurrentDirectory():
listDirectory = os.listdir('../')
return listDirectory
# In[3]:
#function to read csv file
def readCsvFile(path):
crimes_original = pd.read_csv(path, low_memory=False)
return crimes_original
# In[4]:
#function to filter Data
def filterData(data,column,value):
filterData = data.loc[data[column] == value]
return filterData
# In[5]:
#function to get count of a value
def getCount(data,column,columnName):
data_count = pd.DataFrame({columnName:data.groupby(column).size()}).reset_index()
return data_count
# In[7]:
#function to sort
def sortValue(data,column,ascBoolean):
sorted_data = data.sort_values(column,ascending = ascBoolean)
return sorted_data
# In[ ]:
| 14.580645 | 85 | 0.692478 |
cc277ae542c547efeab5e0fc5f9feb11acba947b
| 19,673 |
swift
|
Swift
|
TridentCockpitiOS/PastDivesViewController/PastDivesViewController.swift
|
DimaRU/TridentCockpit
|
0c8f45fa0a6f0bad772e5ea36c800b9b0b279497
|
[
"MIT"
] | 13 |
2019-11-15T11:07:20.000Z
|
2022-03-24T11:12:18.000Z
|
TridentCockpitiOS/PastDivesViewController/PastDivesViewController.swift
|
DimaRU/TridentCockpit
|
0c8f45fa0a6f0bad772e5ea36c800b9b0b279497
|
[
"MIT"
] | 1 |
2019-12-30T22:10:07.000Z
|
2019-12-30T22:10:07.000Z
|
TridentCockpitiOS/PastDivesViewController/PastDivesViewController.swift
|
DimaRU/TridentCockpit
|
0c8f45fa0a6f0bad772e5ea36c800b9b0b279497
|
[
"MIT"
] | 5 |
2019-12-25T21:12:49.000Z
|
2020-11-17T07:26:21.000Z
|
/////
//// PastDivesViewController.swift
/// Copyright © 2020 Dmitriy Borovikov. All rights reserved.
//
import UIKit
import Kingfisher
import AVKit
import Shout
class PastDivesViewController: UIViewController {
@IBOutlet weak var collectionView: UICollectionView!
@IBOutlet weak var availableSpaceBar: LinearProgressBar!
@IBOutlet weak var availableSpaceLabel: UILabel!
@IBOutlet weak var deleteAfterSwitch: PWSwitch!
@IBOutlet weak var recoveryButton: UIBarButtonItem!
var sectionDates: [Date] = []
var recordingBySection: [Date: [Recording]] = [:]
var downloadState: [String: SmartDownloadButton.DownloadState] = [:]
var progressState: [String: Double] = [:]
let sectionFormatter = DateFormatter()
let diveLabelFormatter = DateFormatter()
weak var recordingsAPI: RecordingsAPI! = RecordingsAPI.shared
override func viewDidLoad() {
super.viewDidLoad()
// KingfisherManager.shared.cache.clearDiskCache()
ImageDownloader.default.downloadTimeout = 60
recordingsAPI?.setup(remoteAddress: FastRTPS.remoteAddress, delegate: self)
collectionView.allowsMultipleSelection = true
let layout = collectionView.collectionViewLayout as! UICollectionViewFlowLayout
layout.sectionInsetReference = .fromContentInset
availableSpaceBar.barColorForValue = { value in
switch value {
case 0..<10:
return UIColor.red
case 10..<20:
return UIColor.yellow
default:
return UIColor.systemGreen
}
}
sectionFormatter.dateFormat = "MMMM dd"
diveLabelFormatter.dateFormat = "MMM dd hh:mm:ss"
NotificationCenter.default.addObserver(self, selector: #selector(deviceRotated), name:UIDevice.orientationDidChangeNotification, object: nil)
NotificationCenter.default.addObserver(forName: .AVPlayerItemDidPlayToEndTime, object: nil, queue: nil) { _ in
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
DivePlayerViewController.shared?.removeFromContainer()
}
}
NotificationCenter.default.addObserver(forName: .AVPlayerItemFailedToPlayToEndTime, object: nil, queue: nil) { _ in
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
DivePlayerViewController.shared?.removeFromContainer()
}
}
let refreshControl = UIRefreshControl()
refreshControl.addTarget(self, action: #selector(refreshRecordings), for: .valueChanged)
collectionView.refreshControl = refreshControl
refreshRecordings()
checkRecovery()
}
deinit {
NotificationCenter.default.removeObserver(self)
KingfisherManager.shared.cache.clearMemoryCache()
}
@objc func deviceRotated() {
setupLayout(for: view.bounds.size)
collectionView.setNeedsLayout()
}
@objc func refreshRecordings() {
recordingsAPI.requestRecordings { result in
switch result {
case .success(let recordings):
self.collectionView.refreshControl?.endRefreshing()
self.sortRecordings(recordings)
case .failure(let error):
self.collectionView.refreshControl?.endRefreshing()
error.alert(delay: 100)
self.sortRecordings([])
}
}
}
//MARK: Overrides
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
FastRTPS.registerReader(topic: .rovRecordingStats) { [weak self] (recordingStats: RovRecordingStats) in
guard let self = self else { return }
DispatchQueue.main.async {
let availableBytes = recordingStats.diskSpaceTotalBytes < recordingStats.diskSpaceUsedBytes ? 0 : recordingStats.diskSpaceTotalBytes - recordingStats.diskSpaceUsedBytes
let level = Double(availableBytes) / Double(recordingStats.diskSpaceTotalBytes)
let gigabyte: Double = 1000 * 1000 * 1000
let total = Double(recordingStats.diskSpaceTotalBytes) / gigabyte
let availableGB = Double(availableBytes) / gigabyte
self.availableSpaceLabel.text = String(format: "%.1f GB of %.1f GB free", availableGB, total)
self.availableSpaceBar.progressValue = CGFloat(level) * 100
self.availableSpaceBar.transform = CGAffineTransform(rotationAngle: .pi)
}
}
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
FastRTPS.removeReader(topic: .rovRecordingStats)
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
setupLayout(for: view.bounds.size)
}
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
guard collectionView != nil else { return }
guard let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout else { return }
layout.invalidateLayout()
}
// MARK: Action
@IBAction func selectAllButtonTap(_ sender: Any) {
for section in sectionDates.indices {
for item in recordingBySection[sectionDates[section]]!.indices {
collectionView.selectItem(at: IndexPath(item: item, section: section), animated: false, scrollPosition: [])
}
}
}
@IBAction func deselectAllButtonTap(_ sender: Any) {
for section in sectionDates.indices {
for item in recordingBySection[sectionDates[section]]!.indices {
collectionView.deselectItem(at: IndexPath(item: item, section: section), animated: false)
}
}
}
@IBAction func downloadButtonTap(_ sender: Any) {
guard let selected = collectionView.indexPathsForSelectedItems, !selected.isEmpty else { return }
let recordings = selected.map { getRecording(by: $0) }.filter{ downloadState[$0.sessionId]! == .start }
download(recordings: recordings)
}
@IBAction func deleteButtonTap(_ sender: Any) {
guard let selected = collectionView.indexPathsForSelectedItems, !selected.isEmpty else { return }
let count = selected.count
let sheet = UIAlertController(title: "This will permanently delete \(count) video files on Trident",
message: "Delete dive?",
preferredStyle: .alert)
let okAction = UIAlertAction(title: "OK", style: .default) { _ in
let recordings = selected.map { self.getRecording(by: $0) }
self.delete(recordins: recordings)
}
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel)
sheet.addAction(okAction)
sheet.addAction(cancelAction)
present(sheet, animated: true)
}
@IBAction func cancelButtonTap(_ sender: Any) {
let count = downloadState.values.filter{ $0 == .wait || $0 == .run }.count
guard count != 0 else { return }
let sheet = UIAlertController(title: "Cancel \(count) downloads?",
message: "Are you sure?",
preferredStyle: .alert)
let okAction = UIAlertAction(title: "OK", style: .default) { _ in
self.recordingsAPI.cancelDownloads()
}
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel)
sheet.addAction(okAction)
sheet.addAction(cancelAction)
present(sheet, animated: true)
}
// MARK: Private functions
private func checkRecovery() {
let command = """
#!/bin/bash
for dir in /data/openrov/video/sessions/.[0-9,a-z]*; do
if [ -d "$dir" ]; then
echo "Recovery"
break
fi
done
"""
SSH.executeCommand(command)
.done {
self.recoveryButton.isEnabled = $0.last == "Recovery"
}.catch { error in
print(error)
}
}
private func download(recordings: [Recording]) {
for recording in recordings {
downloadState[recording.sessionId] = .wait
if let indexPath = getIndexPath(by: recording),
let item = collectionView.cellForItem(at: indexPath) as? DiveCollectionViewCell {
item.downloadButton.trasition(to: .wait)
}
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
recordings.forEach{ self.recordingsAPI.download(recording: $0) }
}
}
private func delete(recordins: [Recording]) {
for recording in recordins {
recordingsAPI.deleteRecording(with: recording.sessionId) { error in
if let error = error {
error.alert(delay: 10)
return
}
self.deleteItem(for: recording)
}
}
}
private func deleteItem(for recording: Recording) {
let indexPath = getIndexPath(by: recording)!
let date = sectionDates[indexPath.section]
recordingBySection[date]!.remove(at: indexPath.item)
collectionView.deleteItems(at: [indexPath])
if recordingBySection[date]!.isEmpty {
sectionDates.remove(at: indexPath.section)
collectionView.deleteSections([indexPath.section])
if sectionDates.isEmpty {
collectionView.reloadData()
}
}
}
private func markItemDownloaded(for recording: Recording) {
let indexPath = getIndexPath(by: recording)!
collectionView.deselectItem(at: indexPath, animated: false)
if let item = collectionView.cellForItem(at: indexPath) as? DiveCollectionViewCell {
item.downloadButton.trasition(to: .end)
}
}
private func getRecording(by indexPath: IndexPath) -> Recording {
let sectionDate = sectionDates[indexPath.section]
return recordingBySection[sectionDate]![indexPath.item]
}
private func getRecording(by sessionId: String) -> Recording? {
for (_, recordings) in recordingBySection {
if let recording = recordings.first(where: {$0.sessionId == sessionId}) {
return recording
}
}
return nil
}
private func sortRecordings(_ recordings: [Recording]) {
recordingBySection = [:]
sectionDates = []
downloadState = [:]
for recording in recordings {
downloadState[recording.sessionId] = .start
if recordingsAPI.isDownloaded(recording: recording) {
downloadState[recording.sessionId] = .end
}
let date = recording.startTimestamp.clearedTime
recordingBySection[date, default: []].append(recording)
}
sectionDates = recordingBySection.keys.sorted(by: > )
for key in sectionDates {
recordingBySection[key] = recordingBySection[key]!.sorted(by: {$0.startTimestamp < $1.startTimestamp})
}
recordingsAPI.getDownloads { progressList in
for (sessionId, (countOfBytesReceived, countOfBytesExpectedToReceive)) in progressList {
let progress: Double
if countOfBytesReceived == 0 || countOfBytesExpectedToReceive == 0 {
progress = 0
} else {
progress = Double(countOfBytesReceived) / Double(countOfBytesExpectedToReceive)
}
self.downloadState[sessionId] = progress == 0 ? .wait : .run
self.progressState[sessionId] = progress
}
self.collectionView.reloadData()
}
}
private func getIndexPath(by recording: Recording) -> IndexPath? {
let date = recording.startTimestamp.clearedTime
guard let section = sectionDates.firstIndex(of: date) else { return nil }
guard let item = recordingBySection[date]!.firstIndex(where: { $0.startTimestamp == recording.startTimestamp }) else {
return nil
}
return IndexPath(item: item, section: section)
}
#if targetEnvironment(macCatalyst)
private func setupLayout(for size: CGSize) {
let layout = collectionView.collectionViewLayout as! UICollectionViewFlowLayout
layout.minimumInteritemSpacing = 4
layout.minimumLineSpacing = 4
let layoutWidth = size.width - layout.sectionInset.left - layout.sectionInset.right
let itemCount = (layoutWidth / 300).rounded(.down)
let itemWidth = (layoutWidth + layout.minimumInteritemSpacing) / itemCount - layout.minimumInteritemSpacing
let itemHeight = itemWidth / 16.0 * 9
layout.itemSize = CGSize(width: itemWidth, height: itemHeight)
layout.estimatedItemSize = .zero
layout.invalidateLayout()
}
#else
private func setupLayout(for size: CGSize) {
guard let orientation = getInterfaceOrientation() else { return }
let layout = collectionView.collectionViewLayout as! UICollectionViewFlowLayout
layout.minimumInteritemSpacing = 4
layout.minimumLineSpacing = 4
layout.sectionInset = .zero
switch orientation {
case .landscapeRight:
layout.sectionInset.left = collectionView.safeAreaInsets.left != 0 ? collectionView.safeAreaInsets.left : 4
layout.sectionInset.right = 4
case .landscapeLeft:
layout.sectionInset.left = 4
layout.sectionInset.right = collectionView.safeAreaInsets.right != 0 ? collectionView.safeAreaInsets.right : 4
default:
layout.sectionInset.left = 4
layout.sectionInset.right = 4
break
}
let layoutWidth = size.width - layout.sectionInset.left - layout.sectionInset.right
let itemWidth: CGFloat
let itemCount: CGFloat
if UIDevice.current.userInterfaceIdiom == .pad {
itemCount = (layoutWidth / 300).rounded(.down)
itemWidth = (layoutWidth + layout.minimumInteritemSpacing) / itemCount - layout.minimumInteritemSpacing
} else {
itemCount = UIScreen.main.traitCollection.verticalSizeClass == .compact ? 2 : 3
if orientation.isLandscape {
itemWidth = (layoutWidth + layout.minimumInteritemSpacing) / itemCount - layout.minimumInteritemSpacing
} else {
itemWidth = layoutWidth
}
}
let itemHeight = itemWidth / 16.0 * 9
layout.itemSize = CGSize(width: itemWidth, height: itemHeight)
layout.estimatedItemSize = .zero
layout.invalidateLayout()
}
#endif
private func previewVideo(recording: Recording, in cell: DiveCollectionViewCell) {
DivePlayerViewController.shared?.removeFromContainer()
let playerViewController = DivePlayerViewController.add(to: cell.subviews[0], parentViewController: self)
playerViewController.entersFullScreenWhenPlaybackBegins = true
playerViewController.exitsFullScreenWhenPlaybackEnds = true
let url = recordingsAPI.videoURL(recording: recording)
playerViewController.player = AVPlayer(url: url)
playerViewController.player?.preventsDisplaySleepDuringVideoPlayback = true
playerViewController.player?.rate = 1
playerViewController.enterFullscreen()
}
}
extension PastDivesViewController: UICollectionViewDataSource {
func numberOfSections(in collectionView: UICollectionView) -> Int {
// noVideoLabel.isHidden = !sectionDates.isEmpty
return sectionDates.count
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
let sectionDate = sectionDates[section]
return recordingBySection[sectionDate]?.count ?? 0
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueCell(of: DiveCollectionViewCell.self, for: indexPath)
let recording = getRecording(by: indexPath)
let imageURL = recordingsAPI.previewURL(recording: recording)
cell.previewLabel.text = diveLabelFormatter.string(from: recording.startTimestamp)
cell.previewImage?.kf.indicatorType = .activity
cell.previewImage?.kf.setImage(with: imageURL)
cell.downloadButton.downloadState = downloadState[recording.sessionId]!
cell.downloadButton.progress = progressState[recording.sessionId] ?? 0
cell.delegate = self
return cell
}
func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
let headerView = collectionView.dequeueSupplementaryView(of: DiveCollectionReusableView.self, kind: kind, for: indexPath)
let sectionDate = sectionDates[indexPath.section]
headerView.headerLabel.text = sectionFormatter.string(from: sectionDate)
return headerView
}
}
extension PastDivesViewController: RecordingsAPIProtocol {
func downloadError(sessionId: String, error: Error) {
if let recording = getRecording(by: sessionId),
let indexPath = getIndexPath(by: recording),
let item = collectionView.cellForItem(at: indexPath) as? DiveCollectionViewCell {
item.downloadButton.downloadState = .start
}
downloadState[sessionId] = .start
progressState[sessionId] = 0
let nserror = error as NSError
if nserror.domain == NSURLErrorDomain,
nserror.code == NSURLErrorCancelled {
return
}
error.alert(delay: 10)
}
func downloadEnd(sessionId: String) {
guard let recording = getRecording(by: sessionId) else { return }
downloadState[recording.sessionId] = .end
let deleteAfter = deleteAfterSwitch.on
if deleteAfter {
self.delete(recordins: [recording])
} else {
self.markItemDownloaded(for: recording)
}
}
func progress(sessionId: String, totalBytesWritten: Int64, totalBytesExpectedToWrite: Int64) {
guard
let recording = getRecording(by: sessionId),
let indexPath = getIndexPath(by: recording),
let item = collectionView.cellForItem(at: indexPath) as? DiveCollectionViewCell else { return
}
let progress = Double(totalBytesWritten) / Double(totalBytesExpectedToWrite)
item.downloadButton.downloadState = .run
item.downloadButton.progress = progress
downloadState[sessionId] = .run
progressState[sessionId] = progress
}
}
extension PastDivesViewController: DiveCollectionViewCellDelegate {
func playButtonAction(cell: DiveCollectionViewCell) {
guard let path = self.collectionView.indexPath(for: cell) else { return }
let recording = self.getRecording(by: path)
self.previewVideo(recording: recording, in: cell)
}
func downloadButtonAction(cell: DiveCollectionViewCell) {
guard let path = self.collectionView.indexPath(for: cell) else { return }
let recording = self.getRecording(by: path)
self.download(recordings: [recording])
}
}
| 41.070981 | 184 | 0.64525 |
b2dc6929b15ae89ed88d8e3ef2cd52728dbd110e
| 5,794 |
py
|
Python
|
gui/Ui_sales_transaction.py
|
kim-song/kimsong-apriori
|
0f2a4a2b749989ad1305da3836e7404c09482534
|
[
"MIT"
] | 2 |
2020-07-17T09:36:56.000Z
|
2020-12-11T11:36:11.000Z
|
gui/Ui_sales_transaction.py
|
kimsongsao/kimsong-apriori
|
0f2a4a2b749989ad1305da3836e7404c09482534
|
[
"MIT"
] | null | null | null |
gui/Ui_sales_transaction.py
|
kimsongsao/kimsong-apriori
|
0f2a4a2b749989ad1305da3836e7404c09482534
|
[
"MIT"
] | 1 |
2020-07-17T09:23:15.000Z
|
2020-07-17T09:23:15.000Z
|
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'd:\MITE12\ksapriori\gui\sales_transaction.ui'
#
# Created by: PyQt5 UI code generator 5.12.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_FormSalesTransaction(object):
def setupUi(self, FormSalesTransaction):
FormSalesTransaction.setObjectName("FormSalesTransaction")
FormSalesTransaction.resize(989, 466)
self.groupBox = QtWidgets.QGroupBox(FormSalesTransaction)
self.groupBox.setGeometry(QtCore.QRect(10, 10, 181, 451))
font = QtGui.QFont()
font.setFamily("Segoe UI")
font.setPointSize(9)
self.groupBox.setFont(font)
self.groupBox.setObjectName("groupBox")
self.pushButton = QtWidgets.QPushButton(self.groupBox)
self.pushButton.setGeometry(QtCore.QRect(80, 190, 75, 23))
self.pushButton.setObjectName("pushButton")
self.widget = QtWidgets.QWidget(self.groupBox)
self.widget.setGeometry(QtCore.QRect(10, 31, 151, 140))
self.widget.setObjectName("widget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.widget)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.label = QtWidgets.QLabel(self.widget)
font = QtGui.QFont()
font.setFamily("Segoe UI")
font.setPointSize(9)
self.label.setFont(font)
self.label.setObjectName("label")
self.verticalLayout.addWidget(self.label)
self.fromDate = QtWidgets.QDateEdit(self.widget)
font = QtGui.QFont()
font.setFamily("Segoe UI")
font.setPointSize(9)
self.fromDate.setFont(font)
self.fromDate.setObjectName("fromDate")
self.verticalLayout.addWidget(self.fromDate)
self.label_2 = QtWidgets.QLabel(self.widget)
font = QtGui.QFont()
font.setFamily("Segoe UI")
font.setPointSize(9)
self.label_2.setFont(font)
self.label_2.setObjectName("label_2")
self.verticalLayout.addWidget(self.label_2)
self.toDate = QtWidgets.QDateEdit(self.widget)
font = QtGui.QFont()
font.setFamily("Segoe UI")
font.setPointSize(9)
self.toDate.setFont(font)
self.toDate.setObjectName("toDate")
self.verticalLayout.addWidget(self.toDate)
self.label_3 = QtWidgets.QLabel(self.widget)
font = QtGui.QFont()
font.setFamily("Segoe UI")
font.setPointSize(9)
self.label_3.setFont(font)
self.label_3.setObjectName("label_3")
self.verticalLayout.addWidget(self.label_3)
self.lineEdit = QtWidgets.QLineEdit(self.widget)
self.lineEdit.setObjectName("lineEdit")
self.verticalLayout.addWidget(self.lineEdit)
self.tableWidget = QtWidgets.QTableWidget(FormSalesTransaction)
self.tableWidget.setGeometry(QtCore.QRect(200, 20, 781, 441))
self.tableWidget.setObjectName("tableWidget")
self.tableWidget.setColumnCount(8)
self.tableWidget.setRowCount(0)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(0, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(1, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(2, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(3, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(4, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(5, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(6, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(7, item)
self.retranslateUi(FormSalesTransaction)
QtCore.QMetaObject.connectSlotsByName(FormSalesTransaction)
def retranslateUi(self, FormSalesTransaction):
_translate = QtCore.QCoreApplication.translate
FormSalesTransaction.setWindowTitle(_translate("FormSalesTransaction", "Sales Transaction"))
self.groupBox.setTitle(_translate("FormSalesTransaction", "Filters"))
self.pushButton.setText(_translate("FormSalesTransaction", "Search"))
self.label.setText(_translate("FormSalesTransaction", "From Date"))
self.label_2.setText(_translate("FormSalesTransaction", "To Date"))
self.label_3.setText(_translate("FormSalesTransaction", "Item Code"))
item = self.tableWidget.horizontalHeaderItem(0)
item.setText(_translate("FormSalesTransaction", "Document No"))
item = self.tableWidget.horizontalHeaderItem(1)
item.setText(_translate("FormSalesTransaction", "Posting Date"))
item = self.tableWidget.horizontalHeaderItem(2)
item.setText(_translate("FormSalesTransaction", "Item Code"))
item = self.tableWidget.horizontalHeaderItem(3)
item.setText(_translate("FormSalesTransaction", "Item Label"))
item = self.tableWidget.horizontalHeaderItem(4)
item.setText(_translate("FormSalesTransaction", "Description"))
item = self.tableWidget.horizontalHeaderItem(5)
item.setText(_translate("FormSalesTransaction", "Quantity"))
item = self.tableWidget.horizontalHeaderItem(6)
item.setText(_translate("FormSalesTransaction", "Price"))
item = self.tableWidget.horizontalHeaderItem(7)
item.setText(_translate("FormSalesTransaction", "Amount"))
| 48.283333 | 101 | 0.681049 |
9e138e73572656b68df427c9253f390d0a40d0e7
| 47 |
rs
|
Rust
|
src/lib.rs
|
715209/mfa
|
29118ba8b00c16a6f36fb547a1f8f6c5701b2868
|
[
"MIT"
] | null | null | null |
src/lib.rs
|
715209/mfa
|
29118ba8b00c16a6f36fb547a1f8f6c5701b2868
|
[
"MIT"
] | null | null | null |
src/lib.rs
|
715209/mfa
|
29118ba8b00c16a6f36fb547a1f8f6c5701b2868
|
[
"MIT"
] | null | null | null |
pub mod hmac_sha1;
pub mod hotp;
pub mod totp;
| 11.75 | 18 | 0.744681 |
504065756633765bd95e3853532cd460651575be
| 3,054 |
go
|
Go
|
gameboy/audio/audio.go
|
scottyw/tetromino
|
6b424ea1dc255b32d3ad5ef8268964164b802ab1
|
[
"Apache-2.0"
] | 4 |
2018-07-30T06:58:37.000Z
|
2020-01-21T08:37:56.000Z
|
gameboy/audio/audio.go
|
scottyw/goomba
|
128e701a2d8a5152a1a7d6710392faab8ab2d8d1
|
[
"Apache-2.0"
] | null | null | null |
gameboy/audio/audio.go
|
scottyw/goomba
|
128e701a2d8a5152a1a7d6710392faab8ab2d8d1
|
[
"Apache-2.0"
] | 1 |
2019-10-08T19:37:43.000Z
|
2019-10-08T19:37:43.000Z
|
package audio
const (
frameSeqPeriod = 4194304 / 512 // 512Hz
samplerPeriod = 4194304 / 44100 // 44100 Hz
)
// Audio stream
type Audio struct {
l chan float32
r chan float32
ch1 *square
ch2 *square
ch3 *wave
ch4 *noise
control *control
ticks uint64
frameSeqTicks uint64
}
// NewAudio initializes our internal channel for audio data
func New(l, r chan float32) *Audio {
audio := Audio{
l: l,
r: r,
ch1: &square{sweep: &sweep{}},
ch2: &square{},
ch3: &wave{
waveram: [16]uint8{0x84, 0x40, 0x43, 0xAA, 0x2D, 0x78, 0x92, 0x3C, 0x60, 0x59, 0x59, 0xB0, 0x34, 0xB8, 0x2E, 0xDA},
},
ch4: &noise{},
control: &control{},
ticks: 1,
}
// Set default values for the NR registers
audio.WriteNR10(0x80)
audio.WriteNR11(0xbf)
audio.WriteNR12(0xf3)
audio.WriteNR13(0xff)
audio.WriteNR14(0xbf)
audio.WriteNR21(0x3f)
audio.WriteNR23(0xff)
audio.WriteNR24(0xbf)
audio.WriteNR30(0x7f)
audio.WriteNR31(0xff)
audio.WriteNR32(0x9f)
audio.WriteNR33(0xff)
audio.WriteNR34(0xbf)
audio.WriteNR41(0xff)
audio.WriteNR44(0xbf)
audio.WriteNR50(0x77)
audio.WriteNR51(0xf3)
audio.WriteNR52(0xf1)
return &audio
}
// EndMachineCycle emulates the audio hardware at the end of a machine cycle
func (a *Audio) EndMachineCycle() {
// Each machine cycle is four clock cycles
a.tickClock()
a.tickClock()
a.tickClock()
a.tickClock()
a.ch1.triggered = false
a.ch2.triggered = false
a.ch3.triggered = false
a.ch4.triggered = false
}
func (a *Audio) tickClock() {
if a.ticks > 4194304 {
a.ticks = 1
a.frameSeqTicks = 0
}
// Tick every clock cycle
a.tickTimer()
// Tick the frame sequencer at 512 Hz
if a.ticks%frameSeqPeriod == 0 {
a.tickFrameSequencer()
if a.frameSeqTicks >= 512 {
a.frameSeqTicks = 0
}
}
// Tick this function at 44100 Hz
if a.ticks%samplerPeriod == 0 {
a.tickSampler()
}
a.ticks++
}
func (a *Audio) tickTimer() {
if !a.ch1.triggered {
a.ch1.tickTimer()
}
if !a.ch2.triggered {
a.ch2.tickTimer()
}
if !a.ch3.triggered {
a.ch3.tickTimer()
}
if !a.ch4.triggered {
a.ch4.tickTimer()
}
}
func (a *Audio) tickFrameSequencer() {
// Step Length Ctr Vol Env Sweep
// ---------------------------------------
// 0 Clock - -
// 1 - - -
// 2 Clock - Clock
// 3 - - -
// 4 Clock - -
// 5 - - -
// 6 Clock - Clock
// 7 - Clock -
// ---------------------------------------
// Rate 256 Hz 64 Hz 128 Hz
if a.frameSeqTicks%2 == 0 {
a.ch1.tickLength()
a.ch2.tickLength()
a.ch3.tickLength()
a.ch4.tickLength()
}
if (a.frameSeqTicks-7)%8 == 0 {
a.ch1.tickVolumeEnvelope()
a.ch2.tickVolumeEnvelope()
a.ch4.tickVolumeEnvelope()
}
if (a.frameSeqTicks-2)%4 == 0 {
a.ch1.tickSweep()
}
a.frameSeqTicks++
}
func (a *Audio) tickSampler() {
a.takeSample()
}
| 20.092105 | 118 | 0.57924 |
047cf253f511e51e82cb97c1c2c14016af1f2fc4
| 483 |
swift
|
Swift
|
Driver/MVC/Core/View/BaseView/BaseXibView.swift
|
dathtcheapgo/Jira-Demo
|
1df5317e59f349eb02c90fc1a0c2b2cb58ab8826
|
[
"MIT"
] | null | null | null |
Driver/MVC/Core/View/BaseView/BaseXibView.swift
|
dathtcheapgo/Jira-Demo
|
1df5317e59f349eb02c90fc1a0c2b2cb58ab8826
|
[
"MIT"
] | null | null | null |
Driver/MVC/Core/View/BaseView/BaseXibView.swift
|
dathtcheapgo/Jira-Demo
|
1df5317e59f349eb02c90fc1a0c2b2cb58ab8826
|
[
"MIT"
] | null | null | null |
//
// BaseXibView.swift
// rider
//
// Created by Đinh Anh Huy on 10/12/16.
// Copyright © 2016 Đinh Anh Huy. All rights reserved.
//
import UIKit
class BaseXibView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
initControl()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
initControl()
}
func initControl() {
fatalError("Implement \(self) initControl")
}
}
| 17.888889 | 55 | 0.596273 |
b3ecbc8fb4a0c2304153f1a9f5523897a702a11b
| 176 |
sql
|
SQL
|
HabitsBackend/Habits-Service/src/main/resources/db/mysql/V1__Create_Habit_Table.sql
|
varunbhanot/Habits
|
ab7a2d3e91fe2a4fd8cec42da1e9c981659c6a45
|
[
"MIT"
] | 6 |
2018-04-05T13:42:57.000Z
|
2020-09-18T10:49:39.000Z
|
HabitsBackend/Habits-Service/src/main/resources/db/mysql/V1__Create_Habit_Table.sql
|
varunbhanot/Habits
|
ab7a2d3e91fe2a4fd8cec42da1e9c981659c6a45
|
[
"MIT"
] | null | null | null |
HabitsBackend/Habits-Service/src/main/resources/db/mysql/V1__Create_Habit_Table.sql
|
varunbhanot/Habits
|
ab7a2d3e91fe2a4fd8cec42da1e9c981659c6a45
|
[
"MIT"
] | 3 |
2018-12-25T22:52:38.000Z
|
2022-02-21T19:44:44.000Z
|
CREATE TABLE habit (
habit_id int not null auto_increment,
device_id VARCHAR(128),
name VARCHAR(128),
question VARCHAR(4000),
primary key(habit_id)
);
| 25.142857 | 41 | 0.670455 |
7965618501f7b90bc9d4c5d4dbed4d3b6c558d9c
| 370 |
kt
|
Kotlin
|
networking/src/main/java/com/erevacation/networking/ApiService.kt
|
highmobdevelopment/userlist_anko
|
bbd48c924f601865988a4a82d3d1f328e866ff80
|
[
"Apache-2.0"
] | null | null | null |
networking/src/main/java/com/erevacation/networking/ApiService.kt
|
highmobdevelopment/userlist_anko
|
bbd48c924f601865988a4a82d3d1f328e866ff80
|
[
"Apache-2.0"
] | null | null | null |
networking/src/main/java/com/erevacation/networking/ApiService.kt
|
highmobdevelopment/userlist_anko
|
bbd48c924f601865988a4a82d3d1f328e866ff80
|
[
"Apache-2.0"
] | null | null | null |
package com.erevacation.networking
import com.erevacation.networking.networkmodel.ListNM
import com.erevacation.networking.networkmodel.ProductNM
import io.reactivex.Observable
import retrofit2.http.GET
import retrofit2.http.Query
interface ApiService {
@GET("highmobdevelopment/userlist/master/contacts.json")
fun getList(): Observable<MutableList<ListNM>>
}
| 28.461538 | 60 | 0.827027 |
9bb16f893f1cd0be255902b01081ed96015dd1e0
| 3,084 |
js
|
JavaScript
|
src/components/app/mock.js
|
fernandocamargo/recipositori.es
|
f3cf45c166a13536fcfe1184e3ae99a0abc9f795
|
[
"Apache-2.0"
] | null | null | null |
src/components/app/mock.js
|
fernandocamargo/recipositori.es
|
f3cf45c166a13536fcfe1184e3ae99a0abc9f795
|
[
"Apache-2.0"
] | null | null | null |
src/components/app/mock.js
|
fernandocamargo/recipositori.es
|
f3cf45c166a13536fcfe1184e3ae99a0abc9f795
|
[
"Apache-2.0"
] | null | null | null |
export const coordinates = [
{
id: 'azeite',
label: 'Azeite de oliva',
src: '/assets/image/trash/ingredient/01.png',
},
{
id: 'manteiga',
label: 'Manteiga',
src: '/assets/image/trash/ingredient/02.png',
},
{
id: 'cebola',
label: 'Cebola',
src: '/assets/image/trash/ingredient/03.jpg',
},
{
id: 'champignons',
label: 'Champignons',
src: '/assets/image/trash/ingredient/04.webp',
},
{
dimensions: [{ amount: 600, unit: 'gr' }],
id: 'alcatra',
label: 'Alcatra',
src: '/assets/image/trash/ingredient/05.webp',
},
{
id: 'peperoncino',
label: 'Peperoncino',
src: '/assets/image/trash/ingredient/06.jpg',
},
{
id: 'conhaque',
label: 'Conhaque',
src: '/assets/image/trash/ingredient/07.jpg',
},
{
id: 'louro',
label: 'Louro',
src: '/assets/image/trash/ingredient/08.webp',
},
{
id: 'tomilho',
label: 'Tomilho',
src: '/assets/image/trash/ingredient/09.png',
},
{
id: 'alho',
label: 'Alho',
src: '/assets/image/trash/ingredient/10.jpg',
},
{
id: 'mostarda',
label: 'Mostarda Dijon',
src: '/assets/image/trash/ingredient/11.jpg',
},
{
id: 'creme-de-leite',
label: 'Creme de leite',
src: '/assets/image/trash/ingredient/12.webp',
},
{
id: 'salsinha',
label: 'Salsinha',
src: '/assets/image/trash/ingredient/13.jpg',
},
{
id: 'sal-e-pimenta',
label: 'Sal e pimenta',
src: '/assets/image/trash/ingredient/14.jpg',
},
{
id: 1,
label: 'Limpar',
thread: ['alcatra'],
src: '/assets/image/trash/procedures/',
},
{
id: 2,
label: 'Cortar em cubos',
thread: ['alcatra'],
src: '/assets/image/trash/procedures/',
},
{
id: 3,
label: 'Temperar',
thread: ['alcatra', 'sal-e-pimenta'],
src: '/assets/image/trash/procedures/',
},
];
export default [
{
label: 'Azeite de oliva',
src: '/assets/image/trash/ingredient/01.png',
},
{
label: 'Manteiga',
src: '/assets/image/trash/ingredient/02.png',
},
{
label: 'Cebola',
src: '/assets/image/trash/ingredient/03.jpg',
},
{
label: 'Champignons',
src: '/assets/image/trash/ingredient/04.webp',
},
{
label: 'Alcatra',
src: '/assets/image/trash/ingredient/05.webp',
},
{
label: 'Peperoncino',
src: '/assets/image/trash/ingredient/06.jpg',
},
{
label: 'Conhaque',
src: '/assets/image/trash/ingredient/07.jpg',
},
{
label: 'Louro',
src: '/assets/image/trash/ingredient/08.webp',
},
{
label: 'Tomilho',
src: '/assets/image/trash/ingredient/09.png',
},
{
label: 'Alho',
src: '/assets/image/trash/ingredient/10.jpg',
},
{
label: 'Mostarda Dijon',
src: '/assets/image/trash/ingredient/11.jpg',
},
{
label: 'Creme de leite',
src: '/assets/image/trash/ingredient/12.webp',
},
{
label: 'Salsinha',
src: '/assets/image/trash/ingredient/13.jpg',
},
{
label: 'Sal e pimenta',
src: '/assets/image/trash/ingredient/14.jpg',
},
];
| 20.423841 | 50 | 0.562905 |
bcd1c88221aff375bdc09950e02f3f770f4c2daf
| 26,918 |
js
|
JavaScript
|
dev/sheetdb.js
|
classroomtechtools/managebac_openapply_gsuite
|
e5d0d4ba839ab2d5b7e3f4f265ef170d73279e1b
|
[
"MIT"
] | 2 |
2019-05-14T03:56:58.000Z
|
2022-02-16T20:08:01.000Z
|
dev/sheetdb.js
|
classroomtechtools/managebac_openapply_gsuite
|
e5d0d4ba839ab2d5b7e3f4f265ef170d73279e1b
|
[
"MIT"
] | null | null | null |
dev/sheetdb.js
|
classroomtechtools/managebac_openapply_gsuite
|
e5d0d4ba839ab2d5b7e3f4f265ef170d73279e1b
|
[
"MIT"
] | null | null | null |
/*
Wrapper for advanced sheets api that provides us common database operations
*/
'use strict';
/*
Build upon the globalContext (passed as this below) to define all our variables in the "app" variable
We'll have all the virtualized stuff there in the local stack (thus, name conflicts are still possible)
*/
(function(globalContext) {
/*
Tranpose an array, if element isn't present, it'll be undefined
https://stackoverflow.com/questions/4492678/swap-rows-with-columns-transposition-of-a-matrix-in-javascript
*/
function transpose(a) {
return Object.keys(a[0]).map(function(c) {
return a.map(function(r) { return r[c]; });
});
}
/*
Convert column number (0-indexed) into spreadsheets
*/
function zeroIndexedToColumnName(n) {
var ordA = 'A'.charCodeAt(0);
var ordZ = 'Z'.charCodeAt(0);
var len = ordZ - ordA + 1;
var s = "";
while(n >= 0) {
s = String.fromCharCode(n % len + ordA) + s;
n = Math.floor(n / len) - 1;
}
return s;
}
/*
Define a block of code that executes code on entry to that block, and on exit
Even if there is an error (although that behavior can be overwritten)
*/
var contextManager = function () {
function _parseOptions(opt) {
var ret = {};
ret.enter = opt.enter || function () { return null; };
ret.exit = opt.exit || function (arg) {};
ret.params = opt.params || [];
if (!Array.isArray(ret.params)) throw new TypeError("options.params must be an array");
ret.onError = opt.onError || function () {};
return ret;
}
if (arguments.length == 1) {
var options = _parseOptions(arguments[0]);
return function (body) {
var ret = options.enter.apply(null, options.params);
try {
ret = body(ret) || ret;
} catch (err) {
if (options.onError(err, ret) !== null)
if (typeof err === 'string')
throw new Error(err);
else
throw new err.constructor(err.message + ' --> ' + (err.stack ? err.stack.toString(): ''));
} finally {
options.exit(ret);
}
return ret;
};
} else if (arguments.length == 2) {
var bodies = arguments[0],
options = _parseOptions(arguments[1]);
options = _parseOptions(options);
if (!Array.isArray(bodies))
bodies = [bodies];
for (var i = 0; i < bodies.length; i++) {
var body = bodies[i];
var ret = options.enter.apply(null, options.params);
try {
ret = body(ret) || ret;
} catch (err) {
if (options.onError(err, ret) !== null)
throw new err.constructor(err.message + ' --> ' + err.stack.toString());
} finally {
options.exit(ret);
}
}
} else {
throw new Error("Pass either one or two arguments");
}
return ret;
};
/*
Formatter
https://gist.github.com/brainysmurf/b4394974047428edccef27b2abcc4fb3
*/
// ValueError :: String -> Error
var ValueError = function(message) {
var err = new Error(message);
err.name = 'ValueError';
return err;
};
// defaultTo :: a,a? -> a
var defaultTo = function(x, y) {
return y == null ? x : y;
};
// create :: Object -> String,*... -> String
var create = function(transformers) {
return function(template) {
var args = Array.prototype.slice.call(arguments, 1);
var idx = 0;
var state = 'UNDEFINED';
return template.replace(
/([{}])\1|[{](.*?)(?:!(.+?))?[}]/g,
function(match, literal, key, xf) {
if (literal != null) {
return literal;
}
if (key.length > 0) {
if (state === 'IMPLICIT') {
throw ValueError('cannot switch from ' +
'implicit to explicit numbering');
}
state = 'EXPLICIT';
} else {
if (state === 'EXPLICIT') {
throw ValueError('cannot switch from ' +
'explicit to implicit numbering');
}
state = 'IMPLICIT';
key = String(idx);
idx += 1;
}
var value = defaultTo('', lookup(args, key.split('.')));
if (xf == null) {
return value;
} else if (Object.prototype.hasOwnProperty.call(transformers, xf)) {
return transformers[xf](value);
} else {
throw ValueError('no transformer named "' + xf + '"');
}
}
);
};
};
var lookup = function(obj, path) {
if (!/^\d+$/.test(path[0])) {
path = ['0'].concat(path);
}
for (var idx = 0; idx < path.length; idx += 1) {
var key = path[idx];
obj = typeof obj[key] === 'function' ? obj[key]() : obj[key];
}
return obj;
};
// format :: String,*... -> String
var format = create({});
// format.create :: Object -> String,*... -> String
format.create = create;
// format.extend :: Object,Object -> ()
format.extend = function(prototype, transformers) {
var $format = create(transformers);
prototype.format = function() {
var args = Array.prototype.slice.call(arguments);
args.unshift(this);
return $format.apply(globalContext, args);
};
};
// Do not pollute the global namespace, seems like a bad idea
//global.format = format;
// ...instead we will polyfill the String.protype, but you may want to modify this
// for the use of transformers, see documentation for that
format.extend(String.prototype);
// END FORMATTER
/*
The private, main constructor
*/
var DBSheets_ = function (_ss) {
// Module pattern, returns an object with methods
// We use _methods to indicate private stuff
// defaults
_dimension = 'ROWS';
_keyHeaderRow = 0;
_destInfo = [];
_cachedSS = null;
/*
* Methods for simple interactions
*
*/
function _getCachedSS () {
//return Sheets.Spreadsheets.get(_getId());
if (!_cachedSS) {
_cachedSS = Sheets.Spreadsheets.get(_getId());
}
return _cachedSS;
}
/*
* _getId
* @return {String} The spreadsheet ID
*/
function _getId () {
return _ss.spreadsheetId;
}
/*
@param {Object} request Request object
@return {Object} Response object
*/
function _valuesBatchUpdate (request) {
return Sheets.Spreadsheets.Values.batchUpdate(request, _getId());
}
/*
@return effective values, otherwise empty [[]]
*/
function _getValues (range) {
var response = Sheets.Spreadsheets.Values.get(_getId(), range, {
majorDimension: _dimension,
valueRenderOption: "UNFORMATTED_VALUE"
});
return response.values || [[]];
}
/*
Clears to all values in the range
@return null
*/
function _clearRange (range) {
Logger.log('Clearing ' + range);
Sheets.Spreadsheets.Values.clear({}, _getId(), range);
}
/*
Clears the entire tab
*/
function _clearTab (tabTitle) {
var sheets = _getSheets();
var targetTab = null;
sheets.forEach(function (sheet) {
if (sheet.properties.title == tabTitle) {
targetTab = sheet;
}
});
if (targetTab) {
_clearRange(tabTitle + '!1:' + targetTab.properties.gridProperties.rowCount.toString());
}
}
/*
*/
String.prototype.to10 = function(base) {
var lvl = this.length - 1;
var val = (base || 0) + Math.pow(26, lvl) * (this[0].toUpperCase().charCodeAt() - 64 - (lvl ? 0 : 1));
return (this.length > 1) ? (this.substr(1, this.length - 1)).to10(val) : val;
}
function _a1notation2gridrange(a1notation) {
var data = a1notation.match(/(^.+)!(.+):(.+$)/);
if (data == null) {
// For cases when only the sheet name is returned
return {
sheetId: _getSheet(a1notation).properties.sheetId
}
}
var co1 = data[2].match(/(\D+)(\d+)/);
var co2 = data[3].match(/(\D+)(\d+)/);
var gridRange = {
sheetId: _getSheet(data[1]).properties.sheetId,
startRowIndex: co1 ? parseInt(co1[2], 10) - 1 : null,
endRowIndex: co2 ? parseInt(co2[2], 10) : null,
startColumnIndex: co1 ? co1[1].to10() : data[2].to10(),
endColumnIndex: co2 ? co2[1].to10(1) : data[3].to10(1),
};
if (gridRange.startRowIndex == null) delete gridRange.startRowIndex;
if (gridRange.endRowIndex == null) delete gridRange.endRowIndex;
return gridRange;
}
/*
@param {Number,String} sheet if number, returns the sheet at index
if name, return the sheet that has that name
@throws {Error} if sheet is not a number or not a string
@return {Object} returns the target sheet object
@TODO: Use network call to update
*/
function _getSheet(sheet) {
var ss = _getCachedSS();
if (typeof sheet == "number") return ss.sheets[sheet] || null;
if (typeof sheet == "string") {
var sheetName = sheet.split("!")[0]; // take out the
for (var i = 0; i < ss.sheets.length; i++) {
if (ss.sheets[i].properties.title == sheetName) return ss.sheets[i];
}
return null;
}
throw new Error("Passed in " + typeof sheet + " into _getSheet");
}
function _getSheets() {
return Sheets.Spreadsheets.get(_getId()).sheets;
}
/*
_toRange: Convenience function to convert variables into a A1Notation string
@return {String} Legal A1Notation
*/
function _toRange(title, left, right) {
if (title.indexOf(' ') !== -1)
title = "'" + title + "'";
if (typeof right === 'undefined')
return title + '!' + left.toString() + ':' + left.toString();
else
return title + '!' + left.toString() + ':' + right.toString();
}
/*
Makes frozen rows, add headers
*/
function _defineHeaders (sheet, headers) {
var sht = _getSheet(sheet);
var response = Sheets.Spreadsheets.batchUpdate({
requests: [
{
updateSheetProperties: {
properties: {
sheetId: sht.properties.id,
gridProperties: {
frozenRowCount: headers.length,
}
},
fields: 'gridProperties.frozenRowCount',
}
},
]
}, _getId());
this.inputValues(_toRange(sht.properties.title, 1, headers.length), headers);
this.setKeyHeadingRow(0);
}
function _getHeaders (sheet) {
var sht = _getSheet(sheet);
if (!sht) // may be either undefined or null
return [[]];
var numHeaders = sht.properties.gridProperties.frozenRowCount || 0;
if (numHeaders == 0)
return [[]];
return _getValues(_toRange(sht.properties.title, 1, numHeaders));
}
function _getRange ( ) {
var ss = SpreadsheetApp.openById(_getId());
return ss.getRange.apply(ss, arguments);
}
/*
Uses the sheet's headers and range values and converts them into the properties
@param {string} rangeA1Notation The range string
@returns {List[Object]}
*/
function _toObjects(rangeA1Notation) {
var headers = _getHeaders(rangeA1Notation);
var numHeaders = headers.length;
var headings = headers[_keyHeaderRow];
headers = transpose(headers); // transpose so we can refehence by column below
var values = _getValues(rangeA1Notation);
var range = _getRange(rangeA1Notation); // TODO: Shortcut method, could we do this manually?
var rowOffset = (range.getRow() - numHeaders - 1); // getRow returns the row number after the
var columnOffset = (range.getColumn() - 1);
var ret = [];
var co, header, obj;
// Loop through the values
// We need to use headings.length in nested loop to ensure that
// every column
for (var r = 0; r < values.length; r++) {
ro = r + rowOffset;
obj = {};
for (var c = 0; c < headings.length; c++) {
co = c + columnOffset;
heading = headings[co];
obj[heading] = {
value: values[r][c],
a1Notation: range.getSheet().getName() + '!' + range.offset(ro, co).getA1Notation(),
headers: headers[co],
column: co,
row: range.getRow() + r,
columnAsName: zeroIndexedToColumnName(co),
rowAsName: range.getRow().toString(),
};
}
obj.columns = {};
var i = 0;
for (key in obj) {
if (key === 'columns')
continue;
obj.columns[key] = zeroIndexedToColumnName(i) + (range.getRow() + r).toString();
i++;
}
ret.push(obj);
}
return ret;
}
_plugins = [];
_oncePlugins = [];
/*
Returned object
*/
return {
getId: _getId,
clearRange: _clearRange,
clearTab: _clearTab,
setDimensionAsColumns: function () {
_dimension = 'COLUMNS';
},
setDimensionAsRows: function () {
_dimension = 'ROWS';
},
/*
This determines which header row
*/
setKeyHeadingRow: function (value) {
_keyHeaderRow = value;
},
getHeaders: function (sheet) {
return _getHeaders(sheet);
},
/*
Light wrapper to spreadsheet app getRange function
*/
getRange: function () {
return _getRange.apply(null, arguments);
},
a1notation2gridrange: function (a1Notation) {
return _a1notation2gridrange(a1Notation);
},
registerPlugin: function (description, func) {
_plugins.push({description: description, func: func});
},
registerOncePlugin: function (description, func) {
_oncePlugins.push({description: description, func: func});
},
/*
Inserts a row depending on range specification
*/
insertRow: function (range, row) {
return Sheets.Spreadsheets.Values.append({
majorDimension: _dimension,
values: [row]
}, _getId(), range, {
valueInputOption: "USER_ENTERED",
insertDataOption: "INSERT_ROWS",
});
},
getPluginsOverwriteBuildRequests: function (rangeA1Notation) {
objs = _toObjects(rangeA1Notation); // convert to A1
var requests = [];
var utils = {
zeroIndexedToColumnName: zeroIndexedToColumnName,
objects: objs
};
// cycle through the plugins and build results array
_plugins.forEach(function (plugin) {
objs.forEach(function (obj) {
for (prop in obj) {
if (prop == 'columns')
continue;
var objValue = obj[prop];
if (plugin.description.entryPoint &&
objValue.headers[plugin.description.entryPoint.header - 1] == plugin.description.name) {
var newValue = plugin.func(objValue, utils);
if (typeof newValue === 'string') {
newValue = newValue.format(objValue); // overwrites
newValue = newValue.format(obj.columns);
}
requests.push({values: [[newValue]], a1Notation: objValue.a1Notation});
}
}
});
});
return requests;
},
overwriteWithPlugins: function (rangeA1Notation) {
var requests = this.getPluginsOverwriteBuildRequests(rangeA1Notation);
// Add value requests from results and allow the sheet to update
this.withRequestBuilder(function (rb) {
requests.forEach(function (item) {
rb.addValueRequest(rb.utils.valuesRequest(item.values, item.a1Notation));
});
});
},
/*
Calls batchUpdate with "USER_ENTERED"
@return response
*/
inputValues: function (rangeNotation, values) {
var request = {
valueInputOption: 'USER_ENTERED',
data: [
{
range: rangeNotation,
majorDimension: _dimension,
values: values
}
]
};
return _valuesBatchUpdate(request);
},
getEffectiveValues: function (range) {
return _getValues(range);
},
getColumnValues: function (range, column) {
saved = _dimension;
this.setDimensionAsColumns();
var values = _getValues(range);
_dimension = saved;
return values[column].slice();
},
addSheets: function (sheets) {
//Logger.log(_ss.sheets);
},
getSheets: function () {
return _getSheets();
},
defineHeaders: _defineHeaders,
getDestinationInfo: function () { return _destInfo; },
setDestinationForForm: function (formCreationFunc) {
var before = [];
//
var ctx = contextManager({
enter: function (form) {
_getSheets().forEach(function (b) {
var id = b.properties.sheetId;
before.push(id);
});
return form;
},
exit: function (form) {
if (typeof form === 'undefined') {
_destInfo.push({id: null, sheetId: null, error: "Did not pas form into exit"});
return;
}
form.setDestination(FormApp.DestinationType.SPREADSHEET, _getId());
var after = null;
_getSheets().forEach(function (a) {
if (before.indexOf(a.properties.sheetId) === -1) {
after = a;
}
});
if (after == null) {
_destInfo.push({id: null, sheetId:null, error: "Could not detect after creation."});
} else {
_destInfo.push({id: _getId(), sheet: after, sheetId: after.properties.sheetId, index: after.properties.index, error: false});
}
},
});
ctx(formCreationFunc);
return _destInfo;
},
/*
Chainable convenience methods that builds request objects for execution upon completion
*/
withRequestBuilder: contextManager({
enter: function (obj) {
obj.preSSRequests = [];
obj.sRequests = [];
obj.postSSRequests = [];
return obj;
},
exit: function (obj) {
if (obj.preSSRequests.length > 0) {
Sheets.Spreadsheets.batchUpdate({requests:obj.preSSRequests}, _getId()); // TODO: What about "empty response" error
}
if (obj.sRequests.length > 0) {
if (obj._tabsAutoClear) {
var allSheets = obj.sRequests.reduce(function (acc, item) {
acc.push(item.range.match(/(.*)!/)[1]);
return acc;
}, []);
allSheets.filter(function (i, p, a) {
return a.indexOf(i) == p;
}).forEach(function (sheetName) {
_clearTab(sheetName); // use the
});
}
Logger.log('Update values: ' + obj.sRequests.range + ' -> ' + obj.sRequests.values);
Sheets.Spreadsheets.Values.batchUpdate({
valueInputOption: "USER_ENTERED",
data: obj.sRequests
}, _getId());
}
if (obj.postSSRequests.length > 0) {
Sheets.Spreadsheets.batchUpdate({requests:obj.postSSRequests}, _getId()); // TODO: What about "empty response" error
}
},
params: [{
_valuesSortBy: null,
preSSRequests: [],
sRequests: [],
postSSRequests: [],
_tabsAutoClear: false,
tabsAutoClear: function () {
this._tabsAutoClear = true;
Logger.log(this._tabsAutoClear);
},
setValuesSortByIndex: function (sortBy) {
this._valuesSortBy = sortBy;
},
addValueRequest: function (request) {
Logger.log(request.range + ' -> ' + request.values);
this.sRequests.push(request);
return this;
},
addPropertyRequest: function (request) {
this.preSSRequests.push(request);
return this;
},
addSheetPropertyRequest: function (request) {
this.preSSRequests.push(request);
return this;
},
addSheetRequest: function (request) {
this.preSSRequests.push(request);
return this;
},
addSortRangeRequest: function (request) {
this.postSSRequests.push(request);
return this;
},
utils: {
toRange: function (title, left, right) {
if (title.indexOf(' ') !== -1)
title = "'" + title + "'";
if (typeof right === 'undefined')
return title + '!' + left.toString() + ':' + left.toString();
else
return title + '!' + left.toString() + ':' + right.toString();
},
valuesRequestFromRange: function (values, title, left, right) {
return {
majorDimension: _dimension,
range: this.toRange(title, left, right),
values: values
}
},
valuesRequest: function (values, rangeA1Notation, _dim) {
return {
majorDimension: _dim || _dimension,
range: rangeA1Notation,
values: values
}
},
columnCountRequest: function (id, numCols) {
return {
updateSheetProperties: {
properties: {
sheetId: id,
gridProperties: {
columnCount: numCols,
}
},
fields: 'gridProperties.columnCount',
}
};
},
hideGridlinesRequest: function (id, bool) {
return {
updateSheetProperties: {
properties: {
sheetId: id,
gridProperties: {
hideGridlines: bool,
}
},
fields: 'gridProperties.hideGridlines',
}
};
},
rowCountRequest: function (id, numRows) {
return {
updateSheetProperties: {
properties: {
sheetId: id,
gridProperties: {
rowCount: numRows,
}
},
fields: 'gridProperties.rowCount',
}
};
},
frozenRowsRequest: function (id, numRows) {
var sheet = _getSheet(id);
return {
updateSheetProperties: {
properties: {
sheetId: sheet.properties.sheetId,
gridProperties: {
frozenRowCount: numRows,
}
},
fields: 'gridProperties.frozenRowCount',
}
};
},
frozenColumnsRequest: function (id, numCols) {
return {
updateSheetProperties: {
properties: {
sheetId: id,
gridProperties: {
frozenColumnCount: numCols,
}
},
fields: 'gridProperties.frozenColumnCount',
}
};
},
tabColorRequest: function (id, red, green, blue, alpha) {
if (typeof alpha === 'undefined')
alpha = 1;
return {
updateSheetProperties: {
properties: {
sheetId: id,
tabColor: {
red: red,
green: green,
blue: blue,
alpha: alpha
}
},
fields: 'tabColor',
}
};
},
newTabRequest: function (title) {
return {
addSheet: {
properties: {
title: title
}
},
}
},
tabTitleRequest: function (id, title) {
return {
updateSheetProperties: {
properties: {
sheetId: id,
title: title
},
fields: 'title',
},
}
},
sortRequest: function (range, dimensionIndex, sortOrder) {
return {
sortRange: {
range: _a1notation2gridrange(range),
sortSpecs: {
dimensionIndex: dimensionIndex || 0,
sortOrder: sortOrder || 'ASCENDING',
}
}
}
},
},
}],
})
}; // return
}; // DBSheets()
// ENTRY POINT
globalContext.DBSheets = function (_spreadsheetID) {
_spreadsheetID = _spreadsheetID || SpreadsheetApp.getActiveSpreadsheet().getId();
return DBSheets.fromId(_spreadsheetID);
};
// CONSTRUCTORS:
DBSheets.fromId = function (id) {
return DBSheets_(Sheets.Spreadsheets.get(id));
};
DBSheets.fromRange = function (range) {
var ss = range.getSheet().getParent();
return DBSheets.fromId(ss.getId());
};
DBSheets.createWithTitle = function (title) {
var resource = {properties: {title: title}};
return DBSheets_(Sheets.Spreadsheets.create(resource));
};
DBSheets.createWithProperties = function (resource) {
return DBSheets_(Sheets.Spreadsheets.create(resource));
};
})(this);
| 30.833906 | 139 | 0.506984 |
7fc1931ea10d12569d9def39e0baa88b96ad9546
| 1,749 |
rs
|
Rust
|
src/l2r/market/mean.rs
|
isabella232/Evokit
|
54c21ff318b623a9c1ac168a2323ab2fdb4598cf
|
[
"Apache-2.0"
] | 60 |
2020-03-10T22:59:02.000Z
|
2021-07-16T16:44:23.000Z
|
src/l2r/market/mean.rs
|
etsy/Evokit
|
54c21ff318b623a9c1ac168a2323ab2fdb4598cf
|
[
"Apache-2.0"
] | 1 |
2021-04-05T09:47:44.000Z
|
2021-04-05T09:47:44.000Z
|
src/l2r/market/mean.rs
|
isabella232/Evokit
|
54c21ff318b623a9c1ac168a2323ab2fdb4598cf
|
[
"Apache-2.0"
] | 6 |
2020-03-13T00:27:54.000Z
|
2021-04-05T09:47:26.000Z
|
use crate::l2r::market::utils::*;
/// Indicator for computing the mean
pub struct MeanIndicator {
/// name of the indicator. Also the query-level scorer to use
name: String,
/// Value to scale the score by
scale: Option<f32>,
}
impl MeanIndicator {
/// Returns a new MeanIndicator
pub fn new(name: &str, scale: Option<f32>) -> Self {
MeanIndicator {
name: name.into(),
scale,
}
}
}
impl Indicator for MeanIndicator {
/// Computes the mean across all the requests. Scales if asked.
fn evaluate(&self, metrics: &Vec<&Metrics>) -> f32 {
let mut s = 0.0;
for m in metrics.iter() {
s += m.read_num(&self.name);
}
// Optional scale. Allows the score to be between [0,1]
s / (metrics.len() as f32) * self.scale.unwrap_or(1.)
}
/// Name of indicator
fn name(&self) -> &str {
&self.name
}
}
#[cfg(test)]
mod tests {
use super::*;
use std::collections::HashMap;
#[test]
fn test_mean() {
let mapping1: HashMap<String, f32> = [("avg-price-1".to_string(), 1000.0)]
.iter()
.cloned()
.collect();
let metric1: Metrics = mapping1.into();
let mapping2: HashMap<String, f32> = [("avg-price-1".to_string(), 20.0)]
.iter()
.cloned()
.collect();
let metric2: Metrics = mapping2.into();
let metrics: Vec<&Metrics> = vec![&metric1, &metric2];
let empty_vector: Vec<&Metrics> = vec![];
let indicator = MeanIndicator::new("avg-price-1", None);
assert_eq!(indicator.evaluate(&metrics), 510.0);
assert!(indicator.evaluate(&empty_vector).is_nan());
}
}
| 27.328125 | 82 | 0.554603 |
3ea25d0b3b507fb8f5885d1cbcd0716b22cc82dc
| 44,756 |
h
|
C
|
Include/10.0.19041.0/shared/hidusage.h
|
sezero/windows-sdk-headers
|
e8e9d4d50769ded01a2df905c6bf4355eb3fa8b5
|
[
"MIT"
] | 5 |
2020-05-29T06:22:17.000Z
|
2021-11-28T08:21:38.000Z
|
Include/10.0.19041.0/shared/hidusage.h
|
sezero/windows-sdk-headers
|
e8e9d4d50769ded01a2df905c6bf4355eb3fa8b5
|
[
"MIT"
] | null | null | null |
Include/10.0.19041.0/shared/hidusage.h
|
sezero/windows-sdk-headers
|
e8e9d4d50769ded01a2df905c6bf4355eb3fa8b5
|
[
"MIT"
] | 5 |
2020-05-30T04:15:11.000Z
|
2021-11-28T08:48:56.000Z
|
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
HIDUSAGE.H
Abstract:
Public Definitions of HID USAGES.
Environment:
Kernel & user mode
--*/
#ifndef __HIDUSAGE_H__
#define __HIDUSAGE_H__
#include <winapifamily.h>
#pragma region Desktop Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
//
// Usage Pages
//
typedef USHORT USAGE, *PUSAGE;
#define HID_USAGE_PAGE_UNDEFINED ((USAGE) 0x00)
#define HID_USAGE_PAGE_GENERIC ((USAGE) 0x01)
#define HID_USAGE_PAGE_SIMULATION ((USAGE) 0x02)
#define HID_USAGE_PAGE_VR ((USAGE) 0x03)
#define HID_USAGE_PAGE_SPORT ((USAGE) 0x04)
#define HID_USAGE_PAGE_GAME ((USAGE) 0x05)
#define HID_USAGE_PAGE_GENERIC_DEVICE ((USAGE) 0x06)
#define HID_USAGE_PAGE_KEYBOARD ((USAGE) 0x07)
#define HID_USAGE_PAGE_LED ((USAGE) 0x08)
#define HID_USAGE_PAGE_BUTTON ((USAGE) 0x09)
#define HID_USAGE_PAGE_ORDINAL ((USAGE) 0x0A)
#define HID_USAGE_PAGE_TELEPHONY ((USAGE) 0x0B)
#define HID_USAGE_PAGE_CONSUMER ((USAGE) 0x0C)
#define HID_USAGE_PAGE_DIGITIZER ((USAGE) 0x0D)
#define HID_USAGE_PAGE_HAPTICS ((USAGE) 0x0E)
#define HID_USAGE_PAGE_PID ((USAGE) 0x0F)
#define HID_USAGE_PAGE_UNICODE ((USAGE) 0x10)
#define HID_USAGE_PAGE_ALPHANUMERIC ((USAGE) 0x14)
#define HID_USAGE_PAGE_SENSOR ((USAGE) 0x20)
#define HID_USAGE_PAGE_LIGHTING_ILLUMINATION ((USAGE) 0x59)
#define HID_USAGE_PAGE_BARCODE_SCANNER ((USAGE) 0x8C)
#define HID_USAGE_PAGE_WEIGHING_DEVICE ((USAGE) 0x8D)
#define HID_USAGE_PAGE_MAGNETIC_STRIPE_READER ((USAGE) 0x8E)
#define HID_USAGE_PAGE_CAMERA_CONTROL ((USAGE) 0x90)
#define HID_USAGE_PAGE_ARCADE ((USAGE) 0x91)
#define HID_USAGE_PAGE_MICROSOFT_BLUETOOTH_HANDSFREE ((USAGE) 0xFFF3)
#define HID_USAGE_PAGE_VENDOR_DEFINED_BEGIN ((USAGE) 0xFF00)
#define HID_USAGE_PAGE_VENDOR_DEFINED_END ((USAGE) 0xFFFF)
//
// Generic Desktop Page (0x01)
//
#define HID_USAGE_GENERIC_POINTER ((USAGE) 0x01)
#define HID_USAGE_GENERIC_MOUSE ((USAGE) 0x02)
#define HID_USAGE_GENERIC_JOYSTICK ((USAGE) 0x04)
#define HID_USAGE_GENERIC_GAMEPAD ((USAGE) 0x05)
#define HID_USAGE_GENERIC_KEYBOARD ((USAGE) 0x06)
#define HID_USAGE_GENERIC_KEYPAD ((USAGE) 0x07)
#define HID_USAGE_GENERIC_MULTI_AXIS_CONTROLLER ((USAGE) 0x08)
#define HID_USAGE_GENERIC_TABLET_PC_SYSTEM_CTL ((USAGE) 0x09)
#define HID_USAGE_GENERIC_PORTABLE_DEVICE_CONTROL ((USAGE) 0x0D)
#define HID_USAGE_GENERIC_INTERACTIVE_CONTROL ((USAGE) 0x0E)
#define HID_USAGE_GENERIC_COUNTED_BUFFER ((USAGE) 0x3A)
#define HID_USAGE_GENERIC_SYSTEM_CTL ((USAGE) 0x80)
#define HID_USAGE_GENERIC_X ((USAGE) 0x30)
#define HID_USAGE_GENERIC_Y ((USAGE) 0x31)
#define HID_USAGE_GENERIC_Z ((USAGE) 0x32)
#define HID_USAGE_GENERIC_RX ((USAGE) 0x33)
#define HID_USAGE_GENERIC_RY ((USAGE) 0x34)
#define HID_USAGE_GENERIC_RZ ((USAGE) 0x35)
#define HID_USAGE_GENERIC_SLIDER ((USAGE) 0x36)
#define HID_USAGE_GENERIC_DIAL ((USAGE) 0x37)
#define HID_USAGE_GENERIC_WHEEL ((USAGE) 0x38)
#define HID_USAGE_GENERIC_HATSWITCH ((USAGE) 0x39)
#define HID_USAGE_GENERIC_COUNTED_BUFFER ((USAGE) 0x3A)
#define HID_USAGE_GENERIC_BYTE_COUNT ((USAGE) 0x3B)
#define HID_USAGE_GENERIC_MOTION_WAKEUP ((USAGE) 0x3C)
#define HID_USAGE_GENERIC_START ((USAGE) 0x3D)
#define HID_USAGE_GENERIC_SELECT ((USAGE) 0x3E)
#define HID_USAGE_GENERIC_VX ((USAGE) 0x40)
#define HID_USAGE_GENERIC_VY ((USAGE) 0x41)
#define HID_USAGE_GENERIC_VZ ((USAGE) 0x42)
#define HID_USAGE_GENERIC_VBRX ((USAGE) 0x43)
#define HID_USAGE_GENERIC_VBRY ((USAGE) 0x44)
#define HID_USAGE_GENERIC_VBRZ ((USAGE) 0x45)
#define HID_USAGE_GENERIC_VNO ((USAGE) 0x46)
#define HID_USAGE_GENERIC_FEATURE_NOTIFICATION ((USAGE) 0x47)
#define HID_USAGE_GENERIC_RESOLUTION_MULTIPLIER ((USAGE) 0x48)
#define HID_USAGE_GENERIC_SYSCTL_POWER ((USAGE) 0x81)
#define HID_USAGE_GENERIC_SYSCTL_SLEEP ((USAGE) 0x82)
#define HID_USAGE_GENERIC_SYSCTL_WAKE ((USAGE) 0x83)
#define HID_USAGE_GENERIC_SYSCTL_CONTEXT_MENU ((USAGE) 0x84)
#define HID_USAGE_GENERIC_SYSCTL_MAIN_MENU ((USAGE) 0x85)
#define HID_USAGE_GENERIC_SYSCTL_APP_MENU ((USAGE) 0x86)
#define HID_USAGE_GENERIC_SYSCTL_HELP_MENU ((USAGE) 0x87)
#define HID_USAGE_GENERIC_SYSCTL_MENU_EXIT ((USAGE) 0x88)
#define HID_USAGE_GENERIC_SYSCTL_MENU_SELECT ((USAGE) 0x89)
#define HID_USAGE_GENERIC_SYSCTL_MENU_RIGHT ((USAGE) 0x8A)
#define HID_USAGE_GENERIC_SYSCTL_MENU_LEFT ((USAGE) 0x8B)
#define HID_USAGE_GENERIC_SYSCTL_MENU_UP ((USAGE) 0x8C)
#define HID_USAGE_GENERIC_SYSCTL_MENU_DOWN ((USAGE) 0x8D)
#define HID_USAGE_GENERIC_SYSCTL_COLD_RESTART ((USAGE) 0x8E)
#define HID_USAGE_GENERIC_SYSCTL_WARM_RESTART ((USAGE) 0x8F)
#define HID_USAGE_GENERIC_DPAD_UP ((USAGE) 0x90)
#define HID_USAGE_GENERIC_DPAD_DOWN ((USAGE) 0x91)
#define HID_USAGE_GENERIC_DPAD_RIGHT ((USAGE) 0x92)
#define HID_USAGE_GENERIC_DPAD_LEFT ((USAGE) 0x93)
#define HID_USAGE_GENERIC_SYSCTL_FN ((USAGE) 0x97)
#define HID_USAGE_GENERIC_SYSCTL_FN_LOCK ((USAGE) 0x98)
#define HID_USAGE_GENERIC_SYSCTL_FN_LOCK_INDICATOR ((USAGE) 0x99)
#define HID_USAGE_GENERIC_SYSCTL_DISMISS_NOTIFICATION ((USAGE) 0x9A)
#define HID_USAGE_GENERIC_SYSCTL_DOCK ((USAGE) 0xA0)
#define HID_USAGE_GENERIC_SYSCTL_UNDOCK ((USAGE) 0xA1)
#define HID_USAGE_GENERIC_SYSCTL_SETUP ((USAGE) 0xA2)
#define HID_USAGE_GENERIC_SYSCTL_SYS_BREAK ((USAGE) 0xA3)
#define HID_USAGE_GENERIC_SYSCTL_SYS_DBG_BREAK ((USAGE) 0xA4)
#define HID_USAGE_GENERIC_SYSCTL_APP_BREAK ((USAGE) 0xA5)
#define HID_USAGE_GENERIC_SYSCTL_APP_DBG_BREAK ((USAGE) 0xA6)
#define HID_USAGE_GENERIC_SYSCTL_MUTE ((USAGE) 0xA7)
#define HID_USAGE_GENERIC_SYSCTL_HIBERNATE ((USAGE) 0xA8)
#define HID_USAGE_GENERIC_SYSCTL_DISP_INVERT ((USAGE) 0xB0)
#define HID_USAGE_GENERIC_SYSCTL_DISP_INTERNAL ((USAGE) 0xB1)
#define HID_USAGE_GENERIC_SYSCTL_DISP_EXTERNAL ((USAGE) 0xB2)
#define HID_USAGE_GENERIC_SYSCTL_DISP_BOTH ((USAGE) 0xB3)
#define HID_USAGE_GENERIC_SYSCTL_DISP_DUAL ((USAGE) 0xB4)
#define HID_USAGE_GENERIC_SYSCTL_DISP_TOGGLE ((USAGE) 0xB5)
#define HID_USAGE_GENERIC_SYSCTL_DISP_SWAP ((USAGE) 0xB6)
#define HID_USAGE_GENERIC_SYSCTL_DISP_AUTOSCALE ((USAGE) 0xB7)
#define HID_USAGE_GENERIC_SYSTEM_DISPLAY_ROTATION_LOCK_BUTTON ((USAGE) 0xC9)
#define HID_USAGE_GENERIC_SYSTEM_DISPLAY_ROTATION_LOCK_SLIDER_SWITCH ((USAGE) 0xCA)
#define HID_USAGE_GENERIC_CONTROL_ENABLE ((USAGE) 0xCB)
//
// Simulation Controls Page (0x02)
//
#define HID_USAGE_SIMULATION_FLIGHT_SIMULATION_DEVICE ((USAGE) 0x01)
#define HID_USAGE_SIMULATION_AUTOMOBILE_SIMULATION_DEVICE ((USAGE) 0x02)
#define HID_USAGE_SIMULATION_TANK_SIMULATION_DEVICE ((USAGE) 0x03)
#define HID_USAGE_SIMULATION_SPACESHIP_SIMULATION_DEVICE ((USAGE) 0x04)
#define HID_USAGE_SIMULATION_SUBMARINE_SIMULATION_DEVICE ((USAGE) 0x05)
#define HID_USAGE_SIMULATION_SAILING_SIMULATION_DEVICE ((USAGE) 0x06)
#define HID_USAGE_SIMULATION_MOTORCYCLE_SIMULATION_DEVICE ((USAGE) 0x07)
#define HID_USAGE_SIMULATION_SPORTS_SIMULATION_DEVICE ((USAGE) 0x08)
#define HID_USAGE_SIMULATION_AIRPLANE_SIMULATION_DEVICE ((USAGE) 0x09)
#define HID_USAGE_SIMULATION_HELICOPTER_SIMULATION_DEVICE ((USAGE) 0x0A)
#define HID_USAGE_SIMULATION_MAGIC_CARPET_SIMULATION_DEVICE ((USAGE) 0x0B)
#define HID_USAGE_SIMULATION_BICYCLE_SIMULATION_DEVICE ((USAGE) 0x0C)
#define HID_USAGE_SIMULATION_FLIGHT_CONTROL_STICK ((USAGE) 0x20)
#define HID_USAGE_SIMULATION_FLIGHT_STICK ((USAGE) 0x21)
#define HID_USAGE_SIMULATION_CYCLIC_CONTROL ((USAGE) 0x22)
#define HID_USAGE_SIMULATION_CYCLIC_TRIM ((USAGE) 0x23)
#define HID_USAGE_SIMULATION_FLIGHT_YOKE ((USAGE) 0x24)
#define HID_USAGE_SIMULATION_TRACK_CONTROL ((USAGE) 0x25)
#define HID_USAGE_SIMULATION_AILERON ((USAGE) 0xB0)
#define HID_USAGE_SIMULATION_AILERON_TRIM ((USAGE) 0xB1)
#define HID_USAGE_SIMULATION_ANTI_TORQUE_CONTROL ((USAGE) 0xB2)
#define HID_USAGE_SIMULATION_AUTOPIOLOT_ENABLE ((USAGE) 0xB3)
#define HID_USAGE_SIMULATION_CHAFF_RELEASE ((USAGE) 0xB4)
#define HID_USAGE_SIMULATION_COLLECTIVE_CONTROL ((USAGE) 0xB5)
#define HID_USAGE_SIMULATION_DIVE_BRAKE ((USAGE) 0xB6)
#define HID_USAGE_SIMULATION_ELECTRONIC_COUNTERMEASURES ((USAGE) 0xB7)
#define HID_USAGE_SIMULATION_ELEVATOR ((USAGE) 0xB8)
#define HID_USAGE_SIMULATION_ELEVATOR_TRIM ((USAGE) 0xB9)
#define HID_USAGE_SIMULATION_RUDDER ((USAGE) 0xBA)
#define HID_USAGE_SIMULATION_THROTTLE ((USAGE) 0xBB)
#define HID_USAGE_SIMULATION_FLIGHT_COMMUNICATIONS ((USAGE) 0xBC)
#define HID_USAGE_SIMULATION_FLARE_RELEASE ((USAGE) 0xBD)
#define HID_USAGE_SIMULATION_LANDING_GEAR ((USAGE) 0xBE)
#define HID_USAGE_SIMULATION_TOE_BRAKE ((USAGE) 0xBF)
#define HID_USAGE_SIMULATION_TRIGGER ((USAGE) 0xC0)
#define HID_USAGE_SIMULATION_WEAPONS_ARM ((USAGE) 0xC1)
#define HID_USAGE_SIMULATION_WEAPONS_SELECT ((USAGE) 0xC2)
#define HID_USAGE_SIMULATION_WING_FLAPS ((USAGE) 0xC3)
#define HID_USAGE_SIMULATION_ACCELLERATOR ((USAGE) 0xC4)
#define HID_USAGE_SIMULATION_BRAKE ((USAGE) 0xC5)
#define HID_USAGE_SIMULATION_CLUTCH ((USAGE) 0xC6)
#define HID_USAGE_SIMULATION_SHIFTER ((USAGE) 0xC7)
#define HID_USAGE_SIMULATION_STEERING ((USAGE) 0xC8)
#define HID_USAGE_SIMULATION_TURRET_DIRECTION ((USAGE) 0xC9)
#define HID_USAGE_SIMULATION_BARREL_ELEVATION ((USAGE) 0xCA)
#define HID_USAGE_SIMULATION_DIVE_PLANE ((USAGE) 0xCB)
#define HID_USAGE_SIMULATION_BALLAST ((USAGE) 0xCC)
#define HID_USAGE_SIMULATION_BICYCLE_CRANK ((USAGE) 0xCD)
#define HID_USAGE_SIMULATION_HANDLE_BARS ((USAGE) 0xCE)
#define HID_USAGE_SIMULATION_FRONT_BRAKE ((USAGE) 0xCF)
#define HID_USAGE_SIMULATION_REAR_BRAKE ((USAGE) 0xD0)
//
// Virtual Reality Controls Page (0x03)
//
#define HID_USAGE_VR_BELT ((USAGE) 0x01)
#define HID_USAGE_VR_BODY_SUIT ((USAGE) 0x02)
#define HID_USAGE_VR_FLEXOR ((USAGE) 0x03)
#define HID_USAGE_VR_GLOVE ((USAGE) 0x04)
#define HID_USAGE_VR_HEAD_TRACKER ((USAGE) 0x05)
#define HID_USAGE_VR_HEAD_MOUNTED_DISPLAY ((USAGE) 0x06)
#define HID_USAGE_VR_HAND_TRACKER ((USAGE) 0x07)
#define HID_USAGE_VR_OCULOMETER ((USAGE) 0x08)
#define HID_USAGE_VR_VEST ((USAGE) 0x09)
#define HID_USAGE_VR_ANIMATRONIC_DEVICE ((USAGE) 0x0A)
#define HID_USAGE_VR_STEREO_ENABLE ((USAGE) 0x20)
#define HID_USAGE_VR_DISPLAY_ENABLE ((USAGE) 0x21)
//
// Sport Controls Page (0x04)
//
#define HID_USAGE_SPORT_BASEBALL_BAT ((USAGE) 0x01)
#define HID_USAGE_SPORT_GOLF_CLUB ((USAGE) 0x02)
#define HID_USAGE_SPORT_ROWING_MACHINE ((USAGE) 0x03)
#define HID_USAGE_SPORT_TREADMILL ((USAGE) 0x04)
#define HID_USAGE_SPORT_STICK_TYPE ((USAGE) 0x38)
#define HID_USAGE_SPORT_OAR ((USAGE) 0x30)
#define HID_USAGE_SPORT_SLOPE ((USAGE) 0x31)
#define HID_USAGE_SPORT_RATE ((USAGE) 0x32)
#define HID_USAGE_SPORT_STICK_SPEED ((USAGE) 0x33)
#define HID_USAGE_SPORT_STICK_FACE_ANGLE ((USAGE) 0x34)
#define HID_USAGE_SPORT_HEEL_TOE ((USAGE) 0x35)
#define HID_USAGE_SPORT_FOLLOW_THROUGH ((USAGE) 0x36)
#define HID_USAGE_SPORT_TEMPO ((USAGE) 0x37)
#define HID_USAGE_SPORT_HEIGHT ((USAGE) 0x39)
#define HID_USAGE_SPORT_PUTTER ((USAGE) 0x50)
#define HID_USAGE_SPORT_1_IRON ((USAGE) 0x51)
#define HID_USAGE_SPORT_2_IRON ((USAGE) 0x52)
#define HID_USAGE_SPORT_3_IRON ((USAGE) 0x53)
#define HID_USAGE_SPORT_4_IRON ((USAGE) 0x54)
#define HID_USAGE_SPORT_5_IRON ((USAGE) 0x55)
#define HID_USAGE_SPORT_6_IRON ((USAGE) 0x56)
#define HID_USAGE_SPORT_7_IRON ((USAGE) 0x57)
#define HID_USAGE_SPORT_8_IRON ((USAGE) 0x58)
#define HID_USAGE_SPORT_9_IRON ((USAGE) 0x59)
#define HID_USAGE_SPORT_10_IRON ((USAGE) 0x5A)
#define HID_USAGE_SPORT_11_IRON ((USAGE) 0x5B)
#define HID_USAGE_SPORT_SAND_WEDGE ((USAGE) 0x5C)
#define HID_USAGE_SPORT_LOFT_WEDGE ((USAGE) 0x5D)
#define HID_USAGE_SPORT_POWER_WEDGE ((USAGE) 0x5E)
#define HID_USAGE_SPORT_1_WOOD ((USAGE) 0x5F)
#define HID_USAGE_SPORT_3_WOOD ((USAGE) 0x60)
#define HID_USAGE_SPORT_5_WOOD ((USAGE) 0x61)
#define HID_USAGE_SPORT_7_WOOD ((USAGE) 0x62)
#define HID_USAGE_SPORT_9_WOOD ((USAGE) 0x63)
//
// Game Controls Page (0x05)
//
#define HID_USAGE_GAME_3D_GAME_CONTROLLER ((USAGE) 0x01)
#define HID_USAGE_GAME_PINBALL_DEVICE ((USAGE) 0x02)
#define HID_USAGE_GAME_GUN_DEVICE ((USAGE) 0x03)
#define HID_USAGE_GAME_POINT_OF_VIEW ((USAGE) 0x20)
#define HID_USAGE_GAME_GUN_SELECTOR ((USAGE) 0x32)
#define HID_USAGE_GAME_GAMEPAD_FIRE_JUMP ((USAGE) 0x37)
#define HID_USAGE_GAME_GAMEPAD_TRIGGER ((USAGE) 0x39)
#define HID_USAGE_GAME_TURN_RIGHT_LEFT ((USAGE) 0x21)
#define HID_USAGE_GAME_PITCH_FORWARD_BACK ((USAGE) 0x22)
#define HID_USAGE_GAME_ROLL_RIGHT_LEFT ((USAGE) 0x23)
#define HID_USAGE_GAME_MOVE_RIGHT_LEFT ((USAGE) 0x24)
#define HID_USAGE_GAME_MOVE_FORWARD_BACK ((USAGE) 0x25)
#define HID_USAGE_GAME_MOVE_UP_DOWN ((USAGE) 0x26)
#define HID_USAGE_GAME_LEAN_RIGHT_LEFT ((USAGE) 0x27)
#define HID_USAGE_GAME_LEAN_FORWARD_BACK ((USAGE) 0x28)
#define HID_USAGE_GAME_POV_HEIGHT ((USAGE) 0x29)
#define HID_USAGE_GAME_FLIPPER ((USAGE) 0x2A)
#define HID_USAGE_GAME_SECONDARY_FLIPPER ((USAGE) 0x2B)
#define HID_USAGE_GAME_BUMP ((USAGE) 0x2C)
#define HID_USAGE_GAME_NEW_GAME ((USAGE) 0x2D)
#define HID_USAGE_GAME_SHOOT_BALL ((USAGE) 0x2E)
#define HID_USAGE_GAME_PLAYER ((USAGE) 0x2F)
#define HID_USAGE_GAME_GUN_BOLT ((USAGE) 0x30)
#define HID_USAGE_GAME_GUN_CLIP ((USAGE) 0x31)
#define HID_USAGE_GAME_GUN_SINGLE_SHOT ((USAGE) 0x33)
#define HID_USAGE_GAME_GUN_BURST ((USAGE) 0x34)
#define HID_USAGE_GAME_GUN_AUTOMATIC ((USAGE) 0x35)
#define HID_USAGE_GAME_GUN_SAFETY ((USAGE) 0x36)
//
// Generic Device Controls Page (0x06)
//
#define HID_USAGE_GENERIC_DEVICE_BATTERY_STRENGTH ((USAGE) 0x20)
#define HID_USAGE_GENERIC_DEVICE_WIRELESS_CHANNEL ((USAGE) 0x21)
#define HID_USAGE_GENERIC_DEVICE_WIRELESS_ID ((USAGE) 0x22)
#define HID_USAGE_GENERIC_DEVICE_DISCOVER_WIRELESS_CONTROL ((USAGE) 0x23)
#define HID_USAGE_GENERIC_DEVICE_SECURITY_CODE_CHAR_ENTERED ((USAGE) 0x24)
#define HID_USAGE_GENERIC_DEVICE_SECURITY_CODE_CHAR_ERASED ((USAGE) 0x25)
#define HID_USAGE_GENERIC_DEVICE_SECURITY_CODE_CLEARED ((USAGE) 0x26)
//
// Keyboard/Keypad Page (0x07)
//
// Error "keys"
#define HID_USAGE_KEYBOARD_NOEVENT ((USAGE) 0x00)
#define HID_USAGE_KEYBOARD_ROLLOVER ((USAGE) 0x01)
#define HID_USAGE_KEYBOARD_POSTFAIL ((USAGE) 0x02)
#define HID_USAGE_KEYBOARD_UNDEFINED ((USAGE) 0x03)
// Letters
#define HID_USAGE_KEYBOARD_aA ((USAGE) 0x04)
#define HID_USAGE_KEYBOARD_zZ ((USAGE) 0x1D)
// Numbers
#define HID_USAGE_KEYBOARD_ONE ((USAGE) 0x1E)
#define HID_USAGE_KEYBOARD_ZERO ((USAGE) 0x27)
// Modifier Keys
#define HID_USAGE_KEYBOARD_LCTRL ((USAGE) 0xE0)
#define HID_USAGE_KEYBOARD_LSHFT ((USAGE) 0xE1)
#define HID_USAGE_KEYBOARD_LALT ((USAGE) 0xE2)
#define HID_USAGE_KEYBOARD_LGUI ((USAGE) 0xE3)
#define HID_USAGE_KEYBOARD_RCTRL ((USAGE) 0xE4)
#define HID_USAGE_KEYBOARD_RSHFT ((USAGE) 0xE5)
#define HID_USAGE_KEYBOARD_RALT ((USAGE) 0xE6)
#define HID_USAGE_KEYBOARD_RGUI ((USAGE) 0xE7)
#define HID_USAGE_KEYBOARD_SCROLL_LOCK ((USAGE) 0x47)
#define HID_USAGE_KEYBOARD_NUM_LOCK ((USAGE) 0x53)
#define HID_USAGE_KEYBOARD_CAPS_LOCK ((USAGE) 0x39)
// Function keys
#define HID_USAGE_KEYBOARD_F1 ((USAGE) 0x3A)
#define HID_USAGE_KEYBOARD_F2 ((USAGE) 0x3B)
#define HID_USAGE_KEYBOARD_F3 ((USAGE) 0x3C)
#define HID_USAGE_KEYBOARD_F4 ((USAGE) 0x3D)
#define HID_USAGE_KEYBOARD_F5 ((USAGE) 0x3E)
#define HID_USAGE_KEYBOARD_F6 ((USAGE) 0x3F)
#define HID_USAGE_KEYBOARD_F7 ((USAGE) 0x40)
#define HID_USAGE_KEYBOARD_F8 ((USAGE) 0x41)
#define HID_USAGE_KEYBOARD_F9 ((USAGE) 0x42)
#define HID_USAGE_KEYBOARD_F10 ((USAGE) 0x43)
#define HID_USAGE_KEYBOARD_F11 ((USAGE) 0x44)
#define HID_USAGE_KEYBOARD_F12 ((USAGE) 0x45)
#define HID_USAGE_KEYBOARD_F13 ((USAGE) 0x68)
#define HID_USAGE_KEYBOARD_F14 ((USAGE) 0x69)
#define HID_USAGE_KEYBOARD_F15 ((USAGE) 0x6A)
#define HID_USAGE_KEYBOARD_F16 ((USAGE) 0x6B)
#define HID_USAGE_KEYBOARD_F17 ((USAGE) 0x6C)
#define HID_USAGE_KEYBOARD_F18 ((USAGE) 0x6D)
#define HID_USAGE_KEYBOARD_F19 ((USAGE) 0x6E)
#define HID_USAGE_KEYBOARD_F20 ((USAGE) 0x6F)
#define HID_USAGE_KEYBOARD_F21 ((USAGE) 0x70)
#define HID_USAGE_KEYBOARD_F22 ((USAGE) 0x71)
#define HID_USAGE_KEYBOARD_F23 ((USAGE) 0x72)
#define HID_USAGE_KEYBOARD_F24 ((USAGE) 0x73)
#define HID_USAGE_KEYBOARD_RETURN ((USAGE) 0x28)
#define HID_USAGE_KEYBOARD_ESCAPE ((USAGE) 0x29)
#define HID_USAGE_KEYBOARD_DELETE ((USAGE) 0x2A)
#define HID_USAGE_KEYBOARD_PRINT_SCREEN ((USAGE) 0x46)
#define HID_USAGE_KEYBOARD_DELETE_FORWARD ((USAGE) 0x4C)
//
// LED Page (0x08)
//
#define HID_USAGE_LED_NUM_LOCK ((USAGE) 0x01)
#define HID_USAGE_LED_CAPS_LOCK ((USAGE) 0x02)
#define HID_USAGE_LED_SCROLL_LOCK ((USAGE) 0x03)
#define HID_USAGE_LED_COMPOSE ((USAGE) 0x04)
#define HID_USAGE_LED_KANA ((USAGE) 0x05)
#define HID_USAGE_LED_POWER ((USAGE) 0x06)
#define HID_USAGE_LED_SHIFT ((USAGE) 0x07)
#define HID_USAGE_LED_DO_NOT_DISTURB ((USAGE) 0x08)
#define HID_USAGE_LED_MUTE ((USAGE) 0x09)
#define HID_USAGE_LED_TONE_ENABLE ((USAGE) 0x0A)
#define HID_USAGE_LED_HIGH_CUT_FILTER ((USAGE) 0x0B)
#define HID_USAGE_LED_LOW_CUT_FILTER ((USAGE) 0x0C)
#define HID_USAGE_LED_EQUALIZER_ENABLE ((USAGE) 0x0D)
#define HID_USAGE_LED_SOUND_FIELD_ON ((USAGE) 0x0E)
#define HID_USAGE_LED_SURROUND_FIELD_ON ((USAGE) 0x0F)
#define HID_USAGE_LED_REPEAT ((USAGE) 0x10)
#define HID_USAGE_LED_STEREO ((USAGE) 0x11)
#define HID_USAGE_LED_SAMPLING_RATE_DETECT ((USAGE) 0x12)
#define HID_USAGE_LED_SPINNING ((USAGE) 0x13)
#define HID_USAGE_LED_CAV ((USAGE) 0x14)
#define HID_USAGE_LED_CLV ((USAGE) 0x15)
#define HID_USAGE_LED_RECORDING_FORMAT_DET ((USAGE) 0x16)
#define HID_USAGE_LED_OFF_HOOK ((USAGE) 0x17)
#define HID_USAGE_LED_RING ((USAGE) 0x18)
#define HID_USAGE_LED_MESSAGE_WAITING ((USAGE) 0x19)
#define HID_USAGE_LED_DATA_MODE ((USAGE) 0x1A)
#define HID_USAGE_LED_BATTERY_OPERATION ((USAGE) 0x1B)
#define HID_USAGE_LED_BATTERY_OK ((USAGE) 0x1C)
#define HID_USAGE_LED_BATTERY_LOW ((USAGE) 0x1D)
#define HID_USAGE_LED_SPEAKER ((USAGE) 0x1E)
#define HID_USAGE_LED_HEAD_SET ((USAGE) 0x1F)
#define HID_USAGE_LED_HOLD ((USAGE) 0x20)
#define HID_USAGE_LED_MICROPHONE ((USAGE) 0x21)
#define HID_USAGE_LED_COVERAGE ((USAGE) 0x22)
#define HID_USAGE_LED_NIGHT_MODE ((USAGE) 0x23)
#define HID_USAGE_LED_SEND_CALLS ((USAGE) 0x24)
#define HID_USAGE_LED_CALL_PICKUP ((USAGE) 0x25)
#define HID_USAGE_LED_CONFERENCE ((USAGE) 0x26)
#define HID_USAGE_LED_STAND_BY ((USAGE) 0x27)
#define HID_USAGE_LED_CAMERA_ON ((USAGE) 0x28)
#define HID_USAGE_LED_CAMERA_OFF ((USAGE) 0x29)
#define HID_USAGE_LED_ON_LINE ((USAGE) 0x2A)
#define HID_USAGE_LED_OFF_LINE ((USAGE) 0x2B)
#define HID_USAGE_LED_BUSY ((USAGE) 0x2C)
#define HID_USAGE_LED_READY ((USAGE) 0x2D)
#define HID_USAGE_LED_PAPER_OUT ((USAGE) 0x2E)
#define HID_USAGE_LED_PAPER_JAM ((USAGE) 0x2F)
#define HID_USAGE_LED_REMOTE ((USAGE) 0x30)
#define HID_USAGE_LED_FORWARD ((USAGE) 0x31)
#define HID_USAGE_LED_REVERSE ((USAGE) 0x32)
#define HID_USAGE_LED_STOP ((USAGE) 0x33)
#define HID_USAGE_LED_REWIND ((USAGE) 0x34)
#define HID_USAGE_LED_FAST_FORWARD ((USAGE) 0x35)
#define HID_USAGE_LED_PLAY ((USAGE) 0x36)
#define HID_USAGE_LED_PAUSE ((USAGE) 0x37)
#define HID_USAGE_LED_RECORD ((USAGE) 0x38)
#define HID_USAGE_LED_ERROR ((USAGE) 0x39)
#define HID_USAGE_LED_SELECTED_INDICATOR ((USAGE) 0x3A)
#define HID_USAGE_LED_IN_USE_INDICATOR ((USAGE) 0x3B)
#define HID_USAGE_LED_MULTI_MODE_INDICATOR ((USAGE) 0x3C)
#define HID_USAGE_LED_INDICATOR_ON ((USAGE) 0x3D)
#define HID_USAGE_LED_INDICATOR_FLASH ((USAGE) 0x3E)
#define HID_USAGE_LED_INDICATOR_SLOW_BLINK ((USAGE) 0x3F)
#define HID_USAGE_LED_INDICATOR_FAST_BLINK ((USAGE) 0x40)
#define HID_USAGE_LED_INDICATOR_OFF ((USAGE) 0x41)
#define HID_USAGE_LED_FLASH_ON_TIME ((USAGE) 0x42)
#define HID_USAGE_LED_SLOW_BLINK_ON_TIME ((USAGE) 0x43)
#define HID_USAGE_LED_SLOW_BLINK_OFF_TIME ((USAGE) 0x44)
#define HID_USAGE_LED_FAST_BLINK_ON_TIME ((USAGE) 0x45)
#define HID_USAGE_LED_FAST_BLINK_OFF_TIME ((USAGE) 0x46)
#define HID_USAGE_LED_INDICATOR_COLOR ((USAGE) 0x47)
#define HID_USAGE_LED_RED ((USAGE) 0x48)
#define HID_USAGE_LED_GREEN ((USAGE) 0x49)
#define HID_USAGE_LED_AMBER ((USAGE) 0x4A)
#define HID_USAGE_LED_GENERIC_INDICATOR ((USAGE) 0x4B)
#define HID_USAGE_LED_SYSTEM_SUSPEND ((USAGE) 0x4C)
#define HID_USAGE_LED_EXTERNAL_POWER ((USAGE) 0x4D)
//
// Button Page (0x09)
//
// There is no need to label these usages.
//
//
// Ordinal Page (0x0A)
//
// There is no need to label these usages.
//
//
// Telephony Device Page (0x0B)
//
#define HID_USAGE_TELEPHONY_PHONE ((USAGE) 0x01)
#define HID_USAGE_TELEPHONY_ANSWERING_MACHINE ((USAGE) 0x02)
#define HID_USAGE_TELEPHONY_MESSAGE_CONTROLS ((USAGE) 0x03)
#define HID_USAGE_TELEPHONY_HANDSET ((USAGE) 0x04)
#define HID_USAGE_TELEPHONY_HEADSET ((USAGE) 0x05)
#define HID_USAGE_TELEPHONY_KEYPAD ((USAGE) 0x06)
#define HID_USAGE_TELEPHONY_PROGRAMMABLE_BUTTON ((USAGE) 0x07)
#define HID_USAGE_TELEPHONY_REDIAL ((USAGE) 0x24)
#define HID_USAGE_TELEPHONY_TRANSFER ((USAGE) 0x25)
#define HID_USAGE_TELEPHONY_DROP ((USAGE) 0x26)
#define HID_USAGE_TELEPHONY_LINE ((USAGE) 0x2A)
#define HID_USAGE_TELEPHONY_RING_ENABLE ((USAGE) 0x2D)
#define HID_USAGE_TELEPHONY_SEND ((USAGE) 0x31)
#define HID_USAGE_TELEPHONY_KEYPAD_0 ((USAGE) 0xB0)
#define HID_USAGE_TELEPHONY_KEYPAD_D ((USAGE) 0xBF)
#define HID_USAGE_TELEPHONY_HOST_AVAILABLE ((USAGE) 0xF1)
//
// Consumer Controls Page (0x0C)
//
#define HID_USAGE_CONSUMERCTRL ((USAGE) 0x01)
// channel
#define HID_USAGE_CONSUMER_CHANNEL_INCREMENT ((USAGE) 0x9C)
#define HID_USAGE_CONSUMER_CHANNEL_DECREMENT ((USAGE) 0x9D)
// transport control
#define HID_USAGE_CONSUMER_PLAY ((USAGE) 0xB0)
#define HID_USAGE_CONSUMER_PAUSE ((USAGE) 0xB1)
#define HID_USAGE_CONSUMER_RECORD ((USAGE) 0xB2)
#define HID_USAGE_CONSUMER_FAST_FORWARD ((USAGE) 0xB3)
#define HID_USAGE_CONSUMER_REWIND ((USAGE) 0xB4)
#define HID_USAGE_CONSUMER_SCAN_NEXT_TRACK ((USAGE) 0xB5)
#define HID_USAGE_CONSUMER_SCAN_PREV_TRACK ((USAGE) 0xB6)
#define HID_USAGE_CONSUMER_STOP ((USAGE) 0xB7)
#define HID_USAGE_CONSUMER_PLAY_PAUSE ((USAGE) 0xCD)
// GameDVR
#define HID_USAGE_CONSUMER_GAMEDVR_OPEN_GAMEBAR ((USAGE) 0xD0)
#define HID_USAGE_CONSUMER_GAMEDVR_TOGGLE_RECORD ((USAGE) 0xD1)
#define HID_USAGE_CONSUMER_GAMEDVR_RECORD_CLIP ((USAGE) 0xD2)
#define HID_USAGE_CONSUMER_GAMEDVR_SCREENSHOT ((USAGE) 0xD3)
#define HID_USAGE_CONSUMER_GAMEDVR_TOGGLE_INDICATOR ((USAGE) 0xD4)
#define HID_USAGE_CONSUMER_GAMEDVR_TOGGLE_MICROPHONE ((USAGE) 0xD5)
#define HID_USAGE_CONSUMER_GAMEDVR_TOGGLE_CAMERA ((USAGE) 0xD6)
#define HID_USAGE_CONSUMER_GAMEDVR_TOGGLE_BROADCAST ((USAGE) 0xD7)
// audio
#define HID_USAGE_CONSUMER_VOLUME ((USAGE) 0xE0)
#define HID_USAGE_CONSUMER_BALANCE ((USAGE) 0xE1)
#define HID_USAGE_CONSUMER_MUTE ((USAGE) 0xE2)
#define HID_USAGE_CONSUMER_BASS ((USAGE) 0xE3)
#define HID_USAGE_CONSUMER_TREBLE ((USAGE) 0xE4)
#define HID_USAGE_CONSUMER_BASS_BOOST ((USAGE) 0xE5)
#define HID_USAGE_CONSUMER_SURROUND_MODE ((USAGE) 0xE6)
#define HID_USAGE_CONSUMER_LOUDNESS ((USAGE) 0xE7)
#define HID_USAGE_CONSUMER_MPX ((USAGE) 0xE8)
#define HID_USAGE_CONSUMER_VOLUME_INCREMENT ((USAGE) 0xE9)
#define HID_USAGE_CONSUMER_VOLUME_DECREMENT ((USAGE) 0xEA)
// supplementary audio
#define HID_USAGE_CONSUMER_BASS_INCREMENT ((USAGE) 0x152)
#define HID_USAGE_CONSUMER_BASS_DECREMENT ((USAGE) 0x153)
#define HID_USAGE_CONSUMER_TREBLE_INCREMENT ((USAGE) 0x154)
#define HID_USAGE_CONSUMER_TREBLE_DECREMENT ((USAGE) 0x155)
// Application Launch
#define HID_USAGE_CONSUMER_AL_CONFIGURATION ((USAGE) 0x183)
#define HID_USAGE_CONSUMER_AL_EMAIL ((USAGE) 0x18A)
#define HID_USAGE_CONSUMER_AL_CALCULATOR ((USAGE) 0x192)
#define HID_USAGE_CONSUMER_AL_BROWSER ((USAGE) 0x194)
#define HID_USAGE_CONSUMER_AL_SEARCH ((USAGE) 0x1C6)
// Application Control
#define HID_USAGE_CONSUMER_AC_SEARCH ((USAGE) 0x221)
#define HID_USAGE_CONSUMER_AC_GOTO ((USAGE) 0x222)
#define HID_USAGE_CONSUMER_AC_HOME ((USAGE) 0x223)
#define HID_USAGE_CONSUMER_AC_BACK ((USAGE) 0x224)
#define HID_USAGE_CONSUMER_AC_FORWARD ((USAGE) 0x225)
#define HID_USAGE_CONSUMER_AC_STOP ((USAGE) 0x226)
#define HID_USAGE_CONSUMER_AC_REFRESH ((USAGE) 0x227)
#define HID_USAGE_CONSUMER_AC_PREVIOUS ((USAGE) 0x228)
#define HID_USAGE_CONSUMER_AC_NEXT ((USAGE) 0x229)
#define HID_USAGE_CONSUMER_AC_BOOKMARKS ((USAGE) 0x22A)
#define HID_USAGE_CONSUMER_AC_PAN ((USAGE) 0x238)
// Keyboard Extended Attributes (defined on consumer page in HUTRR42)
#define HID_USAGE_CONSUMER_EXTENDED_KEYBOARD_ATTRIBUTES_COLLECTION ((USAGE) 0x2C0)
#define HID_USAGE_CONSUMER_KEYBOARD_FORM_FACTOR ((USAGE) 0x2C1)
#define HID_USAGE_CONSUMER_KEYBOARD_KEY_TYPE ((USAGE) 0x2C2)
#define HID_USAGE_CONSUMER_KEYBOARD_PHYSICAL_LAYOUT ((USAGE) 0x2C3)
#define HID_USAGE_CONSUMER_VENDOR_SPECIFIC_KEYBOARD_PHYSICAL_LAYOUT ((USAGE) 0x2C4)
#define HID_USAGE_CONSUMER_KEYBOARD_IETF_LANGUAGE_TAG_INDEX ((USAGE) 0x2C5)
#define HID_USAGE_CONSUMER_IMPLEMENTED_KEYBOARD_INPUT_ASSIST_CONTROLS ((USAGE) 0x2C6)
//
// Digitizer Page (0x0D)
//
#define HID_USAGE_DIGITIZER_DIGITIZER ((USAGE) 0x01)
#define HID_USAGE_DIGITIZER_PEN ((USAGE) 0x02)
#define HID_USAGE_DIGITIZER_LIGHT_PEN ((USAGE) 0x03)
#define HID_USAGE_DIGITIZER_TOUCH_SCREEN ((USAGE) 0x04)
#define HID_USAGE_DIGITIZER_TOUCH_PAD ((USAGE) 0x05)
#define HID_USAGE_DIGITIZER_WHITE_BOARD ((USAGE) 0x06)
#define HID_USAGE_DIGITIZER_COORD_MEASURING ((USAGE) 0x07)
#define HID_USAGE_DIGITIZER_3D_DIGITIZER ((USAGE) 0x08)
#define HID_USAGE_DIGITIZER_STEREO_PLOTTER ((USAGE) 0x09)
#define HID_USAGE_DIGITIZER_ARTICULATED_ARM ((USAGE) 0x0A)
#define HID_USAGE_DIGITIZER_ARMATURE ((USAGE) 0x0B)
#define HID_USAGE_DIGITIZER_MULTI_POINT ((USAGE) 0x0C)
#define HID_USAGE_DIGITIZER_FREE_SPACE_WAND ((USAGE) 0x0D)
#define HID_USAGE_DIGITIZER_STYLUS ((USAGE) 0x20)
#define HID_USAGE_DIGITIZER_PUCK ((USAGE) 0x21)
#define HID_USAGE_DIGITIZER_FINGER ((USAGE) 0x22)
#define HID_USAGE_DIGITIZER_TABLET_FUNC_KEYS ((USAGE) 0x39)
#define HID_USAGE_DIGITIZER_PROG_CHANGE_KEYS ((USAGE) 0x3A)
#define HID_USAGE_DIGITIZER_TIP_PRESSURE ((USAGE) 0x30)
#define HID_USAGE_DIGITIZER_BARREL_PRESSURE ((USAGE) 0x31)
#define HID_USAGE_DIGITIZER_IN_RANGE ((USAGE) 0x32)
#define HID_USAGE_DIGITIZER_TOUCH ((USAGE) 0x33)
#define HID_USAGE_DIGITIZER_UNTOUCH ((USAGE) 0x34)
#define HID_USAGE_DIGITIZER_TAP ((USAGE) 0x35)
#define HID_USAGE_DIGITIZER_QUALITY ((USAGE) 0x36)
#define HID_USAGE_DIGITIZER_DATA_VALID ((USAGE) 0x37)
#define HID_USAGE_DIGITIZER_TRANSDUCER_INDEX ((USAGE) 0x38)
#define HID_USAGE_DIGITIZER_BATTERY_STRENGTH ((USAGE) 0x3B)
#define HID_USAGE_DIGITIZER_INVERT ((USAGE) 0x3C)
#define HID_USAGE_DIGITIZER_X_TILT ((USAGE) 0x3D)
#define HID_USAGE_DIGITIZER_Y_TILT ((USAGE) 0x3E)
#define HID_USAGE_DIGITIZER_AZIMUTH ((USAGE) 0x3F)
#define HID_USAGE_DIGITIZER_ALTITUDE ((USAGE) 0x40)
#define HID_USAGE_DIGITIZER_TWIST ((USAGE) 0x41)
#define HID_USAGE_DIGITIZER_TIP_SWITCH ((USAGE) 0x42)
#define HID_USAGE_DIGITIZER_SECONDARY_TIP_SWITCH ((USAGE) 0x43)
#define HID_USAGE_DIGITIZER_BARREL_SWITCH ((USAGE) 0x44)
#define HID_USAGE_DIGITIZER_ERASER ((USAGE) 0x45)
#define HID_USAGE_DIGITIZER_TABLET_PICK ((USAGE) 0x46)
#define HID_USAGE_DIGITIZER_TRANSDUCER_SERIAL ((USAGE) 0x5B)
#define HID_USAGE_DIGITIZER_TRANSDUCER_VENDOR ((USAGE) 0x92)
#define HID_USAGE_DIGITIZER_TRANSDUCER_CONNECTED ((USAGE) 0xA2)
//
// Simple Haptic Controller Page (0x0E)
//
#define HID_USAGE_HAPTICS_SIMPLE_CONTROLLER ((USAGE)0x01)
#define HID_USAGE_HAPTICS_WAVEFORM_LIST ((USAGE)0x10)
#define HID_USAGE_HAPTICS_DURATION_LIST ((USAGE)0x11)
#define HID_USAGE_HAPTICS_AUTO_TRIGGER ((USAGE)0x20)
#define HID_USAGE_HAPTICS_MANUAL_TRIGGER ((USAGE)0x21)
#define HID_USAGE_HAPTICS_AUTO_ASSOCIATED_CONTROL ((USAGE)0x22)
#define HID_USAGE_HAPTICS_INTENSITY ((USAGE)0x23)
#define HID_USAGE_HAPTICS_REPEAT_COUNT ((USAGE)0x24)
#define HID_USAGE_HAPTICS_RETRIGGER_PERIOD ((USAGE)0x25)
#define HID_USAGE_HAPTICS_WAVEFORM_VENDOR_PAGE ((USAGE)0x26)
#define HID_USAGE_HAPTICS_WAVEFORM_VENDOR_ID ((USAGE)0x27)
#define HID_USAGE_HAPTICS_WAVEFORM_CUTOFF_TIME ((USAGE)0x28)
// Waveform types
#define HID_USAGE_HAPTICS_WAVEFORM_BEGIN ((USAGE)0x1000)
#define HID_USAGE_HAPTICS_WAVEFORM_STOP ((USAGE)0x1001)
#define HID_USAGE_HAPTICS_WAVEFORM_NULL ((USAGE)0x1002)
#define HID_USAGE_HAPTICS_WAVEFORM_CLICK ((USAGE)0x1003)
#define HID_USAGE_HAPTICS_WAVEFORM_BUZZ ((USAGE)0x1004)
#define HID_USAGE_HAPTICS_WAVEFORM_RUMBLE ((USAGE)0x1005)
#define HID_USAGE_HAPTICS_WAVEFORM_PRESS ((USAGE)0x1006)
#define HID_USAGE_HAPTICS_WAVEFORM_RELEASE ((USAGE)0x1007)
#define HID_USAGE_HAPTICS_WAVEFORM_END ((USAGE)0x1FFF)
#define HID_USAGE_HAPTICS_WAVEFORM_VENDOR_BEGIN ((USAGE)0x2000)
#define HID_USAGE_HAPTICS_WAVEFORM_VENDOR_END ((USAGE)0x2FFF)
//
// Unicode Page (0x10)
//
// There is no need to label these usages.
//
//
// Alphanumeric Display Page (0x14)
//
#define HID_USAGE_ALPHANUMERIC_ALPHANUMERIC_DISPLAY ((USAGE) 0x01)
#define HID_USAGE_ALPHANUMERIC_BITMAPPED_DISPLAY ((USAGE) 0x02)
#define HID_USAGE_ALPHANUMERIC_DISPLAY_ATTRIBUTES_REPORT ((USAGE) 0x20)
#define HID_USAGE_ALPHANUMERIC_DISPLAY_CONTROL_REPORT ((USAGE) 0x24)
#define HID_USAGE_ALPHANUMERIC_CHARACTER_REPORT ((USAGE) 0x2B)
#define HID_USAGE_ALPHANUMERIC_DISPLAY_STATUS ((USAGE) 0x2D)
#define HID_USAGE_ALPHANUMERIC_CURSOR_POSITION_REPORT ((USAGE) 0x32)
#define HID_USAGE_ALPHANUMERIC_FONT_REPORT ((USAGE) 0x3B)
#define HID_USAGE_ALPHANUMERIC_FONT_DATA ((USAGE) 0x3C)
#define HID_USAGE_ALPHANUMERIC_CHARACTER_ATTRIBUTE ((USAGE) 0x48)
#define HID_USAGE_ALPHANUMERIC_PALETTE_REPORT ((USAGE) 0x85)
#define HID_USAGE_ALPHANUMERIC_PALETTE_DATA ((USAGE) 0x88)
#define HID_USAGE_ALPHANUMERIC_BLIT_REPORT ((USAGE) 0x8A)
#define HID_USAGE_ALPHANUMERIC_BLIT_DATA ((USAGE) 0x8F)
#define HID_USAGE_ALPHANUMERIC_SOFT_BUTTON ((USAGE) 0x90)
#define HID_USAGE_ALPHANUMERIC_ASCII_CHARACTER_SET ((USAGE) 0x21)
#define HID_USAGE_ALPHANUMERIC_DATA_READ_BACK ((USAGE) 0x22)
#define HID_USAGE_ALPHANUMERIC_FONT_READ_BACK ((USAGE) 0x23)
#define HID_USAGE_ALPHANUMERIC_CLEAR_DISPLAY ((USAGE) 0x25)
#define HID_USAGE_ALPHANUMERIC_DISPLAY_ENABLE ((USAGE) 0x26)
#define HID_USAGE_ALPHANUMERIC_SCREEN_SAVER_DELAY ((USAGE) 0x27)
#define HID_USAGE_ALPHANUMERIC_SCREEN_SAVER_ENABLE ((USAGE) 0x28)
#define HID_USAGE_ALPHANUMERIC_VERTICAL_SCROLL ((USAGE) 0x29)
#define HID_USAGE_ALPHANUMERIC_HORIZONTAL_SCROLL ((USAGE) 0x2A)
#define HID_USAGE_ALPHANUMERIC_DISPLAY_DATA ((USAGE) 0x2C)
#define HID_USAGE_ALPHANUMERIC_STATUS_NOT_READY ((USAGE) 0x2E)
#define HID_USAGE_ALPHANUMERIC_STATUS_READY ((USAGE) 0x2F)
#define HID_USAGE_ALPHANUMERIC_ERR_NOT_A_LOADABLE_CHARACTER ((USAGE) 0x30)
#define HID_USAGE_ALPHANUMERIC_ERR_FONT_DATA_CANNOT_BE_READ ((USAGE) 0x31)
#define HID_USAGE_ALPHANUMERIC_ROW ((USAGE) 0x33)
#define HID_USAGE_ALPHANUMERIC_COLUMN ((USAGE) 0x34)
#define HID_USAGE_ALPHANUMERIC_ROWS ((USAGE) 0x35)
#define HID_USAGE_ALPHANUMERIC_COLUMNS ((USAGE) 0x36)
#define HID_USAGE_ALPHANUMERIC_CURSOR_PIXEL_POSITIONING ((USAGE) 0x37)
#define HID_USAGE_ALPHANUMERIC_CURSOR_MODE ((USAGE) 0x38)
#define HID_USAGE_ALPHANUMERIC_CURSOR_ENABLE ((USAGE) 0x39)
#define HID_USAGE_ALPHANUMERIC_CURSOR_BLINK ((USAGE) 0x3A)
#define HID_USAGE_ALPHANUMERIC_CHAR_WIDTH ((USAGE) 0x3D)
#define HID_USAGE_ALPHANUMERIC_CHAR_HEIGHT ((USAGE) 0x3E)
#define HID_USAGE_ALPHANUMERIC_CHAR_SPACING_HORIZONTAL ((USAGE) 0x3F)
#define HID_USAGE_ALPHANUMERIC_CHAR_SPACING_VERTICAL ((USAGE) 0x40)
#define HID_USAGE_ALPHANUMERIC_UNICODE_CHAR_SET ((USAGE) 0x41)
#define HID_USAGE_ALPHANUMERIC_FONT_7_SEGMENT ((USAGE) 0x42)
#define HID_USAGE_ALPHANUMERIC_7_SEGMENT_DIRECT_MAP ((USAGE) 0x43)
#define HID_USAGE_ALPHANUMERIC_FONT_14_SEGMENT ((USAGE) 0x44)
#define HID_USAGE_ALPHANUMERIC_14_SEGMENT_DIRECT_MAP ((USAGE) 0x45)
#define HID_USAGE_ALPHANUMERIC_DISPLAY_BRIGHTNESS ((USAGE) 0x46)
#define HID_USAGE_ALPHANUMERIC_DISPLAY_CONTRAST ((USAGE) 0x47)
#define HID_USAGE_ALPHANUMERIC_ATTRIBUTE_READBACK ((USAGE) 0x49)
#define HID_USAGE_ALPHANUMERIC_ATTRIBUTE_DATA ((USAGE) 0x4A)
#define HID_USAGE_ALPHANUMERIC_CHAR_ATTR_ENHANCE ((USAGE) 0x4B)
#define HID_USAGE_ALPHANUMERIC_CHAR_ATTR_UNDERLINE ((USAGE) 0x4C)
#define HID_USAGE_ALPHANUMERIC_CHAR_ATTR_BLINK ((USAGE) 0x4D)
#define HID_USAGE_ALPHANUMERIC_BITMAP_SIZE_X ((USAGE) 0x80)
#define HID_USAGE_ALPHANUMERIC_BITMAP_SIZE_Y ((USAGE) 0x81)
#define HID_USAGE_ALPHANUMERIC_BIT_DEPTH_FORMAT ((USAGE) 0x83)
#define HID_USAGE_ALPHANUMERIC_DISPLAY_ORIENTATION ((USAGE) 0x84)
#define HID_USAGE_ALPHANUMERIC_PALETTE_DATA_SIZE ((USAGE) 0x86)
#define HID_USAGE_ALPHANUMERIC_PALETTE_DATA_OFFSET ((USAGE) 0x87)
#define HID_USAGE_ALPHANUMERIC_BLIT_RECTANGLE_X1 ((USAGE) 0x8B)
#define HID_USAGE_ALPHANUMERIC_BLIT_RECTANGLE_Y1 ((USAGE) 0x8C)
#define HID_USAGE_ALPHANUMERIC_BLIT_RECTANGLE_X2 ((USAGE) 0x8D)
#define HID_USAGE_ALPHANUMERIC_BLIT_RECTANGLE_Y2 ((USAGE) 0x8E)
#define HID_USAGE_ALPHANUMERIC_SOFT_BUTTON_ID ((USAGE) 0x91)
#define HID_USAGE_ALPHANUMERIC_SOFT_BUTTON_SIDE ((USAGE) 0x92)
#define HID_USAGE_ALPHANUMERIC_SOFT_BUTTON_OFFSET1 ((USAGE) 0x93)
#define HID_USAGE_ALPHANUMERIC_SOFT_BUTTON_OFFSET2 ((USAGE) 0x94)
#define HID_USAGE_ALPHANUMERIC_SOFT_BUTTON_REPORT ((USAGE) 0x95)
//
// Sensor Page (0x20)
//
//
// LampArray Page (0x59)
//
#define HID_USAGE_LAMPARRAY ((USAGE) 0x01)
#define HID_USAGE_LAMPARRAY_ATTRBIUTES_REPORT ((USAGE) 0x02)
#define HID_USAGE_LAMPARRAY_LAMP_COUNT ((USAGE) 0x03)
#define HID_USAGE_LAMPARRAY_BOUNDING_BOX_WIDTH_IN_MICROMETERS ((USAGE) 0x04)
#define HID_USAGE_LAMPARRAY_BOUNDING_BOX_HEIGHT_IN_MICROMETERS ((USAGE) 0x05)
#define HID_USAGE_LAMPARRAY_BOUNDING_BOX_DEPTH_IN_MICROMETERS ((USAGE) 0x06)
#define HID_USAGE_LAMPARRAY_KIND ((USAGE) 0x07)
#define HID_USAGE_LAMPARRAY_MIN_UPDATE_INTERVAL_IN_MICROSECONDS ((USAGE) 0x08)
// 0x09 - 0x1F Reserved
#define HID_USAGE_LAMPARRAY_LAMP_ATTRIBUTES_REQUEST_REPORT ((USAGE) 0x20)
#define HID_USAGE_LAMPARRAY_LAMP_ID ((USAGE) 0x21)
#define HID_USAGE_LAMPARRAY_LAMP_ATTRIBUTES_RESPONSE_REPORT ((USAGE) 0x22)
#define HID_USAGE_LAMPARRAY_POSITION_X_IN_MICROMETERS ((USAGE) 0x23)
#define HID_USAGE_LAMPARRAY_POSITION_Y_IN_MICROMETERS ((USAGE) 0x24)
#define HID_USAGE_LAMPARRAY_POSITION_Z_IN_MICROMETERS ((USAGE) 0x25)
#define HID_USAGE_LAMPARRAY_LAMP_PURPOSES ((USAGE) 0x26)
#define HID_USAGE_LAMPARRAY_UPDATE_LATENCY_IN_MICROSECONDS ((USAGE) 0x27)
#define HID_USAGE_LAMPARRAY_RED_LEVEL_COUNT ((USAGE) 0x28)
#define HID_USAGE_LAMPARRAY_GREEN_LEVEL_COUNT ((USAGE) 0x29)
#define HID_USAGE_LAMPARRAY_BLUE_LEVEL_COUNT ((USAGE) 0x2A)
#define HID_USAGE_LAMPARRAY_INTENSITY_LEVEL_COUNT ((USAGE) 0x2B)
#define HID_USAGE_LAMPARRAY_IS_PROGRAMMABLE ((USAGE) 0x2C)
#define HID_USAGE_LAMPARRAY_INPUT_BINDING ((USAGE) 0x2D)
// 0x2E - 0x4F Reserved
#define HID_USAGE_LAMPARRAY_LAMP_MULTI_UPDATE_REPORT ((USAGE) 0x50)
#define HID_USAGE_LAMPARRAY_LAMP_RED_UPDATE_CHANNEL ((USAGE) 0x51)
#define HID_USAGE_LAMPARRAY_LAMP_GREEN_UPDATE_CHANNEL ((USAGE) 0x52)
#define HID_USAGE_LAMPARRAY_LAMP_BLUE_UPDATE_CHANNEL ((USAGE) 0x53)
#define HID_USAGE_LAMPARRAY_LAMP_INTENSITY_UPDATE_CHANNEL ((USAGE) 0x54)
#define HID_USAGE_LAMPARRAY_LAMP_UPDATE_FLAGS ((USAGE) 0x55)
// 0x55 - 0x5F Reserved
#define HID_USAGE_LAMPARRAY_LAMP_RANGE_UPDATE_REPORT ((USAGE) 0x60)
#define HID_USAGE_LAMPARRAY_LAMP_ID_START ((USAGE) 0x61)
#define HID_USAGE_LAMPARRAY_LAMP_ID_END ((USAGE) 0x62)
// 0x63 - 0x6F Reserved
#define HID_USAGE_LAMPARRAY_CONTROL_REPORT ((USAGE) 0x70)
#define HID_USAGE_LAMPARRAY_AUTONOMOUS_MODE ((USAGE) 0x71)
//
// Camera Control Page (0x90)
//
#define HID_USAGE_CAMERA_AUTO_FOCUS ((USAGE) 0x20)
#define HID_USAGE_CAMERA_SHUTTER ((USAGE) 0x21)
//
// Microsoft Bluetooth Handsfree Page (0xFFF3)
//
#define HID_USAGE_MS_BTH_HF_DIALNUMBER ((USAGE) 0x21)
#define HID_USAGE_MS_BTH_HF_DIALMEMORY ((USAGE) 0x22)
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
#pragma endregion
#endif
| 56.724968 | 87 | 0.647824 |
6502f4ca30fdd305a49eeefeb8dc2c19d45c0e83
| 2,598 |
py
|
Python
|
dit/divergences/tests/test_jensen_shannon_divergence.py
|
chebee7i/dit
|
59626e34c7938fddeec140522dd2a592ba4f42ef
|
[
"BSD-2-Clause"
] | null | null | null |
dit/divergences/tests/test_jensen_shannon_divergence.py
|
chebee7i/dit
|
59626e34c7938fddeec140522dd2a592ba4f42ef
|
[
"BSD-2-Clause"
] | null | null | null |
dit/divergences/tests/test_jensen_shannon_divergence.py
|
chebee7i/dit
|
59626e34c7938fddeec140522dd2a592ba4f42ef
|
[
"BSD-2-Clause"
] | null | null | null |
"""
Tests for dit.divergences.jensen_shannon_divergence.
"""
from nose.tools import assert_almost_equal, assert_raises
from dit import Distribution
from dit.exceptions import ditException
from dit.divergences.jensen_shannon_divergence import (
jensen_shannon_divergence as JSD,
jensen_shannon_divergence_pmf as JSD_pmf
)
def test_jsd0():
""" Test the JSD of a distribution but with weights misspecified."""
d1 = Distribution("AB", [0.5, 0.5])
assert_raises(ditException, JSD, d1, d1)
def test_jsd1():
""" Test the JSD of a distribution with itself """
d1 = Distribution("AB", [0.5, 0.5])
jsd = JSD([d1, d1])
assert_almost_equal(jsd, 0)
def test_jsd2():
""" Test the JSD with half-overlapping distributions """
d1 = Distribution("AB", [0.5, 0.5])
d2 = Distribution("BC", [0.5, 0.5])
jsd = JSD([d1, d2])
assert_almost_equal(jsd, 0.5)
def test_jsd3():
""" Test the JSD with disjoint distributions """
d1 = Distribution("AB", [0.5, 0.5])
d2 = Distribution("CD", [0.5, 0.5])
jsd = JSD([d1, d2])
assert_almost_equal(jsd, 1.0)
def test_jsd4():
""" Test the JSD with half-overlapping distributions with weights """
d1 = Distribution("AB", [0.5, 0.5])
d2 = Distribution("BC", [0.5, 0.5])
jsd = JSD([d1, d2], [0.25, 0.75])
assert_almost_equal(jsd, 0.40563906222956625)
def test_jsd5():
""" Test that JSD fails when more weights than dists are given """
d1 = Distribution("AB", [0.5, 0.5])
d2 = Distribution("BC", [0.5, 0.5])
assert_raises(ditException, JSD, [d1, d2], [0.1, 0.6, 0.3])
def test_jsd_pmf1():
""" Test the JSD of a distribution with itself """
d1 = [0.5, 0.5]
jsd = JSD_pmf([d1, d1])
assert_almost_equal(jsd, 0)
def test_jsd_pmf2():
""" Test the JSD with half-overlapping distributions """
d1 = [0.5, 0.5, 0.0]
d2 = [0.0, 0.5, 0.5]
jsd = JSD_pmf([d1, d2])
assert_almost_equal(jsd, 0.5)
def test_jsd_pmf3():
""" Test the JSD with disjoint distributions """
d1 = [0.5, 0.5, 0.0, 0.0]
d2 = [0.0, 0.0, 0.5, 0.5]
jsd = JSD_pmf([d1, d2])
assert_almost_equal(jsd, 1.0)
def test_jsd_pmf4():
""" Test the JSD with half-overlapping distributions with weights """
d1 = [0.5, 0.5, 0.0]
d2 = [0.0, 0.5, 0.5]
jsd = JSD_pmf([d1, d2], [0.25, 0.75])
assert_almost_equal(jsd, 0.40563906222956625)
def test_jsd_pmf5():
""" Test that JSD fails when more weights than dists are given """
d1 = [0.5, 0.5, 0.0]
d2 = [0.0, 0.5, 0.5]
assert_raises(ditException, JSD_pmf, [d1, d2], [0.1, 0.6, 0.2, 0.1])
| 30.928571 | 73 | 0.624326 |
1809b40cad024369a48918aa65302e8ab3737a6d
| 2,454 |
rb
|
Ruby
|
cookbooks/delivery-cluster/.delivery/build/cookbooks/delivery-matrix/libraries/delivery_change_db.rb
|
chef-boneyard/tf_delivery_cluster
|
0c1bbe9dcea204e97afe0c0d221cc09b2a8b061d
|
[
"Apache-2.0"
] | 15 |
2015-05-02T20:52:19.000Z
|
2015-09-04T03:19:38.000Z
|
cookbooks/delivery-cluster/.delivery/build/cookbooks/delivery-matrix/libraries/delivery_change_db.rb
|
chef-boneyard/tf_delivery_cluster
|
0c1bbe9dcea204e97afe0c0d221cc09b2a8b061d
|
[
"Apache-2.0"
] | 70 |
2015-05-01T21:58:52.000Z
|
2015-09-09T16:27:54.000Z
|
cookbooks/delivery-cluster/.delivery/build/cookbooks/delivery-matrix/libraries/delivery_change_db.rb
|
chef-boneyard/tf_delivery_cluster
|
0c1bbe9dcea204e97afe0c0d221cc09b2a8b061d
|
[
"Apache-2.0"
] | 30 |
2015-10-07T01:00:47.000Z
|
2017-03-27T11:20:21.000Z
|
class Chef
class Provider
class DeliveryChangeDb < Chef::Provider::LWRPBase
provides :delivery_change_db
use_inline_resources
action :create do
converge_by("Create Change Databag Item: #{change_id}") do
new_resource.updated_by_last_action(create_databag)
end
end
action :download do
converge_by("Downloading Change Databag Item: #{change_id} to node.run_state['delivery']['change']['data']") do
new_resource.updated_by_last_action(download_databag)
end
end
private
def change_id
@change_id ||= new_resource.change_id
end
def create_databag
# Create the data bag
begin
bag = Chef::DataBag.new
bag.name(db_name)
DeliverySugar::ChefServer.new.with_server_config do
bag.create
end
rescue Net::HTTPServerException => e
if e.response.code == "409"
::Chef::Log.info("DataBag changes already exists.")
else
raise
end
end
dbi_hash = {
"id" => change_id,
"data" => node.run_state['delivery']['change']['data']
}
## TODO: Merge instead of always creating a new one?
bag_item = Chef::DataBagItem.new
bag_item.data_bag(db_name)
bag_item.raw_data = dbi_hash
DeliverySugar::ChefServer.new.with_server_config do
bag_item.save
end
::Chef::Log.info("Saved bag item #{dbi_hash} in data bag #{change_id}.")
end
def download_databag
## TODO: Look at new delivery-truck syntax
dbi = DeliverySugar::ChefServer.new.with_server_config do
data_bag_item(db_name, change_id)
end
node.run_state['delivery'] ||= {}
node.run_state['delivery']['change'] ||= {}
node.run_state['delivery']['change']['data'] ||= dbi['data']
end
def db_name
'delivery_changes'
end
end
end
end
class Chef
class Resource
class DeliveryChangeDb < Chef::Resource::LWRPBase
actions :create, :download
default_action :create
attribute :change_id, :kind_of => String, :name_attribute => true, :required => true
self.resource_name = :delivery_change_db
def initialize(name, run_context=nil)
super
@provider = Chef::Provider::DeliveryChangeDb
end
end
end
end
| 25.831579 | 119 | 0.602282 |
77d7e73d6b42870f00d41735b3c7c051aa4e32de
| 1,775 |
kt
|
Kotlin
|
lib/src/main/java/alexi/rxpreferences/Preference.kt
|
alexander-ischuk/reactive-preferences
|
47c3b99fc1e63aa0a814b02d35d0135e6e84fc0e
|
[
"Apache-2.0"
] | 1 |
2019-03-06T20:11:57.000Z
|
2019-03-06T20:11:57.000Z
|
lib/src/main/java/alexi/rxpreferences/Preference.kt
|
alexander-ischuk/reactive-preferences
|
47c3b99fc1e63aa0a814b02d35d0135e6e84fc0e
|
[
"Apache-2.0"
] | null | null | null |
lib/src/main/java/alexi/rxpreferences/Preference.kt
|
alexander-ischuk/reactive-preferences
|
47c3b99fc1e63aa0a814b02d35d0135e6e84fc0e
|
[
"Apache-2.0"
] | null | null | null |
package alexi.rxpreferences
import android.content.SharedPreferences
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
import androidx.annotation.VisibleForTesting
import io.reactivex.Emitter
import io.reactivex.Observable
import io.reactivex.ObservableEmitter
abstract class Preference<T>(
val preferences: SharedPreferences,
val key: String,
val defValue: T
) {
private var lastValue: T? = null
var onPreferenceChangedListener: OnSharedPreferenceChangeListener? = null
private set
abstract fun getValue(): T
fun toObservable(): Observable<T> = Observable
.create<T> { it.prepareObservable() }
.doOnDispose { onDispose() }
.replay(1)
.refCount()
@VisibleForTesting
private fun ObservableEmitter<T>.prepareObservable() {
try {
preferences.registerOnSharedPreferenceChangeListener(
createOnPreferenceChangedListener(this)
)
emitValue()
} catch (e: Exception) {
onError(e)
onDispose()
}
}
private fun createOnPreferenceChangedListener(emitter: Emitter<T>) =
OnSharedPreferenceChangeListener { _, key ->
if (this.key == key) {
emitter.emitValue()
}
}.also {
onPreferenceChangedListener = it
}
private fun Emitter<T>.emitValue() {
val currentValue = getValue()
if (lastValue == currentValue) {
return
}
lastValue = currentValue
onNext(currentValue)
}
private fun onDispose() {
preferences.unregisterOnSharedPreferenceChangeListener(onPreferenceChangedListener)
onPreferenceChangedListener = null
}
}
| 26.893939 | 91 | 0.647887 |
c8557c0781bf0605275a8b9ec989f77742a04e00
| 392 |
rs
|
Rust
|
src/conf.rs
|
sdleffler/sludge
|
3f3420c03dede328f59b4f8e0a604643ccca8ea1
|
[
"MIT"
] | 5 |
2020-10-11T05:56:21.000Z
|
2021-01-30T21:40:58.000Z
|
src/conf.rs
|
maximveligan/sludge
|
a01d883ab432ef318f059ecad9ec476cc7af2fd6
|
[
"MIT"
] | 2 |
2020-11-03T03:31:54.000Z
|
2020-11-03T03:33:06.000Z
|
src/conf.rs
|
maximveligan/sludge
|
a01d883ab432ef318f059ecad9ec476cc7af2fd6
|
[
"MIT"
] | 1 |
2020-11-02T07:31:44.000Z
|
2020-11-02T07:31:44.000Z
|
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Conf {
pub window_title: String,
pub window_width: u32,
pub window_height: u32,
}
impl Default for Conf {
fn default() -> Self {
Self {
window_title: "SLUDGE \\m/".to_string(),
window_width: 800,
window_height: 680,
}
}
}
| 20.631579 | 52 | 0.584184 |
fc4ea184306b1b47b4e37574fd9c552868421f70
| 1,224 |
swift
|
Swift
|
Carthage/Checkouts/rxtfl/RxTfL/Classes/Swaggers/Models/Ticket.swift
|
simonrice/TVTubeStatus
|
247ade5bd584764000ba11b1cc0f9c5f84d47770
|
[
"MIT"
] | 1 |
2017-07-16T16:48:11.000Z
|
2017-07-16T16:48:11.000Z
|
Carthage/Checkouts/rxtfl/RxTfL/Classes/Swaggers/Models/Ticket.swift
|
simonrice/TVTubeStatus
|
247ade5bd584764000ba11b1cc0f9c5f84d47770
|
[
"MIT"
] | null | null | null |
Carthage/Checkouts/rxtfl/RxTfL/Classes/Swaggers/Models/Ticket.swift
|
simonrice/TVTubeStatus
|
247ade5bd584764000ba11b1cc0f9c5f84d47770
|
[
"MIT"
] | null | null | null |
//
// Ticket.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
open class Ticket: JSONEncodable {
public var passengerType: String?
public var ticketType: TicketType?
public var ticketTime: TicketTime?
public var cost: String?
public var description: String?
public var mode: String?
public var displayOrder: Int32?
public var messages: [Message]?
public init() {}
// MARK: JSONEncodable
open func encodeToJSON() -> Any {
var nillableDictionary = [String:Any?]()
nillableDictionary["passengerType"] = self.passengerType
nillableDictionary["ticketType"] = self.ticketType?.encodeToJSON()
nillableDictionary["ticketTime"] = self.ticketTime?.encodeToJSON()
nillableDictionary["cost"] = self.cost
nillableDictionary["description"] = self.description
nillableDictionary["mode"] = self.mode
nillableDictionary["displayOrder"] = self.displayOrder?.encodeToJSON()
nillableDictionary["messages"] = self.messages?.encodeToJSON()
let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:]
return dictionary
}
}
| 30.6 | 85 | 0.686275 |
71840b439145aa69fb257afa0a478ce1f121aafc
| 2,308 |
kt
|
Kotlin
|
app/src/main/java/com/gamerguide/android/starterapp/MainActivity.kt
|
jeevakalaiselvam/android-kotlin-guide-configchange
|
98f775a350e5ff72045dae8037c8fbd70f3804da
|
[
"Apache-2.0"
] | null | null | null |
app/src/main/java/com/gamerguide/android/starterapp/MainActivity.kt
|
jeevakalaiselvam/android-kotlin-guide-configchange
|
98f775a350e5ff72045dae8037c8fbd70f3804da
|
[
"Apache-2.0"
] | null | null | null |
app/src/main/java/com/gamerguide/android/starterapp/MainActivity.kt
|
jeevakalaiselvam/android-kotlin-guide-configchange
|
98f775a350e5ff72045dae8037c8fbd70f3804da
|
[
"Apache-2.0"
] | null | null | null |
package com.gamerguide.android.starterapp
import android.content.Context
import android.content.res.Configuration
import androidx.appcompat.app.AppCompatActivity
import com.gamerguide.android.starterapp.helpers.BlurHelper
import io.github.inflationx.viewpump.ViewPumpContextWrapper
import android.os.Bundle
import android.widget.ImageView
import android.widget.Toast
import com.gamerguide.android.starterapp.databinding.ActivityMainBinding
import io.github.inflationx.viewpump.ViewPump
import io.github.inflationx.calligraphy3.CalligraphyInterceptor
import io.github.inflationx.calligraphy3.CalligraphyConfig
class MainActivity : AppCompatActivity() {
private var background: ImageView? = null
private var blurHelper: BlurHelper? = null
private lateinit var binding: ActivityMainBinding
override fun attachBaseContext(newBase: Context) {
super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase))
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
ViewPump.init(
ViewPump.builder()
.addInterceptor(
CalligraphyInterceptor(
CalligraphyConfig.Builder()
.setDefaultFontPath("fonts/sourcesanspro.ttf")
.setFontAttrId(R.attr.fontPath)
.build()
)
)
.build()
)
binding = ActivityMainBinding.inflate(layoutInflater)
val view = binding.root
setContentView(view)
blurHelper = BlurHelper()
background = findViewById(R.id.background)
blurHelper!!.setupImageBlurBackground(this, background!!)
binding.title.text = "Config Change Checker"
binding.data.text = "Portrait Orientation"
}
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
// Checks the orientation of the screen
if (newConfig.orientation === Configuration.ORIENTATION_LANDSCAPE) {
binding.data.text = "Landscape Orientation"
} else if (newConfig.orientation === Configuration.ORIENTATION_PORTRAIT) {
binding.data.text = "Portrait Orientation"
}
}
}
| 35.507692 | 82 | 0.684142 |
38d834ef6bb66111cdb5de6c43becce3b3a3d85c
| 4,437 |
h
|
C
|
qemu-4.2.0/target/hppa/helper.h
|
MisaZhu/qemu_raspi
|
50d71ce87bb39470e6725f7428e4b6b9e1ed0359
|
[
"Apache-2.0"
] | 8 |
2020-09-06T12:49:00.000Z
|
2022-03-09T04:02:06.000Z
|
src/qemu/src-pmp/target/hppa/helper.h
|
newthis/PMP
|
ef5e05fb4612bb622a9e1039f772c6234b87df7d
|
[
"MIT"
] | null | null | null |
src/qemu/src-pmp/target/hppa/helper.h
|
newthis/PMP
|
ef5e05fb4612bb622a9e1039f772c6234b87df7d
|
[
"MIT"
] | 7 |
2020-09-08T15:14:34.000Z
|
2021-06-24T18:03:49.000Z
|
#if TARGET_REGISTER_BITS == 64
# define dh_alias_tr i64
# define dh_is_64bit_tr 1
#else
# define dh_alias_tr i32
# define dh_is_64bit_tr 0
#endif
#define dh_ctype_tr target_ureg
#define dh_is_signed_tr 0
DEF_HELPER_2(excp, noreturn, env, int)
DEF_HELPER_FLAGS_2(tsv, TCG_CALL_NO_WG, void, env, tr)
DEF_HELPER_FLAGS_2(tcond, TCG_CALL_NO_WG, void, env, tr)
DEF_HELPER_FLAGS_3(stby_b, TCG_CALL_NO_WG, void, env, tl, tr)
DEF_HELPER_FLAGS_3(stby_b_parallel, TCG_CALL_NO_WG, void, env, tl, tr)
DEF_HELPER_FLAGS_3(stby_e, TCG_CALL_NO_WG, void, env, tl, tr)
DEF_HELPER_FLAGS_3(stby_e_parallel, TCG_CALL_NO_WG, void, env, tl, tr)
DEF_HELPER_FLAGS_4(probe, TCG_CALL_NO_WG, tr, env, tl, i32, i32)
DEF_HELPER_FLAGS_1(loaded_fr0, TCG_CALL_NO_RWG, void, env)
DEF_HELPER_FLAGS_2(fsqrt_s, TCG_CALL_NO_RWG, f32, env, f32)
DEF_HELPER_FLAGS_2(frnd_s, TCG_CALL_NO_RWG, f32, env, f32)
DEF_HELPER_FLAGS_3(fadd_s, TCG_CALL_NO_RWG, f32, env, f32, f32)
DEF_HELPER_FLAGS_3(fsub_s, TCG_CALL_NO_RWG, f32, env, f32, f32)
DEF_HELPER_FLAGS_3(fmpy_s, TCG_CALL_NO_RWG, f32, env, f32, f32)
DEF_HELPER_FLAGS_3(fdiv_s, TCG_CALL_NO_RWG, f32, env, f32, f32)
DEF_HELPER_FLAGS_2(fsqrt_d, TCG_CALL_NO_RWG, f64, env, f64)
DEF_HELPER_FLAGS_2(frnd_d, TCG_CALL_NO_RWG, f64, env, f64)
DEF_HELPER_FLAGS_3(fadd_d, TCG_CALL_NO_RWG, f64, env, f64, f64)
DEF_HELPER_FLAGS_3(fsub_d, TCG_CALL_NO_RWG, f64, env, f64, f64)
DEF_HELPER_FLAGS_3(fmpy_d, TCG_CALL_NO_RWG, f64, env, f64, f64)
DEF_HELPER_FLAGS_3(fdiv_d, TCG_CALL_NO_RWG, f64, env, f64, f64)
DEF_HELPER_FLAGS_2(fcnv_s_d, TCG_CALL_NO_RWG, f64, env, f32)
DEF_HELPER_FLAGS_2(fcnv_d_s, TCG_CALL_NO_RWG, f32, env, f64)
DEF_HELPER_FLAGS_2(fcnv_w_s, TCG_CALL_NO_RWG, f32, env, s32)
DEF_HELPER_FLAGS_2(fcnv_dw_s, TCG_CALL_NO_RWG, f32, env, s64)
DEF_HELPER_FLAGS_2(fcnv_w_d, TCG_CALL_NO_RWG, f64, env, s32)
DEF_HELPER_FLAGS_2(fcnv_dw_d, TCG_CALL_NO_RWG, f64, env, s64)
DEF_HELPER_FLAGS_2(fcnv_s_w, TCG_CALL_NO_RWG, s32, env, f32)
DEF_HELPER_FLAGS_2(fcnv_d_w, TCG_CALL_NO_RWG, s32, env, f64)
DEF_HELPER_FLAGS_2(fcnv_s_dw, TCG_CALL_NO_RWG, s64, env, f32)
DEF_HELPER_FLAGS_2(fcnv_d_dw, TCG_CALL_NO_RWG, s64, env, f64)
DEF_HELPER_FLAGS_2(fcnv_t_s_w, TCG_CALL_NO_RWG, s32, env, f32)
DEF_HELPER_FLAGS_2(fcnv_t_d_w, TCG_CALL_NO_RWG, s32, env, f64)
DEF_HELPER_FLAGS_2(fcnv_t_s_dw, TCG_CALL_NO_RWG, s64, env, f32)
DEF_HELPER_FLAGS_2(fcnv_t_d_dw, TCG_CALL_NO_RWG, s64, env, f64)
DEF_HELPER_FLAGS_2(fcnv_uw_s, TCG_CALL_NO_RWG, f32, env, i32)
DEF_HELPER_FLAGS_2(fcnv_udw_s, TCG_CALL_NO_RWG, f32, env, i64)
DEF_HELPER_FLAGS_2(fcnv_uw_d, TCG_CALL_NO_RWG, f64, env, i32)
DEF_HELPER_FLAGS_2(fcnv_udw_d, TCG_CALL_NO_RWG, f64, env, i64)
DEF_HELPER_FLAGS_2(fcnv_s_uw, TCG_CALL_NO_RWG, i32, env, f32)
DEF_HELPER_FLAGS_2(fcnv_d_uw, TCG_CALL_NO_RWG, i32, env, f64)
DEF_HELPER_FLAGS_2(fcnv_s_udw, TCG_CALL_NO_RWG, i64, env, f32)
DEF_HELPER_FLAGS_2(fcnv_d_udw, TCG_CALL_NO_RWG, i64, env, f64)
DEF_HELPER_FLAGS_2(fcnv_t_s_uw, TCG_CALL_NO_RWG, i32, env, f32)
DEF_HELPER_FLAGS_2(fcnv_t_d_uw, TCG_CALL_NO_RWG, i32, env, f64)
DEF_HELPER_FLAGS_2(fcnv_t_s_udw, TCG_CALL_NO_RWG, i64, env, f32)
DEF_HELPER_FLAGS_2(fcnv_t_d_udw, TCG_CALL_NO_RWG, i64, env, f64)
DEF_HELPER_FLAGS_5(fcmp_s, TCG_CALL_NO_RWG, void, env, f32, f32, i32, i32)
DEF_HELPER_FLAGS_5(fcmp_d, TCG_CALL_NO_RWG, void, env, f64, f64, i32, i32)
DEF_HELPER_FLAGS_4(fmpyfadd_s, TCG_CALL_NO_RWG, i32, env, i32, i32, i32)
DEF_HELPER_FLAGS_4(fmpynfadd_s, TCG_CALL_NO_RWG, i32, env, i32, i32, i32)
DEF_HELPER_FLAGS_4(fmpyfadd_d, TCG_CALL_NO_RWG, i64, env, i64, i64, i64)
DEF_HELPER_FLAGS_4(fmpynfadd_d, TCG_CALL_NO_RWG, i64, env, i64, i64, i64)
DEF_HELPER_FLAGS_0(read_interval_timer, TCG_CALL_NO_RWG, tr)
#ifndef CONFIG_USER_ONLY
DEF_HELPER_1(halt, noreturn, env)
DEF_HELPER_1(reset, noreturn, env)
DEF_HELPER_1(rfi, void, env)
DEF_HELPER_1(rfi_r, void, env)
DEF_HELPER_FLAGS_2(write_interval_timer, TCG_CALL_NO_RWG, void, env, tr)
DEF_HELPER_FLAGS_2(write_eirr, TCG_CALL_NO_RWG, void, env, tr)
DEF_HELPER_FLAGS_2(write_eiem, TCG_CALL_NO_RWG, void, env, tr)
DEF_HELPER_FLAGS_2(swap_system_mask, TCG_CALL_NO_RWG, tr, env, tr)
DEF_HELPER_FLAGS_3(itlba, TCG_CALL_NO_RWG, void, env, tl, tr)
DEF_HELPER_FLAGS_3(itlbp, TCG_CALL_NO_RWG, void, env, tl, tr)
DEF_HELPER_FLAGS_2(ptlb, TCG_CALL_NO_RWG, void, env, tl)
DEF_HELPER_FLAGS_1(ptlbe, TCG_CALL_NO_RWG, void, env)
DEF_HELPER_FLAGS_2(lpa, TCG_CALL_NO_WG, tr, env, tl)
DEF_HELPER_FLAGS_1(change_prot_id, TCG_CALL_NO_RWG, void, env)
#endif
| 45.742268 | 74 | 0.806851 |
b18bdaaf2161c9d3e5b304ec68d5693505cd1a43
| 1,975 |
asm
|
Assembly
|
tests/assembly/LDY.asm
|
danecreekphotography/6502ts
|
85716cf12f879d7c16c297de3251888c32abba6a
|
[
"MIT"
] | null | null | null |
tests/assembly/LDY.asm
|
danecreekphotography/6502ts
|
85716cf12f879d7c16c297de3251888c32abba6a
|
[
"MIT"
] | null | null | null |
tests/assembly/LDY.asm
|
danecreekphotography/6502ts
|
85716cf12f879d7c16c297de3251888c32abba6a
|
[
"MIT"
] | null | null | null |
; Verifies LDY with all applicable addressing modes
.segment "VECTORS"
.word $eaea
.word init
.word $eaea
.segment "ZEROPAGE"
; Used for zero page address mode testing
zp:
.byte $00 ; Padding so remaining bytes can be accessed in zeropage plus tests
.byte $42 ; Positive
.byte $00 ; Zero
.byte %10010101 ; Negative
; Used for indirect x address mode testing
indirectX:
.byte $00 ; Padding so addresses can be accessed in plus x tests.
.word data + $01 ; Start of actual test data
.word data + $02 ; Zero
.word data + $03 ; Negative
; Used for indirect y address mode testing
indirectY:
.word data ; Address of the actual test data start location
.word data + $FF ; Used for the page boundary test
.data
data:
.byte $00 ; Padding so remaining bytes can be accessed in absolute plus tests
.byte $42 ; Positive
.byte $00 ; Zero
.byte %10010101 ; Negative
; Implicit here is that memory location data + $FF + $02 will be pre-filled with zeros.
; That location gets used to confirm the cycle count it takes to do an indirect Y
; across a page boundary.
.code
init:
; Immediate.
ldy #$42 ; Positive
ldy #$00 ; Zero
ldy #%10010101 ; Negative
; Zeropage. Starts with +1 to skip padding.
ldy zp + $01 ; Positive
ldy zp + $02 ; Zero
ldy zp + $03 ; Negative
; Zeropage plus X. X will be $01
ldy zp,x ; Positive
ldy zp + $01,x ; Zero
ldy zp + $02,x ; Negative
; Absolute. Starts with +1 to skip padding.
ldy data + $01 ; Positive
ldy data + $02 ; Zero
ldy data + $03 ; Negative
; Absolute plus X. X will be $01.
ldy data,x ; Positive
ldy data + $01,x ; Zero
ldy data + $02,x ; Negative
ldy data - $01,x ; Positive across page boundary, y will be $02.
ldy data - $01,x ; Zero across page boundary, y will be $03.
| 28.623188 | 87 | 0.611139 |
540d5e2ffe2f034cfa01b578802d329153d785b3
| 990 |
go
|
Go
|
pkg/apis/ignite/scheme/scheme.go
|
sftim/ignite
|
e612ef77b9fa92495917f23d43b282488fbf42e7
|
[
"Apache-2.0"
] | null | null | null |
pkg/apis/ignite/scheme/scheme.go
|
sftim/ignite
|
e612ef77b9fa92495917f23d43b282488fbf42e7
|
[
"Apache-2.0"
] | null | null | null |
pkg/apis/ignite/scheme/scheme.go
|
sftim/ignite
|
e612ef77b9fa92495917f23d43b282488fbf42e7
|
[
"Apache-2.0"
] | 1 |
2021-04-05T13:10:51.000Z
|
2021-04-05T13:10:51.000Z
|
package scheme
import (
"k8s.io/apimachinery/pkg/runtime"
k8sserializer "k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
api "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1"
"github.com/weaveworks/ignite/pkg/storage/serializer"
)
var (
// Scheme is the runtime.Scheme to which all types are registered.
Scheme = runtime.NewScheme()
// codecs provides access to encoding and decoding for the scheme.
// codecs is private, as Serializer will be used for all higher-level encoding/decoding
codecs = k8sserializer.NewCodecFactory(Scheme)
// Serializer provides high-level encoding/decoding functions
Serializer = serializer.NewSerializer(Scheme, &codecs)
)
func init() {
AddToScheme(Scheme)
}
// AddToScheme builds the scheme using all known versions of the api.
func AddToScheme(scheme *runtime.Scheme) {
utilruntime.Must(api.AddToScheme(Scheme))
utilruntime.Must(scheme.SetVersionPriority(api.SchemeGroupVersion))
}
| 30 | 88 | 0.785859 |
d49c2040de63ccc8d394b63922661e01b298c4f9
| 7,091 |
asm
|
Assembly
|
bootloader/boot.asm
|
KeeProMise/KePOS
|
0d26a46bfb5ef6514fe59261e4864c935a6fd614
|
[
"Apache-2.0"
] | 72 |
2021-04-20T11:36:21.000Z
|
2022-01-26T15:00:29.000Z
|
bootloader/boot.asm
|
buger-beep/KePOS
|
9573946fce57da54f1ee89af1551fba0fb821d31
|
[
"Apache-2.0"
] | null | null | null |
bootloader/boot.asm
|
buger-beep/KePOS
|
9573946fce57da54f1ee89af1551fba0fb821d31
|
[
"Apache-2.0"
] | 2 |
2021-04-21T16:07:41.000Z
|
2021-07-12T08:35:13.000Z
|
;KePOS boot程序
org 0x7c00
BaseOfStack equ 0x7c00
BaseOfLoader equ 0x1000 ;设置loader.bin代码的起始物理地址
OffsetOfLoader equ 0x00
;=========================软盘文件系统(FAT12)相关数据====================================================
RootDirSectors equ 14 ;软盘根目录占14个扇区
SectorNumOfRootDirStart equ 19 ;根目录的开始扇区号
SectorNumOfFAT1Start equ 1 ;FAT1表的开始扇区号
SectorBalance equ 17 ;FAT表中的簇号(软盘每簇1个扇区)和数据区扇区号的对应关系----->簇号+SectorBalance+RootDirSectors=扇区号
jmp short Label_Start
nop
BS_OEMName db 'KePOSFAT'
BPB_BytesPerSec dw 512
BPB_SecPerClus db 1
BPB_RsvdSecCnt dw 1
BPB_NumFATs db 2
BPB_RootEntCnt dw 224
BPB_TotSec16 dw 2880
BPB_Media db 0xf0
BPB_FATSz16 dw 9
BPB_SecPerTrk dw 18
BPB_NumHeads dw 2
BPB_HiddSec dd 0
BPB_TotSec32 dd 0
BS_DrvNum db 0
BS_Reserved1 db 0
BS_BootSig db 0x29
BS_VolID dd 0
BS_VolLab db 'boot loader'
BS_FileSysType db 'FAT12 '
Label_Start:
;初始化cs,ds,es,ss,sp寄存器值
mov ax, cs
mov ds, ax ;ds,es,ss=0
mov es, ax
mov ss, ax
mov sp, BaseOfStack ;sp=7c00H
;======= clear screen
mov ax, 0600h
mov bx, 0700h
mov cx, 0
mov dx, 0184fh
int 10h
;======= set focus,焦点位于(0,0)
mov ax, 0200h
mov bx, 0000h
mov dx, 0000h
int 10h
call Lable_Show_Start_boot ;显示 [KePOS]: Start Boot
;======= reset floppy
xor ah, ah
xor dl, dl
int 13h
;======= search loader.bin==========================================================================================
mov word [SectorNo], SectorNumOfRootDirStart ;SectorNo变量保存:根目录的开始扇区;该变量保存根目录当前被读取的扇区号
;在根目录中查找文件
Lable_Search_In_Root_Dir_Begin:
cmp word [RootDirSizeForLoop], 0 ;变量RootDirSizeForLoop保存根目录包含的扇区数
jz Label_No_LoaderBin ;遍历每个根目录扇区,如果没有找到loader.bin则跳到Label_No_LoaderBin
dec word [RootDirSizeForLoop]
mov ax, 00h
mov es, ax
mov bx, 8000h ;Func_ReadOneSector参数->[es:bx]-扇区加载到内存的地址
mov ax, [SectorNo] ;Func_ReadOneSector参数->ax-查找的扇区号
mov cl, 1 ;Func_ReadOneSector参数->cl-一次从磁盘取几个扇区
call Func_ReadOneSector ;将上述参数传给Func_ReadOneSector函数
mov si, LoaderFileName ;将加载的文件名字首地址保存在si中
mov di, 8000h ;di设置为刚读取的扇区所在的内存开始地址
cld ;将DF设置为0,则lodsb指令会使得si自动增加
mov dx, 10h ;每个扇区可容纳的目录项个数(512 / 32 = 16 = 0x10)
;在某个目录项中寻找该文件
Label_Search_For_LoaderBin:
cmp dx, 0
jz Label_Goto_Next_Sector_In_Root_Dir ;如该扇区所有的目录项中都不包括待加载的文件名字,则读取下一个扇区
dec dx
mov cx, 11 ;FAT12目录项中,文件占据11个字节:文件名(8B),文件后缀(3B)
;比较某个目录项中是否有上述的文件
Label_Cmp_FileName:
cmp cx, 0
jz Label_FileName_Found ;有则跳转到Label_FileName_Found
dec cx
lodsb ;从[DS:(R|E)SI]寄存器指定的内存地址中读取数据到AL寄存器,因为DF=0,读完一个字节给si+1
cmp al, byte [es:di] ;比较是否相等
jz Label_Go_On ;相等则继续读取下一个字节比较,调用Label_Go_On
jmp Label_Different
Label_Go_On:
inc di
jmp Label_Cmp_FileName
Label_Different:
and di, 0ffe0h ;目录项大小是32B,将di对齐到该目录项开始地址处
add di, 20h ;将di+32指向下一个目录项开始地址
mov si, LoaderFileName ;重新设置si指向文件名的开始地址
jmp Label_Search_For_LoaderBin ;在下一个目录项中寻找该文件
;读取根目录的下一个扇区
Label_Goto_Next_Sector_In_Root_Dir:
add word [SectorNo], 1 ;扇区号加1
jmp Lable_Search_In_Root_Dir_Begin
;======= found loader.bin name in root director struct
Label_FileName_Found:
mov ax, RootDirSectors ;ax=根目录占的扇区数
and di, 0ffe0h ;对齐di到该目录项的开始地址
add di, 01ah ;簇号在目录项的1aH偏移处,di->簇号
mov cx, word [es:di] ;将簇号保存在cx中
push cx ;将开始簇号保存在栈中
;簇号+SectorBalance+RootDirSectors=数据区扇区号
add cx, ax
add cx, SectorBalance
;设置loader.bin文件的内存物理地址[es:bx]=10000H
mov ax, BaseOfLoader ;加载该文件到内存的段值
mov es, ax
mov bx, OffsetOfLoader ;加载该文件到内存的偏移值
mov ax, cx
;加载文件到内存(ax->文件所在开始扇区号,[es:bx]->加载到的内存地址)
Label_Go_On_Loading_File:
push ax
push bx
call Label_Show_Point ;调用前保存ax,和bx的值到栈中
pop bx
pop ax
mov cl, 1
call Func_ReadOneSector
pop ax ;之前保存在栈中的簇号
call Func_GetFATEntry ;调用Func_GetFATEntry获取下一个簇号,返回值->ax
cmp ax, 0fffh ;FAT12,簇号为0fffH,表示文件读取完成
jz Label_File_Loaded
push ax ;将簇号保存在栈中
mov dx, RootDirSectors
add ax, dx
add ax, SectorBalance
add bx, [BPB_BytesPerSec]
jmp Label_Go_On_Loading_File
;loader.bin文件加载完成,跳转到loader程序
Label_File_Loaded:
jmp BaseOfLoader:OffsetOfLoader ;跳转到loader.bin程序
;======= display on screen : ERROR:No LOADER Found
Label_No_LoaderBin:
mov ax, 1301h
mov bx, 008ch
mov dx, 0100h ;1行,0列
mov cx, 23
push ax
mov ax, ds
mov es, ax
pop ax
mov bp, NoLoaderMessage
int 10h
jmp $
;======= fun 调用=======================================================================
;======= display on screen : [KePOS] Start Booting......
Label_Show_Point: ;在当前光标位置显示".",显示后光标后移
mov ah, 0eh
mov al, '.'
mov bl, 0fh
int 10h
ret
Lable_Show_Start_boot:
mov ax, 1301h
mov bx, 000fh
mov dx, 0000h ;0行,0列
mov cx, 19
push ax
mov ax, ds
mov es, ax
pop ax
mov bp, StartBootMessage
int 10h
ret
;======= read one sector from floppy
Func_ReadOneSector:
;将LBA(Logical Block Address逻辑块寻址->转成->CHS(Cylinder/Head/Sector,柱面/磁头/扇区)格式的磁盘扇区号。
push bp
mov bp, sp
sub esp, 2
mov byte [bp - 2], cl
push bx
mov bl, [BPB_SecPerTrk]
div bl
inc ah
mov cl, ah
mov dh, al
shr al, 1
mov ch, al
and dh, 1
pop bx
mov dl, [BS_DrvNum]
;地上转换完成,调用int 13h中断,读取一个扇区
Label_Go_On_Reading:
mov ah, 2
mov al, byte [bp - 2]
int 13h
jc Label_Go_On_Reading
add esp, 2
pop bp
ret
;======= get FAT Entry
Func_GetFATEntry:
push es
push bx
push ax
mov ax, 00
mov es, ax
pop ax
mov byte [Odd], 0
mov bx, 3
mul bx
mov bx, 2
div bx
cmp dx, 0
jz Label_Even
mov byte [Odd], 1
Label_Even:
xor dx, dx
mov bx, [BPB_BytesPerSec]
div bx
push dx
mov bx, 8000h
add ax, SectorNumOfFAT1Start
mov cl, 2
call Func_ReadOneSector
pop dx
add bx, dx
mov ax, [es:bx]
cmp byte [Odd], 1
jnz Label_Even_2
shr ax, 4
Label_Even_2:
and ax, 0fffh
pop bx
pop es
ret
;======= tmp variable
RootDirSizeForLoop dw RootDirSectors
SectorNo dw 0
Odd db 0
;======= display messages==============================================================
StartBootMessage: db "[KePOS.boot]: Start"
NoLoaderMessage: db "ERROR:Can't find loader"
LoaderFileName: db "LOADER BIN",0
;======= fill zero until whole sector
times 510 - ($ - $$) db 0
dw 0xaa55
| 23.795302 | 116 | 0.584826 |
59a01a286eccdf4282daef3f30984988db0571aa
| 190 |
swift
|
Swift
|
SimpleRollCall/Starter/CalHacksDemo/Roll Call/ResultVC.swift
|
marcowmonfiglio/MDB
|
4b8315dd1b7f89cae9d18e6c5c28b174c9dbc132
|
[
"MIT"
] | null | null | null |
SimpleRollCall/Starter/CalHacksDemo/Roll Call/ResultVC.swift
|
marcowmonfiglio/MDB
|
4b8315dd1b7f89cae9d18e6c5c28b174c9dbc132
|
[
"MIT"
] | null | null | null |
SimpleRollCall/Starter/CalHacksDemo/Roll Call/ResultVC.swift
|
marcowmonfiglio/MDB
|
4b8315dd1b7f89cae9d18e6c5c28b174c9dbc132
|
[
"MIT"
] | null | null | null |
//
// ResultVC.swift
// CalHacksDemo
//
// Created by Michael Lin on 8/26/20.
// Copyright © 2020 Michael Lin. All rights reserved.
//
import UIKit
class ResultVC: UIViewController {}
| 15.833333 | 54 | 0.689474 |
6bb8b2866f1333888e6dfe2b4841f734147091be
| 799 |
h
|
C
|
EUCBaseUI.framework/Headers/OKAAlbumController.h
|
TyhGB/EUCBaseUI
|
55ab8b2a0d0789182cd9eb75b9ef04c1f2449349
|
[
"MIT"
] | null | null | null |
EUCBaseUI.framework/Headers/OKAAlbumController.h
|
TyhGB/EUCBaseUI
|
55ab8b2a0d0789182cd9eb75b9ef04c1f2449349
|
[
"MIT"
] | null | null | null |
EUCBaseUI.framework/Headers/OKAAlbumController.h
|
TyhGB/EUCBaseUI
|
55ab8b2a0d0789182cd9eb75b9ef04c1f2449349
|
[
"MIT"
] | null | null | null |
//
// OKAAlbumController.h
// OKAPhotosDemo
//
// Created by XXL on 2017/9/5.
// Copyright © 2017年 EasyMoveMobile. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSUInteger, OKAFetchMediaType) {
OKAFetchMediaTypeAll = 0,
OKAFetchMediaTypeImage = 1,
OKAFetchMediaTypeVideo = 2,
OKAFetchMediaTypeAudio = 3,
};
@class OKAAlbumController;
@class OKAAlbumModel;
@class OKAPhotoController;
// 相册代理
@protocol OKAAlbumControllerDelegate <NSObject>
// 提供这个代理的目的在于可能 OKAPhotoController 可能需要创建子类
@required
- (OKAPhotoController *)photoControllerForAlbumController;
@end
@interface OKAAlbumController : UIViewController
@property (nonatomic, weak) id<OKAAlbumControllerDelegate> delegate;
@property (nonatomic, assign) OKAFetchMediaType fetchMediaType;
@end
| 21.026316 | 68 | 0.767209 |
661d6011a672929214c498b81420162f5c35da33
| 304 |
swift
|
Swift
|
VirtualTrainR/ViewController.swift
|
anthonyApptist/VirtualTrainR
|
d1b8cbb21473dd7f28321e43ace82c8e091adddc
|
[
"Apache-2.0"
] | null | null | null |
VirtualTrainR/ViewController.swift
|
anthonyApptist/VirtualTrainR
|
d1b8cbb21473dd7f28321e43ace82c8e091adddc
|
[
"Apache-2.0"
] | null | null | null |
VirtualTrainR/ViewController.swift
|
anthonyApptist/VirtualTrainR
|
d1b8cbb21473dd7f28321e43ace82c8e091adddc
|
[
"Apache-2.0"
] | null | null | null |
//
// ViewController.swift
// VirtualTrainr
//
// Created by Mark Meritt on 2017-06-14.
// Copyright © 2017 Apptist. All rights reserved.
//
import Foundation
import UIKit
class ViewController : UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
}
| 16 | 50 | 0.654605 |
06c5848c38531f385240077e7c7ffaa430195943
| 207 |
swift
|
Swift
|
SwiftSpriter/Classes/SpriteAnimationNode.swift
|
lumenlunae/SwiftSpriter
|
ee727480e9da3ab3880637d656f8ae8b41fb109a
|
[
"MIT"
] | null | null | null |
SwiftSpriter/Classes/SpriteAnimationNode.swift
|
lumenlunae/SwiftSpriter
|
ee727480e9da3ab3880637d656f8ae8b41fb109a
|
[
"MIT"
] | null | null | null |
SwiftSpriter/Classes/SpriteAnimationNode.swift
|
lumenlunae/SwiftSpriter
|
ee727480e9da3ab3880637d656f8ae8b41fb109a
|
[
"MIT"
] | null | null | null |
//
// SpriteAnimationNode.swift
// Pods
//
// Created by Matt on 9/24/16.
//
//
import Foundation
import SpriteKit
public class SpriteAnimationNode: SKSpriteNode {
public var textureName: String?
}
| 13.8 | 48 | 0.710145 |
3dda62974b7b52e672bf658ed50752c91157cbb9
| 4,524 |
rs
|
Rust
|
src/lib.rs
|
DrChat/rust-cab
|
e58c22316d10ca6aa37d17406e660fb708d0bc88
|
[
"MIT"
] | 6 |
2019-12-06T05:16:58.000Z
|
2021-09-21T11:47:25.000Z
|
src/lib.rs
|
DrChat/rust-cab
|
e58c22316d10ca6aa37d17406e660fb708d0bc88
|
[
"MIT"
] | 7 |
2018-09-01T21:54:49.000Z
|
2022-03-22T21:24:28.000Z
|
src/lib.rs
|
DrChat/rust-cab
|
e58c22316d10ca6aa37d17406e660fb708d0bc88
|
[
"MIT"
] | 7 |
2018-09-21T06:28:35.000Z
|
2022-03-15T09:32:27.000Z
|
//! A library for reading/writing [Windows
//! cabinet](https://en.wikipedia.org/wiki/Cabinet_(file_format)) (CAB) files.
//!
//! # Overview
//!
//! CAB is an archive file format used by Windows. A cabinet file can contain
//! multiple compressed files, which are divided into "folders" (no relation to
//! filesystem folders/directories); files in the same folder are compressed
//! together, and each folder in the cabinet can potentially use a different
//! compression scheme. The CAB file format supports multiple different
//! compression schemes; this library can recognize all of them when reading
//! metadata for an existing cabinet file, but currently only supports
//! encoding/decoding some of them, as shown:
//!
//! | Compression | Supported |
//! |----------------------------|-------------------|
//! | Uncompressed | Yes |
//! | MSZIP ([Deflate][deflate]) | Yes |
//! | [Quantum][quantum] | No |
//! | [LZX][lzx] | Yes (decode only) |
//!
//! [deflate]: https://en.wikipedia.org/wiki/DEFLATE
//! [quantum]: https://en.wikipedia.org/wiki/Quantum_compression
//! [lzx]: https://en.wikipedia.org/wiki/LZX_(algorithm)
//!
//! # Example usage
//!
//! Use the `Cabinet` type to read an existing cabinet file:
//!
//! ```no_run
//! use cab;
//! use std::fs;
//! use std::io;
//!
//! let cab_file = fs::File::open("path/to/cabinet.cab").unwrap();
//! let mut cabinet = cab::Cabinet::new(cab_file).unwrap();
//! // List all files in the cabinet, with file sizes and compression types:
//! for folder in cabinet.folder_entries() {
//! for file in folder.file_entries() {
//! println!("File {} ({} B) is compressed with {:?}",
//! file.name(),
//! file.uncompressed_size(),
//! folder.compression_type());
//! }
//! }
//! // Decompress a particular file in the cabinet and save it to disk:
//! let mut reader = cabinet.read_file("images/example.png").unwrap();
//! let mut writer = fs::File::create("out/example.png").unwrap();
//! io::copy(&mut reader, &mut writer).unwrap();
//! ```
//!
//! Creating a new cabinet file is a little more involved. Because of how the
//! cabinet file is structured on disk, the library has to know the names of
//! all the files that will be in the cabinet up front, before it can start
//! writing anything to disk. However, we don't want to have to hold all the
//! file **contents** in memory at once. Therefore, cabinet creation happens
//! in two steps: first, create a `CabinetBuilder` and specify all filenames
//! and other metadata, and then second, stream each file's data into a
//! `CabinetWriter`, one at a time:
//!
//! ```no_run
//! use cab;
//! use std::fs;
//! use std::io;
//!
//! let mut cab_builder = cab::CabinetBuilder::new();
//! // Add a single file in its own folder:
//! cab_builder.add_folder(cab::CompressionType::None).add_file("img/foo.jpg");
//! // Add several more files, compressed together in a second folder:
//! {
//! let folder = cab_builder.add_folder(cab::CompressionType::MsZip);
//! folder.add_file("documents/README.txt");
//! folder.add_file("documents/license.txt");
//! // We can also specify metadata on individual files:
//! {
//! let file = folder.add_file("documents/hidden.txt");
//! file.set_is_hidden(true);
//! file.set_is_read_only(true);
//! }
//! }
//! // Now, we'll actually construct the cabinet file on disk:
//! let cab_file = fs::File::create("path/to/cabinet.cab").unwrap();
//! let mut cab_writer = cab_builder.build(cab_file).unwrap();
//! while let Some(mut writer) = cab_writer.next_file().unwrap() {
//! let mut reader = fs::File::open(writer.file_name()).unwrap();
//! io::copy(&mut reader, &mut writer).unwrap();
//! }
//! // Print the file size of the cabinet file we just created:
//! let mut cab_file = cab_writer.finish().unwrap();
//! println!("Cabinet size: {} B", cab_file.metadata().unwrap().len());
//! ```
#![warn(missing_docs)]
extern crate byteorder;
extern crate chrono;
extern crate flate2;
mod internal;
pub use crate::internal::builder::{
CabinetBuilder, CabinetWriter, FileBuilder, FileWriter, FolderBuilder,
};
pub use crate::internal::cabinet::{
Cabinet, FileEntries, FileEntry, FileReader, FolderEntries, FolderEntry,
};
pub use crate::internal::ctype::CompressionType;
// ========================================================================= //
| 41.127273 | 79 | 0.627763 |
7d5a719975470b2d28acac5e84025ed6795692b9
| 9,940 |
html
|
HTML
|
lei_11671.html
|
JefersonSOliveira/ProjetoConcursos
|
a87526eac19b7352fa27cb8664cd36737dcd2203
|
[
"MIT"
] | null | null | null |
lei_11671.html
|
JefersonSOliveira/ProjetoConcursos
|
a87526eac19b7352fa27cb8664cd36737dcd2203
|
[
"MIT"
] | null | null | null |
lei_11671.html
|
JefersonSOliveira/ProjetoConcursos
|
a87526eac19b7352fa27cb8664cd36737dcd2203
|
[
"MIT"
] | null | null | null |
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<meta name="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="favicon.icon" href="logo.ico">
<link rel="stylesheet" type="text/css" href="02_stylo/stylo.css">
<title>11.671/2018</title>
</head>
<body>
<div id="interface">
<header id="cabecalho">
<nav id="menu">
<h2>Menu Principal</h2>
<ul type="disc">
<li><a href="01_inicio.html">INICIO</a></li>
<li><a href="02_questoes.html">QUESTÕES</a></li>
<li><a href="03_concursos.html">CONCURSOS</a></li>
<li><a href="04_disciplinas.html">DISCIPLINAS</a></li>
<li><a href="05_extra.html">EXTRA</a></li>
</ul>
<h1>Lei nº 11.671/2008</h1>
</nav>
</header>
<hgroup style=" line-height: 1.5; font-size: 18px;">
<br>
<strong>Art.</strong> 1º A inclusão de presos em estabelecimentos penais federais de segurança máxima e a transferência de presos de outros estabelecimentos para aqueles obedecerão ao disposto nesta Lei.<br><br>
<strong>Art. 2º</strong> A atividade jurisdicional de execução penal nos estabelecimentos penais federais será desenvolvida pelo juízo federal da seção ou subseção judiciária em que estiver localizado o estabelecimento penal federal de segurança máxima ao qual for recolhido o preso.<br><br>
<strong>Parágrafo único.</strong> O juízo federal de execução penal será competente para as ações de natureza penal que tenham por objeto fatos ou incidentes relacionados à execução da pena ou infrações penais ocorridas no estabelecimento penal federal. (Incluído pela Lei nº 13.964, de 2019)<br><br>
<strong>Art. 3º</strong> Serão incluídos em estabelecimentos penais federais de segurança máxima aqueles para quem a medida se justifique no interesse da segurança pública ou do próprio preso, condenado ou provisório. (Redação dada pela Lei nº 13.964, de 2019)<br><br>
§ 1º A inclusão em estabelecimento penal federal de segurança máxima, no atendimento do interesse da segurança pública, será em regime fechado de segurança máxima, com as seguintes características: (Incluído pela Lei nº 13.964, de 2019)<br><br>
I - recolhimento em cela individual; (Incluído pela Lei nº 13.964, de 2019)<br><br>
II - visita do cônjuge, do companheiro, de parentes e de amigos somente em dias determinados, por meio virtual ou no parlatório, com o máximo de 2 (duas) pessoas por vez, além de eventuais crianças, separados por vidro e comunicação por meio de interfone, com filmagem e gravações; (Incluído pela Lei nº 13.964, de 2019)<br><br>
III - banho de sol de até 2 (duas) horas diárias; e (Incluído pela Lei nº 13.964, de 2019)<br><br>
IV - monitoramento de todos os meios de comunicação, inclusive de correspondência escrita. (Incluído pela Lei nº 13.964, de 2019)<br><br>
§ 2º Os estabelecimentos penais federais de segurança máxima deverão dispor de monitoramento de áudio e vídeo no parlatório e nas áreas comuns, para fins de preservação da ordem interna e da segurança pública, vedado seu uso nas celas e no atendimento advocatício, salvo expressa autorização judicial em contrário. (Incluído pela Lei nº 13.964, de 2019)<br><br>
§ 3º As gravações das visitas não poderão ser utilizadas como meio de prova de infrações penais pretéritas ao ingresso do preso no estabelecimento. (Incluído pela Lei nº 13.964, de 2019)<br><br>
§ 4º Os diretores dos estabelecimentos penais federais de segurança máxima ou o Diretor do Sistema Penitenciário Federal poderão suspender e restringir o direito de visitas previsto no inciso II do § 1º deste artigo por meio de ato fundamentado. (Incluído pela Lei nº 13.964, de 2019)<br><br>
§ 5º Configura o crime do art. 325 do Decreto-Lei nº 2.848, de 7 de dezembro de 1940 (Código Penal), a violação ao disposto no § 2º deste artigo. (Incluído pela Lei nº 13.964, de 2019)<br><br>
<strong>Art. 4º</strong> A admissão do preso, condenado ou provisório, dependerá de decisão prévia e fundamentada do juízo federal competente, após receber os autos de transferência enviados pelo juízo responsável pela execução penal ou pela prisão provisória.<br><br>
§ 1º A execução penal da pena privativa de liberdade, no período em que durar a transferência, ficará a cargo do juízo federal competente.<br><br>
§ 2º Apenas a fiscalização da prisão provisória será deprecada, mediante carta precatória, pelo juízo de origem ao juízo federal competente, mantendo aquele juízo a competência para o processo e para os respectivos incidentes.<br><br>
<strong>Art. 5º</strong> São legitimados para requerer o processo de transferência, cujo início se dá com a admissibilidade pelo juiz da origem da necessidade da transferência do preso para estabelecimento penal federal de segurança máxima, a autoridade administrativa, o Ministério Público e o próprio preso.<br><br>
§ 1º Caberá à Defensoria Pública da União a assistência jurídica ao preso que estiver nos estabelecimentos penais federais de segurança máxima.<br><br>
§ 2º Instruídos os autos do processo de transferência, serão ouvidos, no prazo de 5 (cinco) dias cada, quando não requerentes, a autoridade administrativa, o Ministério Público e a defesa, bem como o Departamento Penitenciário Nacional – DEPEN, a quem é facultado indicar o estabelecimento penal federal mais adequado.<br><br>
§ 3º A instrução dos autos do processo de transferência será disciplinada no regulamento para fiel execução desta Lei.<br><br>
§ 4º Na hipótese de imprescindibilidade de diligências complementares, o juiz federal ouvirá, no prazo de 5 (cinco) dias, o Ministério Público Federal e a defesa e, em seguida, decidirá acerca da transferência no mesmo prazo.<br><br>
§ 5º A decisão que admitir o preso no estabelecimento penal federal de segurança máxima indicará o período de permanência.<br><br>
§ 6º Havendo extrema necessidade, o juiz federal poderá autorizar a imediata transferência do preso e, após a instrução dos autos, na forma do § 2o deste artigo, decidir pela manutenção ou revogação da medida adotada.<br><br>
§ 7º A autoridade policial será comunicada sobre a transferência do preso provisório quando a autorização da transferência ocorrer antes da conclusão do inquérito policial que presidir.<br><br>
<strong>Art. 6º</strong> Admitida a transferência do preso condenado, o juízo de origem deverá encaminhar ao juízo federal os autos da execução penal.<br><br>
<strong>Art. 7º</strong> Admitida a transferência do preso provisório, será suficiente a carta precatória remetida pelo juízo de origem, devidamente instruída, para que o juízo federal competente dê início à fiscalização da prisão no estabelecimento penal federal de segurança máxima.<br><br>
<strong>Art. 8º</strong> As visitas feitas pelo juiz responsável ou por membro do Ministério Público, às quais se referem os arts. 66 e 68 da Lei nº 7.210, de 11 de julho de 1984, serão registradas em livro próprio, mantido no respectivo estabelecimento.<br><br>
<strong>Art. 9º</strong> Rejeitada a transferência, o juízo de origem poderá suscitar o conflito de competência perante o tribunal competente, que o apreciará em caráter prioritário.<br><br>
<strong>Art. 10.</strong> A inclusão de preso em estabelecimento penal federal de segurança máxima será excepcional e por prazo determinado.<br><br>
§ 1º O período de permanência será de até 3 (três) anos, renovável por iguais períodos, quando solicitado motivadamente pelo juízo de origem, observados os requisitos da transferência, e se persistirem os motivos que a determinaram. (Redação dada pela Lei nº 13.964, de 2019)<br><br>
§ 2º Decorrido o prazo, sem que seja feito, imediatamente após seu decurso, pedido de renovação da permanência do preso em estabelecimento penal federal de segurança máxima, ficará o juízo de origem obrigado a receber o preso no estabelecimento penal sob sua jurisdição.<br><br>
§ 3º Tendo havido pedido de renovação, o preso, recolhido no estabelecimento federal em que estiver, aguardará que o juízo federal profira decisão.<br><br>
§ 4º Aceita a renovação, o preso permanecerá no estabelecimento federal de segurança máxima em que estiver, retroagindo o termo inicial do prazo ao dia seguinte ao término do prazo anterior.<br><br>
§ 5º Rejeitada a renovação, o juízo de origem poderá suscitar o conflito de competência, que o tribunal apreciará em caráter prioritário.<br><br>
§ 6º Enquanto não decidido o conflito de competência em caso de renovação, o preso permanecerá no estabelecimento penal federal.<br><br>
<strong>Art. 11.</strong> A lotação máxima do estabelecimento penal federal de segurança máxima não será ultrapassada.<br><br>
§ 1º O número de presos, sempre que possível, será mantido aquém do limite de vagas, para que delas o juízo federal competente possa dispor em casos emergenciais.<br><br>
§ 2º No julgamento dos conflitos de competência, o tribunal competente observará a vedação estabelecida no caput deste artigo.<br><br>
<strong>Art. 11-A.</strong> As decisões relativas à transferência ou à prorrogação da permanência do preso em estabelecimento penal federal de segurança máxima, à concessão ou à denegação de benefícios prisionais ou à imposição de sanções ao preso federal poderão ser tomadas por órgão colegiado de juízes, na forma das normas de organização interna dos tribunais. (Incluído pela Lei nº 13.964, de 2019)<br><br>
<strong>Art. 11-B.</strong> Os Estados e o Distrito Federal poderão construir estabelecimentos penais de segurança máxima, ou adaptar os já existentes, aos quais será aplicável, no que couber, o disposto nesta Lei. (Incluído pela Lei nº 13.964, de 2019)<br><br>
<strong>Art. 12.</strong> Esta Lei entra em vigor na data de sua publicação.<br><br>
</hgroup>
<footer id="rodape">
Carreira Poícial
</footer>
</div>
</body>
</html>
| 82.833333 | 413 | 0.761771 |
0f74e70e254193248cb69daec29f7533e2bae34b
| 3,881 |
swift
|
Swift
|
SwiftDemo/View/YXCActivityView.swift
|
guoguangtao/SwiftDemo
|
6b26fc9908485cb5a4a8518b91af29a593c56a02
|
[
"MIT"
] | null | null | null |
SwiftDemo/View/YXCActivityView.swift
|
guoguangtao/SwiftDemo
|
6b26fc9908485cb5a4a8518b91af29a593c56a02
|
[
"MIT"
] | null | null | null |
SwiftDemo/View/YXCActivityView.swift
|
guoguangtao/SwiftDemo
|
6b26fc9908485cb5a4a8518b91af29a593c56a02
|
[
"MIT"
] | null | null | null |
//
// YXCActivityView.swift
// SwiftDemo
//
// Created by lbkj on 2021/10/27.
// Copyright © 2021 GGT. All rights reserved.
//
import UIKit
class YXCActivityView: UIView {
/// 定时器
lazy private var displayLink: CADisplayLink = {
var link = CADisplayLink(target: self, selector: #selector(displayLinkAction))
link.add(to: .main, forMode: .default)
return link
}()
/// 显示圆环
private let animationLayer = CAShapeLayer().then {
$0.bounds = CGRect(x: 0, y: 0, width: 60, height: 60)
$0.fillColor = UIColor.clear.cgColor
$0.strokeColor = UIColor.white.cgColor
$0.lineWidth = 4.0
$0.lineCap = .round
$0.lineJoin = .bevel
let maskLayer = CALayer()
maskLayer.frame = $0.bounds
// $0.mask = maskLayer
let animation = CABasicAnimation(keyPath: "transform.rotation")
animation.fromValue = 0
animation.toValue = Double.pi * 2
animation.duration = 1;
animation.timingFunction = CAMediaTimingFunction(name: .linear)
animation.isRemovedOnCompletion = false
animation.repeatCount = Float(CGFloat.infinity)
animation.fillMode = .forwards
animation.autoreverses = false
maskLayer.add(animation, forKey: "rotate")
}
/// 开始角度
private var startAngle: CGFloat = 0.0
/// 结束角度
private var endAngle: CGFloat = 0.0
/// 当前动画进度
private var progress: CGFloat = 0.0
override init(frame: CGRect) {
super.init(frame: frame)
self.backgroundColor = .lightGray
animationLayer.position = CGPoint(x: self.yxc_width / 2.0, y: self.yxc_height / 2.0)
self.layer.addSublayer(animationLayer)
displayLink.isPaused = true
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
/// 定时器响应方法
@objc private func displayLinkAction() {
progress += speed()
if progress >= 1 {
progress = 0
}
updateAnimationLayer()
}
private func speed() -> CGFloat {
if endAngle > Double.pi {
return 0.1 / 60.0
}
return 2 / 60.0
}
/// 刷新动画
private func updateAnimationLayer() {
startAngle = -Double.pi / 2;
endAngle = -Double.pi / 2 + progress * Double.pi * 2;
if endAngle > Double.pi {
let progress_01 = 1 - (1 - progress) / 0.25
startAngle = -Double.pi / 2 + progress_01 * Double.pi * 2
}
let radius = animationLayer.bounds.size.width / 2.0 - animationLayer.lineWidth;
let centerX = animationLayer.bounds.size.width * 0.5
let centerY = animationLayer.bounds.size.height * 0.5
let path = UIBezierPath(arcCenter: CGPoint(x: centerX, y: centerY), radius: radius, startAngle: startAngle, endAngle: endAngle, clockwise: true)
path.lineCapStyle = .round
animationLayer.path = path.cgPath
}
private func start() {
displayLink.isPaused = false
}
private func pause() {
displayLink.isPaused = true;
}
private func hide() {
displayLink.isPaused = true
progress = 0
}
public class func show(inView view: UIView) -> YXCActivityView {
self .hidden(fromView: view)
let activityView = YXCActivityView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
activityView.start()
activityView.center = view.center
view.addSubview(activityView)
return activityView
}
public class func hidden(fromView view: UIView) {
for subView in view.subviews {
if subView.isKind(of: self) == true {
let activityView: YXCActivityView = subView as! YXCActivityView
activityView.pause()
}
}
}
}
| 30.320313 | 152 | 0.589796 |
7f30252a8f361a35617999cdf2d6d7c96ecd2a57
| 38,013 |
rs
|
Rust
|
grep-regex/src/matcher.rs
|
tpai/ripgrep
|
09108b7fda7af6db7c1c4f0366301f9a21cc485d
|
[
"MIT",
"Unlicense"
] | null | null | null |
grep-regex/src/matcher.rs
|
tpai/ripgrep
|
09108b7fda7af6db7c1c4f0366301f9a21cc485d
|
[
"MIT",
"Unlicense"
] | null | null | null |
grep-regex/src/matcher.rs
|
tpai/ripgrep
|
09108b7fda7af6db7c1c4f0366301f9a21cc485d
|
[
"MIT",
"Unlicense"
] | 1 |
2020-05-16T03:18:45.000Z
|
2020-05-16T03:18:45.000Z
|
use std::collections::HashMap;
use grep_matcher::{
Captures, LineMatchKind, LineTerminator, Match, Matcher, NoError, ByteSet,
};
use regex::bytes::{CaptureLocations, Regex};
use config::{Config, ConfiguredHIR};
use crlf::CRLFMatcher;
use error::Error;
use multi::MultiLiteralMatcher;
use word::WordMatcher;
/// A builder for constructing a `Matcher` using regular expressions.
///
/// This builder re-exports many of the same options found on the regex crate's
/// builder, in addition to a few other options such as smart case, word
/// matching and the ability to set a line terminator which may enable certain
/// types of optimizations.
///
/// The syntax supported is documented as part of the regex crate:
/// https://docs.rs/regex/*/regex/#syntax
#[derive(Clone, Debug)]
pub struct RegexMatcherBuilder {
config: Config,
}
impl Default for RegexMatcherBuilder {
fn default() -> RegexMatcherBuilder {
RegexMatcherBuilder::new()
}
}
impl RegexMatcherBuilder {
/// Create a new builder for configuring a regex matcher.
pub fn new() -> RegexMatcherBuilder {
RegexMatcherBuilder {
config: Config::default(),
}
}
/// Build a new matcher using the current configuration for the provided
/// pattern.
///
/// The syntax supported is documented as part of the regex crate:
/// https://docs.rs/regex/*/regex/#syntax
pub fn build(&self, pattern: &str) -> Result<RegexMatcher, Error> {
let chir = self.config.hir(pattern)?;
let fast_line_regex = chir.fast_line_regex()?;
let non_matching_bytes = chir.non_matching_bytes();
if let Some(ref re) = fast_line_regex {
trace!("extracted fast line regex: {:?}", re);
}
let matcher = RegexMatcherImpl::new(&chir)?;
trace!("final regex: {:?}", matcher.regex());
Ok(RegexMatcher {
config: self.config.clone(),
matcher: matcher,
fast_line_regex: fast_line_regex,
non_matching_bytes: non_matching_bytes,
})
}
/// Build a new matcher from a plain alternation of literals.
///
/// Depending on the configuration set by the builder, this may be able to
/// build a matcher substantially faster than by joining the patterns with
/// a `|` and calling `build`.
pub fn build_literals<B: AsRef<str>>(
&self,
literals: &[B],
) -> Result<RegexMatcher, Error> {
let slices: Vec<_> = literals.iter().map(|s| s.as_ref()).collect();
if !self.config.can_plain_aho_corasick() || literals.len() < 40 {
return self.build(&slices.join("|"));
}
let matcher = MultiLiteralMatcher::new(&slices)?;
let imp = RegexMatcherImpl::MultiLiteral(matcher);
Ok(RegexMatcher {
config: self.config.clone(),
matcher: imp,
fast_line_regex: None,
non_matching_bytes: ByteSet::empty(),
})
}
/// Set the value for the case insensitive (`i`) flag.
///
/// When enabled, letters in the pattern will match both upper case and
/// lower case variants.
pub fn case_insensitive(&mut self, yes: bool) -> &mut RegexMatcherBuilder {
self.config.case_insensitive = yes;
self
}
/// Whether to enable "smart case" or not.
///
/// When smart case is enabled, the builder will automatically enable
/// case insensitive matching based on how the pattern is written. Namely,
/// case insensitive mode is enabled when both of the following things
/// are true:
///
/// 1. The pattern contains at least one literal character. For example,
/// `a\w` contains a literal (`a`) but `\w` does not.
/// 2. Of the literals in the pattern, none of them are considered to be
/// uppercase according to Unicode. For example, `foo\pL` has no
/// uppercase literals but `Foo\pL` does.
pub fn case_smart(&mut self, yes: bool) -> &mut RegexMatcherBuilder {
self.config.case_smart = yes;
self
}
/// Set the value for the multi-line matching (`m`) flag.
///
/// When enabled, `^` matches the beginning of lines and `$` matches the
/// end of lines.
///
/// By default, they match beginning/end of the input.
pub fn multi_line(&mut self, yes: bool) -> &mut RegexMatcherBuilder {
self.config.multi_line = yes;
self
}
/// Set the value for the any character (`s`) flag, where in `.` matches
/// anything when `s` is set and matches anything except for new line when
/// it is not set (the default).
///
/// N.B. "matches anything" means "any byte" when Unicode is disabled and
/// means "any valid UTF-8 encoding of any Unicode scalar value" when
/// Unicode is enabled.
pub fn dot_matches_new_line(
&mut self,
yes: bool,
) -> &mut RegexMatcherBuilder {
self.config.dot_matches_new_line = yes;
self
}
/// Set the value for the greedy swap (`U`) flag.
///
/// When enabled, a pattern like `a*` is lazy (tries to find shortest
/// match) and `a*?` is greedy (tries to find longest match).
///
/// By default, `a*` is greedy and `a*?` is lazy.
pub fn swap_greed(&mut self, yes: bool) -> &mut RegexMatcherBuilder {
self.config.swap_greed = yes;
self
}
/// Set the value for the ignore whitespace (`x`) flag.
///
/// When enabled, whitespace such as new lines and spaces will be ignored
/// between expressions of the pattern, and `#` can be used to start a
/// comment until the next new line.
pub fn ignore_whitespace(
&mut self,
yes: bool,
) -> &mut RegexMatcherBuilder {
self.config.ignore_whitespace = yes;
self
}
/// Set the value for the Unicode (`u`) flag.
///
/// Enabled by default. When disabled, character classes such as `\w` only
/// match ASCII word characters instead of all Unicode word characters.
pub fn unicode(&mut self, yes: bool) -> &mut RegexMatcherBuilder {
self.config.unicode = yes;
self
}
/// Whether to support octal syntax or not.
///
/// Octal syntax is a little-known way of uttering Unicode codepoints in
/// a regular expression. For example, `a`, `\x61`, `\u0061` and
/// `\141` are all equivalent regular expressions, where the last example
/// shows octal syntax.
///
/// While supporting octal syntax isn't in and of itself a problem, it does
/// make good error messages harder. That is, in PCRE based regex engines,
/// syntax like `\0` invokes a backreference, which is explicitly
/// unsupported in Rust's regex engine. However, many users expect it to
/// be supported. Therefore, when octal support is disabled, the error
/// message will explicitly mention that backreferences aren't supported.
///
/// Octal syntax is disabled by default.
pub fn octal(&mut self, yes: bool) -> &mut RegexMatcherBuilder {
self.config.octal = yes;
self
}
/// Set the approximate size limit of the compiled regular expression.
///
/// This roughly corresponds to the number of bytes occupied by a single
/// compiled program. If the program exceeds this number, then a
/// compilation error is returned.
pub fn size_limit(&mut self, bytes: usize) -> &mut RegexMatcherBuilder {
self.config.size_limit = bytes;
self
}
/// Set the approximate size of the cache used by the DFA.
///
/// This roughly corresponds to the number of bytes that the DFA will
/// use while searching.
///
/// Note that this is a *per thread* limit. There is no way to set a global
/// limit. In particular, if a regex is used from multiple threads
/// simultaneously, then each thread may use up to the number of bytes
/// specified here.
pub fn dfa_size_limit(
&mut self,
bytes: usize,
) -> &mut RegexMatcherBuilder {
self.config.dfa_size_limit = bytes;
self
}
/// Set the nesting limit for this parser.
///
/// The nesting limit controls how deep the abstract syntax tree is allowed
/// to be. If the AST exceeds the given limit (e.g., with too many nested
/// groups), then an error is returned by the parser.
///
/// The purpose of this limit is to act as a heuristic to prevent stack
/// overflow for consumers that do structural induction on an `Ast` using
/// explicit recursion. While this crate never does this (instead using
/// constant stack space and moving the call stack to the heap), other
/// crates may.
///
/// This limit is not checked until the entire Ast is parsed. Therefore,
/// if callers want to put a limit on the amount of heap space used, then
/// they should impose a limit on the length, in bytes, of the concrete
/// pattern string. In particular, this is viable since this parser
/// implementation will limit itself to heap space proportional to the
/// lenth of the pattern string.
///
/// Note that a nest limit of `0` will return a nest limit error for most
/// patterns but not all. For example, a nest limit of `0` permits `a` but
/// not `ab`, since `ab` requires a concatenation, which results in a nest
/// depth of `1`. In general, a nest limit is not something that manifests
/// in an obvious way in the concrete syntax, therefore, it should not be
/// used in a granular way.
pub fn nest_limit(&mut self, limit: u32) -> &mut RegexMatcherBuilder {
self.config.nest_limit = limit;
self
}
/// Set an ASCII line terminator for the matcher.
///
/// The purpose of setting a line terminator is to enable a certain class
/// of optimizations that can make line oriented searching faster. Namely,
/// when a line terminator is enabled, then the builder will guarantee that
/// the resulting matcher will never be capable of producing a match that
/// contains the line terminator. Because of this guarantee, users of the
/// resulting matcher do not need to slowly execute a search line by line
/// for line oriented search.
///
/// If the aforementioned guarantee about not matching a line terminator
/// cannot be made because of how the pattern was written, then the builder
/// will return an error when attempting to construct the matcher. For
/// example, the pattern `a\sb` will be transformed such that it can never
/// match `a\nb` (when `\n` is the line terminator), but the pattern `a\nb`
/// will result in an error since the `\n` cannot be easily removed without
/// changing the fundamental intent of the pattern.
///
/// If the given line terminator isn't an ASCII byte (`<=127`), then the
/// builder will return an error when constructing the matcher.
pub fn line_terminator(
&mut self,
line_term: Option<u8>,
) -> &mut RegexMatcherBuilder {
self.config.line_terminator = line_term.map(LineTerminator::byte);
self
}
/// Set the line terminator to `\r\n` and enable CRLF matching for `$` in
/// regex patterns.
///
/// This method sets two distinct settings:
///
/// 1. It causes the line terminator for the matcher to be `\r\n`. Namely,
/// this prevents the matcher from ever producing a match that contains
/// a `\r` or `\n`.
/// 2. It translates all instances of `$` in the pattern to `(?:\r??$)`.
/// This works around the fact that the regex engine does not support
/// matching CRLF as a line terminator when using `$`.
///
/// In particular, because of (2), the matches produced by the matcher may
/// be slightly different than what one would expect given the pattern.
/// This is the trade off made: in many cases, `$` will "just work" in the
/// presence of `\r\n` line terminators, but matches may require some
/// trimming to faithfully represent the intended match.
///
/// Note that if you do not wish to set the line terminator but would still
/// like `$` to match `\r\n` line terminators, then it is valid to call
/// `crlf(true)` followed by `line_terminator(None)`. Ordering is
/// important, since `crlf` and `line_terminator` override each other.
pub fn crlf(&mut self, yes: bool) -> &mut RegexMatcherBuilder {
if yes {
self.config.line_terminator = Some(LineTerminator::crlf());
} else {
self.config.line_terminator = None;
}
self.config.crlf = yes;
self
}
/// Require that all matches occur on word boundaries.
///
/// Enabling this option is subtly different than putting `\b` assertions
/// on both sides of your pattern. In particular, a `\b` assertion requires
/// that one side of it match a word character while the other match a
/// non-word character. This option, in contrast, merely requires that
/// one side match a non-word character.
///
/// For example, `\b-2\b` will not match `foo -2 bar` since `-` is not a
/// word character. However, `-2` with this `word` option enabled will
/// match the `-2` in `foo -2 bar`.
pub fn word(&mut self, yes: bool) -> &mut RegexMatcherBuilder {
self.config.word = yes;
self
}
}
/// An implementation of the `Matcher` trait using Rust's standard regex
/// library.
#[derive(Clone, Debug)]
pub struct RegexMatcher {
/// The configuration specified by the caller.
config: Config,
/// The underlying matcher implementation.
matcher: RegexMatcherImpl,
/// A regex that never reports false negatives but may report false
/// positives that is believed to be capable of being matched more quickly
/// than `regex`. Typically, this is a single literal or an alternation
/// of literals.
fast_line_regex: Option<Regex>,
/// A set of bytes that will never appear in a match.
non_matching_bytes: ByteSet,
}
impl RegexMatcher {
/// Create a new matcher from the given pattern using the default
/// configuration.
pub fn new(pattern: &str) -> Result<RegexMatcher, Error> {
RegexMatcherBuilder::new().build(pattern)
}
/// Create a new matcher from the given pattern using the default
/// configuration, but matches lines terminated by `\n`.
///
/// This is meant to be a convenience constructor for using a
/// `RegexMatcherBuilder` and setting its
/// [`line_terminator`](struct.RegexMatcherBuilder.html#method.line_terminator)
/// to `\n`. The purpose of using this constructor is to permit special
/// optimizations that help speed up line oriented search. These types of
/// optimizations are only appropriate when matches span no more than one
/// line. For this reason, this constructor will return an error if the
/// given pattern contains a literal `\n`. Other uses of `\n` (such as in
/// `\s`) are removed transparently.
pub fn new_line_matcher(pattern: &str) -> Result<RegexMatcher, Error> {
RegexMatcherBuilder::new()
.line_terminator(Some(b'\n'))
.build(pattern)
}
}
/// An encapsulation of the type of matcher we use in `RegexMatcher`.
#[derive(Clone, Debug)]
enum RegexMatcherImpl {
/// The standard matcher used for all regular expressions.
Standard(StandardMatcher),
/// A matcher for an alternation of plain literals.
MultiLiteral(MultiLiteralMatcher),
/// A matcher that strips `\r` from the end of matches.
///
/// This is only used when the CRLF hack is enabled and the regex is line
/// anchored at the end.
CRLF(CRLFMatcher),
/// A matcher that only matches at word boundaries. This transforms the
/// regex to `(^|\W)(...)($|\W)` instead of the more intuitive `\b(...)\b`.
/// Because of this, the WordMatcher provides its own implementation of
/// `Matcher` to encapsulate its use of capture groups to make them
/// invisible to the caller.
Word(WordMatcher),
}
impl RegexMatcherImpl {
/// Based on the configuration, create a new implementation of the
/// `Matcher` trait.
fn new(expr: &ConfiguredHIR) -> Result<RegexMatcherImpl, Error> {
if expr.config().word {
Ok(RegexMatcherImpl::Word(WordMatcher::new(expr)?))
} else if expr.needs_crlf_stripped() {
Ok(RegexMatcherImpl::CRLF(CRLFMatcher::new(expr)?))
} else {
if let Some(lits) = expr.alternation_literals() {
if lits.len() >= 40 {
let matcher = MultiLiteralMatcher::new(&lits)?;
return Ok(RegexMatcherImpl::MultiLiteral(matcher));
}
}
Ok(RegexMatcherImpl::Standard(StandardMatcher::new(expr)?))
}
}
/// Return the underlying regex object used.
fn regex(&self) -> String {
match *self {
RegexMatcherImpl::Word(ref x) => x.regex().to_string(),
RegexMatcherImpl::CRLF(ref x) => x.regex().to_string(),
RegexMatcherImpl::MultiLiteral(_) => "<N/A>".to_string(),
RegexMatcherImpl::Standard(ref x) => x.regex.to_string(),
}
}
}
// This implementation just dispatches on the internal matcher impl except
// for the line terminator optimization, which is possibly executed via
// `fast_line_regex`.
impl Matcher for RegexMatcher {
type Captures = RegexCaptures;
type Error = NoError;
fn find_at(
&self,
haystack: &[u8],
at: usize,
) -> Result<Option<Match>, NoError> {
use self::RegexMatcherImpl::*;
match self.matcher {
Standard(ref m) => m.find_at(haystack, at),
MultiLiteral(ref m) => m.find_at(haystack, at),
CRLF(ref m) => m.find_at(haystack, at),
Word(ref m) => m.find_at(haystack, at),
}
}
fn new_captures(&self) -> Result<RegexCaptures, NoError> {
use self::RegexMatcherImpl::*;
match self.matcher {
Standard(ref m) => m.new_captures(),
MultiLiteral(ref m) => m.new_captures(),
CRLF(ref m) => m.new_captures(),
Word(ref m) => m.new_captures(),
}
}
fn capture_count(&self) -> usize {
use self::RegexMatcherImpl::*;
match self.matcher {
Standard(ref m) => m.capture_count(),
MultiLiteral(ref m) => m.capture_count(),
CRLF(ref m) => m.capture_count(),
Word(ref m) => m.capture_count(),
}
}
fn capture_index(&self, name: &str) -> Option<usize> {
use self::RegexMatcherImpl::*;
match self.matcher {
Standard(ref m) => m.capture_index(name),
MultiLiteral(ref m) => m.capture_index(name),
CRLF(ref m) => m.capture_index(name),
Word(ref m) => m.capture_index(name),
}
}
fn find(&self, haystack: &[u8]) -> Result<Option<Match>, NoError> {
use self::RegexMatcherImpl::*;
match self.matcher {
Standard(ref m) => m.find(haystack),
MultiLiteral(ref m) => m.find(haystack),
CRLF(ref m) => m.find(haystack),
Word(ref m) => m.find(haystack),
}
}
fn find_iter<F>(
&self,
haystack: &[u8],
matched: F,
) -> Result<(), NoError>
where F: FnMut(Match) -> bool
{
use self::RegexMatcherImpl::*;
match self.matcher {
Standard(ref m) => m.find_iter(haystack, matched),
MultiLiteral(ref m) => m.find_iter(haystack, matched),
CRLF(ref m) => m.find_iter(haystack, matched),
Word(ref m) => m.find_iter(haystack, matched),
}
}
fn try_find_iter<F, E>(
&self,
haystack: &[u8],
matched: F,
) -> Result<Result<(), E>, NoError>
where F: FnMut(Match) -> Result<bool, E>
{
use self::RegexMatcherImpl::*;
match self.matcher {
Standard(ref m) => m.try_find_iter(haystack, matched),
MultiLiteral(ref m) => m.try_find_iter(haystack, matched),
CRLF(ref m) => m.try_find_iter(haystack, matched),
Word(ref m) => m.try_find_iter(haystack, matched),
}
}
fn captures(
&self,
haystack: &[u8],
caps: &mut RegexCaptures,
) -> Result<bool, NoError> {
use self::RegexMatcherImpl::*;
match self.matcher {
Standard(ref m) => m.captures(haystack, caps),
MultiLiteral(ref m) => m.captures(haystack, caps),
CRLF(ref m) => m.captures(haystack, caps),
Word(ref m) => m.captures(haystack, caps),
}
}
fn captures_iter<F>(
&self,
haystack: &[u8],
caps: &mut RegexCaptures,
matched: F,
) -> Result<(), NoError>
where F: FnMut(&RegexCaptures) -> bool
{
use self::RegexMatcherImpl::*;
match self.matcher {
Standard(ref m) => m.captures_iter(haystack, caps, matched),
MultiLiteral(ref m) => m.captures_iter(haystack, caps, matched),
CRLF(ref m) => m.captures_iter(haystack, caps, matched),
Word(ref m) => m.captures_iter(haystack, caps, matched),
}
}
fn try_captures_iter<F, E>(
&self,
haystack: &[u8],
caps: &mut RegexCaptures,
matched: F,
) -> Result<Result<(), E>, NoError>
where F: FnMut(&RegexCaptures) -> Result<bool, E>
{
use self::RegexMatcherImpl::*;
match self.matcher {
Standard(ref m) => m.try_captures_iter(haystack, caps, matched),
MultiLiteral(ref m) => {
m.try_captures_iter(haystack, caps, matched)
}
CRLF(ref m) => m.try_captures_iter(haystack, caps, matched),
Word(ref m) => m.try_captures_iter(haystack, caps, matched),
}
}
fn captures_at(
&self,
haystack: &[u8],
at: usize,
caps: &mut RegexCaptures,
) -> Result<bool, NoError> {
use self::RegexMatcherImpl::*;
match self.matcher {
Standard(ref m) => m.captures_at(haystack, at, caps),
MultiLiteral(ref m) => m.captures_at(haystack, at, caps),
CRLF(ref m) => m.captures_at(haystack, at, caps),
Word(ref m) => m.captures_at(haystack, at, caps),
}
}
fn replace<F>(
&self,
haystack: &[u8],
dst: &mut Vec<u8>,
append: F,
) -> Result<(), NoError>
where F: FnMut(Match, &mut Vec<u8>) -> bool
{
use self::RegexMatcherImpl::*;
match self.matcher {
Standard(ref m) => m.replace(haystack, dst, append),
MultiLiteral(ref m) => m.replace(haystack, dst, append),
CRLF(ref m) => m.replace(haystack, dst, append),
Word(ref m) => m.replace(haystack, dst, append),
}
}
fn replace_with_captures<F>(
&self,
haystack: &[u8],
caps: &mut RegexCaptures,
dst: &mut Vec<u8>,
append: F,
) -> Result<(), NoError>
where F: FnMut(&Self::Captures, &mut Vec<u8>) -> bool
{
use self::RegexMatcherImpl::*;
match self.matcher {
Standard(ref m) => {
m.replace_with_captures(haystack, caps, dst, append)
}
MultiLiteral(ref m) => {
m.replace_with_captures(haystack, caps, dst, append)
}
CRLF(ref m) => {
m.replace_with_captures(haystack, caps, dst, append)
}
Word(ref m) => {
m.replace_with_captures(haystack, caps, dst, append)
}
}
}
fn is_match(&self, haystack: &[u8]) -> Result<bool, NoError> {
use self::RegexMatcherImpl::*;
match self.matcher {
Standard(ref m) => m.is_match(haystack),
MultiLiteral(ref m) => m.is_match(haystack),
CRLF(ref m) => m.is_match(haystack),
Word(ref m) => m.is_match(haystack),
}
}
fn is_match_at(
&self,
haystack: &[u8],
at: usize,
) -> Result<bool, NoError> {
use self::RegexMatcherImpl::*;
match self.matcher {
Standard(ref m) => m.is_match_at(haystack, at),
MultiLiteral(ref m) => m.is_match_at(haystack, at),
CRLF(ref m) => m.is_match_at(haystack, at),
Word(ref m) => m.is_match_at(haystack, at),
}
}
fn shortest_match(
&self,
haystack: &[u8],
) -> Result<Option<usize>, NoError> {
use self::RegexMatcherImpl::*;
match self.matcher {
Standard(ref m) => m.shortest_match(haystack),
MultiLiteral(ref m) => m.shortest_match(haystack),
CRLF(ref m) => m.shortest_match(haystack),
Word(ref m) => m.shortest_match(haystack),
}
}
fn shortest_match_at(
&self,
haystack: &[u8],
at: usize,
) -> Result<Option<usize>, NoError> {
use self::RegexMatcherImpl::*;
match self.matcher {
Standard(ref m) => m.shortest_match_at(haystack, at),
MultiLiteral(ref m) => m.shortest_match_at(haystack, at),
CRLF(ref m) => m.shortest_match_at(haystack, at),
Word(ref m) => m.shortest_match_at(haystack, at),
}
}
fn non_matching_bytes(&self) -> Option<&ByteSet> {
Some(&self.non_matching_bytes)
}
fn line_terminator(&self) -> Option<LineTerminator> {
self.config.line_terminator
}
fn find_candidate_line(
&self,
haystack: &[u8],
) -> Result<Option<LineMatchKind>, NoError> {
Ok(match self.fast_line_regex {
Some(ref regex) => {
regex.shortest_match(haystack).map(LineMatchKind::Candidate)
}
None => {
self.shortest_match(haystack)?.map(LineMatchKind::Confirmed)
}
})
}
}
/// The implementation of the standard regex matcher.
#[derive(Clone, Debug)]
struct StandardMatcher {
/// The regular expression compiled from the pattern provided by the
/// caller.
regex: Regex,
/// A map from capture group name to its corresponding index.
names: HashMap<String, usize>,
}
impl StandardMatcher {
fn new(expr: &ConfiguredHIR) -> Result<StandardMatcher, Error> {
let regex = expr.regex()?;
let mut names = HashMap::new();
for (i, optional_name) in regex.capture_names().enumerate() {
if let Some(name) = optional_name {
names.insert(name.to_string(), i);
}
}
Ok(StandardMatcher { regex, names })
}
}
impl Matcher for StandardMatcher {
type Captures = RegexCaptures;
type Error = NoError;
fn find_at(
&self,
haystack: &[u8],
at: usize,
) -> Result<Option<Match>, NoError> {
Ok(self.regex
.find_at(haystack, at)
.map(|m| Match::new(m.start(), m.end())))
}
fn new_captures(&self) -> Result<RegexCaptures, NoError> {
Ok(RegexCaptures::new(self.regex.capture_locations()))
}
fn capture_count(&self) -> usize {
self.regex.captures_len()
}
fn capture_index(&self, name: &str) -> Option<usize> {
self.names.get(name).map(|i| *i)
}
fn try_find_iter<F, E>(
&self,
haystack: &[u8],
mut matched: F,
) -> Result<Result<(), E>, NoError>
where F: FnMut(Match) -> Result<bool, E>
{
for m in self.regex.find_iter(haystack) {
match matched(Match::new(m.start(), m.end())) {
Ok(true) => continue,
Ok(false) => return Ok(Ok(())),
Err(err) => return Ok(Err(err)),
}
}
Ok(Ok(()))
}
fn captures_at(
&self,
haystack: &[u8],
at: usize,
caps: &mut RegexCaptures,
) -> Result<bool, NoError> {
Ok(self.regex.captures_read_at(
&mut caps.locations_mut(), haystack, at,
).is_some())
}
fn shortest_match_at(
&self,
haystack: &[u8],
at: usize,
) -> Result<Option<usize>, NoError> {
Ok(self.regex.shortest_match_at(haystack, at))
}
}
/// Represents the match offsets of each capturing group in a match.
///
/// The first, or `0`th capture group, always corresponds to the entire match
/// and is guaranteed to be present when a match occurs. The next capture
/// group, at index `1`, corresponds to the first capturing group in the regex,
/// ordered by the position at which the left opening parenthesis occurs.
///
/// Note that not all capturing groups are guaranteed to be present in a match.
/// For example, in the regex, `(?P<foo>\w)|(?P<bar>\W)`, only one of `foo`
/// or `bar` will ever be set in any given match.
///
/// In order to access a capture group by name, you'll need to first find the
/// index of the group using the corresponding matcher's `capture_index`
/// method, and then use that index with `RegexCaptures::get`.
#[derive(Clone, Debug)]
pub struct RegexCaptures(RegexCapturesImp);
#[derive(Clone, Debug)]
enum RegexCapturesImp {
AhoCorasick {
/// The start and end of the match, corresponding to capture group 0.
mat: Option<Match>,
},
Regex {
/// Where the locations are stored.
locs: CaptureLocations,
/// These captures behave as if the capturing groups begin at the given
/// offset. When set to `0`, this has no affect and capture groups are
/// indexed like normal.
///
/// This is useful when building matchers that wrap arbitrary regular
/// expressions. For example, `WordMatcher` takes an existing regex
/// `re` and creates `(?:^|\W)(re)(?:$|\W)`, but hides the fact that
/// the regex has been wrapped from the caller. In order to do this,
/// the matcher and the capturing groups must behave as if `(re)` is
/// the `0`th capture group.
offset: usize,
/// When enable, the end of a match has `\r` stripped from it, if one
/// exists.
strip_crlf: bool,
},
}
impl Captures for RegexCaptures {
fn len(&self) -> usize {
match self.0 {
RegexCapturesImp::AhoCorasick { .. } => 1,
RegexCapturesImp::Regex { ref locs, offset, .. } => {
locs.len().checked_sub(offset).unwrap()
}
}
}
fn get(&self, i: usize) -> Option<Match> {
match self.0 {
RegexCapturesImp::AhoCorasick { mat, .. } => {
if i == 0 {
mat
} else {
None
}
}
RegexCapturesImp::Regex { ref locs, offset, strip_crlf } => {
if !strip_crlf {
let actual = i.checked_add(offset).unwrap();
return locs.pos(actual).map(|(s, e)| Match::new(s, e));
}
// currently don't support capture offsetting with CRLF
// stripping
assert_eq!(offset, 0);
let m = match locs.pos(i).map(|(s, e)| Match::new(s, e)) {
None => return None,
Some(m) => m,
};
// If the end position of this match corresponds to the end
// position of the overall match, then we apply our CRLF
// stripping. Otherwise, we cannot assume stripping is correct.
if i == 0 || m.end() == locs.pos(0).unwrap().1 {
Some(m.with_end(m.end() - 1))
} else {
Some(m)
}
}
}
}
}
impl RegexCaptures {
pub(crate) fn simple() -> RegexCaptures {
RegexCaptures(RegexCapturesImp::AhoCorasick { mat: None })
}
pub(crate) fn new(locs: CaptureLocations) -> RegexCaptures {
RegexCaptures::with_offset(locs, 0)
}
pub(crate) fn with_offset(
locs: CaptureLocations,
offset: usize,
) -> RegexCaptures {
RegexCaptures(RegexCapturesImp::Regex {
locs, offset, strip_crlf: false,
})
}
pub(crate) fn locations(&self) -> &CaptureLocations {
match self.0 {
RegexCapturesImp::AhoCorasick { .. } => {
panic!("getting locations for simple captures is invalid")
}
RegexCapturesImp::Regex { ref locs, .. } => {
locs
}
}
}
pub(crate) fn locations_mut(&mut self) -> &mut CaptureLocations {
match self.0 {
RegexCapturesImp::AhoCorasick { .. } => {
panic!("getting locations for simple captures is invalid")
}
RegexCapturesImp::Regex { ref mut locs, .. } => {
locs
}
}
}
pub(crate) fn strip_crlf(&mut self, yes: bool) {
match self.0 {
RegexCapturesImp::AhoCorasick { .. } => {
panic!("setting strip_crlf for simple captures is invalid")
}
RegexCapturesImp::Regex { ref mut strip_crlf, .. } => {
*strip_crlf = yes;
}
}
}
pub(crate) fn set_simple(&mut self, one: Option<Match>) {
match self.0 {
RegexCapturesImp::AhoCorasick { ref mut mat } => {
*mat = one;
}
RegexCapturesImp::Regex { .. } => {
panic!("setting simple captures for regex is invalid")
}
}
}
}
#[cfg(test)]
mod tests {
use grep_matcher::{LineMatchKind, Matcher};
use super::*;
// Test that enabling word matches does the right thing and demonstrate
// the difference between it and surrounding the regex in `\b`.
#[test]
fn word() {
let matcher = RegexMatcherBuilder::new()
.word(true)
.build(r"-2")
.unwrap();
assert!(matcher.is_match(b"abc -2 foo").unwrap());
let matcher = RegexMatcherBuilder::new()
.word(false)
.build(r"\b-2\b")
.unwrap();
assert!(!matcher.is_match(b"abc -2 foo").unwrap());
}
// Test that enabling a line terminator prevents it from matching through
// said line terminator.
#[test]
fn line_terminator() {
// This works, because there's no line terminator specified.
let matcher = RegexMatcherBuilder::new()
.build(r"abc\sxyz")
.unwrap();
assert!(matcher.is_match(b"abc\nxyz").unwrap());
// This doesn't.
let matcher = RegexMatcherBuilder::new()
.line_terminator(Some(b'\n'))
.build(r"abc\sxyz")
.unwrap();
assert!(!matcher.is_match(b"abc\nxyz").unwrap());
}
// Ensure that the builder returns an error if a line terminator is set
// and the regex could not be modified to remove a line terminator.
#[test]
fn line_terminator_error() {
assert!(RegexMatcherBuilder::new()
.line_terminator(Some(b'\n'))
.build(r"a\nz")
.is_err())
}
// Test that enabling CRLF permits `$` to match at the end of a line.
#[test]
fn line_terminator_crlf() {
// Test normal use of `$` with a `\n` line terminator.
let matcher = RegexMatcherBuilder::new()
.multi_line(true)
.build(r"abc$")
.unwrap();
assert!(matcher.is_match(b"abc\n").unwrap());
// Test that `$` doesn't match at `\r\n` boundary normally.
let matcher = RegexMatcherBuilder::new()
.multi_line(true)
.build(r"abc$")
.unwrap();
assert!(!matcher.is_match(b"abc\r\n").unwrap());
// Now check the CRLF handling.
let matcher = RegexMatcherBuilder::new()
.multi_line(true)
.crlf(true)
.build(r"abc$")
.unwrap();
assert!(matcher.is_match(b"abc\r\n").unwrap());
}
// Test that smart case works.
#[test]
fn case_smart() {
let matcher = RegexMatcherBuilder::new()
.case_smart(true)
.build(r"abc")
.unwrap();
assert!(matcher.is_match(b"ABC").unwrap());
let matcher = RegexMatcherBuilder::new()
.case_smart(true)
.build(r"aBc")
.unwrap();
assert!(!matcher.is_match(b"ABC").unwrap());
}
// Test that finding candidate lines works as expected.
#[test]
fn candidate_lines() {
fn is_confirmed(m: LineMatchKind) -> bool {
match m {
LineMatchKind::Confirmed(_) => true,
_ => false,
}
}
fn is_candidate(m: LineMatchKind) -> bool {
match m {
LineMatchKind::Candidate(_) => true,
_ => false,
}
}
// With no line terminator set, we can't employ any optimizations,
// so we get a confirmed match.
let matcher = RegexMatcherBuilder::new()
.build(r"\wfoo\s")
.unwrap();
let m = matcher.find_candidate_line(b"afoo ").unwrap().unwrap();
assert!(is_confirmed(m));
// With a line terminator and a regex specially crafted to have an
// easy-to-detect inner literal, we can apply an optimization that
// quickly finds candidate matches.
let matcher = RegexMatcherBuilder::new()
.line_terminator(Some(b'\n'))
.build(r"\wfoo\s")
.unwrap();
let m = matcher.find_candidate_line(b"afoo ").unwrap().unwrap();
assert!(is_candidate(m));
}
}
| 35.895184 | 83 | 0.583721 |
fd6934592a67e5625bc0b0a22fadfa4f79b0a225
| 2,223 |
swift
|
Swift
|
Sources/ShapeUp/CornerShape/EnumeratedCornerShape/CornerTriangle.swift
|
ryanlintott/ShapeUp
|
1e6677c8e7cf80525b85519c2e0b880b339dd100
|
[
"MIT"
] | 30 |
2022-03-24T13:39:10.000Z
|
2022-03-31T14:37:32.000Z
|
Sources/ShapeUp/CornerShape/EnumeratedCornerShape/CornerTriangle.swift
|
ryanlintott/ShapeUp
|
1e6677c8e7cf80525b85519c2e0b880b339dd100
|
[
"MIT"
] | null | null | null |
Sources/ShapeUp/CornerShape/EnumeratedCornerShape/CornerTriangle.swift
|
ryanlintott/ShapeUp
|
1e6677c8e7cf80525b85519c2e0b880b339dd100
|
[
"MIT"
] | null | null | null |
//
// CornerTriangle.swift
// ShapeUp
//
// Created by Ryan Lintott on 2022-03-08.
//
import SwiftUI
/**
A triangular shape with an adjustable top point and individually stylable corners, aligned inside the frame of the view containing it.
The top point is positioned relative to the top left corner and the value is a `RelatableValue` relative to the width of the frame provided. The default is in the middle.
This shape can either be used in a SwiftUI View like any other `InsettableShape`
CornerTriangle(topPoint: .relative(0.6), styles: [
.top: .straight(radius: 10),
.bottomRight: .rounded(radius: .relative(0.3)),
.bottomLeft: .concave(radius: .relative(0.2))
])
.fill()
The corners can be accessed directly for use in a more complex shape
public func corners(in rect: CGRect) -> [Corner] {
CornerTriangle(topPoint: 30)
.corners(in: rect)
.inset(by: 10)
.addingNotch(Notch(.rectangle, depth: 5), afterCornerIndex: 0)
}
*/
public struct CornerTriangle: EnumeratedCornerShape {
public var closed = true
public var insetAmount: CGFloat = 0
/// An enumeration to indicate the three corners of a triangle.
public enum ShapeCorner: CaseIterable, Hashable {
case top
case bottomRight
case bottomLeft
}
public var topPoint: RelatableValue
public var styles: [ShapeCorner: CornerStyle?]
/// Creates a 2d triangular shape with specified top point and styles for each corner.
/// - Parameters:
/// - topPoint: Position of the top point from the top left corner of the frame. Relative values are relative to width.
/// - styles: A dictionary describing the style of each shape corner.
public init(topPoint: RelatableValue = .relative(0.5), styles: [ShapeCorner: CornerStyle] = [:]) {
self.topPoint = topPoint
self.styles = styles
}
public func points(in rect: CGRect) -> [ShapeCorner: CGPoint] {
[
.top: rect.point(.topLeft).moved(dx: topPoint.value(using: rect.width)),
.bottomRight: rect.point(.bottomRight),
.bottomLeft: rect.point(.bottomLeft)
]
}
}
| 34.734375 | 170 | 0.660819 |
e5a2dba05897a1888a4ba15f32336d975b549bbb
| 796 |
kt
|
Kotlin
|
app/src/main/java/abdullah/elamien/bloodbank/utils/PreferenceUtils.kt
|
AbduallahAtta/BloodBank
|
e165fe3ade9c04b4dba3f2b90e9b3ff457fb4b67
|
[
"MIT"
] | 14 |
2019-06-27T20:07:52.000Z
|
2020-03-17T06:02:07.000Z
|
app/src/main/java/abdullah/elamien/bloodbank/utils/PreferenceUtils.kt
|
AbduallahAtta/BloodBank
|
e165fe3ade9c04b4dba3f2b90e9b3ff457fb4b67
|
[
"MIT"
] | null | null | null |
app/src/main/java/abdullah/elamien/bloodbank/utils/PreferenceUtils.kt
|
AbduallahAtta/BloodBank
|
e165fe3ade9c04b4dba3f2b90e9b3ff457fb4b67
|
[
"MIT"
] | 4 |
2019-06-29T20:21:58.000Z
|
2020-02-13T17:33:08.000Z
|
package abdullah.elamien.bloodbank.utils
import abdullah.elamien.bloodbank.R
import android.content.Context
import androidx.preference.PreferenceManager
@Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
class PreferenceUtils {
fun isNotificationsEnabled(context: Context): Boolean {
val preferences = PreferenceManager.getDefaultSharedPreferences(context)
return preferences.getBoolean(context.getString(R.string.notification_key), true)
}
companion object {
fun getLanguageCode(context: Context): String {
val preferences = PreferenceManager.getDefaultSharedPreferences(context)
return preferences.getString(context.getString(R.string.language_key), context.getString(R.string.arabic_language_value))
}
}
}
| 33.166667 | 133 | 0.770101 |
5828532454ec951c4cc3f2597aa04e66e384f148
| 3,739 |
rs
|
Rust
|
healer_core/src/ty/ptr.rs
|
SunHao-0/healer
|
ea7e71361b17f85e9c32faedbc9ef404c9384b8a
|
[
"Apache-2.0"
] | 180 |
2020-01-21T15:38:03.000Z
|
2022-03-22T01:28:41.000Z
|
healer_core/src/ty/ptr.rs
|
Samhaosss/healer
|
2efbb44c7dfaaa6749cd1541949b26fd1d2143fa
|
[
"Apache-2.0"
] | 22 |
2020-04-01T12:06:46.000Z
|
2022-02-23T02:11:03.000Z
|
healer_core/src/ty/ptr.rs
|
Samhaosss/healer
|
2efbb44c7dfaaa6749cd1541949b26fd1d2143fa
|
[
"Apache-2.0"
] | 26 |
2020-03-19T12:43:26.000Z
|
2022-02-21T17:29:20.000Z
|
use crate::{
ty::{common::CommonInfo, Dir},
value::{PtrValue, Value, VmaValue},
};
use std::{fmt::Display, ops::RangeInclusive};
use super::TypeId;
#[derive(Debug, Clone)]
pub struct VmaType {
comm: CommonInfo,
range: Option<RangeInclusive<u64>>,
}
impl VmaType {
common_attr_getter! {}
default_int_format_attr_getter! {}
extra_attr_getter! {}
#[inline(always)]
pub fn format(&self) -> crate::ty::BinaryFormat {
crate::ty::BinaryFormat::Native
}
#[inline(always)]
pub fn range(&self) -> Option<RangeInclusive<u64>> {
self.range.clone()
}
pub fn default_value(&self, dir: Dir) -> Value {
VmaValue::new_special(self.id(), dir, 0).into()
}
pub fn is_default(&self, val: &Value) -> bool {
let val = val.checked_as_vma();
val.is_special() && val.addr == 0
}
}
impl Display for VmaType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "vma")?;
if let Some(range) = self.range.as_ref() {
if range.start() == range.end() {
write!(f, "[{}]", range.start())?;
} else {
write!(f, "[{}:{}]", range.start(), range.end())?;
}
}
Ok(())
}
}
eq_ord_hash_impl!(VmaType);
#[derive(Debug, Clone)]
pub struct VmaTypeBuilder {
comm: CommonInfo,
range: Option<RangeInclusive<u64>>,
}
impl VmaTypeBuilder {
pub fn new(comm: CommonInfo) -> Self {
Self { comm, range: None }
}
pub fn comm(&mut self, comm: CommonInfo) -> &mut Self {
self.comm = comm;
self
}
pub fn range(&mut self, range: RangeInclusive<u64>) -> &mut Self {
self.range = Some(range);
self
}
pub fn build(self) -> VmaType {
VmaType {
comm: self.comm,
range: self.range,
}
}
}
#[derive(Debug, Clone)]
pub struct PtrType {
comm: CommonInfo,
elem: TypeId, // handle recursive type
dir: Dir,
}
impl PtrType {
pub const MAX_SPECIAL_POINTERS: u64 = 16;
common_attr_getter! {}
default_int_format_attr_getter! {}
extra_attr_getter! {}
#[inline(always)]
pub fn format(&self) -> crate::ty::BinaryFormat {
crate::ty::BinaryFormat::Native
}
#[inline(always)]
pub fn elem(&self) -> TypeId {
self.elem
}
#[inline(always)]
pub fn dir(&self) -> Dir {
self.dir
}
pub fn default_value(&self, dir: Dir) -> Value {
// we don't have `target` here, so just give a null
PtrValue::new_special(self.id(), dir, 0).into()
}
pub fn is_default(&self, val: &Value) -> bool {
let val = val.checked_as_ptr();
val.is_special()
}
}
impl Display for PtrType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "ptr[{:?}, {}]", self.dir, self.elem)
}
}
eq_ord_hash_impl!(PtrType);
#[derive(Debug, Clone)]
pub struct PtrTypeBuilder {
comm: CommonInfo,
elem: Option<TypeId>,
dir: Dir,
}
impl PtrTypeBuilder {
pub fn new(comm: CommonInfo) -> Self {
Self {
comm,
elem: None,
dir: Dir::In,
}
}
pub fn comm(&mut self, comm: CommonInfo) -> &mut Self {
self.comm = comm;
self
}
pub fn elem(&mut self, elem: TypeId) -> &mut Self {
self.elem = Some(elem);
self
}
pub fn dir<T: Into<Dir>>(&mut self, dir: T) -> &mut Self {
self.dir = dir.into();
self
}
pub fn build(self) -> PtrType {
PtrType {
comm: self.comm,
elem: self.elem.unwrap(),
dir: self.dir,
}
}
}
| 21.244318 | 72 | 0.538379 |
a1b3a896cb50d8d8881e214e879fcc2d4ad725c8
| 6,721 |
go
|
Go
|
vendor/github.com/golang/leveldb/db/options.go
|
Yangjxxxxx/ZNBase
|
dcf993b73250dd5cb63041f4d9cf098941f67b2b
|
[
"MIT",
"BSD-3-Clause"
] | 1,252 |
2015-07-21T14:17:57.000Z
|
2022-03-30T09:19:48.000Z
|
db/options.go
|
huangchulong/leveldb
|
259d9253d71996b7778a3efb4144fe4892342b18
|
[
"BSD-3-Clause"
] | 13 |
2015-07-28T07:06:24.000Z
|
2021-07-08T19:57:54.000Z
|
db/options.go
|
huangchulong/leveldb
|
259d9253d71996b7778a3efb4144fe4892342b18
|
[
"BSD-3-Clause"
] | 176 |
2015-07-21T00:54:58.000Z
|
2022-03-20T05:56:38.000Z
|
// Copyright 2011 The LevelDB-Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package db
// Compression is the per-block compression algorithm to use.
type Compression int
const (
DefaultCompression Compression = iota
NoCompression
SnappyCompression
nCompression
)
// FilterPolicy is an algorithm for probabilistically encoding a set of keys.
// The canonical implementation is a Bloom filter.
//
// Every FilterPolicy has a name. This names the algorithm itself, not any one
// particular instance. Aspects specific to a particular instance, such as the
// set of keys or any other parameters, will be encoded in the []byte filter
// returned by NewFilter.
//
// The name may be written to files on disk, along with the filter data. To use
// these filters, the FilterPolicy name at the time of writing must equal the
// name at the time of reading. If they do not match, the filters will be
// ignored, which will not affect correctness but may affect performance.
type FilterPolicy interface {
// Name names the filter policy.
Name() string
// AppendFilter appends to dst an encoded filter that holds a set of []byte
// keys.
AppendFilter(dst []byte, keys [][]byte) []byte
// MayContain returns whether the encoded filter may contain given key.
// False positives are possible, where it returns true for keys not in the
// original set.
MayContain(filter, key []byte) bool
}
// Options holds the optional parameters for leveldb's DB implementations.
// These options apply to the DB at large; per-query options are defined by
// the ReadOptions and WriteOptions types.
//
// Options are typically passed to a constructor function as a struct literal.
// The GetXxx methods are used inside the DB implementations; they return the
// default parameter value if the *Options receiver is nil or the field value
// is zero.
//
// Read/Write options:
// - Comparer
// - FileSystem
// - FilterPolicy
// - MaxOpenFiles
// Read options:
// - VerifyChecksums
// Write options:
// - BlockRestartInterval
// - BlockSize
// - Compression
// - ErrorIfDBExists
// - WriteBufferSize
type Options struct {
// BlockRestartInterval is the number of keys between restart points
// for delta encoding of keys.
//
// The default value is 16.
BlockRestartInterval int
// BlockSize is the minimum uncompressed size in bytes of each table block.
//
// The default value is 4096.
BlockSize int
// Comparer defines a total ordering over the space of []byte keys: a 'less
// than' relationship. The same comparison algorithm must be used for reads
// and writes over the lifetime of the DB.
//
// The default value uses the same ordering as bytes.Compare.
Comparer Comparer
// Compression defines the per-block compression to use.
//
// The default value (DefaultCompression) uses snappy compression.
Compression Compression
// ErrorIfDBExists is whether it is an error if the database already exists.
//
// The default value is false.
ErrorIfDBExists bool
// FileSystem maps file names to byte storage.
//
// The default value uses the underlying operating system's file system.
FileSystem FileSystem
// FilterPolicy defines a filter algorithm (such as a Bloom filter) that
// can reduce disk reads for Get calls.
//
// One such implementation is bloom.FilterPolicy(10) from the leveldb/bloom
// package.
//
// The default value means to use no filter.
FilterPolicy FilterPolicy
// MaxOpenFiles is a soft limit on the number of open files that can be
// used by the DB.
//
// The default value is 1000.
MaxOpenFiles int
// WriteBufferSize is the amount of data to build up in memory (backed by
// an unsorted log on disk) before converting to a sorted on-disk file.
//
// Larger values increase performance, especially during bulk loads. Up to
// two write buffers may be held in memory at the same time, so you may
// wish to adjust this parameter to control memory usage. Also, a larger
// write buffer will result in a longer recovery time the next time the
// database is opened.
//
// The default value is 4MiB.
WriteBufferSize int
// VerifyChecksums is whether to verify the per-block checksums in a DB.
//
// The default value is false.
VerifyChecksums bool
}
func (o *Options) GetBlockRestartInterval() int {
if o == nil || o.BlockRestartInterval <= 0 {
return 16
}
return o.BlockRestartInterval
}
func (o *Options) GetBlockSize() int {
if o == nil || o.BlockSize <= 0 {
return 4096
}
return o.BlockSize
}
func (o *Options) GetComparer() Comparer {
if o == nil || o.Comparer == nil {
return DefaultComparer
}
return o.Comparer
}
func (o *Options) GetCompression() Compression {
if o == nil || o.Compression <= DefaultCompression || o.Compression >= nCompression {
// Default to SnappyCompression.
return SnappyCompression
}
return o.Compression
}
func (o *Options) GetErrorIfDBExists() bool {
if o == nil {
return false
}
return o.ErrorIfDBExists
}
func (o *Options) GetFileSystem() FileSystem {
if o == nil || o.FileSystem == nil {
return DefaultFileSystem
}
return o.FileSystem
}
func (o *Options) GetFilterPolicy() FilterPolicy {
if o == nil {
return nil
}
return o.FilterPolicy
}
func (o *Options) GetMaxOpenFiles() int {
if o == nil || o.MaxOpenFiles == 0 {
return 1000
}
return o.MaxOpenFiles
}
func (o *Options) GetWriteBufferSize() int {
if o == nil || o.WriteBufferSize <= 0 {
return 4 * 1024 * 1024
}
return o.WriteBufferSize
}
func (o *Options) GetVerifyChecksums() bool {
if o == nil {
return false
}
return o.VerifyChecksums
}
// ReadOptions hold the optional per-query parameters for Get and Find
// operations.
//
// Like Options, a nil *ReadOptions is valid and means to use the default
// values.
type ReadOptions struct {
// No fields so far.
}
// WriteOptions hold the optional per-query parameters for Set and Delete
// operations.
//
// Like Options, a nil *WriteOptions is valid and means to use the default
// values.
type WriteOptions struct {
// Sync is whether to sync underlying writes from the OS buffer cache
// through to actual disk, if applicable. Setting Sync can result in
// slower writes.
//
// If false, and the machine crashes, then some recent writes may be lost.
// Note that if it is just the process that crashes (and the machine does
// not) then no writes will be lost.
//
// In other words, Sync being false has the same semantics as a write
// system call. Sync being true means write followed by fsync.
//
// The default value is false.
Sync bool
}
func (o *WriteOptions) GetSync() bool {
return o != nil && o.Sync
}
| 28.478814 | 86 | 0.724743 |
cbc3da4918c8ef3f860d50ebd010c2ee1b3e4e9f
| 474 |
swift
|
Swift
|
test/Profiler/coverage_arg_ternary.swift
|
gandhi56/swift
|
2d851ff61991bb8964079661339671c2fd21d88a
|
[
"Apache-2.0"
] | 72,551 |
2015-12-03T16:45:13.000Z
|
2022-03-31T18:57:59.000Z
|
test/Profiler/coverage_arg_ternary.swift
|
gandhi56/swift
|
2d851ff61991bb8964079661339671c2fd21d88a
|
[
"Apache-2.0"
] | 39,352 |
2015-12-03T16:55:06.000Z
|
2022-03-31T23:43:41.000Z
|
test/Profiler/coverage_arg_ternary.swift
|
gandhi56/swift
|
2d851ff61991bb8964079661339671c2fd21d88a
|
[
"Apache-2.0"
] | 13,845 |
2015-12-03T16:45:13.000Z
|
2022-03-31T11:32:29.000Z
|
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_arg_ternary %s | %FileCheck %s
// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -emit-ir %s
var s: String?
// CHECK: sil_coverage_map {{.*}} "$s20coverage_arg_ternary1f0B0ySSSg_tF"
// CHECK-NEXT: [[@LINE+2]]:43 -> [[@LINE+2]]:45 : 0
// CHECK-NEXT: }
func f(arg: String? = s != nil ? s : nil) {}
| 47.4 | 180 | 0.691983 |
a8558aafe3753299be2ade85f78b3c782fd0c02e
| 2,912 |
rs
|
Rust
|
tests/am_cputests/src/cputests/add_u64.rs
|
RISCVERS/rust-xs-evaluation
|
3ad19cf98ede9e8bc7546bf351e582c57b96888d
|
[
"MIT"
] | 3 |
2021-01-02T15:58:29.000Z
|
2021-01-04T10:32:23.000Z
|
tests/am_cputests/src/cputests/add_u64.rs
|
SKTT1Ryze/rust-xs-evaluation
|
3ad19cf98ede9e8bc7546bf351e582c57b96888d
|
[
"MIT"
] | null | null | null |
tests/am_cputests/src/cputests/add_u64.rs
|
SKTT1Ryze/rust-xs-evaluation
|
3ad19cf98ede9e8bc7546bf351e582c57b96888d
|
[
"MIT"
] | 1 |
2021-01-04T01:28:25.000Z
|
2021-01-04T01:28:25.000Z
|
/// AddU64Test Implementation
use crate::benchmark::{BenchMark, CpuTestErr, xs_assert_eq};
use crate::alloc::{
vec::Vec,
vec,
string::String,
};
#[no_mangle]
pub struct AddU64Test {
test_data: Vec<u64>,
answer: Vec<u64>,
}
impl BenchMark<CpuTestErr> for AddU64Test {
fn new() -> Self {
let mut test_data = Vec::new();
test_data.push(0u64);
test_data.push(1u64);
test_data.push(2u64);
test_data.push(0x7fff_ffff_ffff_ffffu64);
test_data.push(0x8000_0000_0000_0000u64);
test_data.push(0x8000_0000_0000_0001u64);
test_data.push(0xffff_ffff_ffff_fffeu64);
test_data.push(0xffff_ffff_ffff_ffffu64);
let answer = vec![0u64, 0x1u64, 0x2u64, 0x7fffffffffffffffu64, 0x8000000000000000u64, 0x8000000000000001u64, 0xfffffffffffffffeu64, 0xffffffffffffffffu64, 0x1u64, 0x2u64, 0x3u64, 0x8000000000000000u64, 0x8000000000000001u64, 0x8000000000000002u64, 0xffffffffffffffffu64, 0u64, 0x2u64, 0x3u64, 0x4u64, 0x8000000000000001u64, 0x8000000000000002u64, 0x8000000000000003u64, 0u64, 0x1u64, 0x7fffffffffffffffu64, 0x8000000000000000u64, 0x8000000000000001u64, 0xfffffffffffffffeu64, 0xffffffffffffffffu64, 0u64, 0x7ffffffffffffffdu64, 0x7ffffffffffffffeu64, 0x8000000000000000u64, 0x8000000000000001u64, 0x8000000000000002u64, 0xffffffffffffffffu64, 0u64, 0x1u64, 0x7ffffffffffffffeu64, 0x7fffffffffffffffu64, 0x8000000000000001u64, 0x8000000000000002u64, 0x8000000000000003u64, 0u64, 0x1u64, 0x2u64, 0x7fffffffffffffffu64, 0x8000000000000000u64, 0xfffffffffffffffeu64, 0xffffffffffffffffu64, 0u64, 0x7ffffffffffffffdu64, 0x7ffffffffffffffeu64, 0x7fffffffffffffffu64, 0xfffffffffffffffcu64, 0xfffffffffffffffdu64, 0xffffffffffffffffu64, 0u64, 0x1u64, 0x7ffffffffffffffeu64, 0x7fffffffffffffffu64, 0x8000000000000000u64, 0xfffffffffffffffdu64, 0xfffffffffffffffeu64];
Self {
test_data,
answer,
}
}
fn single_test(&mut self) -> Result<String, CpuTestErr> {
let mut ans_index = 0;
for i in 0..self.test_data.len() {
for j in 0..self.test_data.len() {
xs_assert_eq!(self.test_data[i] + self.test_data[j], self.answer[ans_index], self.err_type());
ans_index += 1;
}
}
Ok(String::from("addu64_single_test"))
}
fn bench_test(&mut self, bench_size: usize) -> Result<String, CpuTestErr> {
for _ in 0..bench_size {
let mut ans_index = 0;
for i in 0..self.test_data.len() {
for j in 0..self.test_data.len() {
xs_assert_eq!(self.test_data[i] + self.test_data[j], self.answer[ans_index], self.err_type());
ans_index += 1;
}
}
}
Ok(String::from("addu64_bench_test"))
}
fn err_type(&self) -> CpuTestErr {
CpuTestErr::AddU64TestErr
}
}
| 47.737705 | 1,167 | 0.691621 |
7983c20492b8ecc3e03fa850049bd4ec80d3b75e
| 914 |
asm
|
Assembly
|
test/test.Array.splitb.asm
|
richRemer/atlatl
|
169c0c9c29d277dc1295e6c37b0963af6e02741a
|
[
"MIT"
] | null | null | null |
test/test.Array.splitb.asm
|
richRemer/atlatl
|
169c0c9c29d277dc1295e6c37b0963af6e02741a
|
[
"MIT"
] | null | null | null |
test/test.Array.splitb.asm
|
richRemer/atlatl
|
169c0c9c29d277dc1295e6c37b0963af6e02741a
|
[
"MIT"
] | null | null | null |
global test_case
extern Array.splitb
extern Array.eachb
extern std.outb
extern std.outln
extern sys.error
%include "Array.inc"
section .text
test_case:
mov rax, test_array ; Array to split
mov rbx, 4 ; delimit with value 4
call Array.splitb ; split into two arrays (plus delimiter)
push qword[rcx+Array.length] ; preserve leftover length
mov rbx, std.outb ; fn to call
call Array.eachb ; print values from array
mov rax, empty_str ; empty message
call std.outln ; end line
pop rax ; restore length
call sys.error ; exit with array length
section .data
test_bytes: db 0x1, 0x2, 0x3, 0x4, 0x5, 0x6
empty_str: db 0x0
test_array:
istruc Array
at Array.pdata, dq test_bytes
at Array.length, dq 6
iend
| 25.388889 | 76 | 0.588621 |
c3507fb6b9db04992f968eb475574ec5fc3ef95f
| 2,240 |
go
|
Go
|
identity/identity.go
|
ONSdigital/dp-commit-verifier
|
c821f56b03094da6de3ef02abfa0e50c74bd7852
|
[
"MIT"
] | null | null | null |
identity/identity.go
|
ONSdigital/dp-commit-verifier
|
c821f56b03094da6de3ef02abfa0e50c74bd7852
|
[
"MIT"
] | null | null | null |
identity/identity.go
|
ONSdigital/dp-commit-verifier
|
c821f56b03094da6de3ef02abfa0e50c74bd7852
|
[
"MIT"
] | 1 |
2021-04-11T08:12:06.000Z
|
2021-04-11T08:12:06.000Z
|
// Package identity provides functionality for validating the identity of a
// commit author.
package identity
import (
"io/ioutil"
"os"
"os/exec"
"regexp"
"github.com/google/go-github/github"
"golang.org/x/oauth2"
)
var client = func() *github.Client {
ts := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: os.Getenv("GITHUB_ACCESS_TOKEN")})
oc := oauth2.NewClient(oauth2.NoContext, ts)
return github.NewClient(oc)
}()
type identity struct {
Payload string
Signature string
Verified bool
}
// IsValid returns the validity of the identity of a commit author.
func IsValid(owner, name, id string) (bool, error) {
i, err := getIdentity(owner, name, id)
if err != nil {
return false, err
}
if i == nil || i.Verified == false {
return false, nil
}
v, err := verify(i.Signature, i.Payload)
if err != nil {
return false, err
}
if !v {
return false, nil
}
return true, nil
}
func getIdentity(owner, respository, commit string) (*identity, error) {
c, _, err := client.Git.GetCommit(owner, respository, commit)
if err != nil {
return nil, err
}
if c.Verification == nil || c.Verification.Payload == nil || c.Verification.Signature == nil {
return nil, nil
}
return &identity{
Payload: *c.Verification.Payload,
Signature: *c.Verification.Signature,
Verified: *c.Verification.Verified,
}, nil
}
func verify(signature, payload string) (bool, error) {
f, err := ioutil.TempFile(os.TempDir(), "commit-signature")
if err != nil {
return false, err
}
defer func() {
f.Close()
os.Remove(f.Name())
}()
if _, err = f.Write([]byte(signature)); err != nil {
return false, err
}
cmd := exec.Command("gpg", "--status-fd=1", "--keyid-format=long", "--verify", f.Name(), "-")
o, err := cmd.StdoutPipe()
if err != nil {
return false, err
}
i, err := cmd.StdinPipe()
if err != nil {
return false, err
}
if _, err = i.Write([]byte(payload)); err != nil {
return false, err
}
i.Close()
if err = cmd.Start(); err != nil {
return false, err
}
b, err := ioutil.ReadAll(o)
if err != nil {
return false, err
}
m, err := regexp.Match(`(?m)^\[GNUPG:\] GOODSIG`, b)
if err != nil {
return false, err
}
if !m {
return false, nil
}
return true, nil
}
| 19.649123 | 95 | 0.64375 |
b126ba9bf9e2a2a78e899284ddeae336e6d07689
| 379 |
css
|
CSS
|
django_admin_inline_paginator/static/django_admin_inline_paginator/paginator.css
|
aitorres/django-admin-inline-paginator
|
759f598c9366de1902a21c802ba3fffac0e86274
|
[
"MIT"
] | 54 |
2020-11-13T10:04:40.000Z
|
2022-03-30T07:22:19.000Z
|
django_admin_inline_paginator/static/django_admin_inline_paginator/paginator.css
|
aitorres/django-admin-inline-paginator
|
759f598c9366de1902a21c802ba3fffac0e86274
|
[
"MIT"
] | 19 |
2020-12-21T09:49:04.000Z
|
2022-03-08T10:03:47.000Z
|
django_admin_inline_paginator/static/django_admin_inline_paginator/paginator.css
|
aitorres/django-admin-inline-paginator
|
759f598c9366de1902a21c802ba3fffac0e86274
|
[
"MIT"
] | 12 |
2021-02-14T14:07:34.000Z
|
2022-02-24T18:32:44.000Z
|
.btn-page {
border: none;
padding: 5px 10px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 12px;
margin: 4px 2px;
cursor: pointer;
}
.page-selected {
background-color: #ffffff;
color: #666;
}
.page-available {
background-color: #008cba;
color: white !important;
}
.results {
background-color: #ffffff;
color: #666;
}
| 14.576923 | 28 | 0.656992 |
581a3eefcf42cafa994e0166fa4d04727746ba72
| 2,363 |
h
|
C
|
src/Segues/PageTurn.h
|
ArthurCose/Swoosh
|
249785d9a0365e52cb81eb63790a7b8b15105bec
|
[
"Zlib"
] | null | null | null |
src/Segues/PageTurn.h
|
ArthurCose/Swoosh
|
249785d9a0365e52cb81eb63790a7b8b15105bec
|
[
"Zlib"
] | null | null | null |
src/Segues/PageTurn.h
|
ArthurCose/Swoosh
|
249785d9a0365e52cb81eb63790a7b8b15105bec
|
[
"Zlib"
] | null | null | null |
#pragma once
#include <Swoosh/Segue.h>
#include <Swoosh/Ease.h>
#include <Swoosh/Game.h>
#include <Swoosh/EmbedGLSL.h>
#include <Swoosh/Shaders.h>
using namespace swoosh;
/**
@class PageTurn
@brief Divides the screen into vertices that acts like a turning page, revealing the next sceen
@warning Even when mobile optimization is used, may choke on mobile hardware due to SFML bottlenecks
If optimized for mobile, will capture the scenes once and use less vertices to increase performance on weak hardware
*/
class PageTurn : public Segue {
private:
glsl::PageTurn shader;
sf::Texture last, next;
bool firstPass{ true };
const int cellsize(const quality& mode) {
switch (mode) {
case quality::realtime:
return 10;
case quality::reduced:
return 50;
}
// quality::mobile
return 100;
}
public:
void onDraw(sf::RenderTexture& surface) override {
double elapsed = getElapsed().asMilliseconds();
double duration = getDuration().asMilliseconds();
double alpha = ease::linear(elapsed, duration, 1.0);
const bool optimized = getController().getRequestedQuality() == quality::mobile;
sf::Texture temp, temp2;
surface.clear(this->getLastActivityBGColor());
if (firstPass || !optimized) {
this->drawLastActivity(surface);
surface.display(); // flip and ready the buffer
last = temp = sf::Texture(surface.getTexture()); // Make a copy of the source texture
}
else {
temp = last;
}
shader.setTexture(&temp);
shader.setAlpha((float)alpha);
shader.apply(surface);
surface.display();
sf::Texture copy(surface.getTexture());
sf::Sprite left(copy); // Make a copy of the effect to render later
surface.clear(this->getNextActivityBGColor());
if (firstPass || !optimized) {
this->drawNextActivity(surface);
surface.display(); // flip and ready the buffer
next = temp2 = sf::Texture(surface.getTexture());
}
else {
temp2 = next;
}
sf::Sprite right(temp2);
surface.draw(right);
surface.draw(left);
firstPass = false;
}
PageTurn(sf::Time duration, Activity* last, Activity* next) : Segue(duration, last, next),
shader(getController().getVirtualWindowSize(), cellsize(getController().getRequestedQuality()))
{
/* ... */
}
~PageTurn() { ; }
};
| 25.684783 | 118 | 0.666102 |
8b2cf62d71174a85bb32194181ca3b7139647142
| 499 |
kt
|
Kotlin
|
app/src/main/java/za/org/grassroot2/dagger/fragment/FragmentComponent.kt
|
grassrootza/grassroot-android-v2
|
a5851bfe2790ea965ebb7330b8cbb48abf9c4d4c
|
[
"BSD-3-Clause"
] | null | null | null |
app/src/main/java/za/org/grassroot2/dagger/fragment/FragmentComponent.kt
|
grassrootza/grassroot-android-v2
|
a5851bfe2790ea965ebb7330b8cbb48abf9c4d4c
|
[
"BSD-3-Clause"
] | null | null | null |
app/src/main/java/za/org/grassroot2/dagger/fragment/FragmentComponent.kt
|
grassrootza/grassroot-android-v2
|
a5851bfe2790ea965ebb7330b8cbb48abf9c4d4c
|
[
"BSD-3-Clause"
] | 4 |
2018-02-11T11:58:59.000Z
|
2018-03-06T13:52:48.000Z
|
package za.org.grassroot2.dagger.fragment
import dagger.Subcomponent
import za.org.grassroot2.view.fragment.AroundMeFragment
import za.org.grassroot2.view.fragment.HomeFragment
import za.org.grassroot2.view.fragment.MeFragment
/**
* Created by luke on 2017/08/08.
*/
@PerFragment
@Subcomponent(modules = arrayOf(FragmentModule::class))
interface FragmentComponent {
fun inject(aroundMeFragment: AroundMeFragment)
fun inject(fragment: HomeFragment)
fun inject(fragment: MeFragment)
}
| 27.722222 | 55 | 0.799599 |
081b513b73c5a70cc1ea29374def6122dc0a909a
| 337 |
swift
|
Swift
|
Tests/URLBuilderTests/TypeCorrectly.swift
|
Puasonych/URLBuilder
|
232cf644fb92bbce60d045089238a098c8c389e9
|
[
"MIT"
] | 3 |
2020-05-01T21:46:24.000Z
|
2022-01-17T14:00:28.000Z
|
Tests/URLBuilderTests/TypeCorrectly.swift
|
Puasonych/URLBuilder
|
232cf644fb92bbce60d045089238a098c8c389e9
|
[
"MIT"
] | 2 |
2019-08-05T19:28:24.000Z
|
2019-08-05T19:50:00.000Z
|
Tests/URLBuilderTests/TypeCorrectly.swift
|
ephedra-software/URLBuilder
|
232cf644fb92bbce60d045089238a098c8c389e9
|
[
"MIT"
] | null | null | null |
//
// TypeCorrectly.swift
// URLBuilderTests
//
// Created by Eric Basargin on 22.07.2019.
//
import Foundation
struct TypeCorrectly<ExplicitType> {
private init() {}
static func compare(with _: ExplicitType) -> Bool {
return true
}
static func compare<T>(with _: T) -> Bool {
return false
}
}
| 16.047619 | 55 | 0.620178 |
c3e5ebbcecfd128681cc131de3c8742a330bc53e
| 7,020 |
rs
|
Rust
|
rust/loqui_server/src/connection_handler.rs
|
NorthIsUp/loqui
|
8d394a7951fd3a82d109becc1aebbd9e7ccc894a
|
[
"MIT"
] | 147 |
2017-10-02T18:16:52.000Z
|
2020-03-16T03:26:40.000Z
|
rust/loqui_server/src/connection_handler.rs
|
NorthIsUp/loqui
|
8d394a7951fd3a82d109becc1aebbd9e7ccc894a
|
[
"MIT"
] | 14 |
2017-09-19T16:13:32.000Z
|
2019-06-25T21:18:47.000Z
|
rust/loqui_server/src/connection_handler.rs
|
NorthIsUp/loqui
|
8d394a7951fd3a82d109becc1aebbd9e7ccc894a
|
[
"MIT"
] | 25 |
2017-10-01T20:10:31.000Z
|
2020-03-19T14:00:20.000Z
|
use crate::{Config, RequestHandler};
use bytesize::ByteSize;
use failure::Error;
use futures::sink::SinkExt;
use futures::stream::StreamExt;
use loqui_connection::handler::{DelegatedFrame, Handler, Ready};
use loqui_connection::{find_encoding, ReaderWriter};
use loqui_connection::{IdSequence, LoquiError};
use loqui_protocol::frames::{Frame, Hello, HelloAck, LoquiFrame, Push, Request, Response};
use loqui_protocol::upgrade::{Codec, UpgradeFrame};
use loqui_protocol::VERSION;
use std::future::Future;
use std::pin::Pin;
use std::sync::Arc;
use std::time::Duration;
use tokio::net::TcpStream;
use tokio::task::spawn;
use tokio_util::codec::Framed;
pub struct ConnectionHandler<R: RequestHandler> {
config: Arc<Config<R>>,
}
impl<R: RequestHandler> ConnectionHandler<R> {
pub fn new(config: Arc<Config<R>>) -> Self {
Self { config }
}
}
impl<R: RequestHandler> Handler for ConnectionHandler<R> {
// Server doesn't have any internal events.
type InternalEvent = ();
const SEND_GO_AWAY: bool = true;
fn max_payload_size(&self) -> ByteSize {
self.config.max_payload_size
}
fn upgrade(
&self,
tcp_stream: TcpStream,
) -> Pin<Box<dyn Future<Output = Result<TcpStream, Error>> + Send>> {
let max_payload_size = self.max_payload_size();
let framed_socket = Framed::new(tcp_stream, Codec::new(max_payload_size));
let (mut writer, mut reader) = framed_socket.split();
Box::pin(async move {
match reader.next().await {
Some(Ok(UpgradeFrame::Request)) => {
if let Err(e) = writer.send(UpgradeFrame::Response).await {
return Err(e);
}
Ok(writer.reunite(reader)?.into_inner())
}
Some(Ok(frame)) => Err(LoquiError::InvalidUpgradeFrame { frame }.into()),
Some(Err(e)) => Err(e),
None => Err(LoquiError::TcpStreamClosed.into()),
}
})
}
fn handshake(
&mut self,
mut reader_writer: ReaderWriter,
) -> Pin<
Box<
dyn Future<Output = Result<(Ready, ReaderWriter), (Error, Option<ReaderWriter>)>>
+ Send,
>,
> {
let ping_interval = self.config.ping_interval;
let supported_encodings = self.config.supported_encodings;
Box::pin(async move {
match reader_writer.reader.next().await {
Some(Ok(frame)) => {
match Self::handle_handshake_frame(frame, ping_interval, supported_encodings) {
Ok((ready, hello_ack)) => {
reader_writer = match reader_writer.write(hello_ack).await {
Ok(reader_writer) => reader_writer,
Err(e) => return Err((e.into(), None)),
};
Ok((ready, reader_writer))
}
Err(e) => Err((e, Some(reader_writer))),
}
}
Some(Err(e)) => Err((e, Some(reader_writer))),
None => Err((LoquiError::TcpStreamClosed.into(), Some(reader_writer))),
}
})
}
fn handle_frame(
&mut self,
frame: DelegatedFrame,
encoding: &'static str,
) -> Option<Pin<Box<dyn Future<Output = Result<Response, (Error, u32)>> + Send>>> {
match frame {
DelegatedFrame::Push(push) => {
spawn(handle_push(self.config.clone(), push, encoding));
None
}
DelegatedFrame::Request(request) => {
let response_future = handle_request(self.config.clone(), request, encoding);
Some(Box::pin(response_future))
}
DelegatedFrame::Error(_) => None,
DelegatedFrame::Response(_) => None,
}
}
fn handle_internal_event(
&mut self,
_event: (),
_id_sequence: &mut IdSequence,
) -> Option<LoquiFrame> {
None
}
fn on_ping_received(&mut self) {}
}
impl<R: RequestHandler> ConnectionHandler<R> {
fn handle_handshake_frame(
frame: LoquiFrame,
ping_interval: Duration,
supported_encodings: &'static [&'static str],
) -> Result<(Ready, HelloAck), Error> {
match frame {
LoquiFrame::Hello(hello) => {
Self::handle_handshake_hello(hello, ping_interval, supported_encodings)
}
LoquiFrame::GoAway(go_away) => Err(LoquiError::ToldToGoAway { go_away }.into()),
frame => Err(LoquiError::InvalidOpcode {
actual: frame.opcode(),
expected: Some(Hello::OPCODE),
}
.into()),
}
}
fn handle_handshake_hello(
hello: Hello,
ping_interval: Duration,
supported_encodings: &'static [&'static str],
) -> Result<(Ready, HelloAck), Error> {
let Hello {
flags,
version,
encodings,
// compression not supported
compressions: _compressions,
} = hello;
if version != VERSION {
return Err(LoquiError::UnsupportedVersion {
expected: VERSION,
actual: version,
}
.into());
}
let encoding = Self::negotiate_encoding(&encodings, supported_encodings)?;
let hello_ack = HelloAck {
flags,
ping_interval_ms: ping_interval.as_millis() as u32,
encoding: encoding.to_string(),
compression: None,
};
let ready = Ready {
ping_interval,
encoding,
};
Ok((ready, hello_ack))
}
fn negotiate_encoding(
client_encodings: &[String],
supported_encodings: &'static [&'static str],
) -> Result<&'static str, Error> {
for client_encoding in client_encodings {
if let Some(encoding) = find_encoding(client_encoding, supported_encodings) {
return Ok(encoding);
}
}
Err(LoquiError::NoCommonEncoding.into())
}
}
async fn handle_push<R: RequestHandler>(
config: Arc<Config<R>>,
push: Push,
encoding: &'static str,
) {
let Push {
payload,
flags: _flags,
} = push;
config.request_handler.handle_push(payload, encoding).await
}
async fn handle_request<R: RequestHandler>(
config: Arc<Config<R>>,
request: Request,
encoding: &'static str,
) -> Result<Response, (Error, u32)> {
let Request {
payload: request_payload,
flags: _flags,
sequence_id,
} = request;
let response_payload = config
.request_handler
.handle_request(request_payload, encoding)
.await;
Ok(Response {
flags: 0,
sequence_id,
payload: response_payload,
})
}
| 31.909091 | 99 | 0.553561 |
9016cba5434a85d4f9d86b089ce0a52dbd1ead5d
| 5,654 |
swift
|
Swift
|
Example/Pods/Stem/Sources/Application/UIApplication.swift
|
Marmot-App/Marmot-iOS
|
d26b06b802c6870c88653d6249077140963c9232
|
[
"MIT"
] | 1 |
2019-02-21T08:58:00.000Z
|
2019-02-21T08:58:00.000Z
|
Example/Pods/Stem/Sources/Application/UIApplication.swift
|
Marmot-App/Marmot-iOS
|
d26b06b802c6870c88653d6249077140963c9232
|
[
"MIT"
] | null | null | null |
Example/Pods/Stem/Sources/Application/UIApplication.swift
|
Marmot-App/Marmot-iOS
|
d26b06b802c6870c88653d6249077140963c9232
|
[
"MIT"
] | null | null | null |
//
// Stem
//
// Copyright (c) 2017 linhay - https://github.com/linhay
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
import UIKit
public extension Stem where Base: UIApplication {
/// 是否已开启推送
var isOpenNotification: Bool {
if let type = UIApplication.shared.currentUserNotificationSettings?.types, type == .init(rawValue: 0) { return false}
else { return true }
}
}
public extension UIApplication {
struct Info {
/// App版本号
let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? ""
/// App构建版本号
let bundleVersion = Bundle.main.object(forInfoDictionaryKey: kCFBundleVersionKey as String) as? String ?? ""
let bundleName = Bundle.main.object(forInfoDictionaryKey: kCFBundleNameKey as String) as? String ?? ""
let bundleID = Bundle.main.object(forInfoDictionaryKey: kCFBundleIdentifierKey as String) as? String ?? ""
}
struct Path {
var documentsURL: URL? { return FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).last }
var documentsPath: String? { return NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first }
var cachesURL: URL? { return FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).last }
var cachesPath: String? { return NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true).first }
var libraryURL: URL? { return FileManager.default.urls(for: .libraryDirectory, in: .userDomainMask).last }
var libraryPath: String? { return NSSearchPathForDirectoriesInDomains(.libraryDirectory, .userDomainMask, true).first }
}
enum OpenURLType {
case tel(number: String)
case sms(number: String)
case telprompt(number: String)
case safari(url: URL)
case mailto(email: String)
case appSettings
public var url: URL {
switch self {
case .tel(number: let value): return URL(string: "tel://" + value)!
case .sms(number: let value): return URL(string: "sms://" + value)!
case .telprompt(number: let value): return URL(string: "telprompt://" + value)!
case .safari(url: let value): return value
case .mailto(email: let value): return URL(string: "mailto://" + value)!
case .appSettings: return URL(string: UIApplication.openSettingsURLString)!
}
}
}
}
public extension Stem where Base: UIApplication {
var info: UIApplication.Info { return UIApplication.Info() }
var path: UIApplication.Path { return UIApplication.Path() }
}
// MARK: - open
public extension Stem where Base: UIApplication {
/// 打开特定链接
///
/// - Parameters:
/// - url: url
/// - completionHandler: 完成回调
func open(type: UIApplication.OpenURLType, completionHandler: ((Bool) -> Void)? = nil) {
open(url: type.url, completionHandler: completionHandler)
}
/// 打开链接
///
/// - Parameters:
/// - url: url
/// - isSafe: 会判断 能否打开 | default: true
/// - options: UIApplication.OpenExternalURLOptionsKey
/// - completionHandler: 完成回调
func open(url: String,
isSafe: Bool = true,
options: [UIApplication.OpenExternalURLOptionsKey : Any] = [:],
completionHandler: ((Bool) -> Void)? = nil) {
guard let str = url.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed), let url = URL(string: str) else{ return }
open(url: url, isSafe: isSafe, options: options, completionHandler: completionHandler)
}
/// 打开链接
///
/// - Parameters:
/// - url: url
/// - isSafe: 会判断 能否打开 | default: true
/// - options: UIApplication.OpenExternalURLOptionsKey
/// - completionHandler: 完成回调
func open(url: URL,
isSafe: Bool = true,
options: [UIApplication.OpenExternalURLOptionsKey : Any] = [:],
completionHandler: ((Bool) -> Void)? = nil) {
if isSafe, !UIApplication.shared.canOpenURL(url) { return }
if #available(iOS 10.0, *) {
UIApplication.shared.open(url, options: options, completionHandler: completionHandler)
} else {
// https://stackoverflow.com/questions/19356488/openurl-freezes-app-for-over-10-seconds
// 解决打开 其他 app 慢
DispatchQueue.main.async {
completionHandler?(UIApplication.shared.openURL(url))
}
}
}
}
| 40.676259 | 133 | 0.649275 |
a8fbb141ee0eab635533520b0e59ee60d1210fae
| 552 |
sql
|
SQL
|
littlebreadloaf/Data/Database Schemas/blog.sql
|
ZombieFleshEaters/LittleBreadLoaf
|
757337456ea28db3951b3eb3fc92bfd6f93651ed
|
[
"MIT"
] | 4 |
2019-01-20T23:08:14.000Z
|
2021-01-14T14:27:33.000Z
|
littlebreadloaf/Data/Database Schemas/blog.sql
|
ZombieFleshEaters/littlebreadloaf
|
d508a75f48726065778e05b311a456d6dd485ea8
|
[
"MIT"
] | 3 |
2019-10-24T19:28:53.000Z
|
2019-11-05T10:14:26.000Z
|
littlebreadloaf/Data/Database Schemas/blog.sql
|
ZombieFleshEaters/LittleBreadLoaf
|
757337456ea28db3951b3eb3fc92bfd6f93651ed
|
[
"MIT"
] | null | null | null |
CREATE TABLE `blog` (
`BlogID` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`UserID` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`Title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`Description` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`Content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`Created` datetime NOT NULL,
`Published` datetime NOT NULL,
PRIMARY KEY (`BlogID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
| 50.181818 | 81 | 0.778986 |
af4949ef3ea444c85940c43b5028d095963d9014
| 450 |
kt
|
Kotlin
|
_/Section05/app/src/main/java/com/packt/video05/SecondActivity.kt
|
paullewallencom/android-978-1-7898-0871-1
|
1741541212377473f8c8da055ba9568e40831480
|
[
"Apache-2.0"
] | 8 |
2018-12-19T05:47:40.000Z
|
2021-11-08T13:10:39.000Z
|
_/Section05/app/src/main/java/com/packt/video05/SecondActivity.kt
|
paullewallencom/android-978-1-7898-0871-1
|
1741541212377473f8c8da055ba9568e40831480
|
[
"Apache-2.0"
] | null | null | null |
_/Section05/app/src/main/java/com/packt/video05/SecondActivity.kt
|
paullewallencom/android-978-1-7898-0871-1
|
1741541212377473f8c8da055ba9568e40831480
|
[
"Apache-2.0"
] | 2 |
2019-11-26T19:45:25.000Z
|
2021-06-20T03:03:21.000Z
|
package com.packt.video05
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
class SecondActivity : AppCompatActivity() {
init {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_AUTO)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_second)
}
}
| 26.470588 | 80 | 0.771111 |
9955bb56b20c4d2816f103af537be00e6f672cbb
| 1,081 |
h
|
C
|
fs/ext4/e2fsprogs/contrib/android/perms.h
|
fIappy/janus
|
e0923b12f53b32019c1823e58edb401052eb547f
|
[
"MIT"
] | 1 |
2019-12-01T08:07:48.000Z
|
2019-12-01T08:07:48.000Z
|
fs/ext4/e2fsprogs/contrib/android/perms.h
|
fIappy/janus
|
e0923b12f53b32019c1823e58edb401052eb547f
|
[
"MIT"
] | null | null | null |
fs/ext4/e2fsprogs/contrib/android/perms.h
|
fIappy/janus
|
e0923b12f53b32019c1823e58edb401052eb547f
|
[
"MIT"
] | null | null | null |
#ifndef ANDROID_PERMS_H
# define ANDROID_PERMS_H
# include "config.h"
# include <ext2fs/ext2fs.h>
typedef void (*fs_config_f)(const char *path, int dir,
const char *target_out_path,
unsigned *uid, unsigned *gid,
unsigned *mode, uint64_t *capabilities);
# ifdef _WIN32
struct selabel_handle;
static inline errcode_t android_configure_fs(ext2_filsys fs,
char *src_dir,
char *target_out,
char *mountpoint,
void *seopts,
unsigned int nopt,
char *fs_config_file,
time_t fixed_time)
{
return 0;
}
# else
# include <selinux/selinux.h>
# include <selinux/label.h>
# if !defined(HOST)
# include <selinux/android.h>
# endif
# include <private/android_filesystem_config.h>
# include <private/canned_fs_config.h>
errcode_t android_configure_fs(ext2_filsys fs, char *src_dir,
char *target_out,
char *mountpoint,
struct selinux_opt *seopts,
unsigned int nopt,
char *fs_config_file, time_t fixed_time);
# endif
#endif /* !ANDROID_PERMS_H */
| 25.139535 | 61 | 0.66605 |
d56b89667265003b623e5bb7d09e0ef99e221d8b
| 2,382 |
asm
|
Assembly
|
externals/mpir-3.0.0/mpn/x86/rshift.asm
|
JaminChan/eos_win
|
c03e57151cfe152d0d3120abb13226f4df74f37e
|
[
"MIT"
] | 1 |
2018-08-14T03:52:21.000Z
|
2018-08-14T03:52:21.000Z
|
externals/mpir-3.0.0/mpn/x86/rshift.asm
|
JaminChan/eos_win
|
c03e57151cfe152d0d3120abb13226f4df74f37e
|
[
"MIT"
] | null | null | null |
externals/mpir-3.0.0/mpn/x86/rshift.asm
|
JaminChan/eos_win
|
c03e57151cfe152d0d3120abb13226f4df74f37e
|
[
"MIT"
] | null | null | null |
dnl x86 mpn_rshift -- mpn right shift.
dnl Copyright 1992, 1994, 1996, 1999, 2000, 2001, 2002 Free Software
dnl Foundation, Inc.
dnl
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public License as
dnl published by the Free Software Foundation; either version 2.1 of the
dnl License, or (at your option) any later version.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public
dnl License along with the GNU MP Library; see the file COPYING.LIB. If
dnl not, write to the Free Software Foundation, Inc., 51 Franklin Street,
dnl Fifth Floor, Boston, MA 02110-1301, USA.
include(`../config.m4')
C cycles/limb
C P54: 7.5
C P55: 7.0
C P6: 2.5
C K6: 4.5
C K7: 5.0
C P4: 16.5
C mp_limb_t mpn_rshift (mp_ptr dst, mp_srcptr src, mp_size_t size,
C unsigned shift);
defframe(PARAM_SHIFT,16)
defframe(PARAM_SIZE, 12)
defframe(PARAM_SRC, 8)
defframe(PARAM_DST, 4)
TEXT
ALIGN(8)
PROLOGUE(mpn_rshift)
pushl %edi
pushl %esi
pushl %ebx
deflit(`FRAME',12)
movl PARAM_DST,%edi
movl PARAM_SRC,%esi
movl PARAM_SIZE,%edx
movl PARAM_SHIFT,%ecx
leal -4(%edi,%edx,4),%edi
leal (%esi,%edx,4),%esi
negl %edx
movl (%esi,%edx,4),%ebx C read least significant limb
xorl %eax,%eax
shrdl( %cl, %ebx, %eax) C compute carry limb
incl %edx
jz L(end)
pushl %eax C push carry limb onto stack
testb $1,%dl
jnz L(1) C enter loop in the middle
movl %ebx,%eax
ALIGN(8)
L(oop): movl (%esi,%edx,4),%ebx C load next higher limb
shrdl( %cl, %ebx, %eax) C compute result limb
movl %eax,(%edi,%edx,4) C store it
incl %edx
L(1): movl (%esi,%edx,4),%eax
shrdl( %cl, %eax, %ebx)
movl %ebx,(%edi,%edx,4)
incl %edx
jnz L(oop)
shrl %cl,%eax C compute most significant limb
movl %eax,(%edi) C store it
popl %eax C pop carry limb
popl %ebx
popl %esi
popl %edi
ret
L(end): shrl %cl,%ebx C compute most significant limb
movl %ebx,(%edi) C store it
popl %ebx
popl %esi
popl %edi
ret
EPILOGUE()
| 23.584158 | 74 | 0.696893 |
1c6ebab3d957544d317c2c04371cb053ae116757
| 1,007 |
swift
|
Swift
|
Sources/Injector/Resolvable.swift
|
Ericdowney/Swift-Injector
|
47e0f1d365468c7a5b0713d2ab7f43ad94210952
|
[
"MIT"
] | 1 |
2020-05-28T00:40:37.000Z
|
2020-05-28T00:40:37.000Z
|
Sources/Injector/Resolvable.swift
|
Ericdowney/Swift-Injector
|
47e0f1d365468c7a5b0713d2ab7f43ad94210952
|
[
"MIT"
] | null | null | null |
Sources/Injector/Resolvable.swift
|
Ericdowney/Swift-Injector
|
47e0f1d365468c7a5b0713d2ab7f43ad94210952
|
[
"MIT"
] | null | null | null |
import Foundation
/// Represents a class object that can be resolved through the Injector singleton. Any object conforming to Resolvable can be instantiated as Non-Optional or Optional through the use of .resolve().
public protocol Resolvable: class {
static func resolve<T: Resolvable>() throws -> T
static func resolve<T: Resolvable>() -> T?
static func resolve<T: Resolvable>(for name: String) throws -> T
static func resolve<T: Resolvable>(for name: String) -> T?
}
public extension Resolvable {
static func resolve<T: Resolvable>() throws -> T {
return try Injector.shared.resolve()
}
static func resolve<T: Resolvable>() -> T? {
return try? Injector.shared.resolve()
}
static func resolve<T: Resolvable>(for name: String) throws -> T {
return try Injector.shared.resolve(with: name)
}
static func resolve<T: Resolvable>(for name: String) -> T? {
return try? Injector.shared.resolve(with: name)
}
}
| 33.566667 | 197 | 0.668322 |
5432f88e7fb81f3e80d45f744dd142bd29558645
| 2,706 |
swift
|
Swift
|
library/swift/src/RetryPolicy.swift
|
kastiglione/envoy-mobile
|
04253620eba277ac98842b62fbf043b99f56d589
|
[
"Apache-2.0"
] | null | null | null |
library/swift/src/RetryPolicy.swift
|
kastiglione/envoy-mobile
|
04253620eba277ac98842b62fbf043b99f56d589
|
[
"Apache-2.0"
] | null | null | null |
library/swift/src/RetryPolicy.swift
|
kastiglione/envoy-mobile
|
04253620eba277ac98842b62fbf043b99f56d589
|
[
"Apache-2.0"
] | null | null | null |
import Foundation
/// Rules that may be used with `RetryPolicy`.
/// See the `x-envoy-retry-on` Envoy header for documentation.
@objc
public enum RetryRule: Int, CaseIterable {
case status5xx
case gatewayError
case connectFailure
case retriable4xx
case refusedUpstream
/// String representation of this rule.
var stringValue: String {
switch self {
case .status5xx:
return "5xx"
case .gatewayError:
return "gateway-error"
case .connectFailure:
return "connect-failure"
case .retriable4xx:
return "retriable-4xx"
case .refusedUpstream:
return "refused-upstream"
}
}
}
/// Specifies how a request may be retried, containing one or more rules.
/// https://www.envoyproxy.io/learn/automatic-retries
@objcMembers
public final class RetryPolicy: NSObject {
public let maxRetryCount: UInt
public let retryOn: [RetryRule]
public let perRetryTimeoutMS: UInt?
public let totalUpstreamTimeoutMS: UInt
/// Designated initializer.
///
/// - parameter maxRetryCount: Maximum number of retries that a request may be
/// performed.
/// - parameter retryOn: Whitelist of rules used for retrying.
/// - parameter perRetryTimeoutMS: Timeout (in milliseconds) to apply to each retry. Must
/// be <= `totalUpstreamTimeoutMS` or it will be ignored.
/// - parameter totalUpstreamTimeoutMS: Total timeout (in milliseconds) that includes all
/// retries. Spans the point at which the entire downstream
/// request has been processed and when the upstream
/// response has been completely processed.
public init(maxRetryCount: UInt, retryOn: [RetryRule], perRetryTimeoutMS: UInt? = nil,
totalUpstreamTimeoutMS: UInt = 15_000)
{
if let perRetryTimeoutMS = perRetryTimeoutMS {
assert(perRetryTimeoutMS <= totalUpstreamTimeoutMS,
"Per-retry timeout must be <= total timeout")
}
self.maxRetryCount = maxRetryCount
self.retryOn = retryOn
self.perRetryTimeoutMS = perRetryTimeoutMS
self.totalUpstreamTimeoutMS = totalUpstreamTimeoutMS
}
}
// MARK: - Equatable overrides
extension RetryPolicy {
public override func isEqual(_ object: Any?) -> Bool {
guard let other = object as? RetryPolicy else {
return false
}
return self.maxRetryCount == other.maxRetryCount
&& self.retryOn == other.retryOn
&& self.perRetryTimeoutMS == other.perRetryTimeoutMS
&& self.totalUpstreamTimeoutMS == other.totalUpstreamTimeoutMS
}
}
| 34.253165 | 97 | 0.658167 |
fc9c2772dc0087d7dff2c239ae244d5e1467c7aa
| 3,158 |
css
|
CSS
|
build/lesson_13.css
|
olchikguselnikova/Lamps
|
b454f8ca97b59f2cf9c62f512abee940108b1d28
|
[
"MIT"
] | null | null | null |
build/lesson_13.css
|
olchikguselnikova/Lamps
|
b454f8ca97b59f2cf9c62f512abee940108b1d28
|
[
"MIT"
] | null | null | null |
build/lesson_13.css
|
olchikguselnikova/Lamps
|
b454f8ca97b59f2cf9c62f512abee940108b1d28
|
[
"MIT"
] | null | null | null |
.place-for-lamps {
display: -ms-flexbox;
display: flex;
-ms-flex-pack: justify;
justify-content: space-between;
margin-right: 15px;
height: 80px; }
.place-for-lamps :nth-child(2n+1) .lamp__circle_toggled {
background-color: #69a2f8; }
.lamp {
height: 100%;
-ms-flex-direction: column;
flex-direction: column;
margin-right: 10px; }
.lamp__circle {
margin-bottom: 10px;
border: 1px solid black;
border-radius: 50%;
width: 50px;
height: 50px;
background-color: #c0d5f5; }
.lamp__circle_toggled {
background-color: #f3f351; }
.lamp__button {
background-color: #c0d5f5;
border: 1px solid black;
position: relative;
font-family: Arial, Helvetica, sans-serif;
font-size: 15px;
width: 60px; }
.lamp__button_toggled {
background-color: #5ee65a; }
.place-for-toggleBtn {
height: 60px;
width: 85px;
margin-right: 15px; }
.place-for-toggleBtn button {
height: 100%;
width: 100%;
background-color: #c0d5f5;
border: 1px solid black;
position: relative;
font-family: Arial, Helvetica, sans-serif;
font-size: 15px; }
body {
display: -ms-flexbox;
display: flex;
-ms-flex-pack: center;
justify-content: center;
-ms-flex-align: center;
align-items: center;
background-color: white;
background-image: linear-gradient(45deg, rgba(221, 225, 238, 0.534) 25%, transparent 25%, transparent 74%, rgba(221, 225, 238, 0.534) 75%, rgba(221, 225, 238, 0.534)), linear-gradient(45deg, rgba(221, 225, 238, 0.534) 25%, transparent 25%, transparent 74%, rgba(221, 225, 238, 0.534) 75%, rgba(221, 225, 238, 0.534));
background-size: 30px 30px;
background-position: 0 0, 15px 15px; }
.place-for-lamps {
display: -ms-flexbox;
display: flex;
-ms-flex-pack: justify;
justify-content: space-between;
margin-right: 15px;
height: 80px; }
.place-for-lamps :nth-child(2n+1) .lamp__circle_toggled {
background-color: #69a2f8; }
.lamp {
height: 100%;
-ms-flex-direction: column;
flex-direction: column;
margin-right: 10px; }
.lamp__circle {
margin-bottom: 10px;
border: 1px solid black;
border-radius: 50%;
width: 50px;
height: 50px;
background-color: #c0d5f5; }
.lamp__circle_toggled {
background-color: #f3f351; }
.lamp__button {
background-color: #c0d5f5;
border: 1px solid black;
position: relative;
font-family: Arial, Helvetica, sans-serif;
font-size: 15px;
width: 60px; }
.lamp__button_toggled {
background-color: #5ee65a; }
.place-for-toggleBtn {
height: 60px;
width: 85px;
margin-right: 15px; }
.place-for-toggleBtn button {
height: 100%;
width: 100%;
background-color: #c0d5f5;
border: 1px solid black;
position: relative;
font-family: Arial, Helvetica, sans-serif;
font-size: 15px; }
.place-for-addBtn {
height: 60px;
width: 85px;
margin-right: 15px; }
.place-for-addBtn button {
height: 100%;
width: 100%;
background-color: #c0d5f5;
border: 1px solid black;
position: relative;
font-family: Arial, Helvetica, sans-serif;
font-size: 15px; }
| 27.224138 | 319 | 0.648195 |
e71b90e5a5df22cc2a39e90be3a05eadd6987744
| 6,247 |
js
|
JavaScript
|
myGame/myGame2.js
|
JennaWu-Cardona/Alien-Game
|
402e2667623c4d7970e5ce5e7e3c1cbf26ec18c3
|
[
"MIT"
] | null | null | null |
myGame/myGame2.js
|
JennaWu-Cardona/Alien-Game
|
402e2667623c4d7970e5ce5e7e3c1cbf26ec18c3
|
[
"MIT"
] | null | null | null |
myGame/myGame2.js
|
JennaWu-Cardona/Alien-Game
|
402e2667623c4d7970e5ce5e7e3c1cbf26ec18c3
|
[
"MIT"
] | null | null | null |
/*global Phaser game game_state eventFunctions*/
/*global Phaser*/
game_state.mainTwo = function() {};
game_state.mainTwo.prototype = {
preload: function() {
game.load.image('sky', 'assets/sky2.png');
game.load.image('debris', 'assets/planet.png');
game.load.spritesheet('alien', 'assets/spaceship.png', 194, 189);
document.removeEventListener("click", eventFunctions.mainStarter);
game.load.audio('spaceship', 'assets/rocketship.wav');
game.load.audio('shutdown','assets/shutdown.wav' );
game.load.audio('win2', 'assets/win2.wav');
game.load.audio('win1', 'assets/win1.wav');
},
create: function() {
// We're going to be using physics, so enable the Arcade Physics system
game.physics.startSystem(Phaser.Physics.ARCADE);
// a simple background for our game
game.add.sprite(0, 0, 'sky');
//the platforms group contains the ground
this.platforms = game.add.group();
//this is the physics for any object created in this group- the platforms
this.platforms.enableBody = true;
//this is the alien
this.player = game.add.sprite(1, -100, 'alien');
// this.player = game.add.sprite(1, game.world.height - 0, 'alien');
//We need to add physics to this character
game.physics.arcade.enable(this.player);
this.player.enableBody = true;
//Player physics properties. Give the little guy a slight bounce
this.player.body.gravity.y = 290;
this.player.body.collideWorldBounds = true;
//the this.player animation
this.player.animations.add('down', [1], 10, true);
// this.player.animations.add('right', [5], 10, true);
this.player.animations.add('left', [3], 10, true);
this.player.animations.add('up', [0], 10, true);
this.player.animations.add('right', [5], 10, true);
// this makes the alien the size we want
this.player.body.setSize(90, 140, 55, 30);
//Our controls
this.cursors = game.input.keyboard.createCursorKeys();
this.platforms = game.add.group();
this.platforms.enableBody = true;
var movingPlatform = this.platforms.create(0, 64, 'debris');
movingPlatform.body.velocity.y = 100;
movingPlatform.body.immovable = true;
movingPlatform.body.checkCollision.down = false;
movingPlatform.body.checkCollision.left = false;
movingPlatform.body.checkCollision.right = false;
//this makes a moving platform
var _this = this;
setInterval(function() {
// var movingPlatform = this.platforms = this.add.physicsGroup();
var movingPlatform = _this.platforms.create(Math.random() * 700, 64, 'debris');
game.physics.enable(movingPlatform, Phaser.Physics.ARCADE);
movingPlatform.body.velocity.y = 100;
movingPlatform.body.immovable = true;
movingPlatform.body.checkCollision.down = false;
movingPlatform.body.checkCollision.left = false;
movingPlatform.body.checkCollision.right = false;
movingPlatform.scored = false;
}, 2000);
//the score
this.scoreText = game.add.text(16, 16, 'Score: 0', {
fontSize: '30px',
fill: 'white'
});
this.score = 0;
spaceship = game.add.audio('spaceship');
shutdown = game.add.audio('shutdown');
win2 = game.add.audio('win2');
win1 = game.add.audio('win1');
game.sound.setDecodedCallback([spaceship, shutdown, win2], start, this);
audio.addEventListener(playFX, this.cursors.up.isDown);
},
update: function() {
// Collide the player and the platforms
game.physics.arcade.collide(this.player, this.platforms, this.scorePlatform, null, this);
// game.physics.arcade.collide(this.player, this.ground);
// the alien's movement
this.player.body.velocity.x = 0;
// this.player.body.velocity.y = 0;
if (this.cursors.left.isDown) {
//move to the left
this.player.body.velocity.x = -270;
this.player.animations.play('left');
}
else if (this.cursors.right.isDown) {
//Move to the right
this.player.body.velocity.x = 270;
this.player.animations.play('right')
}
else if (this.cursors.down.isDown) {
//Move down
this.player.body.velocity.y = 350;
this.player.animations.play('down');
}
else {
//Stand still
this.player.animations.stop();
this.player.frame = 1;
}
console.log(this.player.body.touching.down);
//Allow the this.player to jump if they are touching the ground.
if (this.cursors.up.isDown && this.player.body.touching.down) {
this.player.body.velocity.y = -350;
spaceship.play();
}
if (this.cursors.up.isDown) {
this.player.animations.play('up');
}
//this is supposed the cue the losing screen if you fall
if (this.player.y > 429.9) {
game.state.start('badEndingTwo');
// shutdown.play();
}
//this is supposed to cue the winning screen if you get a certain score
if (this.score === 20) {
game.state.start('goodEndingTwo');
win2.play();
win1.play();
}
//this plays the sound when you lose
if (this.player.y > 429.9) {
shutdown.play();
}
// this.player.x -= 2;
// if (this.player.x < -this.player.width) {
// this.player.x = game.world.width;
// }
// if(this.player.touching.right)
},
//makes score for landing on platforms
scorePlatform: function(player, platform) {
if (!platform.scored) {
this.score++;
this.scoreText.text = "Score: " + this.score;
platform.scored = true;
}
}
};
// game.state.start('main');
game.state.add('mainTwo', game_state.mainTwo);
| 33.406417 | 97 | 0.581719 |
e412a9229c557309d9b8a687eb17042abf12ccdc
| 89,942 |
sql
|
SQL
|
koperasi_share.sql
|
Tahier/adminkop
|
08b048386e8a543202c46e868e360e825d598188
|
[
"MIT"
] | null | null | null |
koperasi_share.sql
|
Tahier/adminkop
|
08b048386e8a543202c46e868e360e825d598188
|
[
"MIT"
] | null | null | null |
koperasi_share.sql
|
Tahier/adminkop
|
08b048386e8a543202c46e868e360e825d598188
|
[
"MIT"
] | null | null | null |
-- phpMyAdmin SQL Dump
-- version 4.4.10
-- http://www.phpmyadmin.net
--
-- Host: localhost:3306
-- Generation Time: Mar 04, 2016 at 01:47 PM
-- Server version: 5.5.42
-- PHP Version: 5.6.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Database: `koperasi_share`
--
-- --------------------------------------------------------
--
-- Table structure for table `komunitas`
--
CREATE TABLE `komunitas` (
`id_komunitas` varchar(25) NOT NULL,
`nama` varchar(100) DEFAULT NULL,
`status_active` int(11) NOT NULL DEFAULT '1',
`alamat` text,
`telp` varchar(20) DEFAULT NULL,
`tgl_berdiri` varchar(20) DEFAULT NULL,
`ketua_komunitas` varchar(70) DEFAULT NULL,
`ketua_komunitas_telp` varchar(20) DEFAULT NULL,
`keterangan_komunitas` text,
`id_user` varchar(50) NOT NULL,
`service_time` timestamp NULL DEFAULT NULL,
`service_action` varchar(100) DEFAULT NULL,
`service_users` varchar(100) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `konten_agenda`
--
CREATE TABLE `konten_agenda` (
`id_agenda` int(11) NOT NULL,
`judul` varchar(50) DEFAULT NULL,
`isi` text,
`link_gambar` varchar(250) DEFAULT NULL,
`tanggal_agenda` datetime DEFAULT NULL,
`tanggal_dibuat` datetime DEFAULT NULL,
`service_time` datetime DEFAULT NULL,
`serrvice_action` varchar(100) DEFAULT NULL,
`service_user` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `konten_berita`
--
CREATE TABLE `konten_berita` (
`id_berita` int(11) NOT NULL,
`judul` varchar(50) DEFAULT NULL,
`isi` text,
`link_gambar` varchar(250) DEFAULT NULL,
`tanggal_dibuat` datetime DEFAULT NULL,
`service_time` datetime DEFAULT NULL,
`serrvice_action` varchar(100) DEFAULT NULL,
`service_user` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `konten_compro`
--
CREATE TABLE `konten_compro` (
`id_compro` int(11) NOT NULL,
`judul` varchar(50) DEFAULT NULL,
`isi` text,
`link_gambar` varchar(250) DEFAULT NULL,
`tanggal_dibuat` datetime DEFAULT NULL,
`service_time` datetime DEFAULT NULL,
`serrvice_action` varchar(100) DEFAULT NULL,
`service_user` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `konten_event`
--
CREATE TABLE `konten_event` (
`id_event` int(11) NOT NULL,
`judul` varchar(50) DEFAULT NULL,
`isi` text,
`link_gambar` varchar(250) DEFAULT NULL,
`tanggal_event` datetime DEFAULT NULL,
`tanggal_dibuat` datetime DEFAULT NULL,
`service_time` datetime DEFAULT NULL,
`serrvice_action` varchar(100) DEFAULT NULL,
`service_user` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `koperasi`
--
CREATE TABLE `koperasi` (
`id_koperasi` varchar(25) NOT NULL,
`nama` varchar(100) DEFAULT NULL,
`status_active` int(11) NOT NULL DEFAULT '1',
`service_time` timestamp NULL DEFAULT NULL,
`service_action` varchar(100) DEFAULT NULL,
`service_users` varchar(100) DEFAULT NULL,
`alamat` text,
`telp` varchar(20) DEFAULT NULL,
`tgl_berdiri` varchar(20) DEFAULT NULL,
`legal` text,
`ketua_koperasi` varchar(70) DEFAULT NULL,
`ketua_koperasi_telp` varchar(20) DEFAULT NULL,
`keterangan_koperasi` text,
`parent_koperasi` varchar(25) DEFAULT NULL,
`id_user` varchar(50) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `koperasi`
--
INSERT INTO `koperasi` (`id_koperasi`, `nama`, `status_active`, `service_time`, `service_action`, `service_users`, `alamat`, `telp`, `tgl_berdiri`, `legal`, `ketua_koperasi`, `ketua_koperasi_telp`, `keterangan_koperasi`, `parent_koperasi`, `id_user`) VALUES
('81456252551', 'Pijar International', 1, '2016-02-29 07:45:26', 'update', '91456331037', 'Jl. HMS Mintaredja, Gd. BITC lt. 4, Baros, Cimahi', '12345555', '12/11/2031', '123/koperasi/X/2015', 'Bobby Chahya', '34501234', '<div>We believe that the future of business and life </div><div>will involve more collaboration and working together,</div><div>because the best partnerships handle the worst case scenarios in future.</div>', '81456507703', '91456500773'),
('91456484148', 'Nirleka Studios', 1, '2016-02-26 17:59:14', 'insert', '91456331037', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '81456507703', '91456331037'),
('81456507703', 'Cimahi Creative Assocation', 1, '2016-03-01 20:19:37', 'update', '91456507703', 'Jl. HMS Mintaredja, Gd. BITC lt. 4, Baros, Cimahi', '1220145069', '28/10/2009', '123/koperasi/X/2015', 'Rudy Sutedja', '34501234', 'advadv <br><a target="_blank" rel="nofollow" href="http://www.cca.or.id">http://www.cca.or.id</a><br>"''"""<br>TEST', '0', '91456507703'),
('81456524588', 'GRU', 1, '2016-02-26 22:10:07', 'delete', '91456331037', 'Jl. HMS Mintaredja, Gd. BITC lt. 4, Baros, Cimahi', '08579389', '31/03/2045', '', 'Ronny Ruabiana', '34501234', 'hfjfjhgvhvkg', '81456507703', '91456524588'),
('81456741937', 'Muslimah Gallery', 1, '2016-02-29 10:32:17', 'insert', '91456331075', 'Jl. Raya', '08122333113', '09/09/2009', 'SK 009/2015', 'Mrs. Muslimah', '0813456789', 'Muslimah Gallery ', '0', '91456741937'),
('81456822763', 'Aksara Enterprise', 1, '2016-03-01 12:40:10', 'update', '91456822763', 'Jl. HMS Mintaredja, Gd. BITC lt. 4, Baros, Cimahi', '12345678', '12/03/2015', 'test', 'Gusti', '5478', 'Kaohjodjs', '81456507703', '91456822763'),
('81456847241', 'KaREN', 1, '2016-03-01 15:47:21', 'insert', '91456331037', 'Jl. HMS Mintaredja, Gd. BITC lt. 4, Baros, Cimahi, Indonesia', '086899999', '12/02/2020', '', 'Ronny Ruabiana', '12345', 'KASTA RENDAH', '81456741937', '91456847241'),
('81456848348', 'Bara Enterprise', 1, '2016-03-01 16:05:48', 'insert', '91456507703', 'Jl. Sariwangi', '6786876899', '20/03/2067', '', 'Gani', '127682764', 'Bara Enterprise', '81456507703', '91456848348');
-- --------------------------------------------------------
--
-- Table structure for table `pekerjaan`
--
CREATE TABLE `pekerjaan` (
`id_pekerjaan` int(10) NOT NULL,
`nama` varchar(250) NOT NULL DEFAULT '',
`service_time` timestamp NULL DEFAULT NULL,
`service_action` varchar(100) DEFAULT '',
`service_user` varchar(100) DEFAULT ''
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `pekerjaan`
--
INSERT INTO `pekerjaan` (`id_pekerjaan`, `nama`, `service_time`, `service_action`, `service_user`) VALUES
(1, 'Petani', NULL, '', ''),
(2, 'Wirausaha', NULL, '', '');
-- --------------------------------------------------------
--
-- Table structure for table `produk`
--
CREATE TABLE `produk` (
`id_produk` varchar(50) NOT NULL,
`nama` varchar(100) NOT NULL DEFAULT '',
`desk` text,
`warna` varchar(100) DEFAULT '',
`tipe` varchar(100) DEFAULT '',
`berat` varchar(11) DEFAULT '',
`price_n` int(10) NOT NULL DEFAULT '0',
`price_s` int(10) NOT NULL DEFAULT '0',
`qty` int(10) NOT NULL DEFAULT '0',
`terjual` int(10) DEFAULT '0',
`status` varchar(1) NOT NULL DEFAULT '',
`user` varchar(100) NOT NULL DEFAULT '',
`service_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`service_action` varchar(100) DEFAULT '',
`service_user` varchar(100) DEFAULT '',
`owner` varchar(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `produk`
--
INSERT INTO `produk` (`id_produk`, `nama`, `desk`, `warna`, `tipe`, `berat`, `price_n`, `price_s`, `qty`, `terjual`, `status`, `user`, `service_time`, `service_action`, `service_user`, `owner`) VALUES
('201032016234642', 'Macbook Pro', 'Macbook Pro Mid 2012\r\n\r\nCore i5\r\n500 GB HDD\r\n4GB RAM\r\nIntel HD Graphic 4000', 'Silver', '', '1', 16000000, 15950000, 14, NULL, '1', '91456822446', '2016-03-01 18:17:03', 'update', '91456822446', '3'),
('202032016011832', 'iPhone 4s 64 Gb', 'iPhone 4s 64Gb\r\n\r\n512 Ram\r\niOs 9.2.1\r\n', 'White, Black', '', '1', 2300000, 0, 4, NULL, '1', '91456507703', '2016-03-01 18:18:32', 'insert', '91456507703', '2'),
('2147483647', 'Minyak Gorenggggg coy', '1Lt Bimoli', '', '', '1', 21000, 18500, 17, NULL, '0', '91456484148', '2016-02-29 15:05:15', 'delete', '91456331075', '3'),
('2222620', 'Terigu Merahhhhh', 'Segitiga Biru', '', '', '1', 30000, 28000, 5, NULL, '1', '91456331075', '2016-02-28 11:32:52', 'update', '91456331075', '1'),
('2222710', 'Terigu', 'Segitiga Biru', '', '', '1', 30000, 28000, 5, NULL, '0', '91456331075', '2016-02-29 15:05:21', 'delete', '91456331075', '1'),
('2222809', 'Beras Cianjur', 'Segitiga Biru', '', '', '1', 30000, 28000, 10, NULL, '0', '91456507703', '2016-02-29 15:04:58', 'delete', '91456331075', '2'),
('2222829', 'Beras Tasik', 'Daerah daria singaparna', '', '', '1', 30000, 28000, 5, NULL, '0', '91456507703', '2016-02-29 15:05:00', 'delete', '91456331075', '2'),
('229022016174200', 'QK75', 'Bahan Combed\r\nTermasuk jilbab', 'Hijau alpukat', '', '300', 210, 205, 10, NULL, '1', '91456741937', '2016-02-29 12:43:24', 'update', '91456741937', '2'),
('229022016174655', 'QK74', 'Bahan Combed\r\nTermasuk jilbab\r\n', 'Biru Toska Muda', 'Baju', '300', 210000, 205000, 10, NULL, '1', '91456741937', '2016-02-29 10:46:55', 'insert', '91456741937', '2'),
('229022016174939', 'Bross RB2 Small 0.23', 'Tersedia Warna Hijau', 'Tidak berwarna', '', '300', 6000, 5500, 10, NULL, '1', '91456741937', '2016-02-29 10:49:39', 'insert', '91456741937', '2'),
('229022016175129', 'Bross RB2 Small 0.75', 'Warna Sesuai Gambar', 'Tidak Berwarna', '', '500', 20000, 18500, 10, NULL, '1', '91456741937', '2016-02-29 10:51:29', 'insert', '91456741937', '2'),
('229022016175240', 'Bross RB2 Medium 0.33', 'Tersedia Warna Gold dan Biru', 'Tidak berwarna', '', '500', 10000, 7500, 10, NULL, '1', '91456741937', '2016-02-29 10:52:40', 'insert', '91456741937', '2'),
('229022016175243', 'Sarung Kid Quds 2', 'Sarung anak motif ceria. Cocok digunakan oleh anak usia 4-10 tahun.\r\n\r\nBahan Dasar : \r\nTersedia Ukuran : All Size\r\nTersedia Warna : Hijau, Biru,', 'Hijau', 'Baju', '300', 74500, 64500, 10, NULL, '1', '91456741937', '2016-02-29 12:44:23', 'update', '91456741937', '2'),
('229022016175420', 'Kemko Zayd Mst', 'Kemko Formil atau semi formil. Kemko ini nyaman dipakai karena tidak mudah kusut, tidak panas dan menyerap keringat. Cocok digunakan oleh muslim usia 25-45 tahun.', 'Biru', '', '200', 269500, 259500, 10, NULL, '1', '91456741937', '2016-02-29 12:46:09', 'update', '91456741937', '2'),
('229022016175559', 'Kemko Yazeed Mst', 'Kemko Formil atau semi formil. Kemko ini nyaman dipakai karena tidak mudah kusut, tidak panas dan menyerap keringat. Cocok digunakan oleh muslim usia 25-45 tahun.', 'Merah', '', '200', 269500, 259500, 10, NULL, '1', '91456741937', '2016-02-29 12:50:47', 'update', '91456741937', '2'),
('229022016175725', 'Kemko Wazi Mst', 'Kemko Formil atau semi formil. Kemko ini nyaman dipakai karena tidak mudah kusut, tidak panas dan menyerap keringat. Cocok digunakan oleh muslim usia 25-45 tahun.', 'Grey', 'Kemko', '200', 249500, 239500, 10, NULL, '1', '91456741937', '2016-02-29 12:52:29', 'update', '91456741937', '2'),
('229022016175732', 'Mukena Sevila', 'Mukena dengan konsep abaya ini yaitu tanpa penutup kepala yang cocok digunakan untuk di bawa bepergian. Bahannya yang dingin dan tidak transparan. Dilengkapi dengan tas cantik agar menambah kesan simple.\r\n\r\nPANJANG MUKENA : 155\r\nPANJANG TANGAN DARI LEHER: 86\r\nLEBAR DADA: 134', 'Ungu', 'Alat Shalat', '300', 359500, 349500, 10, NULL, '1', '91456741937', '2016-02-29 12:45:08', 'update', '91456741937', '2'),
('229022016175828', 'Kemko Wazi Mst', 'Kemko Formil atau semi formil. Kemko ini nyaman dipakai karena tidak mudah kusut, tidak panas dan menyerap keringat. Cocok digunakan oleh muslim usia 25-45 tahun.', 'Ungu', 'Kemko', '200', 249500, 239500, 10, NULL, '1', '91456741937', '2016-02-29 12:53:11', 'update', '91456741937', '2'),
('229022016180000', 'Kemko Wazi Mst', 'Kemko Formil atau semi formil. Kemko ini nyaman dipakai karena tidak mudah kusut, tidak panas dan menyerap keringat. Cocok digunakan oleh muslim usia 25-45 tahun.', 'Biru', 'Kemko', '200', 249500, 239500, 10, NULL, '0', '91456741937', '2016-02-29 12:54:30', 'delete', '91456741937', '2'),
('229022016180103', 'Kemko Omar Mst', 'Kemko Formil atau semi formil. Kemko ini nyaman dipakai karena tidak mudah kusut, tidak panas dan menyerap keringat. Cocok digunakan oleh muslim usia 25-45 tahun.', 'Kuning', 'Kemko', '200', 269500, 259500, 10, NULL, '1', '91456741937', '2016-02-29 13:00:28', 'update', '91456741937', '2'),
('229022016180147', 'Sarung Kid Quds 4', 'Sarung anak motif ceria. Cocok digunakan oleh anak usia 4-10 tahun.\r\n\r\nBahan Dasar : \r\nTersedia Ukuran : All Size', 'Biru', 'Baju', '300', 65500, 64500, 10, NULL, '1', '91456741937', '2016-02-29 12:46:27', 'update', '91456741937', '2'),
('229022016180259', 'Kemko Faraz Mst', 'Kemko Formil atau semi formil. Kemko ini nyaman dipakai karena tidak mudah kusut, tidak panas dan menyerap keringat. Cocok digunakan oleh muslim usia 25-45 tahun.', 'Cokelat Kopi', 'Kemko', '200', 269500, 259500, 10, NULL, '1', '91456741937', '2016-02-29 13:03:09', 'update', '91456741937', '2'),
('229022016180422', 'Kemko Baraa Pdk', 'Kemko formal dan informal. Kemko ini nyaman digunakan karena tidak panas, tidak mudah kusut dan menyerap keringat. Cocok dipakai untuk usia 20-35 tahun pada kesempatan formal maupun acara santai.', 'Biru', 'Kemko', '200', 259500, 249500, 10, NULL, '1', '91456741937', '2016-02-29 13:03:59', 'update', '91456741937', '2'),
('229022016180431', 'Sarung Kid Quds 3', 'Sarung anak motif ceria. Cocok digunakan oleh anak usia 4-10 tahun.\r\n\r\nBahan Dasar : \r\nTersedia Ukuran : All Size', 'Coklat', 'Baju', '300', 65500, 64500, 10, NULL, '1', '91456741937', '2016-02-29 12:46:53', 'update', '91456741937', '2'),
('229022016180515', 'Kemko Xighma V5 Pdk', 'Kemko formal dan informal dengan akses kotak-kotak dibagian bawah garis kancing. Kemko ini nyaman digunakan karena tidak panas, tidak mudah kusut dan menyerap keringat. Cocok dipakai untuk usia 20-35 tahun pada kesempatan formal maupun acara santai.', 'Merah Ati', 'Kemko', '300', 229500, 219500, 10, NULL, '1', '91456741937', '2016-02-29 15:30:57', 'update', '91456741937', '2'),
('229022016180538', 'Sarung Kid Quds 1', 'Sarung anak motif ceria. Cocok digunakan oleh anak usia 4-10 tahun.\r\n\r\nBahan Dasar : \r\nTersedia Ukuran : All Size', 'Ungu', 'Baju', '300', 65500, 64500, 10, NULL, '1', '91456741937', '2016-02-29 12:47:19', 'update', '91456741937', '2'),
('229022016180626', 'Kemko Laqa Mst', 'Kemko dengan detail border berbeda warna di bagian kerah&plaket sebagai aksen. Kemko ini nyaman digunakan karena tidak panas, tidak mudah kusut dan menyerap keringat. Cocok digunakan oleh muslimah usia 30-50 tahun.', 'Merah Ati', 'Kemko', '300', 239500, 229500, 10, NULL, '1', '91456741937', '2016-02-29 15:31:47', 'update', '91456741937', '2'),
('229022016180746', 'Kemko Radya Pdk', 'Style dari Kemko ini adalah untuk acara Formal,tapi dapat digunakan juga untuk acara Semi Formal.Kemko dengan detail embro di bagian saku sebagai aksen ini dapat digunakan untuk pria dewasa usia 25-50 Tahaun. Kemko ini dapat menyerap keringat,lembut dan terasa dingin bila digunakan karen ada perpaudan bahan Cotton.', 'Grey', 'Kemko', '300', 186500, 176500, 10, NULL, '1', '91456741937', '2016-02-29 13:05:34', 'update', '91456741937', '2'),
('229022016180849', 'Kemko Azhim Pdk', 'Kemko Formal dengan detail embro di bagian lengan sebagai aksen .Kemko ini nyaman digunakan karena tidak panas, tidak mudah kusut dan menyerap keringat. Cocok digunakan oleh muslimah usia 30-50 tahun. ', 'Grey', 'Kemko', '300', 224500, 214500, 10, NULL, '1', '91456741937', '2016-02-29 13:06:26', 'update', '91456741937', '2'),
('229022016180945', 'Kerundung Zinny', 'Kerudung instan casual dari bahan look denim dengan variasi jahitan tindis dan kancing sebagai pemanis. Kerudung ini nyaman digunakan karena tidak mudah kusut, tidak panas dan menyerap keringat. Cocok digunakan oleh muslimah usia 20-30 tahun.\r\n\r\n\r\n\r\n\r\n\r\nBahan Dasar : \r\nDenim Spain\r\n\r\nTersedia Ukuran : S M L XL', 'Spearmint', 'Kerudung', '300', 70500, 69500, 10, NULL, '1', '91456741937', '2016-02-29 12:47:51', 'update', '91456741937', '2'),
('229022016181049', 'Kemko Azhar Blg', 'Kemko dengan detail perpaduan style jacket dan kemeja. Dengan detail rib pada manset dan kain printing look denim mix.Kemko ini dapat digunakan untuk acara semi formal maupun casual.Kemko yang dapat menyerap keringat kesan dingin dan lembut. Kemko ini dapat digunakan untuk pria usia 18-35 Tahun.', 'Biru', 'Kemko', '300', 219500, 209500, 10, NULL, '1', '91456741937', '2016-02-29 13:07:31', 'update', '91456741937', '2'),
('229022016181305', 'Kemko Sajadda V2', 'Kemko dengan kerah kemejda dan style office look ini dapat digunakan untuk berbagai acara formal .Dari bahan nya sendiri dapat menyerap keringat dan tidak mudah kusut. Kemko ini dapat digunakan untuk pria dewasa mulai usia 30-50 tahun.', 'Biru', 'Kemko', '300', 179500, 169500, 10, NULL, '1', '91456741937', '2016-02-29 13:08:02', 'update', '91456741937', '2'),
('229022016181310', 'Kerudung Fatin Blonk Rbi', 'Kerudung selendang bolong rib yang bisa di styling dengan berbagai macam gaya ini dapat digunakan oleh remaja mulai usia 18-40 Tahun.bahan nya dapat menyerap keringat,stretch dan tidak terawang.\r\nBahan Dasar : \r\nHyget dan Polyester\r\n\r\nTersedia Ukuran : All Size', 'Hitam', 'Kerudung', '300', 80500, 79500, 10, NULL, '1', '91456741937', '2016-02-29 12:48:27', 'update', '91456741937', '2'),
('229022016181439', 'Kemko Zaston Mst', 'Kemko dengan border berbeda warna di bagian bahu dan ditambah detail embro sebagai aksennya membuat design Kemko ini menjadi lebih indah.Kemko ini bisa digunakan untuk acara Formal maupun Semi Formal. dari bahan nya yang dapat menyerap keringat dan idak mudah kusut bila sudah digunakan.Cocok digunakan untuk usia 20-50 tahun.', 'Hitam', 'Kemko', '300', 309500, 299500, 10, NULL, '1', '91456741937', '2016-02-29 13:08:57', 'update', '91456741937', '2'),
('229022016181602', 'Kerudung Great Altis', 'Konsep kerudung sekolah ini berbahan kaos simple dan sederhana.dibagian atas terdapat lukisan bunga yang cantik. Dan Kerudung ini cocok dipakai oleh anak-anak remaja sekolah sampai dewasa 10-35 tahun.\r\n\r\nBahan Dasar : \r\nPolyester\r\n\r\nTersedia Ukuran : S M L', 'Algres Blue', 'Kerudung', '300', 74500, 73500, 10, NULL, '1', '91456741937', '2016-02-29 12:49:55', 'update', '91456741937', '2'),
('229022016181645', 'Kemko Sangkot Genie', 'Kemko formal glamour dengan detail motif garis pada bagian bahu depan dan manset lengan memberikan kesan formal. Kemko ini nyaman dipakai karena menyerap keringat, tidak panas dan tidak mudah kusut. Cocok digunakan oleh muslim usia 25-40 tahun.', 'Pink', 'Kemko', '300', 479500, 469500, 10, NULL, '1', '91456741937', '2016-02-29 13:10:37', 'update', '91456741937', '2'),
('229022016181806', 'Kemko Blomma Mst', 'Kemko Formil atau semi formil dengan style corak di bagian pergelangan tangan memberikan kesan modern dan simple. Kemko ini nyaman dipakai karena tidak mudah kusut, tidak panas dan menyerap keringat. Cocok digunakan oleh muslim usia 25-45 tahun.', 'Grey', 'Kemko', '300', 239500, 229500, 10, NULL, '1', '91456741937', '2016-02-29 13:10:59', 'update', '91456741937', '2'),
('229022016181926', 'Kerudung Fatin Blonk Pti', 'Kerudung selendang bolong bergo yang bisa di styling dengan berbagai macam gaya ini dapat digunakan untuk remaja mulai usia 18-40 tahun.Cocok untuk acara Formal ataupun Semi Formal.\r\n\r\nBahan Dasar : \r\nHyget\r\n\r\nTersedia Ukuran : All Size', 'Pink Dharma Wanita', 'Kerudung', '300', 83500, 82500, 10, NULL, '1', '91456741937', '2016-02-29 12:50:24', 'update', '91456741937', '2'),
('229022016182114', 'Kerudung Fatin Therru Darra', 'Kerudung dengan style hoodie ini seperti memakai pashmina.Dengan berbahan Polyester dapat menyerap keringat,stretch,lembut dan dingin saat digunakan.Dapat digunakan untuk acara Formal atau semi Formal.Cocok untuk remaja usia 15-40 tahun.\r\n\r\nBahan Dasar : \r\nPolyester\r\n\r\nTersedia Ukuran : S M L XL', 'Salmon Rose', 'Kerudung', '300', 55500, 54500, 10, NULL, '1', '91456741937', '2016-02-29 12:51:03', 'update', '91456741937', '2'),
('229022016182217', 'Kemko Kaufman Mst', 'Kemko nyaman dipakai, tidak mudah kusut, penyerap keringat dan tidak panas. Cocok digunakan oleh muslim 25-40 tahun.', 'Merah Ati', 'Kemko', '300', 239500, 229500, 10, NULL, '1', '91456741937', '2016-02-29 13:11:46', 'update', '91456741937', '2'),
('229022016182337', 'Outer Kimoera', 'Outer dengan lengan kimono, cutting empire di bagian dada kesan slim&kaki jenjang bagi si pemakai. Bisa di mix&match dengan dresslim polos atau blouse&rok/kulot. Outer ini nyaman digunakan karena tidak panas, tidak mudah kusut dan menyerap keringat. Cocok digunakan oleh muslimah usia 18-40 tahun.\r\n\r\nBahan Dasar : \r\nPolyester dan Spandex\r\n\r\nTersedia Ukuran : XS S M L XL XXL', 'Abu Muda', 'Baju', '300', 195500, 194500, 10, NULL, '1', '91456741937', '2016-02-29 12:51:24', 'update', '91456741937', '2'),
('229022016182400', 'Kemko Kalba Pdk', 'Kemko ini nyaman dipakai, tidak mudah kusut, tidak panas dan menyerap keringat. cocok digunakan pada kesempatan semi formil oleh muslim usia 18-40 tahun.', 'Cokelat', 'Kemko', '300', 184500, 174500, 10, NULL, '1', '91456741937', '2016-02-29 13:13:21', 'update', '91456741937', '2'),
('229022016194138', 'Kemko Hamri Pdk', 'Mohon Maaf Produk Sold Out !', 'Biru', 'Kemko', '300', 200000, 200000, 10, NULL, '1', '91456741937', '2016-02-29 13:13:45', 'update', '91456741937', '2'),
('229022016195341', 'Outer Geomma', 'Outer casual dengan motif khas Rabbani yaitu motif Geomma. Dapat dipadupadankan dengan dresslim atau rok polos. Outer ini nyaman digunakan karena tidak panas, tidak mudah kusut dan menyerap keringat. Cocok digunakan oleh muslimah usia 20-35 tahun.\r\n\r\nBahan Dasar : \r\nPolyester\r\n\r\nTersedia Ukuran : XS S M L XL XXL', 'Merah', 'Baju', '300', 130500, 129500, 10, NULL, '1', '91456741937', '2016-02-29 12:54:02', 'update', '91456741937', '2'),
('229022016195505', 'Outer Shady', 'Outer casual/semi formal dengan style jacket androginy, memadukan style maskulin dengan bahan knitting bermotif floral cocok untuk kesempatan casual/semi formal. Bisa di mix & match dengan busana polos berbahan knitting/woven. Cocok digunakan oleh muslimah usia 18-30 tahun.\r\n\r\nBahan Dasar : \r\nKain campuran Rayon dan Polyester\r\n\r\nTersedia Ukuran : XS M L XL', 'Hitam', 'Baju', '300', 320500, 319500, 10, NULL, '1', '91456741937', '2016-02-29 12:55:44', 'update', '91456741937', '2'),
('229022016195713', 'Outer Sangkarra', 'Outer model cape dengan modifikasi bahan polosan-motif. Outer ini cocok dipadukan dengan dresslim bacis bermotif atau dresslim dengan potongan simple untuk kegiatan santai. Outer ini cocok digunakan oelh muslimah usia 25-35 tahun.\r\nBahan Dasar : \r\nFdy baro \r\n\r\nTersedia Ukuran : S M L', 'Fushia Pink', 'Baju', '300', 130500, 129500, 10, NULL, '1', '91456741937', '2016-02-29 12:59:27', 'update', '91456741937', '2'),
('229022016200131', 'Outer Ayesha', 'Outer untuk kesempatan semi formil dengan detail decorative zipper pada bagian kerah dan saku. Outer ini nyaman digunakan tidak panas dan menyerap keringat. Cocok dipakai oleh muslimah usia 20-30 tahun.\r\n\r\nBahan Dasar : \r\nTersedia Ukuran : S M L', 'Tomato Puree', 'Baju', '300', 245500, 244500, 10, NULL, '1', '91456741937', '2016-02-29 13:12:49', 'update', '91456741937', '2'),
('229022016201403', 'Dresslim S3 Betha V4', 'Dresslim formal dengan motif dibagian bawah. Dresslim ini nyaman digunakan karena tidak panas, tidak mudah kusut dan menyerap keringat. Cocok digunakan oleh muslimah usia 25-50 tahun.\r\n\r\nBahan Dasar : \r\nTersedia Ukuran : S M L', 'Krem', 'Baju', '300', 340500, 339500, 10, NULL, '1', '91456741937', '2016-02-29 13:14:22', 'update', '91456741937', '2'),
('229022016201505', 'Kemko Wairish Pdk', 'Kemko ini dapat digunakan untuk kesempatan casual (sehari-hari) atau kesempatan semi formil Cocok digunakan oleh pria dewasa 20-40 tahun. Karakter kain dapat menyerap keringat, pemakaian baju tidak panas dan daya tahan kusut cukup baik. ', 'Grey', 'Kemko', '300', 204500, 194500, 10, NULL, '1', '91456741937', '2016-02-29 13:16:16', 'update', '91456741937', '2'),
('229022016201701', 'Kemko Vier Pdk', 'Kemko dengan detail aplikasi bordir motif abstrak yang diletakan di ujung lengan. Kemko ini nyaman dipakai, tidak mudah kusut, tidak panas dan menyerap keringat. Cocok digunakan untuk kesempatan semi formil oleh muslim dewasa usia 20-40 tahun.', 'Ungu', 'Kemko', '300', 266500, 25500, 10, NULL, '1', '91456741937', '2016-02-29 13:17:29', 'update', '91456741937', '2'),
('229022016201901', 'Dresslim lazetha Tribby', 'Dresslim casual dengan corak khas Rabbani yaitu Motif Tribby bisa dipadupadankan dengan outer atau kerudung polos. Dresslim ini nyaman digunakan karena tidak panas, tidak mudah kusut dan menyerap keringat. Cocok digunakan oleh muslimah usia 25-50 tahun.\r\n\r\nBahan Dasar : \r\nTersedia Ukuran : M', 'Coklat Kopi', 'Baju', '300', 200500, 199500, 10, NULL, '1', '91456741937', '2016-02-29 13:20:09', 'update', '91456741937', '2'),
('229022016201945', 'Kemko Barli Mst', 'Kemko Formil atau semi formil dengan style bordir garis panah pada bagian bawah memberikan kesan modern dan simple. Kemko ini nyaman dipakai karena tidak mudah kusut, tidak panas dan menyerap keringat. Cocok digunakan oleh muslim usia 25-45 tahun', 'Toska', 'Kemko', '300', 244500, 234500, 10, NULL, '1', '91456741937', '2016-02-29 13:20:47', 'update', '91456741937', '2'),
('229022016202150', 'Kemko Duasa Pdk', 'Kemko semiformil dengan detail cutting dan bordir minimalis, cocok digunakan untuk busana kerja atau semi formil. Kemko ini nyaman digunakan, tidak mudah kusut, tidak panas, dan menyerap keringat. ', 'Grey', 'Kemko', '300', 199500, 189500, 10, NULL, '1', '91456741937', '2016-02-29 13:22:11', 'update', '91456741937', '2'),
('229022016202218', 'Dresslim lazetha Shakila', 'Dresslim casual dengan corak leopard bisa dipadupadankan dengan kerudung polos. Dresslim ini nyaman digunakan karena tidak panas, tidak mudah kusut dan menyerap keringat. Cocok digunakan oleh muslimah usia 25-50 tahun.\r\n\r\nBahan Dasar : \r\nTersedia Ukuran : M L', 'Regal Red', 'Baju', '300', 310500, 309500, 10, NULL, '1', '91456741937', '2016-02-29 13:22:48', 'update', '91456741937', '2'),
('229022016202313', 'Kemko Arfad Pdk', 'Kemko dengan detail aplikasi bordir motif abstrak yang diletakan A-simetris. Kemko ini nyaman dipakai, tidak mudah kusut, tidak panas dan menyerap keringat. Cocok digunakan untuk kesempatan semi formil oleh muslim dewasa usia 20-40 tahun.', 'Cokelat Susu', 'Kemko', '300', 199500, 189500, 10, NULL, '1', '91456741937', '2016-02-29 13:24:03', 'update', '91456741937', '2'),
('229022016202420', 'Dresslim lazetha Sangkarra', 'Dresslim casual dengan corak motif khas Rabbani yaitu motif Sangkarra bisa dipadupadankan dengan outer atau kerudung polos. Dresslim ini nyaman digunakan karena tidak panas, tidak mudah kusut dan menyerap keringat. Cocok digunakan oleh muslimah usia 20-50 tahun.\r\n\r\nBahan Dasar : \r\nFdy baro\r\nTersedia Ukuran : M L', 'Fushia Pink', 'Baju', '300', 200500, 199500, 10, NULL, '1', '91456741937', '2016-02-29 13:24:42', 'update', '91456741937', '2'),
('229022016202455', 'Kemko Fulqi Pdk', 'Kemko dewasa casual dengan cutting simple dan fokus bordir pada bagian saku. Kemko nyaman dipakai, tidak mudah kusut, penyerap keringat dan tidak panas. Cocok digunakan oleh muslim 20-30 tahun.', 'Navy', 'Kemko', '300', 194500, 184500, 10, NULL, '1', '91456741937', '2016-02-29 13:25:37', 'update', '91456741937', '2'),
('229022016202551', 'Dresslim lazetha Keysa', 'Dresslim casual dengan corak gradasi warna yang unik dan cerah bisa dipadupadankan dengan kerudung polos atau motif. Dresslim ini nyaman digunakan karena tidak panas, tidak mudah kusut dan menyerap keringat. Cocok digunakan oleh muslimah usia 25-50 tahun.\r\n\r\nBahan Dasar : \r\nTersedia Ukuran : M L', 'Coklat Kopi', 'Baju', '300', 310500, 309500, 10, NULL, '1', '91456741937', '2016-02-29 13:27:13', 'update', '91456741937', '2'),
('229022016202729', 'Kolo Muhar', 'Mohon Maaf Produk Sold Out !\r\n', 'Putih', 'Kolo', '300', 180000, 170000, 10, NULL, '1', '91456741937', '2016-02-29 13:28:37', 'update', '91456741937', '2'),
('229022016202919', 'Kemko Anak Ashraf', 'Kemko anak ini dapat digunakan untuk acara Formal,Semi Formal maupun Casual. Kemko dengan detail perpaduan style jakcet dan kemeja ini dapat dipadupadankan dengan celana panjang berbahan jeans.terdapat detail rib pada manset dan kain printing look dan denim mix.Dapat digunakan untuk usia 5-12 tahun.\r\n\r\nBahan Dasar : \r\nPolyester dan Cotton\r\n\r\nTersedia Ukuran : M L', 'Coklat Susu', 'Baju', '300', 162500, 161500, 10, NULL, '1', '91456741937', '2016-02-29 13:30:27', 'update', '91456741937', '2'),
('229022016203127', 'St Anak Calia', 'Stelan anak dengan perpaduan bahan knitting dan cotton printing. Stelan anak ini dapat digunakan untuk acara Formal maupun Casual.Dengan bahan yang dapat menyerap keringat,lembut dan dingin karena ada perpaduan dari bahan Cotton.Dapat digunakan untuk usia 5-12 tahun.\r\n\r\nBahan Dasar : \r\nCVC Solid dan Clorist Printing\r\n\r\nTersedia Ukuran : XS S M L', 'Krem', 'Baju', '300', 250500, 249500, 10, NULL, '1', '91456741937', '2016-02-29 13:31:55', 'update', '91456741937', '2'),
('229022016203224', 'Kemko Ibra Pdk', 'Kermko semi formil.Kemko Standar dengan aksen cutting temple dan jahit tindis untuk kesan casual.Dapat digunakan Ikhwan remaja hingga dewasa 18-45 Tahun.bahan dari campuran Polyester dan Cotton (dominan Cotton).Karakter kainnya nyaman di pakai,komposisi Cotton kain dapat menyerap keringat.sementara komposisi Polyester kain tahan kusutnya lebih baik.', 'Ungu', 'Kemko', '300', 190000, 200000, 10, NULL, '1', '91456741937', '2016-02-29 13:32:55', 'update', '91456741937', '2'),
('229022016203300', 'Kemko Anak Attarik', 'Kemko dengan detail aplikasi dan embroidery pada bagian depan ini dapat digunakan untuk acara Semi Formal atau Casual.Karakteristik dari kemko ini sendiri dapat menyerap keringat dingin dan lembut.Dapat digunakan untuk usia 5-12 Tahun.\r\n\r\nBahan Dasar : \r\nCVC Solid + Fa 2954 \r\n\r\nPolyester dan Cotton \r\n\r\nTersedia Ukuran : XS S M L', 'Classic Blue', 'Baju', '300', 135500, 134500, 10, NULL, '1', '91456741937', '2016-02-29 13:38:04', 'update', '91456741937', '2'),
('229022016203358', 'Kemko Larnell Pdk', 'Kemeja Koko Formal dengan variasi cutting motif songket di bagian sisi kiri. Cocok dipakai untuk usia 25-40 tahun pada kesempatan formal maupun semi formal.', 'Grey', 'Kemko', '300', 224500, 14500, 10, NULL, '1', '91456741937', '2016-02-29 13:34:34', 'update', '91456741937', '2'),
('229022016203520', 'Kemko Safir Blg', 'Kemko kain border pinggiran sebagai aksen yang diaplikasikan di bagian dada berbentuk vertikal dari leher hingga bawah. Memberikan kesan slim pada si pemakai. Kemko ini cocok digunakan untuk kesempatan formal dan semi formal usia 25-45 tahun.', 'Putih', 'Kemko', '300', 207500, 197500, 10, NULL, '1', '91456741937', '2016-02-29 13:36:31', 'update', '91456741937', '2'),
('229022016203719', 'Kemko Agha Mst', 'Mohon Maaf Produk Sold Out !', 'Biru', 'Kemko', '300', 200000, 190000, 10, NULL, '1', '91456741937', '2016-02-29 13:39:04', 'update', '91456741937', '2'),
('229022016203805', 'Kemko Abura Blg', 'Kemko minimalis dengan detail border bagian dada. Kemko ini dapat digunakan untuk kesempatan casual atau kesempatan semi formal usia dewasa 20-40 tahun. Karakteristik kain dapat menyerap keringat dan tidak panas. ', 'Burgundy', 'Kemko', '300', 194500, 184500, 10, NULL, '1', '91456741937', '2016-02-29 13:39:23', 'update', '91456741937', '2'),
('229022016203927', 'St Anak Pinky zoo', 'Stelan anak dengan perpaduan bahan knitting dan cotton printing ini dapat digunakan untuk acara semi Formal ataupun juga acara casual.Detail aplikasi embroidery pada bagian bawah baju ini membuat baju terlihat lebih lucu bila digunakan oleh anak usia 5-12 Tahun.\r\n\r\nBahan Dasar : \r\nCVC Solid dan Denim Look Printing \r\n\r\nTersedia Ukuran : XS S M L', 'Lichen', 'Baju', '300', 300500, 299500, 10, NULL, '1', '91456741937', '2016-02-29 13:41:12', 'update', '91456741937', '2'),
('229022016204020', 'Kemko Umar Pdk', 'Kemko minimalis dengan detail border bagian dada. Kemko ini dapat digunakan untuk kesempatan casual atau kesempatan semi formal usia dewasa 20-40 tahun. Karakteristik kain dapat menyerap keringat dan tidak panas.', 'Putih', 'Kemko', '300', 214500, 204500, 10, NULL, '1', '91456741937', '2016-02-29 13:41:02', 'update', '91456741937', '2'),
('229022016204145', 'Kemko Hilal Pdk', 'kemko Casual.Kemko berbahan dasar denim dengan variasi kulit membuat si pemakai tampak terlihat lebih modis.Cocok dipakai untuk usia20-35 tahun pada kesempatan formal maupun acara santai.', 'Biru', 'Kemko', '300', 199500, 189500, 10, NULL, '1', '91456741937', '2016-02-29 13:42:13', 'update', '91456741937', '2'),
('229022016204257', 'Jumper Baby Rafiq', 'Bahan terdiri campuran katun dan polyester, (lebih banyak komposisi cvc nya) Karakter kain dapat menyerap keringat, pemakaian baju tidak panas, dan karena ada campuran polyesternya, jadi kusutnya sedikit lebih baik. Jumper baby ini bisa di gunakan oleh bayi usia 1-12 bulan. Spesifik Item :\r\n\r\nBahan Dasar : \r\nKaos/Cotton Viscosa (cvc)\r\n\r\nTersedia Ukuran : All size All size No 12', 'Grey', 'Baju', '300', 135500, 134500, 10, NULL, '1', '91456741937', '2016-02-29 13:43:15', 'update', '91456741937', '2'),
('229022016204258', 'Kemko Labib Mst', 'Kemko Casual Denim.Kemko ini berbahan dasar denim dengan variasi cuttingmotif “RO” di bagian sisi kiridan kanan dada membuat sipemakaitampak terlihat lebih modis.Sangat cocok dipakai untuk usia 25-35 tahunpada kesempatan formal maupunsemi formal.', 'Dark blue', 'Kemko', '300', 209500, 199500, 10, NULL, '1', '91456741937', '2016-02-29 13:43:53', 'update', '91456741937', '2'),
('229022016204524', 'Kemko Alkhaleej Pdk', 'Kemko Casual Denim.Kemko dengan bahan dasar denim polos di mix denganbahan kulit dibagian bahu danbagian dalam kerah.Sangat cocok dipakai untuk usia 20-35 Tahun pada kesempatan semiformal.Daya serap terhadap keringat baik dengan tahan kusut cukup.Gramasi kain cukup besar, sehingga ketebalan kain cukup baik.', 'Light blue', 'Kemko', '300', 204500, 194500, 10, NULL, '1', '91456741937', '2016-02-29 13:45:44', 'update', '91456741937', '2'),
('229022016204630', 'Kemko Akhram Pdk', 'Kemko berbahan dasar denim dengan variasi cutting motif “RO” di bagian sisi kiri dan kanan dada membuat sipemakai tampak terlihat lebih modis.Sangat cocok dipakai untuk usia 25-35 tahun pada kesempatan formal maupun semiformaldaya serap terhadap keringat baik dengan tahan kusut cukup. Gramasi kain cukup besar, sehingga ketebalan kain cukup baik.', 'Medium blue', 'Kemko', '300', 184500, 174500, 10, NULL, '1', '91456741937', '2016-02-29 13:47:03', 'update', '91456741937', '2'),
('229022016204744', 'Krd Zahira Derter S', 'Kerudung segi4 dengan panjang 1,15 M , simple, formil dan modis. Kerudung kotak yang bisa di pakai di acara formal maupun semi formal . Karakteristik kain ini yaitu nyaman dipakai, kain tidak mudah kusut. Kerudung ini cocok dipakai oleh muslimah dewasa awal usia 20thn keatas. Dapat dipadupadankan dengan busana gamis maupun setelan tunik untuk kesempatan semi formal.\r\n\r\nPANJANG KELILING 110\r\nBahan Dasar : \r\nFinex\r\n\r\nTersedia Ukuran : S', 'Putih', 'Kerudung', '300', 46500, 45500, 10, NULL, '1', '91456741937', '2016-02-29 13:48:51', 'update', '91456741937', '2'),
('229022016204745', 'Kemko Abiyu Pdk', 'Kemko Casual Denim.Kemko dengan bahan dasar denim polos di mix dengan bahan kulit di bagian kerah dan variasi dekat saku.Sangat cocok dipakai untuk usia 20-35Tahun pada kesempatan semiformal.Daya serap terhadap keringat baik dengan tahan kusut cukup.Gramasi kain cukup besar, sehingga ketebalan kain cukup baik.', 'Light blue', 'Kemko', '300', 179500, 169500, 10, NULL, '1', '91456741937', '2016-02-29 13:48:08', 'update', '91456741937', '2'),
('229022016204916', 'Kemko Fathan Pdk', 'Kemko berbahan dasar denim dengan variasi kulit membuat sipemakai tampak terlihat lebih modis. Cocok dipakai untuk usia 20-35 tahun pada kesempatan formal maupun acara santai. ', 'Biru', 'Kolo', '300', 203500, 193500, 10, NULL, '1', '91456741937', '2016-02-29 13:49:47', 'update', '91456741937', '2'),
('229022016205034', 'Kemko Dasyir Pdk', 'Kemko ini dapat digunakan untuk kesempatan casual (sehari-hari) atau kesempatan semi formil Cocok digunakan oleh pria dewasa 20-40 tahun. Karakter kain dapat menyerap keringat, pemakaian baju tidak panas dan daya tahan kusut cukup baik. ', 'Cokelat Kopi', 'Kemko', '300', 197500, 187500, 10, NULL, '1', '91456741937', '2016-02-29 13:51:06', 'update', '91456741937', '2'),
('229022016205144', 'Kemko Abasta Mst', 'Konsep Kemeja Koko FormaL dengan variasi cutting motif songket tegak lurus di bagian kanan. Kemko ini cocok dipakai untuk usia 25-40 tahun pada kesempatan formal maupun semiformal. ', 'Hijau Olive', 'Kemko', '300', 259500, 249500, 10, NULL, '1', '91456741937', '2016-02-29 13:52:04', 'update', '91456741937', '2'),
('229022016205154', 'Krd Zahira Zaitra', 'Kerudung segi4 dengan panjang 1,15 M , simple, formil dan modis. Kerudung kotak yang bisa di pakai di acara formal maupun semi formal . Karakteristik kain ini yaitu nyaman dipakai, kain tidak mudah kusut. Kerudung ini cocok dipakai oleh muslimah dewasa awal usia 20thn keatas. Dapat dipadupadankan dengan busana gamis maupun setelan tunik untuk kesempatan semi formal.\r\n\r\nPANJANG KELILING :110\r\n\r\nBahan Dasar : \r\nFinex\r\n\r\nTersedia Ukuran : S', 'Peach Fuzz', 'Kerudung', '300', 60500, 59500, 10, NULL, '1', '91456741937', '2016-02-29 13:52:38', 'update', '91456741937', '2'),
('229022016205425', 'Selendang AJ Lavender', 'Selendang polos dengan ukuran 200 cm x 60 cm yang bisa dibentuk dengan berbagai model kerudung sesuai keinginan si pemakai. Selendang ini nyaman dipakai, tidak mudah kusut, tidak panas dan menyerap keringat. Cocok digunakan oleh muslimah usia 20-40 tahun.\r\n\r\nBahan Dasar : \r\nTersedia Ukuran : All Size', 'Violet', 'Selendang', '300', 95500, 94500, 10, NULL, '1', '91456741937', '2016-02-29 13:55:54', 'update', '91456741937', '2'),
('229022016205722', 'Selendang Helga', 'Selendang berbahan Hyget ini cocok digunakan untuk para remaja mulai usia 17-35 tahun.\r\n\r\ndan dapat juga dipadupadankan dengan dresslim ataupun kastun. cocok untuk acara formal ataupun aktivitas keseharian lainnya.\r\n\r\nBahan Dasar : \r\nHyget\r\n\r\nTersedia Ukuran :\r\nAll Size', 'Arabesque', 'Selendang', '300', 30500, 29500, 10, NULL, '1', '91456741937', '2016-02-29 13:58:05', 'update', '91456741937', '2'),
('229022016205956', 'Krd Zahira Argentine Fleur', 'Kerudung segi empat casual/semi formal bermotif bunga berbahan woven, bisa di mix&match dgn busana polos berbahan knitting/woven. Cocok digunakan oleh muslimah semua generasi.\r\n\r\nBahan Dasar : \r\nPolyester\r\n\r\nTersedia Ukuran : S', 'Dark Toska', 'Kerudung', '300', 77500, 76500, 10, NULL, '1', '91456741937', '2016-02-29 14:00:18', 'update', '91456741937', '2');
-- --------------------------------------------------------
--
-- Table structure for table `produk_foto`
--
CREATE TABLE `produk_foto` (
`id_foto` varchar(30) NOT NULL,
`id_produk` varchar(50) NOT NULL,
`foto_path` varchar(255) NOT NULL DEFAULT '',
`service_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`service_action` varchar(100) DEFAULT '0',
`service_user` varchar(100) DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `produk_foto`
--
INSERT INTO `produk_foto` (`id_foto`, `id_produk`, `foto_path`, `service_time`, `service_action`, `service_user`) VALUES
('327022016022402', '2222809', '7b2bd0565a72c66c1596ea941b9a3183.JPG', '2016-02-26 12:24:02', 'insert', '91456331075'),
('329022016194416', '229022016175243', '7b148666c371b049a30e458208dc669e.jpg', '2016-02-29 05:44:16', 'insert', '91456741937'),
('329022016194503', '229022016175732', '1181b5d7431627149c4f65b4493255f5.jpg', '2016-02-29 05:45:03', 'insert', '91456741937'),
('329022016194556', '229022016175420', '114267127520f86a4898e47d5e937808.jpg', '2016-02-29 05:45:56', 'insert', '91456741937'),
('329022016194619', '229022016180147', '15e68710faaf176eadd906e4f8293778.jpg', '2016-02-29 05:46:19', 'insert', '91456741937'),
('329022016194646', '229022016180431', 'e4140abd6ec2cb39520843d1a2bcc0ca.jpg', '2016-02-29 05:46:46', 'insert', '91456741937'),
('329022016194715', '229022016180538', '23a373ea03b5ad1e7fda40d205a0877b.jpg', '2016-02-29 05:47:15', 'insert', '91456741937'),
('329022016194748', '229022016180945', '09bc65fad08ffb67e2d9998c6d507811.jpg', '2016-02-29 05:47:48', 'insert', '91456741937'),
('329022016194820', '229022016181310', '76098c77bf096edd64b75660c9a450f9.jpg', '2016-02-29 05:48:20', 'insert', '91456741937'),
('329022016194939', '229022016181602', 'b0beceed69ab687cfa5dd18ef2990576.jpg', '2016-02-29 05:49:39', 'insert', '91456741937'),
('329022016195016', '229022016181926', 'b8f6d347855a15db89e40015351acf8f.jpg', '2016-02-29 05:50:16', 'insert', '91456741937'),
('329022016195042', '229022016175559', '539916426454262440409c9c7abdc891.jpg', '2016-02-29 05:50:42', 'insert', '91456741937'),
('329022016195059', '229022016182114', 'ce921113d53fe76183a8b57fafea4fc7.jpg', '2016-02-29 05:50:59', 'insert', '91456741937'),
('329022016195121', '229022016182337', '3fc727bcc3c688a9312b02575c2938b9.jpg', '2016-02-29 05:51:21', 'insert', '91456741937'),
('329022016195140', '229022016175725', '094f3591f4a220dcaaf6219701bd83e9.jpg', '2016-02-29 05:51:40', 'insert', '91456741937'),
('329022016195308', '229022016175828', 'cc23b6d63e01a41e26be994782a39378.jpg', '2016-02-29 05:53:08', 'insert', '91456741937'),
('329022016195359', '229022016195341', '2e9ae4f06c3c608fc315c476ea7403f2.jpg', '2016-02-29 05:53:59', 'insert', '91456741937'),
('329022016195541', '229022016195505', '438807d297f215e2a04a4b602ecef85e.jpg', '2016-02-29 05:55:41', 'insert', '91456741937'),
('329022016195704', '229022016180103', '29699ee07a5795f439964a42103d2889.jpg', '2016-02-29 05:57:04', 'insert', '91456741937'),
('329022016195925', '229022016195713', '78ba6a6b6495b1572140b9a2a833ca8a.jpg', '2016-02-29 05:59:25', 'insert', '91456741937'),
('329022016200143', '229022016200131', '5696ef040fc0feefaad3c317e85babe5.jpg', '2016-02-29 06:01:43', 'insert', '91456741937'),
('329022016200335', '229022016180422', 'f381d35fd507baf76db818274ab4c9a7.jpg', '2016-02-29 06:03:35', 'insert', '91456741937'),
('329022016200531', '229022016180746', '7ad55425ba2b2c456a349e42232df782.jpg', '2016-02-29 06:05:31', 'insert', '91456741937'),
('329022016200623', '229022016180849', 'bab694d833ffccb45dc1ed801d7994a7.jpg', '2016-02-29 06:06:23', 'insert', '91456741937'),
('329022016200727', '229022016181049', 'b1976be7ac15c58be26c4a9a65889604.jpg', '2016-02-29 06:07:27', 'insert', '91456741937'),
('329022016200800', '229022016181305', '037e2e95bd75fa1ab832928cfc80fc42.jpg', '2016-02-29 06:08:00', 'insert', '91456741937'),
('329022016200854', '229022016181439', 'abfbac077dbe0366726c71e76e85cc5f.jpg', '2016-02-29 06:08:54', 'insert', '91456741937'),
('329022016201035', '229022016181645', '21a6971208271cc0635f0bca6277d19d.jpg', '2016-02-29 06:10:35', 'insert', '91456741937'),
('329022016201057', '229022016181806', '79edd8f1c3debbcfdda577135231adf5.jpg', '2016-02-29 06:10:57', 'insert', '91456741937'),
('329022016201144', '229022016182217', '02ce64175de633e50bf4c490cb022892.jpg', '2016-02-29 06:11:44', 'insert', '91456741937'),
('329022016201319', '229022016182400', '64dbaca1df15e009009ec1088e708f94.jpg', '2016-02-29 06:13:19', 'insert', '91456741937'),
('329022016201342', '229022016194138', '7109c33cdc7c47c16e9265ce70b4579b.jpg', '2016-02-29 06:13:42', 'insert', '91456741937'),
('329022016201417', '229022016201403', 'a6ab3f1884b8b0802c3fdc86db2a8fd6.jpg', '2016-02-29 06:14:17', 'insert', '91456741937'),
('329022016201556', '229022016201505', '59c4b9f62e6a971551926859c8522f7d.jpg', '2016-02-29 06:15:56', 'insert', '91456741937'),
('329022016201726', '229022016201701', 'bd7be1d912b05a3bc0d49857fa1147a5.jpg', '2016-02-29 06:17:26', 'insert', '91456741937'),
('329022016201919', '229022016201901', '91eac0e72d924c2450f978ece0739417.jpg', '2016-02-29 06:19:19', 'insert', '91456741937'),
('329022016202004', '229022016201945', 'd132d9f379d4b314a520f72aa57e56ad.jpg', '2016-02-29 06:20:04', 'insert', '91456741937'),
('329022016202209', '229022016202150', '943d9133d1c7b806b22b483a05f05247.jpg', '2016-02-29 06:22:09', 'insert', '91456741937'),
('329022016202237', '229022016202218', '7aa171b7e285b0673c1e1b1abc51f0db.jpg', '2016-02-29 06:22:37', 'insert', '91456741937'),
('329022016202401', '229022016202313', 'ae11978a9c7e81f89c34633cc610bad2.jpg', '2016-02-29 06:24:01', 'insert', '91456741937'),
('329022016202435', '229022016202420', 'c9b176ef5e51e06d8edd8d42cd4a6efb.jpg', '2016-02-29 06:24:35', 'insert', '91456741937'),
('329022016202515', '229022016202455', 'fa3b28205ed7423c3226000fa146ce5d.jpg', '2016-02-29 06:25:15', 'insert', '91456741937'),
('329022016202607', '229022016202551', '6561e4b68b2ec137846cc47e612222c5.jpg', '2016-02-29 06:26:07', 'insert', '91456741937'),
('329022016202818', '229022016202729', 'c8ad2aa6fc6d6ce7fde304ef0174754c.jpg', '2016-02-29 06:28:18', 'insert', '91456741937'),
('329022016203022', '229022016202919', 'eef8bf7d4455445734c2d2909845c2d8.jpg', '2016-02-29 06:30:22', 'insert', '91456741937'),
('329022016203149', '229022016203127', '7f25fe99bb4cd6bf01d5a3a1a43e0a5c.jpg', '2016-02-29 06:31:49', 'insert', '91456741937'),
('329022016203247', '229022016203224', 'a73297e268cc111b8ac2504dc2b0d6da.jpg', '2016-02-29 06:32:47', 'insert', '91456741937'),
('329022016203432', '229022016203358', 'f3a1ddb96383c55ff0f6f240082e1894.jpg', '2016-02-29 06:34:32', 'insert', '91456741937'),
('329022016203629', '229022016203520', '5c0de2b0dad505559cd795574e0518b4.jpg', '2016-02-29 06:36:29', 'insert', '91456741937'),
('329022016203758', '229022016203300', 'f89aa846ddb39e9512083b157a3de39b.jpg', '2016-02-29 06:37:58', 'insert', '91456741937'),
('329022016203902', '229022016203719', '07c250e3eb0147848f192fd3784f5d9b.jpg', '2016-02-29 06:39:02', 'insert', '91456741937'),
('329022016203921', '229022016203805', '424932a76341a170515d2d0f73e226eb.jpg', '2016-02-29 06:39:21', 'insert', '91456741937'),
('329022016204053', '229022016204020', 'ee73cb9085a916d21dc803d73966ba18.jpg', '2016-02-29 06:40:53', 'insert', '91456741937'),
('329022016204100', '229022016203927', '95ab54a338438c910f15cb844598e76d.jpg', '2016-02-29 06:41:00', 'insert', '91456741937'),
('329022016204211', '229022016204145', '007ed0cd67b0d5a7c6bc811609e2665d.jpg', '2016-02-29 06:42:11', 'insert', '91456741937'),
('329022016204310', '229022016204257', '85766f0a8a4541c135144e9d772b8383.jpg', '2016-02-29 06:43:10', 'insert', '91456741937'),
('329022016204328', '229022016204258', '772a3d47c2f144c74edc87192739bb9e.jpg', '2016-02-29 06:43:28', 'insert', '91456741937'),
('329022016204542', '229022016204524', 'd7a383bb422d3e4ddf48679587c91f23.jpg', '2016-02-29 06:45:42', 'insert', '91456741937'),
('329022016204701', '229022016204630', 'af814b7f032dd8c791d851f4e959b1fa.jpg', '2016-02-29 06:47:01', 'insert', '91456741937'),
('329022016204805', '229022016204745', '1bee88223994d3dc93e8acb375d068a0.jpg', '2016-02-29 06:48:05', 'insert', '91456741937'),
('329022016204844', '229022016204744', '15dce3755373aa8510d17554eff10a31.jpg', '2016-02-29 06:48:44', 'insert', '91456741937'),
('329022016204944', '229022016204916', '0f3a7a920c86ffbe1f25753fd08ac050.jpg', '2016-02-29 06:49:44', 'insert', '91456741937'),
('329022016205052', '229022016205034', 'bbd274cebbc18443a230e083659107c4.jpg', '2016-02-29 06:50:52', 'insert', '91456741937'),
('329022016205202', '229022016205144', '74e25494a18abb7eb8e4cbb980449265.jpg', '2016-02-29 06:52:02', 'insert', '91456741937'),
('329022016205234', '229022016205154', 'efde3634a471cd085c4a7bfcc368610e.jpg', '2016-02-29 06:52:34', 'insert', '91456741937'),
('329022016205549', '229022016205425', '10b77e2e3327790378ff6c269a0efa01.jpg', '2016-02-29 06:55:49', 'insert', '91456741937'),
('329022016205758', '229022016205722', '6226e1bff2c6ce52ee511f92f5b6cd08.jpg', '2016-02-29 06:57:58', 'insert', '91456741937'),
('329022016210015', '229022016205956', 'bba8b895b97d71987b7281bd0435b335.jpg', '2016-02-29 07:00:15', 'insert', '91456741937'),
('329022016223055', '229022016180515', 'f3eefa002f07a29ed6c2ac635f8bb0cd.jpg', '2016-02-29 15:30:55', 'insert', '91456741937'),
('329022016223145', '229022016180626', '1b49d19ef62273f668542514a525d57d.jpg', '2016-02-29 15:31:45', 'insert', '91456741937'),
('302032016011613', '201032016234642', 'e6f05dd197c4b45356860b497e01a950.jpg', '2016-03-01 18:16:13', 'insert', '91456822446');
-- --------------------------------------------------------
--
-- Table structure for table `produk_history`
--
CREATE TABLE `produk_history` (
`id_produk` varchar(50) NOT NULL,
`harga_jual` varchar(100) NOT NULL DEFAULT '',
`warna` varchar(100) DEFAULT '',
`tipe` varchar(100) DEFAULT '',
`price_s` varchar(100) DEFAULT NULL,
`price_n` varchar(100) DEFAULT NULL,
`berat` varchar(100) DEFAULT '',
`ket` text,
`service_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`service_action` varchar(100) NOT NULL DEFAULT '',
`service_user` varchar(100) NOT NULL DEFAULT '',
`qty` int(10) NOT NULL,
`user` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `produk_history`
--
INSERT INTO `produk_history` (`id_produk`, `harga_jual`, `warna`, `tipe`, `price_s`, `price_n`, `berat`, `ket`, `service_time`, `service_action`, `service_user`, `qty`, `user`) VALUES
('2222620', '', '', '', '28000', '30000', '1', 'Management Produk', '2016-02-26 19:07:30', 'update', '91456331075', 5, ''),
('2222710', '', '', '', '28000', '30000', '1', 'Management Produk', '2016-02-26 19:07:38', 'update', '91456331075', 5, ''),
('2147483647', '', '', '', NULL, NULL, '', 'Management Produk', '2016-02-26 19:09:59', 'delete', '91456331075', 0, ''),
('2222809', '', '', '', '28000', '30000', '1', 'Management Produk', '2016-02-26 19:14:58', 'update', '91456331075', 10, ''),
('2147483647', '', '', '', '18500', '21000', '1', 'Management Produk', '2016-02-26 19:26:41', 'update', '91456331075', 6, ''),
('2147483647', '', '', '', '18500', '21000', '1', 'Management Produk', '2016-02-26 19:34:25', 'update', 'Bobby Chahya', 17, ''),
('2222829', '', '', '', '28000', '30000', '1', 'Management Produk', '2016-02-26 19:37:40', 'update', 'Bobby Chahya', 5, ''),
('2222620', '', '', '', '28000', '30000', '1', 'Management Produk', '2016-02-28 11:32:52', 'update', 'Bobby Chahya', 5, ''),
('229022016174200', '', 'Hijau alpukat', '', '205000', '210000', '300', 'Management Produk', '2016-02-29 10:42:00', 'insert', 'Muslimah Gallery', 10, ''),
('229022016174655', '', 'Biru Toska Muda', 'Baju', '205000', '210000', '300', 'Management Produk', '2016-02-29 10:46:55', 'insert', 'Muslimah Gallery', 10, ''),
('229022016174939', '', 'Tidak berwarna', '', '5500', '6000', '300', 'Management Produk', '2016-02-29 10:49:39', 'insert', 'Muslimah Gallery', 10, ''),
('229022016175129', '', 'Tidak Berwarna', '', '18500', '20000', '500', 'Management Produk', '2016-02-29 10:51:29', 'insert', 'Muslimah Gallery', 10, ''),
('229022016175240', '', 'Tidak berwarna', '', '7500', '10000', '500', 'Management Produk', '2016-02-29 10:52:40', 'insert', 'Muslimah Gallery', 10, ''),
('229022016175243', '', 'Hijau', 'Baju', '64500', '74500', '300', 'Management Produk', '2016-02-29 10:52:43', 'insert', 'Muslimah Gallery', 10, ''),
('229022016175420', '', 'Biru', '', '259500', '269500', '200', 'Management Produk', '2016-02-29 10:54:20', 'insert', 'Muslimah Gallery', 10, ''),
('229022016175559', '', 'Merah', '', '259500', '269500', '200', 'Management Produk', '2016-02-29 10:55:59', 'insert', 'Muslimah Gallery', 10, ''),
('229022016175725', '', 'Grey', 'Kemko', '239500', '249500', '200', 'Management Produk', '2016-02-29 10:57:25', 'insert', 'Muslimah Gallery', 10, ''),
('229022016175732', '', 'Ungu', 'Alat Shalat', '349500', '359500', '300', 'Management Produk', '2016-02-29 10:57:32', 'insert', 'Muslimah Gallery', 10, ''),
('229022016175828', '', 'Ungu', 'Kemko', '239500', '249500', '200', 'Management Produk', '2016-02-29 10:58:28', 'insert', 'Muslimah Gallery', 10, ''),
('229022016180000', '', 'Biru', 'Kemko', '239500', '249500', '200', 'Management Produk', '2016-02-29 11:00:00', 'insert', 'Muslimah Gallery', 10, ''),
('229022016180103', '', 'Kuning', 'Kemko', '259500', '269500', '200', 'Management Produk', '2016-02-29 11:01:03', 'insert', 'Muslimah Gallery', 10, ''),
('229022016180147', '', 'Biru', 'Baju', '64500', '65500', '300', 'Management Produk', '2016-02-29 11:01:47', 'insert', 'Muslimah Gallery', 10, ''),
('229022016180259', '', 'Cokelat Kopi', 'Kemko', '259500', '269500', '200', 'Management Produk', '2016-02-29 11:02:59', 'insert', 'Muslimah Gallery', 10, ''),
('229022016180422', '', 'Biru', 'Kemko', '249500', '259500', '200', 'Management Produk', '2016-02-29 11:04:22', 'insert', 'Muslimah Gallery', 10, ''),
('229022016180431', '', 'Coklat', 'Baju', '64500', '65500', '300', 'Management Produk', '2016-02-29 11:04:31', 'insert', 'Muslimah Gallery', 10, ''),
('229022016180515', '', 'Merah Ati', 'Kemko', '219500', '229500', '300', 'Management Produk', '2016-02-29 11:05:15', 'insert', 'Muslimah Gallery', 10, ''),
('229022016180538', '', 'Ungu', 'Baju', '64500', '65500', '300', 'Management Produk', '2016-02-29 11:05:38', 'insert', 'Muslimah Gallery', 10, ''),
('229022016180626', '', 'Merah Ati', 'Kemko', '229500', '239500', '300', 'Management Produk', '2016-02-29 11:06:26', 'insert', 'Muslimah Gallery', 10, ''),
('229022016180746', '', 'Grey', 'Kemko', '176500', '186500', '300', 'Management Produk', '2016-02-29 11:07:46', 'insert', 'Muslimah Gallery', 10, ''),
('229022016180849', '', 'Grey', 'Kemko', '214500', '224500', '300', 'Management Produk', '2016-02-29 11:08:49', 'insert', 'Muslimah Gallery', 10, ''),
('229022016180945', '', 'Spearmint', 'Kerudung', '69500', '70500', '300', 'Management Produk', '2016-02-29 11:09:45', 'insert', 'Muslimah Gallery', 10, ''),
('229022016181049', '', 'Biru', 'Kemko', '209500', '219500', '300', 'Management Produk', '2016-02-29 11:10:49', 'insert', 'Muslimah Gallery', 10, ''),
('229022016181305', '', 'Biru', 'Kemko', '169500', '179500', '300', 'Management Produk', '2016-02-29 11:13:05', 'insert', 'Muslimah Gallery', 10, ''),
('229022016181310', '', 'Hitam', 'Kerudung', '79500', '80500', '300', 'Management Produk', '2016-02-29 11:13:10', 'insert', 'Muslimah Gallery', 10, ''),
('229022016181439', '', 'Hitam', 'Kemko', '299500', '309500', '300', 'Management Produk', '2016-02-29 11:14:39', 'insert', 'Muslimah Gallery', 10, ''),
('229022016181602', '', 'Algres Blue', 'Kerudung', '73500', '74500', '300', 'Management Produk', '2016-02-29 11:16:02', 'insert', 'Muslimah Gallery', 10, ''),
('229022016181645', '', 'Pink', 'Kemko', '469500', '479500', '300', 'Management Produk', '2016-02-29 11:16:45', 'insert', 'Muslimah Gallery', 10, ''),
('229022016181806', '', 'Grey', 'Kemko', '229500', '239500', '300', 'Management Produk', '2016-02-29 11:18:06', 'insert', 'Muslimah Gallery', 10, ''),
('229022016181926', '', 'Pink Dharma Wanita', 'Kerudung', '82500', '83500', '300', 'Management Produk', '2016-02-29 11:19:26', 'insert', 'Muslimah Gallery', 10, ''),
('229022016182114', '', 'Salmon Rose', 'Kerudung', '54500', '55500', '300', 'Management Produk', '2016-02-29 11:21:14', 'insert', 'Muslimah Gallery', 10, ''),
('229022016182217', '', 'Merah Ati', 'Kemko', '229500', '239500', '300', 'Management Produk', '2016-02-29 11:22:17', 'insert', 'Muslimah Gallery', 10, ''),
('229022016182337', '', 'Abu Muda', 'Baju', '194500', '195500', '300', 'Management Produk', '2016-02-29 11:23:37', 'insert', 'Muslimah Gallery', 10, ''),
('229022016182400', '', 'Cokelat', 'Kemko', '174500', '184500', '300', 'Management Produk', '2016-02-29 11:24:00', 'insert', 'Muslimah Gallery', 10, ''),
('229022016194138', '', 'Biru', 'Kemko', '200000', '200000', '300', 'Management Produk', '2016-02-29 12:41:38', 'insert', 'Muslimah Gallery', 10, ''),
('229022016174200', '', 'Hijau alpukat', '', '205', '210', '300', 'Management Produk', '2016-02-29 12:43:24', 'update', 'Muslimah Gallery', 10, ''),
('229022016175243', '', 'Hijau', 'Baju', '64500', '74500', '300', 'Management Produk', '2016-02-29 12:44:23', 'update', 'Muslimah Gallery', 10, ''),
('229022016175732', '', 'Ungu', 'Alat Shalat', '349500', '359500', '300', 'Management Produk', '2016-02-29 12:45:08', 'update', 'Muslimah Gallery', 10, ''),
('229022016175420', '', 'Biru', '', '259500', '269500', '200', 'Management Produk', '2016-02-29 12:46:09', 'update', 'Muslimah Gallery', 10, ''),
('229022016180147', '', 'Biru', 'Baju', '64500', '65500', '300', 'Management Produk', '2016-02-29 12:46:27', 'update', 'Muslimah Gallery', 10, ''),
('229022016180431', '', 'Coklat', 'Baju', '64500', '65500', '300', 'Management Produk', '2016-02-29 12:46:53', 'update', 'Muslimah Gallery', 10, ''),
('229022016180538', '', 'Ungu', 'Baju', '64500', '65500', '300', 'Management Produk', '2016-02-29 12:47:19', 'update', 'Muslimah Gallery', 10, ''),
('229022016180945', '', 'Spearmint', 'Kerudung', '69500', '70500', '300', 'Management Produk', '2016-02-29 12:47:51', 'update', 'Muslimah Gallery', 10, ''),
('229022016181310', '', 'Hitam', 'Kerudung', '79500', '80500', '300', 'Management Produk', '2016-02-29 12:48:05', 'update', 'Muslimah Gallery', 10, ''),
('229022016181310', '', 'Hitam', 'Kerudung', '79500', '80500', '300', 'Management Produk', '2016-02-29 12:48:27', 'update', 'Muslimah Gallery', 10, ''),
('229022016181602', '', 'Algres Blue', 'Kerudung', '73500', '74500', '300', 'Management Produk', '2016-02-29 12:49:42', 'update', 'Muslimah Gallery', 10, ''),
('229022016181602', '', 'Algres Blue', 'Kerudung', '73500', '74500', '300', 'Management Produk', '2016-02-29 12:49:55', 'update', 'Muslimah Gallery', 10, ''),
('229022016181926', '', 'Pink Dharma Wanita', 'Kerudung', '82500', '83500', '300', 'Management Produk', '2016-02-29 12:50:24', 'update', 'Muslimah Gallery', 10, ''),
('229022016175559', '', 'Merah', '', '259500', '269500', '200', 'Management Produk', '2016-02-29 12:50:47', 'update', 'Muslimah Gallery', 10, ''),
('229022016182114', '', 'Salmon Rose', 'Kerudung', '54500', '55500', '300', 'Management Produk', '2016-02-29 12:51:03', 'update', 'Muslimah Gallery', 10, ''),
('229022016182337', '', 'Abu Muda', 'Baju', '194500', '195500', '300', 'Management Produk', '2016-02-29 12:51:24', 'update', 'Muslimah Gallery', 10, ''),
('229022016175725', '', 'Grey', 'Kemko', '239500', '249500', '200', 'Management Produk', '2016-02-29 12:52:29', 'update', 'Muslimah Gallery', 10, ''),
('229022016175828', '', 'Ungu', 'Kemko', '239500', '249500', '200', 'Management Produk', '2016-02-29 12:53:11', 'update', 'Muslimah Gallery', 10, ''),
('229022016195341', '', 'Merah', 'Baju', '129500', '130500', '300', 'Management Produk', '2016-02-29 12:53:41', 'insert', 'Muslimah Gallery', 10, ''),
('229022016195341', '', 'Merah', 'Baju', '129500', '130500', '300', 'Management Produk', '2016-02-29 12:54:02', 'update', 'Muslimah Gallery', 10, ''),
('229022016180000', '', '', '', NULL, NULL, '', 'Management Produk', '2016-02-29 12:54:30', 'delete', 'Muslimah Gallery', 0, ''),
('229022016195505', '', 'Hitam', 'Baju', '319500', '320500', '300', 'Management Produk', '2016-02-29 12:55:05', 'insert', 'Muslimah Gallery', 10, ''),
('229022016195505', '', 'Hitam', 'Baju', '319500', '320500', '300', 'Management Produk', '2016-02-29 12:55:44', 'update', 'Muslimah Gallery', 10, ''),
('229022016195713', '', 'Fushia Pink', 'Baju', '129500', '130500', '300', 'Management Produk', '2016-02-29 12:57:13', 'insert', 'Muslimah Gallery', 10, ''),
('229022016195713', '', 'Fushia Pink', 'Baju', '129500', '130500', '300', 'Management Produk', '2016-02-29 12:59:27', 'update', 'Muslimah Gallery', 10, ''),
('229022016180103', '', 'Kuning', 'Kemko', '259500', '269500', '200', 'Management Produk', '2016-02-29 13:00:28', 'update', 'Muslimah Gallery', 10, ''),
('229022016200131', '', 'Tomato Puree', 'Baju', '244500', '245500', '300', 'Management Produk', '2016-02-29 13:01:31', 'insert', 'Muslimah Gallery', 10, ''),
('229022016180259', '', 'Cokelat Kopi', 'Kemko', '259500', '269500', '200', 'Management Produk', '2016-02-29 13:03:09', 'update', 'Muslimah Gallery', 10, ''),
('229022016180422', '', 'Biru', 'Kemko', '249500', '259500', '200', 'Management Produk', '2016-02-29 13:03:39', 'update', 'Muslimah Gallery', 10, ''),
('229022016180422', '', 'Biru', 'Kemko', '249500', '259500', '200', 'Management Produk', '2016-02-29 13:03:59', 'update', 'Muslimah Gallery', 10, ''),
('229022016180515', '', 'Merah Ati', 'Kemko', '219500', '229500', '300', 'Management Produk', '2016-02-29 13:04:30', 'update', 'Muslimah Gallery', 10, ''),
('229022016180626', '', 'Merah Ati', 'Kemko', '229500', '239500', '300', 'Management Produk', '2016-02-29 13:04:56', 'update', 'Muslimah Gallery', 10, ''),
('229022016180746', '', 'Grey', 'Kemko', '176500', '186500', '300', 'Management Produk', '2016-02-29 13:05:34', 'update', 'Muslimah Gallery', 10, ''),
('229022016180849', '', 'Grey', 'Kemko', '214500', '224500', '300', 'Management Produk', '2016-02-29 13:06:26', 'update', 'Muslimah Gallery', 10, ''),
('229022016181049', '', 'Biru', 'Kemko', '209500', '219500', '300', 'Management Produk', '2016-02-29 13:07:31', 'update', 'Muslimah Gallery', 10, ''),
('229022016181305', '', 'Biru', 'Kemko', '169500', '179500', '300', 'Management Produk', '2016-02-29 13:08:02', 'update', 'Muslimah Gallery', 10, ''),
('229022016181439', '', 'Hitam', 'Kemko', '299500', '309500', '300', 'Management Produk', '2016-02-29 13:08:57', 'update', 'Muslimah Gallery', 10, ''),
('229022016181645', '', 'Pink', 'Kemko', '469500', '479500', '300', 'Management Produk', '2016-02-29 13:10:37', 'update', 'Muslimah Gallery', 10, ''),
('229022016181806', '', 'Grey', 'Kemko', '229500', '239500', '300', 'Management Produk', '2016-02-29 13:10:59', 'update', 'Muslimah Gallery', 10, ''),
('229022016182217', '', 'Merah Ati', 'Kemko', '229500', '239500', '300', 'Management Produk', '2016-02-29 13:11:46', 'update', 'Muslimah Gallery', 10, ''),
('229022016200131', '', 'Tomato Puree', 'Baju', '244500', '245500', '300', 'Management Produk', '2016-02-29 13:12:49', 'update', 'Muslimah Gallery', 10, ''),
('229022016182400', '', 'Cokelat', 'Kemko', '174500', '184500', '300', 'Management Produk', '2016-02-29 13:13:21', 'update', 'Muslimah Gallery', 10, ''),
('229022016194138', '', 'Biru', 'Kemko', '200000', '200000', '300', 'Management Produk', '2016-02-29 13:13:45', 'update', 'Muslimah Gallery', 10, ''),
('229022016201403', '', 'Krem', 'Baju', '339500', '340500', '300', 'Management Produk', '2016-02-29 13:14:03', 'insert', 'Muslimah Gallery', 10, ''),
('229022016201403', '', 'Krem', 'Baju', '339500', '340500', '300', 'Management Produk', '2016-02-29 13:14:22', 'update', 'Muslimah Gallery', 10, ''),
('229022016201505', '', 'Grey', 'Kemko', '194500', '204500', '300', 'Management Produk', '2016-02-29 13:15:05', 'insert', 'Muslimah Gallery', 10, ''),
('229022016201505', '', 'Grey', 'Kemko', '194500', '204500', '300', 'Management Produk', '2016-02-29 13:15:20', 'update', 'Muslimah Gallery', 10, ''),
('229022016201505', '', 'Grey', 'Kemko', '194500', '204500', '300', 'Management Produk', '2016-02-29 13:15:58', 'update', 'Muslimah Gallery', 10, ''),
('229022016201505', '', 'Grey', 'Kemko', '194500', '204500', '300', 'Management Produk', '2016-02-29 13:16:16', 'update', 'Muslimah Gallery', 10, ''),
('229022016201701', '', 'Ungu', 'Kemko', '25500', '266500', '300', 'Management Produk', '2016-02-29 13:17:01', 'insert', 'Muslimah Gallery', 10, ''),
('229022016201701', '', 'Ungu', 'Kemko', '25500', '266500', '300', 'Management Produk', '2016-02-29 13:17:29', 'update', 'Muslimah Gallery', 10, ''),
('229022016201901', '', 'Coklat Kopi', 'Baju', '199500', '200500', '300', 'Management Produk', '2016-02-29 13:19:01', 'insert', 'Muslimah Gallery', 10, ''),
('229022016201945', '', 'Toska', 'Kemko', '234500', '244500', '300', 'Management Produk', '2016-02-29 13:19:45', 'insert', 'Muslimah Gallery', 10, ''),
('229022016201945', '', 'Toska', 'Kemko', '234500', '244500', '300', 'Management Produk', '2016-02-29 13:20:08', 'update', 'Muslimah Gallery', 10, ''),
('229022016201901', '', 'Coklat Kopi', 'Baju', '199500', '200500', '300', 'Management Produk', '2016-02-29 13:20:09', 'update', 'Muslimah Gallery', 10, ''),
('229022016201945', '', 'Toska', 'Kemko', '234500', '244500', '300', 'Management Produk', '2016-02-29 13:20:47', 'update', 'Muslimah Gallery', 10, ''),
('229022016202150', '', 'Grey', 'Kemko', '189500', '199500', '300', 'Management Produk', '2016-02-29 13:21:50', 'insert', 'Muslimah Gallery', 10, ''),
('229022016202150', '', 'Grey', 'Kemko', '189500', '199500', '300', 'Management Produk', '2016-02-29 13:22:11', 'update', 'Muslimah Gallery', 10, ''),
('229022016202218', '', 'Regal Red', 'Baju', '309500', '310500', '300', 'Management Produk', '2016-02-29 13:22:18', 'insert', 'Muslimah Gallery', 10, ''),
('229022016202218', '', 'Regal Red', 'Baju', '309500', '310500', '300', 'Management Produk', '2016-02-29 13:22:48', 'update', 'Muslimah Gallery', 10, ''),
('229022016202313', '', 'Cokelat Susu', 'Kemko', '189500', '199500', '300', 'Management Produk', '2016-02-29 13:23:13', 'insert', 'Muslimah Gallery', 10, ''),
('229022016202313', '', 'Cokelat Susu', 'Kemko', '189500', '199500', '300', 'Management Produk', '2016-02-29 13:24:03', 'update', 'Muslimah Gallery', 10, ''),
('229022016202420', '', 'Fushia Pink', 'Baju', '199500', '200500', '300', 'Management Produk', '2016-02-29 13:24:20', 'insert', 'Muslimah Gallery', 10, ''),
('229022016202420', '', 'Fushia Pink', 'Baju', '199500', '200500', '300', 'Management Produk', '2016-02-29 13:24:42', 'update', 'Muslimah Gallery', 10, ''),
('229022016202455', '', 'Navy', 'Kemko', '184500', '194500', '300', 'Management Produk', '2016-02-29 13:24:55', 'insert', 'Muslimah Gallery', 10, ''),
('229022016202455', '', 'Navy', 'Kemko', '184500', '194500', '300', 'Management Produk', '2016-02-29 13:25:20', 'update', 'Muslimah Gallery', 10, ''),
('229022016202455', '', 'Navy', 'Kemko', '184500', '194500', '300', 'Management Produk', '2016-02-29 13:25:37', 'update', 'Muslimah Gallery', 10, ''),
('229022016202551', '', 'Coklat Kopi', 'Baju', '309500', '310500', '300', 'Management Produk', '2016-02-29 13:25:51', 'insert', 'Muslimah Gallery', 10, ''),
('229022016202551', '', 'Coklat Kopi', 'Baju', '309500', '310500', '300', 'Management Produk', '2016-02-29 13:26:18', 'update', 'Muslimah Gallery', 10, ''),
('229022016202551', '', 'Coklat Kopi', 'Baju', '309500', '310500', '300', 'Management Produk', '2016-02-29 13:27:13', 'update', 'Muslimah Gallery', 10, ''),
('229022016202729', '', 'Putih', 'Kolo', '170000', '180000', '300', 'Management Produk', '2016-02-29 13:27:29', 'insert', 'Muslimah Gallery', 10, ''),
('229022016202729', '', 'Putih', 'Kolo', '170000', '180000', '300', 'Management Produk', '2016-02-29 13:28:37', 'update', 'Muslimah Gallery', 10, ''),
('229022016202919', '', 'Coklat Susu', 'Baju', '161500', '162500', '300', 'Management Produk', '2016-02-29 13:29:19', 'insert', 'Muslimah Gallery', 10, ''),
('229022016202919', '', 'Coklat Susu', 'Baju', '161500', '162500', '300', 'Management Produk', '2016-02-29 13:30:27', 'update', 'Muslimah Gallery', 10, ''),
('229022016203127', '', 'Krem', 'Baju', '249500', '250500', '300', 'Management Produk', '2016-02-29 13:31:27', 'insert', 'Muslimah Gallery', 10, ''),
('229022016203127', '', 'Krem', 'Baju', '249500', '250500', '300', 'Management Produk', '2016-02-29 13:31:55', 'update', 'Muslimah Gallery', 10, ''),
('229022016203224', '', 'Ungu', 'Kemko', '200000', '190000', '300', 'Management Produk', '2016-02-29 13:32:24', 'insert', 'Muslimah Gallery', 10, ''),
('229022016203224', '', 'Ungu', 'Kemko', '200000', '190000', '300', 'Management Produk', '2016-02-29 13:32:50', 'update', 'Muslimah Gallery', 10, ''),
('229022016203224', '', 'Ungu', 'Kemko', '200000', '190000', '300', 'Management Produk', '2016-02-29 13:32:55', 'update', 'Muslimah Gallery', 10, ''),
('229022016203300', '', 'Classic Blue', 'Baju', '134500', '135500', '300', 'Management Produk', '2016-02-29 13:33:00', 'insert', 'Muslimah Gallery', 10, ''),
('229022016203358', '', 'Grey', 'Kemko', '14500', '224500', '300', 'Management Produk', '2016-02-29 13:33:58', 'insert', 'Muslimah Gallery', 10, ''),
('229022016203358', '', 'Grey', 'Kemko', '14500', '224500', '300', 'Management Produk', '2016-02-29 13:34:34', 'update', 'Muslimah Gallery', 10, ''),
('229022016203520', '', 'Putih', 'Kemko', '197500', '207500', '300', 'Management Produk', '2016-02-29 13:35:20', 'insert', 'Muslimah Gallery', 10, ''),
('229022016203520', '', 'Putih', 'Kemko', '197500', '207500', '300', 'Management Produk', '2016-02-29 13:36:31', 'update', 'Muslimah Gallery', 10, ''),
('229022016203719', '', 'Biru', 'Kemko', '190000', '200000', '300', 'Management Produk', '2016-02-29 13:37:19', 'insert', 'Muslimah Gallery', 10, ''),
('229022016203300', '', 'Classic Blue', 'Baju', '134500', '135500', '300', 'Management Produk', '2016-02-29 13:38:04', 'update', 'Muslimah Gallery', 10, ''),
('229022016203805', '', 'Burgundy', 'Kemko', '184500', '194500', '300', 'Management Produk', '2016-02-29 13:38:05', 'insert', 'Muslimah Gallery', 10, ''),
('229022016203719', '', 'Biru', 'Kemko', '190000', '200000', '300', 'Management Produk', '2016-02-29 13:39:04', 'update', 'Muslimah Gallery', 10, ''),
('229022016203805', '', 'Burgundy', 'Kemko', '184500', '194500', '300', 'Management Produk', '2016-02-29 13:39:23', 'update', 'Muslimah Gallery', 10, ''),
('229022016203927', '', 'Lichen', 'Baju', '299500', '300500', '300', 'Management Produk', '2016-02-29 13:39:27', 'insert', 'Muslimah Gallery', 10, ''),
('229022016204020', '', 'Putih', 'Kemko', '204500', '214500', '300', 'Management Produk', '2016-02-29 13:40:20', 'insert', 'Muslimah Gallery', 10, ''),
('229022016204020', '', 'Putih', 'Kemko', '204500', '214500', '300', 'Management Produk', '2016-02-29 13:41:02', 'update', 'Muslimah Gallery', 10, ''),
('229022016203927', '', 'Lichen', 'Baju', '299500', '300500', '300', 'Management Produk', '2016-02-29 13:41:12', 'update', 'Muslimah Gallery', 10, ''),
('229022016204145', '', 'Biru', 'Kemko', '189500', '199500', '300', 'Management Produk', '2016-02-29 13:41:45', 'insert', 'Muslimah Gallery', 10, ''),
('229022016204145', '', 'Biru', 'Kemko', '189500', '199500', '300', 'Management Produk', '2016-02-29 13:42:13', 'update', 'Muslimah Gallery', 10, ''),
('229022016204257', '', 'Grey', 'Baju', '134500', '135500', '300', 'Management Produk', '2016-02-29 13:42:57', 'insert', 'Muslimah Gallery', 10, ''),
('229022016204258', '', 'Dark blue', 'Kemko', '199500', '209500', '300', 'Management Produk', '2016-02-29 13:42:58', 'insert', 'Muslimah Gallery', 10, ''),
('229022016204257', '', 'Grey', 'Baju', '134500', '135500', '300', 'Management Produk', '2016-02-29 13:43:15', 'update', 'Muslimah Gallery', 10, ''),
('229022016204258', '', 'Dark blue', 'Kemko', '199500', '209500', '300', 'Management Produk', '2016-02-29 13:43:31', 'update', 'Muslimah Gallery', 10, ''),
('229022016204258', '', 'Dark blue', 'Kemko', '199500', '209500', '300', 'Management Produk', '2016-02-29 13:43:53', 'update', 'Muslimah Gallery', 10, ''),
('229022016204524', '', 'Light blue', 'Kemko', '194500', '204500', '300', 'Management Produk', '2016-02-29 13:45:24', 'insert', 'Muslimah Gallery', 10, ''),
('229022016204524', '', 'Light blue', 'Kemko', '194500', '204500', '300', 'Management Produk', '2016-02-29 13:45:44', 'update', 'Muslimah Gallery', 10, ''),
('229022016204630', '', 'Medium blue', 'Kemko', '174500', '184500', '300', 'Management Produk', '2016-02-29 13:46:30', 'insert', 'Muslimah Gallery', 10, ''),
('229022016204630', '', 'Medium blue', 'Kemko', '174500', '184500', '300', 'Management Produk', '2016-02-29 13:47:03', 'update', 'Muslimah Gallery', 10, ''),
('229022016204744', '', 'Putih', 'Kerudung', '45500', '46500', '300', 'Management Produk', '2016-02-29 13:47:44', 'insert', 'Muslimah Gallery', 10, ''),
('229022016204745', '', 'Light blue', 'Kemko', '169500', '179500', '300', 'Management Produk', '2016-02-29 13:47:45', 'insert', 'Muslimah Gallery', 10, ''),
('229022016204745', '', 'Light blue', 'Kemko', '169500', '179500', '300', 'Management Produk', '2016-02-29 13:48:08', 'update', 'Muslimah Gallery', 10, ''),
('229022016204744', '', 'Putih', 'Kerudung', '45500', '46500', '300', 'Management Produk', '2016-02-29 13:48:51', 'update', 'Muslimah Gallery', 10, ''),
('229022016204916', '', 'Biru', 'Kolo', '193500', '203500', '300', 'Management Produk', '2016-02-29 13:49:16', 'insert', 'Muslimah Gallery', 10, ''),
('229022016204916', '', 'Biru', 'Kolo', '193500', '203500', '300', 'Management Produk', '2016-02-29 13:49:47', 'update', 'Muslimah Gallery', 10, ''),
('229022016205034', '', 'Cokelat Kopi', 'Kemko', '187500', '197500', '300', 'Management Produk', '2016-02-29 13:50:34', 'insert', 'Muslimah Gallery', 10, ''),
('229022016205034', '', 'Cokelat Kopi', 'Kemko', '187500', '197500', '300', 'Management Produk', '2016-02-29 13:50:57', 'update', 'Muslimah Gallery', 10, ''),
('229022016205034', '', 'Cokelat Kopi', 'Kemko', '187500', '197500', '300', 'Management Produk', '2016-02-29 13:51:06', 'update', 'Muslimah Gallery', 10, ''),
('229022016205144', '', 'Hijau Olive', 'Kemko', '249500', '259500', '300', 'Management Produk', '2016-02-29 13:51:44', 'insert', 'Muslimah Gallery', 10, ''),
('229022016205154', '', 'Peach Fuzz', 'Kerudung', '59500', '60500', '300', 'Management Produk', '2016-02-29 13:51:54', 'insert', 'Muslimah Gallery', 10, ''),
('229022016205144', '', 'Hijau Olive', 'Kemko', '249500', '259500', '300', 'Management Produk', '2016-02-29 13:52:04', 'update', 'Muslimah Gallery', 10, ''),
('229022016205154', '', 'Peach Fuzz', 'Kerudung', '59500', '60500', '300', 'Management Produk', '2016-02-29 13:52:38', 'update', 'Muslimah Gallery', 10, ''),
('229022016205425', '', 'Violet', 'Selendang', '94500', '95500', '300', 'Management Produk', '2016-02-29 13:54:25', 'insert', 'Muslimah Gallery', 10, ''),
('229022016205425', '', 'Violet', 'Selendang', '94500', '95500', '300', 'Management Produk', '2016-02-29 13:55:54', 'update', 'Muslimah Gallery', 10, ''),
('229022016205722', '', 'Arabesque', 'Selendang', '29500', '30500', '300', 'Management Produk', '2016-02-29 13:57:22', 'insert', 'Muslimah Gallery', 10, ''),
('229022016205722', '', 'Arabesque', 'Selendang', '29500', '30500', '300', 'Management Produk', '2016-02-29 13:58:05', 'update', 'Muslimah Gallery', 10, ''),
('229022016205956', '', 'Dark Toska', 'Kerudung', '76500', '77500', '300', 'Management Produk', '2016-02-29 13:59:56', 'insert', 'Muslimah Gallery', 10, ''),
('229022016205956', '', 'Dark Toska', 'Kerudung', '76500', '77500', '300', 'Management Produk', '2016-02-29 14:00:18', 'update', 'Muslimah Gallery', 10, ''),
('2222809', '', '', '', NULL, NULL, '', 'Management Produk', '2016-02-29 15:04:58', 'delete', 'Bobby Chahya', 0, ''),
('2222829', '', '', '', NULL, NULL, '', 'Management Produk', '2016-02-29 15:05:00', 'delete', 'Bobby Chahya', 0, ''),
('2147483647', '', '', '', NULL, NULL, '', 'Management Produk', '2016-02-29 15:05:15', 'delete', 'Bobby Chahya', 0, ''),
('2222710', '', '', '', NULL, NULL, '', 'Management Produk', '2016-02-29 15:05:21', 'delete', 'Bobby Chahya', 0, ''),
('229022016180515', '', 'Merah Ati', 'Kemko', '219500', '229500', '300', 'Management Produk', '2016-02-29 15:30:57', 'update', 'Muslimah Gallery', 10, ''),
('229022016180626', '', 'Merah Ati', 'Kemko', '229500', '239500', '300', 'Management Produk', '2016-02-29 15:31:47', 'update', 'Muslimah Gallery', 10, ''),
('201032016234642', '', 'Silver', '', '14950000', '15000000', '1', 'Management Produk', '2016-03-01 16:46:42', 'insert', 'Rizky Tahir', 2, ''),
('201032016234642', '', 'Silver', '', '15950000', '16000000', '1', 'Management Produk', '2016-03-01 18:17:03', 'update', 'Rizky Tahir', 14, ''),
('202032016011832', '', 'White, Black', '', '', '2300000', '1', 'Management Produk', '2016-03-01 18:18:32', 'insert', 'Cimahi Creative Assocation', 4, '');
-- --------------------------------------------------------
--
-- Table structure for table `produk_kategori`
--
CREATE TABLE `produk_kategori` (
`id_kategori` int(10) NOT NULL,
`nama` varchar(30) NOT NULL DEFAULT '',
`service_time` timestamp NULL DEFAULT NULL,
`service_action` varchar(100) DEFAULT '',
`service_user` varchar(100) DEFAULT ''
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `produk_kategori`
--
INSERT INTO `produk_kategori` (`id_kategori`, `nama`, `service_time`, `service_action`, `service_user`) VALUES
(1, 'Muslim', '2016-02-26 15:11:37', 'insert', '91456331075'),
(5, 'Bahan Baku Pangan', '2016-02-26 15:16:06', 'insert', '91456331075'),
(6, 'Liquid', '2016-02-26 15:16:15', 'insert', '91456331075');
-- --------------------------------------------------------
--
-- Table structure for table `produk_kategori_relation`
--
CREATE TABLE `produk_kategori_relation` (
`id_produk` varchar(50) NOT NULL,
`id_kategori` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `produk_kategori_relation`
--
INSERT INTO `produk_kategori_relation` (`id_produk`, `id_kategori`) VALUES
('2147483647', 1),
('2222620', 1),
('2222710', 1),
('2222809', 1),
('2222829', 1),
('229022016174200', 1),
('229022016174655', 1),
('229022016174939', 1),
('229022016175129', 1),
('229022016175240', 1),
('229022016175243', 1),
('229022016175420', 1),
('229022016175559', 1),
('229022016175725', 1),
('229022016175732', 1),
('229022016175828', 1),
('229022016180000', 1),
('229022016180103', 1),
('229022016180147', 1),
('229022016180259', 1),
('229022016180422', 1),
('229022016180431', 1),
('229022016180515', 1),
('229022016180538', 1),
('229022016180626', 1),
('229022016180746', 1),
('229022016180849', 1),
('229022016180945', 1),
('229022016181049', 1),
('229022016181305', 1),
('229022016181310', 1),
('229022016181439', 1),
('229022016181602', 1),
('229022016181645', 1),
('229022016181806', 1),
('229022016181926', 1),
('229022016182114', 1),
('229022016182217', 1),
('229022016182337', 1),
('229022016182400', 1),
('229022016194138', 1),
('229022016195341', 1),
('229022016195505', 1),
('229022016195713', 1),
('229022016200131', 1),
('229022016201403', 1),
('229022016201505', 1),
('229022016201701', 1),
('229022016201901', 1),
('229022016201945', 1),
('229022016202150', 1),
('229022016202218', 1),
('229022016202313', 1),
('229022016202420', 1),
('229022016202455', 1),
('229022016202551', 1),
('229022016202729', 1),
('229022016202919', 1),
('229022016203127', 1),
('229022016203224', 1),
('229022016203300', 1),
('229022016203358', 1),
('229022016203520', 1),
('229022016203719', 1),
('229022016203805', 1),
('229022016203927', 1),
('229022016204020', 1),
('229022016204145', 1),
('229022016204257', 1),
('229022016204258', 1),
('229022016204524', 1),
('229022016204630', 1),
('229022016204744', 1),
('229022016204745', 1),
('229022016204916', 1),
('229022016205034', 1),
('229022016205144', 1),
('229022016205154', 1),
('229022016205425', 1),
('229022016205722', 1),
('229022016205956', 1),
('201032016234642', 5),
('202032016011832', 6);
-- --------------------------------------------------------
--
-- Table structure for table `user_answer_question`
--
CREATE TABLE `user_answer_question` (
`id_user` varchar(25) NOT NULL,
`id_pertanyaan` int(10) NOT NULL,
`jawaban` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user_answer_question`
--
INSERT INTO `user_answer_question` (`id_user`, `id_pertanyaan`, `jawaban`) VALUES
('91456516586', 1, 'Ya'),
('91456516586', 2, 'Tidak'),
('91456516668', 1, 'Ya'),
('91456516668', 2, 'Ya'),
('91456734724', 1, 'Tidak'),
('91456734724', 2, 'Ya'),
('91456763136', 1, 'Ya'),
('91456763136', 2, 'Tidak'),
('91456822446', 1, 'Ya'),
('91456822446', 2, 'Ya'),
('91456836560', 1, 'Ya'),
('91456836560', 2, 'Ya'),
('91456971968', 1, 'Ya'),
('91456971968', 2, 'Ya');
-- --------------------------------------------------------
--
-- Table structure for table `user_detail`
--
CREATE TABLE `user_detail` (
`id_user` varchar(25) DEFAULT NULL,
`nama_lengkap` varchar(100) DEFAULT NULL,
`nama_depan` varchar(50) NOT NULL,
`nama_belakang` varchar(50) NOT NULL,
`alamat` varchar(250) DEFAULT NULL,
`email` varchar(50) DEFAULT NULL,
`telp` varchar(20) DEFAULT NULL,
`tempat_lahir` varchar(100) DEFAULT NULL,
`tgl_lahir` date DEFAULT NULL,
`jenis_kelamin` varchar(1) DEFAULT NULL,
`pekerjaan` int(10) NOT NULL,
`service_time` timestamp NULL DEFAULT NULL,
`service_action` varchar(100) DEFAULT NULL,
`service_user` varchar(100) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user_detail`
--
INSERT INTO `user_detail` (`id_user`, `nama_lengkap`, `nama_depan`, `nama_belakang`, `alamat`, `email`, `telp`, `tempat_lahir`, `tgl_lahir`, `jenis_kelamin`, `pekerjaan`, `service_time`, `service_action`, `service_user`) VALUES
('91456331037', 'Rizky Tahir', 'Rizky', 'Tahir', 'Cimahi', 'tahier.gazerock@gmail.com', '08579389375', NULL, NULL, 'l', 0, '2016-03-03 18:15:26', 'insert', '91456331037'),
('91457028614', 'Admin Koperasi', 'Admin', 'Koperasi', 'Jl. HMS Mintaredja, Gd. BITC lt. 4, Baros, Cimahi, Indonesia', 'admin@andes9.com', '08579389375', NULL, NULL, 'l', 0, '2016-03-03 18:10:14', 'insert', '91456331037');
-- --------------------------------------------------------
--
-- Table structure for table `user_info`
--
CREATE TABLE `user_info` (
`id_user` varchar(50) NOT NULL,
`koperasi` varchar(50) DEFAULT NULL,
`username` varchar(20) NOT NULL,
`password` varchar(255) NOT NULL,
`status_active` int(10) DEFAULT NULL,
`session_token` varchar(100) DEFAULT NULL,
`last_login` datetime DEFAULT NULL,
`level` int(10) NOT NULL,
`foto` text NOT NULL,
`service_time` datetime DEFAULT NULL,
`service_action` varchar(100) DEFAULT NULL,
`service_user` varchar(100) DEFAULT NULL,
`komunitas` varchar(50) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user_info`
--
INSERT INTO `user_info` (`id_user`, `koperasi`, `username`, `password`, `status_active`, `session_token`, `last_login`, `level`, `foto`, `service_time`, `service_action`, `service_user`, `komunitas`) VALUES
('91456331037', '0', 'rftahir', '55232d77a80e247b1d88a092785d05e455301037', 1, '51457036249', '2016-03-04 03:17:29', 1, '8c167f849f7577bb360a0cf302075041.jpg', '2016-03-04 01:15:26', 'insert', '91456331037', NULL),
('91456822763', '81456822763', 'aksara', 'F+UoYNLqTogpzKmV2CSPXaq87WH8Rmxlyfa+8g3l9xp71+c3xX9ZdfM9dKEEZgKk/bDVm0hZ2pV/3gUdRaErhw==', 1, '51456894408', '2016-03-02 11:53:28', 2, '', '2016-03-01 19:40:10', 'update', '91456822763', NULL),
('91456524588', '81456524588', 'grupictures', 'he+C4l5LKG2wvt/zJYulruU4eODiTUk1H8kGq313U8u+06Mtxy7emC2qTyBZjxAN24rWNDhLAvNbfGT7EzmmBQ==', 1, NULL, NULL, 2, '', '2016-02-27 05:09:58', 'insert', '91456331037', NULL),
('91456507703', '81456507703', 'cca', 'M78KhMMdA/aaJyf+afSiBiIQiJ0VIk0JUQAToqOsAhJka1nY6ooLLqHGRqwANepFWjwTSINaywwuLX0Rvcq7MQ==', 1, '51456973504', '2016-03-03 09:51:44', 2, '32e8485397651a6d723bc4a2e7fd3425.png', '2016-03-02 03:19:37', 'update', '91456507703', NULL),
('91456741937', '81456741937', 'geraimuslim', 'AjzPQn3u1Q5w2PMfWAQFfmXt3FOeZrNqMQLaPgDFMOpm4foF9f9JI5iEN/UU4LT0eyanzZ/weWZOGrhHgUwMWQ==', 1, '51456763264', '2016-02-29 23:27:44', 2, '', '2016-02-29 17:32:17', 'insert', '91456331075', NULL),
('91456847241', '81456847241', 'karen', 'DqMTb+n/T5hlLuQJ6WKeiIEPmasnyQuwekxgad/9KQH2UHp8KRsSJA/QTj+Gkzwv4zxdDiWwqMCoy9Rs3Ybo4A==', 1, NULL, NULL, 2, '', '2016-03-01 22:47:21', 'insert', '91456331037', NULL),
('91457028614', '', 'admin', '90b9aa7e25f80cf4f64e990b78a9fc5ebd6cecad', 1, '51457028857', '2016-03-04 01:14:17', 1, '', '2016-03-04 01:10:14', 'insert', '91456331037', NULL),
('91456848348', '81456848348', 'bara', '9EmhGkhkaRDbnCF6blPIx6ZpglQireist1jVZxHoEjs0ILwYlVIKQyEfixRj11cXRmDl9Q7HhZKqlANdcHOoRw==', 1, '51456848975', '2016-03-01 23:16:15', 2, '', '2016-03-01 23:05:48', 'insert', '91456507703', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `user_level`
--
CREATE TABLE `user_level` (
`id_level` int(10) NOT NULL,
`nama` varchar(100) NOT NULL DEFAULT '',
`service_time` timestamp NULL DEFAULT NULL,
`service_action` varchar(100) DEFAULT '',
`service_user` varchar(100) DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user_level`
--
INSERT INTO `user_level` (`id_level`, `nama`, `service_time`, `service_action`, `service_user`) VALUES
(3, 'Anggota', '2016-02-23 11:34:20', 'insert', ''),
(1, 'Admin', '2016-02-23 11:34:31', 'insert', ''),
(2, 'Koperasi', '2016-02-24 19:51:48', 'insert', '91456331037'),
(4, 'Komunitas', NULL, '', ''),
(5, 'Anggota Komunitas', NULL, '', '');
-- --------------------------------------------------------
--
-- Table structure for table `user_question`
--
CREATE TABLE `user_question` (
`id_pertanyaan` int(10) NOT NULL,
`pertanyaan` text,
`service_time` datetime DEFAULT NULL,
`service_user` varchar(100) DEFAULT NULL,
`service_action` varchar(100) DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user_question`
--
INSERT INTO `user_question` (`id_pertanyaan`, `pertanyaan`, `service_time`, `service_user`, `service_action`) VALUES
(1, 'Apakah memiliki kendaraan bermotor?', NULL, NULL, NULL),
(2, 'Apakah anda memiliki barang elektronik?', NULL, NULL, NULL);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `komunitas`
--
ALTER TABLE `komunitas`
ADD PRIMARY KEY (`id_komunitas`);
--
-- Indexes for table `konten_agenda`
--
ALTER TABLE `konten_agenda`
ADD PRIMARY KEY (`id_agenda`);
--
-- Indexes for table `konten_berita`
--
ALTER TABLE `konten_berita`
ADD PRIMARY KEY (`id_berita`);
--
-- Indexes for table `konten_compro`
--
ALTER TABLE `konten_compro`
ADD PRIMARY KEY (`id_compro`);
--
-- Indexes for table `konten_event`
--
ALTER TABLE `konten_event`
ADD PRIMARY KEY (`id_event`);
--
-- Indexes for table `koperasi`
--
ALTER TABLE `koperasi`
ADD PRIMARY KEY (`id_koperasi`);
--
-- Indexes for table `pekerjaan`
--
ALTER TABLE `pekerjaan`
ADD PRIMARY KEY (`id_pekerjaan`);
--
-- Indexes for table `produk`
--
ALTER TABLE `produk`
ADD PRIMARY KEY (`id_produk`);
--
-- Indexes for table `produk_foto`
--
ALTER TABLE `produk_foto`
ADD PRIMARY KEY (`id_foto`),
ADD KEY `fk_foto_produk` (`id_produk`);
--
-- Indexes for table `produk_history`
--
ALTER TABLE `produk_history`
ADD KEY `fk_history_produk` (`id_produk`);
--
-- Indexes for table `produk_kategori`
--
ALTER TABLE `produk_kategori`
ADD PRIMARY KEY (`id_kategori`);
--
-- Indexes for table `produk_kategori_relation`
--
ALTER TABLE `produk_kategori_relation`
ADD KEY `fk_relation_produk` (`id_produk`),
ADD KEY `fk_relation_kategori` (`id_kategori`);
--
-- Indexes for table `user_detail`
--
ALTER TABLE `user_detail`
ADD KEY `fk_detail_user` (`id_user`),
ADD KEY `fk_detail_pekerajaan` (`pekerjaan`);
--
-- Indexes for table `user_info`
--
ALTER TABLE `user_info`
ADD PRIMARY KEY (`id_user`),
ADD KEY `fk_user_koperasi` (`koperasi`),
ADD KEY `fk_user_level` (`level`);
--
-- Indexes for table `user_level`
--
ALTER TABLE `user_level`
ADD PRIMARY KEY (`id_level`);
--
-- Indexes for table `user_question`
--
ALTER TABLE `user_question`
ADD PRIMARY KEY (`id_pertanyaan`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `konten_agenda`
--
ALTER TABLE `konten_agenda`
MODIFY `id_agenda` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `konten_berita`
--
ALTER TABLE `konten_berita`
MODIFY `id_berita` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `konten_compro`
--
ALTER TABLE `konten_compro`
MODIFY `id_compro` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `konten_event`
--
ALTER TABLE `konten_event`
MODIFY `id_event` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `pekerjaan`
--
ALTER TABLE `pekerjaan`
MODIFY `id_pekerjaan` int(10) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `produk_foto`
--
ALTER TABLE `produk_foto`
AUTO_INCREMENT=2147483648;
--
-- AUTO_INCREMENT for table `produk_kategori`
--
ALTER TABLE `produk_kategori`
MODIFY `id_kategori` int(10) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `user_question`
--
ALTER TABLE `user_question`
MODIFY `id_pertanyaan` int(10) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `produk_history`
--
ALTER TABLE `produk_history`
ADD CONSTRAINT `fk_history_produk` FOREIGN KEY (`id_produk`) REFERENCES `produk` (`id_produk`);
--
-- Constraints for table `produk_kategori_relation`
--
ALTER TABLE `produk_kategori_relation`
ADD CONSTRAINT `fk_relation_kategori` FOREIGN KEY (`id_kategori`) REFERENCES `produk_kategori` (`id_kategori`),
ADD CONSTRAINT `fk_relation_produk` FOREIGN KEY (`id_produk`) REFERENCES `produk` (`id_produk`);
| 88.787759 | 630 | 0.679783 |
950bc47ef969de02b02b8e6fad905354f756a07c
| 77 |
lua
|
Lua
|
src/string/init.lua
|
kxmn/lunar
|
765775d106af6b9c623b7142e6d2421f68159ced
|
[
"MIT"
] | null | null | null |
src/string/init.lua
|
kxmn/lunar
|
765775d106af6b9c623b7142e6d2421f68159ced
|
[
"MIT"
] | null | null | null |
src/string/init.lua
|
kxmn/lunar
|
765775d106af6b9c623b7142e6d2421f68159ced
|
[
"MIT"
] | null | null | null |
--[[md:
## aurora.string - String utils
]]
return ondemand('aurora.string')
| 12.833333 | 32 | 0.662338 |
3dba7b9b0ce2d4e05b2e481ca3d79c14bb939efb
| 860 |
sql
|
SQL
|
week06/src/main/resources/03-customer_order.sql
|
himalia6/GeekJava000
|
89a934e2bf834ceb0c7594b3c5e19c7dc69190d6
|
[
"Apache-2.0"
] | null | null | null |
week06/src/main/resources/03-customer_order.sql
|
himalia6/GeekJava000
|
89a934e2bf834ceb0c7594b3c5e19c7dc69190d6
|
[
"Apache-2.0"
] | null | null | null |
week06/src/main/resources/03-customer_order.sql
|
himalia6/GeekJava000
|
89a934e2bf834ceb0c7594b3c5e19c7dc69190d6
|
[
"Apache-2.0"
] | 3 |
2020-11-18T15:58:46.000Z
|
2022-02-13T11:43:11.000Z
|
create table customer_order
(
id int auto_increment comment '实例ID'
primary key,
uuid varchar(64) not null comment '订单uuid',
customer_uuid varchar(64) not null comment '用户uuid',
item_name varchar(255) not null comment '订单ID',
items_total decimal default 0 not null comment '商品总额',
tax_fee decimal default 0 not null comment '税费',
shipping_fee decimal default 0 null comment '快递费用',
order_total decimal default 0 not null comment '订单总价',
order_status int default 0 not null comment '订单状态
0 - 已提交
1 - 待支付
2 - 已支付
3 - 已取消
4 - 已支付
5 - 已完成
6 - 已删除',
transaction_snapshot varchar(255) null comment '交易快照ID',
order_comment varchar(255) null comment '订单备注',
update_at datetime default CURRENT_TIMESTAMP null comment '更新时间',
create_at datetime default CURRENT_TIMESTAMP null comment '创建时间',
constraint order_uuid_uindex
unique (uuid)
)
comment '用户订单表';
| 31.851852 | 66 | 0.767442 |
d1d83b03bbe598e44289a1eab49cb17a85015b23
| 371 |
asm
|
Assembly
|
oeis/180/A180435.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 11 |
2021-08-22T19:44:55.000Z
|
2022-03-20T16:47:57.000Z
|
oeis/180/A180435.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 9 |
2021-08-29T13:15:54.000Z
|
2022-03-09T19:52:31.000Z
|
oeis/180/A180435.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 3 |
2021-08-22T20:56:47.000Z
|
2021-09-29T06:26:12.000Z
|
; A180435: a(n) = a(n-1)*2^n+n, a(0)=1.
; Submitted by Jon Maiga
; 1,3,14,115,1844,59013,3776838,483435271,123759429384,63364827844617,64885583712887818,132885675443994251275,544299726618600453222412,4458903360459574912797999117,73054672657769675371282417532942
mov $2,1
lpb $0
sub $0,1
add $1,$2
add $1,1
mul $2,2
mul $3,$2
add $3,$1
lpe
mov $0,$3
add $0,1
| 23.1875 | 196 | 0.725067 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.