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
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ddac4a720134eb07c150ef2c266d5e38cf33b089
| 3,358
|
java
|
Java
|
Algorithms_Java_Implementation/src/com/akh/algorithms/dataStructure/tree/Complete_Binary_Tree_Inserter_919.java
|
akhr/java
|
e3b2f2d47a922bbc24fddddf552a4f543793017e
|
[
"Apache-2.0"
] | 1
|
2019-07-12T01:35:33.000Z
|
2019-07-12T01:35:33.000Z
|
Algorithms_Java_Implementation/src/com/akh/algorithms/dataStructure/tree/Complete_Binary_Tree_Inserter_919.java
|
akhr/java
|
e3b2f2d47a922bbc24fddddf552a4f543793017e
|
[
"Apache-2.0"
] | 5
|
2021-12-14T21:00:59.000Z
|
2022-01-04T16:53:16.000Z
|
Algorithms_Java_Implementation/src/com/akh/algorithms/dataStructure/tree/Complete_Binary_Tree_Inserter_919.java
|
akhr/java
|
e3b2f2d47a922bbc24fddddf552a4f543793017e
|
[
"Apache-2.0"
] | null | null | null |
package com.akh.algorithms.dataStructure.tree;
import java.util.Deque;
import java.util.LinkedList;
import java.util.Queue;
/**
* @fileName: Complete_Binary_Tree_Inserter_919.java
* @author: Akhash Ramamurthy
* Created on: Oct 6, 2018
*
* A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible.
Write a data structure CBTInserter that is initialized with a complete binary tree and supports the following operations:
CBTInserter(TreeNode root) initializes the data structure on a given tree with head node root;
CBTInserter.insert(int v) will insert a TreeNode into the tree with value node.val = v so that the tree remains complete, and returns the value of the parent of the inserted TreeNode;
CBTInserter.get_root() will return the head node of the tree.
Example 1:
Input: inputs = ["CBTInserter","insert","get_root"], inputs = [[[1]],[2],[]]
Output: [null,1,[1,2]]
Example 2:
Input: inputs = ["CBTInserter","insert","insert","get_root"], inputs = [[[1,2,3,4,5,6]],[7],[8],[]]
Output: [null,3,4,[1,2,3,4,5,6,7,8]]
Note:
The initial given tree is complete and contains between 1 and 1000 nodes.
CBTInserter.insert is called at most 10000 times per test case.
Every value of a given or inserted node is between 0 and 5000.
*/
public class Complete_Binary_Tree_Inserter_919 {
public static class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int x) { val = x; }
}
public Complete_Binary_Tree_Inserter_919(TreeNode root) {
if(root == null)
return;
this.root = root;
buildDeque();
//updateNextInsertParent();
}
public TreeNode get_root() {
return this.root;
}
//=================================== Using DEQUE Method ========================================
private void buildDeque(){
deque = new LinkedList<>();
Queue<TreeNode> queue = new LinkedList<>();
queue.offer(root);
while(!queue.isEmpty()){
TreeNode curr = queue.poll();
if(curr.left == null || curr.right == null)
deque.offerLast(curr);
if(curr.left != null)
queue.offer(curr.left);
if(curr.right != null)
queue.offer(curr.right);
}
}
public int insert(int v) {
TreeNode newNode = new TreeNode(v);
deque.offerLast(newNode);
TreeNode parent = deque.peekFirst();
if(parent.left == null){
parent.left = newNode;
}else {
parent.right = newNode;
deque.pollFirst();
}
return parent.val;
}
//=================================== Using Simple BFS Method ========================================
private void updateNextInsertParent(){
Queue<TreeNode> q = new LinkedList<>();
q.offer(this.root);
while(!q.isEmpty()){
int size = q.size();
while(size > 0){
TreeNode curr = q.poll();
if(curr.left == null || curr.right == null)
this.nextInsertParent = curr;
q.offer(curr.left);
q.offer(curr.right);
}
}
}
public int insert_1(int v) {
TreeNode newNode = new TreeNode(v);
TreeNode parent = nextInsertParent;
if(nextInsertParent.left == null){
nextInsertParent.left = newNode;
}else {
nextInsertParent.right = newNode;
updateNextInsertParent();
}
return parent.val;
}
private TreeNode root;
private TreeNode nextInsertParent;
private Deque<TreeNode> deque;
}
| 27.080645
| 185
| 0.651876
|
c0c958bd18a2dce0bdef00911af0b32071631126
| 3,426
|
swift
|
Swift
|
SwiftUIPro/Screen/LockScreen.swift
|
shiyulong-ios/SwiftUI
|
62b81829be1112e4b01bdf6f7e5a7188bf49d650
|
[
"Apache-2.0"
] | 1
|
2021-01-05T07:11:27.000Z
|
2021-01-05T07:11:27.000Z
|
SwiftUIPro/Screen/LockScreen.swift
|
shiyulong-ios/SwiftUI
|
62b81829be1112e4b01bdf6f7e5a7188bf49d650
|
[
"Apache-2.0"
] | null | null | null |
SwiftUIPro/Screen/LockScreen.swift
|
shiyulong-ios/SwiftUI
|
62b81829be1112e4b01bdf6f7e5a7188bf49d650
|
[
"Apache-2.0"
] | null | null | null |
//
// LockScreen.swift
// Screen
//
// Created by 石玉龙 on 2021/1/7.
//
import SwiftUI
enum LockState {
case UnLock
case PowerOff
case SOS
}
struct LockScreen: View {
@State var textOpacity:Double=1.0
@State private var offset:CGFloat=0
@State private var progress=0
private var capsuleWidth:CGFloat=300
private var capsuleHeight:CGFloat=70
private var displayText:String
private var sliderPictureName:String=""
private var currentLockState:LockState
init(state:LockState) {
currentLockState=state
switch state {
case .PowerOff:
displayText="silde to power off"
sliderPictureName="power"
case .UnLock:
displayText="slide to unlock"
sliderPictureName="chevron.right.2"
case .SOS:
displayText="Emergency SOS"
sliderPictureName=""
}
}
var body: some View {
ZStack{
Color(.black)
VStack{
ZStack{
Capsule()
.fill(Color.gray.opacity(0.1))
Text(displayText)
.fontWeight(.regular)
.font(.system(size: 25))
.modifier(Shimmer())
.padding(.trailing,-40)
HStack{
ZStack{
if currentLockState == .SOS{
Text("SOS")
.font(.title)
}else{
Image(systemName: sliderPictureName)
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 30, height: 30)
}
}
.frame(width: capsuleHeight, height: capsuleHeight)
.foregroundColor(currentLockState == .SOS ? .white : .red)
.background(currentLockState == .SOS ? Color.red : .white)
.clipShape(Circle())
.offset(x: self.offset)
.gesture(
DragGesture()
.onChanged(self.onChanged(_:))
.onEnded(self.onEnd(_:)))
Spacer()
}
}
.frame(width: capsuleWidth, height: capsuleHeight, alignment: .center)
.padding(.vertical)
}
}
}
}
extension LockScreen {
func onChanged(_ value:DragGesture.Value){
let currentX=value.translation.width
if currentX>0 && self.offset<=capsuleWidth-capsuleHeight{
self.offset=currentX
self.textOpacity=Double(1.0-currentX/capsuleWidth)
}
}
func onEnd(_ value:DragGesture.Value){
withAnimation(Animation.easeOut(duration: 0.3)) {
if offset > capsuleWidth/2 {
offset=capsuleWidth-capsuleHeight
DispatchQueue.main.asyncAfter(deadline: .now()+0.25) {
NotificationCenter.default.post(name: NSNotification.Name("Success"), object: nil)
}
}else{
offset=0
}
}
}
}
| 32.628571
| 102
| 0.465558
|
43fc05687756043cf21a440e68449ba06fedd41e
| 2,006
|
ts
|
TypeScript
|
samples/java/sbng/webpubsub-quickstart-angular/src/app/app.component.ts
|
webcane/azure-webpubsub
|
1ea3861f0efce43fcf59dfcb876a5bb22147491e
|
[
"MIT"
] | null | null | null |
samples/java/sbng/webpubsub-quickstart-angular/src/app/app.component.ts
|
webcane/azure-webpubsub
|
1ea3861f0efce43fcf59dfcb876a5bb22147491e
|
[
"MIT"
] | null | null | null |
samples/java/sbng/webpubsub-quickstart-angular/src/app/app.component.ts
|
webcane/azure-webpubsub
|
1ea3861f0efce43fcf59dfcb876a5bb22147491e
|
[
"MIT"
] | null | null | null |
import {Component, OnInit} from '@angular/core';
import {UpdateResponse, UpdateService} from './update/update.service';
import {ToastrService} from 'ngx-toastr';
import {BehaviorSubject, Observable, Subject} from 'rxjs';
import {Select, Store} from '@ngxs/store';
import {CleanStatusesAction, UpdateStatus, UpdateStatusState} from './state/update-status.state';
import {AzurePubSubService} from './pubsub/azure-pub-sub.service';
import {HttpErrorResponse} from '@angular/common/http';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
@Select(UpdateStatusState.getStatus)
updateStatuses$: Observable<UpdateStatus>;
public disableButton$: Subject<boolean> = new BehaviorSubject<boolean>(false);
constructor(private store: Store,
private updateService: UpdateService,
private pubSubService: AzurePubSubService,
private toastrService: ToastrService) {
}
ngOnInit(): void {
this.updateStatuses$.subscribe((value) => {
console.log('new update status: ', value);
});
this.pubSubService.initConnection()
.then(success => {
console.log(success);
})
.catch(error => {
console.log(error);
});
}
public runUpdate(): void {
console.log('run update');
this.disableButton$.next(true);
this.updateService.startUpdate()
.subscribe((data: UpdateResponse) => {
console.log(data);
this.toastrService.success((data.response).toString(), '', {
timeOut: 3000,
progressBar: false,
tapToDismiss: true
});
}, (error: HttpErrorResponse) => {
this.disableButton$.next(false);
this.toastrService.error(error.message, 'start update error');
}, () => {
this.disableButton$.next(false);
});
}
public clean(): void {
this.store.dispatch(new CleanStatusesAction());
}
}
| 29.5
| 97
| 0.652044
|
248107b3dd3aff50678df2b3d3962af025fd752b
| 5,039
|
asm
|
Assembly
|
Transynther/x86/_processed/NONE/_st_/i3-7100_9_0x84_notsx.log_1_2664.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 9
|
2020-08-13T19:41:58.000Z
|
2022-03-30T12:22:51.000Z
|
Transynther/x86/_processed/NONE/_st_/i3-7100_9_0x84_notsx.log_1_2664.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 1
|
2021-04-29T06:29:35.000Z
|
2021-05-13T21:02:30.000Z
|
Transynther/x86/_processed/NONE/_st_/i3-7100_9_0x84_notsx.log_1_2664.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 3
|
2020-07-14T17:07:07.000Z
|
2022-03-21T01:12:22.000Z
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r15
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x94ac, %rsi
lea addresses_normal_ht+0x1e8e3, %rdi
nop
nop
nop
nop
add $8051, %r14
mov $69, %rcx
rep movsb
nop
nop
dec %rax
lea addresses_UC_ht+0x187c7, %rsi
lea addresses_normal_ht+0x198bf, %rdi
nop
nop
nop
add %rdx, %rdx
mov $79, %rcx
rep movsb
nop
nop
nop
add $6602, %rdi
lea addresses_UC_ht+0x17287, %rsi
lea addresses_A_ht+0xf223, %rdi
nop
nop
nop
cmp $52171, %r11
mov $73, %rcx
rep movsl
nop
nop
sub $40707, %rax
lea addresses_WC_ht+0x11473, %rcx
and $43683, %r14
movb $0x61, (%rcx)
nop
nop
dec %rdi
lea addresses_WC_ht+0xe63, %r11
sub $52086, %rcx
vmovups (%r11), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $0, %xmm6, %rdi
nop
nop
nop
nop
sub %rsi, %rsi
lea addresses_normal_ht+0xfd53, %rcx
nop
nop
nop
nop
sub $8259, %r14
movw $0x6162, (%rcx)
sub $60334, %rcx
lea addresses_normal_ht+0x2ae3, %r11
nop
nop
nop
xor $65517, %r14
mov (%r11), %di
nop
nop
nop
cmp $3413, %r11
lea addresses_WT_ht+0xf7a5, %rsi
clflush (%rsi)
sub $3696, %rdi
mov $0x6162636465666768, %rax
movq %rax, %xmm2
and $0xffffffffffffffc0, %rsi
vmovntdq %ymm2, (%rsi)
and $61212, %r14
lea addresses_WC_ht+0x2663, %rsi
lea addresses_WT_ht+0x19ce3, %rdi
nop
nop
nop
and %r15, %r15
mov $54, %rcx
rep movsq
nop
nop
nop
nop
nop
cmp $54787, %rcx
lea addresses_A_ht+0x6c97, %r11
nop
nop
sub $23754, %rdi
mov (%r11), %r15d
nop
nop
cmp %rdi, %rdi
lea addresses_D_ht+0xaae3, %r11
nop
nop
nop
nop
nop
dec %r14
movb (%r11), %dl
nop
nop
nop
nop
sub %rsi, %rsi
lea addresses_normal_ht+0xd263, %rcx
nop
nop
cmp $20773, %r11
mov $0x6162636465666768, %r15
movq %r15, %xmm6
vmovups %ymm6, (%rcx)
nop
nop
nop
nop
add %rdi, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_A+0x2dab, %rsi
lea addresses_RW+0x1e0e3, %rdi
clflush (%rsi)
nop
nop
nop
nop
nop
cmp $2516, %rbp
mov $111, %rcx
rep movsb
nop
nop
nop
nop
nop
add %rax, %rax
// Store
mov $0xfe3, %rbp
nop
and %rdi, %rdi
movb $0x51, (%rbp)
nop
nop
nop
nop
add %rsi, %rsi
// Store
lea addresses_RW+0x6543, %r10
nop
nop
and %rcx, %rcx
movb $0x51, (%r10)
cmp $32189, %rcx
// Load
mov $0x35a, %rax
nop
nop
xor %r10, %r10
movb (%rax), %cl
nop
nop
nop
dec %rcx
// Faulty Load
lea addresses_RW+0x1e0e3, %rbp
cmp $63393, %rax
mov (%rbp), %r10d
lea oracles, %rbp
and $0xff, %r10
shlq $12, %r10
mov (%rbp,%r10,1), %r10
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_RW', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_RW', 'congruent': 0, 'same': True}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_P', 'same': False, 'size': 1, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_RW', 'same': False, 'size': 1, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_P', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_RW', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 1, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 2, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'same': True, 'size': 2, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 32, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 2, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 1, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal_ht', 'same': True, 'size': 32, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'35': 1}
35
*/
| 20.40081
| 152
| 0.647351
|
a457346c984c521390409ed8d64ed1f01b2241d9
| 11,655
|
php
|
PHP
|
resources/views/layouts/user.blade.php
|
hjydmm/myblog-ver2
|
8725599c7c48d9751200be6b313f0f791427a405
|
[
"MIT"
] | null | null | null |
resources/views/layouts/user.blade.php
|
hjydmm/myblog-ver2
|
8725599c7c48d9751200be6b313f0f791427a405
|
[
"MIT"
] | 2
|
2022-01-15T02:10:13.000Z
|
2022-03-02T06:33:35.000Z
|
resources/views/layouts/user.blade.php
|
hjydmm/myblog-ver2
|
8725599c7c48d9751200be6b313f0f791427a405
|
[
"MIT"
] | null | null | null |
@extends('layouts.main')
@section('keywords', config('home.site.keywords'))
@section('description', config('home.site.description'))
@section('mainStyle')
@yield('detailStyle')
@endsection
@section('navList')
@yield('navList')
@endsection
@section('main')
<section id="content">
<div class="container">
<div class="row">
<div class="left-content col-md-3">
<div class="user-page">
<!-- 会员个人信息部分 -->
<div class="user-widget user-description">
<span class="description">
@if (Auth::guard('home')->user() && Auth::guard('home')->user()->id == $id)
私のページ
@else
投稿者情報
@endif
</span>
</div>
<div class="user-widget user-avatar-name">
<div class="member-info">
<div class="left-avatar">
<div style="background:url('{{ $user->avatar }}') no-repeat center / cover" class="thumbnail"></div>
</div>
<div class="right-username">
<div>
{{ $user->user_name }}
</div>
</div>
</div>
</div>
<div class="user-widget user-info-items">
{{--@if (Auth::guard('home')->user() && Auth::guard('home')->user()->id == $id)--}}
{{--@else--}}
{{--<span id="attend">--}}
{{--@inject('attendService', 'App\Services\AttendServiceInterface')--}}
{{--@if(Auth::guard('home')->user() && $attendService->isAttendUser(Auth::guard('home')->user()->id, $user->id) == true)--}}
{{--<a href="javascript:void(0);" class="Follow">--}}
{{--フォロー中--}}
{{--</a>--}}
{{--@else--}}
{{--<a href="javascript:void(0);" class="notFollow">--}}
{{--フォローする--}}
{{--</a>--}}
{{--@endif--}}
{{--</span>--}}
{{--@endif--}}
<div class="self-introduction">
{{ $user->introduction ? : 'おはようございます!' }}
</div>
<div class="user_info">
<div id="article_number">
<span>
記事
{{ $pageElement['countPassArticle'] }}
</span>
</div>
<div id="stored">
<span>
ブックマーク
{{ $pageElement['countArticleStored'] }}
</span>
</div>
<div id="attended">
<span>
フォロワー
{{ $pageElement['countAttended'] }}
</span>
</div>
<div id="liked">
<span>
いいね
{{ $pageElement['countArticleLiked'] }}
</span>
</div>
</div>
</div>
<div class="user-widget user-info-items">
@if (Auth::guard('home')->user() && Auth::guard('home')->user()->id == $id)
<a id="write-article" href="{{ url('/writeArticle') }}">
記事を書く
</a>
@else
<span id="attend">
@inject('attendService', 'App\Services\AttendServiceInterface')
@if(Auth::guard('home')->user() && $attendService->isAttendUser(Auth::guard('home')->user()->id, $user->id) == true)
<a href="javascript:void(0);" class="Follow">
フォロー中
</a>
@else
<a href="javascript:void(0);" class="notFollow">
フォローする
</a>
@endif
</span>
@endif
</div>
<!-- 会员行为部分 -->
<div class="user-widget user-info-items">
<div class="action-content">
<div class="action">
<a href="{{ route('user.share',[ $id ]) }}">
<span class=""><i class="fa fa-book"></i> 記事リスト</span>
</a>
</div>
<div class="action">
<a href="{{ route('user.comment',[ $id ]) }}">
<span class=""><i class="fa fa-comment-o"></i> コメント</span>
</a>
</div>
<div class="action">
<a href="{{ route('user.attend',[ $id ]) }}">
<span class=""><i class="fa fa-thumbs-o-up"></i> フォロー中</span>
</a>
</div>
<div class="action">
<a href="{{ route('user.like',[ $id ]) }}">
<span class=""><i class="fa fa-heart-o"></i> いいね!</span>
</a>
</div>
<div class="action">
<a href="{{ route('user.stores',[ $id ]) }}">
<span class=""><i class="fa fa-bookmark-o"></i> ブックマーク</span>
</a>
</div>
</div>
</div>
@if (Auth::guard('home')->check())
<input type="hidden" name="visitor_id" id="visitor_id" value="{{ Auth::guard('home')->user()->id }}">
@else
<input type="hidden" name="visitor_id" id="visitor_id" value="visitor">
@endif
</div>
<div class="user-page">
<div id="myScrollspy" class="scroll_spy">
<ul id="affix_ui" class="nav nav-tabs nav-stacked" data-spy="affix" data-offset-top="750" style="border: 0 solid #000;">
{{--<li>--}}
{{--<a id="guide_index" href="javascript:void(0);">目次</a>--}}
{{--</li>--}}
{{--<li class="active">--}}
{{--<a href="#section-1">第一部分 </a>--}}
{{--</li>--}}
{{--<li>--}}
{{--<a href="#section-2">第二部分</a>--}}
{{--</li>--}}
{{--<li>--}}
{{--<a href="#section-3">第三部分</a>--}}
{{--</li>--}}
{{--<li>--}}
{{--<a href="#section-4">第四部分</a>--}}
{{--</li>--}}
{{--<li>--}}
{{--<a href="#section-4">第五部分</a>--}}
{{--</li>--}}
</ul>
</div>
</div>
</div><!-- left-content -->
<div class="right-content col-md-9">
@yield('content')
@yield('commentList')
@yield('comment')
</div><!-- right-content -->
<a style="display:none" href="javascript:void(0);" id="backToTop" title="トップへ"></a>
{{--<div id="backToTop"><a href="#user-header">トップへ</a></div>--}}
</div><!-- row -->
</div><!-- container -->
</section>
@endsection
@section('script')
@yield('script')
@yield('shareScript')
@yield('commentScript')
@yield('likeScript')
@yield('storeScript')
@endsection
@section('userScript')
<script>
// 关注功能
$("#attend").click(function () {
if("{{ !Auth::guard('home')->user()}}") {
swal({
title: "ようこそゲストさん",
text: "アカウントを持っていますか?",
buttons: {
cancel: "キャンセル",
register: "新規登録",
login: "ログイン",
}
})
.then((wilDo) => {
switch (wilDo) {
case "cancel":
break;
case "login":
window.location.href = "{{ url('/login') }}";
break;
case "register":
window.location.href = "{{ url('/register') }}";
break;
}
});
return;
}
$.ajax({
headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
type: "post",
url: "{{ url('/clickToAttend') }}",
data: {'user_id': $("#visitor_id").val(),
'attend_user_id': '{{ $user->id }}',
'created_at': '{{ date('Y-m-d H:i:s') }}',
},
success: function (response) {
if (response.data.status == true) {
if(response.data.judge == 'down'){
$(".Follow").text('フォローする');
$(".Follow").css("background-color", "rgba(246, 119, 119, 0.9)");
$(".Follow").addClass("notFollow");
$(".Follow").removeClass("Follow");
}else{
$(".notFollow").text('フォロー中');
$(".notFollow").css("background-color", "rgba(246, 119, 119, 0.6)");
$(".notFollow").addClass("Follow");
$(".notFollow").removeClass("notFollow");
}
$("#attend").show();
}else {
swal("提示", response.msg, "error");
}
},
error: function () {
swal("提示", "发生未知错误", "error");
},
});
});
</script>
@endsection
| 42.075812
| 152
| 0.307765
|
b09ecf6018583cf96648951174d943dc2d165d3b
| 676
|
py
|
Python
|
force_gromacs/notification_listeners/hpc_writer/hpc_writer_model.py
|
force-h2020/force-bdss-plugin-gromacs
|
1518185e4cdab824d57570bc5df6c719f1f11bea
|
[
"MIT"
] | null | null | null |
force_gromacs/notification_listeners/hpc_writer/hpc_writer_model.py
|
force-h2020/force-bdss-plugin-gromacs
|
1518185e4cdab824d57570bc5df6c719f1f11bea
|
[
"MIT"
] | 28
|
2019-09-05T09:05:52.000Z
|
2020-11-11T13:32:46.000Z
|
force_gromacs/notification_listeners/hpc_writer/hpc_writer_model.py
|
force-h2020/force-bdss-plugin-gromacs
|
1518185e4cdab824d57570bc5df6c719f1f11bea
|
[
"MIT"
] | 1
|
2020-01-15T20:53:17.000Z
|
2020-01-15T20:53:17.000Z
|
# (C) Copyright 2010-2020 Enthought, Inc., Austin, TX
# All rights reserved.
from traits.api import Unicode, Bool, Code
from force_bdss.api import BaseNotificationListenerModel
class HPCWriterModel(BaseNotificationListenerModel):
#: Header to include in all HPC submission scripts
header = Code(desc="Header to include in all HPC submission scripts")
#: Prefix to include at beginning of all HPC submission files
prefix = Unicode(
"hpc_sub_script",
desc="Prefix to include at beginning of all HPC submission files")
#: Whether or not to perform a dry run - i.e, generate but do not
#: write bash files
dry_run = Bool(True)
| 30.727273
| 74
| 0.720414
|
e2f29f6c1091b4f5c1f3e2b8564d06c9c1301394
| 20
|
py
|
Python
|
checkov/version.py
|
athurn/checkov
|
de59dcc91c1f2224facec01c68e150c7da813491
|
[
"Apache-2.0"
] | null | null | null |
checkov/version.py
|
athurn/checkov
|
de59dcc91c1f2224facec01c68e150c7da813491
|
[
"Apache-2.0"
] | null | null | null |
checkov/version.py
|
athurn/checkov
|
de59dcc91c1f2224facec01c68e150c7da813491
|
[
"Apache-2.0"
] | null | null | null |
version = '1.0.801'
| 10
| 19
| 0.6
|
1847d56df73614114d429fdcb4bb58894719af1e
| 325
|
ts
|
TypeScript
|
src/map.ts
|
linwens/xutils-ts-demo
|
17c46c2f572123d37eedb2f236a4cb69dbd53b15
|
[
"MIT"
] | null | null | null |
src/map.ts
|
linwens/xutils-ts-demo
|
17c46c2f572123d37eedb2f236a4cb69dbd53b15
|
[
"MIT"
] | 2
|
2020-09-07T03:02:11.000Z
|
2021-05-08T04:33:23.000Z
|
src/map.ts
|
linwens/xutils-ts-demo
|
17c46c2f572123d37eedb2f236a4cb69dbd53b15
|
[
"MIT"
] | null | null | null |
type Func = (...arg: any) => any
function map(array: any[], iteratee: Func) {
let index = -1
const length = array == null ? 0 : array.length
const result = new Array(length)
while (++index < length) {
result[index] = iteratee(array[index], index, array)
}
return result
}
export default map
| 23.214286
| 60
| 0.606154
|
da2cd6874e7a990f708ccd4d8a77743dd8901052
| 3,757
|
php
|
PHP
|
resources/views/home/view-edit-form.blade.php
|
maxca/book-can-says
|
603acebe335fcf08ad8b69a851c12d8fda9baef9
|
[
"MIT"
] | null | null | null |
resources/views/home/view-edit-form.blade.php
|
maxca/book-can-says
|
603acebe335fcf08ad8b69a851c12d8fda9baef9
|
[
"MIT"
] | 4
|
2021-03-09T16:22:37.000Z
|
2022-02-26T17:15:05.000Z
|
resources/views/home/view-edit-form.blade.php
|
maxca/book-can-says
|
603acebe335fcf08ad8b69a851c12d8fda9baef9
|
[
"MIT"
] | null | null | null |
@extends('template.body')
@section('contents')
<div class="container">
<form action="{{url('/edit-book')}}" method="post" enctype="multipart/form-data">
{{csrf_field()}}
<input name="id" type="hidden" value="{{$data->id}}"/>
@php
$authorName = implode(",", $data->authors->pluck('name')->toArray());
$publishName = implode(",", $data->publisher->pluck('name')->toArray());
@endphp
<div class="form-group">
<label for="exampleInputEmail1">ชื่อหนังสือ</label>
<input type="text" name="name" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp"
value="{{$data->name}}">
</div>
<div class="form-group">
<label for="exampleInputPassword1">สำนักพิมพ์</label>
<input name="publisher_name" type="text" class="form-control" id="exampleInputPassword1"
value="{{$publishName}}">
</div>
<div class="form-group">
<label for="exampleInputPassword1">ผู้แต่ง</label>
<input name="author_name" type="text" class="form-control" id="exampleInputPassword1"
value="{{$authorName}}">
</div>
<div class="form-group">
<label for="exampleFormControlSelect2">หมวดหมู่หนังสือ</label>
<select name="category" class="form-control" id="exampleFormControlSelect2"
value="{{old('category')}}">
@foreach ($bookcat_array as $data)
<option value="{{ $data->id }}" >{{ $data->name }}</option>
@endforeach
</select>
</div>
{{--<div class="form-group">--}}
{{--<label for="exampleInputPassword1">Total page</label>--}}
{{--<input name="total_page" type="number" class="form-control" placeholder="total page" value="{{$data->total_page}}">--}}
{{--{{dd($data->total_page)}}--}}
{{--</div>--}}
{{--<div class="form-group">--}}
{{--<label for="exampleInputPassword1">Total chapter</label>--}}
{{--<input name="total_page" type="number" class="form-control" placeholder="total chapter"--}}
{{--value="{{$data->total_chapter}}">--}}
{{--{{dd($data->total_chapter)}}--}}
{{--</div>--}}
{{-- <div class="form-group">--}}
{{-- <label for="exampleInputPassword1">เรื่องย่อหนังสือ</label>--}}
{{-- <textarea name="description" class="form-control" id="exampleFormControlTextarea1"--}}
{{-- rows="3">{{$data->description}}</textarea>--}}
{{-- </div>--}}
{{--{{dd($data->description)}}--}}
<div class="form-check">
<input name="status" class="form-check-input" type="hidden" id="exampleRadios1" value="active" checked>
{{--<label class="form-check-label" for="exampleRadios1">--}}
{{--Active--}}
{{--</label>--}}
</div>
<div class="form-check">
<input name="status" class="form-check-input" type="hidden" id="exampleRadios2" value="inactive">
{{--<label class="form-check-label" for="exampleRadios2">--}}
{{--Inactive--}}
{{--</label>--}}
</div>
<button type="submit" class="btn btn-dark">แก้ไขข้อมูลหนังสือ</button>
</form>
</div>
@endsection
<style>
.container{
margin-top: 30px;
}
</style>
| 40.397849
| 139
| 0.483897
|
7f762b0ac3a1d3f993ee49fcfbe1b48ddbedea38
| 1,880
|
php
|
PHP
|
app/Http/Controllers/PostsController.php
|
SunnyAforka/sfghb_admin
|
28418c2744b810ab6c4ecf79cc26f5d2a6e5cf8f
|
[
"MIT"
] | null | null | null |
app/Http/Controllers/PostsController.php
|
SunnyAforka/sfghb_admin
|
28418c2744b810ab6c4ecf79cc26f5d2a6e5cf8f
|
[
"MIT"
] | null | null | null |
app/Http/Controllers/PostsController.php
|
SunnyAforka/sfghb_admin
|
28418c2744b810ab6c4ecf79cc26f5d2a6e5cf8f
|
[
"MIT"
] | null | null | null |
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Post;
use App\Models\Comment;
use App\Models\Notification;
use App\Models\Livelink;
class PostsController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
public function index()
{
//Upcoming event Notification
$notification = Notification::all()->last();
//Live streaming key
$live = Livelink::all()->last();
// add date format to value and hide during devotional upload
$today = date('Y-m-d');
$todayPost = Post::where('publishdate', $today)->get();
$dateNow = date('Y-m-d');
$posts = Post::orderBy('publishdate', 'DESC')->where('published', true)->where('publishdate', '<', $dateNow)->get();
return view('posts.index', compact('posts', 'todayPost', 'notification', 'live'));
}
public function show($post)
{
$post = Post::find($post);
//Get comment count
$comment_count = $post->comments->count();
//Comment fetch
$comments = $post->comments()->paginate(10);
//Increment number of views
$count = $post->view_count + 1;
$post->update([
'view_count' => $count,
]);
return view('posts.show', compact('post', 'comment_count', 'comments'));
}
public function search(Request $request) {
$search = $request->get('search');
$posts = Post::where('title', 'like', '%' .$search. '%')
->orWhere('memoryverse', 'like', '%' .$search. '%')
->orWhere('story', 'like', '%' .$search. '%')
->orWhere('publishdate', 'like', '%' .$search. '%')
->paginate(10);
return view('search', compact('posts', 'search'));
}
}
| 31.333333
| 124
| 0.540957
|
bf23df329a885737c6f24a2a8838ba2d54bc5e3f
| 312
|
sql
|
SQL
|
SQL_Scripts/merchant_category.sql
|
amejiali/sql-homework
|
7bb3421521e4a38c86b83b175a722e37e8426382
|
[
"PostgreSQL",
"CC-BY-2.0"
] | null | null | null |
SQL_Scripts/merchant_category.sql
|
amejiali/sql-homework
|
7bb3421521e4a38c86b83b175a722e37e8426382
|
[
"PostgreSQL",
"CC-BY-2.0"
] | null | null | null |
SQL_Scripts/merchant_category.sql
|
amejiali/sql-homework
|
7bb3421521e4a38c86b83b175a722e37e8426382
|
[
"PostgreSQL",
"CC-BY-2.0"
] | null | null | null |
INSERT INTO merchant_category(id,name) VALUES (1,'restaurant');
INSERT INTO merchant_category(id,name) VALUES (2,'coffee shop');
INSERT INTO merchant_category(id,name) VALUES (3,'bar');
INSERT INTO merchant_category(id,name) VALUES (4,'pub');
INSERT INTO merchant_category(id,name) VALUES (5,'food truck');
| 52
| 65
| 0.753205
|
bdbd3a705d35be6d4698a9b0acf81a84856ec1f5
| 672
|
rb
|
Ruby
|
algorithms/minimum_path_sum.rb
|
rawcliffeisaac/leetcode-1
|
c609c4109080cda8f577848319138ff60fd36c6e
|
[
"MIT"
] | 17
|
2018-07-07T04:11:58.000Z
|
2021-02-05T07:23:33.000Z
|
algorithms/minimum_path_sum.rb
|
rawcliffeisaac/leetcode-1
|
c609c4109080cda8f577848319138ff60fd36c6e
|
[
"MIT"
] | null | null | null |
algorithms/minimum_path_sum.rb
|
rawcliffeisaac/leetcode-1
|
c609c4109080cda8f577848319138ff60fd36c6e
|
[
"MIT"
] | 5
|
2019-03-19T03:44:57.000Z
|
2020-10-30T18:55:42.000Z
|
# https://leetcode.com/problems/minimum-path-sum/
#
# Given a m x n grid filled with non-negative numbers, find a path from top
# left to bottom right which minimizes the sum of all numbers along its path.
#
# Note: You can only move either down or right at any point in time.
# @param {Integer[][]} grid
# @return {Integer}
def min_path_sum(grid)
grid = Marshal.load(Marshal.dump(grid))
m, n = grid.size, grid[0].size
1.upto(m - 1) { |i| grid[i][0] += grid[i - 1][0] }
1.upto(n - 1) { |j| grid[0][j] += grid[0][j - 1] }
1.upto(m - 1) do |i|
1.upto(n - 1) do |j|
grid[i][j] += [grid[i - 1][j], grid[i][j - 1]].min
end
end
grid[-1][-1]
end
| 25.846154
| 77
| 0.60119
|
8489245d9f1d8af5c368528da49be57f032ea765
| 1,364
|
dart
|
Dart
|
.pub/deps/debug/angular2/lib/src/router/rules/rules.template.dart
|
smirina/backpack
|
7d7d1aaafe052c40db46efca8c95a3efd22dae47
|
[
"BSD-3-Clause"
] | null | null | null |
.pub/deps/debug/angular2/lib/src/router/rules/rules.template.dart
|
smirina/backpack
|
7d7d1aaafe052c40db46efca8c95a3efd22dae47
|
[
"BSD-3-Clause"
] | null | null | null |
.pub/deps/debug/angular2/lib/src/router/rules/rules.template.dart
|
smirina/backpack
|
7d7d1aaafe052c40db46efca8c95a3efd22dae47
|
[
"BSD-3-Clause"
] | null | null | null |
// @ignoreProblemForFile annotate_overrides
// @ignoreProblemForFile cancel_subscriptions
// @ignoreProblemForFile constant_identifier_names
// @ignoreProblemForFile non_constant_identifier_names
// @ignoreProblemForFile implementation_imports
// @ignoreProblemForFile library_prefixes
// @ignoreProblemForFile type_annotate_public_apis
// @ignoreProblemForFile STRONG_MODE_DOWN_CAST_COMPOSITE
// @ignoreProblemForFile UNUSED_IMPORT
// @ignoreProblemForFile UNUSED_SHOWN_NAME
// @ignoreProblemForFile UNUSED_LOCAL_VARIABLE
import 'rules.dart';
import 'dart:async';
import 'package:angular2/src/facade/exceptions.dart' show BaseException;
import '../instruction.dart' show ComponentInstruction;
import '../url_parser.dart' show Url, convertUrlParamsToArray;
import 'route_handlers/route_handler.dart' show RouteHandler;
import 'route_paths/route_path.dart' show GeneratedUrl, RoutePath;
import 'package:angular2/src/facade/exceptions.template.dart' as i0;
import '../instruction.template.dart' as i1;
import '../url_parser.template.dart' as i2;
import 'route_handlers/route_handler.template.dart' as i3;
import 'route_paths/route_path.template.dart' as i4;
export 'rules.dart';
var _visited = false;
void initReflector() {
if (_visited) return; _visited = true;
i0.initReflector();
i1.initReflector();
i2.initReflector();
i3.initReflector();
i4.initReflector();
}
| 38.971429
| 72
| 0.818182
|
dd53e53bd8320315acd49deae561067c3c6f105d
| 345
|
java
|
Java
|
src/java/io/compgen/cgpipe/parser/variable/VarBool.java
|
compgen-io/cgpipe
|
3e7097d165496a625e76048993850104587eb56a
|
[
"BSD-3-Clause"
] | null | null | null |
src/java/io/compgen/cgpipe/parser/variable/VarBool.java
|
compgen-io/cgpipe
|
3e7097d165496a625e76048993850104587eb56a
|
[
"BSD-3-Clause"
] | null | null | null |
src/java/io/compgen/cgpipe/parser/variable/VarBool.java
|
compgen-io/cgpipe
|
3e7097d165496a625e76048993850104587eb56a
|
[
"BSD-3-Clause"
] | null | null | null |
package io.compgen.cgpipe.parser.variable;
public class VarBool extends VarValue {
public static final VarBool TRUE = new VarBool(true);
public static final VarBool FALSE = new VarBool(false);
private VarBool(boolean val) {
super(val);
}
public boolean toBoolean() {
if ((Boolean) obj) {
return true;
}
return false;
}
}
| 18.157895
| 56
| 0.701449
|
f9352d67fc711ca66175c81be417adf0a0517eea
| 1,757
|
dart
|
Dart
|
test/dart2_suggestors/ui_factory_initializer_test.dart
|
matthewsullivan-wf/over_react_codemod
|
ae61c1ecf80f66e460a785c0fd2de4d788b698ce
|
[
"Apache-2.0"
] | null | null | null |
test/dart2_suggestors/ui_factory_initializer_test.dart
|
matthewsullivan-wf/over_react_codemod
|
ae61c1ecf80f66e460a785c0fd2de4d788b698ce
|
[
"Apache-2.0"
] | 1
|
2019-02-04T15:37:20.000Z
|
2019-02-04T15:37:28.000Z
|
test/dart2_suggestors/ui_factory_initializer_test.dart
|
matthewsullivan-wf/over_react_codemod
|
ae61c1ecf80f66e460a785c0fd2de4d788b698ce
|
[
"Apache-2.0"
] | null | null | null |
// Copyright 2019 Workiva Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
@TestOn('vm')
import 'package:test/test.dart';
import 'package:over_react_codemod/src/dart2_suggestors/ui_factory_initializer.dart';
void main() {
group('UiFactoryInitializer', () {
group('shouldSkip()', () {
test('returns false when @Factory() annotation found', () {
final sourceFileContents = '''library foo;
import 'package:over_react/over_react.dart';
@Factory()
UiFactory<FooProps> Foo;
class FooProps {}''';
expect(UiFactoryInitializer().shouldSkip(sourceFileContents), isFalse);
});
test('returns true when no @Factory() annotation found', () {
final sourceFileContents = '''library foo;
import 'package:over_react/over_react.dart';
UiFactory<FooProps> Foo;
class FooProps {}''';
expect(UiFactoryInitializer().shouldSkip(sourceFileContents), isTrue);
});
test('returns true when @Factory() annotation is commented out', () {
final sourceFileContents = '''library foo;
import 'package:over_react/over_react.dart';
// @Factory()
UiFactory<FooProps> Foo;
class FooProps {}''';
expect(UiFactoryInitializer().shouldSkip(sourceFileContents), isTrue);
});
});
});
}
| 34.45098
| 85
| 0.702903
|
e8085320c5a1c0b7677db11432fe9e12422d5b1a
| 343
|
lua
|
Lua
|
lua/scripts/test1_blink.lua
|
yingnierxiao/rpi-gpio
|
fb25e820f8f8c6eb2fccc26998e76505f0d58c85
|
[
"MIT"
] | 54
|
2015-01-14T09:54:23.000Z
|
2022-03-25T13:00:05.000Z
|
lua/scripts/test1_blink.lua
|
yingnierxiao/rpi-gpio
|
fb25e820f8f8c6eb2fccc26998e76505f0d58c85
|
[
"MIT"
] | 1
|
2018-01-05T14:04:42.000Z
|
2018-01-06T20:30:31.000Z
|
lua/scripts/test1_blink.lua
|
yingnierxiao/rpi-gpio
|
fb25e820f8f8c6eb2fccc26998e76505f0d58c85
|
[
"MIT"
] | 13
|
2015-04-19T00:12:00.000Z
|
2021-10-05T14:24:09.000Z
|
-- Blinks led on P0 / pin11
-- Exits after 10 blinks
local gpio = require("GPIO")
local sleep = function(seconds)
os.execute("sleep "..tostring(seconds).."s")
end
gpio.setmode(gpio.BOARD)
gpio.setup(11, gpio.OUT)
for i = 1,10 do
gpio.output(11, gpio.HIGH)
sleep(0.3)
gpio.output(11, gpio.LOW)
sleep(0.3)
end
gpio.cleanup()
| 15.590909
| 46
| 0.664723
|
24bb77c095685fe480c76063b0bc13a3cf782210
| 1,269
|
php
|
PHP
|
application/index/controller/Ajax.php
|
SiqiLIU7/website-Thinkphp
|
55f15f5c3289386e056ed84076994072c563077a
|
[
"Apache-2.0"
] | null | null | null |
application/index/controller/Ajax.php
|
SiqiLIU7/website-Thinkphp
|
55f15f5c3289386e056ed84076994072c563077a
|
[
"Apache-2.0"
] | null | null | null |
application/index/controller/Ajax.php
|
SiqiLIU7/website-Thinkphp
|
55f15f5c3289386e056ed84076994072c563077a
|
[
"Apache-2.0"
] | null | null | null |
<?php
namespace app\index\controller;
use think\Controller;
use think\Request;
class Ajax extends Controller
{
public function index(Request $request)
{
if($request->isAjax()) {
$myfile = fopen("/home/siqiliu/log1.txt", "r") or die("Unable to open file!" . $myfile);
$res = "";
while ($line = fgets($myfile)) {
$res = $res . $line . '</br>';
}
//$res = fread($myfile,filesize("/home/siqiliu/log.txt"));
fclose($myfile);
return json($res);
}
}
public function read1(Request $request)
{
if($request->isAjax()) {
$myfile = fopen("/home/siqiliu/log1.txt", "r") or die("Unable to open file!" . $myfile);
$res = "";
while ($line = fgets($myfile)) {
$res = $res . $line . '</br>';
}
//$res = fread($myfile,filesize("/home/siqiliu/log.txt"));
fclose($myfile);
return json($res);
}
}
public function read2(Request $request)
{
if($request->isAjax()) {
$myfile = fopen("/home/siqiliu/log2.txt", "r") or die("Unable to open file!" . $myfile);
$res = "";
while ($line = fgets($myfile)) {
$res = $res . $line . '</br>';
}
//$res = fread($myfile,filesize("/home/siqiliu/log.txt"));
fclose($myfile);
return json($res);
}
}
}
| 24.882353
| 93
| 0.552403
|
d7f914dde630e7fd233a1c20bb43a675b391a7e7
| 940
|
rb
|
Ruby
|
lib/ticket_alert/notifier_listener.rb
|
carrascoacd/ticket_alert
|
4b3ba4a3717fb8a55707239a8f81954b17eaf25b
|
[
"MIT"
] | null | null | null |
lib/ticket_alert/notifier_listener.rb
|
carrascoacd/ticket_alert
|
4b3ba4a3717fb8a55707239a8f81954b17eaf25b
|
[
"MIT"
] | null | null | null |
lib/ticket_alert/notifier_listener.rb
|
carrascoacd/ticket_alert
|
4b3ba4a3717fb8a55707239a8f81954b17eaf25b
|
[
"MIT"
] | null | null | null |
require 'ticket_alert/notifier'
module TicketAlert
class NotifierListener
def initialize(notifier=nil)
@notifier = notifier || Notifier.new
end
def on_new_messages(message_list)
message_list.each do |message|
if message.error.nil?
@notifier.notify "Mensaje recibido!", "He recibido la orden para #{message.origin}-#{message.destination} el #{message.date} #{message.hour}"
else
@notifier.notify "No entiendo tu idioma :)", "Vaaya lo siento :P no entiendo el origen, destino o fecha que me indicas esto es lo que me has enviado:\n #{message.text}\n. Recuerda no responder a este mensaje.\n Te paso un ejemplo: valencia madrid 10/12/2017"
end
end
end
def on_ticket_found(message)
@notifier.notify "¡¡Ya están aquí!!", "Ya están aquí los billetes para #{message.origin}-#{message.destination} el #{message.date} #{message.hour}"
end
end
end
| 36.153846
| 268
| 0.684043
|
12ddcf096898f6248782d2940bc4d08c86df9294
| 887
|
cs
|
C#
|
Trainor.Storage/Entities/ResourceDto.cs
|
TessaJune/ByteMe
|
a04929f4db4b554b490700e1c612d89e81d2295c
|
[
"MIT"
] | null | null | null |
Trainor.Storage/Entities/ResourceDto.cs
|
TessaJune/ByteMe
|
a04929f4db4b554b490700e1c612d89e81d2295c
|
[
"MIT"
] | null | null | null |
Trainor.Storage/Entities/ResourceDto.cs
|
TessaJune/ByteMe
|
a04929f4db4b554b490700e1c612d89e81d2295c
|
[
"MIT"
] | null | null | null |
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Trainor.Storage.Entities
{
public record ResourceDto(int Id, string? Name, string Link, IEnumerable<AuthorDto>? Authors, SubjectTag? Subject, TypeTag? Type, DateTime? Date) { }
public record ResourceCreateDto
{
[StringLength(50)]
public string? Name { get; init; }
[Required]
[Url]
public string Link
{
get => Link;
init => Link = Link ?? throw new NullReferenceException();
}
public IEnumerable<AuthorDto>? Authors { get; init; }
public SubjectTag? Subject { get; init; }
public TypeTag? Type { get; set; }
public DateTime? Date { get; init; }
}
public record ResourceUpdateDto : ResourceCreateDto
{
public int Id { get; init; }
}
}
| 29.566667
| 153
| 0.620068
|
384a8ea4d48cedf731fad873c088b25af0652246
| 945
|
php
|
PHP
|
resources/views/auth/login_select.blade.php
|
ArtiomKolesnikov/new_auth_fbvz
|
1622b61b0b94cec33404143e4dc269e12e9443b9
|
[
"MIT"
] | null | null | null |
resources/views/auth/login_select.blade.php
|
ArtiomKolesnikov/new_auth_fbvz
|
1622b61b0b94cec33404143e4dc269e12e9443b9
|
[
"MIT"
] | null | null | null |
resources/views/auth/login_select.blade.php
|
ArtiomKolesnikov/new_auth_fbvz
|
1622b61b0b94cec33404143e4dc269e12e9443b9
|
[
"MIT"
] | null | null | null |
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Login Select</div>
<ul class="nav nav-tabs nav-justified">
<li class="active"><a data-toggle="tab" href="#panel1">Phone</a></li>
<li><a data-toggle="tab" href="#panel2">E-mail</a></li>
</ul>
<div class="tab-content">
<div id="panel1" class="tab-pane fade in active">
@include('auth.login_tab',['type'=>'phone'])
</div>
<div id="panel2" class="tab-pane fade">
@include('auth.login_tab',['type'=>'email'])
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
| 31.5
| 89
| 0.447619
|
07ff6fb94889c58503a881861c64f31d3a18f805
| 6,854
|
rb
|
Ruby
|
app/helpers/blob_helper.rb
|
issenzhang/gitlab
|
16b9ecb5810abc6221a0187c76c0e859a9ff7db3
|
[
"MIT"
] | 3
|
2019-01-26T01:09:20.000Z
|
2019-09-24T13:03:44.000Z
|
app/helpers/blob_helper.rb
|
issenzhang/gitlab
|
16b9ecb5810abc6221a0187c76c0e859a9ff7db3
|
[
"MIT"
] | null | null | null |
app/helpers/blob_helper.rb
|
issenzhang/gitlab
|
16b9ecb5810abc6221a0187c76c0e859a9ff7db3
|
[
"MIT"
] | 3
|
2019-09-24T12:57:45.000Z
|
2022-03-07T17:45:53.000Z
|
module BlobHelper
def highlight(blob_name, blob_content, repository: nil, plain: false)
highlighted = Gitlab::Highlight.highlight(blob_name, blob_content, plain: plain, repository: repository)
raw %(<pre class="code highlight"><code>#{highlighted}</code></pre>)
end
def no_highlight_files
%w(credits changelog news copying copyright license authors)
end
def edit_blob_link(project = @project, ref = @ref, path = @path, options = {})
return unless current_user
blob = options.delete(:blob)
blob ||= project.repository.blob_at(ref, path) rescue nil
return unless blob
edit_path = namespace_project_edit_blob_path(project.namespace, project,
tree_join(ref, path),
options[:link_opts])
if !on_top_of_branch?(project, ref)
button_tag "Edit", class: "btn disabled has-tooltip btn-file-option", title: "You can only edit files when you are on a branch", data: { container: 'body' }
elsif can_edit_blob?(blob, project, ref)
link_to "Edit", edit_path, class: 'btn btn-sm'
elsif can?(current_user, :fork_project, project)
continue_params = {
to: edit_path,
notice: edit_in_new_fork_notice,
notice_now: edit_in_new_fork_notice_now
}
fork_path = namespace_project_forks_path(project.namespace, project, namespace_key: current_user.namespace.id, continue: continue_params)
link_to "Edit", fork_path, class: 'btn btn-file-option', method: :post
end
end
def modify_file_link(project = @project, ref = @ref, path = @path, label:, action:, btn_class:, modal_type:)
return unless current_user
blob = project.repository.blob_at(ref, path) rescue nil
return unless blob
if !on_top_of_branch?(project, ref)
button_tag label, class: "btn btn-#{btn_class} disabled has-tooltip", title: "You can only #{action} files when you are on a branch", data: { container: 'body' }
elsif blob.lfs_pointer?
button_tag label, class: "btn btn-#{btn_class} disabled has-tooltip", title: "It is not possible to #{action} files that are stored in LFS using the web interface", data: { container: 'body' }
elsif can_edit_blob?(blob, project, ref)
button_tag label, class: "btn btn-#{btn_class}", 'data-target' => "#modal-#{modal_type}-blob", 'data-toggle' => 'modal'
elsif can?(current_user, :fork_project, project)
continue_params = {
to: request.fullpath,
notice: edit_in_new_fork_notice + " Try to #{action} this file again.",
notice_now: edit_in_new_fork_notice_now
}
fork_path = namespace_project_forks_path(project.namespace, project, namespace_key: current_user.namespace.id, continue: continue_params)
link_to label, fork_path, class: "btn btn-#{btn_class}", method: :post
end
end
def replace_blob_link(project = @project, ref = @ref, path = @path)
modify_file_link(
project,
ref,
path,
label: "Replace",
action: "replace",
btn_class: "default",
modal_type: "upload"
)
end
def delete_blob_link(project = @project, ref = @ref, path = @path)
modify_file_link(
project,
ref,
path,
label: "Delete",
action: "delete",
btn_class: "remove",
modal_type: "remove"
)
end
def can_edit_blob?(blob, project = @project, ref = @ref)
!blob.lfs_pointer? && can_edit_tree?(project, ref)
end
def leave_edit_message
"Leave edit mode?\nAll unsaved changes will be lost."
end
def editing_preview_title(filename)
if Gitlab::MarkupHelper.previewable?(filename)
'Preview'
else
'Preview Changes'
end
end
# Return an image icon depending on the file mode and extension
#
# mode - File unix mode
# mode - File name
def blob_icon(mode, name)
icon("#{file_type_icon_class('file', mode, name)} fw")
end
def blob_text_viewable?(blob)
blob && blob.text? && !blob.lfs_pointer? && !blob.only_display_raw?
end
def blob_size(blob)
if blob.lfs_pointer?
blob.lfs_size
else
blob.size
end
end
# SVGs can contain malicious JavaScript; only include whitelisted
# elements and attributes. Note that this whitelist is by no means complete
# and may omit some elements.
def sanitize_svg(blob)
blob.data = Gitlab::Sanitizers::SVG.clean(blob.data)
blob
end
# If we blindly set the 'real' content type when serving a Git blob we
# are enabling XSS attacks. An attacker could upload e.g. a Javascript
# file to a Git repository, trick the browser of a victim into
# downloading the blob, and then the 'application/javascript' content
# type would tell the browser to execute the attacker's Javascript. By
# overriding the content type and setting it to 'text/plain' (in the
# example of Javascript) we tell the browser of the victim not to
# execute untrusted data.
def safe_content_type(blob)
if blob.text?
'text/plain; charset=utf-8'
elsif blob.image?
blob.content_type
else
'application/octet-stream'
end
end
def cached_blob?
stale = stale?(etag: @blob.id) # The #stale? method sets cache headers.
# Because we are opionated we set the cache headers ourselves.
response.cache_control[:public] = @project.public?
if @ref && @commit && @ref == @commit.id
# This is a link to a commit by its commit SHA. That means that the blob
# is immutable. The only reason to invalidate the cache is if the commit
# was deleted or if the user lost access to the repository.
response.cache_control[:max_age] = Blob::CACHE_TIME_IMMUTABLE
else
# A branch or tag points at this blob. That means that the expected blob
# value may change over time.
response.cache_control[:max_age] = Blob::CACHE_TIME
end
response.etag = @blob.id
!stale
end
def licenses_for_select
return @licenses_for_select if defined?(@licenses_for_select)
licenses = Licensee::License.all
@licenses_for_select = {
Popular: licenses.select(&:featured).map { |license| { name: license.name, id: license.key } },
Other: licenses.reject(&:featured).map { |license| { name: license.name, id: license.key } }
}
end
def ref_project
@ref_project ||= @target_project || @project
end
def gitignore_names
@gitignore_names ||= Gitlab::Template::GitignoreTemplate.dropdown_names
end
def gitlab_ci_ymls
@gitlab_ci_ymls ||= Gitlab::Template::GitlabCiYmlTemplate.dropdown_names
end
def blob_editor_paths
{
'relative-url-root' => Rails.application.config.relative_url_root,
'assets-prefix' => Gitlab::Application.config.assets.prefix,
'blob-language' => @blob && @blob.language.try(:ace_mode)
}
end
end
| 33.930693
| 198
| 0.676685
|
14967867073f3b1640577b160a2776475d80bd2e
| 326
|
ts
|
TypeScript
|
client/src/components/common/buttons/index.ts
|
sonhoangci/twilio-voice-notification-app
|
3cf360c31e9b89b94c0909531172aa9dff8d5e06
|
[
"Apache-2.0"
] | 20
|
2020-06-26T17:54:24.000Z
|
2021-12-30T12:24:38.000Z
|
client/src/components/common/buttons/index.ts
|
craigsdennis/twilio-voice-notification-app
|
7de6e41289b58905843cf71d4cf43ac6faf779e7
|
[
"Apache-2.0"
] | 28
|
2020-06-29T08:35:05.000Z
|
2021-05-10T03:14:47.000Z
|
client/src/components/common/buttons/index.ts
|
craigsdennis/twilio-voice-notification-app
|
7de6e41289b58905843cf71d4cf43ac6faf779e7
|
[
"Apache-2.0"
] | 21
|
2020-06-28T00:04:59.000Z
|
2022-01-04T18:53:53.000Z
|
import DiscardBroadcastButton from './DiscardBroadcastButton';
import NextButton from './NextButton';
import InitiateButton from './InitiateButton';
import HomeButton from './HomeButton';
import BackButton from './BackButton';
export {
BackButton,
DiscardBroadcastButton,
NextButton,
InitiateButton,
HomeButton,
};
| 23.285714
| 62
| 0.779141
|
9e0361e78102c37d9938d858b4dec574c716649f
| 1,632
|
cs
|
C#
|
src/Storage/DriverOperation.cs
|
robertogiachetta/aegis
|
767329c634ce27c87f8f17bd326ba92dd8b34fe9
|
[
"ECL-2.0"
] | 4
|
2017-03-04T03:30:48.000Z
|
2019-10-02T05:45:43.000Z
|
src/Storage/DriverOperation.cs
|
robertogiachetta/aegis
|
767329c634ce27c87f8f17bd326ba92dd8b34fe9
|
[
"ECL-2.0"
] | 14
|
2017-02-11T16:58:51.000Z
|
2021-03-13T21:06:06.000Z
|
src/Storage/DriverOperation.cs
|
robertogiachetta/aegis
|
767329c634ce27c87f8f17bd326ba92dd8b34fe9
|
[
"ECL-2.0"
] | 3
|
2017-12-01T22:34:56.000Z
|
2018-06-02T09:59:47.000Z
|
// <copyright file="DriverOperation.cs" company="Eötvös Loránd University (ELTE)">
// Copyright 2016-2019 Roberto Giachetta. Licensed under the
// Educational Community License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may
// obtain a copy of the License at
// http://opensource.org/licenses/ECL-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an "AS IS"
// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing
// permissions and limitations under the License.
// </copyright>
namespace AEGIS.Storage
{
/// <summary>
/// Defines possible driver operations.
/// </summary>
public enum DriverOperation
{
/// <summary>
/// Indicates the creation of a new item.
/// </summary>
Create,
/// <summary>
/// Indicates reading of an item.
/// </summary>
Read,
/// <summary>
/// Indicates update of an item with the same storage space.
/// </summary>
Update,
/// <summary>
/// Indicates update of an item with the extension of storage space.
/// </summary>
UpdateExtend,
/// <summary>
/// Indicates update of an item with the reduction of storage space.
/// </summary>
UpdateReduce,
/// <summary>
/// Indicates removal of an item.
/// </summary>
Delete
}
}
| 30.792453
| 83
| 0.602328
|
ffb7bd6dabc74dd952f010e4fee663922bd4fc78
| 1,545
|
ps1
|
PowerShell
|
bConnect/internal/functions/Invoke-bConnectDelete.ps1
|
BaramundiAG/bConnect
|
7fc33791dd4724bf0d4b052da92dbdf87d5ea186
|
[
"MIT"
] | 4
|
2018-09-25T10:16:07.000Z
|
2021-05-28T15:31:27.000Z
|
bConnect/internal/functions/Invoke-bConnectDelete.ps1
|
FriedrichWeinmann/bConnect
|
7fc33791dd4724bf0d4b052da92dbdf87d5ea186
|
[
"MIT"
] | 6
|
2018-12-16T07:01:09.000Z
|
2019-12-17T14:59:15.000Z
|
bConnect/internal/functions/Invoke-bConnectDelete.ps1
|
FriedrichWeinmann/bConnect
|
7fc33791dd4724bf0d4b052da92dbdf87d5ea186
|
[
"MIT"
] | 2
|
2019-06-20T21:16:25.000Z
|
2019-12-19T20:45:53.000Z
|
function Invoke-bConnectDelete
{
<#
.SYNOPSIS
HTTP-DELETE against bConnect
.DESCRIPTION
HTTP-DELETE against bConnect
.PARAMETER Controller
A description of the Controller parameter.
.PARAMETER Data
Hashtable with parameters
.PARAMETER Version
bConnect version to use
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string]
$Controller,
[Parameter(Mandatory = $true)]
[PSCustomObject]
$Data,
[string]
$Version
)
if (!$script:_connectInitialized)
{
Write-Error "bConnect module is not initialized. Use 'Initialize-bConnect' first!"
return $false
}
if ([string]::IsNullOrEmpty($Version))
{
$Version = $script:_bConnectFallbackVersion
}
if ($verbose)
{
$ProgressPreference = "Continue"
}
else
{
$ProgressPreference = "SilentlyContinue"
}
try
{
$_params = @()
foreach ($_key in $Data.Keys)
{
$_params += "$($_key)=$($Data.Get_Item($_key))"
}
$_rest = Invoke-RestMethod -Uri "$($script:_connectUri)/$($Version)/$($Controller)?$($_params)" -Credential $script:_connectCredentials -Method Delete -ContentType "application/json"
if ($_rest)
{
return $_rest
}
else
{
return $true
}
}
catch
{
$_errMsg = ""
try
{
$_response = ConvertFrom-Json $_
}
catch
{
$_response = $false
}
if ($_response)
{
$_errMsg = $_response.Message
}
else
{
$_errMsg = $_
}
if ($_body)
{
$_errMsg = "$($_errMsg) `nHashtable: $($Data)"
}
Write-Error $_errMsg
return $false
}
}
| 14.714286
| 184
| 0.628479
|
7bd161d94216488999bf33ab627feddf42b5fb37
| 5,785
|
cpp
|
C++
|
KFPlugin/KFMongo/KFMongoReadExecute.cpp
|
282951387/KFrame
|
5d6e953f7cc312321c36632715259394ca67144c
|
[
"Apache-2.0"
] | 1
|
2021-04-26T09:31:32.000Z
|
2021-04-26T09:31:32.000Z
|
KFPlugin/KFMongo/KFMongoReadExecute.cpp
|
282951387/KFrame
|
5d6e953f7cc312321c36632715259394ca67144c
|
[
"Apache-2.0"
] | null | null | null |
KFPlugin/KFMongo/KFMongoReadExecute.cpp
|
282951387/KFrame
|
5d6e953f7cc312321c36632715259394ca67144c
|
[
"Apache-2.0"
] | null | null | null |
#include "KFMongoReadExecute.hpp"
namespace KFrame
{
KFResult< uint64 >::UniqueType KFMongoReadExecute::Count( const std::string& table )
{
Poco::MongoDB::Database db( _database );
auto request = db.createQueryRequest( "$cmd" );
request->setNumberToReturn( 1 );
request->selector().add( MongoKeyword::_count, table );
__NEW_RESULT__( uint64 );
ResponseMessage response;
auto ok = SendRequest( *request, response );
if ( ok && response.documents().size() > 0 )
{
Poco::MongoDB::Document::Ptr doc = response.documents()[ 0 ];
try
{
kfresult->_value = doc->getInteger( "n" );
}
catch ( Poco::Exception& )
{
__LOG_DEBUG__( "table=[{}] count failed", table );
}
}
else
{
kfresult->SetResult( KFEnum::Error );
}
return kfresult;
}
KFResult< uint64 >::UniqueType KFMongoReadExecute::Count( const std::string& table, const std::string& field, uint64 key )
{
auto fullname = __FORMAT__( "{}.{}", _database, table );
QueryRequest request( fullname, QueryRequest::QUERY_DEFAULT );
auto& selector = request.selector();
selector.add( field, key );
auto& fields = request.returnFieldSelector();
fields.add( MongoKeyword::_id, MongoKeyword::_asc );
__NEW_RESULT__( uint64 );
ResponseMessage response;
auto ok = SendRequest( request, response );
if ( ok )
{
kfresult->_value = response.documents().size();
}
else
{
kfresult->SetResult( KFEnum::Error );
}
return kfresult;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
KFResult< std::list< KFDBValue > >::UniqueType KFMongoReadExecute::QueryListRecord( const std::string& table, const KFMongoSelector& kfselector )
{
auto fullname = __FORMAT__( "{}.{}", _database, table );
QueryRequest request( fullname, QueryRequest::QUERY_DEFAULT );
// 查询条件
AddPocoDocument( request.selector(), kfselector );
// 返回的字段
if ( !kfselector._returns.empty() )
{
auto& fields = request.returnFieldSelector();
auto iter = kfselector._returns.find( MongoKeyword::_id );
if ( iter == kfselector._returns.end() )
{
fields.add( MongoKeyword::_id, 0 );
}
for ( auto& iter : kfselector._returns )
{
fields.add( iter.first, iter.second );
}
}
// 数量限制
if ( kfselector._limit_count != 0u )
{
request.setNumberToReturn( kfselector._limit_count );
}
///////////////////////////////////////////////////////////////////////////////////
__NEW_RESULT__( std::list< KFDBValue > );
ResponseMessage response;
auto ok = SendRequest( request, response );
if ( ok )
{
for ( auto i = 0u; i < response.documents().size(); ++i )
{
KFDBValue dbvalue;
Poco::MongoDB::Document::Ptr doc = response.documents()[ i ];
try
{
auto elements = doc->getSet();
for ( auto iter = elements->begin(); iter != elements->end(); ++iter )
{
auto& name = ( *iter )->name();
if ( kfselector._limit_returns.find( name ) != kfselector._limit_returns.end() )
{
continue;
}
auto type = ( *iter )->type();
if ( type == ElementTraits<Poco::Int64>::TypeId )
{
auto concrete = dynamic_cast< const ConcreteElement<Poco::Int64>* >( ( *iter ).get() );
if ( concrete != nullptr )
{
dbvalue.AddValue( name, concrete->value() );
}
}
else if ( type == ElementTraits<std::string>::TypeId )
{
auto concrete = dynamic_cast< const ConcreteElement<std::string>* >( ( *iter ).get() );
if ( concrete != nullptr )
{
dbvalue.AddValue( name, concrete->value(), false );
}
}
else if ( type == ElementTraits<Poco::MongoDB::Binary::Ptr>::TypeId )
{
auto concrete = dynamic_cast< const ConcreteElement<Poco::MongoDB::Binary::Ptr>* >( ( *iter ).get() );
if ( concrete != nullptr )
{
dbvalue.AddValue( name, concrete->value()->toRawString(), true );
}
}
}
}
catch ( Poco::Exception& ex )
{
__LOG_ERROR__( "mongo error=[{}]", ex.displayText() );
}
kfresult->_value.emplace_back( dbvalue );
}
}
else
{
kfresult->SetResult( KFEnum::Error );
}
return kfresult;
}
}
| 37.322581
| 149
| 0.429213
|
0ab0b590603f97c6cf46ae8b7c03a1d6d9a3b648
| 312
|
cs
|
C#
|
src/Weather/Weather.Data/Entities/Information.cs
|
SaMirzaei/weather
|
b8915a3578510a8712a921f6e8e4a171af78eee2
|
[
"MIT"
] | 1
|
2019-11-07T21:32:16.000Z
|
2019-11-07T21:32:16.000Z
|
src/Weather/Weather.Data/Entities/Information.cs
|
SaMirzaei/weather
|
b8915a3578510a8712a921f6e8e4a171af78eee2
|
[
"MIT"
] | 4
|
2021-03-09T22:12:55.000Z
|
2022-02-26T19:42:19.000Z
|
src/Weather/Weather.Data/Entities/Information.cs
|
SaMirzaei/weather
|
b8915a3578510a8712a921f6e8e4a171af78eee2
|
[
"MIT"
] | null | null | null |
namespace Weather.Data.Entities
{
using System;
public class Information
{
public Guid Id { get; set; }
public string Country { get; set; }
public string City { get; set; }
public DateTime CreatedAt { get; set; }
public string Json { get; set; }
}
}
| 17.333333
| 47
| 0.567308
|
99dbc8e4cbb9f191391c364c60a22ca6b0a22eb7
| 256
|
rb
|
Ruby
|
backend/db/migrate/20181027173051_add_columns_to_coupons.rb
|
jphacks/TK_1810
|
0c47c2a0eaeea47067e066a43def7ed079f77d2c
|
[
"MIT"
] | 6
|
2018-11-05T15:30:37.000Z
|
2020-10-27T09:16:03.000Z
|
backend/db/migrate/20181027173051_add_columns_to_coupons.rb
|
jphacks/TK_1810
|
0c47c2a0eaeea47067e066a43def7ed079f77d2c
|
[
"MIT"
] | 1
|
2018-10-28T02:02:25.000Z
|
2018-10-28T02:02:25.000Z
|
backend/db/migrate/20181027173051_add_columns_to_coupons.rb
|
jphacks/TK_1810
|
0c47c2a0eaeea47067e066a43def7ed079f77d2c
|
[
"MIT"
] | 3
|
2019-10-18T10:21:54.000Z
|
2021-10-30T00:54:39.000Z
|
class AddColumnsToCoupons < ActiveRecord::Migration[5.2]
def change
add_column :coupons, :comment, :string, null: false
add_column :coupons, :tweet_url, :string, null: false
add_reference :coupons, :food_category, foreign_key: true
end
end
| 32
| 61
| 0.742188
|
930327545cffd9daa53e40c8713f272588857634
| 1,545
|
lua
|
Lua
|
sconce/Freeze.lua
|
anibali/sconce
|
76673f36312e41bcbbaab1736d862d617a4b2527
|
[
"MIT"
] | null | null | null |
sconce/Freeze.lua
|
anibali/sconce
|
76673f36312e41bcbbaab1736d862d617a4b2527
|
[
"MIT"
] | null | null | null |
sconce/Freeze.lua
|
anibali/sconce
|
76673f36312e41bcbbaab1736d862d617a4b2527
|
[
"MIT"
] | null | null | null |
---
-- Wraps another module, adding the ability to freeze and unfreeze parameter
-- updates on that module.
--
-- Use Freeze:freeze() to disable parameter updates on the wrapped module, and
-- Freeze:unfreeze() to enable them. By default the module will be frozen.
--
-- @classmod sconce.Freeze
local Freeze, Parent = require('sconce.ns').class('sconce.Freeze', 'nn.Module')
---
-- @tparam nn.Module module The module to wrap
function Freeze:__init(module)
Parent.__init(self)
self.module = module
self.module:zeroGradParameters()
self.frozen = true
end
---
-- Freeze parameter updates.
function Freeze:freeze()
self.frozen = true
end
---
-- Unfreeze parameter updates.
function Freeze:unfreeze()
self.frozen = false
end
function Freeze:updateOutput(input)
self.output = self.module:updateOutput(input)
return self.output
end
function Freeze:updateGradInput(input, gradOutput)
self.gradInput = self.module:updateGradInput(input, gradOutput)
return self.gradInput
end
function Freeze:accGradParameters(...)
if not self.frozen then
return self.module:accGradParameters(...)
end
end
local function delegate(class, get_delegation_target, methods)
for i,method in ipairs(methods) do
class[method] = function(self, ...)
local other = get_delegation_target(self)
return other[method](other, ...)
end
end
end
delegate(Freeze, function(self) return self.module end, {
'clearState', 'evaluate', 'parameters', 'reset', 'training',
'updateParameters', 'zeroGradParameters'
})
return Freeze
| 23.769231
| 79
| 0.733333
|
be9593143244564f2b99e76e9dd8eb8aa94dfdc8
| 5,263
|
ts
|
TypeScript
|
portal/src/main/resources/public/ts/myapps/myapps.service.ts
|
opendigitaleducation/entcore
|
002ebbf8a1dd6c246af86f1e18b6abf971c08322
|
[
"Apache-2.0"
] | 21
|
2019-01-30T09:00:54.000Z
|
2022-02-28T15:15:05.000Z
|
portal/src/main/resources/public/ts/myapps/myapps.service.ts
|
opendigitaleducation/entcore
|
002ebbf8a1dd6c246af86f1e18b6abf971c08322
|
[
"Apache-2.0"
] | 68
|
2019-02-14T09:03:17.000Z
|
2022-03-29T09:35:53.000Z
|
portal/src/main/resources/public/ts/myapps/myapps.service.ts
|
opendigitaleducation/entcore
|
002ebbf8a1dd6c246af86f1e18b6abf971c08322
|
[
"Apache-2.0"
] | 11
|
2019-03-08T08:33:12.000Z
|
2021-12-14T20:10:38.000Z
|
import { model } from "entcore";
import { App } from "./myapps.types";
import http from "axios";
export interface UserAppsPreferenceResponse {
preference: string;
}
export interface UserAppsPreference {
bookmarks: Array<string>;
applications: Array<string>;
}
export class AppsService {
private static readonly INSTANCE = new AppsService();
private constructor() {}
public static getInstance() {
return AppsService.INSTANCE;
}
async getConnectorsThresold(): Promise<number> {
const conf = await http.get('/conf/public');
let threshold = conf.data["my-apps-connectors-threshold"];
if (threshold == undefined) {
threshold = 6;
}
return threshold;
}
async getApplicationsList(): Promise<Array<App>> {
const applicationListResponse = await http.get('/applications-list');
if (applicationListResponse.data) {
return applicationListResponse.data.apps;
}
return null;
}
/**
* sync user preference apps list with applications-list API:
* - remove duplicates apps in user preference apps
* - remove user preference apps that are not in applications-list API anymore
*
* @param applicationsListFromAPI applications list from /applications-list API
*/
async syncUserPrefAppsWith(applicationsListFromAPI: Array<App>): Promise<void> {
const userAppsPrefResponse = await http.get('/userbook/preference/apps');
if (userAppsPrefResponse.data && userAppsPrefResponse.data.preference) {
const userPrefs: UserAppsPreference = JSON.parse(userAppsPrefResponse.data.preference);
// remove duplicates bookmarks
userPrefs.bookmarks = Array.from(new Set(userPrefs.bookmarks));
// remove duplicates apps
userPrefs.applications = Array.from(new Set(userPrefs.applications));
// remove missing bookmarks from user prefs if not in application-list API
const missingBookmarks: Array<string> = [];
userPrefs.bookmarks.forEach(prefBookmark => {
if (!applicationsListFromAPI.find(a => a.name === prefBookmark)) {
missingBookmarks.push(prefBookmark);
}
});
userPrefs.bookmarks = userPrefs.bookmarks.filter(b => !missingBookmarks.find(m => m === b));
// remove missing apps from user prefs if not in application-list API
const missingApps: Array<string> = [];
userPrefs.applications.forEach(prefApp => {
if (!applicationsListFromAPI.find(a => a.name === prefApp)) {
missingApps.push(prefApp);
}
});
userPrefs.applications = userPrefs.applications.filter(b => !missingApps.find(m => m === b));
await http.put('/userbook/preference/apps', userPrefs);
// sync model.me.myApps lists too
model.me.myApps.bookmarks = Array.from(new Set(model.me.myApps.bookmarks));
model.me.myApps.bookmarks = model.me.myApps.bookmarks.filter(b => !missingBookmarks.find(m => m === b));
model.me.myApps.applications = Array.from(new Set(model.me.myApps.applications));
model.me.myApps.applications = model.me.myApps.applications.filter(a => !missingApps.find(m => m === a));
}
}
isConnectorBeforeLastAppInMyApps(apps: Array<App>, connectors: Array<App>): boolean {
let res = false;
let lastAppIndex = 0;
model.me.myApps.applications.forEach((appName: string, index) => {
if (apps.find(app => appName === app.name)) {
lastAppIndex = index;
}
});
model.me.myApps.applications.forEach((appName: String, index) => {
if (connectors.find(conn => appName === conn.name) && index < lastAppIndex) {
res = true;
}
});
return res;
}
orderAppsFirstInMyApps(apps: Array<App>): void {
const orderedApplications = [];
const orderedConnectors = [];
model.me.myApps.applications.forEach((myAppsAppName: string) => {
if (apps.find(app => myAppsAppName === app.name)) {
orderedApplications.push(myAppsAppName);
} else {
orderedConnectors.push(myAppsAppName);
}
});
model.me.myApps.applications = [...orderedApplications, ...orderedConnectors];
}
isBookmark(app: App): boolean {
return model.me.bookmarkedApps.find(bookmarkedApp => bookmarkedApp.name === app.name);
}
isApplication(app: App): boolean {
return !AppsService.getInstance().isBookmark(app) && !app.isExternal;
}
isConnector(app: App): boolean {
return !AppsService.getInstance().isBookmark(app) && app.isExternal;
}
sortApp(a: App, b: App) {
return model.me.myApps.applications.indexOf(a.name) > model.me.myApps.applications.indexOf(b.name)? 1: -1;
}
pushToMyApps(app: App) {
if (model.me.myApps.applications.indexOf(app.name) == -1) {
model.me.myApps.applications.push(app.name);
}
}
}
| 38.698529
| 117
| 0.609538
|
da779f34cb38de0d39798206187ac7b74d56b870
| 13,415
|
php
|
PHP
|
admin/view/category_view.php
|
ngthuc/CT263
|
c484bba34403e7a27fbd1cd9605ffa89c248c322
|
[
"MIT"
] | null | null | null |
admin/view/category_view.php
|
ngthuc/CT263
|
c484bba34403e7a27fbd1cd9605ffa89c248c322
|
[
"MIT"
] | null | null | null |
admin/view/category_view.php
|
ngthuc/CT263
|
c484bba34403e7a27fbd1cd9605ffa89c248c322
|
[
"MIT"
] | null | null | null |
<?php
/**
* Created by PhpStorm.
* User: trana
* Date: 11/7/2017
* Time: 8:07 AM
*/
class category_view
{
public function create_option($category, $select, $add)
{
if (!$add) {
$selected = $select == "All" ? " selected" : "";
echo "<option value='All'" . $selected . ">All Category</option>";
}
while ($row = mysqli_fetch_assoc($category)) {
$selected = $select == $row["ID"] ? " selected" : "";
echo "<option value='" . $row['ID'] . "' " . $selected . ">" . $row["NAME"] . "</option>";
}
$selected = $select == "" ? " selected" : "";
echo "<option value=''" . $selected . ">Other</option>";
}
public function create_table_category($category)
{
?>
<div id="table-category">
<table class="table table-hover">
<thead>
<tr>
<th style="width: 20px">
<input id="check-all" class='checkbox-style' type='checkbox'>
</th>
<th>Name</th>
<th>Code</th>
<th>Description</th>
</tr>
</thead>
<?php
while ($row = mysqli_fetch_assoc($category)) {
echo "
<tbody class='row-category'>
<tr class='category-row' id='category-" . $row['ID'] . "'>
<td>
<input class='checkbox-style' type='checkbox' name='check-category[]' value='" . $row['ID'] . "'>
</td>
<td class='name-category'>
<strong>
<a href='category.php?action=edit&id=" . $row['ID'] . "'>" . $row['NAME'] . "</a>
</strong>
</td>
<td>" . $row['CATEGORY_ID'] . "</td>
<td style='overflow: hidden'>" . $row['Describe2'] . "...</td>
</tr>
<tr>
<td colspan='4' class='nav-action'>
ID: " . $row['ID'] . "
<strong>
|
<span class='edit'>
<a href='category.php?action=edit&id=" . $row['ID'] . "'>
<span class='fa fa-edit'></span> Edit</a> |</span>
<span class='delete'>
<a href='category.php?action=delete&id=" . $row['ID'] . "'>
<span class='fa fa-remove'></span> Delete</a>
</span>
</strong>
</td>
</tr>
</tbody>
";
}
?>
</table>
</div>
<?php
}
public function create_table_nav_page($currentPage, $totalProduct, $limit, $link)
{
$totalPage = ceil($totalProduct / $limit);
$totalPage = $totalPage < 0 ? 1 : $totalPage;
// $totalPage = 5;
$currentPage = $currentPage > $totalPage ? 1 : $currentPage;
?>
<nav class='ml-auto'>
<ul class='pagination justify-content-end'>
<?php
if ($currentPage > 1) {
echo "<li class='page-item'>
<a class='page-link' href='" . $link . "&page=" . ($currentPage - 1) . "'><span class='fa fa-chevron-left'></span></a>
</li>";
}
// Create page layout
if (($currentPage - 1) < 3 && $currentPage != 1) {
echo "<li class='page-item " . ($currentPage == 1 ? " disabled" : "") . "'>
<a class='page-link' href='" . $link . "&page=1'>1</a>
</li>";
} else if (($currentPage - 1) > 1) {
echo "<li class='page-item'>
<a class='page-link' href='" . $link . "&page=1'>1</a>
</li>
<li class='page-item disabled'>
<a class='page-link' href='#'>...</a>
</li>";
}
if (($currentPage - 1) - 1 > 0) {
echo "<li class='page-item'>
<a class='page-link' href='" . $link . "&page=" . ($currentPage - 1) . "'>" . ($currentPage - 1) . "</a>
</li>";
}
echo "<li class='page-item disabled'>
<a class='page-link' href='" . $link . "&page=" . ($currentPage) . "'>" . ($currentPage) . "</a>
</li>";
if ($totalPage - ($currentPage + 1) > 0) {
echo "<li class='page-item '>
<a class='page-link' href='" . $link . "&page=" . ($currentPage + 1) . "'>" . ($currentPage + 1) . "</a>
</li>";
}
if (($totalPage - ($currentPage + 1)) >= 0) {
if (($totalPage - ($currentPage + 1)) < 2 && $currentPage != $totalPage) {
echo "<li class='page-item " . ($currentPage == $totalPage ? " disabled" : "") . "'>
<a class='page-link' href='" . $link . "&page=" . $totalPage . "'>" . $totalPage . "</a>
</li>";
} else if (($totalPage - ($currentPage + 1)) > 1) {
echo "<li class='page-item disabled'>
<a class='page-link' href='#'>...</a>
</li>
<li class='page-item'>
<a class='page-link' href='" . $link . "&page=" . $totalPage . "'>" . $totalPage . "</a>
</li>";
}
}
if ($currentPage < $totalPage && $totalPage > 1) {
echo "<li class='page-item'>
<a class='page-link' href='" . $link . "&page=" . ($currentPage + 1) . "'><span class='fa fa-chevron-right'></span></a>
</li>";
}
?>
</ul>
</nav>
<?php
}
public function update_alert($result, $id)
{
if ($result) {
echo "
<div class='alert alert-success alert-dismissable'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>x</a>
<strong>Success!</strong> Update success category id = " . $id .
"</div>
";
} else {
echo "
<div class='alert alert-Danger alert-dismissable'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>x</a>
<strong>Error!</strong> Update not success category id = " . $id .
"</div>
";
}
}
public function delete_alert($result, $id)
{
if ($result) {
echo "
<div class='alert alert-success alert-dismissable'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>x</a>
<strong>Success!</strong> Delete category id = " . $id . " success
</div>
";
} else {
echo "
<div class='alert alert-Danger alert-dismissable'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>x</a>
<strong>Error!</strong> Delete category id = " . $id . " not success
</div>
";
}
}
public function insert_alert($result)
{
if ($result) {
echo "
<div class='alert alert-success alert-dismissable'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>x</a>
<strong>Success!</strong> Add new category success
</div>
";
} else {
echo "
<div class='alert alert-Danger alert-dismissable'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>x</a>
<strong>Error!</strong> Add new category not success
</div>
";
}
}
public function delete_alert_multiple($deleted, $total)
{
if ($total - $deleted == 0) {
echo "
<div class='alert alert-success alert-dismissable'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>x</a>
<strong>Success!</strong> Delete " . $total . " category success
</div>
";
} else if ($total - $deleted > 0 && $deleted>0) {
echo "
<div class='alert alert-success alert-dismissable'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>x</a>
<strong>Success!</strong> Delete " . $deleted . " category success
</div>
";
echo "
<div class='alert alert-danger alert-dismissable'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>x</a>
<strong>Error!</strong> Delete " . ($total - $deleted ). " category not success
</div>
";
} else {
echo "
<div class='alert alert-danger alert-dismissable'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>x</a>
<strong>Error!</strong> Delete " . $total . " category not success
</div>
";
}
}
public function create_form_add_new()
{
?>
<div class="card card-default">
<div class="card-header">
<strong>Add New Category</strong>
</div>
<div class="card-body">
<div class='input-group form-group'>
<span class='input-group-addon input-group-addon-label2'>Category Name</span>
<input class='form-control' id='category-name' name='category-name' type='text' placeholder='' maxlength="30">
</div>
<div class='input-group form-group'>
<span class='input-group-addon input-group-addon-label2'>Category Code</span>
<input class='form-control' id='category-code' name='category-code' type='text' placeholder='' maxlength="6" required>
</div>
<div class="form-group">
<label for="description">Discription:</label>
<textarea class="form-control" rows="10" id="category-description" name="category-description" maxlength="1000"></textarea>
</div>
<div class="row">
<button class="btn btn-primary ml-3" name="add-new" type="submit">
<span class="fa fa-plus"></span> Add</button>
<a class="btn btn-secondary ml-3" href="category.php">Cancel</a>
</div>
</div>
</div>
<?php
}
public function create_form_edit($category)
{
$row = mysqli_fetch_assoc($category);
?>
<div class="card card-default">
<div class="card-header">
<strong>Edit Category</strong>
</div>
<div class="card-body">
<div class='input-group form-group'>
<span class='input-group-addon input-group-addon-label2'>ID</span>
<input class='form-control' id='category-id' name='category-id' type='text' value='<?php echo $row['ID']; ?>' readonly>
</div>
<div class='input-group form-group'>
<span class='input-group-addon input-group-addon-label2'>Category Name</span>
<input class='form-control' id='category-name' name='category-name' type='text' value='<?php echo $row['NAME']; ?>' maxlength="30">
</div>
<div class='input-group form-group'>
<span class='input-group-addon input-group-addon-label2'>Category Code</span>
<input class='form-control' id='category-code' name='category-code' type='text' value='<?php echo $row['CATEGORY_ID']; ?>' maxlength="6">
</div>
<div class="form-group">
<label for="description">Discription:</label>
<textarea class="form-control" rows="10" id="category-description" name="category-description" maxlength="1000"><?php echo $row['Describe']; ?></textarea>
</div>
<div class="row">
<button class="btn btn-primary ml-3" name="save" type="submit">
<span class="fa fa-save"></span> Save</button>
<a class="btn btn-secondary ml-3" href="category.php">Cancel</a>
</div>
</div>
</div>
<?php
}
}
| 43.983607
| 174
| 0.423481
|
770c5bdb3ab8ce76dec5e65181b95bf7c749ec3e
| 1,236
|
swift
|
Swift
|
Swift/Repetition/R_LinkedListCycle.swift
|
devMEremenko/Coding-Challenges
|
803b1dfe00afb6a9e9651db02f9a223cb2f1bd64
|
[
"MIT"
] | 10
|
2019-07-19T06:17:50.000Z
|
2022-01-08T03:00:00.000Z
|
Swift/Repetition/R_LinkedListCycle.swift
|
devMEremenko/LeetCode
|
803b1dfe00afb6a9e9651db02f9a223cb2f1bd64
|
[
"MIT"
] | null | null | null |
Swift/Repetition/R_LinkedListCycle.swift
|
devMEremenko/LeetCode
|
803b1dfe00afb6a9e9651db02f9a223cb2f1bd64
|
[
"MIT"
] | 1
|
2019-04-11T10:33:50.000Z
|
2019-04-11T10:33:50.000Z
|
//
// R_LinkedListCycle.swift
// CodingChallenges
//
// Created by Maxim Eremenko on 02.01.2020.
// Copyright © 2020 Eremenko Maxim. All rights reserved.
//
import XCTest
class R_LinkedListCycle: XCTestCase {
func test1() {
let head = ListNode(1, ListNode(2))
XCTAssertFalse(hasCycle(head))
}
func test2() {
let head = ListNode(1)
let second = ListNode(2)
head.next = second
second.next = head
XCTAssertTrue(hasCycle(head))
}
func test3() {
XCTAssertFalse(hasCycle(nil))
}
}
extension R_LinkedListCycle {
class ListNode {
var val: Int
var next: ListNode?
init(_ val: Int, _ next: ListNode? = nil) {
self.val = val
self.next = next
}
}
}
extension R_LinkedListCycle {
/// Time: O(n)
/// Space: O(1)
func hasCycle(_ head: ListNode?) -> Bool {
var slow = head
var fast = head
while fast?.next?.next != nil {
slow = slow?.next
fast = fast?.next?.next
if slow === fast {
return true
}
}
return false
}
}
| 19.3125
| 57
| 0.508091
|
ecb08dd608cf87dc64d7536fbcbcd66b79fbba60
| 70
|
rb
|
Ruby
|
lib/apate.rb
|
Albin-trialbee/Apate
|
55ebf3dd26199541dccf9474b70465277015f59d
|
[
"MIT"
] | null | null | null |
lib/apate.rb
|
Albin-trialbee/Apate
|
55ebf3dd26199541dccf9474b70465277015f59d
|
[
"MIT"
] | 1
|
2015-04-27T22:45:41.000Z
|
2015-04-27T22:45:41.000Z
|
lib/apate.rb
|
Albin-trialbee/Apate
|
55ebf3dd26199541dccf9474b70465277015f59d
|
[
"MIT"
] | null | null | null |
require "apate/version"
require "apate/all_methods"
module Apate
end
| 11.666667
| 27
| 0.8
|
b5530532dd49d5a6cacaaa39cf818a422f7ffed9
| 9,000
|
rb
|
Ruby
|
db/schema.rb
|
xjlin0/rv_converter
|
1d9cc6f04cf26da896f3b3eb768e8e8b69709014
|
[
"MIT"
] | null | null | null |
db/schema.rb
|
xjlin0/rv_converter
|
1d9cc6f04cf26da896f3b3eb768e8e8b69709014
|
[
"MIT"
] | null | null | null |
db/schema.rb
|
xjlin0/rv_converter
|
1d9cc6f04cf26da896f3b3eb768e8e8b69709014
|
[
"MIT"
] | null | null | null |
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160926154913) do
create_table "bible_version_key", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", comment: "This is the general translation information and db links" do |t|
t.text "table", limit: 65535, null: false, comment: "Database Table Name "
t.text "abbreviation", limit: 65535, null: false, comment: "Version Abbreviation"
t.text "language", limit: 65535, null: false, comment: "Language of bible translation (used for language key tables)"
t.text "version", limit: 65535, null: false, comment: "Version Name"
t.text "info_text", limit: 65535, null: false, comment: "About / Info"
t.text "info_url", limit: 65535, null: false, comment: "Info URL"
t.text "publisher", limit: 65535, null: false, comment: "Publisher"
t.text "copyright", limit: 65535, null: false, comment: "Copyright "
t.text "copyright_info", limit: 65535, null: false, comment: "Extended Copyright info"
end
create_table "cross_reference", id: false, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
t.integer "vid", null: false, comment: "verse ID"
t.integer "r", null: false, comment: "Rank"
t.integer "sv", null: false, comment: "Start Verse"
t.integer "ev", null: false, comment: "End Verse"
t.index ["vid"], name: "vid", using: :btree
end
create_table "cuv_pericopes", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.integer "b", null: false
t.integer "c", null: false
t.integer "v", null: false
t.text "t", limit: 65535, null: false
t.text "pa", limit: 65535
end
create_table "key_abbreviations_english", unsigned: true, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", comment: "A table mapping book abbreviations to the book they refer to" do |t|
t.string "a", null: false
t.integer "b", limit: 2, null: false, comment: "ID of book that is abbreviated", unsigned: true
t.boolean "p", default: false, null: false, comment: "Whether an abbreviation is the primary one for the book"
end
create_table "key_chinese", primary_key: "b", id: :integer, comment: "Book #", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.text "n", limit: 65535, null: false, comment: "Book Name"
t.string "t", limit: 2, null: false, comment: "Which Testament this book is in"
t.integer "g", limit: 1, null: false, comment: "A genre ID to identify the type of book this is", unsigned: true
t.string "a", limit: 4, null: false, comment: "book abbreviation"
end
create_table "key_english", primary_key: "b", id: :integer, comment: "Book #", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.text "n", limit: 65535, null: false, comment: "Name"
t.string "t", limit: 2, null: false, comment: "Which Testament this book is in"
t.integer "g", limit: 1, null: false, comment: "A genre ID to identify the type of book this is", unsigned: true
end
create_table "key_genre_english", primary_key: "g", unsigned: true, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", comment: "Table mapping genre IDs to genre names for book table lookup" do |t|
t.string "n", null: false, comment: "Name of genre"
end
create_table "rvs", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.integer "b", null: false
t.integer "c", null: false
t.integer "v", null: false
t.text "cb", limit: 65535
t.text "ct", limit: 65535
t.text "et", limit: 65535
t.text "file_name", limit: 65535
t.index ["id"], name: "id", using: :btree
t.index ["id"], name: "id_2", unique: true, using: :btree
end
create_table "t_asv", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
t.integer "b", null: false
t.integer "c", null: false
t.integer "v", null: false
t.text "t", limit: 65535, null: false
t.index ["id"], name: "id", using: :btree
t.index ["id"], name: "id_2", using: :btree
t.index ["id"], name: "id_3", unique: true, using: :btree
t.index ["id"], name: "id_4", using: :btree
t.index ["id"], name: "id_5", using: :btree
t.index ["id"], name: "id_6", using: :btree
t.index ["id"], name: "id_7", using: :btree
t.index ["id"], name: "id_8", using: :btree
end
create_table "t_bbe", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
t.integer "b", null: false
t.integer "c", null: false
t.integer "v", null: false
t.text "t", limit: 65535, null: false
t.index ["id"], name: "id", unique: true, using: :btree
t.index ["id"], name: "id_2", using: :btree
end
create_table "t_cuv", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.integer "b", null: false
t.integer "c", null: false
t.integer "v", null: false
t.text "t", limit: 65535
t.index ["id"], name: "id", using: :btree
t.index ["id"], name: "id_2", unique: true, using: :btree
end
create_table "t_dby", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
t.integer "b", null: false
t.integer "c", null: false
t.integer "v", null: false
t.text "t", limit: 65535, null: false
t.index ["id"], name: "id", unique: true, using: :btree
t.index ["id"], name: "id_2", unique: true, using: :btree
end
create_table "t_kjv", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.integer "b", null: false
t.integer "c", null: false
t.integer "v", null: false
t.text "t", limit: 65535
t.index ["id"], name: "id", using: :btree
t.index ["id"], name: "id_2", unique: true, using: :btree
end
create_table "t_wbt", id: false, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
t.integer "id", null: false
t.integer "b", null: false
t.integer "c", null: false
t.integer "v", null: false
t.text "t", limit: 65535, null: false
end
create_table "t_web", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
t.integer "b", null: false
t.integer "c", null: false
t.integer "v", null: false
t.text "t", limit: 65535, null: false
t.index ["id"], name: "id", using: :btree
t.index ["id"], name: "id_2", unique: true, using: :btree
end
create_table "t_ylt", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
t.integer "b", null: false
t.integer "c", null: false
t.integer "v", null: false
t.text "t", limit: 65535, null: false
t.index ["id"], name: "id", using: :btree
t.index ["id"], name: "id_2", unique: true, using: :btree
end
create_table "verses", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.integer "b", null: false
t.integer "c", null: false
t.integer "v", null: false
t.text "t", limit: 65535
t.index ["id"], name: "id", using: :btree
t.index ["id"], name: "id_2", unique: true, using: :btree
end
create_table "x_references", id: false, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
t.integer "vid", null: false, comment: "verse ID"
t.integer "r", null: false, comment: "Rank"
t.integer "sv", null: false, comment: "Start Verse"
t.integer "ev", null: false, comment: "End Verse"
t.index ["vid"], name: "vid", using: :btree
end
end
| 52.023121
| 214
| 0.606667
|
be98fd681e430e01b3627c079313d308b379ec67
| 2,888
|
tsx
|
TypeScript
|
src/lib/uniforms-surfnet/__tests__/logic/LocationCodeField.tsx
|
wouter1975/orchestrator-core-gui
|
dbc7f13ad2de48d3a50e7a552962011e469b81d5
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
src/lib/uniforms-surfnet/__tests__/logic/LocationCodeField.tsx
|
wouter1975/orchestrator-core-gui
|
dbc7f13ad2de48d3a50e7a552962011e469b81d5
|
[
"ECL-2.0",
"Apache-2.0"
] | 1
|
2022-03-22T02:39:52.000Z
|
2022-03-22T02:39:52.000Z
|
src/lib/uniforms-surfnet/__tests__/logic/LocationCodeField.tsx
|
wouter1975/orchestrator-core-gui
|
dbc7f13ad2de48d3a50e7a552962011e469b81d5
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
/*
* Copyright 2019-2020 SURF.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import createContext from "lib/uniforms-surfnet/__tests__/_createContext";
import mount from "lib/uniforms-surfnet/__tests__/_mount";
import { LocationCodeField, SelectField } from "lib/uniforms-surfnet/src";
import React from "react";
import ApplicationContext, { ApplicationContextInterface } from "utils/ApplicationContext";
jest.mock("lib/uniforms-surfnet/src/SelectField", () => {
return { __esModule: true, default: () => <br /> };
});
describe("<LocationCodeField>", () => {
test("<LocationCodeField> - calls selectField with all locationCodes", () => {
const element = (
<ApplicationContext.Provider value={{ locationCodes: ["aaa", "bbb"] } as ApplicationContextInterface}>
<LocationCodeField name="x" />
</ApplicationContext.Provider>
);
const wrapper = mount(element, createContext({ x: { type: String } }));
expect(wrapper.html()).toBe("<br>");
expect(wrapper.find(SelectField)).toHaveLength(1);
expect(wrapper.find(SelectField).props()).toMatchObject({
allowedValues: ["aaa", "bbb"],
disabled: false,
error: null,
errorMessage: "",
required: true,
showInlineError: false,
value: undefined,
placeholder: "Search and select a location code...",
});
});
test("<LocationCodeField> - calls selectField with specified locationCodes", () => {
const element = (
<ApplicationContext.Provider value={{ locationCodes: ["aaa", "bbb"] } as ApplicationContextInterface}>
<LocationCodeField name="x" locationCodes={["ccc", "ddd"]} />
</ApplicationContext.Provider>
);
const wrapper = mount(element, createContext({ x: { type: String } }));
expect(wrapper.html()).toBe("<br>");
expect(wrapper.find(SelectField)).toHaveLength(1);
expect(wrapper.find(SelectField).props()).toMatchObject({
allowedValues: ["ccc", "ddd"],
disabled: false,
error: null,
errorMessage: "",
required: true,
showInlineError: false,
value: undefined,
placeholder: "Search and select a location code...",
});
});
});
| 41.855072
| 114
| 0.626385
|
6f66cf776467c88c4f6d4727f125ce1ca5a12aed
| 2,110
|
php
|
PHP
|
app/Http/Controllers/Seller/SellerController.php
|
ramsesguillen/curso_api-laravel
|
e3963b2c4e39b6ebfafdaf43158b835c52b2264b
|
[
"MIT"
] | null | null | null |
app/Http/Controllers/Seller/SellerController.php
|
ramsesguillen/curso_api-laravel
|
e3963b2c4e39b6ebfafdaf43158b835c52b2264b
|
[
"MIT"
] | null | null | null |
app/Http/Controllers/Seller/SellerController.php
|
ramsesguillen/curso_api-laravel
|
e3963b2c4e39b6ebfafdaf43158b835c52b2264b
|
[
"MIT"
] | null | null | null |
<?php
namespace App\Http\Controllers\Seller;
use App\Http\Controllers\ApiController;
// use App\Http\Controllers\Controller;
use App\Models\Seller;
use Illuminate\Http\Request;
class SellerController extends ApiController
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
try {
$vendedores = Seller::has('products')->get(); // Trae solamente las usuarios con relaciones a transaccion
} catch (\Throwable $th) {
//throw $th;
return $this->errorResponse('Vendedores no encontrados', 404);
}
// $vendedores = Seller::with('products')->get(); // Trae solamente las usuarios con relaciones a transaccion
// return response()->json(['data' => $vendedores], 200 );
return $this->showAll( $vendedores );
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
try {
$vendedor = Seller::has('products')->findOrFail($id); // Trae solamente las usuarios con relaciones a transaccion
} catch (\Throwable $th) {
return $this->errorResponse('Vendedor no encontrado', 404);
}
// return response()->json(['data' => $vendedor], 200 );
return $this->showOne( $vendedor );
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
| 25.421687
| 125
| 0.577251
|
cda6719c81359ede1de7755893955553f88bd4df
| 420
|
cs
|
C#
|
Xamarin.PropertyEditing.Windows.Standalone/MockedControlButton.cs
|
netonjm/Xamarin.PropertyEditing
|
b0db811113957cc9dc70f883190ad3bd98918671
|
[
"MIT"
] | 1
|
2017-10-07T04:29:02.000Z
|
2017-10-07T04:29:02.000Z
|
Xamarin.PropertyEditing.Windows.Standalone/MockedControlButton.cs
|
Acidburn0zzz/Xamarin.PropertyEditing
|
876040e6b5e95d4cb658158d3305a6871bb58f3f
|
[
"MIT"
] | null | null | null |
Xamarin.PropertyEditing.Windows.Standalone/MockedControlButton.cs
|
Acidburn0zzz/Xamarin.PropertyEditing
|
876040e6b5e95d4cb658158d3305a6871bb58f3f
|
[
"MIT"
] | null | null | null |
using System.Windows.Controls;
using Xamarin.PropertyEditing.Tests.MockControls;
namespace Xamarin.PropertyEditing.Windows.Standalone
{
public abstract class MockedControlButton<T> : Button, IMockedControl
where T : MockControl
{
public MockedControlButton(T mockedControl)
{
MockedControl = mockedControl;
}
public T MockedControl { get; }
object IMockedControl.MockedControl => MockedControl;
}
}
| 22.105263
| 70
| 0.780952
|
1bc55923cc05fa43146a4a85bd5b511955942bd5
| 2,437
|
rb
|
Ruby
|
lib/insta-catchpoint/api.rb
|
praymann/insta-catchpoint
|
75d7d386eaa9bb4c25b7d3d023894d10cdc5df8d
|
[
"MIT"
] | 1
|
2017-08-11T22:05:35.000Z
|
2017-08-11T22:05:35.000Z
|
lib/insta-catchpoint/api.rb
|
praymann/insta-catchpoint
|
75d7d386eaa9bb4c25b7d3d023894d10cdc5df8d
|
[
"MIT"
] | null | null | null |
lib/insta-catchpoint/api.rb
|
praymann/insta-catchpoint
|
75d7d386eaa9bb4c25b7d3d023894d10cdc5df8d
|
[
"MIT"
] | null | null | null |
require "insta-catchpoint/ver/version"
require 'net/http'
require 'base64'
require 'json'
require 'uri'
module InstaCatchpoint
class Api
@@host = 'https://io.catchpoint.com'
@@prefix = '/ui/api'
@@version = '/v1'
def initialize opts={}
@key = opts["key"]
@secret = opts["secret"]
end
def api_uri endpoint
return URI("#{@@host}#{@@prefix}#{@@version}/#{endpoint}")
end
def token_uri
return URI("#{@@host}#{@@prefix}/token")
end
def http_uri
return URI("#{@@host}")
end
def post_data
opts = {
:grant_type => 'client_credentials',
:client_id => @key,
:client_secret => @secret
}
return URI.encode_www_form(opts)
end
def fetch_token
uri = token_uri
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
res = http.post(uri.path, post_data)
@token = JSON.parse(res.body)["access_token"]
end
def headers
return {
"Authorization" => "Bearer #{Base64.urlsafe_encode64(@token)}"
}
end
def get endpoint
# remove preceeding slash
endpoint.gsub!(/^\//, '')
fetch_token
uri = api_uri(endpoint)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
begin
res = http.get(uri.path, headers)
return JSON.parse(res.body) unless res.code == '403'
puts "HTTP 403 received: #{res.body}"
exit
rescue TypeError
puts "Empty JSON Response from Catchpoint? Can't convert nil to String"
rescue Timeout::Error => e
puts "Possible HTTP Timeout issue"
rescue
end
end
def put endpoint
# remove preceeding slash
endpoint.gsub!(/^\//, '')
fetch_token
uri = api_uri(endpoint)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
begin
res = http.post(uri.path, post_data)
rescue TypeError
puts "Empty JSON Response from Catchpoint? Can't convert nil to String"
rescue Timeout::Error => e
puts "Possible HTTP Timeout issue"
end
end
end
end
| 22.357798
| 81
| 0.513746
|
f9959bccfec39423ddb62066ca181291cab1c157
| 299
|
swift
|
Swift
|
HSWeibo/HSWeibo/Classes/Module/Profile/Controller/HSProfileTableViewController.swift
|
show90houlang/HSWeibo
|
4d48b4b9670e7b33eef6b184a2b0bf8a5bc731eb
|
[
"Apache-2.0"
] | null | null | null |
HSWeibo/HSWeibo/Classes/Module/Profile/Controller/HSProfileTableViewController.swift
|
show90houlang/HSWeibo
|
4d48b4b9670e7b33eef6b184a2b0bf8a5bc731eb
|
[
"Apache-2.0"
] | null | null | null |
HSWeibo/HSWeibo/Classes/Module/Profile/Controller/HSProfileTableViewController.swift
|
show90houlang/HSWeibo
|
4d48b4b9670e7b33eef6b184a2b0bf8a5bc731eb
|
[
"Apache-2.0"
] | null | null | null |
//
// HSProfileTableViewController.swift
// HSWeibo
//
// Created by 曾海胜 on 15/10/27.
// Copyright © 2015年 zhs. All rights reserved.
//
import UIKit
class HSProfileTableViewController: HSBaseTableViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
}
| 16.611111
| 63
| 0.675585
|
937f95c0a8210d5ca40adb7416fb2ceeda4cf4db
| 133
|
cs
|
C#
|
src/Quidjibo.Autofac.Tests/Samples/CustomClientKey2.cs
|
vcsjones/Quidjibo
|
c81f4eb5973b80671f5542024b4c2b27b9289cb6
|
[
"Apache-2.0"
] | 16
|
2017-09-22T17:12:37.000Z
|
2022-01-16T21:28:02.000Z
|
src/Quidjibo.Autofac.Tests/Samples/CustomClientKey2.cs
|
vcsjones/Quidjibo
|
c81f4eb5973b80671f5542024b4c2b27b9289cb6
|
[
"Apache-2.0"
] | 11
|
2017-10-21T15:14:00.000Z
|
2019-02-14T12:48:22.000Z
|
src/Quidjibo.Autofac.Tests/Samples/CustomClientKey2.cs
|
vcsjones/Quidjibo
|
c81f4eb5973b80671f5542024b4c2b27b9289cb6
|
[
"Apache-2.0"
] | 5
|
2017-12-14T20:28:14.000Z
|
2021-08-20T04:54:01.000Z
|
using Quidjibo.Misc;
namespace Quidjibo.Autofac.Tests.Samples
{
public class CustomClientKey2 : IQuidjiboClientKey
{
}
}
| 16.625
| 54
| 0.736842
|
43ca5e3906c04a8537747d1392f0f19b0b7d02da
| 2,547
|
ts
|
TypeScript
|
loads/json.ts
|
wevisdemo/bkk-followup-data
|
9bf536ad43a547a8d3ae2c864f6ad9411b0f4c12
|
[
"MIT"
] | null | null | null |
loads/json.ts
|
wevisdemo/bkk-followup-data
|
9bf536ad43a547a8d3ae2c864f6ad9411b0f4c12
|
[
"MIT"
] | null | null | null |
loads/json.ts
|
wevisdemo/bkk-followup-data
|
9bf536ad43a547a8d3ae2c864f6ad9411b0f4c12
|
[
"MIT"
] | 1
|
2022-03-01T11:41:44.000Z
|
2022-03-01T11:41:44.000Z
|
import { BaseReport } from '../models/base-report.ts';
import { Maps } from '../models/map.ts';
import { ProblemType } from '../models/problem-type.ts';
import { ReportSuite } from '../models/reports.ts';
import { District as ExtractedDistrict } from '../extracts/district.ts';
export async function loadReportSuiteToJsonFiles(suite: ReportSuite, path = '.') {
await writeReports(suite.alls, path, 'all');
await writeReports(suite.areas.residence, path, 'residence');
await writeReports(suite.areas.suburban, path, 'suburban');
await writeReports(suite.areas['tourism-and-cultural'], path, 'tourism-and-cultural');
await writeReports(suite.areas.business, path, 'business');
for (const d of suite.districts) {
await writeReports(d.problems, path, String(`district${d.id}`));
}
}
function writeReports(
reports: { [key in ProblemType]: BaseReport },
path: string,
zone: string,
) {
return Promise.all([
Deno.writeTextFile(`${path}/report_flood_${zone}.json`, JSON.stringify(reports[ProblemType.Flood], null, 2)),
Deno.writeTextFile(`${path}/report_waste_${zone}.json`, JSON.stringify(reports[ProblemType.Waste], null, 2)),
Deno.writeTextFile(`${path}/report_green_${zone}.json`, JSON.stringify(reports[ProblemType.Green], null, 2)),
Deno.writeTextFile(`${path}/report_water_${zone}.json`, JSON.stringify(reports[ProblemType.Water], null, 2)),
Deno.writeTextFile(`${path}/report_air_${zone}.json`, JSON.stringify(reports[ProblemType.Air], null, 2)),
]);
}
export async function loadMapsToJsonFiles(maps: Maps, path = '.') {
return Promise.all([
Deno.writeTextFile(`${path}/map_flood.json`, JSON.stringify(maps[ProblemType.Flood], null, 2)),
Deno.writeTextFile(`${path}/map_waste.json`, JSON.stringify(maps[ProblemType.Waste], null, 2)),
Deno.writeTextFile(`${path}/map_green.json`, JSON.stringify(maps[ProblemType.Green], null, 2)),
Deno.writeTextFile(`${path}/map_water.json`, JSON.stringify(maps[ProblemType.Water], null, 2)),
Deno.writeTextFile(`${path}/map_air.json`, JSON.stringify(maps[ProblemType.Air], null, 2)),
]);
}
export async function loadDistrictsToJsonFiles(districts: ExtractedDistrict[], path = '.') {
const mapped = districts.map(d => ({
id: d.id,
name: d.district,
districtType: d.type,
areaSize: d.area,
minimumPopulationDensity: d.minimumPopulationDensity,
maximumPopluationDensity: d.maximumPopulationDensity,
}));
return Deno.writeTextFile(`${path}/districts.json`, JSON.stringify(mapped, null, 2));
}
| 48.980769
| 115
| 0.707892
|
b06d500456a17fff250fdc19fdba3a4c134815c4
| 6,242
|
py
|
Python
|
tests/cli/test_status.py
|
lokijuhy/renku-python
|
0bfceafa4e6b4750439ab0ed20c61b0a6ba03a1f
|
[
"Apache-2.0"
] | null | null | null |
tests/cli/test_status.py
|
lokijuhy/renku-python
|
0bfceafa4e6b4750439ab0ed20c61b0a6ba03a1f
|
[
"Apache-2.0"
] | null | null | null |
tests/cli/test_status.py
|
lokijuhy/renku-python
|
0bfceafa4e6b4750439ab0ed20c61b0a6ba03a1f
|
[
"Apache-2.0"
] | null | null | null |
# -*- coding: utf-8 -*-
#
# Copyright 2017-2021 - Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Test `status` command."""
import os
from renku.cli import cli
from renku.core.metadata.repository import Repository
from tests.utils import format_result_exception, write_and_commit_file
def test_status(runner, project, subdirectory):
"""Test status check."""
source = os.path.join(project, "source.txt")
output = os.path.join(project, "data", "output.txt")
repo = Repository(project)
write_and_commit_file(repo, source, "content")
assert 0 == runner.invoke(cli, ["run", "cp", source, output]).exit_code
result = runner.invoke(cli, ["status"])
assert 0 == result.exit_code, format_result_exception(result)
write_and_commit_file(repo, source, "new content")
result = runner.invoke(cli, ["status"])
assert 1 == result.exit_code
assert "Outdated outputs(1):" in result.output
assert f"{os.path.relpath(output)}: {os.path.relpath(source)}" in result.output
assert "Modified inputs(1):" in result.output
assert "Outdated activities that have no outputs" not in result.output
def test_status_multiple_steps(runner, project):
"""Test status check with multiple steps."""
source = os.path.join(os.getcwd(), "source.txt")
intermediate = os.path.join(os.getcwd(), "intermediate.txt")
output = os.path.join(os.getcwd(), "data", "output.txt")
repo = Repository(project)
write_and_commit_file(repo, source, "content")
assert 0 == runner.invoke(cli, ["run", "cp", source, intermediate]).exit_code
assert 0 == runner.invoke(cli, ["run", "cp", intermediate, output]).exit_code
write_and_commit_file(repo, source, "new content")
result = runner.invoke(cli, ["status"])
assert 1 == result.exit_code
assert "data/output.txt: source.txt" in result.output
assert "intermediate.txt: source.txt" in result.output
def test_workflow_without_outputs(runner, project):
"""Test workflow without outputs."""
source = os.path.join(os.getcwd(), "source.txt")
repo = Repository(project)
write_and_commit_file(repo, source, "content")
result = runner.invoke(cli, ["run", "cat", "--no-output", source])
assert 0 == result.exit_code, format_result_exception(result)
write_and_commit_file(repo, source, "new content")
result = runner.invoke(cli, ["status"])
assert 1 == result.exit_code
assert "Modified inputs(1):" in result.output
assert "source.txt" in result.output
assert "Outdated activities that have no outputs(1)" in result.output
assert "/activities/" in result.output
def test_status_with_paths(runner, project):
"""Test status check with multiple steps."""
source1 = os.path.join(os.getcwd(), "source1.txt")
output1 = os.path.join(os.getcwd(), "data", "output1.txt")
source2 = os.path.join(os.getcwd(), "source2.txt")
output2 = os.path.join(os.getcwd(), "data", "output2.txt")
repo = Repository(project)
write_and_commit_file(repo, source1, "content")
write_and_commit_file(repo, source2, "content")
assert 0 == runner.invoke(cli, ["run", "cp", source1, output1]).exit_code
assert 0 == runner.invoke(cli, ["run", "cp", source2, output2]).exit_code
write_and_commit_file(repo, source1, "new content")
write_and_commit_file(repo, source2, "new content")
result = runner.invoke(cli, ["status", source1])
assert 1 == result.exit_code, format_result_exception(result)
assert "data/output1.txt: source1.txt" in result.output
assert "Modified inputs(1):" in result.output
assert "source2.txt" not in result.output
result = runner.invoke(cli, ["status", output1])
assert 1 == result.exit_code, format_result_exception(result)
assert "data/output1.txt: source1.txt" in result.output
assert "Modified inputs(1):" in result.output
assert "source2.txt" not in result.output
result = runner.invoke(cli, ["status", "source2.txt"])
assert 1 == result.exit_code, format_result_exception(result)
assert "data/output2.txt: source2.txt" in result.output
assert "Modified inputs(1):" in result.output
assert "source1.txt" not in result.output
result = runner.invoke(cli, ["status", "data/output2.txt"])
assert 1 == result.exit_code, format_result_exception(result)
assert "data/output2.txt: source2.txt" in result.output
assert "Modified inputs(1):" in result.output
assert "source1.txt" not in result.output
result = runner.invoke(cli, ["status", source1, output2])
assert 1 == result.exit_code, format_result_exception(result)
assert "data/output1.txt: source1.txt" in result.output
assert "data/output2.txt: source2.txt" in result.output
assert "Modified inputs(2):" in result.output
def test_status_with_path_all_generation(runner, project):
"""Test that all generations are reported if only one of them is specified."""
source = os.path.join(project, "source.txt")
output1 = os.path.join(project, "data", "output1.txt")
output2 = os.path.join(project, "data", "output2.txt")
repo = Repository(project)
write_and_commit_file(repo, source, "content")
assert 0 == runner.invoke(cli, ["run", "--input", source, "touch", output1, output2]).exit_code
write_and_commit_file(repo, source, "new content")
result = runner.invoke(cli, ["status", output1])
assert 1 == result.exit_code, format_result_exception(result)
assert "data/output1.txt: source.txt" in result.output
assert "data/output2.txt: source.txt" in result.output
| 39.0125
| 99
| 0.706825
|
9306c99133778f1288a8c39b0a7c1185b4a81661
| 1,082
|
go
|
Go
|
api/gogiel.go
|
pizza61/la
|
92feaac01cd24013cce7d14cc484bf81726dda9d
|
[
"MIT"
] | null | null | null |
api/gogiel.go
|
pizza61/la
|
92feaac01cd24013cce7d14cc484bf81726dda9d
|
[
"MIT"
] | 3
|
2021-03-08T23:59:37.000Z
|
2021-10-05T20:05:08.000Z
|
api/gogiel.go
|
pizza61/la
|
92feaac01cd24013cce7d14cc484bf81726dda9d
|
[
"MIT"
] | null | null | null |
package api
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"os"
"github.com/labstack/echo"
)
func GetUserData(c echo.Context) (GoogleData, error) {
co, err := c.Cookie("access_token")
if err != nil {
return GoogleData{}, err
}
resp, err := http.Get("https://www.googleapis.com/oauth2/v2/userinfo?access_token=" + co.Value)
if err != nil {
fmt.Println("oboz")
return GoogleData{}, fmt.Errorf("failed getting user info: %s", err.Error())
}
if resp.StatusCode != 200 {
return GoogleData{}, errors.New("nie ma 200")
}
defer resp.Body.Close()
cont, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("oboz")
return GoogleData{}, fmt.Errorf("failed reading resp body: %s", err.Error())
}
var result GoogleData
json.Unmarshal(cont, &result)
return result, nil
}
func GetConfigJson() Config {
jsonF, err := os.Open("config.json")
if err != nil {
fmt.Errorf("nie ma pliku konfiguracyjnego")
}
defer jsonF.Close()
byt, _ := ioutil.ReadAll(jsonF)
var rest Config
json.Unmarshal([]byte(byt), &rest)
return rest
}
| 19.321429
| 96
| 0.666359
|
af5928dab4c3293f4189d69006bc03e0cc886cda
| 4,901
|
py
|
Python
|
src/trw/layers/encoder_decoder_resnet.py
|
civodlu/trw
|
b9a1cf045f61d6df9c65c014ef63b4048972dcdc
|
[
"MIT"
] | 3
|
2019-07-04T01:20:41.000Z
|
2020-01-27T02:36:12.000Z
|
src/trw/layers/encoder_decoder_resnet.py
|
civodlu/trw
|
b9a1cf045f61d6df9c65c014ef63b4048972dcdc
|
[
"MIT"
] | null | null | null |
src/trw/layers/encoder_decoder_resnet.py
|
civodlu/trw
|
b9a1cf045f61d6df9c65c014ef63b4048972dcdc
|
[
"MIT"
] | 2
|
2020-10-19T13:46:06.000Z
|
2021-12-27T02:18:10.000Z
|
import collections
from functools import partial
import copy
from typing import Sequence, Optional, Any, List
import torch.nn as nn
from ..basic_typing import ConvStrides, Activation, TorchTensorNCX
from .layer_config import LayerConfig, default_layer_config, NormType
from .blocks import ConvBlockType, BlockConvNormActivation, \
ConvTransposeBlockType, BlockDeconvNormActivation, BlockRes
class EncoderDecoderResnet(nn.Module):
def __init__(
self,
dimensionality: int,
input_channels: int,
output_channels: int,
encoding_channels: Sequence[int],
decoding_channels: Sequence[int],
*,
nb_residual_blocks: int = 9,
convolution_kernel: int = 3,
encoding_strides: ConvStrides = 2,
decoding_strides: ConvStrides = 2,
activation: Optional[Activation] = None,
encoding_block: ConvBlockType = BlockConvNormActivation,
decoding_block: ConvTransposeBlockType = BlockDeconvNormActivation,
init_block=partial(BlockConvNormActivation, kernel_size=7),
middle_block: Any = BlockRes,
out_block=partial(BlockConvNormActivation, kernel_size=7),
config: LayerConfig = default_layer_config(
conv_kwargs={'padding': 'same', 'bias': False, 'padding_mode': 'reflect'},
deconv_kwargs={'padding': 'same', 'bias': False},
norm_type=NormType.BatchNorm,
activation=nn.ReLU)):
super().__init__()
#
# encoding path
#
nb_convs = len(encoding_channels)
if not isinstance(encoding_strides, collections.Sequence):
encoding_strides = [encoding_strides] * nb_convs
assert len(encoding_strides) == nb_convs
config_enc = copy.copy(config)
config_enc.set_dim(dimensionality)
if activation is not None:
config_enc.activation = activation
intermediate_channels = encoding_channels[0] // 2
cur = input_channels
prev = input_channels
if init_block is not None:
self.initial = init_block(
config=config_enc,
input_channels=input_channels,
output_channels=intermediate_channels,
stride=1)
prev = intermediate_channels
self.encoders = nn.ModuleList() # do NOT store in a list, else the layer parameters will not be found!
for cur, stride in zip(encoding_channels, encoding_strides):
assert isinstance(stride, (int, tuple))
block = encoding_block(config_enc, prev, cur, kernel_size=convolution_kernel, stride=stride)
prev = cur
self.encoders.append(block)
self.residuals = nn.ModuleList() # do NOT store in a list, else the layer parameters will not be found!
for n in range(nb_residual_blocks):
self.residuals.append(middle_block(config=config_enc, input_channels=cur, kernel_size=convolution_kernel))
#
# decoding path
#
config_dec = copy.copy(config)
config_dec.set_dim(dimensionality)
if activation is not None:
config_dec.activation = activation
nb_convs = len(decoding_channels)
if not isinstance(decoding_strides, collections.Sequence):
decoding_strides = [decoding_strides] * nb_convs
assert len(decoding_strides) == nb_convs
self.decoders = nn.ModuleList() # do NOT store in a list, else the layer parameters will not be found!
for cur, stride in zip(decoding_channels, encoding_strides):
assert isinstance(stride, int), 'todo: tuple not handled'
block = decoding_block(
config_dec,
prev,
cur,
kernel_size=convolution_kernel,
stride=stride,
output_padding=stride - 1)
prev = cur
self.decoders.append(block)
config_dec.activation = None # no activation for the last layer
config_dec.norm = None
self.out = out_block(config_dec, prev, output_channels)
def forward(self, x: TorchTensorNCX) -> TorchTensorNCX:
intermediates = self.forward_with_intermediate(x)
return intermediates[-1]
def forward_with_intermediate(self, x: TorchTensorNCX) -> List[TorchTensorNCX]:
intermediates = []
x = self.initial(x)
for encoder in self.encoders:
x = encoder(x)
intermediates.append(x)
for residual in self.residuals:
x = residual(x)
intermediates.append(x)
for decoder in self.decoders:
x = decoder(x)
intermediates.append(x)
x = self.out(x)
intermediates.append(x)
return intermediates
| 38.289063
| 118
| 0.629463
|
8d9e58170aa955b4be6a91b6b3c5d1f6c006a4c4
| 3,216
|
js
|
JavaScript
|
node_modules/arcgis-js-api/views/2d/input/MapViewInputManager.js
|
rihorn/ky-libaries
|
a3ae1e743b62b9784cd62c4983740c6bc037fbf1
|
[
"Apache-2.0"
] | null | null | null |
node_modules/arcgis-js-api/views/2d/input/MapViewInputManager.js
|
rihorn/ky-libaries
|
a3ae1e743b62b9784cd62c4983740c6bc037fbf1
|
[
"Apache-2.0"
] | null | null | null |
node_modules/arcgis-js-api/views/2d/input/MapViewInputManager.js
|
rihorn/ky-libaries
|
a3ae1e743b62b9784cd62c4983740c6bc037fbf1
|
[
"Apache-2.0"
] | null | null | null |
// COPYRIGHT © 2018 Esri
//
// All rights reserved under the copyright laws of the United States
// and applicable international laws, treaties, and conventions.
//
// This material is licensed for use under the Esri Master License
// Agreement (MLA), and is bound by the terms of that agreement.
// You may redistribute and use this code without modification,
// provided you adhere to the terms of the MLA and include this
// copyright notice.
//
// See use restrictions at http://www.esri.com/legal/pdfs/mla_e204_e300/english
//
// For additional information, contact:
// Environmental Systems Research Institute, Inc.
// Attn: Contracts and Legal Services Department
// 380 New York Street
// Redlands, California, USA 92373
// USA
//
// email: contracts@esri.com
//
// See http://js.arcgis.com/4.10/esri/copyright.txt for details.
define(["require","exports","../../../core/tsSupport/declareExtendsHelper","../../../core/tsSupport/decorateHelper","../../../core/Accessor","../../../core/Handles","../../../core/watchUtils","../../../core/accessorSupport/decorators","./handlers/DoubleClickZoom","./handlers/DragPan","./handlers/DragRotate","./handlers/GamepadNavigation","./handlers/KeyPan","./handlers/KeyRotate","./handlers/KeyZoom","./handlers/MouseWheelZoom","./handlers/PinchAction","../../input/BrowserEventSource","../../input/InputManager","../../input/ViewEvents","../../input/handlers/PreventContextMenu"],function(e,t,n,o,i,r,s,a,c,h,u,l,w,p,d,v,y,_,m,g,f){var M={counter:"Ctrl",pan:{left:"ArrowLeft",right:"ArrowRight",up:"ArrowUp",down:"ArrowDown"},zoom:{zoomIn:["=","+"],zoomOut:["-","_"]},rotate:{clockwiseOption1:"a",clockwiseOption2:"A",counterClockwiseOption1:"d",counterClockwiseOption2:"D",resetOption1:"n",resetOption2:"N"}};return function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._handles=new r,t}return n(t,e),t.prototype.initialize=function(){var e=this;this.viewEvents=new g.ViewEvents(this.view),this._handles.add([s.whenNot(this.view,"ready",function(){return e._disconnect()}),s.when(this.view,"ready",function(){return e._connect()})])},t.prototype.destroy=function(){this._handles&&(this._handles.removeAll(),this._handles=null),this._disconnect(),this.viewEvents.destroy(),this.viewEvents=null},t.prototype._disconnect=function(){this._inputManager&&(this.viewEvents.disconnect(),this._inputManager.destroy(),this._inputManager=null,this._source.destroy(),this._source=null)},t.prototype._connect=function(){var e=this.view.surface,t=new _.BrowserEventSource(e,this.view.input),n=new m.InputManager(t);n.installHandlers("prevent-context-menu",[new f.PreventContextMenu]),n.installHandlers("navigation",[new y.PinchRotateAndZoom(this.view),new l.GamepadNavigation(this.view),new v.MouseWheelZoom(this.view),new c.DoubleClickZoom(this.view),new h.DragPan(this.view,"primary"),new w.KeyPan(this.view,M.pan),new d.KeyZoom(this.view,M.zoom),new p.KeyRotate(this.view,M.rotate),new u.DragRotate(this.view,"secondary"),new c.DoubleClickZoom(this.view,[M.counter])]),this.viewEvents.connect(n),this._source=t,this._inputManager=n},o([a.property()],t.prototype,"view",void 0),t=o([a.subclass("esri.views.2d.input.MapViewInputManager")],t)}(a.declared(i))});
| 128.64
| 2,379
| 0.742537
|
df4c5d7ce9a9aaa4182c9856ac1e6525501cfdec
| 217
|
cs
|
C#
|
FCommerce/FCommerce.Core/Context/IContext.cs
|
RedNoo/FCommerce
|
8d18d4aedc1db0bca28993b54bf52e16696883c1
|
[
"MIT"
] | null | null | null |
FCommerce/FCommerce.Core/Context/IContext.cs
|
RedNoo/FCommerce
|
8d18d4aedc1db0bca28993b54bf52e16696883c1
|
[
"MIT"
] | null | null | null |
FCommerce/FCommerce.Core/Context/IContext.cs
|
RedNoo/FCommerce
|
8d18d4aedc1db0bca28993b54bf52e16696883c1
|
[
"MIT"
] | null | null | null |
using FCommerce.Core.Command;
using FCommerce.Core.Query;
namespace FCommerce.Core.Context
{
public interface IContext
{
T Query<T>(IQuery<T> query);
int? Execute(ICommand command);
}
}
| 16.692308
| 39
| 0.663594
|
3f86994f0791496cffbb148340b3540fe2417d41
| 2,003
|
php
|
PHP
|
frontend/components/views/first-modal.php
|
AliaksandrHaurylenka/belstekloprom.new
|
b3dd400cfd34f3f0e0b05a43cd09468579b9999b
|
[
"BSD-3-Clause"
] | null | null | null |
frontend/components/views/first-modal.php
|
AliaksandrHaurylenka/belstekloprom.new
|
b3dd400cfd34f3f0e0b05a43cd09468579b9999b
|
[
"BSD-3-Clause"
] | null | null | null |
frontend/components/views/first-modal.php
|
AliaksandrHaurylenka/belstekloprom.new
|
b3dd400cfd34f3f0e0b05a43cd09468579b9999b
|
[
"BSD-3-Clause"
] | null | null | null |
<?
use yii\helpers\Html;
?>
<h2>Новинки производства</h2>
<?php foreach ($firstModal as $first): ?>
<div class="d-flex justify-content-around pt-2 carousel-item">
<img class="d-block img-fluid img-new" src="images/bottle/<?= $first['name_2'] ?>.png"
alt="<?= $first['name_1'] ?>"
title="стеклянные бутылки <?= $first['type'] . '-' .
$first['venchik'] . '-' .
$first['volume'] . '-' .
$first['number'] .
' (' . $first['name_1'] . ')'
?>"
>
<table class="table table-striped table-sm w-75 table-new">
<thead>
<tr>
<th colspan="2">
<?= Html::a(
"$first[name_1]",//текст ссылки
[//url ссылки
"site/bottle-$first[venchik_en]",
// 'id' => $first[name_2]
],
[
//массив атрибута тэга 'a' (ссылки)
'class' => "pictogramm-$first[venchik_en]",
// 'id' => "pictogramm-$first[name_2]"
]
)
?>
</th>
</tr>
</thead>
<tbody>
<tr>
<td><?= Yii::t('common', 'Обозначение') ?>:</td>
<td><?= $first['type'] . '-' . $first['venchik'] . '-' . $first['volume'] . '-' . $first['number'] ?></td>
</tr>
<tr>
<td><?= Yii::t('common', 'Тип венчика') ?>:</td>
<td><?= $first['venchik'] ?></td>
</tr>
<tr>
<td><?= Yii::t('common', 'Высота') ?>:</td>
<td><?= $first['height'];
echo $first['dev_1'] ?> мм
</td>
</tr>
<tr>
<td><?= Yii::t('common', 'Диаметр') ?>:</td>
<td><?= $first['diameter'];
echo $first['dev_2'] ?> мм
</td>
</tr>
<tr>
<td><?= Yii::t('common', 'Объем') ?>:</td>
<td><?= $first['volume'] ?> ml</td>
</tr>
</tbody>
</table>
</div>
<?php endforeach; ?>
| 30.348485
| 115
| 0.393909
|
83423b7bf67d97da5c1c60bb08a76acbd0ba1245
| 989
|
ts
|
TypeScript
|
app/styles/buttons.ts
|
gmarler/angular2-deep-dive
|
93df0ae231b76c08be5d12993273a8095ca2516b
|
[
"MIT"
] | null | null | null |
app/styles/buttons.ts
|
gmarler/angular2-deep-dive
|
93df0ae231b76c08be5d12993273a8095ca2516b
|
[
"MIT"
] | null | null | null |
app/styles/buttons.ts
|
gmarler/angular2-deep-dive
|
93df0ae231b76c08be5d12993273a8095ca2516b
|
[
"MIT"
] | null | null | null |
import {COLORS} from './colors';
export const BUTTONS = `
.btn {
text-transform: uppercase;
border: none;
-webkit-box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.4);
box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.4);
-webkit-transition: all 0.4s;
-o-transition: all 0.4s;
transition: all 0.4s;
display: inline-block;
margin-bottom: 0;
font-weight: normal;
text-align: center;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
background-image: none;
border: 1px solid transparent;
white-space: nowrap;
padding: 6px 16px;
font-size: 13px;
line-height: 1.846;
border-radius: 3px;
-webkit-user-select: none;
}
.btn-info {
color: #ffffff;
background-color: ${COLORS.quinary};
}
.btn-danger {
color: #ffffff;
background-color: ${COLORS.primary};
}
.btn-success {
color: #ffffff;
background-color: ${COLORS.tertiary};
}
`;
| 21.977778
| 55
| 0.617796
|
a1f6f4ae30d57607aedab0f270e725c0bed4316d
| 86,728
|
lua
|
Lua
|
Assets/sgk/Lua/module/TeamModule.lua
|
freeGamePerson/dev_update
|
80f75ff1ba6fd0d008e6a4989c2ba09e48129c38
|
[
"BSD-3-Clause"
] | 1
|
2019-12-30T06:54:48.000Z
|
2019-12-30T06:54:48.000Z
|
Assets/sgk/Lua/module/TeamModule.lua
|
freeGamePerson/dev_update
|
80f75ff1ba6fd0d008e6a4989c2ba09e48129c38
|
[
"BSD-3-Clause"
] | null | null | null |
Assets/sgk/Lua/module/TeamModule.lua
|
freeGamePerson/dev_update
|
80f75ff1ba6fd0d008e6a4989c2ba09e48129c38
|
[
"BSD-3-Clause"
] | 3
|
2019-12-30T06:54:52.000Z
|
2020-12-31T10:04:10.000Z
|
local NetworkService = require "utils.NetworkService"
local EventManager = require "utils.EventManager"
local Time = require "module.Time"
local playerModule = require "module.playerModule"
local Property = require "utils.Property"
local UserDefault = require "utils.UserDefault";
local PlayerInfoHelper = require "utils.PlayerInfoHelper"
local SmallTeamDungeonConf = require "config.SmallTeamDungeonConf"
local MapConfig = require "config.MapConfig"
-- prepare
local C_TEAM_INPLACE_CHECK_REQUEST = 18130 -- {sn}
local C_TEAM_INPLACE_CHECK_RESPOND = 18131 -- {sn, result}
local C_TEAM_INPLACE_READY_REQUEST = 18132 -- {sn}
local C_TEAM_INPLACE_READY_RESPOND = 18133 -- {sn, result}
local NOTIFY_TEAM_INPLACE_CHECK = 16005 -- {}
local NOTIFY_TEAM_INPLACE_READY = 16006 -- {pid}
-- in fight
local NOTIFY_TEAM_ADD_MONSTER = 16007 -- {data}
local NOTIFY_TEAM_MONSTER_SYNC = 16008 -- {data}
local C_TEAM_SYNC_REQUEST = 18140 -- {sn, type, data}
local C_TEAM_SYNC_RESPOND = 18141 -- {sn, result}
local teamInfo = nil;
local Sn2Data = {};
local waiting_thread = {}
local function getTeamInfo()
if teamInfo == nil then
teamInfo = { id = -1, group = 0, members = {}, waiting = {}, chat = {}, leader = {}, afk_list = {},invite = nil}
NetworkService.Send(16064, {})
NetworkService.Send(18110, {});
end
if teamInfo.id < 0 and coroutine.isyieldable() and waiting_thread then
waiting_thread[#waiting_thread+1] = coroutine.running();
coroutine.yield();
end
return teamInfo;
end
local function getTeamMembers(type)
if type then
local members = getTeamInfo().members
local list = {}
if type == 1 then--剔除afk玩家
for i = 1,#members do
if module.TeamModule.getAFKMembers(members[i].pid) ~= true and module.MapModule.GetPlayerStatus(members[i].pid) == 0 then
list[#list+1] = members[i]
end
end
return list
end
end
return getTeamInfo().members;
end
local function getAFKMembers(pid)
if pid then
local list = getTeamInfo().afk_list
if list[pid] then
return true
end
return false
end
return getTeamInfo().afk_list
end
local function getTeamWaitingList()
return getTeamInfo().waiting;
end
local function getTeamChatLog()
return getTeamInfo().chat;
end
local function getTeamApply()--申请列表
local list = {}
for k,v in pairs(getTeamInfo().waiting)do
list[#list + 1] = v
end
return list;
end
local function getTeamInvite()--邀请列表
if not getTeamInfo() or getTeamInfo().invite == nil then
NetworkService.Send(18154);
return {}
end
local list = {}
if getTeamInfo() and getTeamInfo().invite then
for k,v in pairs(getTeamInfo().invite)do
list[#list + 1] = v
end
end
return list;
end
local teamGroup = {}
local function updateTeamGroup(id, group, member_count, leader_pid, leader_name, joinRequest,lower_limit,upper_limit,member_id)
teamGroup[group] = teamGroup[group] or {time = 0, teams = {}};
if member_count == 0 then
teamGroup[group].teams[id] = nil;
else
teamGroup[group].teams[id] = {
id = id, member_count = member_count,member_id = member_id,
leader = { pid = leader_pid, name = leader_name},
joinRequest = joinRequest or false,
lower_limit = lower_limit,
upper_limit = upper_limit,
};
end
end
local function HeroData(code)
if code then
local info = ProtobufDecode(code, "com.agame.protocol.FightPlayer")
local heros = {}
-- ERROR_LOG(sprinttb(info.roles))
for k, v in ipairs(info.roles) do
heros[k] = {
id = v.id,
level = v.level,
mode = v.mode,
skills = v.skills,
equips = v.equips,
uuid = v.uuid,
star = v.grow_star,
stage = v.grow_stage,
pos = v.pos,
--combat = capacity,
}
local t = {}
for _, vv in ipairs(v.propertys) do
t[vv.type] = vv.value
end
heros[k].property = Property(t);
end
return heros
else
-- print("玩家编队信息数据为空!")
return nil;
end
end
local Is_NewMember = false
local function updateTeamInfo(data)
if data[1] == 0 then
-- print("player have no team");
if teamInfo and teamInfo.id > 0 and teamGroup[teamInfo.group] then
teamGroup[teamInfo.group][teamInfo.id] = nil;
end
teamInfo = {id = 0, group = 0, members = {}, waiting = {}, chat = {},afk_list = {}}
EventManager.getInstance():dispatch("TEAM_INFO_CHANGE", teamInfo);
EventManager.getInstance():dispatch("TEAM_MEMBER_CHANGE");
return;
end
if Is_NewMember then
Is_NewMember = false
DispatchEvent("Add_team_succeed",{pid = module.playerModule.GetSelfID()})--加入小队
module.CemeteryModule.RestTEAMRecord()
end
teamInfo = {
id = data[1],
group = data[2],
-- leader = nil,
auto_confirm = data[4],
members = {},
waiting = {},
chat = {},
auto_match = data[7],
team_status = data[8],
lower_limit = data[9],
upper_limit = data[10],
is_checking_ready = data[11],
afk_list = {},
}
-- ERROR_LOG("teamInfo->>>"..sprinttb(data))
for i, v in ipairs(data[5]) do
local player = {
pid = v[1],
pos = v[2],
level = v[3],
name = v[4],
heros = {},
is_ready = v[6],
};
player.heros = HeroData(v[5])
-----------------------------
-- local info = {roles = {}} -- ProtobufDecode(v[5], "com.agame.protocol.FightPlayer")
-- --local heros = {}
-- for k, v in ipairs(info.roles) do
-- player.heros[k] = {
-- id = v.id,
-- level = v.level,
-- mode = v.mode,
-- skills = v.skills,
-- equips = v.equips,
-- uuid = v.uuid,
-- }
-- local t = {}
-- for _, vv in ipairs(v.propertys) do
-- t[vv.type] = vv.value
-- end
-- player.heros[k].property = Property(t);
-- end
-----------------------------
if module.playerModule.IsDataExist(player.pid) then
player.level = module.playerModule.IsDataExist(player.pid).level
--ERROR_LOG(">"..player.level)
else
module.playerModule.Get(player.pid,(function( ... )
player.level = module.playerModule.IsDataExist(player.pid).level
teamInfo.members[i] = player;
end))
end
teamInfo.members[i] = player;
teamInfo.afk_list[player.pid] = false
if player.pid == data[3] then
teamInfo.leader = player;
end
-- ERROR_LOG("========>>>查询到队友PID",player.pid);
end
-- ERROR_LOG(sprinttb(data[12]))
if data[12] then
for i = 1,#data[12] do
teamInfo.afk_list[data[12][i]] = true
end
end
for i, v in ipairs(data[6]) do
local player = { pid = v[1], level = v[2], name = v[3]};
teamInfo.waiting[player.pid] = player;
module.playerModule.GetFightData(v[1])--获取申请人数据
local _player = module.playerModule.IsDataExist(v[1])
if _player then
if _player.honor == 9999 then
module.TeamModule.ConfiremTeamJoinRequest(v[1]);
end
else
module.playerModule.Get(v[1],function( ... )
if module.playerModule.IsDataExist(v[1]).honor == 9999 then
module.TeamModule.ConfiremTeamJoinRequest(v[1]);
end
end)
end
end
for _, group in pairs(teamGroup) do
for _, v in pairs(group.teams) do
v.joinRequest = false
end
end
local vote_info = {
inplace = {}, -- 就位确认投票
leader = {}, -- 申请队长投票
}
if type(data[11]) == "table" then
if data[11][1] then
vote_info.inplace.end_time = data[11][1][1];
vote_info.inplace.type = data[11][1][2];
vote_info.inplace.members = data[11][1][3] or {};
teamInfo.is_checking_ready = vote_info.inplace.end_time;
for k, v in ipairs(vote_info.inplace.members or {}) do
teamInfo.members[k].is_ready = v;
end
end
if data[11][2] then
vote_info.leader.end_time = data[11][2][1];
vote_info.leader.pid = data[11][2][2];
vote_info.leader.members = data[11][2][3] or {};
end
end
teamInfo.vote_info = vote_info;
if #data > 0 and module.playerModule.GetSelfID() ~= teamInfo.leader.pid then
-- ERROR_LOG("查询队长位置 ----战斗");
module.TeamModule.QueryLeaderInfo(); --查询队长位置
end
EventManager.getInstance():dispatch("TEAM_INFO_CHANGE", teamInfo);
EventManager.getInstance():dispatch("TEAM_MEMBER_CHANGE");
EventManager.getInstance():dispatch("TEAM_LIST_CHANGE");
EventManager.getInstance():dispatch("TEAM_JOIN_REQUEST_CHANGE");
end
local function updateTeamMemberLevel(pid,lv)
for k,v in pairs (teamInfo.members) do
if v.pid == pid then
teamInfo.members[k].level = lv
break
end
end
-- ERROR_LOG("更新玩家",pid);
EventManager.getInstance():dispatch("updateTeamMember");
end
local function getTeamList(group, refresh)
if teamGroup[group] == nil then
teamGroup[group] = {time = 0, teams = {} }
end
local diff = refresh and 10 or (60 * 5);
if teamGroup[group].time + diff < Time.now() then
teamGroup[group].time = Time.now();
NetworkService.Send(18112, {nil, group});
end
return teamGroup[group].teams;
end
local Invites = nil;
local function SendReQuestInvite(team_id,status,func)
local sn = NetworkService.Send(18156,{nil,team_id,status});
Invites = Invites or {};
Invites[sn] = func;
end
EventManager.getInstance():addListener("server_respond_18113", function(event, cmd, data)
-- ERROR_LOG("server_respond_18113",sprinttb(data));
if data[2] ~= 0 then
-- print("load team list failed")
return;
end
-- ERROR_LOG("server_respond_18113",sprinttb(data))
local group = data[3];
teamGroup[group] = {time = Time.now(), teams = {} };
for _, v in ipairs(data[4]) do
updateTeamGroup(v[1], group, v[2], v[3], v[4], v[5],v[6],v[7],v[8]);
end
EventManager.getInstance():dispatch("TEAM_LIST_CHANGE", group);
end)
local createTeamSN = {}
local function createTeam(group,Fun,level1,level2)
if not teamInfo then
-- print("loading team info")
return;
end
if teamInfo.id ~= 0 then
-- print("already in a team");
return false;
end
local StackList = SceneStack.GetStack()
StackList = StackList[#StackList]
level1 = level1 or 1
level2 = level2 or 80
if StackList.savedValues.mapType and (StackList.savedValues.mapType == 1 or StackList.savedValues.mapType == 4) then
--showDlg(nil,"创建队伍后将离开当前场景",function()
local sn = NetworkService.Send(18114, {nil, group})--创建队伍
createTeamSN[sn] = Fun
NetworkService.Send(18184, {nil,level1,level2})
--end,function()end)
else
local sn = NetworkService.Send(18114, {nil, group})--创建队伍
createTeamSN[sn] = Fun
NetworkService.Send(18184, {nil,level1,level2})
end
end
local TeamChangeDlgTime = 0
local function TeamChangeDlg(type)
local Time = require "module.Time"
if TeamChangeDlgTime + 2 < Time.now() then
TeamChangeDlgTime = Time.now()
if type == 1 then
showDlgError(nil,SGK.Localize:getInstance():getValue("team_1"))
elseif type == 2 then
showDlgError(nil,SGK.Localize:getInstance():getValue("team_2"))
end
end
end
EventManager.getInstance():addListener("server_respond_18115", function(event, cmd, data)
-- ERROR_LOG("server_respond_18115",sprinttb(data));
if data[2] ~= 0 then
-- print("create team failed")
return;
end
if createTeamSN[data[1]] then
createTeamSN[data[1]]()
createTeamSN[data[1]] = nil
end
--创建队伍成功
TeamChangeDlg(1)
--[[
local StackList = SceneStack.GetStack()
StackList = StackList[#StackList]
--ERROR_LOG(StackList.savedValues.mapType)
if StackList.savedValues.mapType and (StackList.savedValues.mapType == 1 or StackList.savedValues.mapType == 4) then
SceneStack.EnterMap(10)
end
--]]
DispatchEvent("create_team_succeed")
-- updateTeamInfo(data[3]);
end)
local sn2teamid = {}
local function joinTeam(teamid)
if not teamInfo then
-- print("loading team info")
return;
end
if teamInfo.id ~= 0 then
-- print("already in a team")
return;
end
if SceneStack.GetBattleStatus() then
showDlgError(nil,"正在战斗中,无法进行该操作")
return
end
local sn = NetworkService.Send(18116, {nil, teamid})
sn2teamid[sn] = teamid;
end
EventManager.getInstance():addListener("server_respond_18117", function(event, cmd, data)
-- ERROR_LOG("server_respond_18117",sprinttb(data));
local sn = data[1];
local teamid = sn2teamid[sn];
sn2teamid[sn] = nil;
if data[2] == 0 then
for _, group in pairs(teamGroup) do
for _, v in pairs(group.teams) do
-- print("--", v.id)
if v.id == teamid then
v.joinRequest = true;
--EventManager.getInstance():dispatch("TEAM_LIST_CHANGE");
end
end
end
showDlgError(nil,"申请成功")
elseif data[2] == 52 then
showDlgError(nil,"不符合队伍所需等级")
else
showDlgError(nil,"加入队伍失败")
end
EventManager.getInstance():dispatch("LOCAL_TEAM_JOIN_CHANGE")
end);
local confiremTeamJoinRequest_sn = {}
local function confiremTeamJoinRequest(pid)
if not teamInfo then
-- print("loading team info")
return;
end
if teamInfo.id <= 0 then
-- print("not in a team")
return;
end
if not teamInfo.waiting[pid] then
-- print("player not waiting")
return;
end
if teamInfo.leader.pid ~= playerModule.GetSelfID() then
-- print("not leader")
return;
end
local sn = NetworkService.Send(18118, {nil, pid})
confiremTeamJoinRequest_sn[sn] = pid
return sn
end
EventManager.getInstance():addListener("server_respond_18119", function(event, cmd, data)
-- ERROR_LOG("server_respond_18119",sprinttb(data));
--审批玩家申请
-- ERROR_LOG("18119",sprinttb(data))
local sn = data[1]
if data[2] == 0 then
DispatchEvent("JOIN_CONFIRM_REQUEST")
elseif data[2] == 11 then--权限不足
showDlgError(nil,"权限不足")
elseif data[2] == 3 then--不在申请类表
showDlgError(nil,"不在申请类表")
elseif data[2] == 824 then--已经有队伍
showDlgError(nil,"该玩家已经有队伍了")
elseif data[2] == 1 then--加入队伍失败
showDlgError(nil,"加入队伍失败")
elseif data[2] == 9 then
showDlgError(nil,"队伍人数已满")
elseif data[2] == 1007 then
showDlgError(nil,"该玩家不在线")
end
if data[2] ~= 1 then
local pid = confiremTeamJoinRequest_sn[sn]
module.TeamModule.delApply(pid)
end
end);
local function findTeamMember(pid)
if not teamInfo then
-- print("loading team info")
return;
end
for k, v in ipairs(teamInfo.members) do
if v.pid == pid then
return k, v;
end
end
end
local kickTeamMember_Tips = true
local function kickTeamMember(pid)
if not teamInfo then
-- print("loading team info")
return;
end
pid = pid or playerModule.GetSelfID();
if teamInfo.id <= 0 then
-- print("not in a team")
return;
end
if pid ~= playerModule.GetSelfID() and teamInfo.leader.pid ~= playerModule.GetSelfID() then
-- print("not leader")
return;
end
if not findTeamMember(pid) then
-- print('player not in you team')
return;
end
if pid == playerModule.GetSelfID() then
kickTeamMember_Tips = false
else
kickTeamMember_Tips = true
end
local sn = NetworkService.Send(18120, {nil, pid})
Sn2Data[sn] = pid;
return;
end
EventManager.getInstance():addListener("server_respond_18121", function(event, cmd, data)
-- ERROR_LOG("server_respond_18121",sprinttb(data));
local sn = data[1];
if data[2] == 0 then
DispatchEvent("kICKTEAMSUCCESS", Sn2Data[sn]);
end
end);
local function chatToTeam(msg, type)
if not teamInfo then
-- print("loading team info")
return;
end
type = type or 0;
if teamInfo.id <= 0 then
-- print("not in a team")
return;
end
return NetworkService.Send(18122, {nil, type, msg})
end
EventManager.getInstance():addListener("server_respond_18123", function(event, cmd, data)
ERROR_LOG("server_respond_18123",sprinttb(data));
if data[2] ~= 0 then
showDlgError(nil,"发送失败")
end
end)
local function setTeamAutoConfirm(b)
if not teamInfo then
-- print("loading team info")
return;
end
if teamInfo.id <= 0 then
-- print("not in a team")
return;
end
if teamInfo.leader.pid ~= playerModule.GetSelfID() then
-- print("not leader")
return;
end
teamInfo.auto_confirm = b;
NetworkService.Send(18124, {nil, b})
end
--[[
EventManager.getInstance():addListener("server_respond_18125", function(event, cmd, data)
end);
--]]
local delApplySN = {}
local function delApply( pid )
--删除申请
--ERROR_LOG(pid)
local sn = NetworkService.Send(18150,{nil,pid})
delApplySN[sn] = pid
end
EventManager.getInstance():addListener("server_respond_18151", function(event, cmd, data)
print("18151->"..sprinttb(data))
if data[2] ~= 0 then
showDlgError(nil,"删除申请人失败")
return
end
if delApplySN[data[1]] then
if delApplySN[data[1]] == 0 then
--全部删除
teamInfo.waiting = {}
else
teamInfo.waiting[delApplySN[data[1]]] = nil
end
delApplySN[data[1]] = nil
end
DispatchEvent("delApply_succeed")
end)
local playerMatchingType = 0--是否匹配中
local function GetplayerMatchingType()
return playerMatchingType
end
local playerMatchingSN = {}
local function playerMatching(groupId)
--玩家匹配
local sn = NetworkService.Send(18158,{nil,groupId})
playerMatchingSN[sn] = groupId
end
EventManager.getInstance():addListener("server_respond_18159", function(event, cmd, data)
print("玩家开启(关闭)自动匹配18159->"..sprinttb(data))
if data[2] ~= 0 then
showDlgError(nil,"匹配失败")
return
end
if playerMatchingSN[data[1]] then
playerMatchingType = playerMatchingSN[data[1]]
playerMatchingSN[data[1]] = nil
end
DispatchEvent("playerMatching_succeed",{auto_match_success = data[3]})
end)
--local TeamMatchingSN = {}
local function TeamMatching(open)
--队伍匹配
NetworkService.Send(18160,{nil,open})
--local sn = NetworkService.Send(18160,{nil,open})
--TeamMatchingSN[sn] = open
end
EventManager.getInstance():addListener("server_respond_18161", function(event, cmd, data)
ERROR_LOG("18161->",sprinttb(data))
-- if data[2] ~= 0 then
-- showDlgError(nil,"队伍匹配失败")
-- return
-- end
-- if TeamMatchingSN[data[1]] ~= nil then
-- teamInfo.auto_match = TeamMatchingSN[data[1]]
-- TeamMatchingSN[data[1]] = nil
-- end
-- DispatchEvent("TeamMatching_succeed")
end)
EventManager.getInstance():addListener("server_notify_18160", function(event, cmd, data)
--队伍匹配通知
ERROR_LOG("server_notify_18160",sprinttb(data))
teamInfo.auto_match = data[1]
DispatchEvent("TeamMatching_succeed")
end)
local Invite_List = {}
local function GetInvite_List(id)
if id then
return Invite_List[id]
end
return Invite_List
end
local function invitePlayer(pid)
Invite_List[pid] = true
NetworkService.Send(18152, {nil, pid});
end
EventManager.getInstance():addListener("server_respond_18153", function(event, cmd, data)
if data[2] == 0 then
showDlgError(nil,"邀请已发送")
elseif data[2] == 824 then
showDlgError(nil,"该玩家已在队伍中")
else
showDlgError(nil,"对方已有队伍")
--showDlgError(nil,"邀请失败"..data[2])
end
end)
local function watchTeamGroup(group)
NetworkService.Send(18126, {nil, group})
end
local sync_flag = nil;
local function syncTeamData(type, msg)
if not teamInfo and type >= 300 then
-- print("loading team info")
return;
end
if teamInfo.id <= 0 then
-- print("not in a team")
return;
end
if type == 201 then
if msg[1] == 1 then
sync_flag = true;
else
if not sync_flag then
return ;
end
sync_flag = nil;
end
end
-- ERROR_LOG();
NetworkService.Send(18140, {nil, type, msg})
end
local function syncFightData(type, msg)
NetworkService.Send(16040, {nil, type, msg})
end
local function memberIsReady(pid)
pid = pid or playerModule.GetSelfID();
local _, player = findTeamMember(pid);
return player and player.is_ready;
end
local function memberSetReady(pid, ready)
pid = pid or playerModule.GetSelfID();
local _, player = findTeamMember(pid);
if player and player.is_ready ~= ready then
player.is_ready = ready;
return true;
end
end
local function readyToFight(ready)
if not teamInfo then
-- print("loading team info")
return;
end
if teamInfo.id <= 0 then
-- print("not in a team")
return;
end
if teamInfo.leader.pid == playerModule.GetSelfID() and not teamInfo.is_checking_ready then
if teamInfo.is_checking_ready then
-- print("checking");
return
end
teamInfo.is_checking_ready = true;
NetworkService.Send(18130, {});
else
if not teamInfo.is_checking_ready then
-- print("not checking");
return
else
if memberIsReady() == ready then
-- print("ready status not change")
return;
end
NetworkService.Send(18132, {nil, ready});
end
end
end
local FightCallback = nil
local function getCallBack()
return FightCallback;
end
local function GetAfkStatus(pid)
if not pid then
pid = module.playerModule.GetSelfID();
end
if teamInfo.afk_list then
return teamInfo.afk_list[math.floor(pid)]
end
end
local function GetFirstMember()
local _members = getTeamMembers(1);
local selfPid = module.playerModule.GetSelfID();
for i=1,#_members do
if _members[i].pid ~= selfPid then
return _members[i];
end
end
end
local function MoveHeaderToMember(pid)
--如果当前队员状态为暂离
if GetAfkStatus( pid ) == true then
return 1;
end
-- print("send 18180 and "..pid);
NetworkService.Send(18180, {nil,pid})
end
local function NewReadyToFight(Type,callback)
FightCallback = callback;
--Type0就位确认1战前确认
NetworkService.Send(18130, {nil,Type});
end
local is_first_query_team = nil;
local function ResumeTeamFight()
if is_first_query_team then
syncFightData(10);
is_first_query_team = nil
end
end
EventManager.getInstance():addListener("server_respond_18111", function(event, cmd, data)
if data[2] ~= 0 then
-- print("query team info failed")
teamInfo = nil;
local _last_waiting_thread = waiting_thread;
waiting_thread = {};
for _, co in ipairs(_last_waiting_thread) do
coroutine.resume(co);
end
return;
end
updateTeamInfo(data[3]);
module.CemeteryModule.RestTEAMRecord()
utils.SGKTools.SynchronousPlayStatus({6,module.playerModule.GetSelfID(),0})--0无自由,1自由
if teamInfo and teamInfo.id >= 0 then
-- if is_first_query_team then
-- syncFightData(10); -- 恢复团队/PVP战斗
-- end
is_first_query_team = true
end
-- is_first_query_team = false;
local _last_waiting_thread = waiting_thread;
waiting_thread = {};
for _, co in ipairs(_last_waiting_thread) do
coroutine.resume(co);
end
end);
local _AFK_callback = nil;
local function TEAM_AFK_REQUEST(AFK_callback,pid)--AFK
_AFK_callback = AFK_callback;
-- ERROR_LOG("暂离=====================", debug.traceback());
NetworkService.Send(18292, {nil,pid});
end
EventManager.getInstance():addListener("server_respond_18293", function(event, cmd, data)
-- ERROR_LOG("暂离回调","server_respond_18293",sprinttb(data))
local sn = data[1]
local err = data[2]
if _AFK_callback then
-- print("暂离回调错误号",err);
_AFK_callback(err);
end
if err == 0 then
print("队伍信息",sprinttb(getTeamInfo()));
else
showDlgError(nil,"暂离进入失败")
end
end)
local AFK_TEAM_CALL = nil
local function TEAM_AFK_RESPOND(func)--AFK回归
local sn = NetworkService.Send(18294);
AFK_TEAM_CALL = func;
end
EventManager.getInstance():addListener("server_respond_18295", function(event, cmd, data)
-- ERROR_LOG("回归队伍","server_respond_18295",sprinttb(data))
if AFK_TEAM_CALL then
AFK_TEAM_CALL(data[2]);
AFK_TEAM_CALL = nil;
end
local sn = data[1]
local err = data[2]
if err == 0 then
ERROR_LOG("回归后,查询队长位置");
-- module.TeamModule.QueryLeaderInfo();
else
showDlgError(nil,"暂离解除失败")
end
-- ERROR_LOG("18295",sprinttb(data))
end)
EventManager.getInstance():addListener("server_notify_18289", function(event, cmd, data)
-- ERROR_LOG("server_notify_18289",sprinttb(data))
for i = 1,#data do
teamInfo.afk_list[data[i]] = true
DispatchEvent("TEAM_INFO_CHANGE")
DispatchEvent("NOTIFY_TEAM_PLAYER_AFK_CHANGE",{pid = data[i],type = true})
end
-- ERROR_LOG("AFK_18289",sprinttb(data))
end)
EventManager.getInstance():addListener("server_notify_18290", function(event, cmd, data)
-- ERROR_LOG("server_notify_18290",sprinttb(data))
for i = 1,#data do
teamInfo.afk_list[data[i]] = false;
DispatchEvent("TEAM_INFO_CHANGE")
DispatchEvent("NOTIFY_TEAM_PLAYER_AFK_CHANGE",{pid = data[i],type = false})
end
-- ERROR_LOG("AFK_BACK_18290",sprinttb(data))
end)
-- local C_TEAM_INPLACE_CHECK_RESPOND = 18131 -- {sn, result}
EventManager.getInstance():addListener("server_respond_18131", function(event, cmd, data)
-- print("就位确认------------------------->>>>>>>>>>");
if not teamInfo then
-- print("loading team info")
return;
end
if teamInfo.id <= 0 then
-- print("not in a team")
return;
end
if data[2] ~= 0 then
teamInfo.is_checking_ready = false;
-- print("start check ready failed")
return;
end
-- print("就位确认------------------------->>>>>>>>>>");
teamInfo.is_checking_ready = true;
end);
local function PlayerReady(ready,Type)
--0待确认1已确认2已拒绝 Type0就位确认1战前确认2队长申请确认
-- print("PlayerReady>"..ready)
NetworkService.Send(18132, {nil, ready,Type})
end
-- local C_TEAM_INPLACE_READY_RESPOND = 18133 -- {sn, result}
EventManager.getInstance():addListener("server_respond_18133", function(event, cmd, data)
if not teamInfo then
-- print("loading team info")
return;
end
if teamInfo.id <= 0 then
-- print("not in a team")
return;
end
if data[2] ~= 0 then
-- print("ready failed")
end
end);
local ExtraSpoilsCount = nil
local function ExtraSpoils()
if ExtraSpoilsCount == nil then
NetworkService.Send(16064, {nil});
return {0,0}--1小怪,2boss
end
return ExtraSpoilsCount
end
EventManager.getInstance():addListener("server_respond_16065", function(event, cmd, data)
--查询小怪R点次数
-- ERROR_LOG("!"..sprinttb(data))
if data[2] == 0 then
ExtraSpoilsCount = {}
ExtraSpoilsCount[1] = data[3]
ExtraSpoilsCount[2] = data[4]
DispatchEvent("TEAM_QUERY_NPC_ROLL_COUNT_REQUEST")
end
end)
EventManager.getInstance():addListener("server_respond_16073", function(event, cmd, data)
-- ERROR_LOG("查询小怪掉落奖励16073->",sprinttb(data))
if data[2] == 0 then
DispatchEvent("TEAM_QUERY_NPC_REWARD_REQUEST",{reward_content = data[3]})
end
end)
--[=[
EventManager.getInstance():addListener("server_respond_16041", function(event, cmd, data)
if data[2] == 50 then
if utils.SceneStack.CurrentSceneName() == "battle" then
--[[
showDlg(nil,"战斗已经结束",function()
utils.SceneStack.Pop();
end,nil,'退出')
--]]
end
end
end);
--]=]
EventManager.getInstance():addListener("server_respond_16071", function(event, cmd, data)
-- print("开始战斗16071->"..sprinttb(data))
if data[2] == 0 then
SetTipsState(false)--暂时关闭物品获取提示和升级提示
else
DispatchEvent("TEAM_BATTLE_START_ERROR")
end
end)
EventManager.getInstance():addListener("server_respond_18157", function(event, cmd, data)
-- ERROR_LOG("回复小队邀请18157->"..sprinttb(data))
Invites = Invites or {};
if Invites[data[1]] then
Invites[data[1]](data[2]);
Invites[data[1]] = nil;
end
if data[2] == 0 then
DispatchEvent("TEAM_PLAYER_REPLY_INVITATION_REQUEST")
ERROR_LOG("回复小队邀请查询队伍");
module.TeamModule.QueryLeaderInfo();
else
DispatchEvent("TEAM_PLAYER_REPLY_INVITATION_REQUEST_ERROR")
showDlgError(nil,"队伍已解散")
NetworkService.Send(18154);
end
end)
EventManager.getInstance():addListener("server_respond_18181", function(event, cmd, data)
-- print("改变小队队长请求->18181"..sprinttb(data))
end)
EventManager.getInstance():addListener("server_notify_16008", function(event, cmd, data)
--小怪奖励掉落通知
-- print("小怪奖励掉落通知->"..sprinttb(data))
--if ExtraSpoilsCount and ExtraSpoilsCount > 0 then
-- ExtraSpoilsTips(nil,data[1],data[2],data[3])
--end
--DialogStack.PushPrefStact("ExtraSpoils")--暂时关闭,不由怪物死亡触发
end)
local RollSetGidSn = {}
local function RollSetGid(gid,k,k1,k2)
local sn = NetworkService.Send(16062,{nil,gid});
RollSetGidSn[sn] = {k,k1,k2}
end
EventManager.getInstance():addListener("server_respond_16063", function(event, cmd, data)
--roll小怪奖励
-- ERROR_LOG("roll小怪奖励",sprinttb(data))
if data[2] == 0 then
--showDlgError(nil,"获得"..data[3][1][2].."->"..data[3][1][3].."个")
if data[3] and next(data[3])~=nil then
DispatchEvent("TEAM_DRAW_NPC_REWARD_REQUEST",{Itemid = data[3][1][2],ItemCount = data[3][1][3],Ks = RollSetGidSn[data[1]]})
NetworkService.Send(16064, {nil});
NetworkService.Send(16072);--R完奖励后重新查询奖励,用来关闭大厅按钮
end
else
showDlgError(nil,"货币不足")
end
end)
EventManager.getInstance():addListener("server_respond_16077", function(event, cmd, data)
-- ERROR_LOG("公共奖励roll请求16077",sprinttb(data))
if data[2] == 0 then
DispatchEvent("TEAM_ROLL_GAME_ROLL_REQUEST",{sn = data[1]})
end
end)
local Fight_Reward = {}
local function GetFightReward()
local rewards = Fight_Reward
Fight_Reward = {}
return rewards
end
EventManager.getInstance():addListener("server_notify_16009", function(event, cmd, data)
--小队副本战斗奖励活动通知
--ERROR_LOG("小队副本战斗奖励活动通知",sprinttb(data))
Fight_Reward = data[1]
end)
-- NOTIFY_TEAM_INPLACE_CHECK = 18130 -- {}
local fightIndex = 1
local function GetFightIndex()
return fightIndex
end
EventManager.getInstance():addListener("server_respond_16067", function(event, cmd, data)
--查询小队副本战斗胜利次数
-- ERROR_LOG("查询个人副本战斗胜利次数"..sprinttb(data))
-- fightIndex = 3
-- for i =1 ,#data[3] do
-- if data[3][i][2] == 0 then
-- fightIndex = i
-- break
-- end
-- end
if data[2] == 0 then
module.CemeteryModule.SetPlayerRecord(data[3])
-- if #data[3] == 1 then
-- module.CemeteryModule.SetPlayerRecord(data[3])
-- else
-- module.CemeteryModule.SetPveStateUid(data[3],data[1])
-- module.CemeteryModule.SetTeamPveFight(data)
-- end
end
--DispatchEvent("QUERY_PLAYER_FIGHT_WIN_COUNT_REQUEST",{win_count = data[3],sn = data[1]})
end)
EventManager.getInstance():addListener("server_respond_16069", function(event, cmd, data)
--查询小队副本队伍副本进度
-- ERROR_LOG("查询小队副本队伍副本进度"..sprinttb(data))
-- fightIndex = 3
-- for i =1 ,#data[3] do
-- if data[3][i][2] == 0 then
-- fightIndex = i
-- break
-- end
-- end
if data[2] == 0 then
module.CemeteryModule.SetTEAMRecord(data[3])
DispatchEvent("QUERY_PLAYER_FIGHT_WIN_COUNT_REQUEST")
-- if #data[3] == 1 then
-- module.CemeteryModule.SetTEAMRecord(data[3])
-- else
-- module.CemeteryModule.SetTEAM_PveStateUid(data[3],data[1])
-- DispatchEvent("QUERY_TEAM_PROGRESS_REQUEST",{win_count = data[3]})
-- end
end
end)
EventManager.getInstance():addListener("server_respond_16087", function(event, cmd, data)
-- ERROR_LOG("怪物NPC进度16087->"..sprinttb(data))
if data[2] == 0 then
--DispatchEvent("update_monster_schedule")
end
end)
EventManager.getInstance():addListener("server_respond_18185", function(event, cmd, data)
--设置队伍等级限制
if data[2] == 0 then
TeamChangeDlg(2)
else
showDlgError(nil,"设置队伍等级限制 错误",data[2])
end
end)
EventManager.getInstance():addListener("server_notify_18111", function(event, cmd, data)
--队伍等级限制改变通知
if teamInfo then
--ERROR_LOG("server_notify_18111",data[1],data[2])
if teamInfo.lower_limit and teamInfo.upper_limit then
if teamInfo.lower_limit ~= data[1] or teamInfo.upper_limit ~= data[2] then
if data[1] > 0 and data[2] > 0 then
--showDlgError(nil,"队长调整队伍等级限制 "..data[1].." - "..data[2].." 级")
else
--showDlgError(nil,"队长调整队伍等级无限制")
end
end
end
teamInfo.lower_limit = data[1]
teamInfo.upper_limit = data[2]
EventManager.getInstance():dispatch("TEAM_INFO_CHANGE");
end
end)
EventManager.getInstance():addListener("server_notify_16041", function(event, cmd, data)
-- ERROR_LOG("怪物NPC进度16041->"..sprinttb(data))
module.CemeteryModule.SetPlayerRecord({{data[1],1}})
module.CemeteryModule.SetTEAMRecord({{data[1],1}})
DispatchEvent("update_monster_schedule",{gid = data[1]})--通知队伍中的其他玩家,队长对话击败怪物
end)
EventManager.getInstance():addListener("server_notify_16011", function(event, cmd, data)
-- print("小队状态变化通知18111->"..sprinttb(data))
end)
EventManager.getInstance():addListener("server_notify_18104", function(event, cmd, data)
--队伍聊天通知
-- print("队伍聊天通知"..sprinttb(data))
local ChatManager = require 'module.ChatModule'
local name = ""
for i = 1, #getTeamInfo().members do
if getTeamInfo().members[i].pid == data[1] then
name = getTeamInfo().members[i].name
break
end
end
if data[2] == 1 then
ShowChatWarning(data[3])
end
ChatManager.SetTeamChat(data[1],name,data[3])
end)
-- local NOTIFY_TEAM_PLAYER_CHAT = 18104 -- {pid, type, msg}
EventManager.getInstance():addListener("server_notify_18104", function(event, cmd, data)
-- print("server_notify_18104",sprinttb(data));
if not teamInfo then
-- print("loading team info, ignore 16004")
return;
end
if teamInfo.id <= 0 then
return;
end
local chatInfo = {
pid = data[1],
type = data[2],
msg = data[3]
};
table.insert(teamInfo.chat, chatInfo)
if #teamInfo.chat > 50 then
table.remove(teamInfo.chat);
end
EventManager.getInstance():dispatch("TEAM_CHAT", chatInfo);
end);
local Roll_Query_sn = {}
local function Roll_Query(type)--0push1PushPrefStact
local sn = NetworkService.Send(16074)
Roll_Query_sn[sn] = type
end
local GetPubReward = {}
local function GetPubRewardData()
return GetPubReward
end
local function SetPubRewardData(data)--用作重置清空数据
GetPubReward = data
end
local function GetPubRewardStatus()
-- ERROR_LOG(sprinttb(GetPubReward))
for k,v in pairs(GetPubReward)do
for i = 1,#v.list do
for j = 1,#v.pids do
if not v.RollPids or not v.RollPids[i][v.pids[j]] then
return true--尚未分配完成
end
end
-- ERROR_LOG(sprinttb(RollPids),pids[j])
-- if v.pids[j] == module.playerModule.GetSelfID() then
-- local time = math.floor(v.EndTime - Time.now())
-- if v.RollPids and v.RollPids[i] and v.RollPids[i][pids[j]] then
-- elseif time <= 0 then
-- else
-- return true
-- end
-- end
end
end
return false
end
EventManager.getInstance():addListener("server_notify_16033", function(event, cmd, data)
--小队副本公共奖励roll点开始通知
Roll_Query(1)
end)
local function SetPubRewardList(data)--用作存入玩家操作数据
if not GetPubReward[data[1]] then return end
if not GetPubReward[data[1]].desc then
GetPubReward[data[1]].Roll = {}
GetPubReward[data[1]].desc = {}
GetPubReward[data[1]].RollPids = {}--roll过的人
end
if not GetPubReward[data[1]].desc[data[3]] then
GetPubReward[data[1]].Roll[data[3]] = {}
GetPubReward[data[1]].desc[data[3]] = {}
GetPubReward[data[1]].RollPids[data[3]] = {}
end
if not GetPubReward[data[1]].RollPids[data[3]][data[2]] then
local idx = #GetPubReward[data[1]].desc[data[3]]
GetPubReward[data[1]].Roll[data[3]][idx + 1] = {gid = data[1],pid = data[2],index = data[3],point = data[4],status = data[5]}
GetPubReward[data[1]].RollPids[data[3]][data[2]] = true
if data[2]>0 then
if playerModule.IsDataExist(data[2]) then
if data[5] == 1 then
-- GetPubReward[data[1]].desc[data[3]][idx + 1] = playerModule.IsDataExist(data[2]).name.."投掷 <color=#FFD700FF>需求</color> "..data[4].."点"
GetPubReward[data[1]].desc[data[3]][idx + 1] = SGK.Localize:getInstance():getValue("fuben_touzhi_5",playerModule.IsDataExist(data[2]).name,data[4])
elseif data[5] == 2 then
--GetPubReward[data[1]].desc[data[3]][idx + 1] = playerModule.IsDataExist(data[2]).name.."投掷 <color=#00FF00FF>贪婪</color> "..data[4].."点"
GetPubReward[data[1]].desc[data[3]][idx + 1] = SGK.Localize:getInstance():getValue("fuben_touzhi_7",playerModule.IsDataExist(data[2]).name,data[4])
elseif data[5] == 0 then
--GetPubReward[data[1]].desc[data[3]][idx + 1] = playerModule.IsDataExist(data[2]).name.."选择了 <color=#F05025FF>放弃</color>"
GetPubReward[data[1]].desc[data[3]][idx + 1] = SGK.Localize:getInstance():getValue("fuben_touzhi_9",playerModule.IsDataExist(data[2]).name,data[4])
else
--GetPubReward[data[1]].desc[data[3]][idx + 1] = playerModule.IsDataExist(data[2]).name.."无法对该道具掷点"
GetPubReward[data[1]].desc[data[3]][idx + 1] = SGK.Localize:getInstance():getValue("fuben_touzhi_1",playerModule.IsDataExist(data[2]).name)
end
else
playerModule.Get(data[2],(function( ... )
if data[5] == 1 then
GetPubReward[data[1]].desc[data[3]][idx + 1] = SGK.Localize:getInstance():getValue("fuben_touzhi_5",playerModule.IsDataExist(data[2]).name,data[4])
elseif data[5] == 2 then
GetPubReward[data[1]].desc[data[3]][idx + 1] = SGK.Localize:getInstance():getValue("fuben_touzhi_7",playerModule.IsDataExist(data[2]).name,data[4])
elseif data[5] == 0 then
GetPubReward[data[1]].desc[data[3]][idx + 1] = SGK.Localize:getInstance():getValue("fuben_touzhi_9",playerModule.IsDataExist(data[2]).name,data[4])
else
GetPubReward[data[1]].desc[data[3]][idx + 1] = SGK.Localize:getInstance():getValue("fuben_touzhi_1",playerModule.IsDataExist(data[2]).name)
end
end))
end
else
local guideResultModule = require "module.GuidePubRewardAndLuckyDraw"
local AIData = guideResultModule.GetLocalPubRewardAIData(data[2])
if AIData then
local name = AIData.name
if data[5] == 1 then
GetPubReward[data[1]].desc[data[3]][idx + 1] = SGK.Localize:getInstance():getValue("fuben_touzhi_5",name,data[4])
elseif data[5] == 2 then
GetPubReward[data[1]].desc[data[3]][idx + 1] = SGK.Localize:getInstance():getValue("fuben_touzhi_7",name,data[4])
elseif data[5] == 0 then
GetPubReward[data[1]].desc[data[3]][idx + 1] = SGK.Localize:getInstance():getValue("fuben_touzhi_9",name,data[4])
else
GetPubReward[data[1]].desc[data[3]][idx + 1] = SGK.Localize:getInstance():getValue("fuben_touzhi_1",name)
end
else
ERROR_LOG("playerData is nil,pid",data[2])
end
end
DispatchEvent("TEAM_ROLL_Notify")
end
end
EventManager.getInstance():addListener("server_notify_16034", function(event, cmd, data)
-- ERROR_LOG("小队副本有玩家roll公共奖励通知",sprinttb(data))
SetPubRewardList(data)
end)
EventManager.getInstance():addListener("server_notify_16035", function(event, cmd, data)
-- ERROR_LOG("server_notify_16035小队副本有玩家获得公共奖励通知",sprinttb(data))
local ItemHelper = require "utils.ItemHelper"
if data[2] ~= 0 then
local name = ""
for i = 1, #getTeamInfo().members do
if getTeamInfo().members[i].pid == data[2] then
name = getTeamInfo().members[i].name
break
end
end
local rewardInfo = GetPubReward[data[1]].list[data[3]];
if rewardInfo then
local ItemData = ItemHelper.Get(rewardInfo[1],rewardInfo[2])
local ItemCount = GetPubReward[data[1]].list[data[3]][3]
local color = "<color="..ItemHelper.QualityTextColor(ItemData.quality)..">"
showDlgError(nil, SGK.Localize:getInstance():getValue("fuben_touzhi_11",name,ItemData.name.."x"..ItemCount))
module.ChatModule.SetData({nil,nil,{data[2],name},0,"<color=#FFDE21>"..name.."</color>获得"..color..ItemData.name.."x"..ItemCount.."</color>",0})
else
ERROR_LOG("rewardInfo is nil","data[3]",data[3],"data[1]",data[1],sprinttb(GetPubReward),sprinttb(data))
end
else
local rewardInfo = GetPubReward[data[1]].list[data[3]];
local ItemData = ItemHelper.Get(rewardInfo[1],rewardInfo[2])
local ItemCount = GetPubReward[data[1]].list[data[3]][3]
local color = "<color="..ItemHelper.QualityTextColor(ItemData.quality)..">"
module.ChatModule.SetData({nil,nil,{data[2],""},0,color..ItemData.name.."x"..ItemCount.."</color>已流拍",0})
end
end)
local PubReward_fight_id = nil
local function GetTeamPveFightId(id)
if id then
PubReward_fight_id = id
else
return PubReward_fight_id
end
end
--查询某场组队战斗玩家是否有权限Roll公共掉落
local function GetSelfCanRollPubRewardStatus()
local status = true
local LimitRollConsumtId = 0
if PubReward_fight_id then
local pve_battle_cfg = SmallTeamDungeonConf.GetTeam_pve_fight_gid(PubReward_fight_id)
if pve_battle_cfg and pve_battle_cfg.pubilc_drop_consume_item then
local LimitRollConsumtId = pve_battle_cfg.pubilc_drop_consume_item
if LimitRollConsumtId then
if module.ItemModule.GetItemCount(LimitRollConsumtId)<=0 then
status = false
end
end
else
ERROR_LOG("pve_battle_cfg is nil,fight_id,",PubReward_fight_id)
end
end
return status
end
--data[4]0 放弃 1 需求 2贪婪 3 放弃
EventManager.getInstance():addListener("server_respond_16075", function(event, cmd, data)
-- ERROR_LOG("16075",'fight_id',sprinttb(data))
if data[2] == 0 then
GetPubReward = data[3]
if #data[3] > 0 then
local arr = {}
local list = {}
for i = 1,#data[3] do
arr[data[3][i][1]] = {list = data[3][i][3],EndTime = data[3][i][2],gid = data[3][i][1],pids = data[3][i][6],offRollPids = data[3][i][7]}
local Roll = data[3][i][7]--不能roll的名单
local containSelf = false
if Roll then
for j = 1,#Roll do
for l = 1,#data[3][i][3] do
local gid,pid,index,point,status,uuid = data[3][i][1],Roll[j],l,-1,4,data[3][i][5]
list[#list+1] = {gid,pid,index,point,status,uuid}
if Roll[j] == module.playerModule.GetSelfID() then
containSelf = true
end
end
end
end
if not containSelf and not GetSelfCanRollPubRewardStatus() then
for l = 1,#data[3][i][3] do
local gid,pid,index,point,status,uuid = data[3][i][1],module.playerModule.GetSelfID(),l,-1,4,data[3][i][5]
list[#list+1] = {gid,pid,index,point,status,uuid}
end
end
end
GetPubReward = arr
for i = 1,#list do
SetPubRewardList(list[i])
end
end
DispatchEvent("Roll_Query_Respond",data[3])
else
ERROR_LOG("server_respond_16075_ERROR -> "..data[2])
end
end)
local Team_Ready_list = {}
local function GetTeam_Ready_list()
return Team_Ready_list
end
EventManager.getInstance():addListener("server_notify_18130", function(event, cmd, data)
if not teamInfo then
-- print("loading team info")
return;
end
if teamInfo.id <= 0 then
-- print("not in a team")
return;
end
if data == 0 then
teamInfo.is_checking_ready = true;
else
teamInfo.is_checking_ready = false;
for k, v in ipairs(teamInfo.members) do
v.is_ready = 0;
EventManager.getInstance():dispatch("TEAM_MEMBER_READY", false)
end
end
-- print("team start check ready")
EventManager.getInstance():dispatch("TEAM_MEMBER_READY_CHECK")
-- print("队长发启点名通知-18130->"..sprinttb(data))
Team_Ready_list = {}
DialogStack.PushPref("ReadyToFight",{EndTime = data[1],gid = data[2]},UnityEngine.GameObject.FindWithTag("UITopRoot"))
end);
-- NOTIFY_TEAM_INPLACE_READY = 18132 -- {pid}
EventManager.getInstance():addListener("server_notify_18132", function(event, cmd, data)
--玩家准备状态变化通知
-- print("玩家准备状态变化通知-18132->"..sprinttb(data))
if memberSetReady(data[1], data[2]) then
EventManager.getInstance():dispatch("TEAM_MEMBER_READY", data[1])
end
Team_Ready_list[#Team_Ready_list+1] = {pid = data[1],ready = data[2],Type = data[3]}
DispatchEvent("ready_Player_succeed",{pid = data[1],ready = data[2],Type = data[3]})
end)
EventManager.getInstance():addListener("server_respond_18179", function(event, cmd, data)
-- ERROR_LOG("改变小队group请求-18179->"..sprinttb(data))
if data[2] == 0 then
TeamChangeDlg(2)
else
showDlgError(nil,SGK.Localize:getInstance():getValue("common_duiyuanpipei"))
end
end)
EventManager.getInstance():addListener("server_notify_18110", function(event, cmd, data)
--小队group变化通知
ERROR_LOG("小队group变化通知-18110->"..sprinttb(data))
teamInfo.group = data[1]
DispatchEvent("GROUP_CHANGE")
--local ActivityTeamlist = require "config.activityConfig"
--showDlgError(nil,"队伍目标切换至"..ActivityTeamlist.GetActivity(teamInfo.group).name)
end)
-- local NOTIFY_TEAM_PLAYER_JOIN_REQUEST = 16001 -- {pid, level, name}
EventManager.getInstance():addListener("server_notify_18101", function(event, cmd, data)
ERROR_LOG("server_notify_18101",sprinttb(data))
if not teamInfo then
-- print("loading team info, ignore 16001")
return;
end
local pid, level, name = data[1], data[2], data[3];
if data[2] == 0 then
teamInfo.waiting[pid] = nil;
else
teamInfo.waiting[pid] = {
pid = pid,
level = level,
name = name,
}
end
module.playerModule.GetFightData(pid)--获取申请人数据
local _player = module.playerModule.IsDataExist(pid)
if _player then
if _player.honor == 9999 then
module.TeamModule.ConfiremTeamJoinRequest(pid);
end
else
module.playerModule.Get(pid,function( ... )
if module.playerModule.IsDataExist(pid).honor == 9999 then
module.TeamModule.ConfiremTeamJoinRequest(pid);
end
end)
end
EventManager.getInstance():dispatch("TEAM_JOIN_REQUEST_CHANGE", pid);
end);
EventManager.getInstance():addListener("server_notify_18107", function(event, cmd, data)
if not teamInfo then
-- print("loading team info, ignore 16007")
return;
end
-- print("玩家邀请通知18107->",sprinttb(data))
--玩家邀请列表[team_id, group, leader_id, leader_name, leader_level]
if teamInfo.invite == nil then
teamInfo.invite = {}
end
local showInvite = true;
for i = 1,#data[2] do
if data[1] == 1 then
teamInfo.invite[data[2][i][1]] = {
team_id = data[2][i][1],
group = data[2][i][2],
leader_id = data[2][i][3],
leader_name = data[2][i][4],
leader_level = data[2][i][5],
}
module.playerModule.GetFightData(data[2][i][3])--获取邀请人数据
local pid = data[2][i][3]
local team_id = data[2][i][1]
local _player = module.playerModule.IsDataExist(pid)
if _player then
if _player.honor == 9999 then
NetworkService.Send(18156,{nil,team_id,true});
end
else
module.playerModule.Get(pid,function( ... )
if module.playerModule.IsDataExist(pid).honor == 9999 then
NetworkService.Send(18156,{nil,team_id,true});
end
end)
end
if i == #data[2] then --只给最后邀请你的玩家回复
if SceneStack.GetBattleStatus() then --如果收到组队邀请的时候你正在战斗中则回复对方,你在战斗中
showInvite = false;
NetworkService.Send(5009,{nil,pid,10, module.playerModule.Get().name.."正在战斗中",""})
elseif module.guideModule.IsGuiding() then
showInvite = false;
NetworkService.Send(5009,{nil,pid,10, module.playerModule.Get().name.."正忙",""})
end
end
else
teamInfo.invite[data[2][i][1]] = nil;
end
end
if data[1] == 1 and showInvite then
-- print("邀请列表更新通知");
DispatchEvent("TEAM_PLAYER_INVITE_LIST_CHANGE")
end
end)
EventManager.getInstance():addListener("server_respond_18155", function(event, cmd, data)
-- ERROR_LOG("查询玩家邀请列表18155->",sprinttb(data))
if getTeamInfo().invite == nil then
getTeamInfo().invite = {}
end
if data[2] == 0 then
for i =1,#data[3] do
getTeamInfo().invite[data[3][i][1]] = {
team_id = data[3][i][1],
group = data[3][i][2],
leader_id = data[3][i][3],
leader_name = data[3][i][4],
leader_level = data[3][i][5],
}
module.playerModule.GetFightData(data[3][i][3])--获取邀请人数据
local pid = data[3][i][3]
local team_id = data[3][i][1]
local _player = module.playerModule.IsDataExist(pid)
if _player then
if _player.honor == 9999 then
NetworkService.Send(18156,{nil,team_id,true});
end
else
module.playerModule.Get(pid,function( ... )
if module.playerModule.IsDataExist(pid).honor == 9999 then
NetworkService.Send(18156,{nil,team_id,true});
end
end)
end
end
DispatchEvent("TEAM_PLAYER_QUERY_INVITE_REQUEST")
end
end)
-- local NOTIFY_TEAM_PLAYER_JOIN = 16002 -- {pid, pos, level, name, {h1,h2,h3,h4,h5}}
EventManager.getInstance():addListener("server_notify_18102", function(event, cmd, data)
ERROR_LOG("server_notify_18102->"..sprinttb(data))
if not teamInfo then
-- print("loading team info, ignore 16002")
return;
end
local pid = data[1];
if pid == playerModule.GetSelfID() then
-- reload team info
playerMatching(0)
teamInfo = nil;
getTeamInfo();
Is_NewMember = true
return;
end
local player = {
pid = data[1],
pos = data[2],
level = data[3],
name = data[4],
heros = nil,
};
player.heros = HeroData(data[5])
table.insert(teamInfo.members, player)
EventManager.getInstance():dispatch("TEAM_MEMBER_CHANGE",player.pid);
if teamInfo.waiting[player.pid] then
teamInfo.waiting[player.pid] = nil;
EventManager.getInstance():dispatch("TEAM_JOIN_REQUEST_CHANGE", player.pid);
end
DispatchEvent("Add_team_succeed",{pid = pid})--加入小队
module.TeamModule.mapSetPosition(pid,nil)
local teamInfo = module.TeamModule.GetTeamInfo()
if teamInfo.leader.pid == playerModule.Get().id then
if teamInfo.members and #teamInfo.members == 5 then
--队伍满员
if module.TeamModule.GetTeamInfo().auto_match then
module.TeamModule.TeamMatching(false)
end
end
end
if module.playerModule.IsDataExist(pid) then
module.ChatModule.SetTeamChat(teamInfo.leader.pid,teamInfo.leader.name,module.playerModule.IsDataExist(pid).name.."加入小队")--显示加入小队消息
else
module.playerModule.Get(pid,(function( ... )
module.ChatModule.SetTeamChat(teamInfo.leader.pid,teamInfo.leader.name,module.playerModule.IsDataExist(pid).name.."加入小队")--显示加入小队消息
end))
end
end);
local function GetMembers(data)
local list = {data[3],{},data[1]}
for i, v in ipairs(data[5]) do
local set = true
for j = 1,#data[12] do
if data[12][j] == v[1] then
set = false
break
end
end
if set then
local player = {
pid = v[1],
pos = v[2],
level = v[3],
name = v[4],
heros = {},
is_ready = v[6],
};
list[2][#list[2]+1] = player.pid
end
end
return list
end
local PlayerTeamList = {}
local GetPlayerTeam_query_sn = {}
local function GetPlayerTeam(pid,status,fun)
-- ERROR_LOG(debug.traceback())
local Time = require "module.Time"
if not PlayerTeamList[pid] or (PlayerTeamList[pid] and (Time.now() - PlayerTeamList[pid].time) >= 60) or status then
local sn = NetworkService.Send(18182, {nil,pid})--查询玩家队伍信息
-- print("查询玩家队伍信息");
GetPlayerTeam_query_sn[sn] = {pid = pid,fun = fun}
else
DispatchEvent("Team_members_Request",PlayerTeamList[pid])
end
end
EventManager.getInstance():addListener("server_respond_18183", function(event, cmd, data)
-- 查询玩家队伍信息{leader_id, [pid],teamid}
-- ERROR_LOG("查询玩家队伍信息 server_respond_18183->"..sprinttb(data))
local sn = data[1]
if data[2] == 0 and #data[3] > 0 then
local Time = require "module.Time"
PlayerTeamList[GetPlayerTeam_query_sn[sn].pid] = {members = GetMembers(data[3]),lower_limit = data[3][9],upper_limit = data[3][10]}
PlayerTeamList[GetPlayerTeam_query_sn[sn].pid].time = Time.now()
if GetPlayerTeam_query_sn[sn] == nil or GetPlayerTeam_query_sn[sn].fun == nil then
DispatchEvent("Team_members_Request",PlayerTeamList[GetPlayerTeam_query_sn[sn].pid])
end
elseif #data[3] == 0 then
PlayerTeamList[GetPlayerTeam_query_sn[sn].pid] = {members = {}}
PlayerTeamList[GetPlayerTeam_query_sn[sn].pid].time = Time.now()
if not GetPlayerTeam_query_sn[sn] or not GetPlayerTeam_query_sn[sn].func then
DispatchEvent("Team_members_Request",PlayerTeamList[GetPlayerTeam_query_sn[sn].pid])
end
end
if GetPlayerTeam_query_sn[sn].fun then
GetPlayerTeam_query_sn[sn].fun()
GetPlayerTeam_query_sn[sn] = nil
end
end)
local clickTeamInfoTab = {}
local function getClickTeamInfo(pid)
if pid then
return PlayerTeamList[pid]
end
return {}
end
local MapTeamData = {}
local function GetMapTeam(Team_id)
if Team_id then
return MapTeamData[Team_id]
end
return MapTeamData
end
local function GetMapPlayerTeam(Player_pid)
for k,v in pairs(MapTeamData) do
for i = 1,#v[2] do
if v[2][i] == Player_pid then
return v[3]
end
end
end
return nil
end
local function SetMapTeam(Team_id,data)
if Team_id then
MapTeamData[Team_id] = data
else
MapTeamData = {}
end
end
local function GetMapLeaveTeam(Team_id,leave_id)--剔除某人后的队伍数据
local list = nil
if Team_id and leave_id and MapTeamData[Team_id] then
list = {MapTeamData[Team_id][1],{},MapTeamData[Team_id][3]}
for i = 1,#MapTeamData[Team_id][2] do
if MapTeamData[Team_id][2][i] ~= leave_id then
list[2][#list[2]+1] = MapTeamData[Team_id][2][i]
end
end
end
return list
end
local function GetLeavePids(New_TeamList)
local Team_id = New_TeamList[3]
local list = {}
if MapTeamData[Team_id] then
for i = 1,#MapTeamData[Team_id][2] do
list[MapTeamData[Team_id][2][i]] = true
end
for i = 1,#New_TeamList[2] do
list[New_TeamList[2][i]] = false
end
end
return list
end
local Query_CALL = nil;
local function QueryLeaderInfo(func,pid)
local teamInfo = getTeamInfo();
if not teamInfo.leader then
return;
end
if coroutine.isyieldable() then
return utils.NetworkService.SyncRequest(18044, {nil, pid or teamInfo.leader.pid})
else
local sn = NetworkService.Send(18044, {nil,pid or teamInfo.leader.pid})
if func then
Query_CALL = Query_CALL or {};
Query_CALL[sn] = func;
end
end
end
EventManager.getInstance():addListener("server_respond_18045", function(event, cmd, data)
--查询队长位置
-- ERROR_LOG("查询队长位置","server_respond_18045->",sprinttb(data))
if Query_CALL and Query_CALL[data[1]] then
Query_CALL[data[1]](data);
Query_CALL[data[1]] = nil;
end
if data[2] == 0 then
local mapid, x, z, y, mapType, room = data[3][1], data[3][2], data[3][3], data[3][4], data[3][5], data[3][6];
DispatchEvent("MAP_QUERY_PLAYER_INFO_REQUEST",{mapid = mapid, x = x, y = y, z = z, mapType = mapType, room = room})
else
ERROR_LOG("18045队伍位置错误 ",data[2])
-- TEAM_AFK_REQUEST();
DispatchEvent("MAP_QUERY_PLAYER_INFO_REQUEST_NULL")
end
end)
EventManager.getInstance():addListener("server_respond_18047", function(event, cmd, data)
--发送地图通知回调
-- ERROR_LOG("server_respond_18047->"..sprinttb(data))
if data[2] == 0 then
-- print("地图炮发送完毕")
end
end)
EventManager.getInstance():addListener("server_notify_16043", function(event, cmd, data)
--地图通知
ERROR_LOG("server_notify_16043->",sprinttb(data))
local Type,_pid = data[1],data[2]
if Type then
if Type == 3 then--通知地图其他人有人的装扮变化
PlayerInfoHelper.GetPlayerAddData(_pid,99,nil,true)
DispatchEvent("LOCAL_TEAM_PLAYERADDDATE_CHANGE", _pid)
elseif Type == 4 then
module.playerModule.Get(_pid,nil,true)
elseif Type == 5 then
module.TeamModule.SetmapPlayStatus(data[2][2],data[2])
DispatchEvent("UpdataPlayteStatus",{pid = data[2][2]})
elseif Type == 6 then
module.MapModule.SetPlayerStatus(_pid,data[3])
elseif Type == 7 then--升级通知地图其他人
module.TeamModule.SetmapPlayStatus(_pid,{Type})
DispatchEvent("UpdataPlayteStatus",{pid = _pid})
end
end
DispatchEvent("NOTIFY_MAP_SYNC",{TeamMap = data})
local event, pid, msg = data[1], data[2], data[3];
if event then
DispatchEvent("MAP_CLIENT_EVENT_" .. event, pid, msg);
end
end)
-- local NOTIFY_TEAM_CHANGE_LEADER = 18105 -- {pid, auto_confirm}
EventManager.getInstance():addListener("server_notify_18105", function(event, cmd, data)
if not teamInfo then
-- print("loading team info, ignore 18105")
return;
end
-- if teamInfo.id ~= 0 then
-- return;
-- end
-- print("队伍队长变化通知->18105"..sprinttb(data))
local pid, auto_confirm = data[1], data[2];
local k, player = findTeamMember(pid)
if k then
if kickTeamMember_Tips then
showDlgError(nil,"<color=#FEBA01>"..player.name.."</color> 成为了新队长")
else
kickTeamMember_Tips = true
end
teamInfo.leader = player;
teamInfo.auto_confirm = auto_confirm;
EventManager.getInstance():dispatch("TEAM_LEADER_CHANGE");
for i = 1,#teamInfo.members do
if teamInfo.members[i].pid then
module.TeamModule.mapSetPosition(teamInfo.members[i].pid,nil)
end
end
if teamInfo.leader.pid ~= playerModule.GetSelfID() then
DispatchEvent("MOVEHEADERSUCCESS");
end
end
end);
-- local NOTIFY_TEAM_CHANGE = 18106 -- {id,group,member_count,leader_pid,leader_name}
EventManager.getInstance():addListener("server_notify_18106", function(event, cmd, data)
-- ERROR_LOG("server_notify_18106",sprinttb(data))
local group = data[2];
updateTeamGroup(data[1], data[2], data[3], data[4], data[5],nil , data[6], data[7],data[8])
EventManager.getInstance():dispatch("TEAM_LIST_CHANGE", group);
end);
local _TeamLeaderStatus = true
local function TeamLeaderStatus(status)
if status then
_TeamLeaderStatus = status
end
return _TeamLeaderStatus
end
-- local NOTIFY_TEAM_SYNC = 18140 -- {tye, data}
EventManager.getInstance():addListener("server_notify_18140", function(event, cmd, data)
if not teamInfo then
-- print("loading team info, ignore 18140")
return;
end
-- ERROR_LOG('TEAM_DATA_SYNC'..sprinttb(data));
if data[2] == 100 then
_TeamLeaderStatus = false
elseif data[2] == 101 then
--队员更换名字
module.playerModule.Get(data[1]).name = data[3][1]
for k,v in ipairs( getTeamInfo().members) do
if v.pid == data[1] then
v.name = data[3][1]
end
end
EventManager.getInstance():dispatch("TEAM_MEMBER_CHANGE");
elseif data[2] == 102 then
--队员更换头像
module.playerModule.Get(data[1]).head = data[3][1]
EventManager.getInstance():dispatch("TEAM_MEMBER_CHANGE");
elseif data[2] == 106 then
DispatchEvent("Team_Emoji_receive",data[3])
elseif data[2] == 110 then--同步队员更换阵容
module.playerModule.SetPlayerFightDataRefresh(data[1])
DispatchEvent("TeamMemberFormationChange",data[1])--队员阵容改变消息
elseif data[2] == 111 then--队伍集结
module.unionModule.queryPlayerUnioInfo(getTeamInfo().leader.pid);
DispatchEvent("NOTIFY_TEAM_ALL_CHANGE");
elseif data[2] == 201 then
-- ERROR_LOG("server_notify_18140",sprinttb(data));
data[3] = data[3] or {};
if data[3][1] == 2 then
module.guideModule.QuestGuideTipStatus = nil
else
module.guideModule.QuestGuideTipStatus = {id = data[3][1],npcid = data[3][2]}
end
DispatchEvent("NOTIFY_TEAM_GUIDE_CHANGE",module.guideModule.QuestGuideTipStatus);
end
DispatchEvent("TEAM_DATA_SYNC", table.unpack(data));
end)
local team_fight_notify_cache = {};
local function GetTeamFightNotifyCache()
local t = team_fight_notify_cache;
team_fight_notify_cache = nil;
return t;
end
local SyncFightFlag = 0--同步战斗类型,用来标记特殊的同步战斗(Albert)
local function GetSyncFightFlag()
local _SyncFightFlag = SyncFightFlag
SyncFightFlag = 0
return _SyncFightFlag
end
EventManager.getInstance():addListener("server_notify_16040", function(event, cmd, data)
EventManager.getInstance():dispatch("FIGHT_DATA_SYNC", table.unpack(data));
if data[1] == 1 then
-- print("<color=red>", "Start Team Fight", "</color>");
module.EncounterFightModule.SetCombatTYPE(0)
module.EncounterFightModule.StartCombat(data)
team_fight_notify_cache = {};
SyncFightFlag = data[2] and data[2][6] or 0
if data[3] then
--储存多人战斗战斗Id
PubReward_fight_id = data[3]
end
elseif data[1] == 7 then
--战斗结束
module.EncounterFightModule.CombatDataPersistence(nil)
DispatchEvent("TeamCombatFinish")
end
if data[1] ~= 1 and team_fight_notify_cache then
table.insert(team_fight_notify_cache, data);
end
end);
--玩家移动 移动后的通知是16043
local C_MAP_MOVE_REQUEST = 18042 -- {sn, x, y, mid}
local C_MAP_MOVE_RESPOND = 18043 -- {sn, result, {{pid,x,y}, ...}};
local mapInfo = { players = {} }
local mapPlayStatus = {}
local mapMoveToData = nil
local function GetmapMoveTo()
return mapMoveToData
end
local function GetmapPlayStatus(pid)
return mapPlayStatus[pid]
end
local function SetmapPlayStatus(pid,value)
mapPlayStatus[pid] = value
end
local function mapMoveTo(x, y, z, mid, mapType, room, move_style)
-- ERROR_LOG("====",debug.traceback());
if not mapMoveToData then
mapMoveToData = {}
end
-- print("移动到对应地图",mid);
if x and y and z then
mapMoveToData[1] = x
mapMoveToData[2] = y
mapMoveToData[3] = z
if mid and mapType then--and room then
if mid ~= mapMoveToData[4] then
mapPlayStatus = {}--清空当前地图玩家状态
end
mapMoveToData[4] = mid
mapMoveToData[5] = mapType
mapMoveToData[6] = room
mapMoveToData[7] = move_style
end
end
local sn = NetworkService.Send(C_MAP_MOVE_REQUEST, {nil, {x, z, y}, 0, mid, mapType, room, move_style})
end
local recover_map_id_sn = {}
EventManager.getInstance():addListener("server_respond_18043", function(event, cmd, data)
-- ERROR_LOG("server_respond_18043",sprinttb(data));
local sn = data[1];
local is_recovery_repspond = recover_map_id_sn[sn];
recover_map_id_sn[sn] = nil;
if data[2] ~= 0 then
--showDlgError(nil,"enter map failed "..data[2])
if data[2] == 51 and not is_recovery_repspond then
if mapMoveToData then
mapMoveTo(mapMoveToData[1], mapMoveToData[3], mapMoveToData[2],mapMoveToData[4], mapMoveToData[5], mapMoveToData[6], mapMoveToData[7]);
recover_map_id_sn[sn] = true;
end
end
return;
end
local players = data[3];
if players then
mapInfo.players = {};
for _, v in ipairs(players) do
local pid, x, z, y = v[1], v[2], v[3], v[4];
mapInfo.players[pid] = {x = x , y = y, z = z};
end
local oldPlayerPids = {}
for pid,v in pairs(mapInfo.players) do
if playerModule.GetSelfID() ~= pid then
oldPlayerPids[#oldPlayerPids+1] = pid
end
end
-- ERROR_LOG("oldPlayerPids",sprinttb(oldPlayerPids),sprinttb(mapInfo.players))
EventManager.getInstance():dispatch("MAP_CHARACTER_REFRESH",oldPlayerPids);
end
end);
EventManager.getInstance():addListener('server_notify_16042', function(event, cmd, data)
-- ERROR_LOG("server_notify_16042",sprinttb(data));
local pid, x, z, y = data[1], data[2], data[3], data[4];
if x then
-- ERROR_LOG("MAP_CHARACTER_MOVE",pid);
mapInfo.players[pid] = {x = x , y = y, z = z};
EventManager.getInstance():dispatch("MAP_CHARACTER_MOVE", pid, x, y, z);
else
-- ERROR_LOG("MAP_CHARACTER_DISAPPEAR",pid);
mapInfo.players[pid] = nil;
EventManager.getInstance():dispatch("MAP_CHARACTER_DISAPPEAR", pid);
end
end)
local function TeamDatePro(pid,leader_id)--获取除了pid之外人的队伍列表
if teamInfo.group ~= 0 then
local tempArr = {}
tempArr[1] = leader_id
tempArr[2] = {}
for k,v in ipairs(teamInfo.members) do
if v.pid ~= pid then
tempArr[2][#tempArr[2] + 1] = v.pid
end
end
tempArr[3] = teamInfo.id--队伍id
return tempArr
end
return {}
end
-- local NOTIFY_TEAM_PLAYER_LEAVE = 16003 -- {pid}
EventManager.getInstance():addListener("server_notify_18103", function(event, cmd, data)
-- ERROR_LOG("server_notify_18103->"..sprinttb(data))
if not teamInfo then
-- print("loading team info, ignore 16003")
return;
end
local pid = data[1];
if pid == playerModule.GetSelfID() then
--local TeamData = TeamDatePro(data[1],data[2])
if mapMoveToData then
mapMoveTo(mapMoveToData[1], mapMoveToData[3], mapMoveToData[2],mapMoveToData[4], mapMoveToData[5], mapMoveToData[6]);
-- NetworkService.Send(C_MAP_MOVE_REQUEST, {nil, {mapMoveToData[1], mapMoveToData[3], mapMoveToData[2]}, 0, mapMoveToData[4], mapMoveToData[5], mapMoveToData[6]})
end
updateTeamInfo({0})
DispatchEvent("Leave_team_succeed",{pid = data[1]})--自己离队
module.CemeteryModule.Setactivityid(0)--队伍解散后重置当前队伍副本id
return;
end
local k = findTeamMember(pid)
if k then
table.remove(teamInfo.members, k)
teamInfo.afk_list[pid] = nil
EventManager.getInstance():dispatch("TEAM_MEMBER_CHANGE");
DispatchEvent("Leave_team_succeed",{pid = data[1]})--队员离队
local teamInfo = module.TeamModule.GetTeamInfo()
if module.playerModule.IsDataExist(data[1]) then
module.ChatModule.SetTeamChat(teamInfo.leader.pid,teamInfo.leader.name,module.playerModule.IsDataExist(data[1]).name.."离开小队")--显示加入小队消息
else
module.playerModule.Get(pid,(function( ... )
module.ChatModule.SetTeamChat(teamInfo.leader.pid,teamInfo.leader.name,module.playerModule.IsDataExist(data[1]).name.."离开小队")--显示加入小队消息
end))
end
end
end);
local LeaderApply_list = {}
local LeaderApply_pid = nil
local LeaderApply_EndTime = 0
local TeamLeaderApply_Pref = nil
local function RestTeamLeaderApply_Pref()
RestTeamLeaderApply_Pref = nil
end
local function LeaderApplySend()
if Time.now() > LeaderApply_EndTime then
NetworkService.Send(18272)
else
showDlgError(nil,math.floor(LeaderApply_EndTime - Time.now()).."秒后可再次发起投票")
end
end
EventManager.getInstance():addListener("server_respond_18273", function(event, cmd, data)
if data[2] == 0 then
showDlgError(nil,"您已发出申请,等待其他人同意")
else
--tower11
showDlgError(nil,"暂离成员无法申请队长")
end
end)
local function GetLeaderApply_pid()
return LeaderApply_pid,LeaderApply_EndTime
end
EventManager.getInstance():addListener("server_notify_18276", function(event, cmd, data)
--有人发起投票通知
LeaderApply_list = {}
LeaderApply_pid = data[1]
LeaderApply_EndTime = data[2]
local list = {candidate = LeaderApply_pid,pid = LeaderApply_pid,agree = 1}
LeaderApply_list[#LeaderApply_list+1] = list
local pid = playerModule.GetSelfID();
if teamInfo.afk_list[pid] then
return
end
TeamLeaderApply_Pref = DialogStack.PushPref("TeamLeaderApply",{EndTime = LeaderApply_EndTime,pid = LeaderApply_pid},UnityEngine.GameObject.FindWithTag("UITopRoot"))
--DispatchEvent("TEAM_APPLY_TO_BE_LEADER")
end)
local function TEAM_Leader_vote(agree)
NetworkService.Send(18274,{nil,LeaderApply_pid,agree})
end
EventManager.getInstance():addListener("server_respond_18275", function(event, cmd, data)
if data[2] == 0 then
--showDlgError(nil,"投票成功")
else
--showDlgError(nil,"投票失败")
end
end)
local function GetLeaderApply_list()
return LeaderApply_list
end
EventManager.getInstance():addListener("server_notify_18278", function(event, cmd, data)
--有人投票通知
-- ERROR_LOG("server_notify_18278",sprinttb(data))
local list = {candidate = data[1],pid = data[2],agree = data[3]}
LeaderApply_list[#LeaderApply_list+1] = list
DispatchEvent("NOTIFY_TEAM_VOTE")
end)
EventManager.getInstance():addListener("server_notify_18280", function(event, cmd, data)
--投票结束通知
--ERROR_LOG(data[1])
DispatchEvent("NOTIFY_TEAM_VOTE_FINISH",{candidate = data[1]})
LeaderApply_EndTime = 0
end)
local function ExamineTeamReady()
--inplace = {}, -- 就位确认投票
--leader = {}, -- 申请队长投票
local Time = require "module.Time"
-- ERROR_LOG(Time.now(),sprinttb(teamInfo.vote_info))
if teamInfo and teamInfo.vote_info then
if teamInfo.vote_info.inplace.end_time and teamInfo.vote_info.inplace.end_time > Time.now() then
for i=1,#teamInfo.vote_info.inplace.members do
if teamInfo.vote_info.inplace.members[i] > 0 then
Team_Ready_list[#Team_Ready_list+1] = {pid = teamInfo.members[i].pid,ready = teamInfo.vote_info.inplace.members[i],Type = teamInfo.vote_info.inplace.type}
end
end
DialogStack.PushPref("ReadyToFight",{EndTime = teamInfo.vote_info.inplace.end_time,gid = teamInfo.vote_info.inplace.type},UnityEngine.GameObject.FindWithTag("UITopRoot"))
elseif teamInfo.vote_info.leader.end_time and teamInfo.vote_info.leader.end_time > Time.now() then
for i=1,#teamInfo.vote_info.leader.members do
if teamInfo.vote_info.leader.members[i] >= 0 then
LeaderApply_list[#LeaderApply_list+1] = {candidate = teamInfo.vote_info.leader.pid,pid = teamInfo.members[i].pid,agree = teamInfo.vote_info.leader.members[i]}
end
end
local pid = playerModule.GetSelfID();
if teamInfo.afk_list[pid] then
return
end
TeamLeaderApply_Pref = DialogStack.PushPref("TeamLeaderApply",{EndTime = teamInfo.vote_info.leader.end_time,pid = teamInfo.vote_info.leader.pid},UnityEngine.GameObject.FindWithTag("UITopRoot"))
end
end
end
local TeamPveTime = {}
local function GetTeamPveTime(gid)
if gid then
return TeamPveTime[gid]
end
return TeamPveTime
end
local function SetTeamPveTime(gid,start_time,end_time)
TeamPveTime[gid] = {start_time = start_time,end_time = end_time}
end
local QUERY_BATTLE_TIME_REQUEST_sn = {}
local function QUERY_BATTLE_TIME_REQUEST(battle_id,fun)--查询副本是否结束
local sn = NetworkService.Send(16281,{nil,battle_id})
QUERY_BATTLE_TIME_REQUEST_sn[sn] = {battle_id = battle_id,fun = fun}
end
EventManager.getInstance():addListener("server_respond_16282", function(event, cmd, data)
local sn = data[1]
local err = data[2]
if err == 0 then
-- ERROR_LOG("16282",sprinttb(data))
if QUERY_BATTLE_TIME_REQUEST_sn[sn] then
TeamPveTime[QUERY_BATTLE_TIME_REQUEST_sn[sn].battle_id] = {start_time = data[3],end_time = data[4]}
if QUERY_BATTLE_TIME_REQUEST_sn[sn].fun then
QUERY_BATTLE_TIME_REQUEST_sn[sn].fun()
end
DispatchEvent("QUERY_BATTLE_TIME_REQUEST")
end
end
end)
local ENTER_BATTLE_REQUEST_sn = {}
local function ENTER_BATTLE_REQUEST(battle_id,mapid,pos)--开启副本进入
local Time = require "module.Time"
local fun = function ( ... )
local sn = NetworkService.Send(16283,{nil,battle_id})
ENTER_BATTLE_REQUEST_sn[sn] = {battle_id = battle_id,mapid = mapid,pos = pos}
end
if TeamPveTime[battle_id] then
if TeamPveTime[battle_id].end_time == 0 or math.floor(TeamPveTime[battle_id].end_time - Time.now()) > 0 then
fun()
else
module.CemeteryModule.RestCemetery(function ()
--重置副本
fun()
end,battle_id)
end
else
QUERY_BATTLE_TIME_REQUEST(battle_id,function ()
ENTER_BATTLE_REQUEST(battle_id,mapid,pos)
end)
end
end
EventManager.getInstance():addListener("server_respond_16284", function(event, cmd, data)
local sn = data[1]
local err = data[2]
if err == 0 then
-- ERROR_LOG("18284",sprinttb(data))
if ENTER_BATTLE_REQUEST_sn[sn] then
TeamPveTime[ENTER_BATTLE_REQUEST_sn[sn].battle_id] = {start_time = data[3],end_time = data[4]}
module.CemeteryModule.Setactivityid(ENTER_BATTLE_REQUEST_sn[sn].battle_id)
local _battleCfg = SmallTeamDungeonConf.GetTeam_pve_fight(ENTER_BATTLE_REQUEST_sn[sn].battle_id)
for i,v in pairs(_battleCfg.idx or {}) do
for j,p in ipairs(v) do
if i == 0 then
coroutine.resume( coroutine.create( function ( ... )
SceneStack.TeamEnterMap(ENTER_BATTLE_REQUEST_sn[sn].mapid)--, {mapid = ENTER_BATTLE_REQUEST_sn[sn].mapid,pos = ENTER_BATTLE_REQUEST_sn[sn].pos})
end ) )
else
utils.NetworkService.Send(16070, {nil, p.gid})
end
break
end
end
end
end
end)
local function mapSetPosition(pid,data)
mapInfo.players[pid] = data
end
local function mapGetPosition(pid)
return mapInfo.players[pid];
end
local function mapGetPlayers()--获取地图玩家数据pid
return mapInfo.players;
end
local function mapResetPlayers()
mapInfo.players = {}
end
local flag = nil
--true 可以进 nil不能进
local function CheckEnterMap(mapid,status)
if SceneStack.GetBattleStatus() then
return true
end
local info = getTeamInfo();
--有队伍信息
local playerinfo = playerModule.Get();
if info.id ~= 0 then
-- 如果自己是队长
if info.leader.pid == playerModule.Get().id then
local map_info = MapConfig.GetMapConf(mapid);
if map_info.map_type == 4 then
local teamInfo = getTeamInfo();
local leader_id = teamInfo.leader.pid;
local leaderInfo =module.unionModule.queryPlayerUnioInfo(teamInfo.leader.pid)
local playerUnionInfo = module.unionModule.queryPlayerUnioInfo(playerModule.Get().id)
for k,v in pairs(info.afk_list) do
if v.pid ~= pid then
local memberInfo =module.unionModule.queryPlayerUnioInfo(v.pid)
if memberInfo.haveUnion == 0 or memberInfo.unionId ~= playerUnionInfo.unionId then
module.playerModule.Get(v.pid,function ( _data )
showDlgError(nil,_data.name.."无法进地图");
end);
utils.NetworkService.SyncRequest(18292, {nil, math.floor(v.pid)});
end
end
end
return true;
elseif playerinfo.level < (map_info.depend_level or 0) then
for k,v in pairs(getTeamMembers()) do
if math.floor(v.pid) ~= math.floor(playerinfo.id) then
if module.playerModule.Get(math.floor(v.pid)).level < map_info.depend_level or 0 then
-- ERROR_LOG("暂离玩家------------>>>>",v.pid);
module.playerModule.Get(v.pid,function ( _data )
showDlgError(nil,_data.name.."无法进地图++++>>>>TeamModule");
end);
utils.NetworkService.SyncRequest(18292, {nil, math.floor(v.pid)});
end
end
end
-- ERROR_LOG("=======================>>>>",sprinttb(getTeamMembers()));
return true;
end
return true;
end
-- local playerinfo = playerModule.Get();
--自己跟随
-- print("队伍x",info.afk_list[math.floor(playerModule.Get().id)]);
if status or info.afk_list[math.floor(playerModule.Get().id)] == false then
-- print("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
local map_info = MapConfig.GetMapConf(mapid);
-- print("目标地图信息",sprinttb(map_info));
if map_info.map_type == 1 then
-- print("============这个地图 %s 没有等级显示",map_info.map_type);
return true;
end
--公会地图
if map_info.map_type == 4 then
local teamInfo = getTeamInfo();
-- teamInfo.leader_id
-- ERROR_LOG("===============队伍信息",sprinttb(teamInfo));
local leader_id = teamInfo.leader.pid;
local leaderInfo =module.unionModule.queryPlayerUnioInfo(teamInfo.leader.pid)
local playerInfo = module.unionModule.queryPlayerUnioInfo(playerinfo.id)
-- ERROR_LOG("==========",sprinttb(playerInfo));
if playerInfo and playerInfo.haveUnion ~= 0 and leaderInfo.unionId == playerInfo.unionId then
return true;
else
-- TEAM_AFK_REQUEST()
return;
end
return true;
elseif playerinfo.level >= (map_info.depend_level or 0) then
-- print("等级不足");
-- TEAM_AFK_REQUEST();
return true;
end
else
-- print(status,"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
end
elseif info.id < 1 then
-- TEAM_AFK_REQUEST();
-- print("当前没有队伍");
return true;
end
end
--记录 activityInfo界面 的 gid
local activityInfoGid = nil
local function GetActivityInfoGid(gid)
if gid then
activityInfoGid = gid
else
local _gid = activityInfoGid
activityInfoGid = nil
return _gid
end
end
--外部调用的检测是否能进地图的接口
-- local function TeamEnterMap( ... )
-- -- body
-- end = 1
return {
GetTeamInfo = getTeamInfo,
GetTeamList = getTeamList,
CreateTeam = createTeam,
JoinTeam = joinTeam,
ConfiremTeamJoinRequest = confiremTeamJoinRequest,
KickTeamMember = kickTeamMember,
ChatToTeam = chatToTeam,
SetTeamAutoConfirm = setTeamAutoConfirm,
Invite = invitePlayer,
GetTeamMembers = getTeamMembers,
GetTeamWaitingList = getTeamWaitingList,
GetTeamChatLog = getTeamChatLog,
WatchTeamGroup = watchTeamGroup,
ReadyToFight = readyToFight,
MemberIsReady = memberIsReady,
SyncTeamData = syncTeamData,
SyncFightData = syncFightData,
GetTeamFightNotifyCache = GetTeamFightNotifyCache,
MapMoveTo = mapMoveTo,
mapSetPosition = mapSetPosition,
MapGetPosition = mapGetPosition,
MapGetPlayers = mapGetPlayers,
mapResetPlayers = mapResetPlayers,
delApply = delApply,
playerMatching = playerMatching,
GetplayerMatchingType = GetplayerMatchingType,
TeamMatching = TeamMatching,
NewReadyToFight = NewReadyToFight,
PlayerReady = PlayerReady,
ExtraSpoils = ExtraSpoils,
RollSetGid = RollSetGid,
GetFightReward = GetFightReward,
GetFightIndex = GetFightIndex,
getTeamApply = getTeamApply,
getTeamInvite = getTeamInvite,
GetClickTeamInfo = getClickTeamInfo,
GetPubRewardData = GetPubRewardData,
Roll_Query = Roll_Query,
SetPubRewardData = SetPubRewardData,
GetInvite_List = GetInvite_List,
SetPubRewardList = SetPubRewardList,
GetPubRewardStatus = GetPubRewardStatus,
GetMapTeam = GetMapTeam,
GetMapPlayerTeam = GetMapPlayerTeam,
SetMapTeam = SetMapTeam,
GetSelfCanRollPubRewardStatus = GetSelfCanRollPubRewardStatus,
GetPlayerTeam = GetPlayerTeam,
updateTeamMemberLevel = updateTeamMemberLevel,
GetLeavePids = GetLeavePids,
LeaderApplySend = LeaderApplySend,
GetLeaderApply_list = GetLeaderApply_list,
TEAM_Leader_vote = TEAM_Leader_vote,
GetTeam_Ready_list = GetTeam_Ready_list,
TeamLeaderStatus = TeamLeaderStatus,
GetMapLeaveTeam = GetMapLeaveTeam,
ExamineTeamReady = ExamineTeamReady,
ENTER_BATTLE_REQUEST = ENTER_BATTLE_REQUEST,
QUERY_BATTLE_TIME_REQUEST = QUERY_BATTLE_TIME_REQUEST,
GetTeamPveTime = GetTeamPveTime,
SetTeamPveTime = SetTeamPveTime,
GetmapMoveTo = GetmapMoveTo,
GetmapPlayStatus = GetmapPlayStatus,
SetmapPlayStatus = SetmapPlayStatus,
TEAM_AFK_REQUEST = TEAM_AFK_REQUEST,
TEAM_AFK_RESPOND = TEAM_AFK_RESPOND,
getAFKMembers = getAFKMembers,
GetCallBack = getCallBack,
MoveHeader = MoveHeaderToMember,
GetAfkStatus = GetAfkStatus,
GetFirstMember = GetFirstMember,
CheckEnterMap = CheckEnterMap,
--回复邀请协议回调
SendReQuestInvite = SendReQuestInvite,
--查询队长信息回调
QueryLeaderInfo = QueryLeaderInfo,
-- CheckSelfEnterMap = CheckSelfEnterMap,
GetSyncFightFlag = GetSyncFightFlag,
GetTeamPveFightId = GetTeamPveFightId,
GetActivityInfoGid = GetActivityInfoGid,
ResumeTeamFight = ResumeTeamFight,
}
| 32.926348
| 205
| 0.61453
|
da92ac8a96e4bf315aa6cad2249205e2124a1e4d
| 193
|
ts
|
TypeScript
|
lib/defaults/EmailDefault.ts
|
fabrix-app/spool-generics
|
f98f191367fefaa612bd9359459098c680b9c33d
|
[
"MIT"
] | 4
|
2018-06-26T17:12:57.000Z
|
2018-11-02T08:40:37.000Z
|
lib/defaults/EmailDefault.ts
|
fabrix-app/spool-generics
|
f98f191367fefaa612bd9359459098c680b9c33d
|
[
"MIT"
] | null | null | null |
lib/defaults/EmailDefault.ts
|
fabrix-app/spool-generics
|
f98f191367fefaa612bd9359459098c680b9c33d
|
[
"MIT"
] | null | null | null |
import { Generic } from '../Generic'
export class EmailDefault extends Generic {
send(data) {
return Promise.resolve([])
}
sendTemplate(data) {
return Promise.resolve([])
}
}
| 16.083333
| 43
| 0.647668
|
8178643cb64cd2e0916f5d58bf195e1732b8b616
| 104
|
dart
|
Dart
|
example_getx/lib/src/controller/controller2.dart
|
nonameJ-admin-Captains-Quarter/ff_annotation_route
|
636f1ab8c1f47c1c4ca3ba75ec4aa92f8bff9c61
|
[
"MIT"
] | 1
|
2022-01-12T08:15:23.000Z
|
2022-01-12T08:15:23.000Z
|
example_getx/lib/src/controller/controller2.dart
|
nonameJ-admin-Captains-Quarter/ff_annotation_route
|
636f1ab8c1f47c1c4ca3ba75ec4aa92f8bff9c61
|
[
"MIT"
] | null | null | null |
example_getx/lib/src/controller/controller2.dart
|
nonameJ-admin-Captains-Quarter/ff_annotation_route
|
636f1ab8c1f47c1c4ca3ba75ec4aa92f8bff9c61
|
[
"MIT"
] | null | null | null |
import 'package:get/get.dart';
class GetxController2 extends GetxController {
RxInt count = 0.obs;
}
| 17.333333
| 46
| 0.75
|
2ca0868df886eef1158e67778b8194223fc021de
| 686
|
py
|
Python
|
sis_provisioner/account_managers/customgrp_bridge.py
|
uw-it-aca/bridge-sis-provisioner
|
6dd31e5ef59263acbcade5e6e4f74b815c16bdee
|
[
"Apache-2.0"
] | null | null | null |
sis_provisioner/account_managers/customgrp_bridge.py
|
uw-it-aca/bridge-sis-provisioner
|
6dd31e5ef59263acbcade5e6e4f74b815c16bdee
|
[
"Apache-2.0"
] | 175
|
2016-07-18T23:25:45.000Z
|
2022-02-07T20:44:05.000Z
|
sis_provisioner/account_managers/customgrp_bridge.py
|
uw-it-aca/bridge-sis-provisioner
|
6dd31e5ef59263acbcade5e6e4f74b815c16bdee
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
import logging
from sis_provisioner.account_managers.gws_bridge import GwsBridgeLoader
from sis_provisioner.dao.gws import get_additional_users
logger = logging.getLogger(__name__)
class CustomGroupLoader(GwsBridgeLoader):
"""
This class will validate custom group members
1. If the user is not in DB, add to Bridge
2. Update active accounts.
"""
def __init__(self, worker, clogger=logger):
super(CustomGroupLoader, self).__init__(worker, clogger)
self.data_source = "Custom group"
def fetch_users(self):
return list(get_additional_users())
| 28.583333
| 71
| 0.74344
|
da70bb5421f601c5db175480e602984823e8d97b
| 4,236
|
php
|
PHP
|
routes/web.php
|
dariuszptaszynski177/project_IB
|
11629fd8c9ec182007c3e57a687e0d3bf1f6f951
|
[
"MIT"
] | null | null | null |
routes/web.php
|
dariuszptaszynski177/project_IB
|
11629fd8c9ec182007c3e57a687e0d3bf1f6f951
|
[
"MIT"
] | null | null | null |
routes/web.php
|
dariuszptaszynski177/project_IB
|
11629fd8c9ec182007c3e57a687e0d3bf1f6f951
|
[
"MIT"
] | null | null | null |
<?php
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
*/
Route::get('/', 'App\Http\Controllers\PageController@main_page')->name('main-page');
Route::get('dashboard', 'App\Http\Controllers\AuthController@dashboard');
Route::get('login', 'App\Http\Controllers\AuthController@index')->name('login');
Route::post('custom-login', 'App\Http\Controllers\AuthController@customLogin')->name('login.custom');
Route::get('register', 'App\Http\Controllers\AuthController@registration')->name('register-user');
Route::post('custom-registration', 'App\Http\Controllers\AuthController@customRegistration')->name('register.custom');
Route::get('signout', 'App\Http\Controllers\AuthController@signOut')->name('signout');
Route::group(['middleware' => ['auth']], function () {
Route::get('/home', 'App\Http\Controllers\HomeController@index')->name('home');
Route::get('/user-computers', 'App\Http\Controllers\SimulationController@computers')->name('user-computers');
Route::post('/user-computers-buy', 'App\Http\Controllers\SimulationController@computers_buy')->name('user-computers-buy');
Route::get('/user-resources', 'App\Http\Controllers\SimulationController@resorces')->name('user-resources');
Route::get('/user-simulations', 'App\Http\Controllers\SimulationController@simulations')->name('user-simulations');
Route::post('/user-create-offer-simulation', 'App\Http\Controllers\SimulationController@create_offer_simulation')->name('create-offer-simulation');
});
Route::group(['middleware' => ['admin']], function () {
Route::get('admin-view', 'App\Http\Controllers\AdminPanelController@index')->name('admin-view');
Route::get('/admin-users', 'App\Http\Controllers\AdminPanelController@users')->name('admin-users');
Route::post('/admin-change-status', 'App\Http\Controllers\AdminPanelController@change_status')->name('admin-change-status');
Route::get('/admin/computers', 'App\Http\Controllers\AdminPanelController@computers')->name('computers');
Route::get('/admin/computer-create', 'App\Http\Controllers\AdminPanelController@computer_create')->name('computer-create');
Route::post('/admin/computer-save', 'App\Http\Controllers\AdminPanelController@computer_save')->name('computer-save');
Route::get('/admin/computer-edit/{id}', 'App\Http\Controllers\AdminPanelController@computer_edit')->name('computer-edit');
Route::post('/admin/computer-update', 'App\Http\Controllers\AdminPanelController@computer_update')->name('computer-update');
Route::get('/admin/conditions', 'App\Http\Controllers\AdminPanelController@conditions')->name('conditions');
Route::get('/admin/conditions/create', 'App\Http\Controllers\AdminPanelController@conditions_create')->name('conditions-create');
Route::post('/admin/conditions/save', 'App\Http\Controllers\AdminPanelController@conditions_save')->name('conditions-save');
Route::get('/admin/conditions/simulation/edit/{id}', 'App\Http\Controllers\AdminPanelController@conditions_simulation_edit')->name('conditions-edit-simulation');
Route::post('/admin/conditions/simulation/update', 'App\Http\Controllers\AdminPanelController@conditions_simulation_update')->name('conditions-simulation-update');
Route::get('/users_resources', 'App\Http\Controllers\AdminPanelController@users_resources')->name('users_resources');
Route::get('/admin/simulations', 'App\Http\Controllers\AdminPanelController@simulations')->name('admin-simulations');
Route::post('/admin/simulation/accept-offer', 'App\Http\Controllers\AdminPanelController@simulation_accept_offer')->name('simulation-accept-offer');
Route::post('/admin/simulation/decline-offer', 'App\Http\Controllers\AdminPanelController@simulation_decline_offer')->name('simulation-decline-offer');
Route::post('/admin/simulation/decline-other-offer', 'App\Http\Controllers\AdminPanelController@simulation_decline_other_offer')->name('simulation-decline-other-offer');
Route::get('/admin/history-simulations', 'App\Http\Controllers\AdminPanelController@history_simulations')->name('history-simulations');
});
| 73.034483
| 173
| 0.728045
|
05a444d804d5c5b4b9de401a739ad615098cda5a
| 17,360
|
py
|
Python
|
app/forecast_parser.py
|
energinet-singularity/forecast-parser
|
7c65188a16ea7da449d0f188e1b50cd72b9787c8
|
[
"Apache-2.0"
] | null | null | null |
app/forecast_parser.py
|
energinet-singularity/forecast-parser
|
7c65188a16ea7da449d0f188e1b50cd72b9787c8
|
[
"Apache-2.0"
] | 13
|
2021-11-18T15:07:07.000Z
|
2022-01-31T10:54:24.000Z
|
app/forecast_parser.py
|
energinet-singularity/forecast-parser
|
7c65188a16ea7da449d0f188e1b50cd72b9787c8
|
[
"Apache-2.0"
] | null | null | null |
import logging
from kafka import KafkaProducer
import pandas as pd
from datetime import datetime as dt, timedelta as td
import json
import re
import os
import time
import requests
from sched import scheduler
from typing import List, Tuple
# Initialize log
log = logging.getLogger(__name__)
def extract_forecast(filepath: str, field_dict: dict) -> pd.DataFrame:
"""Read the forecast file from 'filepath' and, using field_dict, create a pandas DataFrame.
Parameters
----------
filepath : str
Full path of the forecast file.
field_dict : dict
Dictionary with field-setup.
Returns
-------
pd.DataFrame
A dataframe containing the forecast
"""
# First read content of file (unzip if zipped)
with open(filepath, "rt") as fc:
content = fc.readlines()
# Get calculation time and if conwx, the data_index
filename = os.path.basename(filepath)
if 'ConWx' in filename:
calculation_time = content[0][len("#date="):].rstrip()
data_index = ["ID-A", "ID-B", "POS-A", "POS-B"] + \
[(dt.strptime(calculation_time, "%Y%m%d%H") + td(hours=h)).strftime("%Y%m%d%H")
for h in range(int(content[1][len("#minlen="):]), int(content[2][len("#maxlen="):])+1)]
else:
calculation_time = re.search(r"Iteration = (\d+)", content[0]).group(1)
data_index = []
# Go through file and load data
data_array = []
df_dict = {}
parameter = ''
for line in content[1:]:
if line[0] == "#":
if len(data_array) > 0:
df = pd.DataFrame(data_array, columns=data_index)
df.index = df["POS-A"].round(2).astype(str) + "_" + df["POS-B"].round(2).astype(str)
df.drop(columns=(["POS-A", "POS-B"]), inplace=True)
if "ConWx" in filename:
df.drop(columns=["ID-A", "ID-B"], inplace=True)
if "temperature" in parameter:
df = df + 273.15
df_dict[parameter] = df
data_array = []
if "# Valid times:" in line:
# load data_index
data_index = ["POS-A", "POS-B"] + line[len("# Valid times: "):].split()
elif re.search(r" +(.+[a-z].+)", line):
parameter = field_dict[re.search(r" +(.+[a-z].+)", line).group(1)]
else:
if float(line.split()[4]) != -99:
data_array.insert(len(data_array), [float(h) for h in line.split()])
# Concat all measurements into a multi-index dataframe and return it
df_all = pd.concat(df_dict.values(), keys=df_dict.keys())
df_all.index.names = ("parameter", "location")
df_all.reset_index(level='location', inplace=True)
df_all['estim_time'] = calculation_time
df_all['estim_file'] = filename
return df_all.fillna(0)
def publish_forecast(producer: KafkaProducer, topic: str, df: pd.DataFrame, location_lookup: dict):
"""Transform the dataframe (DF) and send it to the Kafka-broker(producer) on the named topic.
Parameters
----------
producer : KafkaProducer
The KafkaProducer where the data should be sent.
topic : str
Topic where the data should be delivered.
df : pd.DataFrame
Dataframe containing the data that needs to be sent to Kafka.
location_lookup : dict
Dictionary where locations can be looked up.
"""
# Load estimation time and filename
estim_time = df.iloc[0]["estim_time"]
estim_file = df.iloc[0]["estim_file"]
estim_type = estim_file.split("_")[0]
for location in df["location"].unique():
# Load lon and lat positions
location_lookup["dist"] = location_lookup['lon'].sub(float(location.split("_")[0])).abs() + \
location_lookup['lat'].sub(float(location.split("_")[1])).abs()
pos_lon = location_lookup.loc[location_lookup["dist"].idxmin()]["lon"].item()
pos_lat = location_lookup.loc[location_lookup["dist"].idxmin()]["lat"].item()
lon_lat = f"{pos_lon:0.2f}_{pos_lat:0.2f}"
hide_col = ["location", "estim_time", "estim_file"]
# Create json-object with forecast times as array
json_item = {
"estimation_time": estim_time,
"estimation_source": estim_file,
"lon_lat_key": lon_lat,
"position_lon": pos_lon,
"position_lat": pos_lat,
"forecast_type": estim_type,
"forecast_time": df[df['location'] == location].drop(columns=hide_col).columns.tolist()
}
# Add measurements as new arrays
for meas_name in df[df['location'] == location].index:
json_item[meas_name] = df[df['location'] == location].drop(columns=hide_col).loc[meas_name].round(2).tolist()
# Send data to kafka
producer.send(topic, json.dumps(json_item))
def setup_ksql(host: str, ksql_config: dict, timer: scheduler = None) -> bool:
"""This function is being deprecated ASAP."""
if timer is not None:
timer.enter(3600, 1, setup_ksql, (ksql_config, timer))
# Verifying connection
log.info(f"(Re)creating kSQLdb setup on host '{host}'..")
try:
response = requests.get(f"http://{host}/info")
if response.status_code != 200:
raise Exception('Host responded with error.')
except Exception as e:
log.exception(e)
log.exception(f"Rest API on 'http://{host}/info' did not respond as expected." +
" Make sure environment variable 'KSQL_HOST' is correct.")
return False
# Drop all used tables and streams (to prepare for rebuild)
log.info('Host responded - trying to DROP tables and streams to re-create them.')
try:
table_drop_string = ' '.join([f"DROP TABLE IF EXISTS {item['NAME']};" for item in ksql_config["config"][::-1]
if item['TYPE'] == 'TABLE'])
stream_drop_string = ' '.join([f"DROP STREAM IF EXISTS {item['NAME']};" for item in ksql_config["config"][::-1]
if item['TYPE'] == 'STREAM'])
if len(table_drop_string) > 1:
response = requests.post(f"http://{host}/ksql", json={"ksql": table_drop_string, "streamsProperties": {}})
if response.status_code != 200:
log.debug(response.json())
raise Exception('Host responded with error when DROPing tables.')
if len(stream_drop_string) > 1:
response = requests.post(f"http://{host}/ksql", json={"ksql": stream_drop_string, "streamsProperties": {}})
if response.status_code != 200:
log.debug(response.json())
raise Exception('Host responded with error when DROPing streams.')
except Exception as e:
log.exception(e)
log.exception("Error when trying to drop tables and/or streams.")
return False
# Create streams and tables based on config
log.info("kSQL host accepted config DROP - trying to rebuild config.")
try:
for ksql_item in ksql_config['config']:
response = requests.post(f"http://{host}/ksql", json={"ksql": f"CREATE {ksql_item['TYPE']} " +
f"{ksql_item['NAME']} {ksql_item['CONFIG']};", "streamsProperties": {}})
if response.status_code != 200:
log.debug(response.json())
raise Exception(f"Error when trying to create {ksql_item['TYPE']} '{ksql_item['NAME']}'' - " +
f"got status code '{response.status_code}'")
if response.json().pop()['commandStatus']['status'] != 'SUCCESS':
log.debug(response.json())
raise Exception(f"Error when trying to create {ksql_item['TYPE']} '{ksql_item['NAME']}'' - " +
f"got reponse '{response.json().pop()['commandStatus']['status']}'")
log.info(f"kSQL host accepted CREATE {ksql_item['TYPE']} {ksql_item['NAME']} - continuing..")
except Exception as e:
log.exception(e)
log.exception("Error when rebuilding streams and tables.")
return False
# All went well!
log.info(f"kSQLdb setup on host '{host}' was (re)created.")
return True
def load_config(coords_file: str, ksql_file: str, topic: str) -> Tuple[dict, dict, pd.DataFrame]:
"""Read config from 'coords_file' and 'ksql_file' and then return as tuple 'output_path'.
Parameters
----------
coords_file : str
Path of the config-file with coordinates.
ksql_file : str
Path of the kSQL config-file.
topic : str
Used for eval part. Will be deprecated soon.
Returns
-------
dict
kSQL mapping.
dict
Fields in the kSQL setup.
pd.DataFrame
Frame with GPS coordinates.
"""
# Initialize coordinate and field-name lookup dictionaries
coords = pd.read_csv(coords_file, index_col=0)
mapping = json.loads(open(ksql_file).read())
# Compute/evaluate the configuration
for config in mapping['config']:
config['CONFIG'] = eval(config['CONFIG'])
fields = {text: field['ID'] for field in mapping['fields'] for text in field['Text']}
# Return values
return (mapping, fields, coords)
def generate_dummy_input(template_path: str, output_path: str, timer: scheduler = None):
"""Take templates from 'template_path', update timestamps and output them to 'output_path'.
Parameters
----------
template_path : str
The path where the templates can be found.
output_path : str
The path where the mock data should be written to.
timer : scheduler
(Optional) If specified, a new run will be scheduled for now + ~1h
"""
log.debug("Running dummy-input generation")
if timer is not None:
next_run = (dt.now()).replace(microsecond=0, second=0, minute=30) + td(hours=1)
timer.enterabs(next_run.timestamp(), 1, generate_dummy_input, (template_path, output_path, timer))
# Make template-file config
CONFIG_DATA = {
r"^ENetNEA_\d{10}\.txt$": {
"filename": "ENetNEA_<timestamp>.txt",
"delay_h": 3,
"timelist": [1, 4, 7, 10, 13, 16, 19, 22]},
r"^EnetEcm_\d{10}\.txt$": {
"filename": "EnetEcm_<timestamp>.txt",
"delay_h": 7,
"timelist": [8, 20]},
r"^ConWx_prog_\d{10}_048\.dat$": {
"filename": "ConWx_prog_<timestamp>_048.dat",
"delay_h": 5,
"timelist": [0, 6, 12, 18]},
r"^ConWx_prog_\d{10}_180\.dat$": {
"filename": "ConWx_prog_<timestamp>_180.dat",
"delay_h": 7,
"timelist": [2, 8, 14, 20]}}
# Go through all files in template path and check if they fit any of the config-regex
for template_file in [fs_item for fs_item in os.scandir(template_path) if fs_item.is_file()]:
for config in [CONFIG_DATA[key] for key in CONFIG_DATA.keys() if re.search(key, template_file.name)]:
# Determine if the file is expected to arrive 'now'
if dt.now().hour in config['timelist']:
with open(template_file.path) as f:
template = f.read().split('\n')
new_timestamp = time.strftime(r"%Y%m%d%H", (dt.now()-td(hours=config['delay_h'])).timetuple())
new_filename = config['filename'].replace('<timestamp>', new_timestamp)
with open(os.path.join(output_path, new_filename), "w") as f:
f.write('\n'.join(change_dummy_timestamp(template, dt.now()-td(hours=config['delay_h']))))
log.info(f"Created dummy-file '{new_filename}'")
continue
def change_dummy_timestamp(contents: List[str], new_t0: dt = dt.now(), max_forecast_h: int = 1000) -> List[str]:
"""Takes file contents (contents) as a list of lines and then changes the timestamp base on new_t0.
Parameters
----------
contents : List[str]
Contents of the forecast-template.
new_t0 : datetime.datetime
(Optional) The new t0-timestamp.
Default = now().
max_forecast_h : int
(Optional) Maximum hours - only used to somewhat verify regex value is a timestamp.
Default = 1000 (leave alone if unsure)
"""
# All templates have the t0 time at the end of first line after a '='-sign
timestring = contents[0].replace(' ', '').split('=')[-1]
template_t0 = dt.fromtimestamp(time.mktime(time.strptime(timestring, r"%Y%m%d%H")))
new_contents = []
for row in contents:
new_row = row
# Regex: Look for exactly 10 digits with no digits right before or after
for match in re.finditer(r'(?<!\d)(\d{10})(?!\d)', row):
try:
template_time = dt.fromtimestamp(time.mktime(time.strptime(match.group(0), r"%Y%m%d%H")))
except Exception:
pass
else:
if 0 <= (template_time - template_t0).total_seconds()/3600 < max_forecast_h:
new_time = new_t0 + (template_time - template_t0)
new_row = new_row[:match.start()] + time.strftime(r"%Y%m%d%H", new_time.timetuple()) + \
new_row[match.end():]
new_contents.append(new_row)
return new_contents
def main_loop(producer: KafkaProducer, topic: str, input_folder: str, file_filter: str, field_dict: dict,
coords_dict: dict, scan_interval_s: int = 5, timer: scheduler = None):
# Save input arguments to pass into timer at the end of function
local_args = tuple(locals().values())
log.debug(f"Scanning '{input_folder}' folder..")
for file in [fs_item for fs_item in os.scandir(input_folder) if fs_item.is_file()]:
if re.search(file_filter, file.name) is not None:
log.info(f"Parsing file '{file.path}'.")
publish_forecast(producer, topic, extract_forecast(file.path, field_dict), coords_dict)
os.remove(file.path)
else:
log.warning(f'Unknown file found: {file.path}')
if timer is not None:
timer.enter(scan_interval_s, 1, main_loop, local_args)
if __name__ == "__main__":
# Set up logging
if os.environ.get('DEBUG', 'FALSE').upper() == 'FALSE':
# __main__ will output INFO-level, everything else stays at WARNING
logging.basicConfig(format="%(levelname)s:%(asctime)s:%(name)s - %(message)s")
logging.getLogger(__name__).setLevel(logging.INFO)
elif os.environ['DEBUG'].upper() == 'TRUE':
# Set EVERYTHING to DEBUG level
logging.basicConfig(format="%(levelname)s:%(asctime)s:%(name)s - %(message)s", level=logging.DEBUG)
log.debug('Setting all logs to debug-level')
else:
raise ValueError(f"'DEBUG' env. variable is '{os.environ['DEBUG']}', but must be either 'TRUE', 'FALSE' or unset.")
log.info("Initializing forecast-parser..")
# Set up constants, load data from files and initialize timer
FILE_FILTER = r"(E[Nn]et(NEA|Ecm)_|ConWx_prog_)\d+(_\d{3})?\.(txt|dat)"
FOLDER_CHECK_WAIT = 5
FORECAST_FOLDER = "/forecast-files/"
TEMPLATE_FOLDER = "/app/"
kafka_topic = os.environ.get('KAFKA_TOPIC', "weather-forecast-raw")
mapping, fields, coords = load_config("app/gridpoints.csv", "app/ksql-config.json", kafka_topic)
timer = scheduler(time.time, time.sleep)
# Set up Kafka
if os.environ.get('KAFKA_HOST') is None:
raise ValueError("KAFKA_HOST is a required variable but it has not been set.")
else:
try:
producer = KafkaProducer(bootstrap_servers=os.environ['KAFKA_HOST'], value_serializer=lambda x: x.encode('utf-8'))
except Exception:
raise ConnectionError(f"Connection to '{os.environ['KAFKA_HOST']}' failed. Check evironment variable "
"'KAFKA_HOST' and reload the script to try again.")
else:
log.debug("Kafka connection established.")
timer.enter(15, 1, main_loop, (producer, kafka_topic, FORECAST_FOLDER, FILE_FILTER,
fields, coords, FOLDER_CHECK_WAIT, timer))
# Set up KSQL
if os.environ.get('KSQL_HOST') is None:
log.warning("'KSQL_HOST' parameter not set. Skipping KSQL setup.")
else:
log.info(f"Expecting KSQL at: {os.environ['KSQL_HOST']}")
timer.enter(0, 1, setup_ksql, (os.environ['KSQL_HOST'], mapping, timer))
# Set up mocking of data
if os.environ.get('USE_MOCK_DATA', 'FALSE').upper() == 'FALSE':
pass
elif os.environ['USE_MOCK_DATA'] == 'TRUE':
# Run creation of mock-data at firstcoming x:30 absolute time
next_run = (dt.now()).replace(microsecond=0, second=0, minute=30)
if dt.now().minute >= 30:
next_run += td(hours=1)
timer.enterabs(next_run.timestamp(), 1, generate_dummy_input, (TEMPLATE_FOLDER, FORECAST_FOLDER, timer))
else:
raise ValueError(f"'USE_MOCK_DATA' env. variable is '{os.environ['USE_MOCK_DATA']}',"
" but must be either 'TRUE', 'FALSE' or unset.")
# Start the scheduler
log.info("Initialization done - Starting scheduler..")
timer.run()
| 43.72796
| 126
| 0.602995
|
652a1f79fa3bbbf570848cf96e051b4a0677f231
| 3,235
|
lua
|
Lua
|
data/scripts/prefabs/pigking.lua
|
GuLiPing-Hz/Dontstarve_m
|
c2f12c8c2b79ed6d5762b130f5702d70bc020596
|
[
"MIT"
] | 4
|
2019-11-18T08:13:29.000Z
|
2021-04-02T00:08:35.000Z
|
data/scripts/prefabs/pigking.lua
|
GuLiPing-Hz/Dontstarve_m
|
c2f12c8c2b79ed6d5762b130f5702d70bc020596
|
[
"MIT"
] | null | null | null |
data/scripts/prefabs/pigking.lua
|
GuLiPing-Hz/Dontstarve_m
|
c2f12c8c2b79ed6d5762b130f5702d70bc020596
|
[
"MIT"
] | 2
|
2019-08-04T07:12:15.000Z
|
2019-12-24T03:34:16.000Z
|
local assets=
{
Asset("ANIM", "anim/pig_king.zip"),
Asset("SOUND", "sound/pig.fsb"),
}
local prefabs =
{
"goldnugget",
}
local function OnGetItemFromPlayer(inst, giver, item)
if item.components.tradable.goldvalue > 0 then
inst.AnimState:PlayAnimation("cointoss")
inst.AnimState:PushAnimation("happy")
inst.AnimState:PushAnimation("idle", true)
inst:DoTaskInTime(20/30, function()
inst.SoundEmitter:PlaySound("dontstarve/pig/PigKingThrowGold")
for k = 1, item.components.tradable.goldvalue do
local nug = SpawnPrefab("goldnugget")
local pt = Vector3(inst.Transform:GetWorldPosition()) + Vector3(0,4.5,0)
nug.Transform:SetPosition(pt:Get())
local down = TheCamera:GetDownVec()
local angle = math.atan2(down.z, down.x) + (math.random()*60-30)*DEGREES
--local angle = (-TUNING.CAM_ROT-90 + math.random()*60-30)/180*PI
local sp = math.random()*4+2
nug.Physics:SetVel(sp*math.cos(angle), math.random()*2+8, sp*math.sin(angle))
end
end)
inst:DoTaskInTime(1.5, function()
inst.SoundEmitter:PlaySound("dontstarve/pig/PigKingHappy")
end)
inst.happy = true
if inst.endhappytask then
inst.endhappytask:Cancel()
end
inst.endhappytask = inst:DoTaskInTime(5, function()
inst.happy = false
inst.endhappytask = nil
end)
end
end
local function OnRefuseItem(inst, giver, item)
inst.SoundEmitter:PlaySound("dontstarve/pig/PigKingReject")
inst.AnimState:PlayAnimation("unimpressed")
inst.AnimState:PushAnimation("idle", true)
inst.happy = false
end
local function fn(Sim)
local inst = CreateEntity()
local minimap = inst.entity:AddMiniMapEntity()
minimap:SetPriority( 5 )
minimap:SetIcon( "pigking.png" )
minimap:SetPriority( 1 )
inst.entity:AddTransform()
inst.entity:AddAnimState()
inst.entity:AddSoundEmitter()
inst.entity:AddDynamicShadow()
inst.DynamicShadow:SetSize( 10, 5 )
MakeObstaclePhysics(inst, 2, .5)
--inst.Transform:SetScale(1.5,1.5,1.5)
inst:AddTag("king")
inst.AnimState:SetBank("Pig_King")
inst.AnimState:SetBuild("Pig_King")
inst.AnimState:PlayAnimation("idle", true)
inst:AddComponent("inspectable")
inst:AddComponent("trader")
inst.components.trader:SetAcceptTest(
function(inst, item)
return item.components.tradable.goldvalue > 0
end)
inst.components.trader.onaccept = OnGetItemFromPlayer
inst.components.trader.onrefuse = OnRefuseItem
inst:ListenForEvent( "nighttime", function(global, data)
inst.components.trader:Disable()
inst.AnimState:PlayAnimation("sleep_pre")
inst.AnimState:PushAnimation("sleep_loop", true)
end, GetWorld())
inst:ListenForEvent( "daytime", function(global, data)
inst.components.trader:Enable()
inst.AnimState:PlayAnimation("sleep_pst")
inst.AnimState:PushAnimation("idle", true)
end, GetWorld())
return inst
end
return Prefab( "common/objects/pigking", fn, assets, prefabs)
| 30.809524
| 93
| 0.650386
|
807f61d2b798c265693dea4c46e51f001844e4ad
| 7,235
|
html
|
HTML
|
public/docs/clearLocks.html
|
organisciak/crowdy-backend
|
c5c85776d492fb97f18f6ad895c4f0765e804e61
|
[
"MIT"
] | null | null | null |
public/docs/clearLocks.html
|
organisciak/crowdy-backend
|
c5c85776d492fb97f18f6ad895c4f0765e804e61
|
[
"MIT"
] | null | null | null |
public/docs/clearLocks.html
|
organisciak/crowdy-backend
|
c5c85776d492fb97f18f6ad895c4f0765e804e61
|
[
"MIT"
] | null | null | null |
<!DOCTYPE html>
<html>
<head>
<title>ClearLocks</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul class="sections">
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">¶</a>
</div>
<h1 id="clearlocks">ClearLocks</h1>
</div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">¶</a>
</div>
<p>Check which locked files are no longer unassignable</p>
<p>The Turk API tells you if a HIT is unassignable (all assignments
started or submitted), but doesn’t tell you if the individual assignments
are available. So, the best we can do is watch for assignment locks in our
database when HIT.NumberofAssignmentsPending is 0. If it’s >0 but <All,
we don’t know which assignment is improperly locked.
The workaround for this would be to put up only 1 assignment HITs, though
the trade-off there is that you may annoy hi-frequency workers by saying
you have, say, 100 assignments when you only a few.</p>
</div>
<div class="content"><div class='highlight'><pre>
async = <span class="hljs-built_in">require</span> <span class="hljs-string">'async'</span>
crowdy = <span class="hljs-built_in">require</span> <span class="hljs-string">'./crowdyturk'</span>
argv = <span class="hljs-built_in">require</span>(<span class="hljs-string">'yargs'</span>)
.boolean(<span class="hljs-string">'p'</span>).alias(<span class="hljs-string">'p'</span>, <span class="hljs-string">'production'</span>)
.describe(<span class="hljs-string">'production'</span>, <span class="hljs-string">'Run on production.'</span>)
.help(<span class="hljs-string">'h'</span>).alias(<span class="hljs-string">'h'</span>, <span class="hljs-string">'help'</span>)
.argv
mturk = crowdy.mturk(argv.production)
mongoose = <span class="hljs-built_in">require</span> <span class="hljs-string">'mongoose'</span>
config = <span class="hljs-built_in">require</span> <span class="hljs-string">'config'</span>
db_server = <span class="hljs-string">'mongodb://'</span> + config.get(<span class="hljs-string">'db.host'</span>) + <span class="hljs-string">'/'</span> + config.get(<span class="hljs-string">'db.name'</span>)
mongoose.connect db_server
db = mongoose.connection
TaskSet = <span class="hljs-built_in">require</span> <span class="hljs-string">'../models/taskset.js'</span>
<span class="hljs-function">
<span class="hljs-title">main</span> = <span class="hljs-params">()</span> -></span>
async.parallel({
<span class="hljs-attribute">lockedInMongo</span>:getLocked
<span class="hljs-attribute">noPending</span>:getNoPending
}, <span class="hljs-function"><span class="hljs-params">(err, result)</span>-></span>
<span class="hljs-keyword">if</span> err <span class="hljs-keyword">then</span> <span class="hljs-built_in">console</span>.error(err)</pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">¶</a>
</div>
<p>Compare the two lists</p>
</div>
<div class="content"><div class='highlight'><pre> toClear = result.lockedInMongo.filter(<span class="hljs-function"><span class="hljs-params">(doc)</span> -></span>
<span class="hljs-keyword">return</span> (doc.turk_hit_id <span class="hljs-keyword">in</span> result.noPending)
)
<span class="hljs-keyword">if</span> toClear.length == <span class="hljs-number">0</span>
<span class="hljs-built_in">console</span>.log <span class="hljs-string">"No errant locks"</span>
<span class="hljs-keyword">else</span>
<span class="hljs-built_in">console</span>.log <span class="hljs-string">"<span class="hljs-subst">#{toClear.length}</span> locks to be removed"</span>
toClearIds = toClear.map(<span class="hljs-function"><span class="hljs-params">(item)</span>-></span>item._id)</pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">¶</a>
</div>
<p>Clear locks from thats where we know there shouldn’t be any</p>
</div>
<div class="content"><div class='highlight'><pre> TaskSet.remove({<span class="hljs-attribute">_id</span>:{<span class="hljs-attribute">$in</span>: toClearIds}, <span class="hljs-attribute">lock</span>:<span class="hljs-literal">true</span>})
.exec(<span class="hljs-function"><span class="hljs-params">(err, results)</span> -></span>
<span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">then</span> <span class="hljs-built_in">console</span>.error err
db.close()
)
)
<span class="hljs-function">
<span class="hljs-title">getLocked</span> = <span class="hljs-params">(callback)</span> -></span>
TaskSet.find({<span class="hljs-attribute">lock</span>:<span class="hljs-literal">true</span>}).select(<span class="hljs-string">'turk_hit_id'</span>).exec(callback)</pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">¶</a>
</div>
<p>Get HITs with 0 pending assignments.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">getNoPending</span> = <span class="hljs-params">(callback)</span> -></span>
matchingHITs = []
crowdy.getHITs(
<span class="hljs-function">(<span class="hljs-params">(hit, cb)</span> -></span>
matchingHITs.push hit.HITId
cb(<span class="hljs-literal">null</span>)
),
{
<span class="hljs-attribute">print</span>:<span class="hljs-literal">false</span>
<span class="hljs-attribute">filter</span>: <span class="hljs-function"><span class="hljs-params">(hit)</span> -></span> <span class="hljs-keyword">return</span> (parseInt(hit.NumberOfAssignmentsPending) <span class="hljs-keyword">is</span> <span class="hljs-number">0</span>)
},
<span class="hljs-function"><span class="hljs-params">(err)</span> -></span>
callback(err, matchingHITs)
)
main()</pre></div></div>
</li>
</ul>
</div>
</body>
</html>
| 46.378205
| 285
| 0.597236
|
f4293d8c8138771d90f24214dae1a842a5d44183
| 898
|
cs
|
C#
|
CollectionsDemo/CollectionsDemo/Cube.cs
|
RakeshThakur26/Day5-Training
|
529fba91156ea99faf10f2a279c89b3fb44ff48a
|
[
"MIT"
] | null | null | null |
CollectionsDemo/CollectionsDemo/Cube.cs
|
RakeshThakur26/Day5-Training
|
529fba91156ea99faf10f2a279c89b3fb44ff48a
|
[
"MIT"
] | null | null | null |
CollectionsDemo/CollectionsDemo/Cube.cs
|
RakeshThakur26/Day5-Training
|
529fba91156ea99faf10f2a279c89b3fb44ff48a
|
[
"MIT"
] | null | null | null |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CollectionsDemo
{
interface Shapes
{
double area();
double volume();
}
class Cube : Shapes
{
int x = 10;
public double area()
{
Console.Write("Area of Cube is = ");
return (6*x*x);
}
public double volume()
{
Console.Write("Volume of Cube is = ");
return (x*x*x);
}
}
class circle : Shapes
{
int radius = 10;
public double area()
{
Console.Write("Area of Circle is = ");
return (3.142 * radius * radius);
}
public double volume()
{
Console.Write("Volume of Circle is = ");
return (0);
}
}
}
| 16.62963
| 52
| 0.47216
|
c1437e0307b74f281794799ae90c3497130b1888
| 68
|
sql
|
SQL
|
packaging/dbscripts/upgrade/04_04_0480_add_boot_uuid.sql
|
jihwahn1018/ovirt-engine
|
5c8a3d9a9637eefb28e4accc3cbd2b7f530d5ec9
|
[
"Apache-2.0"
] | 347
|
2015-01-20T14:13:21.000Z
|
2022-03-31T17:53:11.000Z
|
packaging/dbscripts/upgrade/04_04_0480_add_boot_uuid.sql
|
jihwahn1018/ovirt-engine
|
5c8a3d9a9637eefb28e4accc3cbd2b7f530d5ec9
|
[
"Apache-2.0"
] | 128
|
2015-05-22T19:14:32.000Z
|
2022-03-31T08:11:18.000Z
|
packaging/dbscripts/upgrade/04_04_0480_add_boot_uuid.sql
|
jihwahn1018/ovirt-engine
|
5c8a3d9a9637eefb28e4accc3cbd2b7f530d5ec9
|
[
"Apache-2.0"
] | 202
|
2015-01-04T06:20:49.000Z
|
2022-03-08T15:30:08.000Z
|
select fn_db_add_column('vds_dynamic', 'boot_uuid', 'VARCHAR(64)');
| 34
| 67
| 0.75
|
f4cb2eb5a659555a16bd6c7a03c47ec7c96ae98e
| 4,356
|
tsx
|
TypeScript
|
packages/@remirror/react-social/src/hooks/__tests__/use-social-emoji.spec.tsx
|
juanpicado/remirror
|
898c62e054ddbd8422441d629d5b555d869df88e
|
[
"MIT"
] | null | null | null |
packages/@remirror/react-social/src/hooks/__tests__/use-social-emoji.spec.tsx
|
juanpicado/remirror
|
898c62e054ddbd8422441d629d5b555d869df88e
|
[
"MIT"
] | null | null | null |
packages/@remirror/react-social/src/hooks/__tests__/use-social-emoji.spec.tsx
|
juanpicado/remirror
|
898c62e054ddbd8422441d629d5b555d869df88e
|
[
"MIT"
] | null | null | null |
import { fireEvent } from '@testing-library/dom';
import { act, renderHook } from '@testing-library/react-hooks';
import { RemirrorTestChain } from 'jest-remirror';
import React, { FC } from 'react';
import { createReactManager } from '@remirror/testing/react';
import { SocialProvider } from '../../components/social-provider';
import { socialManagerArgs } from '../../social-utils';
import { useSocialRemirror } from '../use-social';
import { useSocialEmoji } from '../use-social-emoji';
jest.useFakeTimers();
function createChain() {
const manager = createReactManager(...socialManagerArgs([]));
const chain = RemirrorTestChain.create(manager);
const { doc, p } = chain.nodes;
const InnerComponent: FC = ({ children }) => {
const { getRootProps } = useSocialRemirror();
return (
<>
{children}
<div {...getRootProps()} />
</>
);
};
const Wrapper: FC = ({ children }) => {
return (
<SocialProvider manager={manager} initialContent={[doc(p('Initial content ')), 'end']}>
<InnerComponent>{children}</InnerComponent>
</SocialProvider>
);
};
return { chain, Wrapper };
}
function acts(methods: Array<() => void | undefined>) {
for (const method of methods) {
act(method);
}
}
describe('useSocialEmoji', () => {
it('should respond to emoji changes', () => {
const { chain, Wrapper } = createChain();
const { result } = renderHook(() => useSocialEmoji(), {
wrapper: Wrapper,
});
expect(result.current).toEqual({
list: [],
command: undefined,
index: 0,
show: true,
});
act(() => {
chain.insertText(':a');
});
expect(result.current.command).toBeFunction();
expect(result.current.list.length > 0).toBeTrue();
});
it('should `show: false` when losing focus', () => {
const { chain, Wrapper } = createChain();
const { result } = renderHook(() => useSocialEmoji(), {
wrapper: Wrapper,
});
act(() => {
fireEvent.blur(chain.dom);
jest.runAllTimers();
});
expect(result.current).toEqual({
list: [],
command: undefined,
index: 0,
show: false,
});
act(() => {
fireEvent.focus(chain.dom);
jest.runAllTimers();
});
expect(result.current).toEqual({
list: [],
command: undefined,
index: 0,
show: true,
});
});
it('should correctly add the emoji when the command is called', () => {
const { Wrapper, chain } = createChain();
const { result } = renderHook(() => useSocialEmoji(), {
wrapper: Wrapper,
});
acts([
() => {
chain.insertText(':');
},
() => result.current.command?.(result.current.list[0]),
]);
expect(chain.innerHTML).toMatchInlineSnapshot(`
<p>
Initial content 👍
</p>
`);
});
it('should clear suggestions when the `Escape` key is pressed', () => {
const { chain, Wrapper } = createChain();
const { result } = renderHook(() => useSocialEmoji(), {
wrapper: Wrapper,
});
acts([
() => {
chain.insertText(':');
},
() => {
chain.press('Escape');
},
]);
expect(result.current).toEqual({
list: [],
command: undefined,
index: 0,
show: true,
});
});
it('should choose selection when `Enter` key is pressed', () => {
const { Wrapper, chain } = createChain();
renderHook(() => useSocialEmoji(), {
wrapper: Wrapper,
});
acts([
() => {
chain.insertText(':');
},
() => {
chain.press('Enter');
},
]);
expect(chain.innerHTML).toMatchInlineSnapshot(`
<p>
Initial content 👍
</p>
`);
});
it('should update index when `Arrow` keys are used', () => {
const { Wrapper, chain } = createChain();
const { result } = renderHook(() => useSocialEmoji(), {
wrapper: Wrapper,
});
acts([
() => {
chain.insertText(':');
},
() => {
chain.press('ArrowDown');
},
]);
expect(result.current.index).toBe(1);
acts([
() => {
chain.press('ArrowUp');
},
() => {
chain.press('ArrowUp');
},
]);
expect(result.current.index).toBe(result.current.list.length - 1);
});
});
| 21.78
| 93
| 0.538108
|
2564fdad49b10150660bdda9699b5e7936d8ac0a
| 1,922
|
js
|
JavaScript
|
vst3sdk/doc/vstgui/html/class_v_s_t_g_u_i_1_1_a_eff_g_u_i_editor.js
|
MOAMaster/AudioPlugSharp-SamplePlugins
|
dbe3cc445a7834e7e0f922f53a35973d6d9b583a
|
[
"MIT"
] | null | null | null |
vst3sdk/doc/vstgui/html/class_v_s_t_g_u_i_1_1_a_eff_g_u_i_editor.js
|
MOAMaster/AudioPlugSharp-SamplePlugins
|
dbe3cc445a7834e7e0f922f53a35973d6d9b583a
|
[
"MIT"
] | null | null | null |
vst3sdk/doc/vstgui/html/class_v_s_t_g_u_i_1_1_a_eff_g_u_i_editor.js
|
MOAMaster/AudioPlugSharp-SamplePlugins
|
dbe3cc445a7834e7e0f922f53a35973d6d9b583a
|
[
"MIT"
] | null | null | null |
var class_v_s_t_g_u_i_1_1_a_eff_g_u_i_editor =
[
[ "AEffGUIEditor", "class_v_s_t_g_u_i_1_1_a_eff_g_u_i_editor.html#a1607650d2fb5f4a088b4003ed5d1ce87", null ],
[ "~AEffGUIEditor", "class_v_s_t_g_u_i_1_1_a_eff_g_u_i_editor.html#ac15e2e4e59d33716663ac39c96f18b66", null ],
[ "beforeSizeChange", "class_v_s_t_g_u_i_1_1_a_eff_g_u_i_editor.html#abf898f8656c79eab02575890f403927c", null ],
[ "doIdleStuff", "class_v_s_t_g_u_i_1_1_a_eff_g_u_i_editor.html#a1730dc80596102088370374a9f0abce6", null ],
[ "draw", "class_v_s_t_g_u_i_1_1_a_eff_g_u_i_editor.html#a9ee23529fea65731ae4b3de4707135ea", null ],
[ "getEffect", "class_v_s_t_g_u_i_1_1_a_eff_g_u_i_editor.html#a67be704c306f3d46b0f28deac804dcec", null ],
[ "getKnobMode", "class_v_s_t_g_u_i_1_1_a_eff_g_u_i_editor.html#a1bfecf2f4ae3d46222627b2e89597629", null ],
[ "getRect", "class_v_s_t_g_u_i_1_1_a_eff_g_u_i_editor.html#a2d0410aa48e877b5b73e9ad41eaca73c", null ],
[ "getTicks", "class_v_s_t_g_u_i_1_1_a_eff_g_u_i_editor.html#a05dffb509478801c59747249f05dafe5", null ],
[ "getVstGuiVersion", "class_v_s_t_g_u_i_1_1_a_eff_g_u_i_editor.html#ac6dc49d74f61225c9178c3f129e6010d", null ],
[ "idle", "class_v_s_t_g_u_i_1_1_a_eff_g_u_i_editor.html#a83abbeda22fc5e6c2b35523b64199c1c", null ],
[ "onWheel", "class_v_s_t_g_u_i_1_1_a_eff_g_u_i_editor.html#a9a6301b4d39e17c07ba5d926cbcefcab", null ],
[ "open", "class_v_s_t_g_u_i_1_1_a_eff_g_u_i_editor.html#a4422a7c37ff9837ee07403d3217319c7", null ],
[ "setKnobMode", "class_v_s_t_g_u_i_1_1_a_eff_g_u_i_editor.html#a1b2cf8b784cdc6cfd5cfffeb49bbad84", null ],
[ "setParameter", "class_v_s_t_g_u_i_1_1_a_eff_g_u_i_editor.html#ad59270bce62f60e24ca1368cd06adf86", null ],
[ "wait", "class_v_s_t_g_u_i_1_1_a_eff_g_u_i_editor.html#a7c93ea375d0afa3024f09ddc91c015e1", null ],
[ "rect", "class_v_s_t_g_u_i_1_1_a_eff_g_u_i_editor.html#a934d3e77bd6de037c1caa3b7c11fed8c", null ]
];
| 96.1
| 116
| 0.818939
|
e23d002d8d01609c7a1ee0cf414a269d20928d05
| 608
|
py
|
Python
|
yandex_kassa/loggers.py
|
ZarinaAfl/django-yandex-kassa
|
da1f68c7d3fa5976aa9071052c2767fa676b1470
|
[
"MIT"
] | 28
|
2015-12-28T12:49:11.000Z
|
2020-12-16T02:38:58.000Z
|
yandex_kassa/loggers.py
|
ZarinaAfl/django-yandex-kassa
|
da1f68c7d3fa5976aa9071052c2767fa676b1470
|
[
"MIT"
] | 11
|
2015-12-13T16:50:17.000Z
|
2017-09-20T11:48:14.000Z
|
yandex_kassa/loggers.py
|
ZarinaAfl/django-yandex-kassa
|
da1f68c7d3fa5976aa9071052c2767fa676b1470
|
[
"MIT"
] | 24
|
2016-04-08T12:42:27.000Z
|
2021-03-26T07:03:19.000Z
|
# -*- coding: utf-8 -*-
import json
import logging
class ErrorsFilter(logging.Filter):
def filter(self, record):
errors = getattr(record, 'errors', None)
if errors:
if isinstance(errors, dict):
try:
record.errors = json.dumps(errors,
encoding='utf8',
ensure_ascii=False)
except:
pass
else:
record.errors = errors
else:
record.errors = ''
return True
| 25.333333
| 66
| 0.424342
|
d025d0860122f0b23098d8f665f5ed5f165a42ad
| 515
|
swift
|
Swift
|
Example/DeviceData/Model/PostDataResponse.swift
|
sahil4cartoondeveloper/DeviceDataLibrary
|
ca368348d27727720e302fda1c702657065735f2
|
[
"MIT"
] | null | null | null |
Example/DeviceData/Model/PostDataResponse.swift
|
sahil4cartoondeveloper/DeviceDataLibrary
|
ca368348d27727720e302fda1c702657065735f2
|
[
"MIT"
] | null | null | null |
Example/DeviceData/Model/PostDataResponse.swift
|
sahil4cartoondeveloper/DeviceDataLibrary
|
ca368348d27727720e302fda1c702657065735f2
|
[
"MIT"
] | null | null | null |
//
// PostDataResponse.swift
// DeviceData_Example
//
// Created by sahil vadadoriya on 22/10/21.
// Copyright © 2021 CocoaPods. All rights reserved.
//
import Foundation
import ObjectMapper
struct PostDataResponse : Mappable {
var userId : Int?
var id : Int?
var title : String?
var body : String?
init?(map: Map) {
}
mutating func mapping(map: Map) {
userId <- map["userId"]
id <- map["id"]
title <- map["title"]
body <- map["body"]
}
}
| 16.09375
| 52
| 0.586408
|
258940ccb04297fc8a2d6dba9b6659b6d31e0dbc
| 711
|
cs
|
C#
|
YanZhiwei.DotNet2.Utilities.WinFromExamples/winSerialPortExamle.cs
|
wind2006/DotNet.Utilities
|
21726109548bed8a09d537a9080cf2e89ba01c6f
|
[
"MIT"
] | 2
|
2019-10-14T16:41:23.000Z
|
2021-02-02T07:03:01.000Z
|
YanZhiwei.DotNet2.Utilities.WinFromExamples/winSerialPortExamle.cs
|
wind2006/DotNet.Utilities
|
21726109548bed8a09d537a9080cf2e89ba01c6f
|
[
"MIT"
] | null | null | null |
YanZhiwei.DotNet2.Utilities.WinFromExamples/winSerialPortExamle.cs
|
wind2006/DotNet.Utilities
|
21726109548bed8a09d537a9080cf2e89ba01c6f
|
[
"MIT"
] | 2
|
2019-04-01T12:47:41.000Z
|
2021-02-02T07:03:02.000Z
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using YanZhiwei.DotNet2.Utilities.Common;
using YanZhiwei.DotNet2.Utilities.Enums;
using YanZhiwei.DotNet2.Utilities.WinForm;
namespace YanZhiwei.DotNet2.Utilities.WinFromExamples
{
public partial class winSerialPortExamle : Form
{
public winSerialPortExamle()
{
InitializeComponent();
}
private void SerialPortExamle_Load(object sender, EventArgs e)
{
comboBox1.DataSource = EnumHelper.GetValues<int>(typeof(SerialPortBaudRates));
}
}
}
| 23.7
| 90
| 0.721519
|
73591e04c011aad3ecaaff8693ca8ee5cbafb344
| 1,490
|
sh
|
Shell
|
test/integration/all_tests.sh
|
trekmedics/beacon
|
67db2aa052b98ae2e3381c05ab5b517d223b736e
|
[
"MIT"
] | 6
|
2017-04-02T01:32:37.000Z
|
2020-08-17T16:12:57.000Z
|
test/integration/all_tests.sh
|
trekmedics/beacon
|
67db2aa052b98ae2e3381c05ab5b517d223b736e
|
[
"MIT"
] | null | null | null |
test/integration/all_tests.sh
|
trekmedics/beacon
|
67db2aa052b98ae2e3381c05ab5b517d223b736e
|
[
"MIT"
] | 4
|
2017-09-21T04:18:35.000Z
|
2020-05-18T17:42:44.000Z
|
echo "Running 2_incidents_1_fr"
bundle exec rails r test/integration/test_std_2_incidents_1_fr.rb > test_results.txt
echo "Running addl_res"
bundle exec rails r test/integration/test_std_addl_res.rb >> test_results.txt
echo "Running cannot_locate"
bundle exec rails r test/integration/test_std_cannot_locate.rb >> test_results.txt
echo "Running invalid_response"
bundle exec rails r test/integration/test_std_invalid_response.rb >> test_results.txt
echo "Running needs_assistance"
bundle exec rails r test/integration/test_std_needs_assistance.rb >> test_results.txt
echo "Running no_addl_res"
bundle exec rails r test/integration/test_std_no_addl_res.rb >> test_results.txt
echo "Running no_frs"
bundle exec rails r test/integration/test_std_no_frs.rb >> test_results.txt
echo "Running no_hospital"
bundle exec rails r test/integration/test_std_no_hospital.rb >> test_results.txt
echo "Running no_transport"
bundle exec rails r test/integration/test_std_no_transport.rb >> test_results.txt
echo "Running no_vehicles"
bundle exec rails r test/integration/test_std_no_vehicles.rb >> test_results.txt
echo "Running unknown_number"
bundle exec rails r test/integration/test_std_unknown_number.rb >> test_results.txt
echo "Running admin_created_incident"
bundle exec rails r test/integration/test_std_admin_created_incident.rb >> test_results.txt
echo ''
grep 'Passed' test_results.txt
grep -A2 'Failed' test_results.txt
echo ''
rm test_results.txt
| 46.5625
| 93
| 0.808725
|
2f3fb58f1cd6e42e902bc0e24814c8cad45c8fb2
| 167
|
js
|
JavaScript
|
src/seeds/problems/two-sum/javascript/main.js
|
tabjy/cmpt383-project
|
47b6010b5ec277e8020b0a333cb2ee3fff06928a
|
[
"MIT"
] | null | null | null |
src/seeds/problems/two-sum/javascript/main.js
|
tabjy/cmpt383-project
|
47b6010b5ec277e8020b0a333cb2ee3fff06928a
|
[
"MIT"
] | null | null | null |
src/seeds/problems/two-sum/javascript/main.js
|
tabjy/cmpt383-project
|
47b6010b5ec277e8020b0a333cb2ee3fff06928a
|
[
"MIT"
] | null | null | null |
const nums = process.argv[3].split(', ').map(parseFloat)
const target = parseFloat(process.argv[4])
console.log(require('./solution')(nums, target).sort().join(', '))
| 41.75
| 66
| 0.688623
|
ed3e25fd4e42d3c5edb751b00cfb5f4165deb003
| 399
|
h
|
C
|
tempsensor_v1/src/system/hardware_buttons.h
|
sergioamr/vaccinemonitoring
|
9ae91df587542a1565803053c65809e67a5747f1
|
[
"Apache-2.0"
] | null | null | null |
tempsensor_v1/src/system/hardware_buttons.h
|
sergioamr/vaccinemonitoring
|
9ae91df587542a1565803053c65809e67a5747f1
|
[
"Apache-2.0"
] | null | null | null |
tempsensor_v1/src/system/hardware_buttons.h
|
sergioamr/vaccinemonitoring
|
9ae91df587542a1565803053c65809e67a5747f1
|
[
"Apache-2.0"
] | null | null | null |
/*
* hardware_buttons.h
*
* Created on: Jun 1, 2015
* Author: sergioam
*/
#ifndef HARDWARE_BUTTONS_H_
#define HARDWARE_BUTTONS_H_
#define MODEM_ON !(P4IN & BIT0)
#define POWER_ON !(P4IN & BIT4)
void switchers_setupIO();
uint8_t switch_check_service_pressed();
void hardware_disable_buttons();
void hardware_enable_buttons();
void hardware_actions();
#endif /* HARDWARE_BUTTONS_H_ */
| 18.136364
| 39
| 0.744361
|
9e21fc0e0aee9aaa1bbb909359244c085bb35f6b
| 14,963
|
cs
|
C#
|
src/AmqpBitConverter.cs
|
NakWarsi/amqpnetlite
|
cbc6bef583d6a57ae48bb03ed2ea864770007b48
|
[
"Apache-2.0"
] | 367
|
2015-08-17T06:52:49.000Z
|
2022-03-16T16:53:02.000Z
|
src/AmqpBitConverter.cs
|
NakWarsi/amqpnetlite
|
cbc6bef583d6a57ae48bb03ed2ea864770007b48
|
[
"Apache-2.0"
] | 446
|
2015-08-11T05:05:51.000Z
|
2022-03-31T22:45:16.000Z
|
src/AmqpBitConverter.cs
|
NakWarsi/amqpnetlite
|
cbc6bef583d6a57ae48bb03ed2ea864770007b48
|
[
"Apache-2.0"
] | 173
|
2015-08-13T13:52:14.000Z
|
2022-02-24T07:56:23.000Z
|
// ------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this
// file except in compliance with the License. You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
// CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR
// NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing permissions and
// limitations under the License.
// ------------------------------------------------------------------------------------
namespace Amqp
{
using System;
using Amqp.Types;
/// <summary>
/// Reads primitive values from a buffer or writes primitive values to a buffer in networking order.
/// </summary>
public static class AmqpBitConverter
{
/// <summary>
/// Indicates the byte order ("endianness") in which data is stored in this computer architecture.
/// </summary>
#if MF_FRAMEWORK_VERSION_V4_2
public static readonly bool IsLittleEndian = Microsoft.SPOT.Hardware.Utility.ExtractValueFromArray(new byte[] { 0x01, 0x02 }, 0, 2) == 0x0201u;
#else
public static readonly bool IsLittleEndian = BitConverter.IsLittleEndian;
#endif
/// <summary>
/// Reads a signed byte and advance the buffer read cursor.
/// </summary>
/// <param name="buffer">The buffer to read from.</param>
/// <returns></returns>
public static sbyte ReadByte(ByteBuffer buffer)
{
buffer.ValidateRead(FixedWidth.UByte);
sbyte data = (sbyte)buffer.Buffer[buffer.Offset];
buffer.Complete(FixedWidth.UByte);
return data;
}
/// <summary>
/// Reads an unsigned byte and advance the buffer read cursor.
/// </summary>
/// <param name="buffer">The buffer to read from.</param>
/// <returns></returns>
public static byte ReadUByte(ByteBuffer buffer)
{
return (byte)ReadByte(buffer);
}
/// <summary>
/// Reads a 16-bit signed integer and advance the buffer read cursor.
/// </summary>
/// <param name="buffer">The buffer to read from.</param>
/// <returns></returns>
public static short ReadShort(ByteBuffer buffer)
{
buffer.ValidateRead(FixedWidth.Short);
short data = (short)((buffer.Buffer[buffer.Offset] << 8) | buffer.Buffer[buffer.Offset + 1]);
buffer.Complete(FixedWidth.Short);
return data;
}
/// <summary>
/// Reads a 16-bit unsigned integer and advance the buffer read cursor.
/// </summary>
/// <param name="buffer">The buffer to read from.</param>
/// <returns></returns>
public static ushort ReadUShort(ByteBuffer buffer)
{
return (ushort)ReadShort(buffer);
}
/// <summary>
/// Reads a 32-bit signed integer and advance the buffer read cursor.
/// </summary>
/// <param name="buffer">The buffer to read from.</param>
/// <returns></returns>
public static int ReadInt(ByteBuffer buffer)
{
buffer.ValidateRead(FixedWidth.Int);
int data = ReadInt(buffer.Buffer, buffer.Offset);
buffer.Complete(FixedWidth.Int);
return data;
}
/// <summary>
/// Reads a 32-bit signed integer from the buffer at the specified offset.
/// </summary>
/// <param name="buffer">The buffer to read from.</param>
/// <param name="offset">The offset in the buffer to start reading.</param>
/// <returns></returns>
public static int ReadInt(byte[] buffer, int offset)
{
return (buffer[offset] << 24) | (buffer[offset + 1] << 16) | (buffer[offset + 2] << 8) | buffer[offset + 3];
}
/// <summary>
/// Reads a 32-bit unsigned integer and advance the buffer read cursor.
/// </summary>
/// <param name="buffer">The buffer to read from.</param>
/// <returns></returns>
public static uint ReadUInt(ByteBuffer buffer)
{
return (uint)ReadInt(buffer);
}
/// <summary>
/// Reads a 64-bit signed integer from the buffer and advance the buffer read cursor.
/// </summary>
/// <param name="buffer">The buffer to read from.</param>
/// <returns></returns>
public static long ReadLong(ByteBuffer buffer)
{
buffer.ValidateRead(FixedWidth.Long);
long high = ReadInt(buffer.Buffer, buffer.Offset);
long low = (uint)ReadInt(buffer.Buffer, buffer.Offset + 4);
long data = (high << 32) | low;
buffer.Complete(FixedWidth.Long);
return data;
}
/// <summary>
/// Reads a 64-bit unsigned integer from the buffer and advance the buffer read cursor.
/// </summary>
/// <param name="buffer">The buffer to read from.</param>
/// <returns></returns>
public static ulong ReadULong(ByteBuffer buffer)
{
return (ulong)ReadLong(buffer);
}
/// <summary>
/// Reads a 32-bit floating-point value from the buffer and advance the buffer read cursor.
/// </summary>
/// <param name="buffer">The buffer to read from.</param>
/// <returns></returns>
public static unsafe float ReadFloat(ByteBuffer buffer)
{
int data = ReadInt(buffer);
return *((float*)&data);
}
/// <summary>
/// Reads a 64-bit floating-point value from the buffer and advance the buffer read cursor.
/// </summary>
/// <param name="buffer">The buffer to read from.</param>
/// <returns></returns>
public static unsafe double ReadDouble(ByteBuffer buffer)
{
long data = ReadLong(buffer);
return *((double*)&data);
}
/// <summary>
/// Reads a uuid (16-bytes) from the buffer and advance the buffer read cursor.
/// </summary>
/// <param name="buffer">The buffer to read from.</param>
/// <returns></returns>
public static Guid ReadUuid(ByteBuffer buffer)
{
buffer.ValidateRead(FixedWidth.Uuid);
byte[] d = new byte[FixedWidth.Uuid];
if (AmqpBitConverter.IsLittleEndian)
{
int pos = buffer.Offset;
d[3] = buffer.Buffer[pos++];
d[2] = buffer.Buffer[pos++];
d[1] = buffer.Buffer[pos++];
d[0] = buffer.Buffer[pos++];
d[5] = buffer.Buffer[pos++];
d[4] = buffer.Buffer[pos++];
d[7] = buffer.Buffer[pos++];
d[6] = buffer.Buffer[pos++];
Array.Copy(buffer.Buffer, pos, d, 8, 8);
}
else
{
Array.Copy(buffer.Buffer, buffer.Offset, d, 0, FixedWidth.Uuid);
}
buffer.Complete(FixedWidth.Uuid);
return new Guid(d);
}
/// <summary>
/// Reads bytes from one buffer into another.
/// </summary>
/// <param name="buffer">Source buffer.</param>
/// <param name="data">Destination buffer</param>
/// <param name="offset">The start position to write.</param>
/// <param name="count">The number of bytes to read.</param>
public static void ReadBytes(ByteBuffer buffer, byte[] data, int offset, int count)
{
buffer.ValidateRead(count);
Array.Copy(buffer.Buffer, buffer.Offset, data, offset, count);
buffer.Complete(count);
}
/// <summary>
/// Writes a signed byte into the buffer and advance the buffer write cursor.
/// </summary>
/// <param name="buffer">The buffer to write.</param>
/// <param name="data">The data to write.</param>
public static void WriteByte(ByteBuffer buffer, sbyte data)
{
buffer.ValidateWrite(FixedWidth.Byte);
buffer.Buffer[buffer.WritePos] = (byte)data;
buffer.Append(FixedWidth.Byte);
}
/// <summary>
/// Writes an unsigned byte into the buffer and advance the buffer write cursor.
/// </summary>
/// <param name="buffer">The buffer to write.</param>
/// <param name="data">The data to write.</param>
public static void WriteUByte(ByteBuffer buffer, byte data)
{
WriteByte(buffer, (sbyte)data);
}
/// <summary>
/// Writes a 16-bit signed integer into the buffer and advance the buffer write cursor.
/// </summary>
/// <param name="buffer">The buffer to write.</param>
/// <param name="data">The data to write.</param>
public static void WriteShort(ByteBuffer buffer, short data)
{
buffer.ValidateWrite(FixedWidth.Short);
buffer.Buffer[buffer.WritePos] = (byte)(data >> 8);
buffer.Buffer[buffer.WritePos + 1] = (byte)data;
buffer.Append(FixedWidth.Short);
}
/// <summary>
/// Writes a 16-bit unsigned integer into the buffer and advance the buffer write cursor.
/// </summary>
/// <param name="buffer">The buffer to write.</param>
/// <param name="data">The data to write.</param>
public static void WriteUShort(ByteBuffer buffer, ushort data)
{
WriteShort(buffer, (short)data);
}
/// <summary>
/// Writes a 32-bit signed integer into the buffer and advance the buffer write cursor.
/// </summary>
/// <param name="buffer">The buffer to write.</param>
/// <param name="data">The data to write.</param>
public static void WriteInt(ByteBuffer buffer, int data)
{
buffer.ValidateWrite(FixedWidth.Int);
WriteInt(buffer.Buffer, buffer.WritePos, data);
buffer.Append(FixedWidth.Int);
}
/// <summary>
/// Writes a 32-bit unsigned integer into the buffer at specified offset.
/// </summary>
/// <param name="buffer">The buffer to write.</param>
/// <param name="offset">The offset of the buffer.</param>
/// <param name="data">The data to write.</param>
public static void WriteInt(byte[] buffer, int offset, int data)
{
buffer[offset] = (byte)(data >> 24);
buffer[offset + 1] = (byte)(data >> 16);
buffer[offset + 2] = (byte)(data >> 8);
buffer[offset + 3] = (byte)data;
}
/// <summary>
/// Writes a 32-bit unsigned integer into the buffer and advance the buffer write cursor.
/// </summary>
/// <param name="buffer">The buffer to write.</param>
/// <param name="data">The data to write.</param>
public static void WriteUInt(ByteBuffer buffer, uint data)
{
WriteInt(buffer, (int)data);
}
/// <summary>
/// Writes a 64-bit signed integer into the buffer and advance the buffer write cursor.
/// </summary>
/// <param name="buffer">The buffer to write.</param>
/// <param name="data">The data to write.</param>
public static void WriteLong(ByteBuffer buffer, long data)
{
WriteInt(buffer, (int)(data >> 32));
WriteInt(buffer, (int)data);
}
/// <summary>
/// Writes a 64-bit unsigned integer into the buffer and advance the buffer write cursor.
/// </summary>
/// <param name="buffer">The buffer to write.</param>
/// <param name="data">The data to write.</param>
public static void WriteULong(ByteBuffer buffer, ulong data)
{
WriteLong(buffer, (long)data);
}
/// <summary>
/// Writes a 32-bit floating-point value into the buffer and advance the buffer write cursor.
/// </summary>
/// <param name="buffer">The buffer to write.</param>
/// <param name="data">The data to write.</param>
public static unsafe void WriteFloat(ByteBuffer buffer, float data)
{
int n = *((int*)&data);
WriteInt(buffer, n);
}
/// <summary>
/// Writes a 64-bit floating-point value into the buffer and advance the buffer write cursor.
/// </summary>
/// <param name="buffer">The buffer to write.</param>
/// <param name="data">The data to write.</param>
public static unsafe void WriteDouble(ByteBuffer buffer, double data)
{
long n = *((long*)&data);
WriteLong(buffer, n);
}
/// <summary>
/// Writes a uuid (16-bytes) into the buffer and advance the buffer write cursor.
/// </summary>
/// <param name="buffer">The buffer to write.</param>
/// <param name="data">The data to write.</param>
public static void WriteUuid(ByteBuffer buffer, Guid data)
{
buffer.ValidateWrite(FixedWidth.Uuid);
byte[] p = data.ToByteArray();
int pos = buffer.WritePos;
if (AmqpBitConverter.IsLittleEndian)
{
buffer.Buffer[pos++] = p[3];
buffer.Buffer[pos++] = p[2];
buffer.Buffer[pos++] = p[1];
buffer.Buffer[pos++] = p[0];
buffer.Buffer[pos++] = p[5];
buffer.Buffer[pos++] = p[4];
buffer.Buffer[pos++] = p[7];
buffer.Buffer[pos++] = p[6];
Array.Copy(p, 8, buffer.Buffer, pos, 8);
}
else
{
Array.Copy(p, buffer.Buffer, FixedWidth.Uuid);
}
buffer.Append(FixedWidth.Uuid);
}
/// <summary>
/// Writes bytes from one buffer into another.
/// </summary>
/// <param name="buffer">The destination buffer.</param>
/// <param name="data">The source buffer</param>
/// <param name="offset">The position in source buffer to start.</param>
/// <param name="count">The number of bytes to write.</param>
public static void WriteBytes(ByteBuffer buffer, byte[] data, int offset, int count)
{
buffer.ValidateWrite(count);
Array.Copy(data, offset, buffer.Buffer, buffer.WritePos, count);
buffer.Append(count);
}
}
}
| 38.966146
| 151
| 0.552897
|
da78f88061735de792c5be06d7ff1a271ec6128b
| 11,809
|
php
|
PHP
|
RECEPTIONIST/admin_categoryrate.php
|
dpurban/ozz
|
d49e54d59ad003904491ef9ad3d61e21074edbc2
|
[
"Apache-2.0"
] | null | null | null |
RECEPTIONIST/admin_categoryrate.php
|
dpurban/ozz
|
d49e54d59ad003904491ef9ad3d61e21074edbc2
|
[
"Apache-2.0"
] | null | null | null |
RECEPTIONIST/admin_categoryrate.php
|
dpurban/ozz
|
d49e54d59ad003904491ef9ad3d61e21074edbc2
|
[
"Apache-2.0"
] | null | null | null |
<?php
session_start();
ob_start();
include 'conn.php';
$username = $_SESSION['username'];
?>
<!doctype html>
<html lang="en">
<head>
<?php include 'head.php'; ?>
<?php require "add_rcategory.php"; require "update_rcategory.php"; require "delete_rcategory.php";?>
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/material-design-lite/1.1.0/material.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/dataTables.material.min.css">
</head>
<body>
<div class="wrapper" style="background: url('Dark_background_1920x1080.png')
center top no-repeat; background-size: cover;">
<?php include 'sidebar.php'; ?>
<div class="main-panel">
<?php include 'nav.php'; ?>
<div class="content">
<div class="container-fluid">
<ol class='breadcrumb'>
<li>
<i class='fa fa-dashboard'></i> Dashboard
</li>
<li class='active'>
<i class='fa fa-dashboard'></i> Rate Category
</li>
</ol>
<div class="card">
<div class="card-header" style="background-color: #242424;">
<h2 class="title">Rate Category
<a href ='javascript:;' data-toggle ='modal' data-target ='#addsubscription' title = "add subscription plan"><i class='material-icons' style = 'color:white;'>add_circle</i></a>
</h2>
</div>
<div class="card-content table-responsive">
<!-- INSERT CODE HERE -->
<?php
$display= mysqli_query($conn,"SELECT * FROM tbl_rate_category");
$count =mysqli_num_rows($display);
?>
<table id="example" class="mdl-data-table" cellspacing="0" width="100%">
<thead>
<tr>
<th>Category ID</th>
<th>Category Name</th>
<th>Add to Subscription category?</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
if($count > 0 )
{
while($fetch = mysqli_fetch_array($display))
{
$id = $fetch['rcategory_id'];
$categoryname = $fetch['rcategoryname'];
$addsub = $fetch['addtosubscription'];
if($addsub == 1)
{
$bol = "Yes";
}
else
{
$bol = "No";
}
?>
<tr>
<td><?php echo $id ?></td>
<td><?php echo $categoryname ?></td>
<td><?php echo $bol ?></td>
<div class="btn-group" role="group" aria-label="...">
<td>
<a href="#edit<?php echo $id;?>" href ="javascript:;" data-toggle ="modal" title = "edit"> <i class="material-icons" style ="padding-right:25px; color:black;">edit</i></a>
<a href="#delete<?php echo $id;?>" href ="javascript:;" data-toggle ="modal" title = "delete"><i class = "material-icons" style = 'color:black;'>delete</i></a>
</td>
</div>
</tr>
<!-- edit program modal -->
<div id ="edit<?php echo $id;?>" class ="modal fade"role ="dialog" data-backdrop="false">
<div class ="modal-dialog modal-md">
<div class ="modal-content">
<div class ="modal-header"style = "background-color: #242424;">
<button type="button" class ="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span></button>
<h4 class="modal-title" style = "color:white">Rate Category Details</h4><br>
</div>
<div class ="modal-body">
<form method = "post" enctype="multipart/form-data">
<div class ="form-group label-floating">
<label class="control-label">Category ID</label>
<input type = "text" class="form-control" name = "id" value = "<?php echo $id ?>" readonly>
</div>
<div class ="form-group label-floating">
<label class="control-label">Category Name*</label>
<input type = "text" class="form-control" value="<?php echo $categoryname ?>" name = "categoryname">
</div>
<div class = "checkbox">
<label style = "color:black">
<input type="checkbox" name="addsub" value="<?php echo $bol?>"<?php if($addsub == 1) echo ' checked="checked"'; ?>> Add this to subscription category?(optional)
</label>
</div>
<div class="modal-footer">
<button type ="submit" class="btn btn-primary" name ="update"> Save</button>
<button type ="submit" class="btn btn-default" name ="cancel" data-dismiss="modal"> Cancel</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!--/. edit program modal -->
<!-- delete program modal -->
<div id ="delete<?php echo $id;?>" class ="modal fade"role ="dialog" data-backdrop="false">
<div class ="modal-dialog modal-md">
<div class ="modal-content">
<div class ="modal-header"style = "background-color: #242424;">
<button type="button" class ="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span></button>
<h4 class="modal-title" style = "color:white">Confirm Deletion</h4><br>
</div>
<div class ="modal-body">
<form method = "post" enctype="multipart/form-data">
<p>Are you sure you want to delete this Subscription Plan?</p>
<input type = "hidden" name ="id" value = "<?php echo $id ?>">
<div class="modal-footer">
<button type ="submit" class="btn btn-danger" name ="delete">Delete</button>
<button type ="submit" class="btn btn-default" name ="cancel" data-dismiss="modal"> Cancel</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!--/. delete program modal -->
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}
else
{
?>
<div class="alert alert-warning">
No Records Found
</div>
<?php
}
?>
<!--^ INSERT CODE HERE ^-->
</div><!--/card-content-->
</div><!--./card-->
</div><!--./container-fluid-->
</div><!--./content-->
</div><!--./main-panel-->
</div><!--./wrappper-->
</body>
<?php include 'javascript.php';?>
</html>
<script>
$(document).ready(function() {
$('#example').DataTable( {
columnDefs: [
{
targets: [ 0, 1, 2 ],
className: 'mdl-data-table__cell--non-numeric'
}
]
} );
} );
</script>
<!-- add subs modal -->
<div id ="addsubscription" class ="modal fade"role ="dialog">
<div class ="modal-dialog">
<div class ="modal-content">
<div class ="modal-header" style = "background-color: #242424;">
<button type="button" class ="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span></button>
<h4 class="modal-title" style = "color:white">Add Rate Category</h4><br>
</div>
<div class ="modal-body">
<form method = "post" enctype="multipart/form-data">
<div class ="form-group label-floating">
<label class="control-label">Category Name</label>
<input type = "text" class="form-control" name = "categoryname" required="">
</div>
<div class = "checkbox">
<label style = "color:black">
<input type="checkbox" name="addsub" value = "1">Add this to subscription category?(optional)
</label>
</div>
<div class="modal-footer">
<button type ="submit" class="btn btn-primary" name ="add"> Add</button>
<button type ="submit" class="btn btn-default" name ="cancel" data-dismiss="modal"> Cancel</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!--/. add subs modal -->
| 54.671296
| 213
| 0.357947
|
3f620d363405ef50ff900261cc46f0e1204ff7e3
| 27,691
|
php
|
PHP
|
app/Libraries/Helplib/HelpLibServices.php
|
fengzhu1131/knowledge
|
81d119f66367a4fa7e493e29346eddf96be1f521
|
[
"MIT"
] | 1
|
2018-10-27T02:50:19.000Z
|
2018-10-27T02:50:19.000Z
|
app/Libraries/Helplib/HelpLibServices.php
|
fengzhu1131/knowledge
|
81d119f66367a4fa7e493e29346eddf96be1f521
|
[
"MIT"
] | null | null | null |
app/Libraries/Helplib/HelpLibServices.php
|
fengzhu1131/knowledge
|
81d119f66367a4fa7e493e29346eddf96be1f521
|
[
"MIT"
] | null | null | null |
<?php
namespace App\Libraries\Helplib;
use Log;
class HelpLibServices extends BaseService {
public function __construct() {
$this -> config = $this -> loadConfig();
$this -> uri = $this -> config['url'];
self::$helpLib = BaseService::init();
}
protected function loadConfig() {
return config("services.osspush");
}
/**
* 获取浏览器分析对象
* @return {Class} AnalysisBrowser
*/
public function getAnalysisBrowser() {
return new AnalysisBrowser();
}
/**
* 获取错误信息对象
* @return {Class} AppConfig
*/
public function getAppConfig() {
return new AppConfig();
}
/**
* 校验文本是否网址
*/
public function checkTextIsUrl($text) {
return preg_match('#^(http|https|ftp|ftps)://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$#ui', $text);
}
public function getUrlData($url) {
$exceptionDn = null;//$this -> getDomainNameInfo($url);
if (!empty($exceptionDn)) {
$res = $exceptionDn;
} else {
$html = new Htmldom($url);
$res = array("notes" => "", "url_path" => $url, "url_img" => "", "url_title" => "");
//常规的信息处理
$doms = explode(",", 'title,meta[name=description],img');
foreach ($doms as $k => $v) {
foreach ($html->find($v) as $element) {
if ($k == 0) {
$res['notes'] = !empty($element -> plaintext) ? $this -> getText($element -> plaintext) : "";
$res['url_title'] = !empty($element -> plaintext) ? $this -> getText($element -> plaintext) : "";
break;
}
if ($k == 1) {
$res['notes'] = !empty($element -> content) ? $this -> getText($element -> content) : "";
break;
}
if ($k == 2) {
$res['url_img'] = $this -> checkImgUrl($url, $element -> src);
break;
}
}
}
}
return $res;
}
/**
* 获取不同域名的信息
*/
private function getDomainNameInfo($url) {
$html = new Htmldom($url);
$res = array("notes" => "", "url_path" => $url, "url_img" => "", "url_title" => "");
$domainName = "http://www.cnblogs.com";
//获取博客园数据
if (preg_match("/(" . preg_replace("/[\/]/i", "\\/", $domainName) . ")/iu", $url)) {
$doms = explode(";", "title;#topics .postBody;img.img_avatar");
Log::info("抓取博客园:" . json_encode($doms));
//给定初始值
//$res['url_img'] = "";
$res['notes'] = "博客园";
$res['url_title'] = "博客园";
foreach ($doms as $k => $v) {
foreach ($html->find($v) as $element) {
if ($k == 0) {
$res['notes'] = !empty($element -> plaintext) ? $this -> getText($element -> plaintext) : "";
$res['url_title'] = !empty($element -> plaintext) ? $this -> getText($element -> plaintext) : "";
break;
}
if ($k == 1) {
$res['notes'] = !empty($element -> plaintext) ? $this -> getText($element -> plaintext) : "";
break;
}
if ($k == 2) {
//$res['url_img'] = $this -> checkImgUrl($url, $domainName . $element -> src);
//break;
$res['url_img'][] = "1111";
}
if ($k == 2 || $k == 3) {
$res['url_img'][] = $element -> src;
}
}
}
return $res;
}
$domainName = "https://mp.weixin.qq.com";
//获取博客园数据
if (preg_match("/(" . preg_replace("/[\/]/i", "\\/", $domainName) . ")/iu", $url)) {
$doms = explode(";", 'title;script[nonce=1956463050];#img-content img');
//给定初始值
$res['notes'] = "微信分享";
$res['url_title'] = "微信分享";
foreach ($doms as $k => $v) {
foreach ($html->find($v) as $element) {
if ($k == 0) {
$res['notes'] = !empty($element -> plaintext) ? $this -> getText($element -> plaintext) : "";
$res['url_title'] = !empty($element -> plaintext) ? $this -> getText($element -> plaintext) : "";
break;
}
if ($k == 1) {
$res['notes'] = !empty($element -> plaintext) ? $this -> getText($element -> plaintext) : "";
break;
}
if ($k == 2 && !empty($element -> src)) {
$res['url_img'] = $this -> checkImgUrl($url, $element -> src);
break;
}
}
}
return $res;
}
return null;
}
/**
* 格式化获取文本信息
*/
private function getText($text) {
return trim(preg_replace("/[\t\n\r\f\b]/i", "", mb_substr($text, 0, 200)));
}
/**
* 校验图片路径并修改成新的路径
*/
private function checkImgUrl($url, $src) {
if (empty($src)) {
return "";
}
if (preg_match("/(http|https|ftp|ftps)/iu", $src)) {
return $src;
}
return $src;
}
}
/**
* 分析浏览器调用
*/
class AnalysisBrowser {
private $HTTP_USER_AGENT;
public function __construct() {
$this -> HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
}
/**
* 获取浏览器类型
* @return string
*/
public function GetBrowser() {
$sys = $_SERVER['HTTP_USER_AGENT'];
//获取用户代理字符串
if (stripos($sys, "Firefox/") > 0) {
preg_match("/Firefox\/([^;)]+)+/i", $sys, $b);
$exp[0] = "Firefox";
$exp[1] = $b[1];
//获取火狐浏览器的版本号
} elseif (stripos($sys, "Maxthon") > 0) {
preg_match("/Maxthon\/([\d\.]+)/", $sys, $aoyou);
$exp[0] = "傲游";
$exp[1] = $aoyou[1];
} elseif (stripos($sys, "MSIE") > 0) {
preg_match("/MSIE\s+([^;)]+)+/i", $sys, $ie);
$exp[0] = "IE";
$exp[1] = $ie[1];
//获取IE的版本号
} elseif (stripos($sys, "OPR") > 0) {
preg_match("/OPR\/([\d\.]+)/", $sys, $opera);
$exp[0] = "Opera";
$exp[1] = $opera[1];
} elseif (stripos($sys, "Edge") > 0) {
//win10 Edge浏览器 添加了chrome内核标记 在判断Chrome之前匹配
preg_match("/Edge\/([\d\.]+)/", $sys, $Edge);
$exp[0] = "Edge";
$exp[1] = $Edge[1];
} elseif (stripos($sys, "Chrome") > 0) {
preg_match("/Chrome\/([\d\.]+)/", $sys, $google);
$exp[0] = "Chrome";
$exp[1] = $google[1];
//获取google chrome的版本号
} elseif (stripos($sys, 'rv:') > 0 && stripos($sys, 'Gecko') > 0) {
preg_match("/rv:([\d\.]+)/", $sys, $IE);
$exp[0] = "IE";
$exp[1] = $IE[1];
} else {
$exp[0] = "未知浏览器";
$exp[1] = "";
}
return $exp[0] . '(' . $exp[1] . ')';
}
/**
* 获取客户端操作系统信息包括win10
* @return array
* array('os' => '系统名称', 'osv' => '系统版本', 'osb' => '系统位数', 'dev' => '设备类型',
* 'nettype' => '网络情况', 'bw' => '浏览器名称', 'bwv' => '浏览器版本','kernel'=>'内核')
*/
function GetOSAndBrowser() {
$agent = $this -> HTTP_USER_AGENT;
/*print_r($_SERVER);
print_r('<br />');*/
// $_SERVER['HTTP_USER_AGENT'];
print_r('agent:');
print_r($agent);
print_r('<br/>');
$rArr = array('os' => '未知系统', 'osv' => '', 'osb' => '', 'dev' => '', 'nettype' => '', 'bw' => '', 'bwv' => '', 'kernel' => '');
//分析操作系统及版本
if (preg_match('/win/i', $agent, $os) && strpos($agent, '95')) {
$rArr['os'] = 'Windows 95';
$rArr['osv'] = $os[0];
} else if (preg_match('/win 9x/i', $agent, $os) && strpos($agent, '4.90')) {
$rArr['os'] = 'Windows ME';
$rArr['osv'] = $os[0];
} else if (preg_match('/win/i', $agent, $os) && preg_match('/98/i', $agent)) {
$rArr['os'] = 'Windows 98';
$rArr['osv'] = $os[0];
} else if (preg_match('/win/i', $agent, $os) && preg_match('/nt 6.0/i', $agent)) {
$rArr['os'] = 'Windows Vista';
$rArr['osv'] = $os[0];
} else if (preg_match('/windows nt 6.1/i', $agent, $os)) {
$rArr['os'] = 'Windows 7';
$rArr['osv'] = $os[0];
} else if (preg_match('/win/i', $agent, $os) && preg_match('/nt 6.2/i', $agent)) {
$rArr['os'] = 'Windows 8';
$rArr['osv'] = $os[0];
} else if (preg_match('/win/i', $agent, $os) && preg_match('/nt 10.0/i', $agent)) {
$rArr['os'] = 'Windows 10';
$rArr['osv'] = $os[0];
#添加win10判断
} else if (preg_match('/win/i', $agent, $os) && preg_match('/nt 5.1/i', $agent)) {
$rArr['os'] = 'Windows XP';
$rArr['osv'] = $os[0];
} else if (preg_match('/win/i', $agent, $os) && preg_match('/nt 5/i', $agent)) {
$rArr['os'] = 'Windows 2000';
$rArr['osv'] = $os[0];
} else if (preg_match('/win/i', $agent, $os) && preg_match('/nt/i', $agent)) {
$rArr['os'] = 'Windows NT';
$rArr['osv'] = $os[0];
} else if (preg_match('/win/i', $agent, $os) && preg_match('/32/i', $agent)) {
$rArr['os'] = 'Windows 32';
$rArr['osv'] = $os[0];
} else if (preg_match('/linux/i', $agent, $os)) {
$rArr['os'] = 'Linux';
$rArr['osv'] = $os[0];
} else if (preg_match('/unix/i', $agent, $os)) {
$rArr['os'] = 'Unix';
$rArr['osv'] = $os[0];
} else if (preg_match('/sun/i', $agent, $os) && preg_match('/os/i', $agent)) {
$rArr['os'] = 'SunOS';
$rArr['osv'] = $os[0];
} else if (preg_match('/ibm/i', $agent, $os) && preg_match('/os/i', $agent)) {
$rArr['os'] = 'IBM OS/2';
$rArr['osv'] = $os[0];
} else if (preg_match('/Mac/i', $agent, $os) && preg_match('/PC/i', $agent)) {
$rArr['os'] = 'Macintosh';
$rArr['osv'] = $os[0];
} else if (preg_match('/PowerPC/i', $agent, $os)) {
$rArr['os'] = 'PowerPC';
$rArr['osv'] = $os[0];
} else if (preg_match('/AIX/i', $agent, $os)) {
$rArr['os'] = 'AIX';
$rArr['osv'] = $os[0];
} else if (preg_match('/HPUX/i', $agent, $os)) {
$rArr['os'] = 'HPUX';
$rArr['osv'] = $os[0];
} else if (preg_match('/NetBSD/i', $agent, $os)) {
$rArr['os'] = 'NetBSD';
$rArr['osv'] = $os[0];
} else if (preg_match('/BSD/i', $agent, $os)) {
$rArr['os'] = 'BSD';
$rArr['osv'] = $os[0];
} else if (preg_match('/OSF1/i', $agent, $os)) {
$rArr['os'] = 'OSF1';
$rArr['osv'] = $os[0];
} else if (preg_match('/IRIX/i', $agent, $os)) {
$rArr['os'] = 'IRIX';
$rArr['osv'] = $os[0];
} else if (preg_match('/FreeBSD/i', $agent, $os)) {
$rArr['os'] = 'FreeBSD';
$rArr['osv'] = $os[0];
} else if (preg_match('/teleport/i', $agent, $os)) {
$rArr['os'] = 'teleport';
$rArr['osv'] = $os[0];
} else if (preg_match('/flashget/i', $agent, $os)) {
$rArr['os'] = 'flashget';
$rArr['osv'] = $os[0];
} else if (preg_match('/webzip/i', $agent, $os)) {
$rArr['os'] = 'webzip';
$rArr['osv'] = $os[0];
} else if (preg_match('/offline/i', $agent, $os)) {
$rArr['os'] = 'offline';
$rArr['osv'] = $os[0];
}
//版本位数
if (preg_match('/WOW64|Win64/i', $agent, $os)) {
$rArr['osb'] = '64 bit';
}
if (preg_match('/Win32/i', $agent, $os)) {
$rArr['osb'] = '32 bit';
}
preg_match('/Web[kK]it[\/]{0,1}([\d.]+)/i', $agent, $webkit);
preg_match('/(Android);?[\s\/]+([\d.]+)?/', $agent, $android);
preg_match('/\(Macintosh\; Intel /', $agent, $osx);
//osx = !!ua.match(/\(Macintosh\; Intel /),
//preg_match('/NetType\/WIFI/', $agent, $wifi);
preg_match('/(NetType)\/([\w|\s]+)/', $agent, $wifi);
preg_match('/(iPad).*OS\s([\d_]+)/', $agent, $ipad);
preg_match('/(iPod)(.*OS\s([\d_]+))?/', $agent, $ipod);
print_r($ipod);
print_r('<br />');
!$ipad && preg_match('/(iPhone\sOS)\s([\d_]+)/', $agent, $iphone);
print_r($iphone);
print_r('<br />');
preg_match('/(webOS|hpwOS)[\s\/]([\d.]+)/', $agent, $webos);
//win = /Win\d{2}|Windows/.test(platform),
preg_match('/Windows Phone ([\d.]+)/', $agent, $wp);
$webos && preg_match('/TouchPad/', $agent, $touchpad);
preg_match('/Kindle\/([\d.]+)/', $agent, $kindle);
preg_match('/Silk\/([\d._]+)/', $agent, $silk);
preg_match('/(BlackBerry).*Version\/([\d.]+)/', $agent, $blackberry);
preg_match('/(BB10).*Version\/([\d.]+)/', $agent, $bb10);
preg_match('/(RIM\sTablet\sOS)\s([\d.]+)/', $agent, $rimtabletos);
preg_match('/PlayBook/', $agent, $playbook);
preg_match('/Chrome\/([\d.]+)/', $agent, $chrome) || preg_match('/CriOS\/([\d.]+)/', $agent, $chrome);
//国内常规浏览器使用统一的变量设置Standard browser
preg_match('/(MicroMessenger|OPR|QQBrowser|MetaSr|Maxthon|BIDUBrowser|UBrowser|Navigator|CoolNovo|Wochacha)\/([\d\.]+)/i', $agent, $sbw);
//非标准浏览器unStandard browser//这种浏览器只能识别浏览器,不能识别版本
preg_match('/(LBBROWSER|qihu theworld|GiSoon)/i', $agent, $usbw);
//特殊类型浏览器单独处理
preg_match('/(BIDUBrowser)\s+([\d.]+)/i', $agent, $bd);
/*preg_match('/LBBROWSER/i', $agent, $lb);
preg_match('/(qihu theworld)/i', $agent, $sjzc);
preg_match('/(GiSoon)/i', $agent, $fq);*/
preg_match('/Firefox\/([\d.]+)/i', $agent, $firefox);
preg_match('/\((?:Mobile|Tablet); rv:([\d.]+)\).*Firefox\/[\d.]+/i', $agent, $firefoxos);
preg_match('/MSIE\s([\d.]+)/i', $agent, $ie) || preg_match('/Trident\/[\d](?=[^\?]+).*rv:([0-9.].)/i', $agent, $ie);
!$chrome && preg_match('/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i', $agent, $webview);
$webview || preg_match('/Version\/([\d.]+)([^S](Safari)|[^M]*(Mobile)[^S]*(Safari))/i', $agent, $safari);
// Todo: clean this up with a better OS/browser seperation:
// - discern (more) between multiple browsers on android
// - decide if kindle fire in silk mode is android or not
// - Firefox on Android doesn't specify the Android version
// - possibly devide in os, device and browser hashes
if ($webkit) {
$rArr['bw'] = 'webkit';
$rArr['bwv'] = $webkit[1];
}
//国内很多浏览器都是借用ie\firefox\chrome外套的,需要将这几种浏览器的类型判断放置在前面
if ($android) {
$rArr['os'] = 'android';
$rArr['osv'] = $android[2];
}
//基础浏览器先进性判断
if ($ie) {
$rArr['bw'] = 'Internet Explorer';
$rArr['bwv'] = $ie[1];
}
if ($firefox) {
$rArr['bw'] = 'Firefox';
$rArr['bwv'] = $firefox[1];
}
if ($safari) {
$rArr['bw'] = 'Safari';
$rArr['bwv'] = $safari[1];
}
if ($chrome) {
$rArr['bw'] = 'Google Chrome';
$rArr['bwv'] = $chrome[1];
}
//在微信浏览器中,会提交当前网络情况
if ($wifi) {
$rArr['nettype'] = str_replace(' Language', '', $wifi[2]);
}
//判断移动端设备
if ($iphone && !$ipod) {
$rArr['os'] = 'ios';
$rArr['osv'] = str_replace('_', '.', $iphone[2]);
$rArr['dev'] = 'iPhone';
}
if ($ipad) {
$rArr['os'] = 'ios';
$rArr['osv'] = str_replace('_', '.', $iphone[2]);
$rArr['dev'] = 'ipad';
}
if ($ipod) {
$rArr['os'] = 'ios';
$rArr['osv'] = str_replace('_', '.', $iphone[2]);
$rArr['dev'] = 'ipod';
}
if ($wp) {
$rArr['bw'] = 'wp';
$rArr['bwv'] = $wp[1];
}
if ($webos) {
$rArr['os'] = 'Webos';
$rArr['osv'] = $webos[2];
}
if ($touchpad) {
$rArr['dev'] = 'touchpad';
}
if ($firefoxos) {
$rArr['os'] = 'FirefoxOS';
$rArr['osv'] = $firefoxos[1];
}
//标准浏览器
if ($sbw) {
$rArr['bw'] = $sbw[1];
$rArr['bwv'] = $sbw[2];
}
//非标准浏览,只能识别浏览器类型,不能识别版本
if ($usbw) {
$rArr['bw'] = $usbw[0];
$rArr['bwv'] = 'Unknown';
}
//特殊类型浏览器进行判断,特殊类型放在最下面进行判断
if ($bd) {
$rArr['bw'] = $bd[1];
$rArr['bwv'] = $bd[2];
}
/*if ($weixin) {
$rArr['bw'] = 'WeiXin';
$rArr['bwv'] = $weixin[1];
}
if ($opera) {
$rArr['bw'] = 'Opera';
$rArr['bwv'] = $opera[1];
}
if ($qqb) {
$rArr['bw'] = $qqb[1];
$rArr['bwv'] = $qqb[2];
}
if ($lb) {
$rArr['bw'] = $lb[0];
$rArr['bwv'] = 'Unknown';
}
if ($sg) {
$rArr['bw'] = $sg[0];
$rArr['bwv'] = 'Unknown';
}
if ($aq) {
$rArr['bw'] = $aq[1];
$rArr['bwv'] = $aq[2];
}
if ($sjzc) {
$rArr['bw'] = $sjzc[0];
$rArr['bwv'] = 'Unknown';
}
if ($fq) {
$rArr['bw'] = $fq[0];
$rArr['bwv'] = 'Unknown';
}
if ($bd) {
$rArr['bw'] = $bd[1];
$rArr['bwv'] = $bd[2];
}
if ($uc) {
$rArr['bw'] = $uc[1];
$rArr['bwv'] = $uc[2];
}
if ($wj) {
$rArr['bw'] = $wj[1];
$rArr['bwv'] = $wj[2];
}
if ($fs) {
$rArr['bw'] = $fs[1];
$rArr['bwv'] = $fs[2];
}
if ($wcc) {
$rArr['bw'] = $wcc[1];
$rArr['bwv'] = $wcc[2];
}*/
//增加内核浏览器标记
$chrome ? $rArr['kernel'] = $chrome[0] : '';
$ie ? $rArr['kernel'] = $ie[0] : '';
$firefox ? $rArr['kernel'] = $firefox[0] : '';
//国内尺长上常见的浏览器类型QQ浏览器、UC浏览器、Opera浏览器、欧鹏、Chrome、FireFox、Safari、
/*if (iphone && !ipod) os.ios = os.iphone = true, os.version = iphone[2].replace(/_/g, '.')
if (ipad) os.ios = os.ipad = true, os.version = ipad[2].replace(/_/g, '.')
if (ipod) os.ios = os.ipod = true, os.version = ipod[3] ? ipod[3].replace(/_/g, '.') : null
if (wp) os.wp = true, os.version = wp[1]
if (webos) os.webos = true, os.version = webos[2]
if (touchpad) os.touchpad = true
if (blackberry) os.blackberry = true, os.version = blackberry[2]
if (bb10) os.bb10 = true, os.version = bb10[2]
if (rimtabletos) os.rimtabletos = true, os.version = rimtabletos[2]
if (playbook) browser.playbook = true
if (kindle) os.kindle = true, os.version = kindle[1]
if (silk) browser.silk = true, browser.version = silk[1]
if (!silk && os.android && ua.match(/Kindle Fire/)) browser.silk = true
if (chrome) browser.chrome = true, browser.version = chrome[1]
if (weixin) browser.weixin = true, browser.version = weixin[1]
if (firefox) browser.firefox = true, browser.version = firefox[1]
if (firefoxos) os.firefoxos = true, os.version = firefoxos[1]
if (ie) browser.ie = true, browser.version = ie[1]
if (safari && (osx || os.ios || win)) {
browser.safari = true
if (!os.ios) browser.version = safari[1]
}
if (webview) browser.webview = true
os.tablet = !!(ipad || playbook || (android && !ua.match(/Mobile/)) ||
(firefox && ua.match(/Tablet/)) || (ie && !ua.match(/Phone/) && ua.match(/Touch/)))
os.phone = !!(!os.tablet && !os.ipod && (android || iphone || webos || blackberry || bb10 ||
(chrome && ua.match(/Android/)) || (chrome && ua.match(/CriOS\/([\d.]+)/)) ||
(firefox && ua.match(/Mobile/)) || (ie && ua.match(/Touch/))))
os['browser'] = browser;*/
return $rArr;
}
/**
* 是否安卓系统
*/
function isAndroid() {
$uainfo = $this -> getUA();
if (preg_match('/.*Opera.*/i', $uainfo)) {
return true;
} else {
return false;
}
}
/**
* 是否IOS系统
*/
function isIOS() {
$uainfo = $this -> getUA();
if (preg_match('/.*Opera.*/i', $uainfo)) {
return true;
} else {
return false;
}
}
/**
* 获取主机名
*/
function GetHost() {
return $_SERVER['HTTP_HOST'];
}
/**
* 获取来源
*/
function GetReferer() {
return $_SERVER['HTTP_REFERER'];
}
/**
* 函数名称: getPhoneNumber
* 函数功能: 取手机号
* 输入参数: none
* 函数返回值: 成功返回号码,失败返回false
* 其它说明: 说明
*/
function getPhoneNumber() {
if (isset($_SERVER['HTTP_X_NETWORK_INFO'])) {
$str1 = $_SERVER['HTTP_X_NETWORK_INFO'];
$getstr1 = preg_replace('/(.*,)(11[d])(,.*)/i', "", $str1);
return $getstr1;
} elseif (isset($_SERVER['HTTP_X_UP_CALLING_LINE_ID'])) {
$getstr2 = $_SERVER['HTTP_X_UP_CALLING_LINE_ID'];
return $getstr2;
} elseif (isset($_SERVER['HTTP_X_UP_SUBNO'])) {
$str3 = $_SERVER['HTTP_X_UP_SUBNO'];
$getstr3 = preg_replace('/(.*)(11[d])(.*)/i', "", $str3);
return $getstr3;
} elseif (isset($_SERVER['DEVICEID'])) {
return $_SERVER['DEVICEID'];
} else {
return false;
}
}
/**
* 函数名称: getHttpHeader
* 函数功能: 取头信息
* 输入参数: none
* 函数返回值: 成功返回号码,失败返回false
* 其它说明: 说明
*/
function getHttpHeader() {
$str = "";
foreach ($_SERVER as $key => $val) {
$gstr = str_replace("&", "&", $val);
$str .= "$key -> " . $gstr . "rn";
}
return $str;
}
/**
* 函数名称: getUA
* 函数功能: 取UA
* 输入参数: none
* 函数返回值: 成功返回号码,失败返回false
* 其它说明: 说明
*/
function getUA() {
if (isset($_SERVER['HTTP_USER_AGENT'])) {
return $_SERVER['HTTP_USER_AGENT'];
} else {
return false;
}
}
/**
* 函数名称: getPhoneType
* 函数功能: 取得手机类型
* 输入参数: none
* 函数返回值: 成功返回string,失败返回false
* 其它说明: 说明
*/
function getPhoneType() {
$ua = $this -> getUA();
if ($ua != false) {
$str = explode(" ", $ua);
return $str[0];
} else {
return false;
}
}
/**
* 函数名称: isOpera
* 函数功能: 判断是否是opera
* 输入参数: none www.knowsky.com
* 函数返回值: 成功返回string,失败返回false
* 其它说明: 说明
*/
function isOpera() {
$uainfo = $this -> getUA();
if (preg_match('/.*Opera.*/i', $uainfo)) {
return true;
} else {
return false;
}
}
/**
* 函数名称: isM3gate
* 函数功能: 判断是否是m3gate
* 输入参数: none
* 函数返回值: 成功返回string,失败返回false
* 其它说明: 说明
*/
function isM3gate() {
$uainfo = $this -> getUA();
if (preg_match('/M3Gate/i', $uainfo)) {
return true;
} else {
return false;
}
}
/**
* 函数名称: getHttpAccept
* 函数功能: 取得HA
* 输入参数: none
* 函数返回值: 成功返回string,失败返回false
* 其它说明: 说明
*/
function getHttpAccept() {
if (isset($_SERVER['HTTP_ACCEPT'])) {
return $_SERVER['HTTP_ACCEPT'];
} else {
return false;
}
}
/**
* 函数名称: getIP
* 函数功能: 取得手机IP
* 输入参数: none
* 函数返回值: 成功返回string
* 其它说明: 说明
*/
function getIP() {
$ip = getenv('REMOTE_ADDR');
$ip_ = getenv('HTTP_X_FORWARDED_FOR');
if (($ip_ != "") && ($ip_ != "unknown")) {
$ip = $ip_;
}
return $ip;
}
/**
* 判断是否移动端
* @return boole
*/
function isMobile() {
// 如果有HTTP_X_WAP_PROFILE则一定是移动设备
if (isset($_SERVER['HTTP_X_WAP_PROFILE'])) {
return true;
}
// 如果via信息含有wap则一定是移动设备,部分服务商会屏蔽该信息
if (isset($_SERVER['HTTP_VIA'])) {
// 找不到为flase,否则为true
return stristr($_SERVER['HTTP_VIA'], "wap") ? true : false;
}
// 脑残法,判断手机发送的客户端标志,兼容性有待提高
if (isset($_SERVER['HTTP_USER_AGENT'])) {
$clientkeywords = array('nokia', 'sony', 'ericsson', 'mot', 'samsung', 'htc', 'sgh', 'lg', 'sharp', 'sie-', 'philips', 'panasonic', 'alcatel', 'lenovo', 'iphone', 'ipod', 'blackberry', 'meizu', 'android', 'netfront', 'symbian', 'ucweb', 'windowsce', 'palm', 'operamini', 'operamobi', 'openwave', 'nexusone', 'cldc', 'midp', 'wap', 'mobile');
// 从HTTP_USER_AGENT中查找手机浏览器的关键字
if (preg_match("/(" . implode('|', $clientkeywords) . ")/i", strtolower($_SERVER['HTTP_USER_AGENT']))) {
return true;
}
}
// 协议法,因为有可能不准确,放到最后判断
if (isset($_SERVER['HTTP_ACCEPT'])) {
// 如果只支持wml并且不支持html那一定是移动设备
// 如果支持wml和html但是wml在html之前则是移动设备
if ((strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') !== false) && (strpos($_SERVER['HTTP_ACCEPT'], 'text/html') === false || (strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') < strpos($_SERVER['HTTP_ACCEPT'], 'text/html')))) {
return true;
}
}
return false;
}
/**
* 获取手机位置
*/
function GetPosition() {
//$ip = '202.98.96.68';
$ip = getIP();
$url = "http://api.map.baidu.com/location/ip?ak=aGlEjW0vegU01oARIpHIQSru&ip=$ip&coor=bd09ll";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
if (curl_errno($ch)) { echo 'CURL ERROR Code: ' . curl_errno($ch) . ', reason: ' . curl_error($ch);
}
curl_close($ch);
$info = json_decode($output, true);
return $info;
/*print_r($info);
if ($info['status'] == "0") {
$lotx = $info['content']['point']['y'];
$loty = $info['content']['point']['x'];
$citytemp = $info['content']['address_detail']['city'];
$keywords = explode("市", $citytemp);
$city = $keywords[0];
} else {
$lotx = "34.2597";
$loty = "108.9471";
$city = "西安";
}*/
}
}
/**
* 配置文件,用于程序错误返回值
*/
class AppConfig {
/**
* 编码分为3类:
* 1、10开头,为提交参数为空
* 2、20开头,为数据库查询为
* 3、30开头,为数据库操作失败
*/
private $QUN_RET_CODE_MSG = array(1000 => array("success" => 999, "msg" => "获取错误信息失败!"), 1001 => array("success" => 0, "msg" => "参数code没有传递!"), 1002 => array("success" => 0, "msg" => "userid为空!"), 1003 => array("success" => 0, "msg" => "类型为空!"), 1004 => array("success" => 0, "msg" => "id为空!"), 1005 => array("success" => 0, "msg" => "客户id为空!"), 1006 => array("success" => 0, "msg" => "待归档记录id为空!"), 1007 => array("success" => 0, "msg" => "客户ID为空!"), 1008 => array("success" => 0, "msg" => "获取客户数据失败!"), 1009 => array("success" => 0, "msg" => "用户名不能为空!"), 1010 => array("success" => 0, "msg" => "密码不能为空!"), 1011 => array("success" => 0, "msg" => "手机号码不能为空!"), 1012 => array("success" => 0, "msg" => "关键字不能为空!"), 1013 => array("success" => 0, "msg" => "缺少参数被保人who!"), 1014 => array("success" => 0, "msg" => "缺少参数boughtid!"), 1015 => array("success" => 0, "msg" => "沟通记录ID为空!"), 1016 => array("success" => 0, "msg" => "公司ID为空!"), 1017 => array("success" => 0, "msg" => "险种ID为空!"), 1018 => array("success" => 0, "msg" => "性别为空!"), 1019 => array("success" => 0, "msg" => "年龄为空!"), 1020 => array("success" => 0, "msg" => "缴费年限为空!"), 1021 => array("success" => 0, "msg" => "保费为空!"), 1022 => array("success" => 0, "msg" => "客户名为空!"), 1023 => array("success" => 0, "msg" => "计划书ID为空!"), 1024 => array("success" => 0, "msg" => "缺少参数myUserid!"), 1025 => array("success" => 0, "msg" => "待删除成员ID为空!"), 1026 => array("success" => 0, "msg" => "缺少参数invteid!"), 1027 => array("success" => 0, "msg" => "查询手机号为空!"), 1028 => array("success" => 0, "msg" => "picture_size为空!"), 1029 => array("success" => 0, "msg" => "status为空!"), 1030 => array("success" => 0, "msg" => "缺少参数notesid!"), 1031 => array("success" => 0, "msg" => "缺少参数recordid!"), 1032 => array("success" => 0, "msg" => "被邀请人id不能为空!"), 1033 => array("success" => 0, "msg" => "口令不能为空!"), 1034 => array("success" => 0, "msg" => "团队长ID不能为空!"), 1035 => array("success" => 0, "msg" => "申请ID不能为空!"), 1036 => array("success" => 0, "msg" => "动态ID不能为空!"), 1037 => array("success" => 0, "msg" => "评论ID不能为空!"), 1038 => array("success" => 0, "msg" => "配置信息不能为空!"), 1039 => array("success" => 0, "msg" => "用户名称不能为空!"), 1040 => array("success" => 0, "msg" => "邮箱地址不能为空!"), 1041 => array("success" => 0, "msg" => "邮箱地址格式不正确!"), 1042 => array("success" => 0, "msg" => "验证信息不正确!"), 1043 => array("success" => 0, "msg" => "自己不能加入自己的团队!"), 1044 => array("success" => 0, "msg" => "申请人手机号码不能为空!"), 1045 => array("success" => 0, "msg" => "推荐人手机号码不能为空!"), 1046 => array("success" => 0, "msg" => "token不能为空!"), 2000 => array("success" => 1, "msg" => "操作成功!"), 2001 => array("success" => 1, "msg" => "添加成功!"), 2002 => array("success" => 1, "msg" => "删除成功!"), 2003 => array("success" => 1, "msg" => "归档成功!"), 2004 => array("success" => 1, "msg" => "导入成功!"), 2005 => array("success" => 1, "msg" => "编辑成功!"), 2006 => array("success" => 1, "msg" => "登录成功!"), 2007 => array("success" => 1, "msg" => "注册成功!"), 2008 => array("success" => 1, "msg" => "用户存在!"), 2009 => array("success" => 0, "msg" => "用户不存在!"), 2010 => array("success" => 1, "msg" => "发送验证码成功!"), 2011 => array("success" => 0, "msg" => "未能计算出保费!"), 2012 => array("success" => 1, "msg" => "已成功发送邀请,请等待对方确认!"), 2013 => array("success" => 0, "msg" => "发送失败!"), 2014 => array("success" => 0, "msg" => "他已经是您的团长了!"), 2015 => array("success" => 0, "msg" => "他已经是您的下属了!"), 2016 => array("success" => 1, "msg" => "已成功发送邀请,请等待对方确认!"), 2017 => array("success" => 0, "msg" => "口令不存在,请确认输入是否正确!"), 2018 => array("success" => 1, "msg" => "校验通过!"), 2019 => array("success" => 1, "msg" => "已经发送过该团队加入申请,正在等待团队长确认!"), 2020 => array("success" => 0, "msg" => "团队长还未创建团队,请联系团队长重新创建团队!"), 2021 => array("success" => 0, "msg" => "待验证的信息不存在,请确认后再验证!"), 2022 => array("success" => 0, "msg" => "验证信息匹配不正确,请重新发送验证后再验证!"), 2023 => array("success" => 0, "msg" => "不能给自己的评论进行回复!"), 2024 => array("success" => 0, "code" => 2024, "msg" => "用户已经存在,不能使用该手机号码申请内测!"), 2025 => array("success" => 0, "msg" => "推荐人不存在!"), 2026 => array("success" => 0, "msg" => "您填写的推荐人已经超过了推荐限制!"), 2027 => array("success" => 0, "msg" => "您已经申请过,正在审核中...!"), 2028 => array("success" => 1, "msg" => "您的申请已经提交,请等待审核,审核结果我们会以短信方式通知您!"), 2029 => array("success" => 0, "msg" => "不能加入自己的团队成员的团队!"), 2030 => array("success" => 0, "msg" => "请先返回上一页提交申请信息!"), 2031 => array("success" => 0, "msg" => "没有获取到通知接收设备!"), 2032 => array("success" => 0, "msg" => "用户已经加入其他团队!"), 2033 => array("success" => 0, "msg" => "不需要发送消息!"), 2034 => array("success" => 1, "msg" => "用户没有加入团队!"), 3000 => array("success" => 0, "msg" => "操作失败!"), 3001 => array("success" => 0, "msg" => "归档失败!"), 3002 => array("success" => 0, "msg" => "用户名或密码错误!"), 3003 => array("success" => 0, "msg" => "注册失败,该用户已经存在!"), 3004 => array("success" => 0, "msg" => "更新用户信息失败!"), 3005 => array("success" => 0, "msg" => "重置密码失败!"), 3006 => array("success" => 0, "msg" => "计划书创建失败!"), 3007 => array("success" => 0, "msg" => "发送验证码失败!"), 3008 => array("success" => 0, "msg" => "申请失败!"));
/**
* @description 获取返回信息
* @param $code 获取返回信息编码
* @param $msg 新制定的提交信息
*/
public function getRetMsg($code, $msg) {
if (!isset($code)) {
return $this -> $QUN_RET_CODE_MSG[1000];
}
if (isset($msg)) {
/*$res=$this -> QUN_RET_CODE_MSG[$code];
$res['retmsg']=$msg;
return $res;*/
//有数据库错误信息时打印日志
Log::record(date('Y-m-d H:i:s') . ' ' . $msg, 'INFO', true);
}
return $this -> QUN_RET_CODE_MSG[$code];
}
}
| 33.976687
| 4,956
| 0.534542
|
663e0ac625870caa5dd6fcc8d9dc78d0a1715ae3
| 10,425
|
lua
|
Lua
|
.config/conky/wo-conky-clock-lua/scripts/text.lua
|
elvq/work-dotfiles
|
2497637bddeff9bcc100b2c1d12b21f53c85bdac
|
[
"MIT"
] | 5
|
2020-12-07T11:47:34.000Z
|
2021-05-31T06:36:57.000Z
|
.config/conky/wo-conky-clock-lua/scripts/text.lua
|
elvq/work-dotfiles
|
2497637bddeff9bcc100b2c1d12b21f53c85bdac
|
[
"MIT"
] | null | null | null |
.config/conky/wo-conky-clock-lua/scripts/text.lua
|
elvq/work-dotfiles
|
2497637bddeff9bcc100b2c1d12b21f53c85bdac
|
[
"MIT"
] | null | null | null |
--[[
#########################
# conky-system-lua-V3 #
# by +WillemO @wim66 #
# v1.0 8-dec-17 #
# #
#########################
]]
--[[TEXT WIDGET v1.3 by Wlourf 25/06/2010
This widget can drawn texts set in the "text_settings" table with some parameters
http://u-scripts.blogspot.com/2010/06/text-widget.html
The parameters (all optionals) are :
text - text to display, default = "Conky is good for you"
use conky_parse to display conky value ie text=conly_parse("${cpu cpu1}")
- coordinates below are relative to top left corner of the conky window
x - x coordinate of first letter (bottom-left), default = center of conky window
y - y coordinate of first letter (bottom-left), default = center of conky window
h_align - horizontal alignement of text relative to point (x,y), default="l"
available values are "l": left, "c" : center, "r" : right
v_align - vertical alignment of text relative to point (x,y), default="b"
available values "t" : top, "m" : middle, "b" : bottom
font_name - name of font to use, default = Free Sans
font_size - size of font to use, default = 14
italic - display text in italic (true/false), default=false
oblique - display text in oblique (true/false), default=false (I don' see the difference with italic!)
bold - display text in bold (true/false), default=false
angle - rotation of text in degrees, default = 0 (horizontal)
colour - table of colours for text, default = plain white {{1,0xFFFFFF,1}}
this table contains one or more tables with format {P,C,A}
P=position of gradient (0 = beginning of text, 1= end of text)
C=hexadecimal colour
A=alpha (opacity) of color (0=invisible,1=opacity 100%)
Examples :
for a plain color {{1,0x00FF00,0.5}}
for a gradient with two colours {{0,0x00FF00,0.5},{1,0x000033,1}}
or {{0.5,0x00FF00,1},{1,0x000033,1}} -with this one, gradient will start in the middle of the text
for a gradient with three colours {{0,0x00FF00,0.5},{0.5,0x000033,1},{1,0x440033,1}}
and so on ...
orientation - in case of gradient, "orientation" defines the starting point of the gradient, default="ww"
there are 8 available starting points : "nw","nn","ne","ee","se","ss","sw","ww"
(n for north, w for west ...)
theses 8 points are the 4 corners + the 4 middles of text's outline
so a gradient "nn" will go from "nn" to "ss" (top to bottom, parallele to text)
a gradient "nw" will go from "nw" to "se" (left-top corner to right-bottom corner)
radial - define a radial gradient (if present at the same time as "orientation", "orientation" will have no effect)
this parameter is a table with 6 numbers : {xa,ya,ra,xb,yb,rb}
they define two circle for the gradient :
xa, ya, xb and yb are relative to x and y values above
reflection_alpha - add a reflection effect (values from 0 to 1) default = 0 = no reflection
other values = starting opacity
reflection_scale - scale of the reflection (default = 1 = height of text)
reflection_length - length of reflection, define where the opacity will be set to zero
calues from 0 to 1, default =1
skew_x,skew_y - skew text around x or y axis
Needs conky 1.8.0
To call this script in the conkyrc, in before-TEXT section:
lua_load /path/to/the/lua/script/text.lua
lua_draw_hook_pre draw_text
v1.0 07/06/2010, Original release
v1.1 10/06/2010 Add "orientation" parameter
v1.2 15/06/2010 Add "h_align", "v_align" and "radial" parameters
v1.3 25/06/2010 Add "reflection_alpha", "reflection_length", "reflection_scale",
"skew_x" et "skew_y"
]]
require 'cairo'
function conky_draw_text()
--BEGIN OF PARAMETRES
if conky_window==nil then return end
local w=conky_window.width
local h=conky_window.height
local xc=w/2
local yc=h/2
local color1={{0,0xE7660B,1}}
local color2={{0,0xFAAD3E,1}}
local color3={{0,0xDCE142,1}}
text_settings={
{
text=conky_parse( "${time %A}" ),
font_name="ubuntu",
font_size=20,
h_align="r",
v_align="m",
bold=false,
x=240,
y=60,
orientation="nn",
colour=color1,
},
{
text=conky_parse( "${time %d %B}" ),
font_name="ubuntu",
font_size=18,
h_align="r",
v_align="m",
bold=false,
x=240,
y=90,
orientation="nn",
colour=color2,
},
}
--------------END OF PARAMETERES----------------
if conky_window == nil then return end
if tonumber(conky_parse("$updates"))<3 then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
for i,v in pairs(text_settings) do
cr = cairo_create (cs)
display_text(v)
cairo_destroy(cr)
end
cairo_surface_destroy(cs)
end
function rgb_to_r_g_b2(tcolour)
colour,alpha=tcolour[2],tcolour[3]
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
function display_text(t)
local function set_pattern()
--this function set the pattern
if #t.colour==1 then
cairo_set_source_rgba(cr,rgb_to_r_g_b2(t.colour[1]))
else
local pat
if t.radial==nil then
local pts=linear_orientation(t,te)
pat = cairo_pattern_create_linear (pts[1],pts[2],pts[3],pts[4])
else
pat = cairo_pattern_create_radial (t.radial[1],t.radial[2],t.radial[3],t.radial[4],t.radial[5],t.radial[6])
end
for i=1, #t.colour do
cairo_pattern_add_color_stop_rgba (pat, t.colour[i][1], rgb_to_r_g_b2(t.colour[i]))
end
cairo_set_source (cr, pat)
end
end
--set default values if needed
if t.text==nil then t.text="Conky is good for you !" end
if t.x==nil then t.x = conky_window.width/2 end
if t.y==nil then t.y = conky_window.height/2 end
if t.colour==nil then t.colour={{0,0XFFFFFF,1},{0.6,0xFFFFFF,0.7}, {1,0xFFFFFF,0.2}} end
if t.font_name==nil then t.font_name="ubuntu" end
if t.font_size==nil then t.font_size=14 end
if t.angle==nil then t.angle=0 end
if t.italic==nil then t.italic=false end
if t.oblique==nil then t.oblique=false end
if t.bold==nil then t.bold=false end
if t.radial ~= nil then
if #t.radial~=6 then
print ("error in radial table")
t.radial=nil
end
end
if t.orientation==nil then t.orientation="nn" end
if t.h_align==nil then t.h_align="l" end
if t.v_align==nil then t.v_align="b" end
if t.reflection_alpha == nil then t.reflection_alpha=0 end
if t.reflection_length == nil then t.reflection_length=1 end
if t.reflection_scale == nil then t.reflection_scale=1 end
if t.skew_x==nil then t.skew_x=0 end
if t.skew_y==nil then t.skew_y=0 end
cairo_translate(cr,t.x,t.y)
cairo_rotate(cr,t.angle*math.pi/180)
cairo_save(cr)
local slant = CAIRO_FONT_SLANT_NORMAL
local weight =CAIRO_FONT_WEIGHT_NORMAL
if t.italic then slant = CAIRO_FONT_SLANT_ITALIC end
if t.oblique then slant = CAIRO_FONT_SLANT_OBLIQUE end
if t.bold then weight = CAIRO_FONT_WEIGHT_BOLD end
cairo_select_font_face(cr, t.font_name, slant,weight)
for i=1, #t.colour do
if #t.colour[i]~=3 then
print ("error in color table")
t.colour[i]={1,0xFFFFFF,1}
end
end
local matrix0 = cairo_matrix_t:create()
skew_x,skew_y=t.skew_x/t.font_size,t.skew_y/t.font_size
cairo_matrix_init (matrix0, 1,skew_y,skew_x,1,0,0)
cairo_transform(cr,matrix0)
cairo_set_font_size(cr,t.font_size)
te=cairo_text_extents_t:create()
cairo_text_extents (cr,t.text,te)
set_pattern()
mx,my=0,0
if t.h_align=="c" then
mx=-te.width/2
elseif t.h_align=="r" then
mx=-te.width
end
if t.v_align=="m" then
my=-te.height/2-te.y_bearing
elseif t.v_align=="t" then
my=-te.y_bearing
end
cairo_move_to(cr,mx,my)
cairo_show_text(cr,t.text)
if t.reflection_alpha ~= 0 then
local matrix1 = cairo_matrix_t:create()
cairo_set_font_size(cr,t.font_size)
cairo_matrix_init (matrix1,1,0,0,-1*t.reflection_scale,0,(te.height+te.y_bearing+my)*(1+t.reflection_scale))
cairo_set_font_size(cr,t.font_size)
te=cairo_text_extents_t:create()
cairo_text_extents (cr,t.text,te)
cairo_transform(cr,matrix1)
set_pattern()
cairo_move_to(cr,mx,my)
cairo_show_text(cr,t.text)
local pat2 = cairo_pattern_create_linear (0,
(te.y_bearing+te.height+my),
0,
te.y_bearing+my)
cairo_pattern_add_color_stop_rgba (pat2, 0,1,0,0,1-t.reflection_alpha)
cairo_pattern_add_color_stop_rgba (pat2, t.reflection_length,0,0,0,1)
cairo_set_line_width(cr,1)
dy=te.x_bearing
if dy<0 then dy=dy*(-1) end
cairo_rectangle(cr,mx+te.x_bearing,te.y_bearing+te.height+my,te.width+dy,-te.height*1.05)
cairo_clip_preserve(cr)
cairo_set_operator(cr,CAIRO_OPERATOR_CLEAR)
--cairo_stroke(cr)
cairo_mask(cr,pat2)
cairo_pattern_destroy(pat2)
cairo_set_operator(cr,CAIRO_OPERATOR_OVER)
end
end
function linear_orientation(t,te)
local w,h=te.width,te.height
local xb,yb=te.x_bearing,te.y_bearing
if t.h_align=="c" then
xb=xb-w/2
elseif t.h_align=="r" then
xb=xb-w
end
if t.v_align=="m" then
yb=-h/2
elseif t.v_align=="t" then
yb=0
end
if t.orientation=="nn" then
p={xb+w/2,yb,xb+w/2,yb+h}
elseif t.orientation=="ne" then
p={xb+w,yb,xb,yb+h}
elseif t.orientation=="ww" then
p={xb,h/2,xb+w,h/2}
elseif vorientation=="se" then
p={xb+w,yb+h,xb,yb}
elseif t.orientation=="ss" then
p={xb+w/2,yb+h,xb+w/2,yb}
elseif vorientation=="ee" then
p={xb+w,h/2,xb,h/2}
elseif t.orientation=="sw" then
p={xb,yb+h,xb+w,yb}
elseif t.orientation=="nw" then
p={xb,yb,xb+w,yb+h}
end
return p
end
| 33.306709
| 147
| 0.630983
|
25ef5c86676e34feed935e7d3e4077e816b309ca
| 3,486
|
cs
|
C#
|
Assets/Scripts/GameManager.cs
|
Kruemelkatze/ThereWillBeLight
|
90c1ac46833209bde08576dfe326dee88649f788
|
[
"MIT"
] | null | null | null |
Assets/Scripts/GameManager.cs
|
Kruemelkatze/ThereWillBeLight
|
90c1ac46833209bde08576dfe326dee88649f788
|
[
"MIT"
] | null | null | null |
Assets/Scripts/GameManager.cs
|
Kruemelkatze/ThereWillBeLight
|
90c1ac46833209bde08576dfe326dee88649f788
|
[
"MIT"
] | null | null | null |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameManager : MonoBehaviour
{
public static GameManager Instance = null;
public enum PlayerColor
{
Red,
Yellow,
Blue
}
public GameObject checkpoint;
public static string StringSeed = "";
public PlayerColor CurrentColor = PlayerColor.Yellow;
private GameObject _player;
public Vector2 CheckpointSpawnOffset = new Vector2(0, 0);
// Awake is always called before any Start functions
void Awake()
{
Cursor.visible = false;
// Check if instance already exists
if (Instance == null)
{
Instance = this;
}
else if (Instance != this)
{
Destroy(gameObject);
}
//Sets this to not be destroyed when reloading scene
DontDestroyOnLoad(gameObject);
}
public PlayerColor[] ColorDistribution = {
PlayerColor.Yellow, PlayerColor.Yellow,PlayerColor.Yellow,PlayerColor.Yellow,PlayerColor.Yellow, // 50%
PlayerColor.Red, PlayerColor.Red, PlayerColor.Red, // 30%
PlayerColor.Blue, PlayerColor.Blue, // 20%
};
public static int Seed
{
get
{
return StringSeed.GetHashCode();
}
}
public bool GameStarted = false;
public bool GamePaused = true;
// Use this for initialization
void Start()
{
Hub.Get<PlayerMovement2>().Enabled = false;
_player = GameObject.FindGameObjectWithTag("Player");
_player.SetActive(false);
Debug.Log(_player);
}
void SetupLevel()
{
Hub.Get<LevelGeneration>().GenerateLevel();
generateCheckpoint();
}
void generateCheckpoint()
{
Instantiate(checkpoint, new Vector3(0, 0, 0), Quaternion.identity);
}
public void switchColor(PlayerColor? color = null)
{
if (color != null)
{
CurrentColor = color.Value;
}
else
{
int i = Random.Range(0, ColorDistribution.Length);
CurrentColor = ColorDistribution[i];
}
Hub.Get<EventHub>().TriggerPlayercolorChangedEvent();
}
public void SetCheckpoint(Vector3 collisionPos)
{
Vector3 vec3Checkpoint = GameObject.FindGameObjectWithTag("checkpoint").transform.position;
vec3Checkpoint = new Vector3(vec3Checkpoint.x, collisionPos.y, vec3Checkpoint.z);
GameObject.FindGameObjectWithTag("checkpoint").transform.position = vec3Checkpoint + new Vector3(CheckpointSpawnOffset.x, CheckpointSpawnOffset.y);
}
public void StartGame(string seed)
{
StringSeed = seed?.ToLowerInvariant() ?? "42";
Debug.Log($"Starting game with seed '{StringSeed}' = {Seed}");
Random.InitState(Seed);
SetupLevel();
GameStarted = true;
_player.SetActive(true);
switchColor(CurrentColor);
Hub.Get<PlayerMovement2>().Enabled = true;
Hub.Get<Highscore>().StartLevel(StringSeed);
}
public void PauseGame()
{
Hub.Get<PlayerMovement2>().Enabled = false;
GamePaused = true;
}
public void RemainGame()
{
Hub.Get<PlayerMovement2>().Enabled = true;
GamePaused = false;
}
public void EndGame()
{
Hub.Get<PlayerMovement2>().Enabled = false;
Hub.Get<UIManager>().ShowEndScreen(Hub.Get<Highscore>().EndLevel());
}
}
| 26.014925
| 155
| 0.615605
|
e2b5f9d54375407b636ca85a9ebc974666f05965
| 1,819
|
py
|
Python
|
test_src/Pages/HomePage.py
|
BJanos87/Vizsgaremek-conduit-app
|
1ffb309389b0cbe68aca56bfde50ba8b17219d03
|
[
"MIT"
] | null | null | null |
test_src/Pages/HomePage.py
|
BJanos87/Vizsgaremek-conduit-app
|
1ffb309389b0cbe68aca56bfde50ba8b17219d03
|
[
"MIT"
] | null | null | null |
test_src/Pages/HomePage.py
|
BJanos87/Vizsgaremek-conduit-app
|
1ffb309389b0cbe68aca56bfde50ba8b17219d03
|
[
"MIT"
] | null | null | null |
from test_src.Pages.base_commands import BaseCommands
from test_src.Data.test_data import HomePgWebElements
from test_src.Data.test_data import TestData
class HomePage(BaseCommands):
"""constructor of the page class"""
def __init__(self, driver):
super().__init__(driver)
self.get_url(TestData.BASE_URL)
"""Page Actions for Home Page"""
"""this used to reload Home Page"""
def reload_home_page(self):
self.driver.get(TestData.BASE_URL)
"""this used to get the current page url"""
def get_home_page_url(self):
return self.get_current_url()
"""this used to get the current page title"""
def get_home_page_title(self):
return self.get_current_title()
"""this used to get list of the cookies from Home Page"""
def get_cookie_status_from_homepage(self):
return len(self.get_cookies_list())
"""this used to check value of the cookie"""
def check_value_cookie_from_homepage(self):
cookie = self.check_value_cookie()
return cookie["value"]
"""this used to click on cookie accept button on Home Page"""
def click_cookie_accept_btn(self):
self.do_click(HomePgWebElements.cookie_accept_btn)
"""this used to check sign up button is displayed"""
def is_sign_up_btn_displayed(self):
return self.is_element_displayed(HomePgWebElements.sign_up_btn)
"""this used to sign up to app"""
def click_sign_up_btn(self):
self.do_click(HomePgWebElements.sign_up_btn)
"""this used to check sign in button is displayed"""
def is_sign_in_btn_displayed(self):
return self.is_element_displayed(HomePgWebElements.sign_in_btn)
"""this used to sign in to app"""
def click_sign_in_btn(self):
return self.do_click(HomePgWebElements.sign_in_btn)
| 33.072727
| 71
| 0.708081
|
ca93d0d123a046a695728eaa78185e61675f5634
| 1,082
|
cs
|
C#
|
View/Gestionnaire/UCShowCars.cs
|
ouldevloper/Csharp-Car-Rental-Management-
|
0d63b898501a3ddd2fdcd098887490eab2569b4f
|
[
"MIT"
] | null | null | null |
View/Gestionnaire/UCShowCars.cs
|
ouldevloper/Csharp-Car-Rental-Management-
|
0d63b898501a3ddd2fdcd098887490eab2569b4f
|
[
"MIT"
] | null | null | null |
View/Gestionnaire/UCShowCars.cs
|
ouldevloper/Csharp-Car-Rental-Management-
|
0d63b898501a3ddd2fdcd098887490eab2569b4f
|
[
"MIT"
] | null | null | null |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using GestionDeLocationVoiture.Control.Classes;
using GestionDeLocationVoiture.Control.Interfaces;
namespace GestionDeLocationVoiture.View.Gestionnaire
{
public partial class cin : UserControl
{
IGestionnaireControler manager;
public cin()
{
InitializeComponent();
manager = new GestionnaireControler();
grid.DataSource = manager.SearchCars("");
}
private void search_Click(object sender, EventArgs e)
{
}
private void modelormatricule_OnTextChange(object sender, EventArgs e)
{
if (modelormatricule.text != string.Empty)
grid.DataSource = manager.SearchCars(modelormatricule.text);
else
grid.DataSource = manager.showCars();
}
}
}
| 28.473684
| 79
| 0.636784
|
12bd0252bca3702cab18199f5ab8df1bb51e4c30
| 705
|
cs
|
C#
|
VoiceTelSharp.Lib/Models/Call/NumberList.cs
|
Pwnoz0r/VoiceTelSharp
|
57edd82f27b07b94ae40a27bba2fb6b2b23e9b15
|
[
"Apache-2.0"
] | null | null | null |
VoiceTelSharp.Lib/Models/Call/NumberList.cs
|
Pwnoz0r/VoiceTelSharp
|
57edd82f27b07b94ae40a27bba2fb6b2b23e9b15
|
[
"Apache-2.0"
] | null | null | null |
VoiceTelSharp.Lib/Models/Call/NumberList.cs
|
Pwnoz0r/VoiceTelSharp
|
57edd82f27b07b94ae40a27bba2fb6b2b23e9b15
|
[
"Apache-2.0"
] | null | null | null |
// Copyright (c) 2018 Initial Servers LLC. All rights reserved.
// https://initialservers.com/
using System.Collections.Generic;
using System.ComponentModel;
using Newtonsoft.Json;
namespace VoiceTelSharp.Lib.Models.Call
{
public class Number
{
[JsonProperty("number")] public string Num { get; set; }
[JsonProperty("id")] public string Id { get; set; }
[JsonProperty("ip")] public string Ip { get; set; }
}
[Description("https://api.voicetel.com/numberList/[api_key]/")]
public class NumberList
{
[JsonProperty("status")] public string Status { get; set; }
[JsonProperty("numbers")] public IList<Number> Numbers { get; set; }
}
}
| 27.115385
| 76
| 0.653901
|
b753e58ff00bc994c8dc9e157fe23b35e3166aa9
| 8,811
|
hpp
|
C++
|
include/mockturtle/algorithms/aqfp/detail/dag_util.hpp
|
shi27feng/mockturtle
|
032dcd590b57040c5ff10d80b515353ffe822671
|
[
"MIT"
] | null | null | null |
include/mockturtle/algorithms/aqfp/detail/dag_util.hpp
|
shi27feng/mockturtle
|
032dcd590b57040c5ff10d80b515353ffe822671
|
[
"MIT"
] | null | null | null |
include/mockturtle/algorithms/aqfp/detail/dag_util.hpp
|
shi27feng/mockturtle
|
032dcd590b57040c5ff10d80b515353ffe822671
|
[
"MIT"
] | null | null | null |
/* mockturtle: C++ logic network library
* Copyright (C) 2018-2021 EPFL
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
/*!
\file dag_util.hpp
\brief Utilities for DAG generation
\author Dewmini Marakkalage
*/
#pragma once
#include <map>
#include <set>
#include <unordered_map>
#include <vector>
#include <mockturtle/utils/hash_functions.hpp>
namespace mockturtle
{
namespace detail
{
/*! \brief Computes and returns the frequency map for a given collection of elements.
* Use std::map instead of std::unordered_map because we use it as a key in a hash-table so the order is important to compute the hash
*/
template<typename ElemT>
inline std::map<ElemT, uint32_t> get_frequencies( const std::vector<ElemT>& elems )
{
std::map<ElemT, uint32_t> elem_counts;
std::for_each( elems.begin(), elems.end(), [&elem_counts]( auto e ) { elem_counts[e]++; } );
return elem_counts;
}
template<typename ElemT>
class partition_generator
{
using part = std::multiset<ElemT>;
using partition = std::multiset<part>;
using partition_set = std::set<partition>;
using inner_cache_key_t = std::vector<ElemT>;
using inner_cache_t = std::unordered_map<inner_cache_key_t, partition_set, hash<inner_cache_key_t>>;
using outer_cache_key_t = std::tuple<std::vector<uint32_t>, uint32_t, uint32_t>;
using outer_cache_t = std::unordered_map<outer_cache_key_t, inner_cache_t, hash<outer_cache_key_t>>;
public:
/*! \brief Computes and returns a set of partitions for a given list of elements
* such that no part contains any element `e` more than `max_counts[e]` times.
*/
partition_set operator()(
std::vector<int> elems,
const std::vector<uint32_t>& max_counts = {},
uint32_t max_parts = 0,
uint32_t max_part_size = 0 )
{
_elems = elems;
_max_counts = max_counts;
_max_parts = max_parts;
_max_part_size = max_part_size;
const outer_cache_key_t key = { _max_counts, _max_parts, _max_part_size };
partition_cache = outer_cache.insert( { key, inner_cache_t() } ).first;
return get_all_partitions();
}
private:
outer_cache_t outer_cache;
typename outer_cache_t::iterator partition_cache;
std::vector<ElemT> _elems;
std::vector<uint32_t> _max_counts;
uint32_t _max_parts;
uint32_t _max_part_size;
partition_set get_all_partitions()
{
if ( _elems.size() == 0 )
{
return { {} }; // return the empty partition.
}
inner_cache_key_t key = _elems;
if ( partition_cache->second.count( key ) )
{
return partition_cache->second.at( key );
}
partition_set result;
auto last = _elems.back();
_elems.pop_back();
auto temp = get_all_partitions();
for ( auto&& t : temp )
{
partition cpy;
// take 'last' in its own partition
cpy = t;
if ( _max_parts == 0u || _max_parts > cpy.size() )
{
cpy.insert( { last } );
result.insert( cpy );
}
// add 'last' to one of the existing partitions
for ( auto it = t.begin(); it != t.end(); )
{
if ( _max_counts.empty() || it->count( last ) < _max_counts[last] )
{
if ( _max_part_size == 0 || _max_part_size > it->size() )
{
cpy = t;
auto elem_it = cpy.find( *it );
auto cpy_elem = *elem_it;
cpy_elem.insert( last );
cpy.erase( elem_it );
cpy.insert( cpy_elem );
result.insert( cpy );
}
}
std::advance( it, t.count( *it ) );
}
}
return ( partition_cache->second[key] = result );
}
};
template<typename ElemT>
class partition_extender
{
using part = std::multiset<ElemT>;
using partition = std::multiset<part>;
using partition_set = std::set<partition>;
using inner_cache_key_t = std::vector<ElemT>;
using inner_cache_t = std::unordered_map<inner_cache_key_t, partition_set, hash<inner_cache_key_t>>;
using outer_cache_key_t = std::tuple<partition, std::vector<uint32_t>, uint32_t>;
using outer_cache_t = std::map<outer_cache_key_t, inner_cache_t>;
public:
/*! \brief Compute a list of different partitions that can be obtained by adding elements
* in `elems` to the parts of `base` such that no part contains any element `e` more than
* `max_counts[e]` times
*/
partition_set operator()( std::vector<ElemT> elems, partition base, const std::vector<uint32_t>& max_counts, uint32_t max_part_size = 0 )
{
_elems = elems;
_base = base;
_max_counts = max_counts;
_max_part_size = max_part_size;
const outer_cache_key_t key = { _base, _max_counts, _max_part_size };
partition_cache = outer_cache.insert( { key, inner_cache_t() } ).first;
return extend_partitions();
}
private:
outer_cache_t outer_cache;
typename outer_cache_t::iterator partition_cache;
std::vector<ElemT> _elems;
partition _base;
std::vector<uint32_t> _max_counts;
uint32_t _max_part_size;
partition_set extend_partitions()
{
if ( _elems.size() == 0 )
{
return { _base };
}
inner_cache_key_t key = _elems;
if ( partition_cache->second.count( key ) )
{
return partition_cache->second.at( key );
}
partition_set result;
auto last = _elems.back();
_elems.pop_back();
auto temp = extend_partitions();
for ( auto&& t : temp )
{
partition cpy;
for ( auto it = t.begin(); it != t.end(); )
{
if ( it->count( last ) < _max_counts.at( last ) )
{
if ( _max_part_size == 0 || _max_part_size > it->size() )
{
cpy = t;
auto elem_it = cpy.find( *it );
auto cpy_elem = *elem_it;
cpy_elem.insert( last );
cpy.erase( elem_it );
cpy.insert( cpy_elem );
result.insert( cpy );
}
}
std::advance( it, t.count( *it ) );
}
}
return ( partition_cache->second[key] = result );
}
};
template<typename ElemT>
struct sublist_generator
{
using sub_list_cache_key_t = std::map<ElemT, uint32_t>;
public:
/**
* \brief Given a list of elements `elems`, generate all sub lists of those elements.
* Ex: if `elems` = [1, 2, 2, 3], this will generate the following lists:
* [0], [1], [1, 2], [1, 2, 2], [1, 2, 2, 3], [1, 2, 3], [1, 3], [2], [2, 2], [2, 2, 3], [2, 3], and [3].
*/
std::set<std::vector<ElemT>> operator()( std::vector<ElemT> elems )
{
elem_counts = get_frequencies( elems );
return get_sub_lists_recur();
}
private:
std::unordered_map<sub_list_cache_key_t, std::set<std::vector<ElemT>>, hash<sub_list_cache_key_t>> sub_list_cache;
std::map<ElemT, uint32_t> elem_counts;
std::set<std::vector<ElemT>> get_sub_lists_recur()
{
if ( elem_counts.size() == 0u )
{
return { {} };
}
sub_list_cache_key_t key = elem_counts;
if ( !sub_list_cache.count( key ) )
{
auto last = std::prev( elem_counts.end() );
auto last_elem = last->first;
auto last_count = last->second;
elem_counts.erase( last );
std::set<std::vector<int>> result;
std::vector<int> t;
for ( auto i = last_count; i > 0; --i )
{
t.push_back( last_elem );
result.insert( t ); // insert a copy of t, and note that t is already sorted.
}
auto temp = get_sub_lists_recur();
for ( std::vector<int> t : temp )
{
result.insert( t );
for ( auto i = last_count; i > 0; --i )
{
t.push_back( last_elem );
std::sort( t.begin(), t.end() );
result.insert( t );
}
}
sub_list_cache[key] = result;
}
return sub_list_cache[key];
}
};
} // namespace detail
} // namespace mockturtle
| 27.794953
| 139
| 0.637726
|
f432d076ee224ad058540229f0a20c0a8c1c1f33
| 7,281
|
cs
|
C#
|
EIDSS v6/bltoolkit.3.2.dev/Reflection/Emit/MethodBuilderHelper.cs
|
EIDSS/EIDSS-Legacy
|
2f7f45f1882a899dde6f774c2d38b9f431ce42c1
|
[
"BSD-2-Clause"
] | 2
|
2017-09-14T03:03:40.000Z
|
2017-09-15T14:58:47.000Z
|
EIDSS v5/bltoolkit.3.2.dev/Reflection/Emit/MethodBuilderHelper.cs
|
EIDSS/EIDSS-Legacy
|
2f7f45f1882a899dde6f774c2d38b9f431ce42c1
|
[
"BSD-2-Clause"
] | null | null | null |
EIDSS v5/bltoolkit.3.2.dev/Reflection/Emit/MethodBuilderHelper.cs
|
EIDSS/EIDSS-Legacy
|
2f7f45f1882a899dde6f774c2d38b9f431ce42c1
|
[
"BSD-2-Clause"
] | 2
|
2017-09-14T03:03:45.000Z
|
2019-03-25T23:09:43.000Z
|
using System;
using System.Collections.Generic;
using System.Reflection.Emit;
using System.Reflection;
namespace BLToolkit.Reflection.Emit
{
/// <summary>
/// A wrapper around the <see cref="MethodBuilder"/> class.
/// </summary>
/// <include file="Examples.CS.xml" path='examples/emit[@name="Emit"]/*' />
/// <include file="Examples.VB.xml" path='examples/emit[@name="Emit"]/*' />
/// <seealso cref="System.Reflection.Emit.MethodBuilder">MethodBuilder Class</seealso>
public class MethodBuilderHelper : MethodBuilderBase
{
/// <summary>
/// Initializes a new instance of the <see cref="MethodBuilderHelper"/> class
/// with the specified parameters.
/// </summary>
/// <param name="typeBuilder">Associated <see cref="TypeBuilderHelper"/>.</param>
/// <param name="methodBuilder">A <see cref="MethodBuilder"/></param>
public MethodBuilderHelper(TypeBuilderHelper typeBuilder, MethodBuilder methodBuilder)
: base(typeBuilder)
{
if (methodBuilder == null) throw new ArgumentNullException("methodBuilder");
_methodBuilder = methodBuilder;
methodBuilder.SetCustomAttribute(Type.Assembly.BLToolkitAttribute);
}
/// <summary>
/// Sets a custom attribute using a custom attribute type.
/// </summary>
/// <param name="attributeType">Attribute type.</param>
public void SetCustomAttribute(Type attributeType)
{
if (attributeType == null) throw new ArgumentNullException("attributeType");
ConstructorInfo ci = attributeType.GetConstructor(System.Type.EmptyTypes);
CustomAttributeBuilder caBuilder = new CustomAttributeBuilder(ci, new object[0]);
_methodBuilder.SetCustomAttribute(caBuilder);
}
/// <summary>
/// Sets a custom attribute using a custom attribute type
/// and named properties.
/// </summary>
/// <param name="attributeType">Attribute type.</param>
/// <param name="properties">Named properties of the custom attribute.</param>
/// <param name="propertyValues">Values for the named properties of the custom attribute.</param>
public void SetCustomAttribute(
Type attributeType,
PropertyInfo[] properties,
object[] propertyValues)
{
if (attributeType == null) throw new ArgumentNullException("attributeType");
ConstructorInfo ci = attributeType.GetConstructor(System.Type.EmptyTypes);
CustomAttributeBuilder caBuilder = new CustomAttributeBuilder(
ci, new object[0], properties, propertyValues);
_methodBuilder.SetCustomAttribute(caBuilder);
}
/// <summary>
/// Sets a custom attribute using a custom attribute type
/// and named property.
/// </summary>
/// <param name="attributeType">Attribute type.</param>
/// <param name="propertyName">A named property of the custom attribute.</param>
/// <param name="propertyValue">Value for the named property of the custom attribute.</param>
public void SetCustomAttribute(
Type attributeType,
string propertyName,
object propertyValue)
{
SetCustomAttribute(
attributeType,
new PropertyInfo[] { attributeType.GetProperty(propertyName) },
new object[] { propertyValue });
}
/// <summary>
/// Initializes a new instance of the <see cref="MethodBuilderHelper"/> class
/// with the specified parameters.
/// </summary>
/// <param name="typeBuilder">Associated <see cref="TypeBuilderHelper"/>.</param>
/// <param name="methodBuilder">A <see cref="MethodBuilder"/></param>
/// <param name="genericArguments">Generic arguments of the method.</param>
/// <param name="returnType">The return type of the method.</param>
/// <param name="parameterTypes">The types of the parameters of the method.</param>
internal MethodBuilderHelper(
TypeBuilderHelper typeBuilder,
MethodBuilder methodBuilder,
Type[] genericArguments,
Type returnType,
Type[] parameterTypes
)
: base(typeBuilder)
{
if (methodBuilder == null) throw new ArgumentNullException("methodBuilder");
if (genericArguments == null) throw new ArgumentNullException("genericArguments");
_methodBuilder = methodBuilder;
string[] genArgNames = Array.ConvertAll<Type, string>(genericArguments, delegate (Type t)
{
return t.Name;
});
GenericTypeParameterBuilder[] genParams = methodBuilder.DefineGenericParameters(genArgNames);
// Copy parameter constraints.
//
List<Type> interfaceConstraints = null;
for (int i = 0; i < genParams.Length; i++)
{
genParams[i].SetGenericParameterAttributes(genericArguments[i].GenericParameterAttributes);
foreach (Type constraint in genericArguments[i].GetGenericParameterConstraints())
{
if (constraint.IsClass)
genParams[i].SetBaseTypeConstraint(constraint);
else
{
if (interfaceConstraints == null)
interfaceConstraints = new List<Type>();
interfaceConstraints.Add(constraint);
}
}
if (interfaceConstraints != null && interfaceConstraints.Count != 0)
{
genParams[i].SetInterfaceConstraints(interfaceConstraints.ToArray());
interfaceConstraints.Clear();
}
}
// When a method contains a generic parameter we need to replace all
// generic types from methodInfoDeclaration with local ones.
//
for (int i = 0; i < parameterTypes.Length; i++)
parameterTypes[i] = TypeHelper.TranslateGenericParameters(parameterTypes[i], genParams);
methodBuilder.SetParameters(parameterTypes);
methodBuilder.SetReturnType(TypeHelper.TranslateGenericParameters(returnType, genParams));
// Once all generic stuff is done is it is safe to call SetCustomAttribute
//
methodBuilder.SetCustomAttribute(Type.Assembly.BLToolkitAttribute);
}
private readonly MethodBuilder _methodBuilder;
/// <summary>
/// Gets MethodBuilder.
/// </summary>
public MethodBuilder MethodBuilder
{
get { return _methodBuilder; }
}
/// <summary>
/// Converts the supplied <see cref="MethodBuilderHelper"/> to a <see cref="MethodBuilder"/>.
/// </summary>
/// <param name="methodBuilder">The <see cref="MethodBuilderHelper"/>.</param>
/// <returns>A <see cref="MethodBuilder"/>.</returns>
public static implicit operator MethodBuilder(MethodBuilderHelper methodBuilder)
{
if (methodBuilder == null) throw new ArgumentNullException("methodBuilder");
return methodBuilder.MethodBuilder;
}
private EmitHelper _emitter;
/// <summary>
/// Gets <see cref="EmitHelper"/>.
/// </summary>
public override EmitHelper Emitter
{
get
{
if (_emitter == null)
_emitter = new EmitHelper(this, _methodBuilder.GetILGenerator());
return _emitter;
}
}
private MethodInfo _overriddenMethod;
/// <summary>
/// Gets or sets the base type method overridden by this method, if any.
/// </summary>
public MethodInfo OverriddenMethod
{
get { return _overriddenMethod; }
set { _overriddenMethod = value; }
}
/// <summary>
/// Returns the type that declares this method.
/// </summary>
public Type DeclaringType
{
get { return _methodBuilder.DeclaringType; }
}
}
}
| 34.671429
| 100
| 0.68562
|
b0e38bd4dc7b8ae70f07400d86176cc854606c19
| 1,673
|
py
|
Python
|
vv/commands.py
|
catherinedevlin/verse-voter
|
bd0a0a04656d07e05b81ab064ee9b0e19aa677b6
|
[
"MIT"
] | null | null | null |
vv/commands.py
|
catherinedevlin/verse-voter
|
bd0a0a04656d07e05b81ab064ee9b0e19aa677b6
|
[
"MIT"
] | null | null | null |
vv/commands.py
|
catherinedevlin/verse-voter
|
bd0a0a04656d07e05b81ab064ee9b0e19aa677b6
|
[
"MIT"
] | null | null | null |
from datetime import datetime
from os.path import join
from random import random
from time import sleep
from pony import orm
from .helpers import get_config
from .models import Project, Verse
from .reddit import get_subreddit
@orm.db_session
def read_from_reddit():
config = get_config()
project_name = config['WEBSITE']['project']
subreddit = get_subreddit()
for submission in subreddit.submissions():
if submission.comments:
comment = submission.comments[0] # automatically sorts top comment
verse = Verse.get(topic_url=submission.id)
if verse:
verse.result_text = comment.body
verse.last_modified = datetime.fromtimestamp(comment.created_utc)
@orm.db_session
def write_to_reddit():
config = get_config()
project_name = config['WEBSITE']['project']
subreddit = get_subreddit()
# update existing verses
for submission in subreddit.submissions():
verse = Verse.get(topic_url=submission.id)
if verse:
newbody = verse.reddit_markdown()
if submission.selftext != newbody:
print(f'Pushing edit to {verse.name}')
submission.edit(newbody)
sleep(random())
# initial push of new verses
for verse in Verse.select(lambda v: v.topic_url is None):
verse.push_to_reddit(subreddit)
print(f'pushed {verse.name}')
sleep(random())
break
@orm.db_session
def write_site():
config = get_config()
project_name = config['WEBSITE']['project']
project = Project.get(name=project_name)
project.write_site(config['WEBSITE']['path'])
| 29.875
| 81
| 0.661686
|
1c361005216db00dede2743ab8c423242f5dfea0
| 9,765
|
lua
|
Lua
|
AzurLaneData/zh-CN/view/ship/shipinfoview/shipequipview.lua
|
FlandreCirno/AzurLaneWikiUtilitiesManual
|
b525fd9086dd716bb65848a8cd0635b261ab6fdf
|
[
"MIT"
] | null | null | null |
AzurLaneData/zh-CN/view/ship/shipinfoview/shipequipview.lua
|
FlandreCirno/AzurLaneWikiUtilitiesManual
|
b525fd9086dd716bb65848a8cd0635b261ab6fdf
|
[
"MIT"
] | null | null | null |
AzurLaneData/zh-CN/view/ship/shipinfoview/shipequipview.lua
|
FlandreCirno/AzurLaneWikiUtilitiesManual
|
b525fd9086dd716bb65848a8cd0635b261ab6fdf
|
[
"MIT"
] | null | null | null |
slot0 = class("ShipEquipView", import("...base.BaseSubView"))
slot0.UNLOCK_EQUIPMENT_SKIN_POS = {
1,
2,
3
}
slot0.getUIName = function (slot0)
return "ShipEquipView"
end
slot0.OnInit = function (slot0)
slot0:InitEquipment()
end
slot0.SetShareData = function (slot0, slot1)
slot0.shareData = slot1
end
slot0.GetShipVO = function (slot0)
if slot0.shareData and slot0.shareData.shipVO then
return slot0.shareData.shipVO
end
return nil
end
slot0.UpdateUI = function (slot0)
slot0:UpdateEquipments(slot0:GetShipVO())
end
slot0.InitEquipment = function (slot0)
slot0.mainPanel = slot0._parentTf.parent
slot0.equipRCon = slot0._parentTf:Find("equipment_r_container")
slot0.equipLCon = slot0._parentTf:Find("equipment_l_container")
slot0.equipmentR = slot0:findTF("equipment_r")
slot0.equipmentL = slot0:findTF("equipment_l")
slot0.equipmentR1 = slot0.equipmentR:Find("equipment/equipment_r1")
slot0.equipmentR2 = slot0.equipmentR:Find("equipment/equipment_r2")
slot0.equipmentR3 = slot0.equipmentR:Find("equipment/equipment_r3")
slot0.equipmentL1 = slot0.equipmentL:Find("equipment/equipment_l1")
slot0.equipmentL2 = slot0.equipmentL:Find("equipment/equipment_l2")
slot0.equipSkinBtn = slot0.equipmentR:Find("equipment_skin_btn")
slot0.resource = slot0._tf:Find("resource")
slot0.equipSkinLogicPanel = ShipEquipSkinLogicPanel.New(slot0._tf.gameObject)
slot0.equipSkinLogicPanel:attach(slot0)
slot0.equipSkinLogicPanel:setLabelResource(slot0.resource)
setActive(slot0.equipSkinLogicPanel._go, true)
setParent(slot0.equipmentR, slot0.equipRCon)
setParent(slot0.equipmentL, slot0.equipLCon)
setActive(slot0.equipmentR, true)
setActive(slot0.equipmentL, true)
setActive(slot0.equipSkinBtn, true)
slot0.equipmentPanels = {
slot0.equipmentR1,
slot0.equipmentR2,
slot0.equipmentR3,
slot0.equipmentL1,
slot0.equipmentL2
}
slot0.onSelected = false
end
slot0.InitEvent = function (slot0)
onButton(slot0, slot0.equipSkinBtn, function ()
slot0, slot1 = ShipStatus.ShipStatusCheck("onModify", slot0:GetShipVO())
if not slot0 then
pg.TipsMgr.GetInstance():ShowTips(slot1)
return
end
slot0:switch2EquipmentSkinPage()
end)
if slot0.contextData.isInEquipmentSkinPage then
slot0.contextData.isInEquipmentSkinPage = nil
triggerButton(slot0.equipSkinBtn)
end
end
slot0.OnSelected = function (slot0, slot1)
slot2 = pg.UIMgr.GetInstance()
if slot1 then
slot5(slot0.equipmentR:Find("skin"), slot4)
slot5(slot0.equipmentR:Find("equipment"), slot4)
slot5(slot0.equipmentL:Find("skin"), slot3)
slot5(slot0.equipmentL:Find("equipment"), slot3)
table.insert(slot3, slot0.equipmentL:Find("equipment/equipment_l1"))
slot2:OverlayPanelPB(slot0.equipRCon, {
pbList = {},
groupName = LayerWeightConst.GROUP_SHIPINFOUI,
overlayType = LayerWeightConst.OVERLAY_UI_ADAPT,
weight = LayerWeightConst.LOWER_LAYER
})
slot2:OverlayPanelPB(slot0.equipLCon, {
pbList = {},
groupName = LayerWeightConst.GROUP_SHIPINFOUI,
overlayType = LayerWeightConst.OVERLAY_UI_ADAPT,
weight = LayerWeightConst.LOWER_LAYER
})
else
slot2:UnOverlayPanel(slot0.equipRCon, slot0._parentTf)
slot2:UnOverlayPanel(slot0.equipLCon, slot0._parentTf)
end
slot0.onSelected = slot1
end
slot0.UpdateEquipments = function (slot0, slot1)
slot2 = slot1:getActiveEquipments()
for slot6, slot7 in ipairs(slot1.equipments) do
slot0:UpdateEquipmentPanel(slot6, slot7, slot2[slot6])
end
if slot0.equipSkinLogicPanel then
slot0.equipSkinLogicPanel:updateAll(slot1)
end
if slot0.contextData.openEquipUpgrade == true then
slot0.contextData.openEquipUpgrade = false
slot3 = 0
for slot9, slot10 in ipairs(slot5) do
if slot10 then
slot3 = slot3 + 1
end
end
if slot3 > 0 then
slot0:emit(ShipMainMediator.OPEN_EQUIP_UPGRADE, slot0:GetShipVO().id)
else
pg.TipsMgr.GetInstance():ShowTips(i18n("fightfail_noequip"))
end
end
end
slot0.UpdateEquipmentPanel = function (slot0, slot1, slot2, slot3)
slot7 = findTF(slot5, "efficiency")
setActive(slot5, slot2)
setActive(slot6, not slot2)
slot9 = nil
for slot13, slot14 in pairs(slot0:GetShipVO().skills) do
if ys.Battle.BattleDataFunction.GetBuffTemplate(slot14.id, slot14.level).shipInfoScene and slot15.shipInfoScene.equip then
slot9 = slot15.shipInfoScene.equip
end
end
slot10 = findTF(slot4, "panel_title/type")
if findTF(slot4, "skin_icon") then
setActive(slot11, slot2 and slot2:hasSkin())
end
slot10:GetComponent(typeof(Text)).text = EquipType.LabelToName(slot12)
if slot2 then
setActive(slot7, not slot2:isDevice())
if not slot2:isDevice() then
slot14 = pg.ship_data_statistics[slot8.configId]
slot16 = (slot8:getEquipProficiencyByPos(slot1) and slot15 * 100) or 0
slot17 = false
slot18 = slot8:getFlag("inWorld") and slot0.contextData.fromMediatorName == WorldMediator.__cname and WorldConst.FetchWorldShip(slot8.id):IsBroken()
if not slot18 and slot9 then
for slot22, slot23 in ipairs(slot9) do
if slot0:equipmentCheck(slot23) and slot0.equipmentEnhance(slot23, slot2) then
slot16 = slot16 + slot23.number
slot17 = true
end
end
end
setButtonText(slot7, (slot17 and setColorStr(slot16 .. "%", COLOR_GREEN)) or slot16 .. "%")
end
updateEquipment(slot14, slot2)
slot15 = slot2.config.name
if slot2.config.ammo_icon[1] then
setActive(findTF(slot5, "cont/icon_ammo"), true)
setImageSprite(findTF(slot5, "cont/icon_ammo"), GetSpriteFromAtlas("ammo", slot2.config.ammo_icon[1]))
else
setActive(findTF(slot5, "cont/icon_ammo"), false)
end
setScrollText(slot0.equipmentPanels[slot1]:Find("info/cont/name_mask/name"), slot15)
eachChild(slot16, function (slot0)
setActive(slot0, false)
end)
slot18 = underscore.filter(slot2.GetPropertiesInfo(slot2).attrs, function (slot0)
return not slot0.type or slot0.type ~= AttributeType.AntiSiren
end)
slot17 = slot18
slot19 = (slot2.config.skill_id[1] and slot2:isDevice() and {
1,
2,
5
}) or {
1,
4,
2,
3
}
for slot23, slot24 in ipairs(slot19) do
slot25 = slot16:Find("attr_" .. slot24)
slot26 = findTF(slot25, "panel")
slot27 = findTF(slot25, "lock")
setActive(slot25, true)
if slot24 == 5 then
setText(slot26:Find("values/value"), "")
setText(slot26:Find("values/value_1"), getSkillName(slot18))
setActive(slot27, false)
elseif #slot17 > 0 then
slot28 = table.remove(slot17, 1)
if slot2:isAircraft() and slot28.type == AttributeType.CD then
slot28 = slot8:getAircraftReloadCD()
end
slot33, slot33 = Equipment.GetInfoTrans(slot28, slot8)
setText(slot26:Find("tag"), slot29)
if #string.split(tostring(slot30), "/") >= 2 then
setText(slot26:Find("values/value"), slot31[1] .. "/")
setText(slot26:Find("values/value_1"), slot31[2])
else
setText(slot26:Find("values/value"), slot30)
setText(slot26:Find("values/value_1"), "")
end
setActive(slot27, false)
else
setText(slot26:Find("tag"), "")
setText(slot26:Find("values/value"), "")
setText(slot26:Find("values/value_1"), "")
setActive(slot27, true)
end
end
onButton(slot0, slot4, function ()
slot0:emit(BaseUI.ON_EQUIPMENT, {
type = EquipmentInfoMediator.TYPE_SHIP,
shipId = slot1.id,
pos = BaseUI.ON_EQUIPMENT
})
end, SFX_UI_DOCKYARD_EQUIPADD)
else
onButton(slot0, slot4, function ()
if slot0 then
slot0, slot1 = ShipStatus.ShipStatusCheck("onModify", ShipStatus.ShipStatusCheck)
if not slot0 then
pg.TipsMgr.GetInstance():ShowTips(slot1)
return
end
slot1:emit(ShipMainMediator.ON_SELECT_EQUIPMENT, slot1.emit)
end
end, SFX_UI_DOCKYARD_EQUIPADD)
end
end
slot0.equipmentCheck = function (slot0, slot1)
if not slot0:GetShipVO() then
return false
end
slot3 = slot1.check_indexList
slot4 = slot1.check_label
if not slot1.check_type and not slot3 and not slot4 then
return true
end
slot5 = false
slot6 = {}
slot7 = Clone(slot0:GetShipVO().equipments)
if slot3 then
slot8 = #slot7
while slot8 > 0 do
if not table.contains(slot3, slot8) then
table.remove(slot7, slot8)
end
slot8 = slot8 - 1
end
end
if slot2 then
slot8 = #slot7
while slot8 > 0 do
if not slot7[slot8] or not table.contains(slot2, slot9.config.type) then
table.remove(slot7, slot8)
end
slot8 = slot8 - 1
end
end
if slot4 then
slot8 = #slot7
while slot8 > 0 do
if slot7[slot8] then
slot10 = 1
for slot14, slot15 in ipairs(slot4) do
if not table.contains(slot9.config.label, slot15) then
slot10 = slot10 * 0
end
end
if slot10 == 0 then
table.remove(slot7, slot8)
end
else
table.remove(slot7, slot8)
end
slot8 = slot8 - 1
end
end
return #slot7 > 0
end
slot0.equipmentEnhance = function (slot0, slot1)
slot2 = 1
slot3 = slot1.config.label
if slot0.label then
slot2 = 1
for slot7, slot8 in ipairs(slot0.label) do
if not table.contains(slot3, slot8) then
slot2 = 0
break
end
end
end
return slot2 == 1
end
slot0.switch2EquipmentSkinPage = function (slot0)
if slot0.equipSkinLogicPanel:isTweening() then
return
end
slot0.equipSkinLogicPanel:doSwitchAnim(slot0.contextData.isInEquipmentSkinPage)
slot0.contextData.isInEquipmentSkinPage = not slot0.contextData.isInEquipmentSkinPage
setActive(slot0.equipSkinBtn:Find("unsel"), not slot0.contextData.isInEquipmentSkinPage)
setActive(slot0.equipSkinBtn:Find("sel"), slot0.contextData.isInEquipmentSkinPage)
slot0.equipSkinLogicPanel:updateAll(slot0:GetShipVO())
end
slot0.OnDestroy = function (slot0)
setParent(slot0.equipmentR, slot0._tf)
setParent(slot0.equipmentL, slot0._tf)
slot0.shareData = nil
end
return slot0
| 25.102828
| 151
| 0.731695
|
b783b5beb076ebb706b6f1bfad72eaf1be30e8ee
| 53,356
|
sql
|
SQL
|
database.sql
|
steveyout/exetra
|
d877c3dcb5169012d137da3f461e012d9b58ca49
|
[
"Apache-2.0"
] | null | null | null |
database.sql
|
steveyout/exetra
|
d877c3dcb5169012d137da3f461e012d9b58ca49
|
[
"Apache-2.0"
] | null | null | null |
database.sql
|
steveyout/exetra
|
d877c3dcb5169012d137da3f461e012d9b58ca49
|
[
"Apache-2.0"
] | 1
|
2020-02-26T06:43:36.000Z
|
2020-02-26T06:43:36.000Z
|
-- phpMyAdmin SQL Dump
-- version 4.1.6
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Sep 14, 2017 at 08:57 AM
-- Server version: 5.6.16
-- PHP Version: 5.5.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `pay`
--
-- --------------------------------------------------------
--
-- Table structure for table `action_queue`
--
CREATE TABLE IF NOT EXISTS `action_queue` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`action_time` varchar(100) DEFAULT NULL,
`action_repeat` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=633 ;
--
-- Dumping data for table `action_queue`
--
INSERT INTO `action_queue` (`id`, `action_time`, `action_repeat`) VALUES
(632, '1491643431', '3600');
-- --------------------------------------------------------
--
-- Table structure for table `announcements`
--
CREATE TABLE IF NOT EXISTS `announcements` (
`id` int(11) NOT NULL,
`news` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `announcements`
--
INSERT INTO `announcements` (`id`, `news`) VALUES
(1, 'Registration is ongoing \r\nProgrammers are working to ensure all participants can get on the site without difficulty or server errors. \r\nThe list will be out by 6pm today. \r\nPlease bear with us.');
-- --------------------------------------------------------
--
-- Table structure for table `list_date`
--
CREATE TABLE IF NOT EXISTS `list_date` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`release_time` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=408 ;
--
-- Dumping data for table `list_date`
--
INSERT INTO `list_date` (`id`, `release_time`) VALUES
(407, '1491033602');
-- --------------------------------------------------------
--
-- Table structure for table `list_status`
--
CREATE TABLE IF NOT EXISTS `list_status` (
`status` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `list_status`
--
INSERT INTO `list_status` (`status`) VALUES
(1);
-- --------------------------------------------------------
--
-- Table structure for table `match_queue`
--
CREATE TABLE IF NOT EXISTS `match_queue` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`payer_id` int(11) DEFAULT NULL,
`receiver_id` int(11) DEFAULT NULL,
`amount` int(11) DEFAULT NULL,
`confirmed` int(11) DEFAULT NULL,
`expiry_date` varchar(20) DEFAULT NULL,
`complete` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `members`
--
CREATE TABLE IF NOT EXISTS `members` (
`idu` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`username` varchar(20) NOT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(100) NOT NULL,
`phonenumber` varchar(15) NOT NULL,
`bank_name` varchar(100) DEFAULT NULL,
`acc_name` varchar(100) DEFAULT NULL,
`acc_number` varchar(15) DEFAULT NULL,
`block` int(11) DEFAULT NULL,
`date` datetime DEFAULT NULL,
`admin_user` int(11) DEFAULT NULL,
PRIMARY KEY (`idu`),
UNIQUE KEY `username` (`username`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=264 ;
--
-- Dumping data for table `members`
--
INSERT INTO `members` (`idu`, `name`, `username`, `email`, `password`, `phonenumber`, `bank_name`, `acc_name`, `acc_number`, `block`, `date`, `admin_user`) VALUES
(1, 'nkem', 'sholake', 'nkemdirimarukwe@gmail.com', 'happygallow', '08124043226', 'Access Bank', 'Arukwe Chinelo Oluchi', '0055919911', 0, '2017-03-30 21:00:40', 1),
(3, 'Cindy', 'Cindyberry', 'minajcindy@yahoo.com', 'cindy123', '08095909224', 'Zenith bank', 'Cynthia', '2081698060', 0, '2017-03-30 21:01:33', 0),
(4, 'Ife clinecole', 'Ifybaby', 'ifecole@yahoo.com', 'ifeyinwa2015', '08033340468', 'Diamond bank', 'Ifeyinwa cline-cole', '0000868070', 0, '2017-03-30 21:03:13', 0),
(5, 'olawale stacey', 'Yecats', 'staceyola1@gmail.com', 'webmaster001', '08135630662', 'UBA Bank', 'Olawale Stacey', '2076441569', 0, '2017-03-30 21:03:32', 0),
(6, 'Olorunsola Isaac', 'Topccy', 'topeolorunsola@yahoo.com', 'Mcfish0001', '09038614417', 'First bank', 'Olorunsola Temitope Isaac', '2031652511', 0, '2017-03-30 21:03:42', 0),
(7, 'florence', 'floxy88', 'ayeuriah@gmail.com', 'otonye89', '08062568640', 'fidelity', 'florence anokwuru', '6171632469', 0, '2017-03-30 21:04:12', 0),
(8, 'magu', 'maguu', 'neloarukwe@gmail.com', 'nkem', '94837249389', 'Access Bank', 'Arukwe Chinelo Oluchi', '0055919911', 0, '2017-03-30 21:04:15', 0),
(9, 'tina', 'TInny', 'tinaofume9@gmail.com', 'demilola', '08134973268', 'fidelity bank', 'ofume tina', '6235565492', 0, '2017-03-30 21:04:51', 0),
(10, 'Onuwaje tuale', 'tfame3865', 'tualety49@gmail.com', '38656172', '08138656172', 'Access bank', 'Onuwaje tuale', '0689530340', 0, '2017-03-30 21:05:50', 0),
(11, 'Oladimeji', 'bollarcash', 'adaramoyeoladimeji@yahoo.com', 'tolu2010', '07034215360', '1St bank', 'Oladimeji adaramoye', '2031652360', 0, '2017-03-30 21:06:36', 0),
(12, 'BENJAMIN ONYEOCHA', 'daddyben', 'benjaminonyeocha@yahoo.com', 'heavenlove', '08068176738', 'Access', 'ONYEOCHA BENJAMIN', '0019977548', 0, '2017-03-30 21:07:09', 0),
(13, 'Abaniwo Rose', 'Realme', 'abaniworose@gmail.com', 'mafo12', '08069314998', 'GT Bank', 'Abaniwo rose mafo', '0150245084', 0, '2017-03-30 21:09:14', 0),
(14, 'Mina Allison', 'Juminaj', 'minajjumbo@gmail.com', 'titanic1', '07037349992', 'Diamond bank', 'Mina Allison', '0000543209', 0, '2017-03-30 21:10:01', 0),
(15, 'ada ibekwe', 'adaibekwe', 'ada_ibekwe@yahoo.com', 'miracle@', '08033805719', 'skye', 'ibekwe nkiru ada', '3010718926', 0, '2017-03-30 21:10:32', 0),
(16, 'Adeyinka Adeleke', 'ayinkuzee', 'ayinkuzee@yahoo.com', 'AYinka@83', '08034285215', 'GTB', 'Adeyinka Adeleke', '0013989768', 0, '2017-03-30 21:13:15', 0),
(17, 'Akande', 'sambio', 'akabiosam1@gmail.com', 'odunayomi', '08061138146', 'Gtb', 'Akande Biodun Samuel', '0125977503', 0, '2017-03-30 21:14:41', 0),
(18, 'Ibrahim Fuad', 'Rolayoib', 'rolayoib@yahoo.com', 'rolayo', '09069722077', 'GTB', 'Ibrahim fuad', '0171174316', 0, '2017-03-30 21:14:44', 0),
(19, 'Offor Franklin Chibuike', 'Blankis88', 'offorfranklinchibuike@gmail.com', 'amanda4me', '08065446781', 'First Bank', 'Offor Franklin Chibuike', '3099986253', 0, '2017-03-30 21:17:00', 0),
(20, 'Stanley', 'Stanleynuel', 'stanleychibuzor83@gmail.com', 'stanleychi', '08164608101', 'Eco', 'Odozie chibuzor Stanley', '2151295424', 0, '2017-03-30 21:17:49', 0),
(21, 'Jonathan', 'Lanjonath', 'Lanjonath@hotmail.com', 'mafloy', '08131506603', 'Zenith', 'Jonathan Idowu', '2081244986', 0, '2017-03-30 21:20:13', 0),
(22, 'olusola', 'solad5159', 'solad5159@yahoo.com', 'oladimeji6069', '08060695159', 'GTB', 'oladimeji olusola o', '0037046142', 0, '2017-03-30 21:20:16', 0),
(23, 'Hannah', 'ChallyHan', 'hannahdavidabaniwo@gmail.com', '20081995', '08138896434', 'Zenith Bank', 'Abaniwo Hannah Esuga', '2083593499', 0, '2017-03-30 21:21:10', 0),
(24, 'Boom', 'Boom', 'BBoom7037@gmail.com', 'bookbook', '09076540454', 'FirstBank', 'Nneka Emelieze', '3055310973', 0, '2017-03-30 21:21:15', 0),
(25, 'Doris', 'amanda2013', 'ujunwamelu@gmail.com', 'uju1990', '08034833498', 'diamond Bank', 'OLUA Doris uju', '0022876837', 0, '2017-03-30 21:21:53', 0),
(26, 'Frank val', 'frankyvalll', 'ifezimefrank3@gmail.com', 'fevi14', '08038784508', 'ZENITH', 'IFEZIME FRANKLIN', '2085661965', 0, '2017-03-30 21:22:00', 0),
(27, 'Akinoso Bolaji', 'zeemaraj', 'Akinosobolaji@gmail.com', 'tolulope51', '08062574216', 'Stanbic ibtc', 'Akinoso Bolaji', '0005512929', 0, '2017-03-30 21:22:16', 0),
(28, 'johnson', 'breeze', 'adeayobi@gmail.com', 'skillet', '08037641811', 'zenith', 'johnson akanbi', '2003345702', 0, '2017-03-30 21:22:42', 0),
(29, 'Ohanebo Monica', 'Mhornikhar', 'onyinyefrancisca14@gmail.com', '666426', '08137441333', 'Diamond bank', 'Ohanebo Monica Onyinyechukwu', '0030153054', 0, '2017-03-30 21:23:16', 0),
(30, 'Prekuna', 'Prekuna', 'kunaplanet@gmail.com', '40d765e4', '08039410786', 'Zenith bank', 'Caleb sagbe', '2176448417', 0, '2017-03-30 21:24:29', 0),
(31, 'Aisha aisha', 'aisha', 'ashizzy19@yahoo.com', 'adeigbe19', '09032645540', 'Gtbank', 'Adeigbe Aishat Omowunmi', '0137358114', 0, '2017-03-30 21:25:16', 0),
(32, 'Jay', 'cashthings', 'kingoscardon@gmail.com', 'thebossman%$', '07036710873', 'GTB', 'Oscar Uzoma', '0029935207', 0, '2017-03-30 21:25:33', 0),
(33, 'Ugheoke Itsoghena Mary', 'oshiomamo', 'itsoghenamary@yahoo.com', 'awesome', '08057398166', 'First Bank', 'Ugheoke Itsoghena Mary', '3024136504', 0, '2017-03-30 21:26:53', 0),
(34, 'Ajibade olushola', 'shola89', 'ajibadeolushola89@gmail.com', 'shollyman4973', '08064467672', 'fcmb', 'ajibade olushola', '2680065017', 0, '2017-03-30 21:27:54', 0),
(35, 'Akingbulu Adewumi', 'Adewumi', 'folasadeadewumi.aa@gmail.com', 'emerald96', '07017229466', 'Gt bank', 'Akingbulu Adewumi', '0126897130', 0, '2017-03-30 21:28:15', 0),
(36, 'Odofin David', 'Khulong', 'david.odofin@yahoo.com', 'Olasunkanmi@1', '08030728572', 'First bank', 'Odofin David', '3034805140', 0, '2017-03-30 21:28:42', 0),
(37, 'Jennifer ndukwe', 'hottie', 'jaykaybeu@yahoo.com', '080ndukwe', '08032723295', 'first bank', 'Jennifer ndukwe', '3016048011', 0, '2017-03-30 21:28:49', 0),
(38, 'loveth nwosu', 'loveth', 'lovethnwosu@ymail.com', 'ronnexy030589', '07062630017', 'diamond bank', 'loveth nwosu', '0004245783', 0, '2017-03-30 21:29:26', 0),
(39, 'George Ani', 'George', 'georgeosinachiani@gmail.com', 'chukwunyeremaka', '08142374909', 'First Bank', 'George Osinachi Ani', '3077602410', 0, '2017-03-30 21:32:11', 0),
(40, 'olori dee', 'olori', 'mintgreenventures@gmail.com', 'temitope', '08033685693', 'first bank plc', 'Damola-Ogunsola Olubunmi', '3089639208', 0, '2017-03-30 21:33:13', 0),
(41, 'Chidinma', 'Dinmadamsy', 'kingsjudith@gmail.com', 'kings1990', '08061277451', 'Diamond', 'Eze Chidinma Judith', '0019327111', 0, '2017-03-30 21:33:38', 0),
(42, 'Helen imaghodor', 'Lenosa', 'imaggs.ie@gmail.com', 'eghosa1998', '08033259561', 'UBA', 'helen Imaghodor', '2002716596', 0, '2017-03-30 21:34:42', 0),
(43, 'Charisma', 'Charismaagu', 'charismaagu@gmail.com', 'password', '09053056489', 'Gtbank', 'Charisma Agu', '0109089903', 0, '2017-03-30 21:34:56', 0),
(44, 'Bokolo uzoamaka', 'Clarryb', 'bokolouzoamaka@gmail.com', '98659', '08169175676', 'Diamond bank', 'Bokolo uzoamaka', '0086414877', 0, '2017-03-30 21:35:18', 0),
(45, 'Bosede', 'Bosman', 'bosedw@yahoo.com', 'tife7278', '07063341686', 'GTbank', 'Bosede Oyekunle', '0140457716', 0, '2017-03-30 21:35:49', 0),
(46, 'Nwankwo Ebenezar', 'BenTej', 'donebey@gmail.com', 'ebeny101', '08134015098', 'Gtbank', 'nwankwo ebenezar', '0233280599', 0, '2017-03-30 21:37:17', 0),
(47, 'Patience', 'Elijah', 'patteeglamour@gmail.com', 'blissmi', '08066888984', 'UBA', 'Patience Elijah', '2043839812', 0, '2017-03-30 21:37:39', 0),
(48, 'Ayomiposi', 'Ajicom', 'aribilolaayomiposi@gmail.com', 'Sogbeminija01', '08032425145', 'GT bank', 'ARIBILOLA Ayomiposi', '0049623799', 0, '2017-03-30 21:40:57', 0),
(49, 'saint', 'saint', 'opeyemidairo0007@gmail.com', 'micheal', '07030536090', 'Access bank', 'Dairo Opeyemi', '0693773058', 0, '2017-03-30 21:42:45', 0),
(50, 'Lekan', 'Geo-Seedorph', 'Lekkyworld@gmail.com', 'Olami4891', '08038519466', 'First Bank', 'Ogundare Saheed Tunji', '3048347771', 0, '2017-03-30 21:44:51', 0),
(52, 'Blessing banro', 'Blessyn', 'blessingbanro@yahoo.com', 'adebunmi1', '08031849978', 'Fcmb', 'Banro blessing', '2286592012', 0, '2017-03-30 21:45:45', 0),
(53, 'linda', 'lindie', 'lindachukwu@yahoo.com', 'sheila61', '07038254003', 'first bank', 'Linda chukwu', '3086003141', 0, '2017-03-30 21:46:02', 0),
(54, 'Ojo', 'Ayoola11', 'ojoayoola1130@gmail.com', 'olorun1130', '08163466962', 'Gtb', 'Ojo Ayoola', '0036241029', 0, '2017-03-30 21:50:12', 0),
(55, 'Segun Tyson', 'Toyinseg', 'ayodele.toyin1@gmail.com', 'joseph12', '08032238808', 'Guaranty Trust Bank plc', 'Ayodele Joseph Segun', '0126754200', 0, '2017-03-30 21:51:05', 0),
(56, 'Goke Tobi', 'goketobi', 'goketobi@gmail.com', 'oluwatobi/88', '08106701252', 'Access Bank', 'Olagoke Oluwatobi', '0689665387', 0, '2017-03-30 21:51:30', 0),
(57, 'Philemon', 'Pamipolo', 'philemondavid604@yahoo.com', 'sairuwa1', '08065645360', 'Zenith bank', 'Sairuwa Philemon', '2087048863', 0, '2017-03-30 21:52:58', 0),
(58, 'Nwachukwu Stanley', 'Stankonia', 'stankonia58@gmail.com', 'obumneke', '07033770647', 'FCMB', 'Nwachukwu Stanley', '3738762018', 0, '2017-03-30 21:53:55', 0),
(59, 'Abdulsalam ibn abdulsalam', 'Sirlamkhan', 'sirlamkhan@gmail.com', 'babatunde123', '08164900490', 'Gtbank', 'Abdulsalam ibn abdulsalam', '0140367978', 0, '2017-03-30 21:54:36', 0),
(60, 'Hannah Ikuenobe', 'Onose2017', 'ihannah82@yahoo.com', 'Azuka2017', '08067908718', 'Zenith Bank', 'Hannah Ikuenobe', '2088761615', 0, '2017-03-30 21:54:39', 0),
(61, 'Fatoyinbo', 'Sunnyx90', 'sunnyx90@yahoo.com', 'sunday4real', '07031821795', 'Gtb', 'Fatoyinbo Gbenga', '0152922651', 0, '2017-03-30 21:55:03', 0),
(62, 'Samson falade', 'Psammy', 'samade4luv@yahoo.com', 'babatunde', '08060906100', 'Firstbank', 'Samson falade', '3023527839', 0, '2017-03-30 21:55:03', 0),
(63, 'Babatunde', 'KingDavid', 'tunde.olambo@gmail.com', 'john3162017', '08030483869', 'GTbank', 'Olambo Babatunde', '0011268353', 0, '2017-03-30 21:55:19', 0),
(64, 'Choice', 'ChoiceTeejay', 'choiceomokiniovo@gmail.com', 'ouchboss', '08135210271', 'Unity', 'Choice', '0026557382', 0, '2017-03-30 21:55:47', 0),
(65, 'Edidiong James', 'Eddyjames', 'Edijames11@yahoo.com', '19999999', '08179127278', 'Diamond bank', 'James Edidiong', '0029652670', 0, '2017-03-30 21:56:33', 0),
(66, 'Chris', 'kristo', 'oyakhirechris1@gmail.com', 'master', '08124368086', 'Diamond bank', 'Chris Itavbusiogben', '0085656641', 0, '2017-03-30 21:57:30', 0),
(67, 'Ogu Hope', 'Hope1', 'Hopeogu90@gmail.com', 'ogu12345', '08062590412', 'First bank', 'Ogu Hope A', '3025887580', 0, '2017-03-30 22:01:27', 0),
(68, 'Adebowale femi', 'steamy7', 'kausedavid@gmail.com', 'danjuman', '08080806940', 'Accessbank', 'Adebowale femi', '0037116129', 0, '2017-03-30 22:03:29', 0),
(69, 'Ugochukwu Aniegboka', 'Emma_047', 'aniegbokaugochukwu@gmail.com', 'hydrocarbon', '08144536627', 'Zenith Bank', 'Aniegboka ugochukwu', '2082154602', 0, '2017-03-30 22:04:11', 0),
(70, 'Lite', 'ThankGod', 'orjithankgod25@gmail.com', 'power12345', '08060539289', 'Diamond bank', 'Orji o', '0055256208', 0, '2017-03-30 22:04:49', 0),
(71, 'Isiono Sada', 'Elita', 'isionosada78@gmail.com', 'mimi@40', '08089344796', 'Gtb', 'Isiono sada', '0009999258', 0, '2017-03-30 22:05:12', 0),
(72, 'Nkechi', 'Anyanwu', 'nkechimatara@gmail.com', 'lilian', '08062177531', 'Gtb', 'Nkechi Anyanwu', '0117694205', 0, '2017-03-30 22:06:46', 0),
(73, 'samson Ediogyawere', 'sam333', 'sam33@gmail.com', '08052056099', '08065678342', 'first bank', 'samson Ediogyawere', '0108566789', 0, '2017-03-30 22:08:32', 0),
(74, 'Amina', 'Amina', 'aminat@gmail.com', 'amina070', '09076220275', 'Gtbank', 'Husseini zuwaira', '0115588955', 0, '2017-03-30 22:11:07', 0),
(75, 'Lucky Euna', 'Eunex', 'eunex250@gmail.com', 'secouc', '08038679636', 'FCMB', 'Lucky C Euna', '2470384010', 0, '2017-03-30 22:13:20', 0),
(76, 'Lola', 'lolyloly', 'loly2g@yahoo.com', 'lolypop', '08029315076', 'Access', 'Owolabi lolade', '0004520784', 0, '2017-03-30 22:17:09', 0),
(77, 'Ozang Stephen', 'stevoo11', 'sirraymond2@gmail.com', 'stevoo11', '08062250869', 'Skye Bank', 'Ozang Stephen', '3031020415', 0, '2017-03-30 22:18:44', 0),
(78, 'Ifejokwu', 'Kachy', 'kachy_2@yahoo.com', '08067138685', '08067138685', 'Eco bank', 'Ifejokwu Onyekachi', '4371068518', 0, '2017-03-30 22:29:08', 0),
(79, 'Nze', 'Raphael', 'nzeraph@gmail.com', '123456', '07063009987', 'first bank', 'Nzekwe onyeka', '3089536912', 0, '2017-03-30 22:29:35', 0),
(80, 'Gbebikan racheal', 'rachygbebs', 'rachypels50@gmail.com', 'anike.96', '08109672511', 'Gtbank', 'Gbebikan Rachael', '0127066733', 0, '2017-03-30 22:31:48', 0),
(81, 'ken Isi', 'keb16', 'kenebhomielen@gmail.com', '08064679200', '08099144443', 'GTB', 'kenneth Ebhomielen', '0107588639', 0, '2017-03-30 22:34:22', 0),
(82, 'Keji tayo', 'kgytayo', 'keshy4life@yahoo.com', 'investment17', '08028152434', 'GTB', 'Keji tayo', '0016921668', 0, '2017-03-30 22:34:50', 0),
(83, 'Abiodun Ganiyat', 'Timilehinab', 'timmy4u@live.com', 'thimmie', '07067342718', 'Ecobank', 'Abiodun Ganiyat', '4572106518', 0, '2017-03-30 22:35:48', 0),
(84, 'Akinbodewa emmanuel o', 'tossy1212', 'tossyemmanuel@gmail.com', 'tossycatty', '08030497624', 'First bank', 'Akinbodewa Emmanuel o', '3030495734', 0, '2017-03-30 22:39:31', 0),
(85, 'Shola Oyeniyi', 'shola', 'sholaoyeniyi@yahoo.com', 'kolade', '08073801732', 'Access Bank', 'Oyeniyi Olushola M', '0046263858', 0, '2017-03-30 22:40:26', 0),
(86, 'Chizoba Okechukwu', 'sunshyne', 'chizysunshyne@gmail.com', 'prechizy', '08137587284', 'first bank', 'Okechukwu Chizoba', '3033832734', 0, '2017-03-30 22:41:13', 0),
(87, 'Mma Achugwo', 'Moraz', 'morazulike2000@yahoo.com', 'morazmoraz', '08034817860', 'Zenith bank', 'Mmachukwu Achugwo', '2020130893', 0, '2017-03-30 22:43:40', 0),
(88, 'Yomi', 'ababalola', 'abayomi4u@gmail.com', 'Mine4eva!', '08034254246', 'GTB', 'Abayomi Samuel Babalola', '0122459806', 0, '2017-03-30 22:44:46', 0),
(89, 'Ugochukwu', 'Nedu', 'Emma_047@yahoo.com', 'hydrocarbon', '08144526627', 'Zenith Bank', 'Aniegboka ugochukwu', '2082154602', 0, '2017-03-30 22:47:02', 0),
(90, 'Ukachi Jane', 'Zinny25', 'godfav6@gmail.com', '909090', '08155132568', 'Access Bank', 'Ukachi Jane', '0054725481', 0, '2017-03-30 22:49:12', 0),
(91, 'Basuo otonye', 'BOSSMANT', 'oti_basuo@yahoo.com', 'otonye89', '08063842424', 'Access Bank', 'Basuo Collins otonye', '0019713418', 0, '2017-03-30 22:52:03', 0),
(92, 'Ruth', 'Pearlryl', 'pearlryl@gmail.com', '26102610', '08062424133', 'First Bank', 'Ruth James', '3085478281', 0, '2017-03-30 22:54:48', 0),
(93, 'Tetra Zee', 'tetrazee', 'Funmiada1@gmail.com', 'bracelet', '08090150406', 'Diamond Bank', 'Elsie Aka', '0004012864', 0, '2017-03-30 22:55:37', 0),
(94, 'Skyrider', 'Skyrider', 'donhui@zoho.com', 'batuta123', '08033333168', 'First bank', 'Ikenna', '3102993009', 0, '2017-03-30 22:55:43', 0),
(95, 'Eboselume', 'Eboski', 'eby.fidelis@yahoo.com', 'forever2017', '07033430707', 'Zenith bank', 'Oigiagbe Eboselume', '2006758349', 0, '2017-03-30 23:10:14', 0),
(96, 'Franca', 'francip', 'francpalmero@gmail.com', 'trident12', '07032171618', 'diamondbank', 'FranciscaPalmer', '0029875011', 0, '2017-03-30 23:11:28', 0),
(97, 'Ogundele Damilola', 'Aquarium', 'dimpleddara15@gmail.com', 'dara2017', '08148759151', 'Access', 'Ogundele Damilola', '0034865574', 0, '2017-03-30 23:13:11', 0),
(98, 'MADU OKEHI', 'MAZINO', 'maduokehi@gmail.com', 'zimkpa4u', '08031966404', 'ACCESS', 'OKEHI MADUZIMKPA', '0017124520', 0, '2017-03-30 23:14:01', 0),
(99, 'Michael', 'Teguss', 'oteguss@gmail.com', 'praises', '07066559494', 'Diamond Bank', 'Tega Michael Igbinedion', '0029890591', 0, '2017-03-30 23:16:48', 0),
(100, 'Olisa', 'Olisa123', 'quizzy_83@hotmail.com', 'chibusky', '08025957443', 'Diamond bank', 'Okechukwu okwuolisa chibuzo', '0069701370', 0, '2017-03-30 23:23:07', 0),
(101, 'Nnennaya', 'Nnennaya', 'eboselumeoigiagbe93@gmail.com', 'burger', '08112708685', 'UBA', 'Mba Nnennaya', '2050780154', 0, '2017-03-30 23:27:45', 0),
(102, 'Janta', 'Janta123', 'wasbusted@yahoo.com', 'chibusky', '07054184178', 'Diamond bank', 'Okechukwu okwuolisa chibuzo', '0069701370', 0, '2017-03-30 23:27:45', 0),
(103, 'Ajala Desola', 'dezzy', 'desolaakinbolu@yahoo.com', 'lovelyday', '08020591961', 'Fcmb', 'Ajala Desola', '0564245016', 0, '2017-03-30 23:29:27', 0),
(104, 'Awofeso Kudirat', 'Kudirat', 'kouldstylist@yahoo.com', 'thimmie', '07067342718', 'Gtb', 'Awofeso Kudirat', '0235058671', 0, '2017-03-30 23:30:14', 0),
(105, 'Tgot', 'Tgot', 'tgot1960@gmail.com', 'bookbook', '09076540454', 'FirstBank', 'Nneka Emelieze', '3055310973', 0, '2017-03-30 23:31:41', 0),
(106, 'Ethel', 'Xclusivee', 'd.xcluzzy16@gmail.com', 'XCLUSIVEE1', '08167641499', 'Access Bank', 'Agba Ethel Amarachi', '0058849972', 0, '2017-03-30 23:31:41', 0),
(107, 'Afees Olufemi Kushimo', 'phemmykush', 'phemmykush@gmail.com', 'obstacle', '08038549879', 'Guaranty Trust Bank PLC', 'Afees Olufemi Kushimo', '0026814848', 0, '2017-03-30 23:34:08', 0),
(108, 'Rauf Ganiu', 'tyoung', 'fatykikeduservices@gmail.com', 'education', '08030457673', 'ZENITH BANK', 'Rauf Ganiu', '2005017030', 0, '2017-03-30 23:36:37', 0),
(109, 'Ezeigbo frank chisom', 'kingfrank', 'ezeigbofrank02@gmail.com', 'Asadon12', '08143553372', 'firstbank', 'Ezeigbo frank chisom', '3049753504', 0, '2017-03-30 23:41:49', 0),
(110, 'Obum', 'Obum', 'stone2ken@gmail.com', 'chibusky', '08025957443', 'Fidelity', 'Carousel intl', '5600179092', 0, '2017-03-30 23:42:09', 0),
(111, 'Stone', 'Stone', 'joleribe@yahoo.com', 'chibusky', '08025957443', 'Fidelity', 'Carousel intl', '5600179092', 0, '2017-03-30 23:45:06', 0),
(112, 'Titilayo', 'Teety', 'odukoyatitilayo11@gmail.com', '123456', '08035273157', 'First bank', 'Titilayo Odukoya', '3039809435', 0, '2017-03-30 23:49:07', 0),
(113, 'Muna Achugwo', 'Obeleagu', 'munaachugwo1111@gmail.com', 'morazmoraz', '08034817860', 'Zenith bank', 'Munachimso Achugwo', '2050411171', 0, '2017-03-30 23:51:58', 0),
(114, 'Remilekun Amos', 'Remi007', 'remilekunamos2050@gmail.com', 'remi007', '08053118537', 'First bank', 'Remilekun Amos Beatrice', '3017873726', 0, '2017-03-30 23:59:18', 0),
(115, 'Olaide soda', 'Olaheedey', 'olaheedeymafe@yahoo.com', 'lasvegas06', '08099441610', 'Uba', 'Olaide soda', '2019443940', 0, '2017-03-31 00:03:43', 0),
(116, 'Susan Maggs', 'Susan', 'mailsuzane@gmail.com', 'omojohnson', '08117797517', 'Gtb', 'Susan Johnson', '0121710955', 0, '2017-03-31 00:08:54', 0),
(117, 'Olorunsola Tosin', 'Olorunsketch', 'olorunsketch@gmail.com', 'rimolla123', '07084255556', 'Gtb', 'Olorunsola Tosin Emmanuel', '0045519195', 0, '2017-03-31 00:10:50', 0),
(118, 'Adekunle', 'koonlay', 'koonlayoshodi@gmail.com', 'manmee', '08099441234', 'Diamond Bank', 'Adekunle Oshodi', '0016030573', 0, '2017-03-31 00:18:34', 0),
(119, 'Efe Odiri', 'effe', 'odiriendurance@gmail.com', 'rimolla123', '08134379528', 'Zenith Bank', 'Efe Odiri', '2100092675', 0, '2017-03-31 00:25:19', 0),
(120, 'Maximus Njoku', 'MajorMax', 'maximus.njoku@yahoo.com', 'smanhadley', '07038371182', 'Fidelity', 'Njoku Maximus U.', '6171469724', 0, '2017-03-31 00:38:55', 0),
(121, 'Abdul Jubril', 'Lakun', 'habdullahjibreal@gmail.com', 'olakunle', '09030576903', 'First bank', 'Abdullah jubril', '3110860131', 0, '2017-03-31 00:42:04', 0),
(122, 'Asadu James', 'James82', 'funkyjay12@gmail.com', 'james82', '07032042882', 'UBA', 'Asadu James Obiora', '2044208648', 0, '2017-03-31 00:48:21', 0),
(123, 'Syntyche Esenowo', 'Syntech01', 'esenowosyntyche@gmail.com', 'syntech01', '08135371064', 'GTB', 'Esenowo Syntyche', '0142138051', 0, '2017-03-31 00:54:28', 0),
(124, 'Bblizy', 'bblizy43', 'bblizy43@gmail.com', 'bblizy43', '08164029879', 'UBA', 'Okoror', '2063846379', 0, '2017-03-31 00:56:47', 0),
(125, 'henry cyprian c', 'hendox', 'chukwuka31@yahoo.com', 'henro26', '08130692991', 'first bank of nigeria', 'henry chukwuka', '3020954854', 0, '2017-03-31 00:57:21', 0),
(126, 'Rolly Swiss', 'Rollyswiss', 'Princessgoldie03@gmail.com', 'Goldie10', '2349036626375', 'Skyebank', 'OMOEDEH RICHWELL', '3019451857', 0, '2017-03-31 01:01:56', 0),
(127, 'Stephanie', 'treasure', 'joypopins@yahoo.com', 'hub55', '09029649435', 'access', 'Okedinachi stephanie joy', '0006712097', 0, '2017-03-31 01:11:59', 0),
(128, 'gerald cy', 'gerald12', 'geraldcyprian@gmail.com', 'HENRO26', '08069208966', 'GTB', 'GERALD CHUKWUKA', '0109512539', 0, '2017-03-31 01:13:10', 0),
(129, 'Cordelia Nwadi', 'Nwadi001', 'cordeliannjoku@gmail.com', 'nwadi001', '08087702665', 'Skye bank', 'Cordelia Nwadi Njoku', '3016583414', 0, '2017-03-31 01:17:29', 0),
(130, 'Bibian Nwankwo', 'keshmum', 'keshmum76@yahoo.com', '39489970', '07039489970', 'Diamond bank', 'Bibian Nwankwo', '0021086929', 0, '2017-03-31 01:19:49', 0),
(131, 'Elina onos', 'Elina', 'elina.onomuophu@gmail.com', 'elina09', '08099449010', 'First bank', 'Elina onomuophu', '3066279137', 0, '2017-03-31 01:23:35', 0),
(132, 'EMEKA CHUKWUKA', 'Emmyboy', 'chukaemeka@gmail.com', 'henro26', '08186999767', 'fidelity bank', 'chukwuka henry', '6171992714', 0, '2017-03-31 01:30:17', 0),
(133, 'Akinleye odunola', 'Olamii', 'bettychard15@yahoo.com', 'dhix96', '08104215018', 'Wema bank', 'Akinleye odunola', '0228322502', 0, '2017-03-31 01:41:05', 0),
(134, 'Vivian Elekwa', 'Ninaviv91', 'vivianelekwa@gmail.com', 'nnenna91', '08184809264', 'Diamond bank', 'Elekwa Vivian', '0018282053', 0, '2017-03-31 01:45:46', 0),
(135, 'precious onu', 'precie40', 'nkechif1986@gmail.com', '2012jeffrey', '08182245733', 'fcmb', 'ou precious E', '3077419013', 0, '2017-03-31 01:45:57', 0),
(136, 'gerald chukwuka', 'gboy', 'geraldchukwuka@yahoo.com', 'henro26', '09055044344', 'stanbic IBTC', 'GERALD CHUKWUKA', '0011785209', 0, '2017-03-31 01:50:19', 0),
(138, 'olapade Samuel', 'samest', 'olapadesam00@yahoo.com', 'iamawinner', '08067612109', 'access bank', 'olapade Samuel', '0051854803', 0, '2017-03-31 01:58:37', 0),
(139, 'Idachaba Friday', 'Pato', 'idachabafriday02@yahoo.com', 'rimolla123', '08062321065', 'GTB', 'Idachaba Friday', '0159974398', 0, '2017-03-31 02:00:52', 0),
(140, 'Ikebunwa Nchekwube', 'Nikebunwa', 'Nikeodogwu@gmail.com', '08069507152', '08069507152', 'Fidelity bank', 'Ikebunwa Nchekwube', '6170898084', 0, '2017-03-31 02:10:28', 0),
(141, 'Amusan Michael', 'amusanmikel', 'amusanmikel@gmail.com', 'mayowa', '08032122586', 'Gtb', 'Amusan michael', '0126452740', 0, '2017-03-31 02:23:16', 0),
(142, 'Ekere', 'Waris', 'warisekere@gmail.com', 'goodluck', '08063067297', 'Diamond bank', 'Ekere Francis', '0022671537', 0, '2017-03-31 03:26:11', 0),
(143, 'obiora anthonia', 'toniaj', 'menajiv@gmail.com', 'menajiv', '08036651806', 'fidelity', 'obiora effe', '5070120507', 0, '2017-03-31 03:57:43', 0),
(144, 'Oluwatoyin', 'Lorioba', 'adetutu2603@gmail.com', 'treasure', '07035041063', 'StanbicIBTC Bank', 'Oluwatoyin Adetutu Akapo', '0009628369', 0, '2017-03-31 04:04:22', 0),
(145, 'Favoured', 'Florish', 'Charityezeigbo123@gmail.com', 'holy2017', '08186475051', 'Firstbank', 'Firstbank', '3058542793', 0, '2017-03-31 04:08:25', 0),
(146, 'Chioma', 'mallycee', 'mallyc09@gmail.com', 'philewlin1992', '08062441223', 'Diamond Bank', 'Chioma Okechukwu', '0087177854', 0, '2017-03-31 04:14:18', 0),
(147, 'Joyous', 'Cheerful', 'Ezeigbo56@gmail.com', 'mark1990', '08186475051', 'Firstbank', 'Ezeigbo Charity', '3058542793', 0, '2017-03-31 04:18:18', 0),
(148, 'Tomoye Collins', 'Tomcollins', 'send2tomcollins@gmail.com', 'ayebanoa', '08064985196', 'Access Bank', 'Ayolagha CollinsTomoye', '0019713425', 0, '2017-03-31 04:18:40', 0),
(149, 'Chalse', 'Favoured', 'Charityezeigbo@gmail.com', 'Loveu2', '08186475051', 'Firstbank', 'Ezeigbo Charity', '3058542793', 0, '2017-03-31 04:24:11', 0),
(150, 'Olawale Yusuf', 'emeritus', 'fountainptserv@gmail.com', 'lagoscity', '08062389651', 'Diamond Bank', 'Yusuf Olawale F', '0002725182', 0, '2017-03-31 04:41:21', 0),
(151, 'Muna Egu', 'Munsman', 'egu.muna@gmail.com', 'Fatinrat1', '07062024442', 'Guaranty Trust Bank', 'Egu Muna Maurice', '0039732977', 0, '2017-03-31 04:50:50', 0),
(152, 'osas', 'osas', 'dohuber1@yahoo.com', '456789', '08119292899', 'zenith bank', 'osakpolor omorogbe', '2080305785', 0, '2017-03-31 04:52:58', 0),
(153, 'Olasimbo', 'Fredasam', 'simbebe2001@yahoo.com', 'kolorogun', '08023423897', 'Gtbank', 'Olasimbo Oshagbami', '0004458851', 0, '2017-03-31 05:01:28', 0),
(154, 'John Ani', 'bigjohn', 'ajmovies2016@gmail.com', '08036068665', '08036068665', 'Diamond bank', 'Ani john', '0034692199', 0, '2017-03-31 05:23:47', 0),
(155, 'Anaba Solomon chinedu', 'solomonjoe', 'solomondewise009@yahoo.com', 'belong009', '08080000296', 'diamond bank', 'Anaba Solomon chinedu', '0034770761', 0, '2017-03-31 05:25:06', 0),
(156, 'John Abah', 'Johnabah', 'Bigjformular@yahoo.com', '08036068665', '09079223485', 'Zenith bank', 'John Ani', '2084211741', 0, '2017-03-31 05:30:05', 0),
(157, 'abiodun', 'gbadu2k', 'gbadu2k@yahoo.com', 'opemywifee', '08029112797', 'gtbank', 'gbadebo abiodun', '0009708908', 0, '2017-03-31 05:32:20', 0),
(158, 'Oduwaye Mary', 'Goldenbimsy', 'bwealth6@gmail.com', 'olawalemi', '08185334164', 'Access Bank', 'Oduwaye Mary', '0035872333', 0, '2017-03-31 05:33:17', 0),
(159, 'Esther Akpan', 'Wemablooms', 'kowemaprofile@yahoo.co.uk', '@&bloomyloo1', '08064956690', 'Access', 'Esther Akpan', '0690154289', 0, '2017-03-31 05:56:37', 0),
(160, 'Fola', 'moshow97', 'moshow97@yahoo.com', 'tomilosho', '09092132498', 'Fcmb', 'Afolabi moshood Abiola', '0586309017', 0, '2017-03-31 05:57:36', 0),
(161, 'Chukwudi endy', 'endyoflife', 'enddyofliffe@yahoo.com', 'ikenna1', '08065776084', 'Zenith', 'Chukwudi endy Ikenna', '2110657880', 0, '2017-03-31 05:59:09', 0),
(162, 'Amaka bassey', 'Amaka', 'casikeche@yahoo.com', 'xora2011', '08063928853', 'GTBank', 'Bassey Amaka', '0038347293', 0, '2017-03-31 06:00:33', 0),
(163, 'Oriasotie Oseghale', 'princefavian', 'oriasotieoseghale@gmail.com', 'innocent1993', '08137339300', 'first bank', 'Oriasotie Oseghale', '3085492290', 0, '2017-03-31 06:03:05', 0),
(164, 'Aidee mbre', 'Aidee', 'idongesitmbre@gmail.com', 'imembre', '08055121611', 'access bank', 'Idongesit mbre', '0045895005', 0, '2017-03-31 06:06:24', 0),
(165, 'Boma Jumbo', 'Jubom', 'bomajuliusjumbo@gmail.com', 'titanic1', '08124196426', 'First Bank', 'Boma Jumbo', '3022204649', 0, '2017-03-31 06:11:40', 0),
(166, 'ARTHUR RICHARD', 'Arthur2k5', 'Arthur2k5@gmail.com', 'onyekamother2020', '07030616719', 'DIAMOND BANK', 'ARTHUR RICHARD', '0077806223', 0, '2017-03-31 06:11:49', 0),
(167, 'Jane Ononyume', 'Awesome007', 'janeomayume@gmail.com', 'awesome', '08130664503', 'First Bank', 'ONONYUME OMAMOREDE JANE', '3048995299', 0, '2017-03-31 06:13:49', 0),
(168, 'Sharon Agu', 'Asharon', 'agusharon22@gmail.com', 'wonderful', '07062679262', 'Access bank', 'Agu Sharon', '0697368928', 0, '2017-03-31 06:20:03', 0),
(169, 'Temitope Opeyemi', 'Temmy', 'danieljomiloju@yahoo.com', 'King1011', '08172079044', 'Diamond Bank', 'Temitope Opeyemi', '0021110505', 0, '2017-03-31 06:26:12', 0),
(170, 'Adeola Adeniji', 'adeolas', 'adexy4u2nv@yahoo.com', 'adeniji', '08137990252', 'GTBank', 'Adeola Adeniji', '0114122512', 0, '2017-03-31 06:26:30', 0),
(171, 'Femi', 'Infinity', 'pheminiyi@gmail.com', 'kayode', '07031224290', 'Zenith bank', 'OYENIYI OLUWAFEMI', '2002255723', 0, '2017-03-31 06:31:55', 0),
(172, 'Chidimma', 'Luvlicindi', 'luvlicindi@gmail.com', 'nneamaka89', '08068841916', 'UBA', 'Okeke chidimma', '2046741385', 0, '2017-03-31 06:33:49', 0),
(173, 'Okonkwo maureen', 'talktomomo', 'talktomomo@yahoo.co.uk', 'maugirl1629', '08037758083', 'Diamond bank', 'Okonkwo maureen chinenye', '0071541751', 0, '2017-03-31 06:34:10', 0),
(174, 'wumi', 'sleek', 'wumit10@gmail.com', 'skillet', '08033682323', 'StanbicIbtc', 'Wumi Oyeniyi', '9304106796', 0, '2017-03-31 06:34:17', 0),
(175, 'Ayebaifie', 'ayecrown', 'ayebaifie22@gmail.com', 'ayeba001', '08062762110', 'Zenith bank', 'Ayebaifie obed', '2080801593', 0, '2017-03-31 06:37:31', 0),
(176, 'obi onyinye', 'onyi6060', 'onyinyeobi24@gmail.com', 'jehovaGod@123', '07063551063', 'uba', 'obi onyinye', '2062996435', 0, '2017-03-31 06:38:17', 0),
(177, 'Joseph Njuare', 'Jonjuare', 'Josephbisong@gmail.com', 'joseph3313', '08054564499', 'Diamond Bank', 'Joseph Bisong', '0049587165', 0, '2017-03-31 06:39:00', 0),
(178, 'Esther Abraham Adesola', 'Esther_', 'abrahamhaddassah@yahoo.com', 'password', '08082879650', 'Gtbank', 'Abraham Esther Adesola', '0111822213', 0, '2017-03-31 06:39:14', 0),
(179, 'onuorah shedrach', 'shedluv', 'motionshedon4life@yahoo.com', 'love.com', '08100161703', 'FCMB', 'onuorah shedrach', '4153260017', 0, '2017-03-31 06:40:01', 0),
(180, 'Ime Itabina', 'Ime3', 'imeitabina09@gmail.com', 'Idongesit', '08060819940', 'Zenith', 'Itabina Ime', '2087184330', 0, '2017-03-31 06:40:18', 0),
(181, 'Ukaoha Victoria', 'Babyjasparo', 'babyjasparo@gmail.com', 'adanta16', '08064156973', 'access bank', 'Ukaoha Victoria', '0047520192', 0, '2017-03-31 06:43:48', 0),
(182, 'Jayeola', 'Jayeola', 'jayeesho@gmail.com', 'temiesho1', '08188581240', 'Diamond Bank', 'Temitope Akande', '0011903922', 0, '2017-03-31 06:44:21', 0),
(183, 'David', 'Buraimoh', 'desmonddemix4u@yahoo.com', 'Password.009', '08028076163', 'Access bank', 'Buraimoh David', '0034726549', 0, '2017-03-31 06:44:57', 0),
(184, 'Anthony onyenakie', 'Anthonyo', 'onyenakieanthony@gmail.com', 'bracelet', '08166278819', 'Diamond bank', 'Akawushim kelechi green', '0074917683', 0, '2017-03-31 06:47:18', 0),
(185, 'Kesiena emefeke', 'kessya1', 'kessya1@yahoo.com', 'ga0891', '08053199064', 'Gtb', 'Kesiena emefeke', '0226815078', 0, '2017-03-31 06:48:30', 0),
(186, 'lian', 'lian79', 'lianintegrated@gmail.com', '08064679200', '08052777896', 'zenith bank', 'lian integrated service', '1013151365', 0, '2017-03-31 06:49:33', 0),
(187, 'Ijeoma', 'mayon', 'luchiangel@yahoo.com', 'keren123', '09067387888', 'Zenith Bank', 'Ijeoma Akalugwu', '2003054844', 0, '2017-03-31 06:55:06', 0),
(188, 'Sidney', 'siduz', 'siduzy@gmail.com', 'maximusnjoku', '08061371361', 'GTB', 'Uzor Sidney C.', '0041763952', 0, '2017-03-31 06:55:36', 0),
(189, 'Ngwubike Onyinye', 'Onyinye', 'luvlypeace4don@gmail.com', 'Onyinye', '08036064471', 'zenith', 'Ngwubike Onyinye Peace', '2120523098', 0, '2017-03-31 06:56:59', 0),
(190, 'Freda', 'Phreda', 'fredafredrick@ymail.com', 'fredevelyn1.', '08135844750', 'Zenith Bank', 'Dibie Freda', '2009658653', 0, '2017-03-31 06:57:05', 0),
(191, 'Esther Abraham Adesola', 'Grace_', 'muumywunmi12@gmail.com', 'password', '08032780206', 'Diamond bank', 'Abraham Esther Adesola', '0074882347', 0, '2017-03-31 06:58:02', 0),
(192, 'Iloegbunam Mike', 'mikechi', 'iloegbunamchinonsomike@gmail.com', 'progress', '08163496928', 'UBA', 'Iloegbunam Mike', '2062299260', 0, '2017-03-31 07:00:01', 0),
(193, 'Iloegbunam Agnes', 'agychi', 'agneschikwado@yahoo.com', 'benitaanita', '07080224785', 'UBA', 'Iloegbunam Agnes', '2034753251', 0, '2017-03-31 07:03:18', 0),
(194, 'Salisu', 'Salami', 'kingwizwayne@gmail.com', '52568968', '09054467911', 'Eco bank', 'Salami Salisu', '2382132381', 0, '2017-03-31 07:04:48', 0),
(195, 'Uju Chiama', 'wealth', 'ujuchiama@gmail.com', 'ujuchiama', '08122238883', 'Diamond bank', 'Uju chiama', '0027776080', 0, '2017-03-31 07:06:09', 0),
(196, 'Salihu Muhammed Salami', 'Muhammed', 'salihumuhammed71@gmail.com', '52568968', '07086692171', 'Gtbank', 'Salihu Muhammed salami', '0179009353', 0, '2017-03-31 07:07:49', 0),
(197, 'Ahmed Lukman', 'Lukman', 'lukahmed@yahoo.com', 'omeiza', '08108811598', 'Access Bank', 'Ahmed Lukman Omeiza', '0700436989', 0, '2017-03-31 07:10:37', 0),
(198, 'Clifford', 'legend27', 'peaz2004@gmail.com', 'pere070485', '08034356079', 'Gtbank', 'Clifford Ekinabhari', '0042339381', 0, '2017-03-31 07:11:58', 0),
(199, 'Modupelola', 'Oyekunle', 'boseoye3@gmail.com', 'tife7278', '08171884043', 'Diamond Bank', 'Modupelola Oyekunle', '0073911983', 0, '2017-03-31 07:16:47', 0),
(200, 'Jane Abeng', 'Djane', 'gabrieljane70@gmail.com', 'jane123', '08032353125', 'Fidelity', 'Abeng jane', '6233445305', 0, '2017-03-31 07:17:50', 0),
(201, 'Ife', 'ifelarry', 'ifelarry@gmail.com', 'ospiro', '09057152775', 'UBA', 'Ife Oluwatuyi', '2091584711', 0, '2017-03-31 07:19:33', 0),
(202, 'obih ifeanyi', 'maxihyfr', 'maxihyfr123@gmail.com', 'suckerpunch', '08063726386', 'Zenith Bank', 'obih ifeanyi', '2200002101', 0, '2017-03-31 07:23:37', 0),
(203, 'Kate john', 'Gordon1', 'queentreasure797@gmail.com', '777777', '08066889729', 'first bank', 'Kate john', '3077624975', 0, '2017-03-31 07:23:38', 0),
(204, 'Morgan uwaya', 'Morganvm', 'vicmee2000@gmail.com', 'promise123', '08131801200', 'Diamond Bank', 'Uwaya Morgan', '0007985082', 0, '2017-03-31 07:24:36', 0),
(205, 'Obikee', 'Kenpet', 'Kenpet4christ@gmail.com', 'osinachi', '08035141744', 'First Bank', 'Obikee Kennedy', '3063773816', 0, '2017-03-31 07:25:11', 0),
(206, 'Yusuf Oladimeji', 'yoosoph', 'yoosoph4real@yahoo.com', 'dimeji78', '08032851940', 'Access Bank Plc', 'Yusuf Y Oladimeji', '0036521683', 0, '2017-03-31 07:26:07', 0),
(207, 'Collins', 'Shuga', 'csandyluv@gmail.com', '301995', '08154546948', 'First bank', 'A. Collins', '3113101600', 0, '2017-03-31 07:27:02', 0),
(208, 'ike chiamaka chinwe', 'bigbold', 'babyasses@yahoo.com', '505050', '07064420513', 'diamond', 'ike chiamaka chinwe', '0015948617', 0, '2017-03-31 07:28:59', 0),
(209, 'Jones Amaechi', 'razorfyne', 'razorfyne@gmail.com', 'Anjola001', '08032128172', 'Skye Bank', 'Jones Amaechi', '1780007336', 0, '2017-03-31 07:30:47', 0),
(210, 'Kayode odunayo', 'Sunshine', 'Odunayokayode11@gmail.com', '284878', '08169750080', 'First bank', 'Kayode Henry', '3065362656', 0, '2017-03-31 07:31:33', 0),
(211, 'Omolara', 'Lara', 'ladeniyi17@gmail.com', 'Favour@1', '08050276744', 'gtb', 'Afusat Adeniyi', '0034768920', 0, '2017-03-31 07:34:28', 0),
(213, 'Adenike', 'Adenyke', 'adenikeadesina@gmail.com', 'Adenyke@123', '08179725412', 'Access Bank', 'Adenike Adesina', '0727049012', 0, '2017-03-31 07:37:53', 0),
(214, 'Franklin Olubadejo', 'GRACE1', 'folubadejo@yahoo.com', 'ajebo1', '07082945432', 'UBA', 'OLUBADEJO FRANKLIN', '2069604225', 0, '2017-03-31 07:38:26', 0),
(215, 'Lawal Oyinlola', 'honeyzrich', 'honeyzrich1705@gmail.com', '17may1996', '08175083988', 'Access Bank', 'Oyinlola Lawal', '0690821941', 0, '2017-03-31 07:39:51', 0),
(216, 'Ogechi', 'Richman888', 'Ogcares4@yahoo.com', 'Tissue', '09068922788', 'Diamond', 'Ogechi Odoemenam', '0016759461', 0, '2017-03-31 07:39:53', 0),
(217, 'Gabriel Abadi', 'Riel', 'gaberiel7.ga@gmail.com', '07017493943', '07017493943', 'Diamond bank', 'Gabriel Abadi', '0063486882', 0, '2017-03-31 07:41:01', 0),
(218, 'Titilayo Taiwo', 'titilar', 'titilayoenitan.taiwo@gmail.com', 'anjorint', '08029661124', 'Gtb', 'Titilayo Taiwo', '0157057758', 0, '2017-03-31 07:41:39', 0),
(219, 'Amaka', 'Maks', 'amaka.mordi56@gmail.com', 'karen0708', '08110831492', 'First bank', 'Ndidiamaka mordi', '3038982847', 0, '2017-03-31 07:41:51', 0),
(220, 'Dammy ola', 'Dammy97', 'kafayatmodel2@yahoo.com', 'damilola97', '08038443649', 'First bank', 'Giwa kafayat', '3017489589', 0, '2017-03-31 07:43:14', 0),
(221, 'Tiana Chukwueke', 'Tiana24', 'Ninaelekwa@yahoo.com', 'unn1993', '08136517682', 'Access bank', 'Tiana Chukwueke', '0000456054', 0, '2017-03-31 07:46:12', 0),
(222, 'Udoidang Idaraobong', 'IdyOriginal', 'aideeoriginal@gmail.com', 'original1234', '07067024178', 'Diamond bank', 'Udodidang idaraobong', '0085597478', 0, '2017-03-31 07:47:10', 0),
(223, 'Odafenye Timothy', 'sirtim', 'timo4christ101@gmail.com', '567890', '08167107246', 'Zenith', 'Odafenye Timothy', '2189316118', 0, '2017-03-31 07:48:27', 0),
(224, 'Nnedi', 'preacher', 'ibekwe.stella@yahoo.com', 'Ebele4', '08065234286', 'GTBank', 'Nnedi S Okafor', '0046912281', 0, '2017-03-31 07:49:07', 0),
(225, 'Adedayo Caleb', 'act4real', 'adedayocaleb@yahoo.com', 'caleb1991', '08069429033', 'GTB', 'Adedayo Caleb', '020889523', 0, '2017-03-31 07:50:03', 0),
(226, 'Gbenga john', 'Ochipopo', 'adenusigbenga@gmail.com', 'timebobo1', '09071669373', 'Zenith bank', 'Gbenga John A', '2087443011', 0, '2017-03-31 07:50:57', 0),
(227, 'Oluwaseyi', 'Starlet', 'starletico@gmail.com', 'seyi@20', '07089997734', 'Heritage bank', 'Oluwaseyi Ijaola', '1000340261', 0, '2017-03-31 07:51:54', 0),
(228, 'Chinedu Emmanuel', 'Manuelned', 'oriebizline@gmail.com', 'calculus2689', '07035052689', 'Diamond', 'Chinedu Emmanuel Orie', '0086694831', 0, '2017-03-31 07:52:27', 0),
(229, 'Abdulsalam Yusuf', 'Elhadj', 'lilmoh97@gmail.com', '1doublem', '08066984983', 'First bank', 'Yusuf Muhammad', '3113028040', 0, '2017-03-31 07:54:01', 0),
(230, 'Harold A', 'HaroldA', 'abrahamharold22@gmail.com', 'hub_333', '08077416484', 'Heritage Bank', 'Abraham Harold', '1000409166', 0, '2017-03-31 07:54:04', 0),
(231, 'taiwo george', 'oluomot', 'taiwogeorge2013@gmail.com', 'echen111', '08023801718', 'first bank', 'george taiwo echen', '3053175279', 0, '2017-03-31 07:55:03', 0),
(232, 'Joshua Victor', 'Moondust', 'faemevic17@gmail.com', 'timzy001', '08108089377', 'Gtb', 'Joshua Victor Chukwuemeka', '0241320373', 0, '2017-03-31 07:56:17', 0),
(234, 'Odochi', 'odobekee', 'odee_24m@yahoo.com', 'simplyred', '08035514846', 'Diamondbank', 'Ajaero Odochi', '0049563280', 0, '2017-03-31 08:05:21', 0),
(235, 'Kenneth unachukwu', 'Dandy', 'kennygee2k@yahoo.co.uk', '303.636.939.k', '08037890512', 'First bank', 'Kenneth unachukwu', '3063932408', 0, '2017-03-31 08:11:47', 0),
(236, 'Faith', 'Andre', 'ennyadeniran@gmail.com', 'egbe1805', '08069421619', 'Diamomd', 'Morounkeji Adeniran', '0028016637', 0, '2017-03-31 08:14:45', 0),
(237, 'Amara Juliet', 'Amaa', 'Ama@gmail.com', 'wealth', '08119477011', 'GTBank', 'Amara Juliet', '0173118677', 0, '2017-03-31 08:15:25', 0),
(238, 'Okechukwu', 'Okies', 'obinnannamdi@yahoomail.com', 'senator', '08015505186', 'diamond', 'Okies', '0165235896', 0, '2017-03-31 08:24:36', 0),
(239, 'Abe', 'Goldie', 'amanda_capo27@yahoo.com', '52568968', '08085089019', 'AccessBank', 'Abe Olajumoke', '0020673349', 0, '2017-03-31 08:28:13', 0),
(240, 'sonia brown', 'tarabrown', 'taribrown75@gmail.com', '112233t', '08063438640', 'eco bank', 'question tamaratari', '3091154150', 0, '2017-03-31 08:34:44', 0),
(241, 'shakiru fatai gbenga', 'makewell', 'olugbenga.agunbiade@yahoo.com', 'omolabake', '07039225646', 'gtb', 'shakiru fatai', '0015208407', 0, '2017-03-31 08:35:04', 0),
(242, 'taiwo ajetunmobi', 'taiwoajet', 'ajetunmobibaby@yahoo.com', 'kenny@123', '08066699620', 'GTB', 'taiwo ajetunmobi', '0176331150', 0, '2017-03-31 08:36:35', 0),
(243, 'olalekan odurinde', 'lakesboy', 'lakesbabs007@yahoo.com', 'pigtail007', '07032463894', 'access bank', 'olalekan odurinde', '0028581864', 0, '2017-03-31 08:49:48', 0),
(244, 'JACKSON', 'xclusivedon', 'chukwudijackson139@gmail.com', 'chuddy9', '09054743626', 'FIRST BANK', 'CHUKWUDI KANU', '3113582258', 0, '2017-03-31 08:57:09', 0),
(245, 'Immaculata Achugwo', 'Ekemma', 'gloria_joseph@yahoo.com', 'morazmoraz', '08034817860', 'Diamond Bank', 'Mmachukwu ImmaculataAchugwo', '0060950584', 0, '2017-03-31 09:11:17', 0),
(246, 'Olaolu Olajubu', 'laolu', 'Laolu2014@gmail.com', 'adejubu4eva', '08142471315', 'Gtbank', 'Olaolu Olajubu', '0023527619', 0, '2017-03-31 09:17:26', 0),
(247, 'Aremu-Dele', 'Tallaremu', 'Seggzzy@gmail.com', 'origin', '07036799300', 'StanbicIBTC', 'Aremu Dele Olusegun', '0015074879', 0, '2017-03-31 09:30:02', 0),
(248, 'Raphael', 'Geezee', 'Geezeeguy@gmail.com', '19921992', '08154546949', 'Diamond', 'Raphael abadi', '0042873854', 0, '2017-03-31 09:33:24', 0),
(249, 'AGU DIANAH IJEOMA', 'Aijeoma', 'ijeomaagu37@gmail.com', 'ijeoma', '08033199898', 'Union bank', 'Agu Dianah ijeoma', '0003813628', 0, '2017-03-31 09:38:13', 0),
(250, 'George Nsima', 'nsimageorge', 'georgensima@gmail.com', 'password', '08069707549', 'Eco Bank', 'Nsima George', '0201064943', 0, '2017-03-31 10:21:38', 0),
(252, 'Sandar', 'Sandra25', 'akonkeade@yahoo.com', 'zozi25', '08024151434', 'Diamond bank', 'Sandra peter', '0043195537', 0, '2017-03-31 11:41:58', 0),
(253, 'John Oyeniyi', 'Desire', 'contactjohnoyeniyi@gmail.com', 'annie2016', '07068152755', 'Zenith', 'John Oyeniyi', '2080435167', 0, '2017-03-31 11:43:48', 0),
(254, 'Chia Faith Onyinye E.', 'Potter', 'Jniyi4real03@yahoo.com', 'annie2016', '09021382091', 'First bank', 'Chia Faith Onyinye E.', '3040469013', 0, '2017-03-31 11:57:36', 0),
(255, 'Johnson o', 'Olembe', 'bjoneil2002@yahoo.com', 'john123', '08069001993', 'Accessbank', '0006954765', '0006954765', 0, '2017-03-31 12:03:36', 0),
(256, 'Enoch Chilge A', 'Kush', 'Jniyi4real02@yahoo.com', 'annie2016', '07055803853', 'Zenith Bank', 'Enoch Chilge A.', '2007114634', 0, '2017-03-31 12:05:35', 0),
(257, 'Eboselume Oigiagbe', 'Kayus', 'Jniyi4real01@yahoo.com', 'annie2016', '07067828847', 'Zenith Bank', 'Eboselume Oigiagbe', '2006758349', 0, '2017-03-31 12:16:00', 0),
(258, 'Elizabeth Abadoo', 'lizzyab', 'lizzynina100@gmail.com', 'lizzy1234', '09095439002', 'Heritage Bank', 'Elizabeth Abadoo', '1912264433', 0, '2017-03-31 12:26:44', 0),
(259, 'Shakir', 'Atilolar', 'Boyopumping23@yahoo.com', 'adebanke', '08086291670', 'FCMB', 'Akinmade Shakir O', '0437193011', 0, '2017-03-31 12:36:34', 0),
(260, 'Ogbonna chisom', 'Chisomwealth', 'uzomachisomogbonna@gmail.com', 'chisom324', '09069589075', 'FCMB', 'Ogbonna chisom', '3769844019', 0, '2017-03-31 15:59:43', 0),
(262, 'Testing one', 'test1', 'mail@ma.com', 'test123', '08124043226', 'Access Bank', 'my account', '12344445', 0, '2017-04-01 11:21:25', 0),
(263, 'Admin 2', 'admin', 'mail@admin.com', 'test123', '08032125708', 'Bank', 'Account', 'number', 0, '2017-04-01 11:23:48', 1);
-- --------------------------------------------------------
--
-- Table structure for table `no_of_people_list`
--
CREATE TABLE IF NOT EXISTS `no_of_people_list` (
`no` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `no_of_people_list`
--
INSERT INTO `no_of_people_list` (`no`) VALUES
(20);
-- --------------------------------------------------------
--
-- Table structure for table `paid`
--
CREATE TABLE IF NOT EXISTS `paid` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idu` int(11) DEFAULT NULL,
`amount` int(11) DEFAULT NULL,
`time_paid` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `paid`
--
INSERT INTO `paid` (`id`, `idu`, `amount`, `time_paid`) VALUES
(1, 120, 500, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `payment_list`
--
CREATE TABLE IF NOT EXISTS `payment_list` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idu` int(11) DEFAULT NULL,
`section` varchar(20) DEFAULT NULL,
`amount` int(11) DEFAULT NULL,
`complete` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1164 ;
--
-- Dumping data for table `payment_list`
--
INSERT INTO `payment_list` (`id`, `idu`, `section`, `amount`, `complete`) VALUES
(1151, 120, '', 75000, 0),
(1153, 123, '', 45000, 0),
(1154, 125, '', 75000, 0),
(1155, 128, '', 55000, 0),
(1156, 129, '', 50000, 0),
(1157, 132, '', 40000, 0),
(1158, 136, '', 30000, 0),
(1159, 139, '', 40000, 0),
(1160, 253, '', 70000, 0),
(1161, 254, '', 30000, 0),
(1162, 256, '', 45000, 0),
(1163, 257, '', 55000, 0);
-- --------------------------------------------------------
--
-- Table structure for table `pay_queue`
--
CREATE TABLE IF NOT EXISTS `pay_queue` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idu` int(11) DEFAULT NULL,
`amount` int(11) DEFAULT NULL,
`complete` int(11) DEFAULT NULL,
`section` int(11) DEFAULT NULL,
`pledged` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
--
-- Dumping data for table `pay_queue`
--
INSERT INTO `pay_queue` (`id`, `idu`, `amount`, `complete`, `section`, `pledged`) VALUES
(10, 451, 30000, 0, 30000, 30000);
-- --------------------------------------------------------
--
-- Table structure for table `queue`
--
CREATE TABLE IF NOT EXISTS `queue` (
`idq` int(11) NOT NULL AUTO_INCREMENT,
`idu` int(11) NOT NULL,
`payto` int(11) NOT NULL,
`section` int(11) NOT NULL,
`section_id` int(11) NOT NULL,
`amount` int(11) NOT NULL,
`date_peered` datetime NOT NULL,
`date_expire` datetime NOT NULL,
`paid` int(11) NOT NULL,
PRIMARY KEY (`idq`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `received`
--
CREATE TABLE IF NOT EXISTS `received` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idu` int(11) DEFAULT NULL,
`amount` int(11) DEFAULT NULL,
`time_paid` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `received_help`
--
CREATE TABLE IF NOT EXISTS `received_help` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idu` int(11) NOT NULL,
`amount` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `receive_queue`
--
CREATE TABLE IF NOT EXISTS `receive_queue` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idu` int(11) DEFAULT NULL,
`amount` int(11) DEFAULT NULL,
`complete` int(11) DEFAULT NULL,
`section` varchar(20) DEFAULT NULL,
`listed` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=21 ;
--
-- Dumping data for table `receive_queue`
--
INSERT INTO `receive_queue` (`id`, `idu`, `amount`, `complete`, `section`, `listed`) VALUES
(1, 114, 60000, 0, '', 0),
(2, 117, 20000, 0, '', 0),
(3, 119, 30000, 0, '', 0),
(4, 120, 75000, 0, '', 1),
(5, 122, 50000, 0, '', 0),
(6, 123, 45000, 0, '', 1),
(7, 125, 75000, 0, '', 1),
(8, 128, 55000, 0, '', 1),
(9, 129, 50000, 0, '', 1),
(10, 132, 40000, 0, '', 1),
(11, 136, 30000, 0, '', 1),
(13, 139, 40000, 0, '', 1),
(17, 253, 70000, 0, '', 1),
(18, 254, 30000, 0, '', 1),
(19, 256, 45000, 0, '', 1),
(20, 257, 55000, 0, '', 1);
-- --------------------------------------------------------
--
-- Table structure for table `section_five`
--
CREATE TABLE IF NOT EXISTS `section_five` (
`id_five` int(11) NOT NULL AUTO_INCREMENT,
`idu` int(11) NOT NULL,
`pay_one` int(11) NOT NULL,
`pay_two` int(11) NOT NULL,
`complete` int(11) NOT NULL,
PRIMARY KEY (`id_five`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `section_four`
--
CREATE TABLE IF NOT EXISTS `section_four` (
`id_four` int(11) NOT NULL AUTO_INCREMENT,
`idu` int(11) NOT NULL,
`pay_one` int(11) NOT NULL,
`pay_two` int(11) NOT NULL,
`complete` int(11) NOT NULL,
PRIMARY KEY (`id_four`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `section_one`
--
CREATE TABLE IF NOT EXISTS `section_one` (
`id_one` int(11) NOT NULL AUTO_INCREMENT,
`idu` int(11) NOT NULL,
`pay_one` int(11) NOT NULL,
`pay_two` int(11) NOT NULL,
`complete` int(11) NOT NULL,
PRIMARY KEY (`id_one`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `section_three`
--
CREATE TABLE IF NOT EXISTS `section_three` (
`id_three` int(11) NOT NULL AUTO_INCREMENT,
`idu` int(11) NOT NULL,
`pay_one` int(11) NOT NULL,
`pay_two` int(11) NOT NULL,
`complete` int(11) NOT NULL,
PRIMARY KEY (`id_three`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `section_two`
--
CREATE TABLE IF NOT EXISTS `section_two` (
`id_two` int(11) NOT NULL AUTO_INCREMENT,
`idu` int(11) NOT NULL,
`pay_one` int(11) NOT NULL,
`pay_two` int(11) NOT NULL,
`complete` int(11) NOT NULL,
PRIMARY KEY (`id_two`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `sent_help`
--
CREATE TABLE IF NOT EXISTS `sent_help` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idu` int(11) NOT NULL,
`amount` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `testing`
--
CREATE TABLE IF NOT EXISTS `testing` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nothing` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=37 ;
--
-- Dumping data for table `testing`
--
INSERT INTO `testing` (`id`, `nothing`) VALUES
(1, ''),
(2, ''),
(3, ''),
(4, ''),
(5, ''),
(6, ''),
(7, ''),
(8, ''),
(9, ''),
(10, ''),
(11, ''),
(12, ''),
(13, ''),
(14, ''),
(15, ''),
(16, ''),
(17, ''),
(18, ''),
(19, ''),
(20, ''),
(21, ''),
(22, ''),
(23, ''),
(24, ''),
(25, ''),
(26, ''),
(27, ''),
(28, ''),
(29, ''),
(30, ''),
(31, ''),
(32, ''),
(33, ''),
(34, ''),
(35, ''),
(36, '');
-- --------------------------------------------------------
--
-- Table structure for table `tidy_up`
--
CREATE TABLE IF NOT EXISTS `tidy_up` (
`last_time` varchar(20) DEFAULT NULL,
`nothing` int(11) DEFAULT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `tidy_up`
--
INSERT INTO `tidy_up` (`last_time`, `nothing`, `id`) VALUES
('1491860277', NULL, 1);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| 71.811575
| 207
| 0.648868
|
5f954d81fb86f9d5901bf07760f59baf1d0ec97a
| 1,125
|
swift
|
Swift
|
githubsampleUITests/RepositoriesScreenTest.swift
|
FelipeCardoso89/GithubSample
|
1cdedb50fc9be1a4e3487bf3b3e418c426cfec8d
|
[
"MIT"
] | null | null | null |
githubsampleUITests/RepositoriesScreenTest.swift
|
FelipeCardoso89/GithubSample
|
1cdedb50fc9be1a4e3487bf3b3e418c426cfec8d
|
[
"MIT"
] | null | null | null |
githubsampleUITests/RepositoriesScreenTest.swift
|
FelipeCardoso89/GithubSample
|
1cdedb50fc9be1a4e3487bf3b3e418c426cfec8d
|
[
"MIT"
] | null | null | null |
//
// RepositoriesScreenTest.swift
// githubsampleUITests
//
// Created by Henrique Cardoso on 03/02/2019.
// Copyright © 2019 Felipe Antonio Cardoso. All rights reserved.
//
import XCTest
import KIF
@testable import githubsample
class RepositoriesScreenTest: KIFTestCase {
var app: XCUIApplication!
override func setUp() {
continueAfterFailure = false
app = XCUIApplication()
setupSnapshot(app)
app.launch()
}
override func tearDown() {
}
func testRepositoriesViewController() {
let tableViewIdenfier = "repositories_table_view"
XCTAssertTrue(waitForElementToAppear(self.app.tables[tableViewIdenfier]))
snapshot("MainRepositoriesScreen")
}
func waitForElementToAppear(_ element: XCUIElement) -> Bool {
let predicate = NSPredicate(format: "exists == true")
let exp = expectation(for: predicate, evaluatedWith: element, handler: nil)
let result = XCTWaiter().wait(for: [exp], timeout: 5)
return result == .completed
}
}
| 23.93617
| 83
| 0.637333
|
0d769c4f8aeb4f0529e610de6df369515479b503
| 1,158
|
cs
|
C#
|
Syntinel.Core/Objects/Replies/SignalReply.cs
|
SynapseProject/syntinel.core.net
|
fc4a1dd819df08e4cac0dce7746b62d35f264e6a
|
[
"MIT"
] | 1
|
2020-09-28T04:19:07.000Z
|
2020-09-28T04:19:07.000Z
|
Syntinel.Core/Objects/Replies/SignalReply.cs
|
SynapseProject/syntinel.core.net
|
fc4a1dd819df08e4cac0dce7746b62d35f264e6a
|
[
"MIT"
] | 7
|
2019-02-13T21:08:45.000Z
|
2021-04-23T16:28:03.000Z
|
Syntinel.Core/Objects/Replies/SignalReply.cs
|
SynapseProject/syntinel.core.net
|
fc4a1dd819df08e4cac0dce7746b62d35f264e6a
|
[
"MIT"
] | null | null | null |
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json.Converters;
namespace Syntinel.Core
{
public class SignalReply
{
[JsonProperty(PropertyName = "statusCode")]
[JsonConverter(typeof(StringEnumConverter))]
public StatusCode StatusCode { get; set; }
[JsonProperty(PropertyName = "id")]
public string Id { get; set; }
[JsonProperty(PropertyName = "time")]
public DateTime Time { get; set; }
[JsonProperty(PropertyName = "results")]
public List<SignalStatus> Results { get; set; } = new List<SignalStatus>();
}
public class SignalStatus
{
[JsonProperty(PropertyName = "code")]
[JsonConverter(typeof(StringEnumConverter))]
public StatusCode Code { get; set; }
[JsonProperty(PropertyName = "channelId")]
public string ChannelId { get; set; }
[JsonProperty(PropertyName = "channelType")]
public string ChannelType { get; set; }
[JsonProperty(PropertyName = "message")]
public string Message { get; set; }
}
}
| 28.243902
| 83
| 0.643351
|
1a73857a0ae5ce680845c5e136663919537ae307
| 5,870
|
py
|
Python
|
eventsourcing_grpc/protos/application_pb2.py
|
johnbywater/eventsourcing-grpc
|
d6f36f1e9bd994a95d1cea16a46254d61efbddeb
|
[
"BSD-3-Clause"
] | 2
|
2022-03-18T15:25:37.000Z
|
2022-03-18T16:47:04.000Z
|
eventsourcing_grpc/protos/application_pb2.py
|
johnbywater/eventsourcing-grpc
|
d6f36f1e9bd994a95d1cea16a46254d61efbddeb
|
[
"BSD-3-Clause"
] | null | null | null |
eventsourcing_grpc/protos/application_pb2.py
|
johnbywater/eventsourcing-grpc
|
d6f36f1e9bd994a95d1cea16a46254d61efbddeb
|
[
"BSD-3-Clause"
] | null | null | null |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: eventsourcing_grpc/protos/application.proto
"""Generated protocol buffer code."""
from google.protobuf import (
descriptor as _descriptor,
descriptor_pool as _descriptor_pool,
message as _message,
reflection as _reflection,
symbol_database as _symbol_database,
)
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
b'\n+eventsourcing_grpc/protos/application.proto\x12\x12\x65ventsourcing_grpc"\x07\n\x05\x45mpty"B\n\rMethodRequest\x12\x13\n\x0bmethod_name\x18\x01'
b" \x01(\t\x12\x0c\n\x04\x61rgs\x18\x02 \x01(\x0c\x12\x0e\n\x06kwargs\x18\x03"
b' \x01(\x0c"\x1b\n\x0bMethodReply\x12\x0c\n\x04\x64\x61ta\x18\x01'
b' \x01(\x0c"R\n\x14NotificationsRequest\x12\r\n\x05start\x18\x01'
b" \x01(\t\x12\r\n\x05limit\x18\x02 \x01(\t\x12\x0c\n\x04stop\x18\x03"
b" \x01(\t\x12\x0e\n\x06topics\x18\x04"
b' \x03(\t"k\n\x0cNotification\x12\n\n\x02id\x18\x01'
b" \x01(\t\x12\x15\n\roriginator_id\x18\x02"
b" \x01(\t\x12\x1a\n\x12originator_version\x18\x03 \x01(\t\x12\r\n\x05topic\x18\x04"
b" \x01(\t\x12\r\n\x05state\x18\x05"
b' \x01(\x0c"M\n\x12NotificationsReply\x12\x37\n\rnotifications\x18\x01'
b" \x03(\x0b\x32"
b' .eventsourcing_grpc.Notification"&\n\rPromptRequest\x12\x15\n\rupstream_name\x18\x01'
b' \x01(\t2\xde\x02\n\x0b\x41pplication\x12>\n\x04Ping\x12\x19.eventsourcing_grpc.Empty\x1a\x19.eventsourcing_grpc.Empty"\x00\x12]\n\x15\x43\x61llApplicationMethod\x12!.eventsourcing_grpc.MethodRequest\x1a\x1f.eventsourcing_grpc.MethodReply"\x00\x12H\n\x06Prompt\x12!.eventsourcing_grpc.PromptRequest\x1a\x19.eventsourcing_grpc.Empty"\x00\x12\x66\n\x10GetNotifications\x12(.eventsourcing_grpc.NotificationsRequest\x1a&.eventsourcing_grpc.NotificationsReply"\x00\x42=\n!io.eventsourcing_grpc.applicationB\x10\x41pplicationProtoP\x01\xa2\x02\x03\x45SAb\x06proto3'
)
_EMPTY = DESCRIPTOR.message_types_by_name["Empty"]
_METHODREQUEST = DESCRIPTOR.message_types_by_name["MethodRequest"]
_METHODREPLY = DESCRIPTOR.message_types_by_name["MethodReply"]
_NOTIFICATIONSREQUEST = DESCRIPTOR.message_types_by_name["NotificationsRequest"]
_NOTIFICATION = DESCRIPTOR.message_types_by_name["Notification"]
_NOTIFICATIONSREPLY = DESCRIPTOR.message_types_by_name["NotificationsReply"]
_PROMPTREQUEST = DESCRIPTOR.message_types_by_name["PromptRequest"]
Empty = _reflection.GeneratedProtocolMessageType(
"Empty",
(_message.Message,),
{
"DESCRIPTOR": _EMPTY,
"__module__": "eventsourcing_grpc.protos.application_pb2"
# @@protoc_insertion_point(class_scope:eventsourcing_grpc.Empty)
},
)
_sym_db.RegisterMessage(Empty)
MethodRequest = _reflection.GeneratedProtocolMessageType(
"MethodRequest",
(_message.Message,),
{
"DESCRIPTOR": _METHODREQUEST,
"__module__": "eventsourcing_grpc.protos.application_pb2"
# @@protoc_insertion_point(class_scope:eventsourcing_grpc.MethodRequest)
},
)
_sym_db.RegisterMessage(MethodRequest)
MethodReply = _reflection.GeneratedProtocolMessageType(
"MethodReply",
(_message.Message,),
{
"DESCRIPTOR": _METHODREPLY,
"__module__": "eventsourcing_grpc.protos.application_pb2"
# @@protoc_insertion_point(class_scope:eventsourcing_grpc.MethodReply)
},
)
_sym_db.RegisterMessage(MethodReply)
NotificationsRequest = _reflection.GeneratedProtocolMessageType(
"NotificationsRequest",
(_message.Message,),
{
"DESCRIPTOR": _NOTIFICATIONSREQUEST,
"__module__": "eventsourcing_grpc.protos.application_pb2"
# @@protoc_insertion_point(class_scope:eventsourcing_grpc.NotificationsRequest)
},
)
_sym_db.RegisterMessage(NotificationsRequest)
Notification = _reflection.GeneratedProtocolMessageType(
"Notification",
(_message.Message,),
{
"DESCRIPTOR": _NOTIFICATION,
"__module__": "eventsourcing_grpc.protos.application_pb2"
# @@protoc_insertion_point(class_scope:eventsourcing_grpc.Notification)
},
)
_sym_db.RegisterMessage(Notification)
NotificationsReply = _reflection.GeneratedProtocolMessageType(
"NotificationsReply",
(_message.Message,),
{
"DESCRIPTOR": _NOTIFICATIONSREPLY,
"__module__": "eventsourcing_grpc.protos.application_pb2"
# @@protoc_insertion_point(class_scope:eventsourcing_grpc.NotificationsReply)
},
)
_sym_db.RegisterMessage(NotificationsReply)
PromptRequest = _reflection.GeneratedProtocolMessageType(
"PromptRequest",
(_message.Message,),
{
"DESCRIPTOR": _PROMPTREQUEST,
"__module__": "eventsourcing_grpc.protos.application_pb2"
# @@protoc_insertion_point(class_scope:eventsourcing_grpc.PromptRequest)
},
)
_sym_db.RegisterMessage(PromptRequest)
_APPLICATION = DESCRIPTOR.services_by_name["Application"]
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = (
b"\n!io.eventsourcing_grpc.applicationB\020ApplicationProtoP\001\242\002\003ESA"
)
_EMPTY._serialized_start = 67
_EMPTY._serialized_end = 74
_METHODREQUEST._serialized_start = 76
_METHODREQUEST._serialized_end = 142
_METHODREPLY._serialized_start = 144
_METHODREPLY._serialized_end = 171
_NOTIFICATIONSREQUEST._serialized_start = 173
_NOTIFICATIONSREQUEST._serialized_end = 255
_NOTIFICATION._serialized_start = 257
_NOTIFICATION._serialized_end = 364
_NOTIFICATIONSREPLY._serialized_start = 366
_NOTIFICATIONSREPLY._serialized_end = 443
_PROMPTREQUEST._serialized_start = 445
_PROMPTREQUEST._serialized_end = 483
_APPLICATION._serialized_start = 486
_APPLICATION._serialized_end = 836
# @@protoc_insertion_point(module_scope)
| 40.763889
| 565
| 0.759625
|
1c7e86705b1237366e7e0847762eee491eba1d6e
| 921
|
sh
|
Shell
|
experiment_scripts/mutag_denoise_0.8_forward.sh
|
gear/denoising-gnn
|
867f7d8b7776d0241816bb78491003a221c3146e
|
[
"MIT"
] | 13
|
2019-05-10T08:14:07.000Z
|
2021-03-18T02:44:53.000Z
|
experiment_scripts/mutag_denoise_0.8_forward.sh
|
gear/denoising-gnn
|
867f7d8b7776d0241816bb78491003a221c3146e
|
[
"MIT"
] | 1
|
2019-07-26T03:16:22.000Z
|
2019-07-26T04:21:09.000Z
|
experiment_scripts/mutag_denoise_0.8_forward.sh
|
gear/denoising-gnn
|
867f7d8b7776d0241816bb78491003a221c3146e
|
[
"MIT"
] | 1
|
2020-05-14T10:44:03.000Z
|
2020-05-14T10:44:03.000Z
|
#!/bin/bash
# Run all datasets with the default parameters
cd ..
source activate graph
# Best parameter in isolated default search
batch_size=32
num_layers=5
lr=0.01
num_mlp_layers=2
hidden_dim=32
final_dropout=0
epochs=20
for fold in 0
do
echo Processing MUTAG at fold $fold ...
python main.py --dataset MUTAG \
--epochs $epochs \
--batch_size $batch_size \
--num_layers $num_layers \
--lr $lr \
--num_mlp_layers $num_mlp_layers \
--hidden_dim $hidden_dim \
--fold_idx $fold \
--filename MUTAG_0.8_result_fold_$fold \
--degree_as_tag \
--corrupt_label \
--N "0.8" \
--denoise estimate \
--correction forward
> ./logs/COLLAB_0.8_forward.log
echo Done.
done
| 27.088235
| 59
| 0.53203
|
b097b54a6d38894fdbab1a742166d27455292835
| 478
|
py
|
Python
|
test.py
|
zhujun3753/ACMD
|
e7ed37a0a492adf6bc5f238762dd7253df9f7464
|
[
"MIT"
] | null | null | null |
test.py
|
zhujun3753/ACMD
|
e7ed37a0a492adf6bc5f238762dd7253df9f7464
|
[
"MIT"
] | null | null | null |
test.py
|
zhujun3753/ACMD
|
e7ed37a0a492adf6bc5f238762dd7253df9f7464
|
[
"MIT"
] | null | null | null |
# 综合分类数据集
from numpy import where
from sklearn.datasets import make_classification
import matplotlib.pyplot as plt
# 定义数据集
X, y = make_classification(n_samples=1000, n_features=2, n_informative=2, n_redundant=0, n_clusters_per_class=1, random_state=4)
# 为每个类的样本创建散点图
plt.figure()
plt.scatter(X[:,0],X[:,1])
plt.figure()
for class_value in range(2):
# 获取此类的示例的行索引
row_ix = where(y == class_value)
# 创建这些样本的散布
plt.scatter(X[row_ix, 0], X[row_ix, 1])
# 绘制散点图
plt.show()
| 28.117647
| 128
| 0.742678
|
c6cbff9d5b5bf83d5a33ee9eaea1ac45acb606a1
| 531
|
rb
|
Ruby
|
lib/br_danfe/danfe_lib/ticket.rb
|
glaubersantana/br_danfe
|
3cb56881ebd1d05b750ba911d855fc2c55a726c0
|
[
"MIT"
] | null | null | null |
lib/br_danfe/danfe_lib/ticket.rb
|
glaubersantana/br_danfe
|
3cb56881ebd1d05b750ba911d855fc2c55a726c0
|
[
"MIT"
] | null | null | null |
lib/br_danfe/danfe_lib/ticket.rb
|
glaubersantana/br_danfe
|
3cb56881ebd1d05b750ba911d855fc2c55a726c0
|
[
"MIT"
] | null | null | null |
module BrDanfe
module DanfeLib
class Ticket
def self.render(pdf, xml)
pdf.ibox 0.85, 16.10, 0.25, 0.42, I18n.t("danfe.ticket.xNome", :xNome => xml["emit/xNome"])
pdf.ibox 0.85, 4.10, 0.25, 1.27, I18n.t("danfe.ticket.received_at")
pdf.ibox 0.85, 12.00, 4.35, 1.27, I18n.t("danfe.ticket.receiver")
pdf.ibox 1.70, 4.50, 16.35, 0.42, "", I18n.t("danfe.ticket.document", :nNF => xml["ide/nNF"], :serie => xml["ide/serie"]), {:align => :center, :valign => :center}
end
end
end
end
| 40.846154
| 170
| 0.587571
|
24bcf892c0e329e2d279dda5b06adb34edd884df
| 3,145
|
php
|
PHP
|
tests/UsersCest.php
|
shadowsproject/element
|
4ebe57cb56ead3516315874a51bf77e05a96dd28
|
[
"MIT"
] | 19
|
2019-08-07T11:35:51.000Z
|
2022-03-29T13:40:02.000Z
|
tests/UsersCest.php
|
shadowsproject/element
|
4ebe57cb56ead3516315874a51bf77e05a96dd28
|
[
"MIT"
] | 119
|
2019-01-11T13:51:56.000Z
|
2019-07-18T20:47:43.000Z
|
tests/UsersCest.php
|
dzantiev/element
|
4ebe57cb56ead3516315874a51bf77e05a96dd28
|
[
"MIT"
] | 5
|
2019-12-15T02:52:25.000Z
|
2022-02-01T19:25:19.000Z
|
<?php
class UsersCest
{
public function getUsers(ApiTester $I)
{
$I->sendGET('/users/getUsers');
$I->seeResponseContainsJson(['success' => false]);
$I->sendPOST('/auth', ['login' => 'admin', 'password' => 'adminpass']);
$I->seeResponseContainsJson(['success' => true]);
$I->sendGET('/users/getUsers');
$I->seeResponseContainsJson(['success' => true]);
$I->seeResponseJsonMatchesJsonPath('$.users.*.id');
}
public function addUser(ApiTester $I)
{
$I->sendPOST('/auth', ['login' => 'admin', 'password' => 'adminpass']);
$I->seeResponseContainsJson(['success' => true]);
$I->sendPOST('/users/addUser',
[
'login' => 'user',
'password' => 'pass',
'name' => 'ddd',
'email' => 'kisieva@gmail.com'
]);
$I->seeResponseContainsJson(['success' => true]);
$I->seeInDatabase('em_users',
[
'name' => 'ddd', 'email' => 'kisieva@gmail.com', 'login' => 'user', 'password' => md5('pass')
]);
$I->sendPOST('/users/addUser',
[
'login' => 'user',
'password' => 'pass',
]);
$I->seeResponseContainsJson(['success' => false]);
$I->sendPOST('/users/addUser',
[
'login' => 'user',
'name' => 'ddd',
'email' => 'kisieva@gmail.com'
]);
$I->seeResponseContainsJson(['success' => false]);
}
public function getUser(ApiTester $I)
{
$I->sendPOST('/auth', ['login' => 'admin', 'password' => 'adminpass']);
$I->seeResponseContainsJson(['success' => true]);
$I->sendGET('/users/getUser');
$I->seeResponseContainsJson(['success' => false]);
$I->sendGET('/users/getUser', ['id' => 1]);
$I->seeResponseContainsJson(['success' => true]);
$I->seeResponseJsonMatchesJsonPath('$.user.id');
}
public function deleteUser(ApiTester $I)
{
$I->sendPOST('/auth', ['login' => 'admin', 'password' => 'adminpass']);
$I->seeResponseContainsJson(['success' => true]);
$I->sendPOST('/users/deleteUser');
$I->seeResponseContainsJson(['success' => false]);
$I->sendPOST('/users/deleteUser', ['id' => 1]);
$I->seeResponseContainsJson(['success' => true]);
$I->dontSeeInDatabase('em_users', ['id' => 1]);
}
public function updateUser(ApiTester $I)
{
$I->sendPOST('/users/updateUser', ['id' => 1]);
$I->seeResponseContainsJson(['success' => false]);
$I->sendPOST('/auth', ['login' => 'admin', 'password' => 'adminpass']);
$I->seeResponseContainsJson(['success' => true]);
$I->sendPOST('/users/updateUser', ['id' => 1]);
$I->seeResponseContainsJson(['success' => true]);
$I->sendPOST('/users/updateUser');
$I->seeResponseContainsJson(['success' => false]);
$I->sendPOST('/users/updateUser',
[
'id' => 1,
'login' => 'dsfdsfsdf',
'email' => 'kisiev@mail.ru',
'password' => 'red'
]);
$I->seeResponseContainsJson(['success' => true]);
$I->sendPOST('/users/updateUser',
[
'id' => 1,
'login' => 'dsfdsfsdf',
'email' => 'kisiev@mail.ru',
'password' => 'red'
]);
$I->seeResponseContainsJson(['success' => true]);
$I->sendPOST('/users/updateUser',
[
'id' => 1,
'login' => 'admin',
'email' => 'axel0726@gmail.com',
'password' => 'adminpass'
]);
$I->seeResponseContainsJson(['success' => true]);
}
}
| 26.208333
| 96
| 0.590779
|
b0e3e8c6e02a8605b854ec5b7d9d5f786313138e
| 1,384
|
py
|
Python
|
CyberGuard_v2/function/variables.py
|
CyberTriber/python
|
3d9cffa4f6fc3a3348bc2ce8070c243f047927e1
|
[
"MIT"
] | 1
|
2018-09-16T05:50:52.000Z
|
2018-09-16T05:50:52.000Z
|
CyberGuard_v2/function/variables.py
|
CyberTriber/python
|
3d9cffa4f6fc3a3348bc2ce8070c243f047927e1
|
[
"MIT"
] | null | null | null |
CyberGuard_v2/function/variables.py
|
CyberTriber/python
|
3d9cffa4f6fc3a3348bc2ce8070c243f047927e1
|
[
"MIT"
] | null | null | null |
# coding=utf-8
global DEBUG_ON # Turn debug ON/OF (True/False)
DEBUG_ON = False
global LEVEL_SYSTEM # Settings for leveling system
LEVEL_SYSTEM = {
'1': {'cap': 0, 'multiplier': 1},
'2': {'cap': 10, 'multiplier': 1},
'3': {'cap': 100, 'multiplier': 2},
'4': {'cap': 500, 'multiplier': 2},
'5': {'cap': 1000, 'multiplier': 3},
'6': {'cap': 2000, 'multiplier': 3},
'7': {'cap': 5000, 'multiplier': 3},
'8': {'cap': 10000, 'multiplier': 4},
'8': {'cap': 20000, 'multiplier': 5}
}
global NEW_USER # Default settings for new users
NEW_USER = {
'credit': 100,
'points': 0,
'level': 1,
'multiplier': 1,
'xp': 0,
'weapons': {},
'active_weapon': ''
}
# Info screen settings
global INFO_BG
global EMPTY_AVATAR
global INFO_BG1
global FONT1
global FONT2
global FONT3
global FONT4
global STATUS_COLORS
INFO_BG = './static/img/bg.png' # base background of info graphic
INFO_BG1 = './static/img/bg1.png' # left part covering avatar and make them rounded
EMPTY_AVATAR = './static/img/no_avatar.png' # default picture for users without avatar
FONT1 = './static/fonts/Ignis et Glacies Sharp.ttf'
FONT2 = './static/fonts/GFSNeohellenicBold.ttf'
FONT3 = '/usr/share/fonts/truetype/freefont/FreeSans.ttf'
STATUS_COLORS={
'online': (67, 181, 129),
'offline': (116, 127, 141),
'idle': (250, 166, 26),
'dnd': (240, 71, 71),
'invisible': (116, 127, 141)}
| 25.163636
| 87
| 0.644509
|
e1cf3d7691e31a34c955a968970e1b1427a2516a
| 2,877
|
cs
|
C#
|
MsTestDataDrivenTest.UnitTests/FullBehaviourTests.cs
|
San7hos/MSTestDataDrivenTest
|
cf5dc8d3ec76e393ceb02675bc408a091662de45
|
[
"MIT"
] | null | null | null |
MsTestDataDrivenTest.UnitTests/FullBehaviourTests.cs
|
San7hos/MSTestDataDrivenTest
|
cf5dc8d3ec76e393ceb02675bc408a091662de45
|
[
"MIT"
] | 2
|
2017-06-08T13:07:05.000Z
|
2017-06-08T13:09:17.000Z
|
MsTestDataDrivenTest.UnitTests/FullBehaviourTests.cs
|
San7hos/MSTestDataDrivenTest
|
cf5dc8d3ec76e393ceb02675bc408a091662de45
|
[
"MIT"
] | null | null | null |
// <copyright file="FullBehaviourTests.cs" company="Santhos.net">
// Copyright (c) Santhos.net. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// </copyright>
namespace MsTestDataDrivenTest.UnitTests
{
using System;
using System.Collections;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Santhos.MSTest;
[TestClass]
public class FullBehaviourTests
{
[TestMethod]
public void DataDrivenTestPassesCorrectly()
{
Func<int, int, int> correctAdder = (x, y) => x + y;
TestData
.Arrange(1, 1, 2)
.Arrange(1, 2, 3)
.ActAndAssert((int a, int b, int expected) =>
{
var sut = correctAdder;
int actual = sut(a, b);
Assert.AreEqual(actual, expected);
});
}
[TestMethod]
public void DataDrivenTestFailsCorrectly()
{
var expectedMessage = "Assert.AreEqual failed. Expected:<4>. Actual:<3>. ";
try
{
var epicFail = 0;
Func<int, int, int> brokenAdder = (x, y) => x + y + epicFail++;
TestData
.Arrange(1, 1, 2)
.Arrange(1, 2, 3)
.ActAndAssert((int a, int b, int expected) =>
{
var sut = brokenAdder;
int actual = sut(a, b);
Assert.AreEqual(actual, expected);
});
}
catch (AssertFailedException ex)
{
Assert.AreEqual(expectedMessage, ex.Message);
}
}
[TestMethod]
public void DataDrivenTestPassesCorrectlyWhenUsingTestCaseSourceClass()
{
var actualCalls = 0;
TestData
.ArrangeTestCases(new MyTestCases())
.ActAndAssert((int x, int y, int expected) =>
{
var actual = Math.Min(x, y);
Assert.AreEqual(expected, actual, $"Failed for x {x}, y {y} and expected {expected}");
actualCalls++;
});
Assert.AreEqual(2, actualCalls, "Act should be called twice");
}
private class MyTestCases : IEnumerable<IEnumerable<object>>
{
public IEnumerator<IEnumerable<object>> GetEnumerator()
{
yield return new List<object> { 1, 2, 1 };
yield return new List<object> { 3, 4, 3 };
}
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
}
}
}
| 30.935484
| 106
| 0.493917
|
c688baa304e8c28a6a30ae1b6a080705248fef71
| 87
|
py
|
Python
|
todolist/task/admin.py
|
AzamatKomaev/azamat-komaev-todo-list
|
37d330f81a8587509cbd2dff852c788d5db4fbc6
|
[
"MIT"
] | null | null | null |
todolist/task/admin.py
|
AzamatKomaev/azamat-komaev-todo-list
|
37d330f81a8587509cbd2dff852c788d5db4fbc6
|
[
"MIT"
] | null | null | null |
todolist/task/admin.py
|
AzamatKomaev/azamat-komaev-todo-list
|
37d330f81a8587509cbd2dff852c788d5db4fbc6
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from .models import Task
admin.site.register(Task)
| 12.428571
| 32
| 0.793103
|
e275927e3a27acd893e8af207ffd2613c81e10c7
| 1,577
|
py
|
Python
|
qplan/Control.py
|
rdk1024/qplan
|
6f9ac8d5d4d110369997b31dd35811284b301095
|
[
"BSD-3-Clause"
] | 2
|
2016-08-17T01:48:01.000Z
|
2019-08-01T05:58:32.000Z
|
qplan/Control.py
|
rdk1024/qplan
|
6f9ac8d5d4d110369997b31dd35811284b301095
|
[
"BSD-3-Clause"
] | 26
|
2016-12-25T07:35:16.000Z
|
2021-02-05T21:22:54.000Z
|
qplan/Control.py
|
rdk1024/qplan
|
6f9ac8d5d4d110369997b31dd35811284b301095
|
[
"BSD-3-Clause"
] | 3
|
2016-06-20T21:25:42.000Z
|
2020-07-28T20:59:11.000Z
|
#
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import sys, os
import threading
from ginga.misc import Callback
class ControlError(Exception):
pass
class Controller(Callback.Callbacks):
def __init__(self, logger, threadPool, module_manager, preferences,
ev_quit, model):
Callback.Callbacks.__init__(self)
self.logger = logger
self.threadPool = threadPool
self.mm = module_manager
self.prefs = preferences
# event for controlling termination of threads executing in this
# object
self.ev_quit = ev_quit
self.model = model
self.settings = self.prefs.create_category('general')
# For asynchronous tasks on the thread pool
self.tag = 'master'
self.shares = ['threadPool', 'logger']
self.input_dir = self.settings.get('input_dir', '.')
self.output_dir = self.settings.get('output_dir', None)
self.idx_tgt_plots = 0
self.num_tgt_plots = 100
def set_input_dir(self, path):
self.input_dir = path
def set_output_dir(self, path):
self.output_dir = path
def set_input_fmt(self, fmt):
self.input_fmt = fmt
def get_logger(self):
return self.logger
def get_model(self):
return self.model
def get_preferences(self):
return self.prefs
def set_loglevel(self, level):
handlers = self.logger.handlers
for hdlr in handlers:
hdlr.setLevel(level)
# END
| 24.640625
| 72
| 0.642993
|
4942784e64a3e119ca55f37ee642b868e0320ce1
| 4,465
|
sql
|
SQL
|
SQL/2.0.13/5) Post process.sql
|
NimbusServices/SAEON.ObservationsDatabase
|
025ea0af49cc6c5f6efcbe06119062655b457766
|
[
"MIT"
] | null | null | null |
SQL/2.0.13/5) Post process.sql
|
NimbusServices/SAEON.ObservationsDatabase
|
025ea0af49cc6c5f6efcbe06119062655b457766
|
[
"MIT"
] | 102
|
2017-07-25T12:37:44.000Z
|
2022-03-28T12:28:34.000Z
|
SQL/2.0.13/5) Post process.sql
|
NimbusServices/SAEON.ObservationsDatabase
|
025ea0af49cc6c5f6efcbe06119062655b457766
|
[
"MIT"
] | null | null | null |
USE [Observations]
--USE [ObservationsTest]
alter table SchemaColumn alter column FixedTime varchar(10)
EXECUTE sp_refreshsqlmodule '[dbo].[vSchemaColumn]'
PRINT 'Create aspnet_Applications_Index'
GO
CREATE CLUSTERED INDEX [aspnet_Applications_Index]
ON [dbo].[aspnet_Applications]([LoweredApplicationName])
WITH(DROP_EXISTING=ON) ON [Authentication];
PRINT 'Create aspnet_Membership_index'
GO
CREATE CLUSTERED INDEX [aspnet_Membership_index]
ON [dbo].[aspnet_Membership]([ApplicationId] ASC, [LoweredEmail])
WITH(DROP_EXISTING=ON) ON [Authentication];
PRINT 'Create aspnet_Paths_index'
GO
CREATE UNIQUE CLUSTERED INDEX [aspnet_Paths_index]
ON [dbo].[aspnet_Paths]([ApplicationId] ASC, [LoweredPath])
WITH(DROP_EXISTING=ON) ON [Authentication];
PRINT 'Create aspnet_PersonalizationPerUser_index1'
GO
CREATE UNIQUE CLUSTERED INDEX [aspnet_PersonalizationPerUser_index1]
ON [dbo].[aspnet_PersonalizationPerUser]([PathId] ASC, [UserId])
WITH(DROP_EXISTING=ON) ON [Authentication];
PRINT 'Create aspnet_PersonalizationPerUser_ncindex2'
GO
CREATE UNIQUE INDEX [aspnet_PersonalizationPerUser_ncindex2]
ON [dbo].[aspnet_PersonalizationPerUser]([UserId] ASC, [PathId])
WITH(DROP_EXISTING=ON) ON [Authentication];
PRINT 'Create aspnet_Roles_index1'
GO
CREATE UNIQUE CLUSTERED INDEX [aspnet_Roles_index1]
ON [dbo].[aspnet_Roles]([ApplicationId] ASC, [LoweredRoleName])
WITH(DROP_EXISTING=ON) ON [Authentication];
PRINT 'Create aspnet_Users_Index'
GO
CREATE UNIQUE CLUSTERED INDEX [aspnet_Users_Index]
ON [dbo].[aspnet_Users]([ApplicationId] ASC, [LoweredUserName])
WITH(DROP_EXISTING=ON) ON [Authentication];
PRINT 'Create aspnet_Users_Index2'
GO
CREATE INDEX [aspnet_Users_Index2]
ON [dbo].[aspnet_Users]([ApplicationId] ASC, [LastActivityDate])
WITH(DROP_EXISTING=ON) ON [Authentication];
PRINT 'Create aspnet_UsersInRoles_index'
GO
CREATE INDEX [aspnet_UsersInRoles_index]
ON [dbo].[aspnet_UsersInRoles]([RoleId])
WITH(DROP_EXISTING=ON) ON [Authentication];
PRINT 'Create CX_Observation'
GO
CREATE CLUSTERED INDEX [CX_Observation] ON [dbo].[Observation] ([AddedAt])
WITH(DROP_EXISTING=ON) ON [Observations];
PRINT 'Drop PK_Observation'
GO
ALTER TABLE [dbo].[Observation] DROP CONSTRAINT [PK_Observation]
PRINT 'Create PK_Observation'
GO
ALTER TABLE [dbo].[Observation] ADD CONSTRAINT [PK_Observation] PRIMARY KEY NONCLUSTERED ([ID]) on [Observations]
PRINT 'Drop UX_Observation'
GO
ALTER TABLE [dbo].[Observation] DROP CONSTRAINT [UX_Observation]
PRINT 'Create UX_Observation'
GO
ALTER TABLE [dbo].[Observation] ADD CONSTRAINT [UX_Observation] UNIQUE ([SensorID], [ImportBatchID], [ValueDate], [PhenomenonOfferingID], [PhenomenonUOMID]) ON [Observations]
PRINT 'Create IX_Observation'
GO
CREATE INDEX [IX_Observation] ON [dbo].[Observation]([SensorID] ASC, [ValueDate] ASC, [RawValue])
WITH(DROP_EXISTING=ON) ON [Observations];
PRINT 'Create IX_Observation_ImportBatchID'
GO
CREATE INDEX [IX_Observation_ImportBatchID] ON [dbo].[Observation]([ImportBatchID])
WITH(DROP_EXISTING=ON) ON [Observations];
PRINT 'Create IX_Observation_SensorID'
GO
CREATE INDEX [IX_Observation_SensorID] ON [dbo].[Observation] ([SensorID])
WITH(DROP_EXISTING=ON) ON [Observations];
PRINT 'Create IX_Observation_PhenomenonOfferingID'
GO
CREATE INDEX [IX_Observation_PhenomenonOfferingID] ON [dbo].[Observation] ([PhenomenonOfferingID])
WITH(DROP_EXISTING=ON) ON [Observations];
PRINT 'Create IX_Observation_PhenomenonUOMID'
GO
CREATE INDEX [IX_Observation_PhenomenonUOMID] ON [dbo].[Observation] ([PhenomenonUOMID])
WITH(DROP_EXISTING=ON) ON [Observations];
PRINT 'Create IX_Observation_UserId'
GO
CREATE INDEX [IX_Observation_UserId] ON [dbo].[Observation] ([UserId])
WITH(DROP_EXISTING=ON) ON [Observations];
PRINT 'Create IX_Observation_AddedDate'
GO
CREATE INDEX [IX_Observation_AddedDate] ON [dbo].[Observation] ([SensorID], [AddedDate])
WITH(DROP_EXISTING=ON) ON [Observations];
PRINT 'Create IX_Observation_ValueDate'
GO
CREATE INDEX [IX_Observation_ValueDate] ON [dbo].[Observation] ([SensorID], [ValueDate])
WITH(DROP_EXISTING=ON) ON [Observations];
PRINT 'Create IX_Observation_StatusID'
GO
CREATE INDEX [IX_Observation_StatusID] ON [dbo].[Observation] ([StatusID])
WITH(DROP_EXISTING=ON) ON [Observations];
PRINT 'Create IX_Observation_StatusReasonID'
GO
CREATE INDEX [IX_Observation_StatusReasonID] ON [dbo].[Observation] ([StatusReasonID])
WITH(DROP_EXISTING=ON) ON [Observations];
PRINT 'Done'
GO
| 38.826087
| 174
| 0.792609
|
c6f6d3fd555f96b503f5a8a51e465811afb7ba6a
| 5,240
|
py
|
Python
|
datahub/investment/project/test/test_signals.py
|
Staberinde/data-hub-api
|
3d0467dbceaf62a47158eea412a3dba827073300
|
[
"MIT"
] | 6
|
2019-12-02T16:11:24.000Z
|
2022-03-18T10:02:02.000Z
|
datahub/investment/project/test/test_signals.py
|
Staberinde/data-hub-api
|
3d0467dbceaf62a47158eea412a3dba827073300
|
[
"MIT"
] | 1,696
|
2019-10-31T14:08:37.000Z
|
2022-03-29T12:35:57.000Z
|
datahub/investment/project/test/test_signals.py
|
Staberinde/data-hub-api
|
3d0467dbceaf62a47158eea412a3dba827073300
|
[
"MIT"
] | 9
|
2019-11-22T12:42:03.000Z
|
2021-09-03T14:25:05.000Z
|
from unittest.mock import Mock
import pytest
from datahub.company.test.factories import CompanyFactory
from datahub.core.constants import (
Country as CountryConstant,
InvestmentProjectStage as InvestmentProjectStageConstant,
)
from datahub.core.test_utils import random_obj_for_model
from datahub.investment.project.test.factories import InvestmentProjectFactory
from datahub.metadata.models import InvestmentBusinessActivity
@pytest.mark.django_db
class TestUpdateGVAOnBusinessActivitiesM2MChanged:
"""
Tests for the update_gross_value_added_on_project_business_activities_m2m_changed
signal receiver.
"""
def test_add(self, monkeypatch):
"""
Test that the GVA of a project is updated when a business activity is added to the
project.
"""
project = InvestmentProjectFactory()
set_gross_value_added_for_investment_project_mock = Mock()
monkeypatch.setattr(
'datahub.investment.project.signals.set_gross_value_added_for_investment_project',
set_gross_value_added_for_investment_project_mock,
)
business_activity = random_obj_for_model(InvestmentBusinessActivity)
project.business_activities.add(business_activity)
set_gross_value_added_for_investment_project_mock.assert_called_once_with(project)
def test_remove(self, monkeypatch):
"""
Test that the GVA of a project is updated when a business activity is removed from
the project.
"""
business_activity = random_obj_for_model(InvestmentBusinessActivity)
project = InvestmentProjectFactory(business_activities=[business_activity])
set_gross_value_added_for_investment_project_mock = Mock()
monkeypatch.setattr(
'datahub.investment.project.signals.set_gross_value_added_for_investment_project',
set_gross_value_added_for_investment_project_mock,
)
project.business_activities.remove(business_activity)
set_gross_value_added_for_investment_project_mock.assert_called_once_with(project)
def test_clear(self, monkeypatch):
"""Test that the GVA of a project is updated when its business activities are cleared."""
business_activity = random_obj_for_model(InvestmentBusinessActivity)
project = InvestmentProjectFactory(business_activities=[business_activity])
set_gross_value_added_for_investment_project_mock = Mock()
monkeypatch.setattr(
'datahub.investment.project.signals.set_gross_value_added_for_investment_project',
set_gross_value_added_for_investment_project_mock,
)
project.business_activities.clear()
set_gross_value_added_for_investment_project_mock.assert_called_once_with(project)
@pytest.mark.django_db
class TestInvestorCompanyUpdate:
"""
Tests for the update_country_investment_originates_from_post_save signal receiver.
"""
def test_update_investor_company_updates_country_of_origin_for_in_progress_project(self):
"""
Test that in progress investment projects' country investment originates from field
is updated when corresponding investor company address country is updated.
"""
investor_company = CompanyFactory(
address_country_id=CountryConstant.japan.value.id,
)
projects = InvestmentProjectFactory.create_batch(
2,
investor_company=investor_company,
stage_id=InvestmentProjectStageConstant.prospect.value.id,
)
for project in projects:
assert (
str(project.country_investment_originates_from_id)
== CountryConstant.japan.value.id
)
investor_company.address_country_id = CountryConstant.united_states.value.id
investor_company.save()
for project in projects:
project.refresh_from_db()
assert (
str(project.country_investment_originates_from_id)
== CountryConstant.united_states.value.id
)
def test_update_investor_company_doesnt_update_country_of_origin_for_won_project(self):
"""
Test that won investment projects' country investment originates from field
is not updated when corresponding investor company address country is updated.
"""
investor_company = CompanyFactory(
address_country_id=CountryConstant.japan.value.id,
)
projects = InvestmentProjectFactory.create_batch(
2,
investor_company=investor_company,
stage_id=InvestmentProjectStageConstant.won.value.id,
)
for project in projects:
assert (
str(project.country_investment_originates_from_id)
== CountryConstant.japan.value.id
)
investor_company.address_country_id = CountryConstant.united_states.value.id
investor_company.save()
for project in projects:
project.refresh_from_db()
assert (
str(project.country_investment_originates_from_id)
== CountryConstant.japan.value.id
)
| 37.697842
| 97
| 0.712595
|
c6844c750d43ad925e651c20d49595d8ff367eef
| 446
|
py
|
Python
|
tests/test_cipher.py
|
shukurovasif/Python
|
1e0b9f8d1b02d27e5fee731dbb78d05c05a23f8b
|
[
"MIT"
] | null | null | null |
tests/test_cipher.py
|
shukurovasif/Python
|
1e0b9f8d1b02d27e5fee731dbb78d05c05a23f8b
|
[
"MIT"
] | null | null | null |
tests/test_cipher.py
|
shukurovasif/Python
|
1e0b9f8d1b02d27e5fee731dbb78d05c05a23f8b
|
[
"MIT"
] | null | null | null |
import unittest
from src.caesar_cipher.caesar_cipher import Caesar
class CipherTest(unittest.TestCase):
def setUp(self):
self.caesar = Caesar(1, 'abc')
def test_encrypt(self):
encrypted = self.caesar.encrypt()
self.assertEqual(encrypted, 'bcd')
def test_decrypt(self):
self.caesar.encrypt()
decrypted = self.caesar.decrypt()
self.assertEqual(decrypted, 'abc')
| 23.473684
| 50
| 0.634529
|
259d47fe5927586c8cc07ce5f3ae1b6e6f4b6fc0
| 1,204
|
cs
|
C#
|
Activation usein email/Defaull.aspx.cs
|
tebyaniyan/Activation-usein-email
|
1151c6716d9f358d689b29f457eafe69934686ab
|
[
"MIT"
] | null | null | null |
Activation usein email/Defaull.aspx.cs
|
tebyaniyan/Activation-usein-email
|
1151c6716d9f358d689b29f457eafe69934686ab
|
[
"MIT"
] | null | null | null |
Activation usein email/Defaull.aspx.cs
|
tebyaniyan/Activation-usein-email
|
1151c6716d9f358d689b29f457eafe69934686ab
|
[
"MIT"
] | null | null | null |
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Activation usein email.Models;
namespace Activation usein email
{
public partial class Defaull : System.Web.UI.Page
{
private Models.ActiveUserBayEmailEntities db = new ActiveUserBayEmailEntities();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSendActivelink_OnClick(object sender, EventArgs e)
{
var guid = Guid.NewGuid().ToString().Replace("-", "");
db.Tbl_User.Add(new Tbl_User()
{
Email = txtEmail.Text,
ActiveCod = guid,
IsActive = false,
});
db.SaveChanges();
var domainName = "http://" + Request.Url.Authority;
string body = "<div style='direction:rtl; text-align:right;'>";
body += "<li><a href="+ domainName+"/ActiveUser/" + guid + "></a>کلیک کنید</li>";
body += "</div>";
SendMail.SendEmailGmail.Send(txtEmail.Text, "لینک فعال سازی", body);
}
}
}
| 29.365854
| 93
| 0.580565
|
6bcff6e7310a7d6064c044a6713ea75aa29e8d46
| 1,398
|
cpp
|
C++
|
Src/Controller/CV/WallCVGenerator.cpp
|
sh4869/Culverton
|
14ba42b29c38ec8bcb8c385c17b93a45e02b37ed
|
[
"MIT"
] | 1
|
2017-10-24T03:16:53.000Z
|
2017-10-24T03:16:53.000Z
|
Src/Controller/CV/WallCVGenerator.cpp
|
sh4869/Culverton
|
14ba42b29c38ec8bcb8c385c17b93a45e02b37ed
|
[
"MIT"
] | 3
|
2017-11-11T19:27:16.000Z
|
2017-11-15T02:30:14.000Z
|
Src/Controller/CV/WallCVGenerator.cpp
|
sh4869/Culverton
|
14ba42b29c38ec8bcb8c385c17b93a45e02b37ed
|
[
"MIT"
] | null | null | null |
#include "WallCVGenerator.h"
WallCVGenerator::WallCVGenerator(PIDParams _params)
: pidController(std::unique_ptr<PIDController>(new PIDController(_params))),
sensorController(SensorController::GetInstance()) {}
// 右の値が大きいほど(つまり壁に近いほど)大きな値が返るようになっている
float WallCVGenerator::Update() {
switch (GetStatus()) {
case WallCVStatus::RIGHT_AND_LEFT:
return pidController->Update(
static_cast<float>(
sensorController->GetDiffFromNormal(SensorNumber::FRONT_RIGHT) -
sensorController->GetDiffFromNormal(SensorNumber::FRONT_LEFT)),
0);
case WallCVStatus::RIGHT:
return pidController->Update(
static_cast<float>(
sensorController->GetDiffFromNormal(SensorNumber::FRONT_RIGHT) * 2),
0);
case WallCVStatus::LEFT:
return pidController->Update(
static_cast<float>(
-sensorController->GetDiffFromNormal(SensorNumber::FRONT_LEFT) * 2),
0);
case WallCVStatus::NONE:
return 0.0f;
default:
return 0.0f;
}
}
WallCVGenerator::WallCVStatus WallCVGenerator::GetStatus() {
// TODO : この辺の実装(多分SensorControllerも同時に実装しなおさないと無理)
return WallCVStatus::RIGHT_AND_LEFT;
}
| 38.833333
| 96
| 0.600858
|
2cda2623e923f4dc411d197b1b6e215b64a3f9aa
| 35,118
|
cpp
|
C++
|
hip/hip/kernels/share/qDataUpdateS.cpp
|
artv3/Laghos
|
64449d427349b0ca35086a63ae4e7d1ed5894f08
|
[
"BSD-2-Clause"
] | 1
|
2019-11-20T21:45:18.000Z
|
2019-11-20T21:45:18.000Z
|
hip/hip/kernels/share/qDataUpdateS.cpp
|
jeffhammond/Laghos
|
12e62aa7eb6175f27380106b40c9286d710a0f52
|
[
"BSD-2-Clause"
] | null | null | null |
hip/hip/kernels/share/qDataUpdateS.cpp
|
jeffhammond/Laghos
|
12e62aa7eb6175f27380106b40c9286d710a0f52
|
[
"BSD-2-Clause"
] | null | null | null |
// Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at
// the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights
// reserved. See files LICENSE and NOTICE for details.
//
// This file is part of CEED, a collection of benchmarks, miniapps, software
// libraries and APIs for efficient high-order finite element and spectral
// element discretizations for exascale applications. For more information and
// source code availability see http://github.com/ceed.
//
// The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
// a collaborative effort of two U.S. Department of Energy organizations (Office
// of Science and the National Nuclear Security Administration) responsible for
// the planning and preparation of a capable exascale ecosystem, including
// software, applications, hardware, advanced system engineering and early
// testbed platforms, in support of the nation's exascale computing imperative.
#include "../hip.hpp"
// *****************************************************************************
template<const int NUM_DIM,
const int NUM_QUAD,
const int NUM_QUAD_1D,
const int NUM_DOFS_1D> kernel
void rUpdateQuadratureData2S(const double GAMMA,
const double H0,
const double CFL,
const bool USE_VISCOSITY,
const int numElements,
const double* restrict dofToQuad,
const double* restrict dofToQuadD,
const double* restrict quadWeights,
const double* restrict v,
const double* restrict e,
const double* restrict rho0DetJ0w,
const double* restrict invJ0,
const double* restrict J,
const double* restrict invJ,
const double* restrict detJ,
double* restrict stressJinvT,
double* restrict dtEst)
{
const int NUM_QUAD_2D = NUM_QUAD_1D*NUM_QUAD_1D;
const int NUM_QUAD_DOFS_1D = (NUM_QUAD_1D * NUM_DOFS_1D);
const int NUM_MAX_1D = (NUM_QUAD_1D<NUM_DOFS_1D)?NUM_DOFS_1D:NUM_QUAD_1D;
const int idx = blockIdx.x;
const int el = idx;
if (el < numElements)
{
share double s_dofToQuad[NUM_QUAD_DOFS_1D];//@dim(NUM_QUAD_1D, NUM_DOFS_1D);
share double s_dofToQuadD[NUM_QUAD_DOFS_1D];//@dim(NUM_QUAD_1D, NUM_DOFS_1D);
share double s_xy[NUM_DIM *
NUM_QUAD_DOFS_1D];//@dim(NUM_DIM, NUM_DOFS_1D, NUM_QUAD_1D);
share double s_xDy[NUM_DIM *
NUM_QUAD_DOFS_1D];//@dim(NUM_DIM, NUM_DOFS_1D, NUM_QUAD_1D);
share double s_gradv[NUM_DIM * NUM_DIM *
NUM_QUAD_2D];//@dim(NUM_DIM, NUM_DIM, NUM_QUAD_2D);
double r_v[NUM_DIM * NUM_DOFS_1D];//@dim(NUM_DIM, NUM_DOFS_1D);
{
const int x = threadIdx.x;
for (int id = x; id < NUM_QUAD_DOFS_1D; id += NUM_MAX_1D)
{
s_dofToQuad[id] = dofToQuad[id];
s_dofToQuadD[id] = dofToQuadD[id];
}
}
sync;
{
const int dx = threadIdx.x;
if (dx < NUM_DOFS_1D)
{
for (int qy = 0; qy < NUM_QUAD_1D; ++qy)
{
for (int vi = 0; vi < NUM_DIM; ++vi)
{
s_xy[ijkNM(vi, dx, qy,NUM_DIM,NUM_DOFS_1D)] = 0;
s_xDy[ijkNM(vi, dx, qy,NUM_DIM,NUM_DOFS_1D)] = 0;
}
}
for (int dy = 0; dy < NUM_DOFS_1D; ++dy)
{
for (int vi = 0; vi < NUM_DIM; ++vi)
{
r_v[ijN(vi, dy,NUM_DIM)] = v[_ijklNM(vi,dx,dy,el,NUM_DOFS_1D,numElements)];
}
}
for (int qy = 0; qy < NUM_QUAD_1D; ++qy)
{
double xy[NUM_DIM];
double xDy[NUM_DIM];
for (int vi = 0; vi < NUM_DIM; ++vi)
{
xy[vi] = 0;
xDy[vi] = 0;
}
for (int dy = 0; dy < NUM_DOFS_1D; ++dy)
{
for (int vi = 0; vi < NUM_DIM; ++vi)
{
xy[vi] += r_v[ijN(vi, dy,NUM_DIM)] * s_dofToQuad[ijN(qy,dy,NUM_QUAD_1D)];
xDy[vi] += r_v[ijN(vi, dy,NUM_DIM)] * s_dofToQuadD[ijN(qy,dy,NUM_QUAD_1D)];
}
}
for (int vi = 0; vi < NUM_DIM; ++vi)
{
s_xy[ijkNM(vi, dx, qy,NUM_DIM,NUM_DOFS_1D)] = xy[vi];
s_xDy[ijkNM(vi, dx, qy,NUM_DIM,NUM_DOFS_1D)] = xDy[vi];
}
}
}
}
sync;
{
const int qy = threadIdx.x;
if (qy < NUM_QUAD_1D)
{
for (int qx = 0; qx < NUM_MAX_1D; ++qx)
{
double gradX[NUM_DIM];
double gradY[NUM_DIM];
for (int vi = 0; vi < NUM_DIM; ++vi)
{
gradX[vi] = 0;
gradY[vi] = 0;
}
for (int dx = 0; dx < NUM_DOFS_1D; ++dx)
{
for (int vi = 0; vi < NUM_DIM; ++vi)
{
gradX[vi] += s_xy[ijkNM(vi, dx, qy,NUM_DIM,NUM_DOFS_1D)] * s_dofToQuadD[ijN(qx,
dx,NUM_QUAD_1D)];
gradY[vi] += s_xDy[ijkNM(vi, dx, qy,NUM_DIM,NUM_DOFS_1D)] * s_dofToQuad[ijN(qx,
dx,NUM_QUAD_1D)];
}
}
for (int vi = 0; vi < NUM_DIM; ++vi)
{
s_gradv[ijkN(vi, 0, qx + qy*NUM_QUAD_1D,NUM_DIM)] = gradX[vi];
s_gradv[ijkN(vi, 1, qx + qy*NUM_QUAD_1D,NUM_DIM)] = gradY[vi];
}
}
}
}
sync;
{
const int qBlock = threadIdx.x;
for (int q = qBlock; q < NUM_QUAD; q += NUM_MAX_1D)
{
double q_gradv[NUM_DIM * NUM_DIM];//@dim(NUM_DIM, NUM_DIM);
double q_stress[NUM_DIM * NUM_DIM];//@dim(NUM_DIM, NUM_DIM);
const double invJ_00 = invJ[ijklNM(0,0,q,el,NUM_DIM,NUM_QUAD)];
const double invJ_10 = invJ[ijklNM(1,0,q,el,NUM_DIM,NUM_QUAD)];
const double invJ_01 = invJ[ijklNM(0,1,q,el,NUM_DIM,NUM_QUAD)];
const double invJ_11 = invJ[ijklNM(1,1,q,el,NUM_DIM,NUM_QUAD)];
q_gradv[ijN(0,0,2)] = ((s_gradv[ijkN(0,0,q,2)]*invJ_00) + (s_gradv[ijkN(1,0,q,
2)]*invJ_01));
q_gradv[ijN(1,0,2)] = ((s_gradv[ijkN(0,0,q,2)]*invJ_10) + (s_gradv[ijkN(1,0,q,
2)]*invJ_11));
q_gradv[ijN(0,1,2)] = ((s_gradv[ijkN(0,1,q,2)]*invJ_00) + (s_gradv[ijkN(1,1,q,
2)]*invJ_01));
q_gradv[ijN(1,1,2)] = ((s_gradv[ijkN(0,1,q,2)]*invJ_10) + (s_gradv[ijkN(1,1,q,
2)]*invJ_11));
const double q_Jw = detJ[ijN(q,el,NUM_QUAD)]*quadWeights[q];
const double q_rho = rho0DetJ0w[ijN(q,el,NUM_QUAD)]/q_Jw;
const double q_e = fmax(0.0,e[ijN(q,el,NUM_QUAD)]);
// TODO: Input OccaVector eos(q,e) -> (stress, soundSpeed)
const double s = -(GAMMA - 1.0) * q_rho * q_e;
q_stress[ijN(0,0,2)] = s; q_stress[ijN(1,0,2)] = 0;
q_stress[ijN(0,1,2)] = 0; q_stress[ijN(1,1,2)] = s;
const double gradv00 = q_gradv[ijN(0,0,2)];
const double gradv11 = q_gradv[ijN(1,1,2)];
const double gradv10 = 0.5 * (q_gradv[ijN(1,0,2)] + q_gradv[ijN(0,1,2)]);
q_gradv[ijN(1,0,2)] = gradv10;
q_gradv[ijN(0,1,2)] = gradv10;
double comprDirX = 1;
double comprDirY = 0;
double minEig = 0;
// linalg/densemat.cpp: Eigensystem2S()
if (gradv10 == 0)
{
minEig = (gradv00 < gradv11) ? gradv00 : gradv11;
}
else
{
const double zeta = (gradv11 - gradv00) / (2.0 * gradv10);
const double azeta = fabs(zeta);
double t = 1.0 / (azeta + sqrt(1.0 + zeta*zeta));
if ((t < 0) != (zeta < 0))
{
t = -t;
}
const double c = sqrt(1.0 / (1.0 + t*t));
const double s = c * t;
t *= gradv10;
if ((gradv00 - t) <= (gradv11 + t))
{
minEig = gradv00 - t;
comprDirX = c;
comprDirY = -s;
}
else
{
minEig = gradv11 + t;
comprDirX = s;
comprDirY = c;
}
}
// Computes the initial->physical transformation Jacobian.
const double J_00 = J[ijklNM(0,0,q,el,NUM_DIM,NUM_QUAD)];
const double J_10 = J[ijklNM(1,0,q,el,NUM_DIM,NUM_QUAD)];
const double J_01 = J[ijklNM(0,1,q,el,NUM_DIM,NUM_QUAD)];
const double J_11 = J[ijklNM(1,1,q,el,NUM_DIM,NUM_QUAD)];
const double invJ0_00 = invJ0[ijklNM(0,0,q,el,NUM_DIM,NUM_QUAD)];
const double invJ0_10 = invJ0[ijklNM(1,0,q,el,NUM_DIM,NUM_QUAD)];
const double invJ0_01 = invJ0[ijklNM(0,1,q,el,NUM_DIM,NUM_QUAD)];
const double invJ0_11 = invJ0[ijklNM(1,1,q,el,NUM_DIM,NUM_QUAD)];
const double Jpi_00 = ((J_00 * invJ0_00) + (J_10 * invJ0_01));
const double Jpi_10 = ((J_00 * invJ0_10) + (J_10 * invJ0_11));
const double Jpi_01 = ((J_01 * invJ0_00) + (J_11 * invJ0_01));
const double Jpi_11 = ((J_01 * invJ0_10) + (J_11 * invJ0_11));
const double physDirX = (Jpi_00 * comprDirX) + (Jpi_10 * comprDirY);
const double physDirY = (Jpi_01 * comprDirX) + (Jpi_11 * comprDirY);
const double q_h = H0 * sqrt((physDirX * physDirX) + (physDirY * physDirY));
// TODO: soundSpeed will be an input as well (function call or values per q)
const double soundSpeed = sqrt(GAMMA * (GAMMA - 1.0) * q_e);
dtEst[ijN(q, el,NUM_QUAD)] = CFL * q_h / soundSpeed;
if (USE_VISCOSITY)
{
// TODO: Check how we can extract outside of kernel
const double mu = minEig;
double coeff = 2.0 * q_rho * q_h * q_h * fabs(mu);
if (mu < 0)
{
coeff += 0.5 * q_rho * q_h * soundSpeed;
}
for (int y = 0; y < NUM_DIM; ++y)
{
for (int x = 0; x < NUM_DIM; ++x)
{
q_stress[ijN(x,y,2)] += coeff * q_gradv[ijN(x,y,2)];
}
}
}
const double S00 = q_stress[ijN(0,0,2)];
const double S10 = q_stress[ijN(1,0,2)];
const double S01 = q_stress[ijN(0,1,2)];
const double S11 = q_stress[ijN(1,1,2)];
stressJinvT[ijklNM(0,0,q,el,NUM_DIM,
NUM_QUAD)] = q_Jw * ((S00 * invJ_00) + (S10 * invJ_01));
stressJinvT[ijklNM(1,0,q,el,NUM_DIM,
NUM_QUAD)] = q_Jw * ((S00 * invJ_10) + (S10 * invJ_11));
stressJinvT[ijklNM(0,1,q,el,NUM_DIM,
NUM_QUAD)] = q_Jw * ((S01 * invJ_00) + (S11 * invJ_01));
stressJinvT[ijklNM(1,1,q,el,NUM_DIM,
NUM_QUAD)] = q_Jw * ((S01 * invJ_10) + (S11 * invJ_11));
}
}
}
}
// *****************************************************************************
template<const int NUM_DIM,
const int NUM_QUAD,
const int NUM_QUAD_1D,
const int NUM_DOFS_1D> kernel
void rUpdateQuadratureData3S(const double GAMMA,
const double H0,
const double CFL,
const bool USE_VISCOSITY,
const int numElements,
const double* restrict dofToQuad,
const double* restrict dofToQuadD,
const double* restrict quadWeights,
const double* restrict v,
const double* restrict e,
const double* restrict rho0DetJ0w,
const double* restrict invJ0,
const double* restrict J,
const double* restrict invJ,
const double* restrict detJ,
double* restrict stressJinvT,
double* restrict dtEst)
{
const int NUM_QUAD_2D = NUM_QUAD_1D*NUM_QUAD_1D;
const int NUM_QUAD_DOFS_1D = (NUM_QUAD_1D * NUM_DOFS_1D);
const int el = blockIdx.x;
if (el < numElements)
{
share double s_dofToQuad[NUM_QUAD_DOFS_1D];
share double s_dofToQuadD[NUM_QUAD_DOFS_1D];
{
const int y = threadIdx.y;
{
const int x = threadIdx.x;
const int id = (y * NUM_QUAD_1D) + x;
for (int i = id; i < (NUM_DOFS_1D * NUM_QUAD_1D); i += NUM_QUAD_2D)
{
s_dofToQuad[id] = dofToQuad[id];
s_dofToQuadD[id] = dofToQuadD[id];
}
}
}
sync;
for (int qz = 0; qz < NUM_QUAD_1D; ++qz)
{
{
const int qy = threadIdx.y;
{
const int qx = 0 + threadIdx.x;
const int q = qx + qy*NUM_QUAD_1D + qz*NUM_QUAD_2D;
double gradv[9];
double q_gradv[9];
double q_stress[9];
// Brute-force convertion of dof -> quad for now
for (int i = 0; i < 9; ++i)
{
gradv[i] = 0;
}
for (int dz = 0; dz < NUM_DOFS_1D; ++dz)
{
double xy[3];
double Dxy[3];
double xDy[3];
for (int vi = 0; vi < 3; ++vi)
{
xy[vi] = Dxy[vi] = xDy[vi] = 0;
}
for (int dy = 0; dy < NUM_DOFS_1D; ++dy)
{
double x[3];
double Dx[3];
for (int vi = 0; vi < 3; ++vi)
{
x[vi] = Dx[vi] = 0;
}
for (int dx = 0; dx < NUM_DOFS_1D; ++dx)
{
const double wx = s_dofToQuad[ijN(qx,dx,NUM_QUAD_1D)];
const double wDx = s_dofToQuadD[ijN(qx,dx,NUM_QUAD_1D)];
for (int vi = 0; vi < 3; ++vi)
{
const double r_v = v[_ijklmNM(vi,dx,dy,dz,el,NUM_DOFS_1D,numElements)];
x[vi] += wx * r_v;
Dx[vi] += wDx * r_v;
}
}
const double wy = s_dofToQuad[ijN(qy,dy,NUM_QUAD_1D)];
const double wDy = s_dofToQuadD[ijN(qy,dy,NUM_QUAD_1D)];
for (int vi = 0; vi < 3; ++vi)
{
xy[vi] += wy * x[vi];
Dxy[vi] += wy * Dx[vi];
xDy[vi] += wDy * x[vi];
}
}
const double wz = s_dofToQuad[ijN(qz,dz,NUM_QUAD_1D)];
const double wDz = s_dofToQuadD[ijN(qz,dz,NUM_QUAD_1D)];
for (int vi = 0; vi < 3; ++vi)
{
gradv[ijN(vi,0,3)] += wz * Dxy[vi];
gradv[ijN(vi,1,3)] += wz * xDy[vi];
gradv[ijN(vi,2,3)] += wDz * xy[vi];
}
}
const double invJ_00 = invJ[ijklNM(0, 0, q, el,NUM_DIM,NUM_QUAD)];
const double invJ_10 = invJ[ijklNM(1, 0, q, el,NUM_DIM,NUM_QUAD)];
const double invJ_20 = invJ[ijklNM(2, 0, q, el,NUM_DIM,NUM_QUAD)];
const double invJ_01 = invJ[ijklNM(0, 1, q, el,NUM_DIM,NUM_QUAD)];
const double invJ_11 = invJ[ijklNM(1, 1, q, el,NUM_DIM,NUM_QUAD)];
const double invJ_21 = invJ[ijklNM(2, 1, q, el,NUM_DIM,NUM_QUAD)];
const double invJ_02 = invJ[ijklNM(0, 2, q, el,NUM_DIM,NUM_QUAD)];
const double invJ_12 = invJ[ijklNM(1, 2, q, el,NUM_DIM,NUM_QUAD)];
const double invJ_22 = invJ[ijklNM(2, 2, q, el,NUM_DIM,NUM_QUAD)];
q_gradv[ijN(0,0,3)] = ((gradv[ijN(0,0,3)] * invJ_00) + (gradv[ijN(1,0,
3)] * invJ_01) + (gradv[ijN(2,0,3)] * invJ_02));
q_gradv[ijN(1,0,3)] = ((gradv[ijN(0,0,3)] * invJ_10) + (gradv[ijN(1,0,
3)] * invJ_11) + (gradv[ijN(2,0,3)] * invJ_12));
q_gradv[ijN(2,0,3)] = ((gradv[ijN(0,0,3)] * invJ_20) + (gradv[ijN(1,0,
3)] * invJ_21) + (gradv[ijN(2,0,3)] * invJ_22));
q_gradv[ijN(0,1,3)] = ((gradv[ijN(0,1,3)] * invJ_00) + (gradv[ijN(1,1,
3)] * invJ_01) + (gradv[ijN(2,1,3)] * invJ_02));
q_gradv[ijN(1,1,3)] = ((gradv[ijN(0,1,3)] * invJ_10) + (gradv[ijN(1,1,
3)] * invJ_11) + (gradv[ijN(2,1,3)] * invJ_12));
q_gradv[ijN(2,1,3)] = ((gradv[ijN(0,1,3)] * invJ_20) + (gradv[ijN(1,1,
3)] * invJ_21) + (gradv[ijN(2,1,3)] * invJ_22));
q_gradv[ijN(0,2,3)] = ((gradv[ijN(0,2,3)] * invJ_00) + (gradv[ijN(1,2,
3)] * invJ_01) + (gradv[ijN(2,2,3)] * invJ_02));
q_gradv[ijN(1,2,3)] = ((gradv[ijN(0,2,3)] * invJ_10) + (gradv[ijN(1,2,
3)] * invJ_11) + (gradv[ijN(2,2,3)] * invJ_12));
q_gradv[ijN(2,2,3)] = ((gradv[ijN(0,2,3)] * invJ_20) + (gradv[ijN(1,2,
3)] * invJ_21) + (gradv[ijN(2,2,3)] * invJ_22));
const double q_Jw = detJ[ijN(q,el,NUM_QUAD)] * quadWeights[q];
const double q_rho = rho0DetJ0w[ijN(q,el,NUM_QUAD)] / q_Jw;
const double q_e = fmax(0.0, e[ijN(q,el,NUM_QUAD)]);
const double s = -(GAMMA - 1.0) * q_rho * q_e;
q_stress[ijN(0, 0,3)] = s; q_stress[ijN(1, 0,3)] = 0; q_stress[ijN(2, 0,3)] = 0;
q_stress[ijN(0, 1,3)] = 0; q_stress[ijN(1, 1,3)] = s; q_stress[ijN(2, 1,3)] = 0;
q_stress[ijN(0, 2,3)] = 0; q_stress[ijN(1, 2,3)] = 0; q_stress[ijN(2, 2,3)] = s;
const double gradv00 = q_gradv[ijN(0, 0,3)];
const double gradv11 = q_gradv[ijN(1, 1,3)];
const double gradv22 = q_gradv[ijN(2, 2,3)];
const double gradv10 = 0.5 * (q_gradv[ijN(1, 0,3)] + q_gradv[ijN(0, 1,3)]);
const double gradv20 = 0.5 * (q_gradv[ijN(2, 0,3)] + q_gradv[ijN(0, 2,3)]);
const double gradv21 = 0.5 * (q_gradv[ijN(2, 1,3)] + q_gradv[ijN(1, 2,3)]);
q_gradv[ijN(1, 0,3)] = gradv10; q_gradv[ijN(2, 0,3)] = gradv20;
q_gradv[ijN(0, 1,3)] = gradv10; q_gradv[ijN(2, 1,3)] = gradv21;
q_gradv[ijN(0, 2,3)] = gradv20; q_gradv[ijN(1, 2,3)] = gradv21;
double minEig = 0;
double comprDirX = 1;
double comprDirY = 0;
double comprDirZ = 0;
{
// Compute eigenvalues using quadrature formula
const double q_ = (gradv00 + gradv11 + gradv22) / 3.0;
const double gradv_q00 = (gradv00 - q_);
const double gradv_q11 = (gradv11 - q_);
const double gradv_q22 = (gradv22 - q_);
const double p1 = ((gradv10 * gradv10) +
(gradv20 * gradv20) +
(gradv21 * gradv21));
const double p2 = ((gradv_q00 * gradv_q00) +
(gradv_q11 * gradv_q11) +
(gradv_q22 * gradv_q22) +
(2.0 * p1));
const double p = sqrt(p2 / 6.0);
const double pinv = 1.0 / p;
// det(pinv * (gradv - q*I))
const double r = (0.5 * pinv * pinv * pinv *
((gradv_q00 * gradv_q11 * gradv_q22) +
(2.0 * gradv10 * gradv21 * gradv20) -
(gradv_q11 * gradv20 * gradv20) -
(gradv_q22 * gradv10 * gradv10) -
(gradv_q00 * gradv21 * gradv21)));
double phi = 0;
if (r <= -1.0)
{
phi = M_PI / 3.0;
}
else if (r < 1.0)
{
phi = acos(r) / 3.0;
}
minEig = q_ + (2.0 * p * cos(phi + (2.0 * M_PI / 3.0)));
const double eig3 = q_ + (2.0 * p * cos(phi));
const double eig2 = 3.0 * q_ - minEig - eig3;
double maxNorm = 0;
for (int i = 0; i < 3; ++i)
{
const double x = q_gradv[i + 3*0] - (i == 0)*eig3;
const double y = q_gradv[i + 3*1] - (i == 1)*eig3;
const double z = q_gradv[i + 3*2] - (i == 2)*eig3;
const double cx = ((x * (gradv00 - eig2)) +
(y * gradv10) +
(z * gradv20));
const double cy = ((x * gradv10) +
(y * (gradv11 - eig2)) +
(z * gradv21));
const double cz = ((x * gradv20) +
(y * gradv21) +
(z * (gradv22 - eig2)));
const double cNorm = (cx*cx + cy*cy + cz*cz);
if ((cNorm > 1e-16) && (maxNorm < cNorm))
{
comprDirX = cx;
comprDirY = cy;
comprDirZ = cz;
maxNorm = cNorm;
}
}
if (maxNorm > 1e-16)
{
const double maxNormInv = 1.0 / sqrt(maxNorm);
comprDirX *= maxNormInv;
comprDirY *= maxNormInv;
comprDirZ *= maxNormInv;
}
}
// Computes the initial->physical transformation Jacobian.
const double J_00 = J[ijklNM(0, 0, q, el,NUM_DIM,NUM_QUAD)];
const double J_10 = J[ijklNM(1, 0, q, el,NUM_DIM,NUM_QUAD)];
const double J_20 = J[ijklNM(2, 0, q, el,NUM_DIM,NUM_QUAD)];
const double J_01 = J[ijklNM(0, 1, q, el,NUM_DIM,NUM_QUAD)];
const double J_11 = J[ijklNM(1, 1, q, el,NUM_DIM,NUM_QUAD)];
const double J_21 = J[ijklNM(2, 1, q, el,NUM_DIM,NUM_QUAD)];
const double J_02 = J[ijklNM(0, 2, q, el,NUM_DIM,NUM_QUAD)];
const double J_12 = J[ijklNM(1, 2, q, el,NUM_DIM,NUM_QUAD)];
const double J_22 = J[ijklNM(2, 2, q, el,NUM_DIM,NUM_QUAD)];
const double invJ0_00 = invJ0[ijklNM(0, 0, q, el,NUM_DIM,NUM_QUAD)];
const double invJ0_10 = invJ0[ijklNM(1, 0, q, el,NUM_DIM,NUM_QUAD)];
const double invJ0_20 = invJ0[ijklNM(2, 0, q, el,NUM_DIM,NUM_QUAD)];
const double invJ0_01 = invJ0[ijklNM(0, 1, q, el,NUM_DIM,NUM_QUAD)];
const double invJ0_11 = invJ0[ijklNM(1, 1, q, el,NUM_DIM,NUM_QUAD)];
const double invJ0_21 = invJ0[ijklNM(2, 1, q, el,NUM_DIM,NUM_QUAD)];
const double invJ0_02 = invJ0[ijklNM(0, 2, q, el,NUM_DIM,NUM_QUAD)];
const double invJ0_12 = invJ0[ijklNM(1, 2, q, el,NUM_DIM,NUM_QUAD)];
const double invJ0_22 = invJ0[ijklNM(2, 2, q, el,NUM_DIM,NUM_QUAD)];
const double Jpi_00 = ((J_00 * invJ0_00) + (J_10 * invJ0_01) +
(J_20 * invJ0_02));
const double Jpi_10 = ((J_00 * invJ0_10) + (J_10 * invJ0_11) +
(J_20 * invJ0_12));
const double Jpi_20 = ((J_00 * invJ0_20) + (J_10 * invJ0_21) +
(J_20 * invJ0_22));
const double Jpi_01 = ((J_01 * invJ0_00) + (J_11 * invJ0_01) +
(J_21 * invJ0_02));
const double Jpi_11 = ((J_01 * invJ0_10) + (J_11 * invJ0_11) +
(J_21 * invJ0_12));
const double Jpi_21 = ((J_01 * invJ0_20) + (J_11 * invJ0_21) +
(J_21 * invJ0_22));
const double Jpi_02 = ((J_02 * invJ0_00) + (J_12 * invJ0_01) +
(J_22 * invJ0_02));
const double Jpi_12 = ((J_02 * invJ0_10) + (J_12 * invJ0_11) +
(J_22 * invJ0_12));
const double Jpi_22 = ((J_02 * invJ0_20) + (J_12 * invJ0_21) +
(J_22 * invJ0_22));
const double physDirX = ((Jpi_00 * comprDirX) + (Jpi_10 * comprDirY) +
(Jpi_20 * comprDirZ));
const double physDirY = ((Jpi_01 * comprDirX) + (Jpi_11 * comprDirY) +
(Jpi_21 * comprDirZ));
const double physDirZ = ((Jpi_02 * comprDirX) + (Jpi_12 * comprDirY) +
(Jpi_22 * comprDirZ));
const double q_h = H0 * sqrt((physDirX * physDirX) + (physDirY * physDirY) +
(physDirZ * physDirZ));
const double soundSpeed = sqrt(GAMMA * (GAMMA - 1.0) * q_e);
dtEst[ijN(q, el,NUM_QUAD)] = CFL * q_h / soundSpeed;
if (USE_VISCOSITY)
{
// TODO: Check how we can extract outside of kernel
const double mu = minEig;
double coeff = 2.0 * q_rho * q_h * q_h * fabs(mu);
if (mu < 0)
{
coeff += 0.5 * q_rho * q_h * soundSpeed;
}
for (int y = 0; y < 3; ++y)
{
for (int x = 0; x < 3; ++x)
{
q_stress[ijN(x, y,3)] += coeff * q_gradv[ijN(x, y,3)];
}
}
}
const double S00 = q_stress[ijN(0, 0,3)];
const double S10 = q_stress[ijN(1, 0,3)];
const double S20 = q_stress[ijN(2, 0,3)];
const double S01 = q_stress[ijN(0, 1,3)];
const double S11 = q_stress[ijN(1, 1,3)];
const double S21 = q_stress[ijN(2, 1,3)];
const double S02 = q_stress[ijN(0, 2,3)];
const double S12 = q_stress[ijN(1, 2,3)];
const double S22 = q_stress[ijN(2, 2,3)];
stressJinvT[ijklNM(0, 0, q, el,NUM_DIM,
NUM_QUAD)] = q_Jw * ((S00 * invJ_00) + (S10 * invJ_01) + (S20 * invJ_02));
stressJinvT[ijklNM(1, 0, q, el,NUM_DIM,
NUM_QUAD)] = q_Jw * ((S00 * invJ_10) + (S10 * invJ_11) + (S20 * invJ_12));
stressJinvT[ijklNM(2, 0, q, el,NUM_DIM,
NUM_QUAD)] = q_Jw * ((S00 * invJ_20) + (S10 * invJ_21) + (S20 * invJ_22));
stressJinvT[ijklNM(0, 1, q, el,NUM_DIM,
NUM_QUAD)] = q_Jw * ((S01 * invJ_00) + (S11 * invJ_01) + (S21 * invJ_02));
stressJinvT[ijklNM(1, 1, q, el,NUM_DIM,
NUM_QUAD)] = q_Jw * ((S01 * invJ_10) + (S11 * invJ_11) + (S21 * invJ_12));
stressJinvT[ijklNM(2, 1, q, el,NUM_DIM,
NUM_QUAD)] = q_Jw * ((S01 * invJ_20) + (S11 * invJ_21) + (S21 * invJ_22));
stressJinvT[ijklNM(0, 2, q, el,NUM_DIM,
NUM_QUAD)] = q_Jw * ((S02 * invJ_00) + (S12 * invJ_01) + (S22 * invJ_02));
stressJinvT[ijklNM(1, 2, q, el,NUM_DIM,
NUM_QUAD)] = q_Jw * ((S02 * invJ_10) + (S12 * invJ_11) + (S22 * invJ_12));
stressJinvT[ijklNM(2, 2, q, el,NUM_DIM,
NUM_QUAD)] = q_Jw * ((S02 * invJ_20) + (S12 * invJ_21) + (S22 * invJ_22));
}
}
}
}
}
// *****************************************************************************
typedef void (*fUpdateQuadratureDataS)(const double GAMMA,
const double H0,
const double CFL,
const bool USE_VISCOSITY,
const int numElements,
const double* restrict dofToQuad,
const double* restrict dofToQuadD,
const double* restrict quadWeights,
const double* restrict v,
const double* restrict e,
const double* restrict rho0DetJ0w,
const double* restrict invJ0,
const double* restrict J,
const double* restrict invJ,
const double* restrict detJ,
double* restrict stressJinvT,
double* restrict dtEst);
// *****************************************************************************
void rUpdateQuadratureDataS(const double GAMMA,
const double H0,
const double CFL,
const bool USE_VISCOSITY,
const int NUM_DIM,
const int NUM_QUAD,
const int NUM_QUAD_1D,
const int NUM_DOFS_1D,
const int nzones,
const double* restrict dofToQuad,
const double* restrict dofToQuadD,
const double* restrict quadWeights,
const double* restrict v,
const double* restrict e,
const double* restrict rho0DetJ0w,
const double* restrict invJ0,
const double* restrict J,
const double* restrict invJ,
const double* restrict detJ,
double* restrict stressJinvT,
double* restrict dtEst)
{
const int grid = nzones;
const int b1d = (NUM_QUAD_1D<NUM_DOFS_1D)?NUM_DOFS_1D:NUM_QUAD_1D;
const dim3 blck(b1d,b1d,1);
assert(LOG2(NUM_DIM)<=4);
assert(LOG2(NUM_DOFS_1D-2)<=4);
assert(NUM_QUAD_1D==2*(NUM_DOFS_1D-1));
assert(IROOT(NUM_DIM,NUM_QUAD)==NUM_QUAD_1D);
const unsigned int id = (NUM_DIM<<4)|(NUM_DOFS_1D-2);
static std::unordered_map<unsigned int,fUpdateQuadratureDataS> call =
{
// 2D
{0x20,&rUpdateQuadratureData2S<2,2*2,2,2>},
{0x21,&rUpdateQuadratureData2S<2,4*4,4,3>},
{0x22,&rUpdateQuadratureData2S<2,6*6,6,4>},
{0x23,&rUpdateQuadratureData2S<2,8*8,8,5>},
{0x24,&rUpdateQuadratureData2S<2,10*10,10,6>},
{0x25,&rUpdateQuadratureData2S<2,12*12,12,7>},
{0x26,&rUpdateQuadratureData2S<2,14*14,14,8>},
{0x27,&rUpdateQuadratureData2S<2,16*16,16,9>},
{0x28,&rUpdateQuadratureData2S<2,18*18,18,10>},
{0x29,&rUpdateQuadratureData2S<2,20*20,20,11>},
{0x2A,&rUpdateQuadratureData2S<2,22*22,22,12>},
{0x2B,&rUpdateQuadratureData2S<2,24*24,24,13>},
{0x2C,&rUpdateQuadratureData2S<2,26*26,26,14>},
{0x2D,&rUpdateQuadratureData2S<2,28*28,28,15>},
//{0x2E,&rUpdateQuadratureData2S<2,30*30,30,16>}, uses too much shared data
//{0x2F,&rUpdateQuadratureData2S<2,32*32,32,17>}, uses too much shared data
// 3D
{0x30,&rUpdateQuadratureData3S<3,2*2*2,2,2>},
{0x31,&rUpdateQuadratureData3S<3,4*4*4,4,3>},
{0x32,&rUpdateQuadratureData3S<3,6*6*6,6,4>},
{0x33,&rUpdateQuadratureData3S<3,8*8*8,8,5>},
{0x34,&rUpdateQuadratureData3S<3,10*10*10,10,6>},
{0x35,&rUpdateQuadratureData3S<3,12*12*12,12,7>},
{0x36,&rUpdateQuadratureData3S<3,14*14*14,14,8>},
{0x37,&rUpdateQuadratureData3S<3,16*16*16,16,9>},
{0x38,&rUpdateQuadratureData3S<3,18*18*18,18,10>},
{0x39,&rUpdateQuadratureData3S<3,20*20*20,20,11>},
{0x3A,&rUpdateQuadratureData3S<3,22*22*22,22,12>},
{0x3B,&rUpdateQuadratureData3S<3,24*24*24,24,13>},
{0x3C,&rUpdateQuadratureData3S<3,26*26*26,26,14>},
{0x3D,&rUpdateQuadratureData3S<3,28*28*28,28,15>},
{0x3E,&rUpdateQuadratureData3S<3,30*30*30,30,16>},
{0x3F,&rUpdateQuadratureData3S<3,32*32*32,32,17>},
};
if (!call[id])
{
printf("\n[rUpdateQuadratureDataS] id \033[33m0x%X\033[m ",id);
fflush(stdout);
}
assert(call[id]);
call0(id,grid,blck,
GAMMA,H0,CFL,USE_VISCOSITY,
nzones,dofToQuad,dofToQuadD,quadWeights,
v,e,rho0DetJ0w,invJ0,J,invJ,detJ,
stressJinvT,dtEst);
}
| 48.371901
| 129
| 0.440287
|
a170682b63c262654a7da13e14e7b38355ed6df9
| 213
|
swift
|
Swift
|
Sources/Pokepay/Responses/Error.swift
|
n-qwed/ios-sdk
|
0b5ca28d90e9f7b767c9fc760f62a4d5776e629a
|
[
"MIT"
] | 6
|
2018-10-11T06:35:59.000Z
|
2020-05-14T02:44:50.000Z
|
Sources/Pokepay/Responses/Error.swift
|
n-qwed/ios-sdk
|
0b5ca28d90e9f7b767c9fc760f62a4d5776e629a
|
[
"MIT"
] | 6
|
2018-12-05T07:47:01.000Z
|
2020-07-29T07:05:47.000Z
|
Sources/Pokepay/Responses/Error.swift
|
n-qwed/ios-sdk
|
0b5ca28d90e9f7b767c9fc760f62a4d5776e629a
|
[
"MIT"
] | 6
|
2019-09-14T07:49:04.000Z
|
2021-05-13T07:21:56.000Z
|
import Foundation
public struct APIError: Codable {
public let type: String
public let message: String
public let errors: String?
}
public struct OAuthError: Codable {
public let error: String
}
| 17.75
| 35
| 0.723005
|
e07c4d88196b75bf9bc39d8457e5c4eae6de7da1
| 8,749
|
h
|
C
|
opal/mca/pmix/pmix4x/openpmix/src/atomics/sys/gcc_builtin/atomic.h
|
isuruf/ompi
|
edcd6d8aebbeae986eae1d236adb11ee71f1ce3c
|
[
"BSD-3-Clause-Open-MPI"
] | 20
|
2020-04-20T15:50:19.000Z
|
2021-09-03T09:17:23.000Z
|
opal/mca/pmix/pmix4x/openpmix/src/atomics/sys/gcc_builtin/atomic.h
|
isuruf/ompi
|
edcd6d8aebbeae986eae1d236adb11ee71f1ce3c
|
[
"BSD-3-Clause-Open-MPI"
] | 13
|
2020-11-01T18:16:03.000Z
|
2022-03-08T01:33:02.000Z
|
opal/mca/pmix/pmix4x/openpmix/src/atomics/sys/gcc_builtin/atomic.h
|
isuruf/ompi
|
edcd6d8aebbeae986eae1d236adb11ee71f1ce3c
|
[
"BSD-3-Clause-Open-MPI"
] | 29
|
2020-05-12T02:12:11.000Z
|
2021-08-30T02:04:39.000Z
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2013 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Triad National Security, LLC. All rights
* reserved.
* Copyright (c) 2018 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PMIX_SYS_ARCH_ATOMIC_H
#define PMIX_SYS_ARCH_ATOMIC_H 1
/**********************************************************************
*
* Memory Barriers
*
*********************************************************************/
#define PMIX_HAVE_ATOMIC_MEM_BARRIER 1
#define PMIX_HAVE_ATOMIC_MATH_32 1
#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_32 1
#define PMIX_HAVE_ATOMIC_ADD_32 1
#define PMIX_HAVE_ATOMIC_AND_32 1
#define PMIX_HAVE_ATOMIC_OR_32 1
#define PMIX_HAVE_ATOMIC_XOR_32 1
#define PMIX_HAVE_ATOMIC_SUB_32 1
#define PMIX_HAVE_ATOMIC_SWAP_32 1
#define PMIX_HAVE_ATOMIC_MATH_64 1
#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_64 1
#define PMIX_HAVE_ATOMIC_ADD_64 1
#define PMIX_HAVE_ATOMIC_AND_64 1
#define PMIX_HAVE_ATOMIC_OR_64 1
#define PMIX_HAVE_ATOMIC_XOR_64 1
#define PMIX_HAVE_ATOMIC_SUB_64 1
#define PMIX_HAVE_ATOMIC_SWAP_64 1
static inline void pmix_atomic_mb(void)
{
__atomic_thread_fence (__ATOMIC_SEQ_CST);
}
static inline void pmix_atomic_rmb(void)
{
#if PMIX_ASSEMBLY_ARCH == PMIX_X86_64
/* work around a bug in older gcc versions where ACQUIRE seems to get
* treated as a no-op instead of being equivalent to
* __asm__ __volatile__("": : :"memory") */
__atomic_thread_fence (__ATOMIC_SEQ_CST);
#else
__atomic_thread_fence (__ATOMIC_ACQUIRE);
#endif
}
static inline void pmix_atomic_wmb(void)
{
__atomic_thread_fence (__ATOMIC_RELEASE);
}
#define PMIXMB() pmix_atomic_mb()
/**********************************************************************
*
* Atomic math operations
*
*********************************************************************/
/*
* Suppress numerous (spurious ?) warnings from Oracle Studio compilers
* see https://community.oracle.com/thread/3968347
*/
#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
#pragma error_messages(off, E_ARG_INCOMPATIBLE_WITH_ARG_L)
#endif
static inline bool pmix_atomic_compare_exchange_strong_acq_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval)
{
return __atomic_compare_exchange_n (addr, oldval, newval, false, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED);
}
static inline bool pmix_atomic_compare_exchange_strong_rel_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval)
{
return __atomic_compare_exchange_n (addr, oldval, newval, false, __ATOMIC_RELEASE, __ATOMIC_RELAXED);
}
static inline bool pmix_atomic_compare_exchange_strong_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval)
{
return __atomic_compare_exchange_n (addr, oldval, newval, false, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED);
}
static inline int32_t pmix_atomic_swap_32 (pmix_atomic_int32_t *addr, int32_t newval)
{
int32_t oldval;
__atomic_exchange (addr, &newval, &oldval, __ATOMIC_RELAXED);
return oldval;
}
static inline int32_t pmix_atomic_fetch_add_32(pmix_atomic_int32_t *addr, int32_t delta)
{
return __atomic_fetch_add (addr, delta, __ATOMIC_RELAXED);
}
static inline int32_t pmix_atomic_fetch_and_32(pmix_atomic_int32_t *addr, int32_t value)
{
return __atomic_fetch_and (addr, value, __ATOMIC_RELAXED);
}
static inline int32_t pmix_atomic_fetch_or_32(pmix_atomic_int32_t *addr, int32_t value)
{
return __atomic_fetch_or (addr, value, __ATOMIC_RELAXED);
}
static inline int32_t pmix_atomic_fetch_xor_32(pmix_atomic_int32_t *addr, int32_t value)
{
return __atomic_fetch_xor (addr, value, __ATOMIC_RELAXED);
}
static inline int32_t pmix_atomic_fetch_sub_32(pmix_atomic_int32_t *addr, int32_t delta)
{
return __atomic_fetch_sub (addr, delta, __ATOMIC_RELAXED);
}
static inline bool pmix_atomic_compare_exchange_strong_acq_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval)
{
return __atomic_compare_exchange_n (addr, oldval, newval, false, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED);
}
static inline bool pmix_atomic_compare_exchange_strong_rel_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval)
{
return __atomic_compare_exchange_n (addr, oldval, newval, false, __ATOMIC_RELEASE, __ATOMIC_RELAXED);
}
static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval)
{
return __atomic_compare_exchange_n (addr, oldval, newval, false, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED);
}
static inline int64_t pmix_atomic_swap_64 (pmix_atomic_int64_t *addr, int64_t newval)
{
int64_t oldval;
__atomic_exchange (addr, &newval, &oldval, __ATOMIC_RELAXED);
return oldval;
}
static inline int64_t pmix_atomic_fetch_add_64(pmix_atomic_int64_t *addr, int64_t delta)
{
return __atomic_fetch_add (addr, delta, __ATOMIC_RELAXED);
}
static inline int64_t pmix_atomic_fetch_and_64(pmix_atomic_int64_t *addr, int64_t value)
{
return __atomic_fetch_and (addr, value, __ATOMIC_RELAXED);
}
static inline int64_t pmix_atomic_fetch_or_64(pmix_atomic_int64_t *addr, int64_t value)
{
return __atomic_fetch_or (addr, value, __ATOMIC_RELAXED);
}
static inline int64_t pmix_atomic_fetch_xor_64(pmix_atomic_int64_t *addr, int64_t value)
{
return __atomic_fetch_xor (addr, value, __ATOMIC_RELAXED);
}
static inline int64_t pmix_atomic_fetch_sub_64(pmix_atomic_int64_t *addr, int64_t delta)
{
return __atomic_fetch_sub (addr, delta, __ATOMIC_RELAXED);
}
#if PMIX_HAVE_GCC_BUILTIN_CSWAP_INT128
#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_128 1
static inline bool pmix_atomic_compare_exchange_strong_128 (pmix_atomic_int128_t *addr,
pmix_int128_t *oldval, pmix_int128_t newval)
{
return __atomic_compare_exchange_n (addr, oldval, newval, false,
__ATOMIC_ACQUIRE, __ATOMIC_RELAXED);
}
#elif defined(PMIX_HAVE_SYNC_BUILTIN_CSWAP_INT128) && PMIX_HAVE_SYNC_BUILTIN_CSWAP_INT128
#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_128 1
/* __atomic version is not lock-free so use legacy __sync version */
static inline bool pmix_atomic_compare_exchange_strong_128 (pmix_atomic_pmix_int128_t *addr,
pmix_int128_t *oldval, pmix_int128_t newval)
{
pmix_int128_t prev = __sync_val_compare_and_swap (addr, *oldval, newval);
bool ret = prev == *oldval;
*oldval = prev;
return ret;
}
#endif
#if defined(__HLE__)
#include <immintrin.h>
#define PMIX_HAVE_ATOMIC_SPINLOCKS 1
static inline void pmix_atomic_lock_init (pmix_atomic_lock_t* lock, int32_t value)
{
lock->u.lock = value;
}
static inline int pmix_atomic_trylock(pmix_atomic_lock_t *lock)
{
int ret = __atomic_exchange_n (&lock->u.lock, PMIX_ATOMIC_LOCK_LOCKED,
__ATOMIC_ACQUIRE | __ATOMIC_HLE_ACQUIRE);
if (PMIX_ATOMIC_LOCK_LOCKED == ret) {
/* abort the transaction */
_mm_pause ();
return 1;
}
return 0;
}
static inline void pmix_atomic_lock (pmix_atomic_lock_t *lock)
{
while (PMIX_ATOMIC_LOCK_LOCKED == __atomic_exchange_n (&lock->u.lock, PMIX_ATOMIC_LOCK_LOCKED,
__ATOMIC_ACQUIRE | __ATOMIC_HLE_ACQUIRE)) {
/* abort the transaction */
_mm_pause ();
}
}
static inline void pmix_atomic_unlock (pmix_atomic_lock_t *lock)
{
__atomic_store_n (&lock->u.lock, PMIX_ATOMIC_LOCK_UNLOCKED,
__ATOMIC_RELEASE | __ATOMIC_HLE_RELEASE);
}
#endif
#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
#pragma error_messages(default, E_ARG_INCOMPATIBLE_WITH_ARG_L)
#endif
#endif /* ! PMIX_SYS_ARCH_ATOMIC_H */
| 33.140152
| 122
| 0.716539
|
c3ffb00db97d672140da3d010c20f17c4fe8cd35
| 929
|
cs
|
C#
|
Assets/Example/Scripts/TriggerEffects/AddTriggerEffectsSystem.cs
|
Kuptsevych/Unity-DOTS-TriggerSystem
|
55235b2b48a8e24d3b6cb50f967b84f2a4bfc1ab
|
[
"MIT"
] | 4
|
2020-07-23T07:12:11.000Z
|
2021-07-16T04:28:08.000Z
|
Assets/Example/Scripts/TriggerEffects/AddTriggerEffectsSystem.cs
|
Kuptsevych/Unity-DOTS-TriggerSystem
|
55235b2b48a8e24d3b6cb50f967b84f2a4bfc1ab
|
[
"MIT"
] | null | null | null |
Assets/Example/Scripts/TriggerEffects/AddTriggerEffectsSystem.cs
|
Kuptsevych/Unity-DOTS-TriggerSystem
|
55235b2b48a8e24d3b6cb50f967b84f2a4bfc1ab
|
[
"MIT"
] | 1
|
2020-09-20T07:31:26.000Z
|
2020-09-20T07:31:26.000Z
|
using Unity.Entities;
namespace TriggerSystem.Example
{
public class AddTriggerEffectsSystem : ComponentSystem
{
private TriggerDetectorSystem _triggerDetectorSystem;
protected override void OnStartRunning()
{
_triggerDetectorSystem = EntityManager.World.GetExistingSystem<TriggerDetectorSystem>();
//Add effect components
_triggerDetectorSystem.Conversion.Add(typeof(TriggerEffectVfxComponent), EcsUtils.CopyComponent<TriggerEffectVfxComponent>);
_triggerDetectorSystem.Conversion.Add(typeof(TriggerEffectDestroyComponent), EcsUtils.CopyComponent<TriggerEffectDestroyComponent>);
_triggerDetectorSystem.Conversion.Add(typeof(TriggerCoin), EcsUtils.CopyComponent<TriggerCoin>);
_triggerDetectorSystem.Conversion.Add(typeof(SimpleTriggerEffect), EcsUtils.CopyComponent<SimpleTriggerEffect>);
}
protected override void OnUpdate()
{
}
}
}
| 38.708333
| 136
| 0.778256
|
4ce73c213dcd3b3a653aa12e013877cb586e9203
| 2,221
|
py
|
Python
|
adminapp/serializer1.py
|
nosiphokhumalo/honours-project-chefreg
|
c3e43bdae9d3a6880fecac5fb95fd698959a088a
|
[
"MIT"
] | null | null | null |
adminapp/serializer1.py
|
nosiphokhumalo/honours-project-chefreg
|
c3e43bdae9d3a6880fecac5fb95fd698959a088a
|
[
"MIT"
] | 9
|
2020-02-12T00:16:41.000Z
|
2021-12-13T19:46:27.000Z
|
adminapp/serializer1.py
|
nosiphokhumalo/ictchefs
|
c3e43bdae9d3a6880fecac5fb95fd698959a088a
|
[
"MIT"
] | null | null | null |
from .models import Student, StudentInfo, EmploymentInfo
from django.contrib.auth.models import User
from django import forms
from rest_framework import serializers
class EmploymentInfoSerializer(serializers.ModelSerializer):
class Meta:
model = EmploymentInfo
fields = ('internship', 'current_employment')
class StudentInfoSerializer(serializers.ModelSerializer):
class Meta:
model = StudentInfo
fields = ('class_no', 'grad_or_student', 'year', 'dropout')
class UserSerializer(serializers.ModelSerializer):
students = serializers.PrimaryKeyRelatedField(many=True, queryset=Student.objects.all())
class Meta:
model = User
fields = ('id', 'username', 'students')
class AppSerializer(serializers.ModelSerializer):
owner = serializers.ReadOnlyField(source='owner.username')
contact_details = serializers.SlugRelatedField(
many=True,
read_only=True,
slug_field='contact'
)
employment_history = serializers.SlugRelatedField(
many=True,
read_only=True,
slug_field='employment'
)
employment_info = EmploymentInfoSerializer(many=True, read_only=True)
weekend_placement = serializers.SlugRelatedField(
many=True,
read_only=True,
slug_field='placement'
)
student_info = StudentInfoSerializer(many=True, read_only=True)
class Meta:
model = Student
fields = ('student_id','owner','activated', 'password', 'name', 'id_no', 'deceased', 'contact_details','address' ,'employment_history', 'employment_info', 'weekend_placement', 'student_info')
def create(self, validated_data):
contact_details_data = validated_data.pop('contact_details')
student_info_data = validated_data.pop('student_info')
student = Student.objects.create(**validated_data)
for contact_detail_data in contact_details_data:
ContactDetails.objects.create(student=student, **contact_detail_data)
for info_data in student_info_data:
StudentInfo.objects.create(student=student, **info_data)
return student
| 37.016667
| 200
| 0.681225
|
be50f0dd9768673a05e9906cab0f13f659b1d0d5
| 134
|
sql
|
SQL
|
aws-test/tests/aws_guardduty_publishing_destination/test-not-found-query.sql
|
cjsrkd3321/steampipe-plugin-aws
|
c9b424289abb2020126019fdaefc03ad39ecb171
|
[
"Apache-2.0"
] | null | null | null |
aws-test/tests/aws_guardduty_publishing_destination/test-not-found-query.sql
|
cjsrkd3321/steampipe-plugin-aws
|
c9b424289abb2020126019fdaefc03ad39ecb171
|
[
"Apache-2.0"
] | null | null | null |
aws-test/tests/aws_guardduty_publishing_destination/test-not-found-query.sql
|
cjsrkd3321/steampipe-plugin-aws
|
c9b424289abb2020126019fdaefc03ad39ecb171
|
[
"Apache-2.0"
] | null | null | null |
select destination_id, arn
from aws_guardduty_publishing_destination
where akas::text = '["{{ output.resource_aka.value }}"::dummy]';
| 33.5
| 64
| 0.776119
|