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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0daab0856a85579fc632d5165a616f21616ac38b | 2,081 | asm | Assembly | programs/oeis/159/A159328.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/159/A159328.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/159/A159328.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A159328: Transform of 1 by the T_{1,1} transformation (see link)
; 2,4,10,24,56,130,302,702,1632,3794,8820,20504,47666,110810,257602,598852,1392162,3236384,7523680,17490434,40660326,94523790,219741152,510836202,1187550092,2760719024,6417893090,14919791314,34684306786,80631230820,187444870202,435756455752,1013010857672,2354964531714,5474628335550,12726966800894,29586608263296,68780519523650,159895308845252,371711495751752,864124389088402,2008845484606954,4669999171395810,10856430934061924,25238139944001106,58671557135275280,136394822451885552,317079493029107202,737120391318825782,1713597010350148494,3983629741441901120,9260815594944232154,21528784312299042716,50048351488450564960,116348301435697841602,270476985642491437602,628782705544529194562,1461742446784302550084,3398138914906340698730,7899714556694946190584,18364608287056459724376,42692534662685827490690,99248101970639509213902,230723844873603332384702,536367865342216806216992,1246904008250083263095474,2898700138939419509237140,6738660265660308807737464,15665484527352170667833586,36417833189675313897262970,84661190779981909163859202,196813390487947270364885252,457535623093553306664200322,1063641279084747288426689664,2472665981555082522316553600,5748251009589306296760481794,13363062344742501134075027846,31065350996603973331020673550,72218179309916224021672446752,167886898281283226537051021002,390289687220621204898828843052,907313444409213385644056933904,2109247857067680973671564136610,4903406369605237354625407385074,11399036839089563502177150815906,26499545635125896770952201814180,61603969596803800663127711195802,143211854359249171949655880774952,332927169519265811293664421747432,773961769436102890644809214888194,1799242823629026221296754681944670,4182732101534138693894310037805054,9723672426780466529734229964414016,22604795900902148422710824499576610,52549774950679650902558323607706852,122163405477015122391987551788381352,283995462430588213793556832649306962,660209351288414047499253717978865034
mov $1,2
mov $2,2
mov $3,2
lpb $0
sub $0,1
add $3,$1
add $1,$2
add $2,$3
lpe
mov $0,$1
| 148.642857 | 1,917 | 0.91975 |
6d8684cd6e37d452cdc5e43fd0962b19a45ea09f | 2,359 | kt | Kotlin | src/main/kotlin/zone/nora/slothpixel/skyblock/players/stats/deaths/SkyblockPlayerDeaths.kt | NertCoding/Slothpixel-JVM | 7cd87f7a81d4876af6a49e5aaf616bc306e71f40 | [
"BSD-3-Clause"
] | 6 | 2020-02-17T12:06:13.000Z | 2020-12-18T08:41:28.000Z | src/main/kotlin/zone/nora/slothpixel/skyblock/players/stats/deaths/SkyblockPlayerDeaths.kt | NertCoding/Slothpixel-JVM | 7cd87f7a81d4876af6a49e5aaf616bc306e71f40 | [
"BSD-3-Clause"
] | 3 | 2020-05-04T19:39:14.000Z | 2021-03-11T16:29:23.000Z | src/main/kotlin/zone/nora/slothpixel/skyblock/players/stats/deaths/SkyblockPlayerDeaths.kt | NertCoding/Slothpixel-JVM | 7cd87f7a81d4876af6a49e5aaf616bc306e71f40 | [
"BSD-3-Clause"
] | 4 | 2020-05-04T20:13:00.000Z | 2021-12-14T13:38:22.000Z | package zone.nora.slothpixel.skyblock.players.stats.deaths
import com.google.gson.annotations.SerializedName
class SkyblockPlayerDeaths {
@SerializedName("void")
val void = 0
@SerializedName("ruin_wolf")
val ruinWolf = 0
@SerializedName("dasher_spider")
val dasherSpider = 0
@SerializedName("spider_jockey")
val spiderJockey = 0
@SerializedName("fire")
val fire = 0
@SerializedName("diamond_skeleton")
val diamondSkeleton = 0
@SerializedName("diamond_zombie")
val diamondZombie = 0
@SerializedName("wither_skeleton")
val witherSkeleton = 0
@SerializedName("fireball_magma_cube")
val fireballMagmaCube = 0
@SerializedName("blaze")
val blaze = 0
@SerializedName("generator_magma_cube")
val generatorMagmaCube = 0
@SerializedName("fall")
val fall = 0
@SerializedName("emerald_slime")
val emeraldSlime = 0
@SerializedName("sea_archer")
val seaArcher = 0
@SerializedName("magma_cube_boss")
val magmaCubeBoss = 0
@SerializedName("deep_sea_protector")
val deepSeaProtector = 0
@SerializedName("water_hydra")
val waterHydra = 0
@SerializedName("spider")
val spider = 0
@SerializedName("zealot_enderman")
val zealotEnderman = 0
@SerializedName("enderman")
val enderman = 0
@SerializedName("unknown")
val unknown = 0
@SerializedName("obsidian_wither")
val obsidianWither = 0
@SerializedName("endermite")
val endermite = 0
@SerializedName("watcher")
val watcher = 0
@SerializedName("wise_dragon")
val wiseDragon = 0
@SerializedName("superior_dragon")
val superiorDragon = 0
@SerializedName("protector_dragon")
val protectorDragon = 0
@SerializedName("young_dragon")
val youngDragon = 0
@SerializedName("old_dragon")
val oldDragon = 0
@SerializedName("sea_leech")
val seaLeech = 0
@SerializedName("zombie")
val zombie = 0
@SerializedName("unburried_zombie")
val unburriedZombie = 0
@SerializedName("soul_of_the_alpha")
val soulOfTheAlpha = 0
@SerializedName("liquid_hot_magma")
val liquidHotMagma = 0
@SerializedName("wolf")
val wolf = 0
@SerializedName("old_wolf")
val oldWolf = 0
@SerializedName("strong_dragon")
val strongDragon = 0
} | 20.336207 | 58 | 0.67783 |
3b82041d683ec0b56655bee383bf14a8eba97535 | 3,443 | h | C | Engine/Source/Runtime/Online/OnlineSubsystemFacebook/Private/IOS/OnlineIdentityFacebook.h | PopCap/GameIdea | 201e1df50b2bc99afc079ce326aa0a44b178a391 | [
"BSD-2-Clause"
] | null | null | null | Engine/Source/Runtime/Online/OnlineSubsystemFacebook/Private/IOS/OnlineIdentityFacebook.h | PopCap/GameIdea | 201e1df50b2bc99afc079ce326aa0a44b178a391 | [
"BSD-2-Clause"
] | 2 | 2015-06-21T17:38:11.000Z | 2015-06-22T20:54:42.000Z | Engine/Source/Runtime/Online/OnlineSubsystemFacebook/Private/IOS/OnlineIdentityFacebook.h | PopCap/GameIdea | 201e1df50b2bc99afc079ce326aa0a44b178a391 | [
"BSD-2-Clause"
] | null | null | null | // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
// Module includes
#include "OnlineIdentityInterface.h"
#include "OnlineSubsystemFacebookPackage.h"
/**
* Facebook implementation of the online account information we may want
*/
class FUserOnlineAccountFacebook : public FUserOnlineAccount
{
public:
// FOnlineUser
virtual TSharedRef<const FUniqueNetId> GetUserId() const override;
virtual FString GetRealName() const override;
virtual FString GetDisplayName() const override;
virtual bool GetUserAttribute(const FString& AttrName, FString& OutAttrValue) const override;
// FUserOnlineAccount
virtual FString GetAccessToken() const override;
virtual bool GetAuthAttribute(const FString& AttrName, FString& OutAttrValue) const override;
public:
/**
* Constructor
*
* @param InUserId The user Id which should be assigned for this account.
* @param InAuthTicket The token which this account is using.
*/
FUserOnlineAccountFacebook(const FString& InUserId=TEXT(""), const FString& InAuthTicket=TEXT("")) ;
/**
* Destructor
*/
virtual ~FUserOnlineAccountFacebook(){}
private:
/** The token obtained for this session */
FString AuthTicket;
/** UID of the logged in user */
TSharedRef<const FUniqueNetId> UserId;
/** Allow the fb identity to fill in our private members from it's callbacks */
friend class FOnlineIdentityFacebook;
};
/**
* Facebook service implementation of the online identity interface
*/
class FOnlineIdentityFacebook : public IOnlineIdentity
{
public:
// Begin IOnlineIdentity interface
virtual bool Login(int32 LocalUserNum, const FOnlineAccountCredentials& AccountCredentials) override;
virtual bool Logout(int32 LocalUserNum) override;
virtual bool AutoLogin(int32 LocalUserNum) override;
virtual TSharedPtr<FUserOnlineAccount> GetUserAccount(const FUniqueNetId& UserId) const override;
virtual TArray<TSharedPtr<FUserOnlineAccount> > GetAllUserAccounts() const override;
virtual TSharedPtr<const FUniqueNetId> GetUniquePlayerId(int32 LocalUserNum) const override;
virtual TSharedPtr<const FUniqueNetId> CreateUniquePlayerId(uint8* Bytes, int32 Size) override;
virtual TSharedPtr<const FUniqueNetId> CreateUniquePlayerId(const FString& Str) override;
virtual ELoginStatus::Type GetLoginStatus(int32 LocalUserNum) const override;
virtual ELoginStatus::Type GetLoginStatus(const FUniqueNetId& UserId) const override;
virtual FString GetPlayerNickname(int32 LocalUserNum) const override;
virtual FString GetPlayerNickname(const FUniqueNetId& UserId) const override;
virtual FString GetAuthToken(int32 LocalUserNum) const override;
virtual void GetUserPrivilege(const FUniqueNetId& UserId, EUserPrivileges::Type Privilege, const FOnGetUserPrivilegeCompleteDelegate& Delegate) override;
virtual FPlatformUserId GetPlatformUserIdFromUniqueNetId(const FUniqueNetId& UniqueNetId) override;
// End IOnlineIdentity interface
public:
/**
* Default constructor
*/
FOnlineIdentityFacebook();
/**
* Destructor
*/
virtual ~FOnlineIdentityFacebook()
{
}
private:
/** The user account details associated with this identity */
TSharedRef< FUserOnlineAccountFacebook > UserAccount;
/** The current state of our login */
ELoginStatus::Type LoginStatus;
/** Username of the user assuming this identity */
FString Name;
};
typedef TSharedPtr<FOnlineIdentityFacebook, ESPMode::ThreadSafe> FOnlineIdentityFacebookPtr; | 30.201754 | 154 | 0.791461 |
1bec93e93758ee45b7f7fafe69a3f00abf7caa7e | 54,999 | asm | Assembly | libsrc/math/z88math/z80/bbcmath.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/math/z88math/z80/bbcmath.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/math/z88math/z80/bbcmath.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z | ; This is a slightly modified version of the original source code from
; from: https://github.com/davidgiven/cpmish/tree/master/third_party/bbcbasic
;
; For compatibility with z80asm the following changes were made:
; * TITLE and PAGE directives were commented out
;
; For compatbility with the z88math library the following chnage was made:
; * Implement FNEGATE in function table + code
;
; For compatbility with machines reserving one register the following change
; was made:
; * Use a static word to store the sp to be restored on error
;
IF !FORz88
SECTION bss_fp_bbc
; Stores the stack for the exit condition
stackstore: defw 0
SECTION code_fp_bbc
PUBLIC FPP
; TITLE '(C) COPYRIGHT R.T.RUSSELL 1986'
;
;Z80 FLOATING POINT PACKAGE
;(C) COPYRIGHT R.T.RUSSELL 1986
;VERSION 0.0, 26-10-1986
;VERSION 0.1, 14-12-1988 (BUG FIX)
;
;BINARY FLOATING POINT REPRESENTATION:
; 32 BIT SIGN-MAGNITUDE NORMALIZED MANTISSA
; 8 BIT EXCESS-128 SIGNED EXPONENT
; SIGN BIT REPLACES MANTISSA MSB (IMPLIED "1")
; MANTISSA=0 & EXPONENT=0 IMPLIES VALUE IS ZERO.
;
;BINARY INTEGER REPRESENTATION:
; 32 BIT 2'S-COMPLEMENT SIGNED INTEGER
; "EXPONENT" BYTE = 0 (WHEN PRESENT)
;
;NORMAL REGISTER ALLOCATION: MANTISSA - HLH'L'
; EXPONENT - C
;ALTERNATE REGISTER ALLOCATION: MANTISSA - DED'E'
; EXPONENT - B
;
;Error codes:
;
BADOP EQU 1 ;Bad operation code
DIVBY0 EQU 18 ;Division by zero
TOOBIG EQU 20 ;Too big
NGROOT EQU 21 ;Negative root
LOGRNG EQU 22 ;Log range
ACLOST EQU 23 ;Accuracy lost
EXPRNG EQU 24 ;Exp range
;
GLOBAL FPP
;
;Call entry and despatch code:
;
FPP:
ld (stackstore),sp ;z88dk
; PUSH IY ;Save IY
; LD IY,0
; ADD IY,SP ;Save SP in IY
CALL OP ;Perform operation
CP A ;Good return (Z, NC)
EXIT:
;POP IY ;Restore IY
ret ;Return to caller
;
;Error exit:
;
BAD: LD A,BADOP ;"Bad operation code"
ERROR:
ld sp,(stackstore) ;z88dk
;LD SP,IY ;Restore SP from IY
OR A ;Set NZ
SCF ;Set C
JR EXIT
;
;Perform operation or function:
;
OP: CP +(RTABLE-DTABLE)/2
JR NC,BAD
CP +(FTABLE-DTABLE)/2
JR NC,DISPAT
EX AF,AF'
LD A,B
OR C ;Both integer?
CALL NZ,FLOATA ;No, so float both
EX AF,AF'
DISPAT: PUSH HL
LD HL,DTABLE
PUSH BC
ADD A,A ;A = op-code * 2
LD C,A
LD B,0 ;BC = op-code * 2
ADD HL,BC
LD A,(HL) ;Get low byte
INC HL
LD H,(HL) ;Get high byte
LD L,A
POP BC
EX (SP),HL
RET ;Off to routine
;
;Despatch table:
;
DTABLE: DEFW IAND ;AND (INTEGER)
DEFW IBDIV ;DIV
DEFW IEOR ;EOR
DEFW IMOD ;MOD
DEFW IOR ;OR
DEFW ILE ;<=
DEFW INE ;<>
DEFW IGE ;>=
DEFW ILT ;<
DEFW IEQ ;=
DEFW IMUL ;*
DEFW IADD ;+
DEFW IGT ;>
DEFW ISUB ;-
DEFW IPOW ;^
DEFW IDIV ;/
;
FTABLE: DEFW ABS ;ABS
DEFW ACS ;ACS
DEFW ASN ;ASN
DEFW ATN ;ATN
DEFW COS ;COS
DEFW DEG ;DEG
DEFW EXP ;EXP
DEFW INT ;INT
DEFW LN ;LN
DEFW LOG ;LOG
DEFW NOTK ;NOT
DEFW RAD ;RAD
DEFW SGN ;SGN
DEFW SIN ;SIN
DEFW SQR ;SQR
DEFW TAN ;TAN
;
DEFW ZERO ;ZERO
DEFW FONE ;FONE
DEFW TRUE ;TRUE
DEFW PI ;PI
;
DEFW VAL ;VAL
DEFW STR ;STR$
;
DEFW SFIX ;FIX
DEFW SFLOAT ;FLOAT
;
DEFW FTEST ;TEST
DEFW FCOMP ;COMPARE
DEFW FNEGATE ;NEGATE (z88dk added)
;
RTABLE: DEFW FAND ;AND (FLOATING-POINT)
DEFW FBDIV ;DIV
DEFW FEOR ;EOR
DEFW FMOD ;MOD
DEFW FOR ;OR
DEFW FLE ;<=
DEFW FNE ;<>
DEFW FGE ;>=
DEFW FLT ;<
DEFW FEQ ;=
DEFW FMUL ;*
DEFW FADD ;+
DEFW FGT ;>
DEFW FSUB ;-
DEFW FPOW ;^
DEFW FDIV ;/
;
;PAGE
;
;ARITHMETIC AND LOGICAL OPERATORS:
;All take two arguments, in HLH'L'C & DED'E'B.
;Output in HLH'L'C
;All registers except IX, IY destroyed.
; (N.B. FPOW destroys IX).
;
;FAND - Floating-point AND.
;IAND - Integer AND.
;
FAND: CALL FIX2
IAND: LD A,H
AND D
LD H,A
LD A,L
AND E
LD L,A
EXX
LD A,H
AND D
LD H,A
LD A,L
AND E
LD L,A
EXX
RET
;
;FEOR - Floating-point exclusive-OR.
;IEOR - Integer exclusive-OR.
;
FEOR: CALL FIX2
IEOR: LD A,H
XOR D
LD H,A
LD A,L
XOR E
LD L,A
EXX
LD A,H
XOR D
LD H,A
LD A,L
XOR E
LD L,A
EXX
RET
;
;FOR - Floating-point OR.
;IOR - Integer OR.
;
FOR: CALL FIX2
IOR: LD A,H
OR D
LD H,A
LD A,L
OR E
LD L,A
EXX
LD A,H
OR D
LD H,A
LD A,L
OR E
LD L,A
EXX
RET
;
;FMOD - Floating-point remainder.
;IMOD - Integer remainder.
;
FMOD: CALL FIX2
IMOD: LD A,H
XOR D ;DIV RESULT SIGN
BIT 7,H
EX AF,AF'
BIT 7,H
CALL NZ,NEGATE ;MAKE ARGUMENTS +VE
CALL SWAP
BIT 7,H
CALL NZ,NEGATE
LD B,H
LD C,L
LD HL,0
EXX
LD B,H
LD C,L
LD HL,0
LD A,-33
CALL DIVA ;DIVIDE
EXX
LD C,0 ;INTEGER MARKER
EX AF,AF'
RET Z
JP NEGATE
;
;BDIV - Integer division.
;
FBDIV: CALL FIX2
IBDIV: CALL IMOD
OR A
CALL SWAP
LD C,0
RET P
JP NEGATE
;
;ISUB - Integer subtraction.
;FSUB - Floating point subtraction with rounding.
;
ISUB: CALL SUB
RET PO
CALL ADD
CALL FLOAT2
FSUB: LD A,D
XOR 80H ;CHANGE SIGN THEN ADD
LD D,A
JR FADD
;
;Reverse subtract.
;
RSUB: LD A,H
XOR 80H
LD H,A
JR FADD
;
;IADD - Integer addition.
;FADD - Floating point addition with rounding.
;
IADD: CALL ADD
RET PO
CALL SUB
CALL FLOAT2
FADD: DEC B
INC B
RET Z ;ARG 2 ZERO
DEC C
INC C
JP Z,SWAP ;ARG 1 ZERO
EXX
LD BC,0 ;INITIALISE
EXX
LD A,H
XOR D ;XOR SIGNS
PUSH AF
LD A,B
CP C ;COMPARE EXPONENTS
CALL C,SWAP ;MAKE DED'E'B LARGEST
LD A,B
SET 7,H ;IMPLIED 1
CALL NZ,FIX ;ALIGN
POP AF
LD A,D ;SIGN OF LARGER
SET 7,D ;IMPLIED 1
JP M,FADD3 ;SIGNS DIFFERENT
CALL ADD ;HLH'L'=HLH'L'+DED'E'
CALL C,DIV2 ;NORMALISE
SET 7,H
JR FADD4
;
FADD3: CALL SUB ;HLH'L'=HLH'L'-DED'E'
CALL C,NEG ;NEGATE HLH'L'B'C'
CALL FLO48
CPL ;CHANGE RESULT SIGN
FADD4: EXX
EX DE,HL
LD HL,8000H
OR A ;CLEAR CARRY
SBC HL,BC
EX DE,HL
EXX
CALL Z,ODD ;ROUND UNBIASSED
CALL C,ADD1 ;ROUND UP
CALL C,INCC
RES 7,H
DEC C
INC C
JP Z,ZERO
OR A ;RESULT SIGNQ
RET P ;POSITIVE
SET 7,H ;NEGATIVE
RET
;
;IDIV - Integer division.
;FDIV - Floating point division with rounding.
;
IDIV: CALL FLOAT2
FDIV: DEC B ;TEST FOR ZERO
INC B
LD A,DIVBY0
JP Z,ERROR ;"Division by zero"
DEC C ;TEST FOR ZERO
INC C
RET Z
LD A,H
XOR D ;CALC. RESULT SIGN
EX AF,AF' ;SAVE SIGN
SET 7,D ;REPLACE IMPLIED 1's
SET 7,H
PUSH BC ;SAVE EXPONENTS
LD B,D ;LOAD REGISTERS
LD C,E
LD DE,0
EXX
LD B,D
LD C,E
LD DE,0
LD A,-32 ;LOOP COUNTER
CALL DIVA ;DIVIDE
EXX
BIT 7,D
EXX
CALL Z,DIVB ;NORMALISE & INC A
EX DE,HL
EXX
SRL B ;DIVISOR/2
RR C
OR A ;CLEAR CARRY
SBC HL,BC ;REMAINDER-DIVISOR/2
CCF
EX DE,HL ;RESULT IN HLH'L'
CALL Z,ODD ;ROUND UNBIASSED
CALL C,ADD1 ;ROUND UP
POP BC ;RESTORE EXPONENTS
CALL C,INCC
RRA ;LSB OF A TO CARRY
LD A,C ;COMPUTE NEW EXPONENT
SBC A,B
CCF
JP CHKOVF
;
;IMUL - Integer multiplication.
;
IMUL: LD A,H
XOR D
EX AF,AF' ;SAVE RESULT SIGN
BIT 7,H
CALL NZ,NEGATE
CALL SWAP
BIT 7,H
CALL NZ,NEGATE
LD B,H
LD C,L
LD HL,0
EXX
LD B,H
LD C,L
LD HL,0
LD A,-33
CALL MULA ;MULTIPLY
EXX
LD C,191 ;PRESET EXPONENT
CALL TEST ;TEST RANGE
JR NZ,IMUL1 ;TOO BIG
BIT 7,D
JR NZ,IMUL1
CALL SWAP
LD C,D ;INTEGER MARKER
EX AF,AF'
RET P
JP NEGATE
;
IMUL1: DEC C
EXX
SLA E
RL D
EXX
RL E
RL D
EXX
ADC HL,HL
EXX
ADC HL,HL
JP P,IMUL1 ;NORMALISE
EX AF,AF'
RET M
RES 7,H ;POSITIVE
RET
;
;FMUL - Floating point multiplication with rounding.
;
FMUL: DEC B ;TEST FOR ZERO
INC B
JP Z,ZERO
DEC C ;TEST FOR ZERO
INC C
RET Z
LD A,H
XOR D ;CALC. RESULT SIGN
EX AF,AF'
SET 7,D ;REPLACE IMPLIED 1's
SET 7,H
PUSH BC ;SAVE EXPONENTS
LD B,H ;LOAD REGISTERS
LD C,L
LD HL,0
EXX
LD B,H
LD C,L
LD HL,0
LD A,-32 ;LOOP COUNTER
CALL MULA ;MULTIPLY
CALL C,MULB ;NORMALISE & INC A
EXX
PUSH HL
LD HL,8000H
OR A ;CLEAR CARRY
SBC HL,DE
POP HL
CALL Z,ODD ;ROUND UNBIASSED
CALL C,ADD1 ;ROUND UP
POP BC ;RESTORE EXPONENTS
CALL C,INCC
RRA ;LSB OF A TO CARRY
LD A,C ;COMPUTE NEW EXPONENT
ADC A,B
CHKOVF: JR C,CHKO1
JP P,ZERO ;UNDERFLOW
JR CHKO2
CHKO1: JP M,OFLOW ;OVERFLOW
CHKO2: ADD A,80H
LD C,A
JP Z,ZERO
EX AF,AF' ;RESTORE SIGN BIT
RES 7,H
RET P
SET 7,H
RET
;
;IPOW - Integer involution.
;
IPOW: CALL SWAP
BIT 7,H
PUSH AF ;SAVE SIGN
CALL NZ,NEGATE
IPOW0: LD C,B
LD B,32 ;LOOP COUNTER
IPOW1: CALL X2
JR C,IPOW2
DJNZ IPOW1
POP AF
EXX
INC L ;RESULT=1
EXX
LD C,H
RET
;
IPOW2: POP AF
PUSH BC
EX DE,HL
PUSH HL
EXX
EX DE,HL
PUSH HL
EXX
LD IX,0
ADD IX,SP
JR Z,IPOW4
PUSH BC
EXX
PUSH DE
EXX
PUSH DE
CALL SFLOAT
CALL RECIP
LD (IX+4),C
EXX
LD (IX+0),L
LD (IX+1),H
EXX
LD (IX+2),L
LD (IX+3),H
JR IPOW5
;
IPOW3: PUSH BC
EXX
SLA E
RL D
PUSH DE
EXX
RL E
RL D
PUSH DE
LD A,'*' & 0FH
PUSH AF
CALL COPY
CALL OP ;SQUARE
POP AF
CALL DLOAD5
CALL C,OP ;MULTIPLY BY X
IPOW5: POP DE
EXX
POP DE
EXX
LD A,C
POP BC
LD C,A
IPOW4: DJNZ IPOW3
POP AF
POP AF
POP AF
RET
;
FPOW0: POP AF
POP AF
POP AF
JR IPOW0
;
;FPOW - Floating-point involution.
;
FPOW: BIT 7,D
PUSH AF
CALL SWAP
CALL PUSH5
DEC C
INC C
JR Z,FPOW0
LD A,158
CP C
JR C,FPOW1
INC A
CALL FIX
EX AF,AF'
JP P,FPOW0
FPOW1: CALL SWAP
CALL LN0
CALL POP5
POP AF
CALL FMUL
JP EXP0
;
;Integer and floating-point compare.
;Result is TRUE (-1) or FALSE (0).
;
FLT: CALL FCP
JR ILT1
ILT: CALL ICP
ILT1: RET NC
JR TRUE
;
FGT: CALL FCP
JR IGT1
IGT: CALL ICP
IGT1: RET Z
RET C
JR TRUE
;
FGE: CALL FCP
JR IGE1
IGE: CALL ICP
IGE1: RET C
JR TRUE
;
FLE: CALL FCP
JR ILE1
ILE: CALL ICP
ILE1: JR Z,TRUE
RET NC
JR TRUE
;
FNE: CALL FCP
JR INE1
INE: CALL ICP
INE1: RET Z
JR TRUE
;
FEQ: CALL FCP
JR IEQ1
IEQ: CALL ICP
IEQ1: RET NZ
TRUE: LD HL,-1
EXX
LD HL,-1
EXX
XOR A
LD C,A
RET
;
;PAGE
;
;FUNCTIONS:
;
;Result returned in HLH'L'C (floating point)
;Result returned in HLH'L' (C=0) (integer)
;All registers except IY destroyed.
;
;ABS - Absolute value
;Result is numeric, variable type.
;
ABS: BIT 7,H
RET Z ;POSITIVE/ZERO
DEC C
INC C
JP Z,NEGATE ;INTEGER
RES 7,H
RET
;
;NOT - Complement integer.
;Result is integer numeric.
;
NOTK: CALL SFIX
LD A,H
CPL
LD H,A
LD A,L
CPL
LD L,A
EXX
LD A,H
CPL
LD H,A
LD A,L
CPL
LD L,A
EXX
XOR A ;NUMERIC MARKER
RET
;
;PI - Return PI (3.141592654)
;Result is floating-point numeric.
;
PI: LD HL,490FH
EXX
LD HL,0DAA2H
EXX
LD C,81H
XOR A ;NUMERIC MARKER
RET
;
;DEG - Convert radians to degrees
;Result is floating-point numeric.
;
DEG: CALL FPI180
CALL FMUL
XOR A
RET
;
;RAD - Convert degrees to radians
;Result is floating-point numeric.
;
RAD: CALL FPI180
CALL FDIV
XOR A
RET
;
;180/PI
;
FPI180: CALL SFLOAT
LD DE,652EH
EXX
LD DE,0E0D3H
EXX
LD B,85H
RET
;
;SGN - Return -1, 0 or +1
;Result is integer numeric.
;
SGN: CALL TEST
OR C
RET Z ;ZERO
BIT 7,H
JP NZ,TRUE ;-1
CALL ZERO
JP ADD1 ;1
;
;VAL - Return numeric value of string.
;Input: ASCII string at IX
;Result is variable type numeric.
;
VAL: CALL SIGNQ
PUSH AF
CALL CON
POP AF
CP '-'
LD A,0 ;NUMERIC MARKER
RET NZ
DEC C
INC C
JP Z,NEGATE ;ZERO/INTEGER
LD A,H
XOR 80H ;CHANGE SIGN (FP)
LD H,A
XOR A
RET
;
;INT - Floor function
;Result is integer numeric.
;
INT: DEC C
INC C
RET Z ;ZERO/INTEGER
LD A,159
LD B,H ;B7=SIGN BIT
CALL FIX
EX AF,AF'
AND B
CALL M,ADD1 ;NEGATIVE NON-INTEGER
LD A,B
OR A
CALL M,NEGATE
XOR A
LD C,A
RET
;
;SQR - square root
;Result is floating-point numeric.
;
SQR: CALL SFLOAT
SQR0: BIT 7,H
LD A,NGROOT
JP NZ,ERROR ;"-ve root"
DEC C
INC C
RET Z ;ZERO
SET 7,H ;IMPLIED 1
BIT 0,C
CALL Z,DIV2 ;MAKE EXPONENT ODD
LD A,C
SUB 80H
SRA A ;HALVE EXPONENT
ADD A,80H
LD C,A
PUSH BC ;SAVE EXPONENT
EX DE,HL
LD HL,0
LD B,H
LD C,L
EXX
EX DE,HL
LD HL,0
LD B,H
LD C,L
LD A,-31
CALL SQRA ;ROOT
EXX
BIT 7,B
EXX
CALL Z,SQRA ;NORMALISE & INC A
CALL SQRB
OR A ;CLEAR CARRY
CALL DIVB
RR E ;LSB TO CARRY
LD H,B
LD L,C
EXX
LD H,B
LD L,C
CALL C,ADD1 ;ROUND UP
POP BC ;RESTORE EXPONENT
CALL C,INCC
RRA
SBC A,A
ADD A,C
LD C,A
RES 7,H ;POSITIVE
XOR A
RET
;
;TAN - Tangent function
;Result is floating-point numeric.
;
TAN: CALL SFLOAT
CALL PUSH5
CALL COS0
CALL POP5
CALL PUSH5
CALL SWAP
CALL SIN0
CALL POP5
CALL FDIV
XOR A ;NUMERIC MARKER
RET
;
;COS - Cosine function
;Result is floating-point numeric.
;
COS: CALL SFLOAT
COS0: CALL SCALE
INC E
INC E
LD A,E
JR SIN1
;
;SIN - Sine function
;Result is floating-point numeric.
;
SIN: CALL SFLOAT
SIN0: PUSH HL ;H7=SIGN
CALL SCALE
POP AF
RLCA
RLCA
RLCA
AND 4
XOR E
SIN1: PUSH AF ;OCTANT
RES 7,H
RRA
CALL PIBY4
CALL C,RSUB ;X=(PI/4)-X
POP AF
PUSH AF
AND 3
JP PO,SIN2 ;USE COSINE APPROX.
CALL PUSH5 ;SAVE X
CALL SQUARE ;PUSH X*X
CALL POLY
DEFW 0A8B7H ;a(8)
DEFW 3611H
DEFB 6DH
DEFW 0DE26H ;a(6)
DEFW 0D005H
DEFB 73H
DEFW 80C0H ;a(4)
DEFW 888H
DEFB 79H
DEFW 0AA9DH ;a(2)
DEFW 0AAAAH
DEFB 7DH
DEFW 0 ;a(0)
DEFW 0
DEFB 80H
CALL POP5
CALL POP5
CALL FMUL
JP SIN3
;
SIN2: CALL SQUARE ;PUSH X*X
CALL POLY
DEFW 0D571H ;b(8)
DEFW 4C78H
DEFB 70H
DEFW 94AFH ;b(6)
DEFW 0B603H
DEFB 76H
DEFW 9CC8H ;b(4)
DEFW 2AAAH
DEFB 7BH
DEFW 0FFDDH ;b(2)
DEFW 0FFFFH
DEFB 7EH
DEFW 0 ;b(0)
DEFW 0
DEFB 80H
CALL POP5
SIN3: POP AF
AND 4
RET Z
DEC C
INC C
RET Z ;ZERO
SET 7,H ;MAKE NEGATIVE
RET
;
;Floating-point one:
;
FONE: LD HL,0
EXX
LD HL,0
EXX
LD C,80H
RET
;
DONE: LD DE,0
EXX
LD DE,0
EXX
LD B,80H
RET
;
PIBY4: LD DE,490FH
EXX
LD DE,0DAA2H
EXX
LD B,7FH
RET
;
;EXP - Exponential function
;Result is floating-point numeric.
;
EXP: CALL SFLOAT
EXP0: CALL LN2 ;LN(2)
EXX
DEC E
LD BC,0D1CFH ;0.6931471805599453
EXX
PUSH HL ;H7=SIGN
CALL MOD48 ;"MODULUS"
POP AF
BIT 7,E
JR Z,EXP1
RLA
JP C,ZERO
LD A,EXPRNG
JP ERROR ;"Exp range"
;
EXP1: AND 80H
OR E
PUSH AF ;INTEGER PART
RES 7,H
CALL PUSH5 ;PUSH X*LN(2)
CALL POLY
DEFW 4072H ;a(7)
DEFW 942EH
DEFB 73H
DEFW 6F65H ;a(6)
DEFW 2E4FH
DEFB 76H
DEFW 6D37H ;a(5)
DEFW 8802H
DEFB 79H
DEFW 0E512H ;a(4)
DEFW 2AA0H
DEFB 7BH
DEFW 4F14H ;a(3)
DEFW 0AAAAH
DEFB 7DH
DEFW 0FD56H ;a(2)
DEFW 7FFFH
DEFB 7EH
DEFW 0FFFEH ;a(1)
DEFW 0FFFFH
DEFB 7FH
DEFW 0 ;a(0)
DEFW 0
DEFB 80H
CALL POP5
POP AF
PUSH AF
CALL P,RECIP ;X=1/X
POP AF
JP P,EXP4
AND 7FH
NEG
EXP4: ADD A,80H
ADD A,C
JR C,EXP2
JP P,ZERO ;UNDERFLOW
JR EXP3
EXP2: JP M,OFLOW ;OVERFLOW
EXP3: ADD A,80H
JP Z,ZERO
LD C,A
XOR A ;NUMERIC MARKER
RET
;
RECIP: CALL DONE
RDIV: CALL SWAP
JP FDIV ;RECIPROCAL
;
LN2: LD DE,3172H ;LN(2)
EXX
LD DE,17F8H
EXX
LD B,7FH
RET
;
;LN - Natural log.
;Result is floating-point numeric.
;
LN: CALL SFLOAT
LN0: LD A,LOGRNG
BIT 7,H
JP NZ,ERROR ;"Log range"
INC C
DEC C
JP Z,ERROR
LD DE,3504H ;SQR(2)
EXX
LD DE,0F333H ;1.41421356237
EXX
CALL ICP0 ;MANTISSA>SQR(2)?
LD A,C ;EXPONENT
LD C,80H ;1 <= X < 2
JR C,LN4
DEC C
INC A
LN4: PUSH AF ;SAVE EXPONENT
CALL RATIO ;X=(X-1)/(X+1)
CALL PUSH5
CALL SQUARE ;PUSH X*X
CALL POLY
DEFW 0CC48H ;a(9)
DEFW 74FBH
DEFB 7DH
DEFW 0AEAFH ;a(7)
DEFW 11FFH
DEFB 7EH
DEFW 0D98CH ;a(5)
DEFW 4CCDH
DEFB 7EH
DEFW 0A9E3H ;a(3)
DEFW 2AAAH
DEFB 7FH
DEFW 0 ;a(1)
DEFW 0
DEFB 81H
CALL POP5
CALL POP5
CALL FMUL
POP AF ;EXPONENT
CALL PUSH5
EX AF,AF'
CALL ZERO
EX AF,AF'
SUB 80H
JR Z,LN3
JR NC,LN1
CPL
INC A
LN1: LD H,A
LD C,87H
PUSH AF
CALL FLOAT
RES 7,H
CALL LN2
CALL FMUL
POP AF
JR NC,LN3
JP M,LN3
SET 7,H
LN3: CALL POP5
CALL FADD
XOR A
RET
;
;LOG - base-10 logarithm.
;Result is floating-point numeric.
;
LOG: CALL LN
LD DE,5E5BH ;LOG(e)
EXX
LD DE,0D8A9H
EXX
LD B,7EH
CALL FMUL
XOR A
RET
;
;ASN - Arc-sine
;Result is floating-point numeric.
;
ASN: CALL SFLOAT
CALL PUSH5
CALL COPY
CALL FMUL
CALL DONE
CALL RSUB
CALL SQR0
CALL POP5
INC C
DEC C
LD A,2
PUSH DE
JR Z,ACS1
POP DE
CALL RDIV
JR ATN0
;
;ATN - arc-tangent
;Result is floating-point numeric.
;
ATN: CALL SFLOAT
ATN0: PUSH HL ;SAVE SIGN
RES 7,H
LD DE,5413H ;TAN(PI/8)=SQR(2)-1
EXX
LD DE,0CCD0H
EXX
LD B,7EH
CALL FCP0 ;COMPARE
LD B,0
JR C,ATN2
LD DE,1A82H ;TAN(3*PI/8)=SQR(2)+1
EXX
LD DE,799AH
EXX
LD B,81H
CALL FCP0 ;COMPARE
JR C,ATN1
CALL RECIP ;X=1/X
LD B,2
JP ATN2
ATN1: CALL RATIO ;X=(X-1)/(X+1)
LD B,1
ATN2: PUSH BC ;SAVE FLAG
CALL PUSH5
CALL SQUARE ;PUSH X*X
CALL POLY
DEFW 0F335H ;a(13)
DEFW 37D8H
DEFB 7BH
DEFW 6B91H ;a(11)
DEFW 0AAB9H
DEFB 7CH
DEFW 41DEH ;a(9)
DEFW 6197H
DEFB 7CH
DEFW 9D7BH ;a(7)
DEFW 9237H
DEFB 7DH
DEFW 2A5AH ;a(5)
DEFW 4CCCH
DEFB 7DH
DEFW 0A95CH ;a(3)
DEFW 0AAAAH
DEFB 7EH
DEFW 0 ;a(1)
DEFW 0
DEFB 80H
CALL POP5
CALL POP5
CALL FMUL
POP AF
ACS1: CALL PIBY4 ;PI/4
RRA
PUSH AF
CALL C,FADD
POP AF
INC B
RRA
CALL C,RSUB
POP AF
OR A
RET P
SET 7,H ;MAKE NEGATIVE
XOR A
RET
;
;ACS - Arc cosine=PI/2-ASN.
;Result is floating point numeric.
;
ACS: CALL ASN
LD A,2
PUSH AF
JR ACS1
;
;Function STR - convert numeric value to ASCII string.
; Inputs: HLH'L'C = integer or floating-point number
; DE = address at which to store string
; IX = address of @% format control
; Outputs: String stored, with NUL terminator
;
;First normalise for decimal output:
;
STR: CALL SFLOAT
LD B,0 ;DEFAULT PT. POSITION
BIT 7,H ;NEGATIVE?
JR Z,STR10
RES 7,H
LD A,'-'
LD (DE),A ;STORE SIGN
INC DE
STR10: XOR A ;CLEAR A
CP C
JR Z,STR2 ;ZERO
PUSH DE ;SAVE TEXT POINTER
LD A,B
STR11: PUSH AF ;SAVE DECIMAL COUNTER
LD A,C ;BINARY EXPONENT
CP 161
JR NC,STR14
CP 155
JR NC,STR15
CPL
CP 225
JR C,STR13
LD A,-8
STR13: ADD A,28
CALL POWR10
PUSH AF
CALL FMUL
POP AF
LD B,A
POP AF
SUB B
JR STR11
STR14: SUB 32
CALL POWR10
PUSH AF
CALL FDIV
POP AF
LD B,A
POP AF
ADD A,B
JR STR11
STR15: LD A,9
CALL POWR10 ;10^9
CALL FCP0
LD A,C
POP BC
LD C,A
SET 7,H ;IMPLIED 1
CALL C,X10B ;X10, DEC B
POP DE ;RESTORE TEXT POINTER
RES 7,C
LD A,0
RLA ;PUT CARRY IN LSB
;
;At this point decimal normalisation has been done,
;now convert to decimal digits:
; AHLH'L' = number in normalised integer form
; B = decimal place adjustment
; C = binary place adjustment (29-33)
;
STR2: INC C
EX AF,AF' ;SAVE A
LD A,B
BIT 1,(IX+2)
JR NZ,STR20
XOR A
CP (IX+1)
JR Z,STR21
LD A,-10
STR20: ADD A,(IX+1) ;SIG. FIG. COUNT
OR A ;CLEAR CARRY
JP M,STR21
XOR A
STR21: PUSH AF
EX AF,AF' ;RESTORE A
STR22: CALL X2 ;RL AHLH'L'
ADC A,A
CP 10
JR C,STR23
SUB 10
EXX
INC L ;SET RESULT BIT
EXX
STR23: DEC C
JR NZ,STR22 ;32 TIMES
LD C,A ;REMAINDER
LD A,H
AND 3FH ;CLEAR OUT JUNK
LD H,A
POP AF
JP P,STR24
INC A
JR NZ,STR26
LD A,4
CP C ;ROUND UP?
LD A,0
JR STR26
STR24: PUSH AF
LD A,C
ADC A,'0' ;ADD CARRY
CP '0'
JR Z,STR25 ;SUPPRESS ZERO
CP '9'+1
CCF
JR NC,STR26
STR25: EX (SP),HL
BIT 6,L ;ZERO FLAG
EX (SP),HL
JR NZ,STR27
LD A,'0'
STR26: INC A ;SET +VE
DEC A
PUSH AF ;PUT ON STACK + CARRY
STR27: INC B
CALL TEST ;IS HLH'L' ZERO?
LD C,32
LD A,0
JR NZ,STR22
POP AF
PUSH AF
LD A,0
JR C,STR22
;
;At this point, the decimal character string is stored
; on the stack. Trailing zeroes are suppressed and may
; need to be replaced.
;B register holds decimal point position.
;Now format number and store as ASCII string:
;
STR3: EX DE,HL ;STRING POINTER
LD C,-1 ;FLAG "E"
LD D,1
LD E,(IX+1) ;f2
BIT 0,(IX+2)
JR NZ,STR34 ;E MODE
BIT 1,(IX+2)
JR Z,STR31
LD A,B ;F MODE
OR A
JR Z,STR30
JP M,STR30
LD D,B
STR30: LD A,D
ADD A,(IX+1)
LD E,A
CP 11
JR C,STR32
STR31: LD A,B ;G MODE
LD DE,101H
OR A
JP M,STR34
JR Z,STR32
LD A,(IX+1)
OR A
JR NZ,STR3A
LD A,10
STR3A: CP B
JR C,STR34
LD D,B
LD E,B
STR32: LD A,B
ADD A,129
LD C,A
STR34: SET 7,D
DEC E
STR35: LD A,D
CP C
JR NC,STR33
STR36: POP AF
JR Z,STR37
JP P,STR38
STR37: PUSH AF
INC E
DEC E
JP M,STR4
STR33: LD A,'0'
STR38: DEC D
JP PO,STR39
LD (HL),'.'
INC HL
STR39: LD (HL),A
INC HL
DEC E
JP P,STR35
JR STR36
;
STR4: POP AF
STR40: INC C
LD C,L
JR NZ,STR44
LD (HL),'e' ;EXPONENT
INC HL
LD A,B
DEC A
JP P,STR41
LD (HL),'-'
INC HL
NEG
STR41: LD (HL),'0'
JR Z,STR47
CP 10
LD B,A
LD A,':'
JR C,STR42
INC HL
LD (HL),'0'
STR42: INC (HL)
CP (HL)
JR NZ,STR43
LD (HL),'0'
DEC HL
INC (HL)
INC HL
STR43: DJNZ STR42
STR47: INC HL
STR44: EX DE,HL
RET
;
;PAGE
;
;Support subroutines:
;
DLOAD5: LD B,(IX+4)
EXX
LD E,(IX+0)
LD D,(IX+1)
EXX
LD E,(IX+2)
LD D,(IX+3)
RET
;
;CON - Get unsigned numeric constant from ASCII string.
; Inputs: ASCII string at (IX).
; Outputs: Variable-type result in HLH'L'C
; IX updated (points to delimiter)
; A7 = 0 (numeric marker)
;
CON: CALL ZERO ;INITIALISE TO ZERO
LD C,0 ;TRUNCATION COUNTER
CALL NUMBER ;GET INTEGER PART
CP '.'
LD B,0 ;DECL. PLACE COUNTER
CALL Z,NUMBIX ;GET FRACTION PART
CP 'E'
LD A,0 ;INITIALISE EXPONENT
CALL Z,GETEXP ;GET EXPONENT
BIT 7,H
JR NZ,CON0 ;INTEGER OVERFLOW
OR A
JR NZ,CON0 ;EXPONENT NON-ZERO
CP B
JR NZ,CON0 ;DECIMAL POINT
CP C
RET Z ;INTEGER
CON0: SUB B
ADD A,C
LD C,159
CALL FLOAT
RES 7,H ;DITCH IMPLIED 1
OR A
RET Z ;DONE
JP M,CON2 ;NEGATIVE EXPONENT
CALL POWR10
CALL FMUL ;SCALE
XOR A
RET
CON2: CP -38
JR C,CON3 ;CAN'T SCALE IN ONE GO
NEG
CALL POWR10
CALL FDIV ;SCALE
XOR A
RET
CON3: PUSH AF
LD A,38
CALL POWR10
CALL FDIV
POP AF
ADD A,38
JR CON2
;
;GETEXP - Get decimal exponent from string
; Inputs: ASCII string at (IX)
; (IX points at 'E')
; A = initial value
; Outputs: A = new exponent
; IX updated.
; Destroys: A,A',IX,F,F'
;
GETEXP: PUSH BC ;SAVE REGISTERS
LD B,A ;INITIAL VALUE
LD C,2 ;2 DIGITS MAX
INC IX ;BUMP PAST 'E'
CALL SIGNQ
EX AF,AF' ;SAVE EXPONENT SIGN
GETEX1: CALL DIGITQ
JR C,GETEX2
LD A,B ;B=B*10
ADD A,A
ADD A,A
ADD A,B
ADD A,A
LD B,A
LD A,(IX) ;GET BACK DIGIT
INC IX
AND 0FH ;MASK UNWANTED BITS
ADD A,B ;ADD IN DIGIT
LD B,A
DEC C
JP P,GETEX1
LD B,100 ;FORCE OVERFLOW
JR GETEX1
GETEX2: EX AF,AF' ;RESTORE SIGN
CP '-'
LD A,B
POP BC ;RESTORE
RET NZ
NEG ;NEGATE EXPONENT
RET
;
;NUMBER: Get unsigned integer from string.
; Inputs: string at (IX)
; C = truncated digit count
; (initially zero)
; B = total digit count
; HLH'L' = initial value
; Outputs: HLH'L' = number (binary integer)
; A = delimiter.
; B, C & IX updated
; Destroys: A,B,C,D,E,H,L,B',C',D',E',H',L',IX,F
;
NUMBIX: INC IX
NUMBER: CALL DIGITQ
RET C
INC B ;INCREMENT DIGIT COUNT
INC IX
CALL X10 ;*10 & COPY OLD VALUE
JR C,NUMB1 ;OVERFLOW
DEC C ;SEE IF TRUNCATED
INC C
JR NZ,NUMB1 ;IMPORTANT!
AND 0FH
EXX
LD B,0
LD C,A
ADD HL,BC ;ADD IN DIGIT
EXX
JR NC,NUMBER
INC HL ;CARRY
LD A,H
OR L
JR NZ,NUMBER
NUMB1: INC C ;TRUNCATION COUNTER
CALL SWAP1 ;RESTORE PREVIOUS VALUE
JR NUMBER
;
;FIX - Fix number to specified exponent value.
; Inputs: HLH'L'C = +ve non-zero number (floated)
; A = desired exponent (A>C)
; Outputs: HLH'L'C = fixed number (unsigned)
; fraction shifted into B'C'
; A'F' positive if integer input
; Destroys: C,H,L,A',B',C',H',L',F,F'
;
FIX: EX AF,AF'
XOR A
EX AF,AF'
SET 7,H ;IMPLIED 1
FIX1: CALL DIV2
CP C
RET Z
JP NC,FIX1
JP OFLOW
;
;SFIX - Convert to integer if necessary.
; Input: Variable-type number in HLH'L'C
; Output: Integer in HLH'L', C=0
; Destroys: A,C,H,L,A',B',C',H',L',F,F'
;
;NEGATE - Negate HLH'L'
; Destroys: H,L,H',L',F
;
FIX2: CALL SWAP
CALL SFIX
CALL SWAP
SFIX: DEC C
INC C
RET Z ;INTEGER/ZERO
BIT 7,H ;SIGN
PUSH AF
LD A,159
CALL FIX
POP AF
LD C,0
RET Z
NEGATE: OR A ;CLEAR CARRY
EXX
NEG0: PUSH DE
EX DE,HL
LD HL,0
SBC HL,DE
POP DE
EXX
PUSH DE
EX DE,HL
LD HL,0
SBC HL,DE
POP DE
RET
;
;NEG - Negate HLH'L'B'C'
; Also complements A (used in FADD)
; Destroys: A,H,L,B',C',H',L',F
;
NEG: EXX
CPL
PUSH HL
OR A ;CLEAR CARRY
LD HL,0
SBC HL,BC
LD B,H
LD C,L
POP HL
JR NEG0
; FNEGATE: z88dk added
FNEGATE: ;z88dk
dec c ;z88dk
inc c ;z88dk
jp z, NEGATE ;z88dk
ld a, h ;z88dk
xor $80 ;z88dk
ld h, a ;z88dk
ret ;z88dk
;
;SCALE - Trig scaling.
;MOD48 - 48-bit floating-point "modulus" (remainder).
; Inputs: HLH'L'C unsigned floating-point dividend
; DED'E'B'C'B unsigned 48-bit FP divisor
; Outputs: HLH'L'C floating point remainder (H7=1)
; E = quotient (bit 7 is sticky)
; Destroys: A,B,C,D,E,H,L,B',C',D',E',H',L',IX,F
;FLO48 - Float unsigned number (48 bits)
; Input/output in HLH'L'B'C'C
; Destroys: C,H,L,B',C',H',L',F
;
SCALE: LD A,150
CP C
LD A,ACLOST
JP C,ERROR ;"Accuracy lost"
CALL PIBY4
EXX
LD BC,2169H ;3.141592653589793238
EXX
MOD48: SET 7,D ;IMPLIED 1
SET 7,H
LD A,C
LD C,0 ;INIT QUOTIENT
LD IX,0
PUSH IX ;PUT ZERO ON STACK
CP B
JR C,MOD485 ;DIVIDEND<DIVISOR
MOD481: EXX ;CARRY=0 HERE
EX (SP),HL
SBC HL,BC
EX (SP),HL
SBC HL,DE
EXX
SBC HL,DE
JR NC,MOD482 ;DIVIDEND>=DIVISOR
EXX
EX (SP),HL
ADD HL,BC
EX (SP),HL
ADC HL,DE
EXX
ADC HL,DE
MOD482: CCF
RL C ;QUOTIENT
JR NC,MOD483
SET 7,C ;STICKY BIT
MOD483: DEC A
CP B
JR C,MOD484 ;DIVIDEND<DIVISOR
EX (SP),HL
ADD HL,HL ;DIVIDEND * 2
EX (SP),HL
EXX
ADC HL,HL
EXX
ADC HL,HL
JR NC,MOD481 ;AGAIN
OR A
EXX
EX (SP),HL
SBC HL,BC ;OVERFLOW, SO SUBTRACT
EX (SP),HL
SBC HL,DE
EXX
SBC HL,DE
OR A
JR MOD482
;
MOD484: INC A
MOD485: LD E,C ;QUOTIENT
LD C,A ;REMAINDER EXPONENT
EXX
POP BC
EXX
FLO48: BIT 7,H
RET NZ
EXX
SLA C
RL B
ADC HL,HL
EXX
ADC HL,HL
DEC C
JP NZ,FLO48
RET
;
;Float unsigned number
; Input/output in HLH'L'C
; Destroys: C,H,L,H',L',F
;
FLOAT: BIT 7,H
RET NZ
EXX ;SAME AS "X2"
ADD HL,HL ;TIME-CRITICAL
EXX ;REGION
ADC HL,HL ;(BENCHMARKS)
DEC C
JP NZ,FLOAT
RET
;
;SFLOAT - Convert to floating-point if necessary.
; Input: Variable-type number in HLH'L'C
; Output: Floating-point in HLH'L'C
; Destroys: A,C,H,L,H',L',F
;
FLOATA: EX AF,AF'
ADD A,+(RTABLE-DTABLE)/2
EX AF,AF'
FLOAT2: CALL SWAP
CALL SFLOAT
CALL SWAP
SFLOAT: DEC C
INC C
RET NZ ;ALREADY FLOATING-POINT
CALL TEST
RET Z ;ZERO
LD A,H
OR A
CALL M,NEGATE
LD C,159
CALL FLOAT
OR A
RET M ;NEGATIVE
RES 7,H
RET
;
;ROUND UP
;Return with carry set if 32-bit overflow
; Destroys: H,L,B',C',H',L',F
;
ADD1: EXX
LD BC,1
ADD HL,BC
EXX
RET NC
PUSH BC
LD BC,1
ADD HL,BC
POP BC
RET
;
;ODD - Add one if even, leave alone if odd.
; (Used to perform unbiassed rounding, i.e.
; number is rounded up half the time)
; Destroys: L',F (carry cleared)
;
ODD: OR A ;CLEAR CARRY
EXX
SET 0,L ;MAKE ODD
EXX
RET
;
;SWAP - Swap arguments.
; Exchanges DE,HL D'E',H'L' and B,C
; Destroys: A,B,C,D,E,H,L,D',E',H',L'
;SWAP1 - Swap DEHL with D'E'H'L'
; Destroys: D,E,H,L,D',E',H',L'
;
SWAP: LD A,C
LD C,B
LD B,A
SWAP1: EX DE,HL
EXX
EX DE,HL
EXX
RET
;
;DIV2 - destroys C,H,L,A',B',C',H',L',F,F'
;INCC - destroys C,F
;OFLOW
;
DIV2: CALL D2
EXX
RR B
RR C
EX AF,AF'
OR B
EX AF,AF'
EXX
INCC: INC C
RET NZ
OFLOW: LD A,TOOBIG
JP ERROR ;"Too big"
;
;FTEST - Test for zero & sign
; Output: A=0 if zero, A=&40 if +ve, A=&C0 if -ve
;
FTEST: CALL TEST
RET Z
LD A,H
AND 10000000B
OR 01000000B
RET
;
;TEST - Test HLH'L' for zero.
; Output: Z-flag set & A=0 if HLH'L'=0
; Destroys: A,F
;
TEST: LD A,H
OR L
EXX
OR H
OR L
EXX
RET
;
;FCOMP - Compare two numbers
; Output: A=0 if equal, A=&40 if L>R, A=&C0 if L<R
;
FCOMP: LD A,B
OR C ;Both integer?
JR NZ,FCOMP1
CALL ICP
FCOMP0: LD A,0
RET Z ;Equal
LD A,80H
RRA
RET
;
FCOMP1: CALL FLOAT2 ;Float both
CALL FCP
JR FCOMP0
;
;Integer and floating point compare.
;Sets carry & zero flags according to HLH'L'C-DED'E'B
;Result pre-set to FALSE
;ICP1, FCP1 destroy A,F
;
;ZERO - Return zero.
; Destroys: A,C,H,L,H',L'
;
ICP: CALL ICP1
ZERO: LD A,0
EXX
LD H,A
LD L,A
EXX
LD H,A
LD L,A
LD C,A
RET
;
FCP: CALL FCP1
JR ZERO ;PRESET FALSE
;
FCP0: LD A,C
CP B ;COMPARE EXPONENTS
RET NZ
ICP0: SBC HL,DE ;COMP MANTISSA MSB
ADD HL,DE
RET NZ
EXX
SBC HL,DE ;COMP MANTISSA LSB
ADD HL,DE
EXX
RET
;
FCP1: LD A,H
XOR D
LD A,H
RLA
RET M
JR NC,FCP0
CALL FCP0
RET Z ;** V0.1 BUG FIX
CCF
RET
;
ICP1: LD A,H
XOR D
JP P,ICP0
LD A,H
RLA
RET
;
;ADD - Integer add.
;Carry, sign & zero flags valid on exit
; Destroys: H,L,H',L',F
;
X10B: DEC B
INC C
X5: CALL COPY0
CALL D2C
CALL D2C
EX AF,AF' ;SAVE CARRY
ADD: EXX
ADD HL,DE
EXX
ADC HL,DE
RET
;
;SUB - Integer subtract.
;Carry, sign & zero flags valid on exit
; Destroys: H,L,H',L',F
;
SUB: EXX
OR A
SBC HL,DE
EXX
SBC HL,DE
RET
;
;X10 - unsigned integer * 10
; Inputs: HLH'L' initial value
; Outputs: DED'E' = initial HLH'L'
; Carry bit set if overflow
; If carry not set HLH'L'=result
; Destroys: D,E,H,L,D',E',H',L',F
;X2 - Multiply HLH'L' by 2 as 32-bit integer.
; Carry set if MSB=1 before shift.
; Sign set if MSB=1 after shift.
; Destroys: H,L,H',L',F
;
X10: CALL COPY0 ;DED'E'=HLH'L'
CALL X2
RET C ;TOO BIG
CALL X2
RET C
CALL ADD
RET C
X2: EXX
ADD HL,HL
EXX
ADC HL,HL
RET
;
;D2 - Divide HLH'L' by 2 as 32-bit integer.
; Carry set if LSB=1 before shift.
; Destroys: H,L,H',L',F
;
D2C: INC C
D2: SRL H
RR L
EXX
RR H
RR L
EXX
RET
;
;COPY - COPY HLH'L'C INTO DED'E'B
; Destroys: B,C,D,E,H,L,D',E',H',L'
;
COPY: LD B,C
COPY0: LD D,H
LD E,L
EXX
LD D,H
LD E,L
EXX
RET
;
;SQUARE - PUSH X*X
;PUSH5 - PUSH HLH'L'C ONTO STACK.
; Destroys: SP,IX
;
SQUARE: CALL COPY
CALL FMUL
PUSH5: POP IX ;RETURN ADDRESS
PUSH BC
PUSH HL
EXX
PUSH HL
EXX
JP (IX) ;"RETURN"
;
;POP5 - POP DED'E'B OFF STACK.
; Destroys: A,B,D,E,D',E',SP,IX
;
POP5: POP IX ;RETURN ADDRESS
EXX
POP DE
EXX
POP DE
LD A,C
POP BC
LD B,C
LD C,A
JP (IX) ;"RETURN"
;
;RATIO - Calculate (X-1)/(X+1)
; Inputs: X in HLH'L'C
; Outputs: (X-1)/(X+1) in HLH'L'C
; Destroys: Everything except IY,SP,I
;
RATIO: CALL PUSH5 ;SAVE X
CALL DONE
CALL FADD
CALL POP5 ;RESTORE X
CALL PUSH5 ;SAVE X+1
CALL SWAP
CALL DONE
CALL FSUB
CALL POP5 ;RESTORE X+1
JP FDIV
;
;POLY - Evaluate a polynomial.
; Inputs: X in HLH'L'C and also stored at (SP+2)
; Polynomial coefficients follow call.
; Outputs: Result in HLH'L'C
; Destroys: Everything except IY,SP,I
;Routine terminates on finding a coefficient >=1.
;Note: The last coefficient is EXECUTED on return
; so must contain only innocuous bytes!
;
POLY: LD IX,2
ADD IX,SP
EX (SP),IX
CALL DLOAD5 ;FIRST COEFFICIENT
POLY1: CALL FMUL
LD DE,5
ADD IX,DE
CALL DLOAD5 ;NEXT COEFFICIENT
EX (SP),IX
INC B
DEC B ;TEST
JP M,FADD
CALL FADD
CALL DLOAD5 ;X
EX (SP),IX
JR POLY1
;
;POWR10 - Calculate power of ten.
; Inputs: A=power of 10 required (A<128)
; A=binary exponent to be exceeded (A>=128)
; Outputs: DED'E'B = result
; A = actual power of ten returned
; Destroys: A,B,D,E,A',D',E',F,F'
;
POWR10: INC A
EX AF,AF'
PUSH HL
EXX
PUSH HL
EXX
CALL DONE
CALL SWAP
XOR A
POWR11: EX AF,AF'
DEC A
JR Z,POWR14 ;EXIT TYPE 1
JP P,POWR13
CP C
JR C,POWR14 ;EXIT TYPE 2
INC A
POWR13: EX AF,AF'
INC A
SET 7,H
CALL X5
JR NC,POWR12
EX AF,AF'
CALL D2C
EX AF,AF'
POWR12: EX AF,AF'
CALL C,ADD1 ;ROUND UP
INC C
JP M,POWR11
JP OFLOW
POWR14: CALL SWAP
RES 7,D
EXX
POP HL
EXX
POP HL
EX AF,AF'
RET
;
;DIVA, DIVB - DIVISION PRIMITIVE.
; Function: D'E'DE = H'L'HLD'E'DE / B'C'BC
; Remainder in H'L'HL
; Inputs: A = loop counter (normally -32)
; Destroys: A,D,E,H,L,D',E',H',L',F
;
DIVA: OR A ;CLEAR CARRY
DIV0: SBC HL,BC ;DIVIDEND-DIVISOR
EXX
SBC HL,BC
EXX
JR NC,DIV1
ADD HL,BC ;DIVIDEND+DIVISOR
EXX
ADC HL,BC
EXX
DIV1: CCF
DIVC: RL E ;SHIFT RESULT INTO DE
RL D
EXX
RL E
RL D
EXX
INC A
RET P
DIVB: ADC HL,HL ;DIVIDEND*2
EXX
ADC HL,HL
EXX
JR NC,DIV0
OR A
SBC HL,BC ;DIVIDEND-DIVISOR
EXX
SBC HL,BC
EXX
SCF
JP DIVC
;
;MULA, MULB - MULTIPLICATION PRIMITIVE.
; Function: H'L'HLD'E'DE = B'C'BC * D'E'DE
; Inputs: A = loop counter (usually -32)
; H'L'HL = 0
; Destroys: D,E,H,L,D',E',H',L',A,F
;
MULA: OR A ;CLEAR CARRY
MUL0: EXX
RR D ;MULTIPLIER/2
RR E
EXX
RR D
RR E
JR NC,MUL1
ADD HL,BC ;ADD IN MULTIPLICAND
EXX
ADC HL,BC
EXX
MUL1: INC A
RET P
MULB: EXX
RR H ;PRODUCT/2
RR L
EXX
RR H
RR L
JP MUL0
;
;SQRA, SQRB - SQUARE ROOT PRIMITIVES
; Function: B'C'BC = SQR (D'E'DE)
; Inputs: A = loop counter (normally -31)
; B'C'BCH'L'HL initialised to 0
; Destroys: A,B,C,D,E,H,L,B',C',D',E',H',L',F
;
SQR1: SBC HL,BC
EXX
SBC HL,BC
EXX
INC C
JR NC,SQR2
DEC C
ADD HL,BC
EXX
ADC HL,BC
EXX
DEC C
SQR2: INC A
RET P
SQRA: SLA C
RL B
EXX
RL C
RL B
EXX
INC C
SLA E
RL D
EXX
RL E
RL D
EXX
ADC HL,HL
EXX
ADC HL,HL
EXX
SLA E
RL D
EXX
RL E
RL D
EXX
ADC HL,HL
EXX
ADC HL,HL
EXX
JP NC,SQR1
SQR3: OR A
SBC HL,BC
EXX
SBC HL,BC
EXX
INC C
JP SQR2
;
SQRB: ADD HL,HL
EXX
ADC HL,HL
EXX
JR C,SQR3
INC A
INC C
SBC HL,BC
EXX
SBC HL,BC
EXX
RET NC
ADD HL,BC
EXX
ADC HL,BC
EXX
DEC C
RET
;
DIGITQ: LD A,(IX)
CP '9'+1
CCF
RET C
CP '0'
RET
;
SIGNQ: LD A,(IX)
INC IX
CP ' '
JR Z,SIGNQ
CP '+'
RET Z
CP '-'
RET Z
DEC IX
RET
;
ENDIF
| 24.048535 | 77 | 0.383389 |
c02e690fbcb1219e8cce7d55e1e21a874845b079 | 1,219 | sql | SQL | tests/sql/original_db_setup.sql | ikethecoder/sae-postgres | 8b84fbce45ff1caf7b70a96b4a87857b54fc2e32 | [
"Apache-2.0"
] | 1 | 2019-09-18T20:04:20.000Z | 2019-09-18T20:04:20.000Z | tests/sql/original_db_setup.sql | ikethecoder/sae-postgres | 8b84fbce45ff1caf7b70a96b4a87857b54fc2e32 | [
"Apache-2.0"
] | 7 | 2020-04-16T23:35:59.000Z | 2022-01-10T21:51:24.000Z | tests/sql/original_db_setup.sql | ikethecoder/sae-postgres | 8b84fbce45ff1caf7b70a96b4a87857b54fc2e32 | [
"Apache-2.0"
] | null | null | null | CREATE SCHEMA protected_data;
CREATE SCHEMA working_data;
CREATE ROLE ${WORKSPACE}_contribute;
GRANT USAGE ON SCHEMA protected_data TO ${WORKSPACE}_contribute;
GRANT SELECT ON ALL TABLES IN SCHEMA protected_data TO ${WORKSPACE}_contribute;
GRANT ALL ON ALL TABLES IN SCHEMA working_data TO ${WORKSPACE}_contribute;
GRANT CREATE, USAGE ON SCHEMA working_data TO ${WORKSPACE}_contribute;
ALTER DEFAULT PRIVILEGES IN SCHEMA protected_data GRANT SELECT ON TABLES TO ${WORKSPACE}_contribute;
ALTER DEFAULT PRIVILEGES IN SCHEMA working_data GRANT ALL ON TABLES TO ${WORKSPACE}_contribute;
CREATE ROLE ${WORKSPACE}_readonly;
GRANT SELECT ON ALL TABLES IN SCHEMA protected_data TO ${WORKSPACE}_readonly;
GRANT SELECT ON ALL TABLES IN SCHEMA working_data TO ${WORKSPACE}_readonly;
ALTER DEFAULT PRIVILEGES IN SCHEMA protected_data GRANT SELECT ON TABLES TO ${WORKSPACE}_readonly;
ALTER DEFAULT PRIVILEGES IN SCHEMA working_data GRANT SELECT ON TABLES TO ${WORKSPACE}_readonly;
-- CREATE USER ${WORKSPACE}_user WITH ENCRYPTED PASSWORD '${POSTGRES_APP_PASSWORD}';
-- GRANT ${WORKSPACE}_contribute TO ${WORKSPACE}_user;
-- ALTER ROLE ${WORKSPACE}_contribute IN DATABASE ${APP_DATABASE} SET search_path TO working_data, public;
| 55.409091 | 106 | 0.815422 |
3aac2ea905199d7ef9a0c7c85dadee00a50ebf06 | 407 | lua | Lua | vendor/RainbowRepacker/tool/engine_android(5)/assets/scripts/view/kScreen_1280_800/games/common2/microphoneLayout.lua | huangtao/cloud-test | 8087b1337d47daab9eb39335ca6e286df0e4b4dc | [
"Apache-2.0"
] | 1 | 2018-09-12T15:43:32.000Z | 2018-09-12T15:43:32.000Z | vendor/RainbowRepacker/tool/engine_android(5)/assets/scripts/view/kScreen_1280_800/games/common2/microphoneLayout.lua | huangtao/cloud-test | 8087b1337d47daab9eb39335ca6e286df0e4b4dc | [
"Apache-2.0"
] | null | null | null | vendor/RainbowRepacker/tool/engine_android(5)/assets/scripts/view/kScreen_1280_800/games/common2/microphoneLayout.lua | huangtao/cloud-test | 8087b1337d47daab9eb39335ca6e286df0e4b4dc | [
"Apache-2.0"
] | 3 | 2018-09-12T15:43:33.000Z | 2019-07-10T09:50:15.000Z | microphoneLayout=
{
name="microphoneLayout",type=0,typeName="View",time=0,x=0,y=0,width=68,height=68,visible=1,nodeAlign=kAlignCenter,fillParentWidth=0,fillParentHeight=0,
{
name="microphone",type=1,typeName="Image",time=0,x=0,y=0,width=68,height=68,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignCenter,file="games/common/chatRealTime/video_microphone.png"
}
}
return microphoneLayout; | 50.875 | 201 | 0.798526 |
ac7a37161e4324b2aeabb533b43ee4427c92ccb9 | 1,002 | swift | Swift | VastParserSwift/ElemenHandlerImpl/Common/Creatives/Creative/InLine/UniversalAdidElementHandler.swift | DJ110/VastParserSwift | 3d15869708da6d0de3d6a1a5acff50e46542b0ba | [
"MIT"
] | 1 | 2021-07-22T07:13:41.000Z | 2021-07-22T07:13:41.000Z | VastParserSwift/ElemenHandlerImpl/Common/Creatives/Creative/InLine/UniversalAdidElementHandler.swift | DJ110/VastParserSwift | 3d15869708da6d0de3d6a1a5acff50e46542b0ba | [
"MIT"
] | null | null | null | VastParserSwift/ElemenHandlerImpl/Common/Creatives/Creative/InLine/UniversalAdidElementHandler.swift | DJ110/VastParserSwift | 3d15869708da6d0de3d6a1a5acff50e46542b0ba | [
"MIT"
] | null | null | null | //
// UniversalAdidElementHandler.swift
// VastParserSwift
//
// Created by 伊藤大司 on 7/10/20.
// Copyright © 2020 DJ110. All rights reserved.
//
import Foundation
class UniversalAdidElementHandler: ElementHandler {
let rank: Int = 5
func execute(state: ParseState, elementName: String, attributes attributeDict: [String : String]) {
var universalAdid = UniversalAdId()
if let idRegistry = attributeDict["idRegistry"] {
universalAdid.idRegistry = idRegistry
}
if state.checkAnyParent(rank: rank-1, targetElementName: Constants.Element.CREATIVE)
&& state.isInLine() {
state.vast.vastAd?.vastInline?.creatives.creative.last?.universalAdid = universalAdid
state.updateParseElement(rank: rank, elementName: elementName)
} else {
state.errors.append(ParseError(message: "UniversalAdId should be under Creative of Inline"))
}
}
}
| 30.363636 | 104 | 0.640719 |
763227085f33f67dea6162b54e664890dd685a21 | 3,351 | go | Go | 20211024_graduateProject/iam_study/api/swagger/docs/user_swagger.go | todaynowy/Go_work | 8efba6dd745ffc4485d8fd63f6c89b331aa970ce | [
"MIT"
] | 1 | 2021-07-31T13:38:25.000Z | 2021-07-31T13:38:25.000Z | 20211024_graduateProject/iam_study/api/swagger/docs/user_swagger.go | todaynowy/Go_work | 8efba6dd745ffc4485d8fd63f6c89b331aa970ce | [
"MIT"
] | null | null | null | 20211024_graduateProject/iam_study/api/swagger/docs/user_swagger.go | todaynowy/Go_work | 8efba6dd745ffc4485d8fd63f6c89b331aa970ce | [
"MIT"
] | null | null | null | // Copyright 2020 Lingfei Kong <colin404@foxmail.com>. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package docs
import (
v1 "github.com/marmotedu/api/apiserver/v1"
metav1 "github.com/marmotedu/component-base/pkg/meta/v1"
"github.com/marmotedu/iam/internal/apiserver/controller/v1/user"
)
// swagger:route POST /users users createUserRequest
//
// Create users.
//
// Create users according to input parameters.
//
// Security:
// api_key:
//
// Responses:
// default: errResponse
// 200: createUserResponse
// swagger:route DELETE /users/{name} users deleteUserRequest
//
// Delete user.
//
// Delete user according to input parameters.
//
// Responses:
// default: errResponse
// 200: okResponse
// swagger:route DELETE /users users deleteUserCollectionRequest
//
// Batch delete user.
//
// Delete users
//
// Security:
// api_key:
//
// Responses:
// default: errResponse
// 200: okResponse
// swagger:route PUT /users/{name} users updateUserRequest
//
// Update user.
//
// Update user according to input parameters.
//
// Security:
// api_key:
//
// Responses:
// default: errResponse
// 200: updateUserResponse
// swagger:route PUT /users/{name}/change_password users changePasswordRequest
//
// Change user password.
//
// Change user password.
//
// Security:
// api_key:
//
// Responses:
// default: errResponse
// 200: okResponse
// swagger:route GET /users/{name} users getUserRequest
//
// Get details for specified user.
//
// Get details for specified user according to input parameters.
//
// Responses:
// default: errResponse
// 200: getUserResponse
// swagger:route GET /users users listUserRequest
//
// List users.
//
// List users.
//
// Responses:
// default: errResponse
// 200: listUserResponse
// List users request.
// swagger:parameters listUserRequest
type listUserRequestParamsWrapper struct {
// in:query
metav1.ListOptions
}
// List users response.
// swagger:response listUserResponse
type listUserResponseWrapper struct {
// in:body
Body v1.UserList
}
// User response.
// swagger:response createUserResponse
type createUserResponseWrapper struct {
// in:body
Body v1.User
}
// User response.
// swagger:response updateUserResponse
type updateUserResponseWrapper struct {
// in:body
Body v1.User
}
// User response.
// swagger:response getUserResponse
type getUserResponseWrapper struct {
// in:body
Body v1.User
}
// swagger:parameters createUserRequest updateUserRequest
type userRequestParamsWrapper struct {
// User information.
// in:body
Body v1.User
}
// swagger:parameters deleteUserRequest getUserRequest updateUserRequest
type userNameParamsWrapper struct {
// User name.
// in:path
Name string `json:"name"`
}
// Batch delete users.
// swagger:parameters deleteUserCollectionRequest deletePolicyCollectionRequest
type deleteCollectionRequestParamsWrapper struct {
// in:query
Names []string `json:"name"`
}
// Change user password.
// swagger:parameters changePasswordRequest
type changePasswordRequestParamsWrapper struct {
// The name of user.
// in:path
Name string `json:"name"`
// in:body
Body user.ChangePasswordRequest
}
| 20.685185 | 79 | 0.705163 |
5b5fb5278f333bf2cc263ecdf2e71617ae8efdf1 | 993 | plsql | SQL | database/min_date_from_each_table_in_schema.plsql | bheckel/code | 98309e8aa145901e49460546643c911eaaff54e6 | [
"Apache-2.0"
] | 1 | 2019-08-11T00:39:34.000Z | 2019-08-11T00:39:34.000Z | database/min_date_from_each_table_in_schema.plsql | bheckel/code | 98309e8aa145901e49460546643c911eaaff54e6 | [
"Apache-2.0"
] | null | null | null | database/min_date_from_each_table_in_schema.plsql | bheckel/code | 98309e8aa145901e49460546643c911eaaff54e6 | [
"Apache-2.0"
] | 1 | 2020-07-28T05:58:47.000Z | 2020-07-28T05:58:47.000Z | -- Created: 08-Aug-19 (Bob Heckel)
create or replace PACKAGE BODY RION39366 IS
PROCEDURE do IS
mindt DATE;
CURSOR c1 IS
SELECT table_name, low_value
FROM user_tab_columns
WHERE table_name IN(
SELECT table_name
FROM user_tables
WHERE table_name NOT LIKE 'BDG%'
AND table_name NOT LIKE '%CMK'
AND table_name NOT LIKE '%\_OLD' ESCAPE '\'
AND table_name NOT LIKE '%\_BKUP' ESCAPE '\'
AND NOT regexp_like(table_name, '.*\d+$')
AND NOT regexp_like(table_name, '^S\d+')
)
AND column_name = 'CREATED'
ORDER BY 1
;
BEGIN
FOR c1rec IN c1 LOOP
dbms_stats.convert_raw_value(hextoraw(c1rec.LOW_VALUE), mindt);
IF mindt < '01JAN1970' THEN
dbms_output.put_line(c1rec.table_name || ' ' || to_char(mindt, 'DD-MON-YYYY'));
END IF;
END LOOP;
END do;
END;
| 26.837838 | 91 | 0.553877 |
2f088fcf2481d1ce7610d42370d922174723fb5b | 114 | php | PHP | src/MailerInterface.php | UrosPurtic/mailer | c180192c0da4ec5827b74e146a396a7bb8f0c9ae | [
"MIT"
] | null | null | null | src/MailerInterface.php | UrosPurtic/mailer | c180192c0da4ec5827b74e146a396a7bb8f0c9ae | [
"MIT"
] | 1 | 2020-12-30T09:26:24.000Z | 2020-12-30T09:26:24.000Z | src/MailerInterface.php | UrosPurtic/mailer | c180192c0da4ec5827b74e146a396a7bb8f0c9ae | [
"MIT"
] | 4 | 2020-01-14T13:05:30.000Z | 2020-12-29T06:56:27.000Z | <?php
namespace G4\Mailer;
interface MailerInterface
{
public function send(\G4\Mailer\Message $message);
} | 12.666667 | 54 | 0.736842 |
b1503c87dec70ae3a5fe803e845856310d4c481f | 12,258 | h | C | lib/tableau.h | Alan-Robertson/qecode | fc01e6f66a7fbe4f6b2bda6b3874fd6e5b10c628 | [
"MIT"
] | 4 | 2018-03-07T06:15:32.000Z | 2021-11-17T10:50:15.000Z | lib/tableau.h | Alan-Robertson/qecode | fc01e6f66a7fbe4f6b2bda6b3874fd6e5b10c628 | [
"MIT"
] | null | null | null | lib/tableau.h | Alan-Robertson/qecode | fc01e6f66a7fbe4f6b2bda6b3874fd6e5b10c628 | [
"MIT"
] | null | null | null | #ifndef TABLEAU
#define TABLEAU
// This is a "hidden" column containing the phase information
#define TABLEAU_PHASE_COL (tableau->length)
#include "sym.h"
#include "sym_iter.h"
#include "destabilisers.h"
/*
* tableau_create
* Creates a tableau representation of the stabilisers and destabilisers as per 10.1103/PhysRevA.70.052328
* :: const sym* code :: The sym object for the error correcting code
* :: const sym* logicals :: The sym object for the associated logicals
* :: const sym** destabilisers :: The array of sym objects for the associated destabilisers
* Returns a sym* object containing the tableau
*/
sym* tableau_create(const sym* code, const sym* logicals);
/*
* tableau_extend:
* Extends the tableau to fill the full 2n by 2n matrix
* used to find the stabilisers and associated destabilisers in turn
* :: sym* tableau :: The current tableau object containing the stabilisers and destabilisers
* :: sym* logicals :: The logicals associated with the code
* :: const unsigned n_stabilisers :: The current number of stabilisers
* Operation is performed in place, nothing returned
*/
void tableau_extend(sym* tableau, const sym* logicals, const unsigned n_stabilisers);
bool tableau_backtrack_stabiliser(
sym* tableau,
const sym* logicals,
const unsigned stabiliser);
bool tableau_backtrack_destabiliser(
sym* tableau,
const sym* logicals,
const unsigned stabiliser);
bool tableau_is_stabiliser(
const sym* stabiliser_candidate,
const sym* tableau,
const sym* logicals,
const unsigned n_stabiliser);
bool tableau_is_destabiliser(
const sym* destabiliser_candidate,
const sym* tableau,
const sym* logicals,
const unsigned n_stabiliser);
void tableau_rank_deficient(sym* tableau);
/*
* tableau_cnot
* Performs a CNOT gate on the tableau
* :: sym* tableau :: The tableau object being operated on
* :: const unsigned control :: The control qubit in the CNOT gate
* :: const unsigned target :: The target qubit in the CNOT gate
* Operations are performed in place, nothing is returned
*/
void tableau_cnot(sym* tableau, const unsigned control, const unsigned target);
/*
* tableau_hadamard
* Performs a Hadamard gate on the tableau
* :: sym* tableau :: The tableau object being operated on
* :: const unsigned target :: The target qubit in the Hadamard gate
* Operations are performed in place, nothing is returned
*/
void tableau_hadamard(sym* tableau, const unsigned target);
/*
* tableau_phase
* Performs a phase gate on the tableau
* :: sym* tableau :: The tableau object being operated on
* :: const unsigned target :: The target qubit in the phase gate
* Operations are performed in place, nothing is returned
*/
void tableau_phase(sym* tableau, const unsigned target);
/*
* tableau_create
* Creates a tableau representation of the stabilisers and destabilisers as per 10.1103/PhysRevA.70.052328
* :: const sym* code :: The sym object for the error correcting code
* :: const sym* logicals :: The sym object for the associated logicals
* :: const sym** destabilisers :: The array of sym objects for the associated destabilisers
* Returns a sym* object containing the tableau
*/
sym* tableau_create(const sym* code, const sym* logicals)
{
sym** destabilisers = destabilisers_generate(code, logicals);
// Could not find destabilisers
if (NULL == destabilisers)
{
return NULL;
}
// One extra column to track the phases
sym* tableau = sym_create(code->length, code->length);
// Create the tableau object
for (size_t i = 0; i < code->height; i++)
{
sym_row_copy(tableau, destabilisers[i], i, 0);
sym_row_copy(tableau, code, i + tableau->height/2, i);
}
// Add the additional stabilisers and destabilisers
tableau_extend(tableau, logicals, code->height);
// Free the destabilisers
for (uint32_t i = 0; i < code->height; i++)
{
sym_free(destabilisers[i]);
}
free(destabilisers);
// Add a phase tracking column
//tableau_add_phase_col(tableau);
return tableau;
}
/*
* tableau_extend:
* Extends the tableau to fill the full 2n by 2n matrix, this function is a wrapper for the backtrack methods
* used to find the stabilisers and associated destabilisers in turn
* :: sym* tableau :: The current tableau object containing the stabilisers and destabilisers
* :: sym* logicals :: The logicals associated with the code
* :: const unsigned n_stabilisers :: The current number of stabilisers
* Operation is performed in place, nothing returned
*/
void tableau_extend(sym* tableau, const sym* logicals, const unsigned n_stabilisers)
{
sym* t = sym_transpose(logicals);
for (size_t i = 0; i < t->height / 2; i++)
{
// Copy the Z to the destabilisers
sym_row_copy(tableau, t, tableau->length/2 - (i+1), i);
// Copy the X to the stabilisers
sym_row_copy(tableau, t, tableau->length - (i+1), i + t->height/2);
}
sym_free(t);
return;
// If you want to search for a low weight stabiliser use this, however it may not be linearly independent
// And if it's not then this isn't going to work
/*if (n_stabilisers < tableau->height / 2)
{
bool result = tableau_backtrack_stabiliser(tableau, logicals, n_stabilisers);
if (result == false)
{
printf("Tableau could not be completed!\n");
}
}*/
}
bool tableau_backtrack_stabiliser(
sym* tableau,
const sym* logicals,
const unsigned stabiliser)
{
// The base case
if (stabiliser == tableau->height / 2)
{
return true;
}
bool found_stabiliser = false;
sym_iter* stabiliser_candidate = sym_iter_create(tableau->length);
while(sym_iter_next(stabiliser_candidate) && !found_stabiliser)
{
// Check whether our proposal is a stabiliser
if (tableau_is_stabiliser(
stabiliser_candidate->state,
tableau,
logicals,
stabiliser))
{ // If it is a stabiliser, then copy it to our tableau
sym_row_copy(tableau, stabiliser_candidate->state, tableau->height / 2 + stabiliser, 0);
// Backtrack to find the associated destabiliser
found_stabiliser = tableau_backtrack_destabiliser(
tableau,
logicals,
stabiliser);
}
}
// Free up memory and return
sym_iter_free(stabiliser_candidate);
return found_stabiliser;
}
bool tableau_backtrack_destabiliser(
sym* tableau,
const sym* logicals,
const unsigned stabiliser)
{
// The base case occurs with the destabilisers
bool found_destabiliser = false;
sym_iter* destabiliser_candidate = sym_iter_create(tableau->length);
while(sym_iter_next(destabiliser_candidate) && !found_destabiliser)
{
// Check whether our proposal is a destabiliser
if (tableau_is_destabiliser(
destabiliser_candidate->state,
tableau,
logicals,
stabiliser))
{ // If it is a destabiliser, then copy it to our tableau
sym_row_copy(tableau, destabiliser_candidate->state, stabiliser, 0);
// Backtrack to find the next stabiliser
found_destabiliser = tableau_backtrack_stabiliser(
tableau,
logicals,
stabiliser + 1);
}
}
// Free up memory and return
sym_iter_free(destabiliser_candidate);
return found_destabiliser;
}
/*
* tableau_extend:
* Extends a code to a full 2n x 2n tableau
* :: sym* tableau :: The current tableau
* :: const sym* logicals :: The logicals associated with the stabiliser code
* :: const n_stabiliser :: What stabiliser is currently being checked
* Returns true or false if the current candidate is or isn't a destabiliser
*/
bool tableau_is_stabiliser(
const sym* stabiliser_candidate,
const sym* tableau,
const sym* logicals,
const unsigned n_stabiliser)
{
// Check that it commutes with the logicals
for (size_t i = 0; i < logicals->length; i++)
{
if (1 == sym_row_column_commutes(stabiliser_candidate, logicals, 0, i))
{
return false;
}
}
// Check that it commutes with the current stabilisers
for (size_t i = tableau->length / 2; i < tableau->length / 2 + n_stabiliser; i++)
{
if (1 == sym_row_commutes(tableau, stabiliser_candidate, i, 0))
{
return false;
}
}
// Check that it commutes with the current destabilisers
for (size_t i = 0; i < n_stabiliser; i++)
{
if (1 == sym_row_commutes(tableau, stabiliser_candidate, i, 0))
{
return false;
}
}
// All checks passed, it is a stabiliser, return true
return true;
}
bool tableau_is_destabiliser(
const sym* destabiliser_candidate,
const sym* tableau,
const sym* logicals,
const unsigned n_stabiliser)
{
// Check that it commutes with the logicals
for (size_t i = 0; i < logicals->length; i++)
{
if (1 == sym_row_column_commutes(destabiliser_candidate, logicals, 0, i))
{
return false;
}
}
// Check that it commutes with the current stabilisers
for (size_t i = tableau->length / 2; i < tableau->length / 2 + n_stabiliser - 1; i++)
{
if (1 == sym_row_commutes(tableau, destabiliser_candidate, i, 0))
{
return false;
}
}
// Check that it anti-commutes with pairwise with the appropriate stabiliser
if (0 == sym_row_commutes(tableau, destabiliser_candidate, tableau->length / 2 + n_stabiliser, 0))
{
return false;
}
// Check that it commutes with the current destabilisers
for (size_t i = 0; i < n_stabiliser; i++)
{
if (1 == sym_row_commutes(tableau, destabiliser_candidate, i, 0))
{
return false;
}
}
// All checks passed, it is a destabiliser, return true
return true;
}
/*
* tableau_CNOT
* Performs a CNOT gate on the tableau
* :: sym* tableau :: The tableau object being operated on
* :: const unsigned control :: The control qubit in the CNOT gate
* :: const unsigned target :: The target qubit in the CNOT gate
* Operations are performed in place, nothing is returned
*/
void tableau_cnot(sym* tableau, const unsigned control, const unsigned target)
{
if (control > tableau->length / 2
|| target > tableau->length / 2)
{
printf("Invalid operation attempted\n");
}
for (size_t i = 0; i < tableau->height; i++)
{
// Set the target column to the control column XORed with the target column for both X and Z sub-matricies
sym_set(tableau, i, target, sym_get(tableau, i, target ) ^ sym_get(tableau, i, control));
sym_set(tableau, i, control + tableau->length / 2, sym_get(tableau, i, target + tableau->length / 2 ) ^ sym_get(tableau, i, control + tableau->length / 2));
}
return;
}
/*
* tableau_hadamard
* Performs a Hadamard gate on the tableau
* :: sym* tableau :: The tableau object being operated on
* :: const unsigned target :: The target qubit in the Hadamard gate
* Operations are performed in place, nothing is returned
*/
void tableau_hadamard(sym* tableau, const unsigned target)
{
for (size_t i = 0; i < tableau->height; i++)
{
sym_set(tableau, i, target, sym_get(tableau, i, target) ^ sym_get(tableau, i, target + tableau->length / 2));
sym_set(tableau, i, target + tableau->length / 2, sym_get(tableau, i, target) ^ sym_get(tableau, i, target + tableau->length / 2));
sym_set(tableau, i, target, sym_get(tableau, i, target) ^ sym_get(tableau, i, target + tableau->length / 2));
}
return;
}
/*
* tableau_phase
* Performs a phase gate on the tableau
* :: sym* tableau :: The tableau object being operated on
* :: const unsigned target :: The target qubit in the phase gate
* Operations are performed in place, nothing is returned
*/
void tableau_phase(sym* tableau, const unsigned target)
{
for (size_t i = 0; i < tableau->height; i++)
{
sym_set(tableau, i, target + tableau->length / 2, sym_get(tableau, i, target) ^ sym_get(tableau, i, target + tableau->length / 2));
}
return;
}
/*
* tableau_add_phase_col
* Adds a column to track phase information on the tableau
* :: sym* tableau :: The tableau object being operated on
* Operations are performed in place, nothing is returned
* You don't really need this if you don't care about the phases
*/
void tableau_add_phase_col(sym* tableau)
{
// Create a new tableau
sym* tableau_new = sym_create(tableau->height, tableau->length + 1);
for (uint32_t i = 0; i < tableau->height; i++)
{
for (uint32_t j = 0; j < tableau->length; j++)
{
sym_set(tableau_new, i, j, sym_get(tableau, i, j));
}
}
// Swap the old matrix to the new sym object and free it
BYTE* old_matrix = tableau->matrix;
tableau->matrix = tableau_new->matrix;
tableau_new->matrix = old_matrix;
sym_free(tableau_new);
return;
}
#endif
| 29.537349 | 159 | 0.716185 |
b66648740a90981eb09899ccef0b29a7ff0b1553 | 651 | rb | Ruby | app/models/phone_number_range.rb | amooma/GS5 | acef44a7f28df0274b52a77f3a1d4c9f418d3c63 | [
"MIT"
] | 14 | 2015-01-07T10:20:22.000Z | 2020-02-19T13:35:26.000Z | app/models/phone_number_range.rb | tpizzle/GS5 | acef44a7f28df0274b52a77f3a1d4c9f418d3c63 | [
"MIT"
] | 3 | 2015-07-22T04:35:10.000Z | 2021-02-20T14:07:27.000Z | app/models/phone_number_range.rb | tpizzle/GS5 | acef44a7f28df0274b52a77f3a1d4c9f418d3c63 | [
"MIT"
] | 20 | 2015-04-08T07:23:21.000Z | 2021-09-11T09:05:38.000Z | class PhoneNumberRange < ActiveRecord::Base
attr_accessible :name, :description
has_many :phone_numbers, :as => :phone_numberable, :dependent => :destroy
belongs_to :phone_number_rangeable, :polymorphic => true
validates_presence_of :name
validates_uniqueness_of :name, :scope => [:phone_number_rangeable_id, :phone_number_rangeable_type]
validates_inclusion_of :name, :in => [GsParameter.get('INTERNAL_EXTENSIONS'), GsParameter.get('DIRECT_INWARD_DIALING_NUMBERS'), GsParameter.get('SERVICE_NUMBERS')]
validates_presence_of :phone_number_rangeable_id
validates_presence_of :phone_number_rangeable
def to_s
name
end
end
| 38.294118 | 165 | 0.794163 |
7b4c8bf3520e859c9e031401f33dfc7d64c452bd | 1,138 | css | CSS | dist/css/home.css | hecto932/vw-react | 1230e136cbe8b2737c0e06639ff043c560c021a8 | [
"Unlicense"
] | 1 | 2019-02-11T04:02:34.000Z | 2019-02-11T04:02:34.000Z | dist/css/home.css | hecto932/vw-react | 1230e136cbe8b2737c0e06639ff043c560c021a8 | [
"Unlicense"
] | null | null | null | dist/css/home.css | hecto932/vw-react | 1230e136cbe8b2737c0e06639ff043c560c021a8 | [
"Unlicense"
] | null | null | null | .Job{margin-top:1em}
.notifications-mobile{display:none}.display-inline{display:inline}.nav-icons{font-size:1.5em;margin:0px 0.2em;color:#a1a3a6;text-align:center}.search-form{margin-right:1em}.search-input{display:inline;border-radius:7px 0px 0px 7px;margin-right:0 !important;-webkit-transition:all 1s ease;-moz-transition:all 1s ease;transition:all 1s ease}.search-button{display:inline;background-color:#0f7aff;color:white;border-radius:0px 7px 7px 0px !important;border-color:#0f7aff}.notification-number{position:relative;top:-15px;left:-7px;font-size:0.5em;border-radius:3px 3px;text-align:center;padding:0.2em 0.4em}.search-result{position:absolute;top:70px;width:280px}.search-text{display:inline;border-radius:7px 0px 0px 7px;width:227px;-webkit-transition:all 1s ease;-moz-transition:all 1s ease;transition:all 1s ease}@media screen and (min-width: 880px){.search-text:focus{width:454px}}@media (max-width: 638px){.search-text{width:200px}.nav-icons{font-size:1.5em;margin:0px 0.2em;color:#a1a3a6;text-align:center}.notifications{display:none}.notifications-mobile{display:inline;color:#a1a3a6;font-size:1em;margin-top:0.5em}}
| 379.333333 | 1,116 | 0.800527 |
ed2e5936c047c79d0ffb89e44f71f327f62c7147 | 281 | lua | Lua | gamestates/died.lua | usysrc/MagicRealms | e1febee9c6ab238e8575f4ba135e8210d6b13902 | [
"0BSD"
] | null | null | null | gamestates/died.lua | usysrc/MagicRealms | e1febee9c6ab238e8575f4ba135e8210d6b13902 | [
"0BSD"
] | null | null | null | gamestates/died.lua | usysrc/MagicRealms | e1febee9c6ab238e8575f4ba135e8210d6b13902 | [
"0BSD"
] | null | null | null | local Gamestate = require "lib.hump.gamestate"
local died = {}
died.draw = function()
love.graphics.clear()
love.graphics.print("YOU DIED", 250, 150)
end
died.keypressed = function(self, key)
if key == "escape" then
love.event.quit()
end
end
return died | 17.5625 | 46 | 0.658363 |
37d103f1f4f83658b1c037c4bc23cf0c2f00d080 | 2,952 | swift | Swift | Extra/Classes/Foundation/String+Extra.swift | rpedepoy/Extra | e15880aa421161a3723fee2a12cef6f2f2c445b6 | [
"MIT"
] | 24 | 2017-02-22T14:38:54.000Z | 2020-03-20T15:07:21.000Z | Extra/Classes/Foundation/String+Extra.swift | rpedepoy/Extra | e15880aa421161a3723fee2a12cef6f2f2c445b6 | [
"MIT"
] | 4 | 2017-07-13T09:34:16.000Z | 2020-03-30T14:34:51.000Z | Extra/Classes/Foundation/String+Extra.swift | rpedepoy/Extra | e15880aa421161a3723fee2a12cef6f2f2c445b6 | [
"MIT"
] | 5 | 2018-03-22T08:30:33.000Z | 2020-12-14T12:39:04.000Z | // The MIT License (MIT)
//
// Copyright (c) 2017 Smart&Soft
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
import Foundation
extension String {
/// Same as boundingRect(), but simplified !
///
/// - parameter width: width into the string is constrained
/// - parameter attributes: Your attributed string attributes
///
/// - returns: computed height according to the string length
public func heightConstrained(to width: CGFloat, attributes: [NSAttributedString.Key: Any]? = nil) -> CGFloat {
let constraintRect = CGSize(width: width, height: CGFloat.greatestFiniteMagnitude)
let boundingBox = self.boundingRect(with: constraintRect,
options: NSStringDrawingOptions.usesLineFragmentOrigin,
attributes: attributes,
context: nil)
return boundingBox.height
}
/// regex : [A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,6}
///
/// - returns: True or false mail validation
public func isValidEmail() -> Bool {
let emailRegex = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}"
return NSPredicate(format: "SELF MATCHES %@", emailRegex).evaluate(with: self)
}
/// Capitalize only the first letter of the entire string (localized capitalized)
public func firstCapitalized() -> String {
if self.isEmpty { return self }
return String(self.prefix(1)).uppercased() + String(self.dropFirst())
}
/// Check if the string matches to the passed regex
public func matchesRegex(regex: String) -> Bool {
let predicate = NSPredicate(format: "SELF MATCHES %@", regex)
return predicate.evaluate(with: self)
}
/// Base-64 encoded String from a raw String
///
/// - Returns: encoded string
func base64() -> String? {
return self.data(using: String.Encoding.utf8)?.base64EncodedString()
}
}
| 39.36 | 113 | 0.676829 |
3306b230b7b452f85e6bb142239de2540a26cb53 | 72 | py | Python | marrow/interface/__init__.py | marrow/interface | 4d60f9fc16e949c5da3b3756c77d60fe84f0ed2d | [
"MIT"
] | 2 | 2016-03-22T15:21:48.000Z | 2017-02-21T23:52:46.000Z | marrow/interface/__init__.py | marrow/interface | 4d60f9fc16e949c5da3b3756c77d60fe84f0ed2d | [
"MIT"
] | 1 | 2019-01-21T22:09:00.000Z | 2019-01-21T22:09:00.000Z | marrow/interface/__init__.py | marrow/interface | 4d60f9fc16e949c5da3b3756c77d60fe84f0ed2d | [
"MIT"
] | 2 | 2015-12-21T03:24:06.000Z | 2016-11-10T15:19:27.000Z | from .meta import Interface
from .release import version as __version__
| 24 | 43 | 0.833333 |
2a85605e53204539e77ee83f1493a2d43da7cc0d | 703 | java | Java | src/net/jmui/builds/BuildSelector.java | jmui/JumiBot | 566eff0ce620be0176f1129ee37560f80a5f6174 | [
"MIT"
] | null | null | null | src/net/jmui/builds/BuildSelector.java | jmui/JumiBot | 566eff0ce620be0176f1129ee37560f80a5f6174 | [
"MIT"
] | null | null | null | src/net/jmui/builds/BuildSelector.java | jmui/JumiBot | 566eff0ce620be0176f1129ee37560f80a5f6174 | [
"MIT"
] | null | null | null | package net.jmui.builds;
import bwapi.*;
import bwta.BWTA;
import bwta.BaseLocation;
import net.jmui.JumiBot;
public class BuildSelector {
private DefaultBuild currentBuild;
private Player self;
private JumiBot bot;
private Game game;
//constructor
public BuildSelector(Player self, JumiBot bot, Game game) {
this.self = self;
this.bot = bot;
this.game = game;
}
public void pickBuild() {
//leave this as double nine gate for now
currentBuild = new NineNineGate(self, bot, game);
assert(currentBuild instanceof NineNineGate);
}
public void doBuild(Unit myUnit) {
currentBuild.setUnit(myUnit); //currently selected unit
currentBuild.continueBuild();
}
}
| 17.575 | 60 | 0.72404 |
4f548e6a472a6a744d316f3cf7645ada6211f14a | 149 | sql | SQL | src/test/resources/sql/select/f5704318.sql | Shuttl-Tech/antlr_psql | fcf83192300abe723f3fd3709aff5b0c8118ad12 | [
"MIT"
] | 66 | 2018-06-15T11:34:03.000Z | 2022-03-16T09:24:49.000Z | src/test/resources/sql/select/f5704318.sql | Shuttl-Tech/antlr_psql | fcf83192300abe723f3fd3709aff5b0c8118ad12 | [
"MIT"
] | 13 | 2019-03-19T11:56:28.000Z | 2020-08-05T04:20:50.000Z | src/test/resources/sql/select/f5704318.sql | Shuttl-Tech/antlr_psql | fcf83192300abe723f3fd3709aff5b0c8118ad12 | [
"MIT"
] | 28 | 2019-01-05T19:59:02.000Z | 2022-03-24T11:55:50.000Z | -- file:jsonb.sql ln:620 expect:true
SELECT jsa FROM jsonb_populate_record(NULL::jsbrec, '{"jsa": ["aaa", null, [1, 2, "3", {}], { "k" : "v" }]}') q
| 49.666667 | 111 | 0.583893 |
584cf75a6db9476de3200ab4f0b1698b00a727a3 | 2,209 | h | C | bs_bos_core_base/include/omp_tools.h | bs-eagle/bs-eagle | b1017a4f6ac2dcafba2deafec84052ddde792671 | [
"BSD-3-Clause"
] | 7 | 2015-07-16T22:30:36.000Z | 2020-02-06T10:16:42.000Z | bs_bos_core_base/include/omp_tools.h | bs-eagle/bs-eagle | b1017a4f6ac2dcafba2deafec84052ddde792671 | [
"BSD-3-Clause"
] | null | null | null | bs_bos_core_base/include/omp_tools.h | bs-eagle/bs-eagle | b1017a4f6ac2dcafba2deafec84052ddde792671 | [
"BSD-3-Clause"
] | 3 | 2017-01-05T20:06:28.000Z | 2021-12-20T16:19:10.000Z | #ifndef __OMP_TOOLS_H_
#define __OMP_TOOLS_H_
/*!
* \file omp_tools.h
* \brief omp tools and definitions
* \author Khait Mark
* \date 2006-07-21
*/
//#define OMP_DEBUG
#ifdef UNIX
#ifndef _OPENMP
#undef OMP_DEBUG
#endif
#endif
#ifdef OMP_DEBUG
#include <omp.h>
//! start OMP time measure
#define OMP_TIME_MEASURE_START(t) \
t -= omp_get_wtime ()
//! end OMP time measure
#define OMP_TIME_MEASURE_END(t) \
t += omp_get_wtime ()
#else //OMP_DEBUG
//! start OMP time measure
#define OMP_TIME_MEASURE_START(t) \
t = 0;
//! end OMP time measure
#define OMP_TIME_MEASURE_END(t) \
t = 0;
#endif //OMP_DEBUG
#ifdef _OPENMP
#define CSR_MATRIX_VECTOR_PRODUCT_PARALLEL
#if 0
#define SMOOTHER_GS_F_ONLY_INV_PARALLEL
#define SMOOTHER_GS_F_ONLY_PARALLEL
#define SMOOTHER_GS_C_ONLY_INV_PARALLEL
#define SMOOTHER_GS_C_ONLY_PARALLEL
#endif
#define FI_OPERATOR_BLOCK_CONNECTIONS_PARALLEL
#define FI_OPERATOR_CELLS_PARALLEL
#define TRIPLE_MATRIX_PRODUCT_PARALLEL
#define CPR_PRECONDITIONER_SETUP_PARALLEL
#define GMRES_SOLVER2_SOLVE_PARALLEL
#define MV_CALC_LIN_COMB_PARALLEL
#define CPR_PRECONDITIONER_SOLVE_PARALLEL
#define CSR_CALC_LIN_COMB_PARALLEL
#define MV_VECTOR_INNER_PRODUCT_PARALLEL
#define OTHER_NON_IMPORTANT_PARALLEL
#define B_MATRIX_VECTOR_PRODUCT_PARALLEL
#define BUILD_STRENGTH_MATRIX_PARALLEL
#define BUILD_P_PARALLEL
#define BUILD_P_STANDART_PARALLEL
#define COARSE_PMIS_2_PARALLEL
//#define ILU_PREC_PARALLEL
//#define AMG_COARSE_RUGE_PARALLEL
//#define AMG_COARSE_CLJP_PARALLEL
//#define TWO_STAGE_PREC_PARALLEL
#endif //_OPENMP
extern double fi_operator_block_connections_timer;
extern double fi_operator_cells_timer;
extern double cpr_preconditioner_setup_timer;
extern double gmres_solver2_solve_timer;
extern double mv_calc_lin_comb_timer;
extern double cpr_preconditioner_solve_timer;
extern double b_matrix_vector_product_timer;
extern double gmres_setup_timer;
extern double gmres_solve_timer;
extern double ilu_combine_matrix;
extern double ilu_setup_timer;
extern double ilu_solve_timer;
#endif //__OMP_TOOLS_H_
| 25.988235 | 72 | 0.775917 |
e364fa0ab16d76cd9b3cd2cb70735cdeea7b59e5 | 1,650 | sql | SQL | backend/dal/Migrations/Initial/Up/PostUp/02-ProjectStatusNotifications.sql | agalbrai/PIMS | 79a25f66e873143de96e926f122e08ab844b5b43 | [
"Apache-2.0"
] | 20 | 2020-02-03T23:46:56.000Z | 2022-03-30T22:01:36.000Z | backend/dal/Migrations/Initial/Up/PostUp/02-ProjectStatusNotifications.sql | agalbrai/PIMS | 79a25f66e873143de96e926f122e08ab844b5b43 | [
"Apache-2.0"
] | 818 | 2019-12-04T21:39:55.000Z | 2022-03-31T22:34:53.000Z | backend/dal/Migrations/Initial/Up/PostUp/02-ProjectStatusNotifications.sql | agalbrai/PIMS | 79a25f66e873143de96e926f122e08ab844b5b43 | [
"Apache-2.0"
] | 26 | 2020-01-08T00:02:24.000Z | 2022-01-18T22:53:44.000Z | PRINT 'Adding ProjectStatusNotifications'
INSERT INTO dbo.[ProjectStatusNotifications]
(
[TemplateId]
, [FromStatusId]
, [ToStatusId]
, [Priority]
, [Delay]
, [DelayDays]
)
VALUES
(
1 -- New Disposal Project Submitted
, 6
, 7
, 2
, 0
, 0
), (
1 -- New Disposal Project Submitted with Exemption
, 6
, 8
, 2
, 0
, 0
), (
2 -- Disposal Project Denied
, NULL
, 16
, 1
, 0
, 0
), (
3 -- Disposal Project Cancelled
, NULL
, 23
, 1
, 0
, 0
), (
4 -- Disposal Project Approved for ERP
, NULL
, 14
, 1
, 0
, 0
), (
5 -- New Properties on ERP
, NULL
, 14
, 2
, 0
, 0
), (
6 -- 30 day ERP notification - Owning Agency
, NULL
, 14
, 1
, 3
, 30
), (
7 -- 60 day ERP notification - Owning Agency
, NULL
, 14
, 1
, 3
, 60
), (
8 -- 90 day ERP notification - Owning Agency
, NULL
, 14
, 1
, 3
, 90
), (
9 -- 30 day ERP notification - Parent Agencies
, NULL
, 14
, 2
, 3
, 30
), (
10 -- 60 day ERP notification - Parent Agencies
, NULL
, 14
, 2
, 3
, 60
), (
11 -- 90 day ERP notification - Parent Agencies
, NULL
, 14
, 2
, 3
, 90
), (
12 -- 30 day ERP notification - Watching Agencies
, NULL
, 14
, 2
, 3
, 30
), (
13 -- 60 day ERP notification - Watching Agencies
, NULL
, 14
, 2
, 3
, 60
), (
14 -- 90 day ERP notification - Watching Agencies
, NULL
, 14
, 2
, 3
, 90
)
| 13.865546 | 54 | 0.458788 |
c7f050ffe5c25222da278df2964596faafed430d | 1,560 | py | Python | custom_components/eldes_alarm/binary_sensor.py | samuolis/eldes | ae81fa1c165ba36c4294328dd8657812c3767f7d | [
"MIT"
] | 7 | 2022-01-31T19:00:05.000Z | 2022-02-20T14:48:34.000Z | custom_components/eldes_alarm/binary_sensor.py | samuolis/eldes | ae81fa1c165ba36c4294328dd8657812c3767f7d | [
"MIT"
] | 9 | 2022-01-29T12:12:03.000Z | 2022-03-30T15:46:44.000Z | custom_components/eldes_alarm/binary_sensor.py | samuolis/eldes | ae81fa1c165ba36c4294328dd8657812c3767f7d | [
"MIT"
] | 3 | 2022-02-01T16:26:40.000Z | 2022-02-20T15:27:12.000Z | """Support for Eldes sensors."""
import logging
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
BinarySensorEntity
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from .const import (
DATA_CLIENT,
DATA_COORDINATOR,
DOMAIN
)
from . import EldesDeviceEntity
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry, async_add_entities):
"""Set up the Eldes binary sensor platform."""
client = hass.data[DOMAIN][entry.entry_id][DATA_CLIENT]
coordinator = hass.data[DOMAIN][entry.entry_id][DATA_COORDINATOR]
entities = []
for index, _ in enumerate(coordinator.data):
entities.append(EldesConnectionStatusBinarySensor(client, coordinator, index))
async_add_entities(entities)
class EldesConnectionStatusBinarySensor(EldesDeviceEntity, BinarySensorEntity):
"""Class for the connection status sensor."""
@property
def unique_id(self):
"""Return a unique identifier for this entity."""
return f"{self.imei}_connection_status"
@property
def name(self):
"""Return the name of the sensor."""
return f"{self.data['info']['model']} Connection Status"
@property
def is_on(self):
"""Return true if sensor is on."""
return self.data["info"].get("online", False)
@property
def device_class(self):
"""Return the class of this sensor."""
return DEVICE_CLASS_CONNECTIVITY
| 28.363636 | 89 | 0.712179 |
131935b41e66d4990f7841756632768ad75e6103 | 4,386 | h | C | _midynet/include/FastMIDyNet/prior/sbm/vertex_count.h | charlesmurphy1/fast-midynet | 22071d49077fce9d5f99a4664f36767b27edea64 | [
"MIT"
] | null | null | null | _midynet/include/FastMIDyNet/prior/sbm/vertex_count.h | charlesmurphy1/fast-midynet | 22071d49077fce9d5f99a4664f36767b27edea64 | [
"MIT"
] | null | null | null | _midynet/include/FastMIDyNet/prior/sbm/vertex_count.h | charlesmurphy1/fast-midynet | 22071d49077fce9d5f99a4664f36767b27edea64 | [
"MIT"
] | null | null | null | #ifndef FAST_MIDYNET_VERTEX_COUNT_H
#define FAST_MIDYNET_VERTEX_COUNT_H
#include <vector>
#include "BaseGraph/types.h"
#include "FastMIDyNet/prior/prior.hpp"
#include "FastMIDyNet/exceptions.h"
#include "FastMIDyNet/prior/sbm/block_count.h"
#include "FastMIDyNet/utility/functions.h"
namespace FastMIDyNet{
class VertexCountPrior: public Prior<std::vector<size_t>>{
protected:
size_t m_size;
BlockCountPrior* m_blockCountPriorPtr= nullptr;
void createBlock(){ m_state.push_back(0); }
void destroyBlock(const BlockIndex& idx) { m_state.erase(m_state.begin() + idx); }
public:
VertexCountPrior(){}
VertexCountPrior(size_t size, BlockCountPrior& blockCountPrior):
m_size(size) { setBlockCountPrior(blockCountPrior); }
VertexCountPrior(const VertexCountPrior& other):
m_size(other.m_size) { setBlockCountPrior(*other.m_blockCountPriorPtr); }
virtual ~VertexCountPrior(){}
const VertexCountPrior& operator=(const VertexCountPrior& other){
this->m_size = other.m_size;
this->setBlockCountPrior(*other.m_blockCountPriorPtr);
return *this;
}
void setState(const std::vector<size_t>& state) {
m_state = state;
m_blockCountPriorPtr->setState(state.size());
}
const BlockCountPrior& getBlockCountPrior() const { return *m_blockCountPriorPtr; }
BlockCountPrior& getBlockCountPriorRef() const { return *m_blockCountPriorPtr; }
void setBlockCountPrior(BlockCountPrior& blockCountPrior) {
m_blockCountPriorPtr = &blockCountPrior;
m_blockCountPriorPtr->isRoot(false);
}
const size_t& getSize() const { return m_size; }
const size_t& getBlockCount() const { return m_blockCountPriorPtr->getState(); }
void samplePriors() override{ m_blockCountPriorPtr->sample(); }
const double getLogPrior() const override{
return m_blockCountPriorPtr->getLogJoint();
}
const double getLogLikelihoodRatioFromGraphMove(const GraphMove& ) const { return 0; }
virtual const double getLogLikelihoodRatioFromBlockMove(const BlockMove& ) const = 0;
const double getLogPriorRatioFromGraphMove(const GraphMove& move) const { return 0; }
const double getLogPriorRatioFromBlockMove(const BlockMove& move) const { return m_blockCountPriorPtr->getLogJointRatioFromBlockMove(move); }
const double getLogJointRatioFromGraphMove(const GraphMove& move) const { return 0; }
const double getLogJointRatioFromBlockMove(const BlockMove& move) const {
return processRecursiveConstFunction<double>( [&]() { return getLogLikelihoodRatioFromBlockMove(move) + getLogPriorRatioFromBlockMove(move); }, 0.);
}
void applyGraphMove(const GraphMove&) { };
void applyBlockMove(const BlockMove& move) {
processRecursiveFunction( [&]() {
applyBlockMoveToState(move);
m_blockCountPriorPtr->applyBlockMove(move);
});
}
void applyBlockMoveToState(const BlockMove& move) {
if (move.addedBlocks == 1){ createBlock(); }
--m_state[move.prevBlockIdx];
++m_state[move.nextBlockIdx];
if (move.addedBlocks == -1){ destroyBlock(move.prevBlockIdx); }
}
virtual void computationFinished() const override { m_isProcessed = false; m_blockCountPriorPtr->computationFinished(); }
virtual void checkSafety() const override{
if (m_size < 0)
throw SafetyError("BlockPrior: unsafe prior since `size` < 0: " + std::to_string(m_size) + ".");
if (m_blockCountPriorPtr == nullptr)
throw SafetyError("BlockUniformPrior: unsafe prior since `m_blockCountPriorPtr` is empty.");
}
};
class VertexCountUniformPrior: public VertexCountPrior{
public:
using VertexCountPrior::VertexCountPrior;
void sampleState() override;
const double getLogLikelihood() const override { return getLogLikelihoodFromState(getSize(), getBlockCount()); }
void checkSelfConsistency() const override;
const double getLogLikelihoodRatioFromBlockMove(const BlockMove&) const override;
static size_t getSizeFromState(const std::vector<size_t> state){
size_t sum = 0;
for(auto nr : state) sum += nr;
return sum;
}
protected:
const double getLogLikelihoodFromState(size_t size, size_t blockCount) const { return -logBinomialCoefficient(size - 1, blockCount - 1);}
};
} // FastMIDyNet
#endif
| 38.814159 | 156 | 0.720246 |
cb6e1aecba51ece733052bad1e780e2e214a2935 | 638 | swift | Swift | ChefCraft/Flow/Recipe Detail View/RecipeDetailViewModel.swift | ivfomenko/ChefCraft | 4942dd8170ee6821c8fa86a592b883c862b14f06 | [
"MIT"
] | null | null | null | ChefCraft/Flow/Recipe Detail View/RecipeDetailViewModel.swift | ivfomenko/ChefCraft | 4942dd8170ee6821c8fa86a592b883c862b14f06 | [
"MIT"
] | null | null | null | ChefCraft/Flow/Recipe Detail View/RecipeDetailViewModel.swift | ivfomenko/ChefCraft | 4942dd8170ee6821c8fa86a592b883c862b14f06 | [
"MIT"
] | null | null | null | //
// RecipeDetailViewModel.swift
// ChefCraft
//
// Created by Ivan Fomenko on 19.11.2019.
// Copyright © 2019 Ivan Fomenko. All rights reserved.
//
import RxSwift
import RxCocoa
class RecipeDetailViewModel {
// MARK: - Router
var router: RecipeDetailRouter
var repository: RecipeDetailRepositoryProtocol
// MARK: - Properties
private var disposeBag = DisposeBag()
var model: RecipeModel
init(router: RecipeDetailRouter, repository: RecipeDetailRepositoryProtocol, data: RecipeModel) {
self.router = router
self.repository = repository
self.model = data
}
}
| 21.266667 | 101 | 0.684953 |
1666f58123c8d925d77e1da822fecaa1fffd98cf | 1,293 | swift | Swift | akane/ViewController/NewArticleListViewController.swift | slightair/akane | 4575a2057c89c80229872812b2c744758523e7ca | [
"MIT"
] | 4 | 2017-04-18T07:50:53.000Z | 2017-08-22T03:34:44.000Z | akane/ViewController/NewArticleListViewController.swift | slightair/akane | 4575a2057c89c80229872812b2c744758523e7ca | [
"MIT"
] | null | null | null | akane/ViewController/NewArticleListViewController.swift | slightair/akane | 4575a2057c89c80229872812b2c744758523e7ca | [
"MIT"
] | null | null | null | import UIKit
import RxSwift
import RxCocoa
class NewArticleListViewController: UIViewController {
@IBOutlet weak var tableView: UITableView!
let disposeBag = DisposeBag()
override func viewDidLoad() {
super.viewDidLoad()
let refreshControl = UIRefreshControl()
tableView.refreshControl = refreshControl
let refreshTrigger = rx.sentMessage(#selector(viewWillAppear)).map { _ in }
let loadBeforeTrigger = refreshControl.rx.controlEvent(.valueChanged)
let loadAfterTrigger = tableView.rx.reachedBottom
let viewModel = NewArticleListViewModel(
input: (
refreshTrigger: refreshTrigger.asObservable(),
loadBeforeTrigger: loadBeforeTrigger.asObservable(),
loadAfterTrigger: loadAfterTrigger.asObservable()
),
client: NewArticleListClient()
)
viewModel.articles
.bind(to: tableView.rx.items(cellIdentifier: "ArticleListCell")) { _, article, cell in
cell.textLabel?.text = article.title
}
.disposed(by: disposeBag)
viewModel.articles
.map { _ in false }
.bind(to: refreshControl.rx.isRefreshing)
.disposed(by: disposeBag)
}
}
| 31.536585 | 98 | 0.636504 |
014d88b3c159fa01914d49a07f2664d711f17372 | 455 | rs | Rust | pi_nilakantha.rs | vizs/rs-math | fb093abe1dc0934f7e801e62471ee7196d449296 | [
"BSD-2-Clause"
] | null | null | null | pi_nilakantha.rs | vizs/rs-math | fb093abe1dc0934f7e801e62471ee7196d449296 | [
"BSD-2-Clause"
] | null | null | null | pi_nilakantha.rs | vizs/rs-math | fb093abe1dc0934f7e801e62471ee7196d449296 | [
"BSD-2-Clause"
] | null | null | null | fn main() {
let argv: Vec<String> = std::env::args().collect();
let uplimit: u64 = argv[1].trim()
.parse()
.unwrap();
let mut den: f64 = 0.0;
for n in 1..=uplimit {
let d = (2*n) * (2*n + 1) * (2*n + 2);
if n % 2 == 0 {
den -= 4.0 / (d as f64);
} else {
den += 4.0 / (d as f64);
}
}
println!("{}", 3.0 + den);
}
| 22.75 | 55 | 0.340659 |
38d6857e76dbe3c5d105d0f34ceaab998c4467ba | 2,038 | h | C | JUtilities/Foundation/NSObject+Utilities.h | wishWinds/JUtilities | adb1fb1b09fbad7c55ef8336f3a42209e17e1f8d | [
"MIT"
] | null | null | null | JUtilities/Foundation/NSObject+Utilities.h | wishWinds/JUtilities | adb1fb1b09fbad7c55ef8336f3a42209e17e1f8d | [
"MIT"
] | null | null | null | JUtilities/Foundation/NSObject+Utilities.h | wishWinds/JUtilities | adb1fb1b09fbad7c55ef8336f3a42209e17e1f8d | [
"MIT"
] | null | null | null | //
// NSObject+Utilities.h
// JUtilities
//
// Created by shupeng on 2019/4/29.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSObject (Utilities)
#pragma mark - Associate value
///=============================================================================
/// @name Associate value
///=============================================================================
/**
Associate one object to `self`, as if it was a strong property (strong, nonatomic).
@param value The object to associate.
@param key The pointer to get value from `self`.
*/
- (void)setAssociateValue:(id)value withKey:(void *)key;
/**
Associate one object to `self`, as if it was a weak property (week, nonatomic).
@param value The object to associate.
@param key The pointer to get value from `self`.
*/
- (void)setAssociateWeakValue:(id)value withKey:(void *)key;
/**
Get the associated value from `self`.
@param key The pointer to get value from `self`.
*/
- (id)getAssociatedValueForKey:(void *)key;
/**
Remove all associated values.
*/
- (void)removeAssociatedValues;
/**
Returns the class name in NSString.
*/
+ (NSString *)className;
/**
Returns the class name in NSString.
@discussion Apple has implemented this method in NSObject(NSLayoutConstraintCallsThis),
but did not make it public.
*/
- (NSString *)className;
/**
Returns a copy of the instance with `NSKeyedArchiver` and ``NSKeyedUnarchiver``.
Returns nil if an error occurs.
*/
- (id)deepCopy;
/**
Returns a copy of the instance use archiver and unarchiver.
Returns nil if an error occurs.
@param archiver NSKeyedArchiver class or any class inherited.
@param unarchiver NSKeyedUnarchiver clsas or any class inherited.
*/
- (id)deepCopyWithArchiver:(Class)archiver unarchiver:(Class)unarchiver;
#pragma mark - runtime
/**
获取属性列表
@return <#return value description#>
*/
+ (NSArray *)propertyList;
/**
获取所有子类
@return <#return value description#>
*/
+ (NSArray *)subclasses;
@end
NS_ASSUME_NONNULL_END
| 21.680851 | 88 | 0.656035 |
0e8759cd5cad3321ece39bf51e82ac0c57ad335c | 1,299 | swift | Swift | TabbedPageView/TabIconCollectionViewCell.swift | michaelonjack/TabbedPageView | a42dfcda9209e21c57182e58fbaed01d186371bf | [
"MIT"
] | 3 | 2018-11-20T15:44:13.000Z | 2019-05-13T12:25:39.000Z | TabbedPageView/TabIconCollectionViewCell.swift | michaelonjack/TabbedPageView | a42dfcda9209e21c57182e58fbaed01d186371bf | [
"MIT"
] | 4 | 2018-12-21T01:44:00.000Z | 2019-09-11T23:14:25.000Z | TabbedPageView/TabIconCollectionViewCell.swift | michaelonjack/TabbedPageView | a42dfcda9209e21c57182e58fbaed01d186371bf | [
"MIT"
] | null | null | null | //
// TabCollectionViewCell.swift
// TabbedPageView
//
// Created by Michael Onjack on 11/3/18.
// Copyright © 2018 Michael Onjack. All rights reserved.
//
import UIKit
class TabIconCollectionViewCell: UICollectionViewCell {
lazy var imageView: UIImageView = {
var iv = UIImageView(frame: .zero)
iv.translatesAutoresizingMaskIntoConstraints = false
iv.contentMode = .scaleAspectFit
iv.backgroundColor = UIColor.clear
return iv
}()
override init(frame: CGRect) {
super.init(frame: frame)
setupView()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupView() {
translatesAutoresizingMaskIntoConstraints = false
addSubview(imageView)
setupLayout()
}
func setupLayout() {
NSLayoutConstraint.activate([
imageView.centerXAnchor.constraint(equalTo: self.centerXAnchor),
imageView.centerYAnchor.constraint(equalTo: self.centerYAnchor),
imageView.heightAnchor.constraint(equalTo: self.heightAnchor, multiplier: 0.65),
imageView.widthAnchor.constraint(equalTo: imageView.heightAnchor)
])
}
}
| 25.98 | 92 | 0.636644 |
c0c41c3940570626685faa58a962f42ce6a02669 | 765 | sql | SQL | api/app/sql/control/tracking/user/get/lecturer/lectures.sql | mohamed-waleed-rady/elearning-php | 3fcb31e2ee55f067954f1468969487d8c982a703 | [
"MIT"
] | 1 | 2021-06-14T21:03:56.000Z | 2021-06-14T21:03:56.000Z | api/app/sql/control/tracking/user/get/lecturer/lectures.sql | mohamedwr/elearning-php | 3fcb31e2ee55f067954f1468969487d8c982a703 | [
"MIT"
] | null | null | null | api/app/sql/control/tracking/user/get/lecturer/lectures.sql | mohamedwr/elearning-php | 3fcb31e2ee55f067954f1468969487d8c982a703 | [
"MIT"
] | null | null | null |
SELECT
lectures.id, lectures.name,
courses.name as course,
lectures.type, lectures.nu,
COUNT(tracking.id) as views,
lectures.stamp
FROM
lectures
JOIN users ON users.id = %d AND users.type = 'lecturer' AND users.blocked = 0 AND users.deleted = 0
JOIN courses ON courses.id = lectures.course AND courses.deleted = 0
LEFT JOIN users as viewers ON viewers.type = 'student' AND viewers.blocked = 0 AND viewers.deleted = 0
LEFT JOIN tracking ON tracking.id = viewers.id AND tracking.path = CONCAT('lectures/', CONCAT(lectures.type, CONCAT('s/', lectures.id)))
WHERE
lectures.creator = users.id AND lectures.deleted = 0
GROUP BY
lectures.id
ORDER BY
lectures.course,
lectures.nu,
lectures.name,
lectures.creator,
lectures.id; | 28.333333 | 140 | 0.720261 |
9965f5b9d5ea3d3ac310f486acbab0fa41443e96 | 305 | c | C | level4/source.c | olesgedz/RainFall | 306519fc45a50d0f487d6b68f00244612edeb79f | [
"Unlicense"
] | null | null | null | level4/source.c | olesgedz/RainFall | 306519fc45a50d0f487d6b68f00244612edeb79f | [
"Unlicense"
] | null | null | null | level4/source.c | olesgedz/RainFall | 306519fc45a50d0f487d6b68f00244612edeb79f | [
"Unlicense"
] | null | null | null | #include <stdio.h>
#include <stdlib.h>
int m = 0;
int p(char *buffer)
{
printf(buffer);
return (0);
}
int n(void)
{
char buffer[512];
fgets(buffer, 512, stdin);
p(buffer);
if (m == 0x1025544)
system("/bin/cat /home/user/level5/.pass");
return (0);
}
int main(void)
{
n();
return (0);
} | 11.296296 | 45 | 0.590164 |
9d31ae5fbfff9ea3d173fc06669d35df9f6d703f | 1,358 | html | HTML | ksr_customisations/ksrnr_customisations/report/government_salary_pdf/government_salary_pdf.html | dawoodjee/ksr_customisations | 78fcb60a021557063ccbceabab7279082e10be95 | [
"MIT"
] | null | null | null | ksr_customisations/ksrnr_customisations/report/government_salary_pdf/government_salary_pdf.html | dawoodjee/ksr_customisations | 78fcb60a021557063ccbceabab7279082e10be95 | [
"MIT"
] | null | null | null | ksr_customisations/ksrnr_customisations/report/government_salary_pdf/government_salary_pdf.html | dawoodjee/ksr_customisations | 78fcb60a021557063ccbceabab7279082e10be95 | [
"MIT"
] | null | null | null | <style>
@media print {
.print-format table {
font-size: xx-small;
width: 100%;
}
.print-format {
padding:1em;
}
}
</style>
{%
var report_columns = report.get_columns_for_print();
%}
{%= frappe.boot.letter_heads[filters.letter_head || frappe.defaults.get_default("letter_head")].header %}
<span class="text-left"> سند مشترك رواتب موظفين هيئة تطوير محمية الملك سلمان بن عبد العزيز الملكية لشهر جولاي ٢٠٢١ </span>
<span class="text-right"> طريقة الصرف: تحويل سريع رقم المسير: ١١ </span>
<table class="table table-bordered">
<thead>
<tr>
{% for(var i=0, l=report_columns.length; i<l; i++) { %}
<th class="text-right">{%= report_columns[i].label %}</th>
{% } %}
</tr>
</thead>
<tbody>
{% for(var j=0, k=data.length; j<k; j++) { %}
{%
var row = data[j];
%}
<tr>
{% for(var i=0, l=report_columns.length; i<l; i++) { %}
<td class="text-right">
{% var fieldname = report_columns[i].fieldname; %}
{% if (report_columns[i].fieldtype=='Currency' && !isNaN(row[fieldname])) { %}
{%= format_currency(row[fieldname]) %}
{% } else { %}
{% if (!is_null(row[fieldname])) { %}
{%= row[fieldname] %}
{% } %}
{% } %}
</td>
{% } %}
</tr>
{% } %}
</tbody>
</table>
| 25.148148 | 130 | 0.53461 |
7e989fdeb320eec7affcced56a9a0b8e4a8c59e8 | 5,010 | dart | Dart | lib/store/settings/blocklist_settings_store.dart | loshine/flutter-nga | e1a44e70a8a4160fd728660fd286c0184bc22a19 | [
"Apache-2.0"
] | 20 | 2018-12-10T06:18:18.000Z | 2022-03-02T02:23:47.000Z | lib/store/settings/blocklist_settings_store.dart | loshine/flutter-nga | e1a44e70a8a4160fd728660fd286c0184bc22a19 | [
"Apache-2.0"
] | 4 | 2018-12-17T03:50:55.000Z | 2021-12-24T07:12:27.000Z | lib/store/settings/blocklist_settings_store.dart | loshine/flutter-nga | e1a44e70a8a4160fd728660fd286c0184bc22a19 | [
"Apache-2.0"
] | 7 | 2018-12-10T02:16:19.000Z | 2022-03-01T06:43:38.000Z | import 'package:flutter_nga/data/data.dart';
import 'package:flutter_nga/data/entity/block.dart';
import 'package:mmkv/mmkv.dart';
import 'package:mobx/mobx.dart';
part 'blocklist_settings_store.g.dart';
class BlocklistSettingsStore = _BlocklistSettingsStore
with _$BlocklistSettingsStore;
enum BlockMode { COLLAPSE, PAINT, ALPHA, DELETE_LINE, GONE }
extension BlockModeExtention on BlockMode {
String get name {
switch (this) {
case BlockMode.COLLAPSE:
return "折叠";
case BlockMode.PAINT:
return "涂抹";
case BlockMode.ALPHA:
return "淡化";
case BlockMode.DELETE_LINE:
return "删除线";
case BlockMode.GONE:
default:
return "隐藏";
}
}
}
abstract class _BlocklistSettingsStore with Store {
final settings = MMKV("blocklist");
@observable
var clientBlockEnabled = false;
@observable
var listBlockEnabled = true;
@observable
var detailsBlockEnabled = true;
@observable
var blockMode = BlockMode.COLLAPSE;
@observable
var blockUserList = <String>[];
@observable
var blockWordList = <String>[];
@action
void init() {
clientBlockEnabled =
settings.decodeBool("clientBlockEnabled", defaultValue: false);
listBlockEnabled =
settings.decodeBool("listBlockEnabled", defaultValue: true);
detailsBlockEnabled =
settings.decodeBool("detailsBlockEnabled", defaultValue: true);
blockMode = getBlockMode();
}
@action
void setClientBlockEnabled(bool enabled) {
clientBlockEnabled = enabled;
settings.encodeBool("clientBlockEnabled", clientBlockEnabled);
}
@action
void setListBlockEnabled(bool enabled) {
listBlockEnabled = enabled;
settings.encodeBool("listBlockEnabled", listBlockEnabled);
}
@action
void setDetailsBlockEnabled(bool enabled) {
detailsBlockEnabled = enabled;
settings.encodeBool("detailsBlockEnabled", detailsBlockEnabled);
}
@action
Future<void> load() async {
try {
final blockInfo = await Data().userRepository.getBlockInfo();
blockUserList = blockInfo.blockUserList;
blockWordList = blockInfo.blockWordList;
} catch (err) {
rethrow;
}
}
@action
Future<String> addUser(String user) async {
try {
var submitUsers = <String>[];
blockUserList.forEach((e) => submitUsers.add(e));
submitUsers.add(user);
final content = await Data()
.userRepository
.setBlockInfo(BlockInfoData(submitUsers, blockWordList));
blockUserList = submitUsers;
return content;
} catch (err) {
rethrow;
}
}
@action
Future<String> deleteUser(String user) async {
try {
var submitUsers = <String>[];
blockUserList.forEach((e) {
if (e != user) {
submitUsers.add(e);
}
});
final content = await Data()
.userRepository
.setBlockInfo(BlockInfoData(submitUsers, blockWordList));
blockUserList = submitUsers;
return content;
} catch (err) {
rethrow;
}
}
@action
Future<String> deleteAllUsers() async {
try {
final content = await Data()
.userRepository
.setBlockInfo(BlockInfoData([], blockWordList));
blockUserList = [];
return content;
} catch (err) {
rethrow;
}
}
@action
Future<String> addWord(String word) async {
try {
var submitWords = <String>[];
blockWordList.forEach((e) => submitWords.add(e));
submitWords.add(word);
final content = await Data()
.userRepository
.setBlockInfo(BlockInfoData(blockUserList, submitWords));
blockWordList = submitWords;
return content;
} catch (err) {
rethrow;
}
}
@action
Future<String> deleteWord(String word) async {
try {
var submitWords = <String>[];
blockWordList.forEach((e) {
if (e != word) {
submitWords.add(e);
}
});
final content = await Data()
.userRepository
.setBlockInfo(BlockInfoData(blockUserList, submitWords));
blockWordList = submitWords;
return content;
} catch (err) {
rethrow;
}
}
@action
Future<String> deleteAllWords() async {
try {
final content = await Data()
.userRepository
.setBlockInfo(BlockInfoData(blockUserList, []));
blockWordList = [];
return content;
} catch (err) {
rethrow;
}
}
BlockMode getBlockMode() {
final i =
settings.decodeInt("blockMode", defaultValue: BlockMode.COLLAPSE.index);
return getBlockModeByIndex(i);
}
BlockMode getBlockModeByIndex(int index) {
switch (index) {
case 0:
return BlockMode.COLLAPSE;
case 1:
return BlockMode.PAINT;
case 2:
return BlockMode.ALPHA;
case 3:
return BlockMode.DELETE_LINE;
case 4:
return BlockMode.GONE;
default:
return BlockMode.COLLAPSE;
}
}
}
| 23.744076 | 80 | 0.631337 |
16e0270b14e446c6e8b22869c8f138a8a9d98fbe | 463 | tsx | TypeScript | frontend/models/Sellers.tsx | JDaniloC/Individual-Licenciador | 31f710773a9f3e0acfe11410578e63cd1ac8a557 | [
"0BSD"
] | null | null | null | frontend/models/Sellers.tsx | JDaniloC/Individual-Licenciador | 31f710773a9f3e0acfe11410578e63cd1ac8a557 | [
"0BSD"
] | 17 | 2021-03-17T00:55:07.000Z | 2022-01-17T13:21:36.000Z | frontend/models/Sellers.tsx | JDaniloC/Individual-Licenciador | 31f710773a9f3e0acfe11410578e63cd1ac8a557 | [
"0BSD"
] | 2 | 2021-03-17T01:03:37.000Z | 2021-03-18T22:22:24.000Z | import mongoose from 'mongoose';
export interface SellerSchema {
email: String,
password: String,
type: String,
licenses: Number,
showBots: Boolean,
botList: Array<string>,
}
const SellerModel = new mongoose.Schema({
email: String,
type: String,
password: String,
licenses: Number,
botList: Array,
showBots: Boolean,
});
export default mongoose.models.Seller ||
mongoose.model('Seller', SellerModel); | 21.045455 | 42 | 0.663067 |
6eeb3bf3ff799bce2dc863387bc027dc6111e8f1 | 34,663 | html | HTML | app/index.html | jobayerarman/electron-crud | 2380937453c0ad605622005a992b617c1cdb5e49 | [
"MIT"
] | null | null | null | app/index.html | jobayerarman/electron-crud | 2380937453c0ad605622005a992b617c1cdb5e49 | [
"MIT"
] | null | null | null | app/index.html | jobayerarman/electron-crud | 2380937453c0ad605622005a992b617c1cdb5e49 | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<!--<base href="#" />-->
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
<!-- devicon -->
<link rel="stylesheet" href="https://cdn.rawgit.com/konpa/devicon/master/devicon.min.css">
<!-- build:css(.) styles/vendor.css -->
<link rel="stylesheet" href="./../bower_components/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="./../bower_components/AdminLTE/dist/css/AdminLTE.css" />
<link rel="stylesheet" href="./../bower_components/AdminLTE/dist/css/skins/skin-blue.css" />
<link rel="stylesheet" href="./../bower_components/AdminLTE/plugins/iCheck/flat/blue.css" />
<!-- <link rel="stylesheet" href="./../bower_components/AdminLTE/plugins/morris/morris.css" /> -->
<link rel="stylesheet" href="./../bower_components/AdminLTE/plugins/jvectormap/jquery-jvectormap-1.2.2.css" />
<!-- <link rel="stylesheet" href="./../bower_components/AdminLTE/plugins/datepicker/datepicker3.css" />
<link rel="stylesheet" href="./../bower_components/AdminLTE/plugins/daterangepicker/daterangepicker-bs3.css" /> -->
<link rel="stylesheet" href="./../bower_components/AdminLTE/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css" />
<!-- <link rel="stylesheet" href="./../bower_components/AdminLTE/plugins/datatables/dataTables.bootstrap.css" /> -->
</head>
<body class="hold-transition skin-blue sidebar-mini fixed">
<div class="wrapper">
<!-- Main Header -->
<header class="main-header">
<!-- Logo -->
<a href="index2.html" class="logo">
<!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini">
<b>E</b> IMS</span>
<!-- logo for regular state and mobile devices -->
<span class="logo-lg">
<b>Electron</b> IMS</span>
</a>
<!-- Header Navbar -->
<nav class="navbar navbar-static-top" role="navigation">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
<span class="sr-only">Toggle navigation</span>
</a>
<!-- Navbar Right Menu -->
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<!-- Messages: style can be found in dropdown.less-->
<li class="dropdown messages-menu">
<!-- Menu toggle button -->
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-envelope-o"></i>
<span class="label label-success">4</span>
</a>
<ul class="dropdown-menu">
<li class="header">You have 4 messages</li>
<li>
<!-- inner menu: contains the messages -->
<ul class="menu">
<li>
<!-- start message -->
<a href="#">
<div class="pull-left">
<!-- User Image -->
<img src="images/yeoman.png" class="img-circle" alt="User Image">
</div>
<!-- Message title and timestamp -->
<h4>
Support Team
<small>
<i class="fa fa-clock-o"></i> 5 mins</small>
</h4>
<!-- The message -->
<p>Why not buy a new awesome theme?</p>
</a>
</li>
<!-- end message -->
</ul>
<!-- /.menu -->
</li>
<li class="footer">
<a href="#">See All Messages</a>
</li>
</ul>
</li>
<!-- /.messages-menu -->
<!-- Notifications Menu -->
<li class="dropdown notifications-menu">
<!-- Menu toggle button -->
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-bell-o"></i>
<span class="label label-warning">10</span>
</a>
<ul class="dropdown-menu">
<li class="header">You have 10 notifications</li>
<li>
<!-- Inner Menu: contains the notifications -->
<ul class="menu">
<li>
<!-- start notification -->
<a href="#">
<i class="fa fa-users text-aqua"></i> 5 new members joined today
</a>
</li>
<!-- end notification -->
</ul>
</li>
<li class="footer">
<a href="#">View all</a>
</li>
</ul>
</li>
<!-- Tasks Menu -->
<li class="dropdown tasks-menu">
<!-- Menu Toggle Button -->
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-flag-o"></i>
<span class="label label-danger">9</span>
</a>
<ul class="dropdown-menu">
<li class="header">You have 9 tasks</li>
<li>
<!-- Inner menu: contains the tasks -->
<ul class="menu">
<li>
<!-- Task item -->
<a href="#">
<!-- Task title and progress text -->
<h3>
Design some buttons
<small class="pull-right">20%</small>
</h3>
<!-- The progress bar -->
<div class="progress xs">
<!-- Change the css width attribute to simulate progress -->
<div class="progress-bar progress-bar-aqua" style="width: 20%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">20% Complete</span>
</div>
</div>
</a>
</li>
<!-- end task item -->
</ul>
</li>
<li class="footer">
<a href="#">View all tasks</a>
</li>
</ul>
</li>
<!-- User Account Menu -->
<li class="dropdown user user-menu">
<!-- Menu Toggle Button -->
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<!-- The user image in the navbar-->
<img src="images/yeoman.png" class="user-image" alt="User Image">
<!-- hidden-xs hides the username on small devices so only the image appears. -->
<span class="hidden-xs">Jobayer Arman</span>
</a>
<ul class="dropdown-menu">
<!-- The user image in the menu -->
<li class="user-header">
<img src="images/yeoman.png" class="img-circle" alt="User Image">
<p>
Jobayer Arman - Web Developer
<small>Member since Nov. 2012</small>
</p>
</li>
<!-- Menu Body -->
<li class="user-body">
<div class="row">
<div class="col-xs-4 text-center">
<a href="#">Followers</a>
</div>
<div class="col-xs-4 text-center">
<a href="#">Sales</a>
</div>
<div class="col-xs-4 text-center">
<a href="#">Friends</a>
</div>
</div>
<!-- /.row -->
</li>
<!-- Menu Footer-->
<li class="user-footer">
<div class="pull-left">
<a href="#" class="btn btn-default btn-flat">Profile</a>
</div>
<div class="pull-right">
<a href="#" class="btn btn-default btn-flat">Sign out</a>
</div>
</li>
</ul>
</li>
<!-- Control Sidebar Toggle Button -->
<li>
<a href="#" data-toggle="control-sidebar">
<i class="fa fa-gears"></i>
</a>
</li>
</ul>
</div>
</nav>
</header>
<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<!-- Sidebar user panel (optional) -->
<div class="user-panel">
<div class="pull-left image">
<img src="images/yeoman.png" class="img-circle" alt="User Image">
</div>
<div class="pull-left info">
<p>Jobayer Arman</p>
<!-- Status -->
<a href="#">
<i class="fa fa-circle text-success"></i> Online</a>
</div>
</div>
<!-- search form (Optional) -->
<form action="#" method="get" class="sidebar-form">
<div class="input-group">
<input type="text" name="q" class="form-control" placeholder="Search...">
<span class="input-group-btn">
<button type="submit" name="search" id="search-btn" class="btn btn-flat">
<i class="fa fa-search"></i>
</button>
</span>
</div>
</form>
<!-- /.search form -->
<!-- Sidebar Menu -->
<ul class="sidebar-menu" data-widget="tree">
<li class="header">HEADER</li>
<!-- Optionally, you can add icons to the links -->
<li class="active menu-open">
<a href="#"><i class="fa fa-dashboard"></i> <span>Dashboard</span></a>
</li>
<li class="treeview">
<a href="#">
<i class="fa fa-file"></i>
<span>Invoice</span>
<span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
</a>
<ul class="treeview-menu">
<li>
<a href="#">
<i class="fa fa-pencil-square-o" aria-hidden="true"></i> Create New</a>
</li>
<li>
<a href="#">
<i class="fa fa-list" aria-hidden="true"></i> List</a>
</li>
</ul>
</li>
<li class="treeview">
<a href="#">
<i class="fa fa-link"></i>
<span>Products</span>
<span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
</a>
<ul class="treeview-menu">
<li>
<a href="#">
<i class="fa fa-plus" aria-hidden="true"></i> Add New</a>
</li>
<li>
<a href="#">
<i class="fa fa-list" aria-hidden="true"></i> List</a>
</li>
</ul>
</li>
<li class="treeview">
<a href="#">
<i class="fa fa-user-circle"></i>
<span>Employee</span>
<span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
</a>
<ul class="treeview-menu">
<li>
<a href="#">
<i class="fa fa-user-plus" aria-hidden="true"></i> Add New</a>
</li>
<li>
<a href="#">
<i class="fa fa-users"></i> List</a>
</li>
</ul>
</li>
<li>
<a href="#">
<i class="fa fa-bar-chart"></i>
<span>Reports</span>
</li>
</ul>
<!-- /.sidebar-menu -->
</section>
<!-- /.sidebar -->
</aside>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>Page Header<small>Optional description</small></h1>
<ol class="breadcrumb">
<li>
<a href="#">
<i class="fa fa-dashboard"></i> Level</a>
</li>
<li class="active">Here</li>
</ol>
</section>
<!-- Main content -->
<section class="content container-fluid">
<!-- Info boxes -->
<div class="row">
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="info-box">
<span class="info-box-icon bg-aqua">
<i class="ion ion-ios-gear-outline"></i>
</span>
<div class="info-box-content">
<span class="info-box-text">CPU Traffic</span>
<span class="info-box-number">90
<small>%</small>
</span>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
</div>
<!-- /.col -->
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="info-box">
<span class="info-box-icon bg-red">
<i class="fa fa-google-plus"></i>
</span>
<div class="info-box-content">
<span class="info-box-text">Likes</span>
<span class="info-box-number">41,410</span>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
</div>
<!-- /.col -->
<!-- fix for small devices only -->
<div class="clearfix visible-sm-block"></div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="info-box">
<span class="info-box-icon bg-green">
<i class="ion ion-ios-cart-outline"></i>
</span>
<div class="info-box-content">
<span class="info-box-text">Sales</span>
<span class="info-box-number">760</span>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
</div>
<!-- /.col -->
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="info-box">
<span class="info-box-icon bg-yellow">
<i class="ion ion-ios-people-outline"></i>
</span>
<div class="info-box-content">
<span class="info-box-text">New Members</span>
<span class="info-box-number">2,000</span>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
<div class="row">
<div class="col-md-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Monthly Recap Report</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse">
<i class="fa fa-minus"></i>
</button>
<div class="btn-group">
<button type="button" class="btn btn-box-tool dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-wrench"></i>
</button>
<ul class="dropdown-menu" role="menu">
<li>
<a href="#">Action</a>
</li>
<li>
<a href="#">Another action</a>
</li>
<li>
<a href="#">Something else here</a>
</li>
<li class="divider"></li>
<li>
<a href="#">Separated link</a>
</li>
</ul>
</div>
<button type="button" class="btn btn-box-tool" data-widget="remove">
<i class="fa fa-times"></i>
</button>
</div>
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="row">
<div class="col-md-8">
<p class="text-center">
<strong>Sales: 1 Jan, 2014 - 30 Jul, 2014</strong>
</p>
<div class="chart">
<!-- Sales Chart Canvas -->
<canvas id="salesChart" style="height: 180px;"></canvas>
</div>
<!-- /.chart-responsive -->
</div>
<!-- /.col -->
<div class="col-md-4">
<p class="text-center">
<strong>Goal Completion</strong>
</p>
<div class="progress-group">
<span class="progress-text">Add Products to Cart</span>
<span class="progress-number">
<b>160</b>/200</span>
<div class="progress sm">
<div class="progress-bar progress-bar-aqua" style="width: 80%"></div>
</div>
</div>
<!-- /.progress-group -->
<div class="progress-group">
<span class="progress-text">Complete Purchase</span>
<span class="progress-number">
<b>310</b>/400</span>
<div class="progress sm">
<div class="progress-bar progress-bar-red" style="width: 80%"></div>
</div>
</div>
<!-- /.progress-group -->
<div class="progress-group">
<span class="progress-text">Visit Premium Page</span>
<span class="progress-number">
<b>480</b>/800</span>
<div class="progress sm">
<div class="progress-bar progress-bar-green" style="width: 80%"></div>
</div>
</div>
<!-- /.progress-group -->
<div class="progress-group">
<span class="progress-text">Send Inquiries</span>
<span class="progress-number">
<b>250</b>/500</span>
<div class="progress sm">
<div class="progress-bar progress-bar-yellow" style="width: 80%"></div>
</div>
</div>
<!-- /.progress-group -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</div>
<!-- ./box-body -->
<div class="box-footer">
<div class="row">
<div class="col-sm-3 col-xs-6">
<div class="description-block border-right">
<span class="description-percentage text-green">
<i class="fa fa-caret-up"></i> 17%</span>
<h5 class="description-header">$35,210.43</h5>
<span class="description-text">TOTAL REVENUE</span>
</div>
<!-- /.description-block -->
</div>
<!-- /.col -->
<div class="col-sm-3 col-xs-6">
<div class="description-block border-right">
<span class="description-percentage text-yellow">
<i class="fa fa-caret-left"></i> 0%</span>
<h5 class="description-header">$10,390.90</h5>
<span class="description-text">TOTAL COST</span>
</div>
<!-- /.description-block -->
</div>
<!-- /.col -->
<div class="col-sm-3 col-xs-6">
<div class="description-block border-right">
<span class="description-percentage text-green">
<i class="fa fa-caret-up"></i> 20%</span>
<h5 class="description-header">$24,813.53</h5>
<span class="description-text">TOTAL PROFIT</span>
</div>
<!-- /.description-block -->
</div>
<!-- /.col -->
<div class="col-sm-3 col-xs-6">
<div class="description-block">
<span class="description-percentage text-red">
<i class="fa fa-caret-down"></i> 18%</span>
<h5 class="description-header">1200</h5>
<span class="description-text">GOAL COMPLETIONS</span>
</div>
<!-- /.description-block -->
</div>
</div>
<!-- /.row -->
</div>
<!-- /.box-footer -->
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
<div class="row">
<div class="col-md-8">
<!-- TABLE: LATEST ORDERS -->
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">Latest Orders</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse">
<i class="fa fa-minus"></i>
</button>
<button type="button" class="btn btn-box-tool" data-widget="remove">
<i class="fa fa-times"></i>
</button>
</div>
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="table-responsive">
<table class="table no-margin">
<thead>
<tr>
<th>Order ID</th>
<th>Item</th>
<th>Status</th>
<th>Popularity</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="pages/examples/invoice.html">OR9842</a>
</td>
<td>Call of Duty IV</td>
<td>
<span class="label label-success">Shipped</span>
</td>
<td>
<div class="sparkbar" data-color="#00a65a" data-height="20">90,80,90,-70,61,-83,63</div>
</td>
</tr>
<tr>
<td>
<a href="pages/examples/invoice.html">OR1848</a>
</td>
<td>Samsung Smart TV</td>
<td>
<span class="label label-warning">Pending</span>
</td>
<td>
<div class="sparkbar" data-color="#f39c12" data-height="20">90,80,-90,70,61,-83,68</div>
</td>
</tr>
<tr>
<td>
<a href="pages/examples/invoice.html">OR7429</a>
</td>
<td>iPhone 6 Plus</td>
<td>
<span class="label label-danger">Delivered</span>
</td>
<td>
<div class="sparkbar" data-color="#f56954" data-height="20">90,-80,90,70,-61,83,63</div>
</td>
</tr>
<tr>
<td>
<a href="pages/examples/invoice.html">OR7429</a>
</td>
<td>Samsung Smart TV</td>
<td>
<span class="label label-info">Processing</span>
</td>
<td>
<div class="sparkbar" data-color="#00c0ef" data-height="20">90,80,-90,70,-61,83,63</div>
</td>
</tr>
<tr>
<td>
<a href="pages/examples/invoice.html">OR1848</a>
</td>
<td>Samsung Smart TV</td>
<td>
<span class="label label-warning">Pending</span>
</td>
<td>
<div class="sparkbar" data-color="#f39c12" data-height="20">90,80,-90,70,61,-83,68</div>
</td>
</tr>
<tr>
<td>
<a href="pages/examples/invoice.html">OR7429</a>
</td>
<td>iPhone 6 Plus</td>
<td>
<span class="label label-danger">Delivered</span>
</td>
<td>
<div class="sparkbar" data-color="#f56954" data-height="20">90,-80,90,70,-61,83,63</div>
</td>
</tr>
<tr>
<td>
<a href="pages/examples/invoice.html">OR9842</a>
</td>
<td>Call of Duty IV</td>
<td>
<span class="label label-success">Shipped</span>
</td>
<td>
<div class="sparkbar" data-color="#00a65a" data-height="20">90,80,90,-70,61,-83,63</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- /.table-responsive -->
</div>
<!-- /.box-body -->
<div class="box-footer clearfix">
<a href="javascript:void(0)" class="btn btn-sm btn-info btn-flat pull-left">Place New Order</a>
<a href="javascript:void(0)" class="btn btn-sm btn-default btn-flat pull-right">View All Orders</a>
</div>
<!-- /.box-footer -->
</div>
<!-- /.box -->
</div>
<!-- /.col -->
<div class="col-md-4">
<!-- Info Boxes Style 2 -->
<div class="info-box bg-yellow">
<span class="info-box-icon">
<i class="ion ion-ios-pricetag-outline"></i>
</span>
<div class="info-box-content">
<span class="info-box-text">Inventory</span>
<span class="info-box-number">5,200</span>
<div class="progress">
<div class="progress-bar" style="width: 50%"></div>
</div>
<span class="progress-description">
50% Increase in 30 Days
</span>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
<div class="info-box bg-green">
<span class="info-box-icon">
<i class="ion ion-ios-heart-outline"></i>
</span>
<div class="info-box-content">
<span class="info-box-text">Mentions</span>
<span class="info-box-number">92,050</span>
<div class="progress">
<div class="progress-bar" style="width: 20%"></div>
</div>
<span class="progress-description">
20% Increase in 30 Days
</span>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
<div class="info-box bg-red">
<span class="info-box-icon">
<i class="ion ion-ios-cloud-download-outline"></i>
</span>
<div class="info-box-content">
<span class="info-box-text">Downloads</span>
<span class="info-box-number">114,381</span>
<div class="progress">
<div class="progress-bar" style="width: 70%"></div>
</div>
<span class="progress-description">
70% Increase in 30 Days
</span>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
<div class="info-box bg-aqua">
<span class="info-box-icon">
<i class="ion-ios-chatbubble-outline"></i>
</span>
<div class="info-box-content">
<span class="info-box-text">Direct Messages</span>
<span class="info-box-number">163,921</span>
<div class="progress">
<div class="progress-bar" style="width: 40%"></div>
</div>
<span class="progress-description">
40% Increase in 30 Days
</span>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
</div>
</div>
<!--------------------------
| Your Page Content Here |
-------------------------->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<!-- Main Footer -->
<footer class="main-footer">
<!-- To the right -->
<div class="pull-right hidden-xs">
Anything you want
</div>
<!-- Default to the left -->
<strong>Copyright © 2018
<a href="#">Jobayer Arman</a>.</strong> All rights reserved.
</footer>
<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Create the tabs -->
<ul class="nav nav-tabs nav-justified control-sidebar-tabs">
<li class="active">
<a href="#control-sidebar-home-tab" data-toggle="tab">
<i class="fa fa-home"></i>
</a>
</li>
<li>
<a href="#control-sidebar-settings-tab" data-toggle="tab">
<i class="fa fa-gears"></i>
</a>
</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<!-- Home tab content -->
<div class="tab-pane active" id="control-sidebar-home-tab">
<h3 class="control-sidebar-heading">Recent Activity</h3>
<ul class="control-sidebar-menu">
<li>
<a href="javascript:;">
<i class="menu-icon fa fa-birthday-cake bg-red"></i>
<div class="menu-info">
<h4 class="control-sidebar-subheading">Langdon's Birthday</h4>
<p>Will be 23 on April 24th</p>
</div>
</a>
</li>
</ul>
<!-- /.control-sidebar-menu -->
<h3 class="control-sidebar-heading">Tasks Progress</h3>
<ul class="control-sidebar-menu">
<li>
<a href="javascript:;">
<h4 class="control-sidebar-subheading">
Custom Template Design
<span class="pull-right-container">
<span class="label label-danger pull-right">70%</span>
</span>
</h4>
<div class="progress progress-xxs">
<div class="progress-bar progress-bar-danger" style="width: 70%"></div>
</div>
</a>
</li>
</ul>
<!-- /.control-sidebar-menu -->
</div>
<!-- /.tab-pane -->
<!-- Stats tab content -->
<div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab Content</div>
<!-- /.tab-pane -->
<!-- Settings tab content -->
<div class="tab-pane" id="control-sidebar-settings-tab">
<form method="post">
<h3 class="control-sidebar-heading">General Settings</h3>
<div class="form-group">
<label class="control-sidebar-subheading">
Report panel usage
<input type="checkbox" class="pull-right" checked>
</label>
<p>
Some information about this general settings option
</p>
</div>
<!-- /.form-group -->
</form>
</div>
<!-- /.tab-pane -->
</div>
</aside>
<!-- /.control-sidebar -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.js"></script>
<!-- build:js(.) scripts/vendor.js -->
<script src="./../bower_components/jquery/dist/jquery.min.js"></script>
<script src="./../bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="./../bower_components/AdminLTE/dist/js/adminlte.js"></script>
<!-- ChartJS -->
<script src="./../bower_components/chart.js/Chart.min.js"></script>
</body>
</html>
| 39.03491 | 165 | 0.405274 |
31660a1182a4a8d1b34a942fc3acf3f43dcba54c | 286 | sql | SQL | data_loading/load_patient.sql | renuka-fernando/diabetes_data_warehouse | 3f6c058ab19d764986ba334ce2bd0ccd56f223c6 | [
"MIT"
] | 8 | 2018-11-12T00:47:37.000Z | 2022-03-17T09:58:43.000Z | data_loading/load_patient.sql | renuka-fernando/diabetes_data_warehouse | 3f6c058ab19d764986ba334ce2bd0ccd56f223c6 | [
"MIT"
] | 8 | 2018-06-23T17:00:38.000Z | 2021-03-19T08:09:45.000Z | data_loading/load_patient.sql | renuka-fernando/diabetes_data_warehouse | 3f6c058ab19d764986ba334ce2bd0ccd56f223c6 | [
"MIT"
] | 3 | 2018-06-23T13:08:29.000Z | 2018-08-29T15:37:02.000Z | INSERT INTO `diabetes_dwh`.`dim_patient` (`patient_number`, `race`, `gender`, `age`)
SELECT DISTINCT `patient_nbr`, `race`, `gender`, `age`
FROM `diabetes_dwh_staging`.`dataset_modified`
ORDER BY `patient_nbr`, `age`;
SELECT *
FROM `diabetes_dwh`.`dim_patient`
WHERE `patient_sk` = 62; | 35.75 | 84 | 0.730769 |
c2c197b9d1aed50c2c0c56d481bcc2ad13d5e6fd | 253 | go | Go | config/status.go | djbender/muss | dcbc093f91c8abfe1aedcd0486900c2323e0c377 | [
"MIT"
] | 3 | 2019-12-18T15:40:37.000Z | 2020-04-18T02:21:50.000Z | config/status.go | djbender/muss | dcbc093f91c8abfe1aedcd0486900c2323e0c377 | [
"MIT"
] | 12 | 2020-11-19T23:47:05.000Z | 2021-03-19T23:26:30.000Z | config/status.go | djbender/muss | dcbc093f91c8abfe1aedcd0486900c2323e0c377 | [
"MIT"
] | 2 | 2020-03-02T23:09:41.000Z | 2020-04-06T17:04:11.000Z | package config
import (
"time"
)
// StatusConfig defines how to determine project status.
type StatusConfig struct {
Exec []string `yaml:"exec"`
LineFormat string `yaml:"line_format"`
Interval time.Duration `yaml:"interval"`
}
| 19.461538 | 56 | 0.679842 |
75dbeebea454f6fdaf3c49ea3fe285b67bbae33f | 1,746 | php | PHP | resources/views/admin/categories/index.blade.php | iamfrego/laravel-boolpress | 9cbe3f83bb94dcfe43d17818c10a826f5cccf80f | [
"MIT"
] | null | null | null | resources/views/admin/categories/index.blade.php | iamfrego/laravel-boolpress | 9cbe3f83bb94dcfe43d17818c10a826f5cccf80f | [
"MIT"
] | null | null | null | resources/views/admin/categories/index.blade.php | iamfrego/laravel-boolpress | 9cbe3f83bb94dcfe43d17818c10a826f5cccf80f | [
"MIT"
] | null | null | null | @extends('layouts.admin')
@section('content')
<div class="container mt-5">
<h1>Categories</h1>
<div class="row">
<div class="col-md-8">
<!-- Form per creare una categoria -->
<form action="{{ route('admin.categories.store') }}" method="post">
@csrf
<div class="mb-3">
<label for="name" class="form-label">Name</label>
<input type="text" name="name" id="name" class="form-control" placeholder="Category name here"
aria-describedby="nameHelper">
<small id="nameHelper" class="text-muted">Type a category name: </small>
</div>
<button type="submit" class="btn btn-dark">Add category</button>
</form>
</div>
<div class="col-md-4">
<ul class="list-group">
@foreach ($categories as $category)
<li class="list-group-item d-flex align-items-center justify-content-between">
<p>{{ $category->name }}</p>
<form action="{{ route('admin.categories.destroy', $category->id) }}" method="post">
@csrf
@method('DELETE')
<button type="submit" class="btn text-danger">
<i class="fas fa-trash fa-lg fa-fw"></i>
</button>
</form>
</li>
@endforeach
</ul>
</div>
</div>
</div>
@endsection
| 42.585366 | 118 | 0.415808 |
8fcbd1416f033c2590018f98b398e57aa2fd7c01 | 3,148 | kt | Kotlin | quality/src/main/kotlin/net/twisterrob/gradle/quality/report/html/model/LintMessageDetailsSplitter.kt | TWiStErRob/net.twisterrob.gradle.quality | b1363d4c90d3db43e5c77efe9738b538d312d263 | [
"MIT"
] | 7 | 2018-01-24T18:44:08.000Z | 2021-12-20T22:06:14.000Z | quality/src/main/kotlin/net/twisterrob/gradle/quality/report/html/model/LintMessageDetailsSplitter.kt | TWiStErRob/net.twisterrob.gradle.quality | b1363d4c90d3db43e5c77efe9738b538d312d263 | [
"MIT"
] | 161 | 2018-01-29T00:05:46.000Z | 2022-03-29T11:21:18.000Z | quality/src/main/kotlin/net/twisterrob/gradle/quality/report/html/model/LintMessageDetailsSplitter.kt | TWiStErRob/net.twisterrob.gradle.quality | b1363d4c90d3db43e5c77efe9738b538d312d263 | [
"MIT"
] | null | null | null | package net.twisterrob.gradle.quality.report.html.model
import net.twisterrob.gradle.quality.Violation
class LintMessageDetailsSplitter {
data class MessageDetails(
val title: String,
val message: String,
val description: String
)
fun split(v: Violation): MessageDetails {
val handler = specialCases[v.rule] ?: ::defaultSplit
return handler(v)
}
companion object {
private fun String.replaceNewLines(): String =
replace("""
""", "\n")
/**
* Reverse of [se.bjurr.violations.lib.parsers.AndroidLintParser.parseReportOutput].
*/
private fun defaultSplit(v: Violation): MessageDetails {
val lines = v.message.lineSequence()
return MessageDetails(
title = lines.elementAt(0).replaceNewLines(),
message = lines.elementAt(1).replaceNewLines(),
description = lines
.drop(2) // already used 0 and 1 above
.joinToString("\n")
.replaceNewLines()
)
}
private val specialCases: Map<String, (Violation) -> MessageDetails> = mapOf(
"IconMissingDensityFolder" to fun(v: Violation): MessageDetails {
val split = defaultSplit(v)
val replaced = split.message
.replace(Regex("""(?<=Missing density variation folders in `)(.*?)(?=`:)""")) {
it.value.replace("""\\""", """\""")
}
return split.copy(message = replaced)
},
// Consider using ContextViewModel.ErrorContext for displaying the stack trace of this.
"LintError" to fun(v: Violation): MessageDetails {
val split = defaultSplit(v)
val replaced =
if ("←" in split.message) {
split.message
.replace(Regex("""Stack: `(.*?):"""), "$0←")
.replace(
Regex(
"""
Unexpected failure during lint analysis of (.*?) \(this is a bug in lint or one of the libraries it depends on\)
Stack: `(.*?):(.*)`\n\nYou can set environment variable `LINT_PRINT_STACKTRACE=true` to dump a full stacktrace to stdout\.
""".trimIndent()
)
) {
"""
Unexpected failure during lint analysis of `${it.groupValues[1]}`.
```
Exception in thread "lint" ${it.groupValues[2]}:${
it.groupValues[3]
.replace("←", "\n\tat ")
.prependIndent("\t\t\t\t\t\t\t\t")
.trimStart('\t')
}
```
""".trimIndent()
}
} else {
split.message
.replace(
Regex(
"""
Unexpected failure during lint analysis of (.*?) \(this is a bug in lint or one of the libraries it depends on\)
Stack: `(.*?):`\n\nYou can set environment variable `LINT_PRINT_STACKTRACE=true` to dump a full stacktrace to stdout\.
""".trimIndent()
)
) {
"""
`${it.groupValues[2]}` during lint analysis of `${it.groupValues[1]}`.
""".trimIndent()
}
}
return split.copy(
message = replaced,
description = "This is a bug in lint or one of the libraries it depends on." +
"\n\nYou can set environment variable `LINT_PRINT_STACKTRACE=true` to dump a full stacktrace to stdout." +
"\n\n" + split.description
)
}
)
}
}
| 30.563107 | 131 | 0.59784 |
291bfbb6b5b2b9e12bc73b5eb65200e4deaf9fa0 | 42 | py | Python | All_Source_Code/VisionDeepLearning/VisionDeepLearning_2.py | APMonitor/pds | fa9a7ec920802de346dcdf7f5dd92d752142c16f | [
"MIT"
] | 11 | 2021-01-21T09:46:29.000Z | 2022-03-16T19:33:10.000Z | All_Source_Code/VisionDeepLearning/VisionDeepLearning_2.py | the-mahapurush/pds | 7cb4087dd8e75cb1e9b2a4283966c798175f61f7 | [
"MIT"
] | 1 | 2022-03-16T19:47:09.000Z | 2022-03-16T20:11:50.000Z | All_Source_Code/VisionDeepLearning/VisionDeepLearning_2.py | the-mahapurush/pds | 7cb4087dd8e75cb1e9b2a4283966c798175f61f7 | [
"MIT"
] | 12 | 2021-02-08T21:11:11.000Z | 2022-03-20T12:42:49.000Z | for x in faces:
print(x['confidence']) | 21 | 26 | 0.642857 |
1122a90ec220d4b91ae8ae8d8551ce6012235e92 | 5,456 | sql | SQL | cruise.sql | PelnaE/cruise-organizing | ce3c661d8c96344d0ded757db84732c98408db10 | [
"MIT"
] | null | null | null | cruise.sql | PelnaE/cruise-organizing | ce3c661d8c96344d0ded757db84732c98408db10 | [
"MIT"
] | null | null | null | cruise.sql | PelnaE/cruise-organizing | ce3c661d8c96344d0ded757db84732c98408db10 | [
"MIT"
] | null | null | null | -- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 17, 2018 at 06:20 PM
-- Server version: 10.1.29-MariaDB
-- PHP Version: 7.1.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `cruise`
--
-- --------------------------------------------------------
--
-- Table structure for table `cabins`
--
CREATE TABLE `cabins` (
`ID` int(11) NOT NULL,
`class` varchar(100) NOT NULL,
`descr` longtext NOT NULL,
`shipID` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `cabins`
--
INSERT INTO `cabins` (`ID`, `class`, `descr`, `shipID`) VALUES
(1, 'A', 'Kruta klase', 2),
(2, 'B', 'Visādas iespējas', 1);
-- --------------------------------------------------------
--
-- Table structure for table `passengers`
--
CREATE TABLE `passengers` (
`passengerID` int(11) NOT NULL,
`name` varchar(100) NOT NULL,
`surname` varchar(100) NOT NULL,
`persCode` varchar(12) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `ports`
--
CREATE TABLE `ports` (
`portID` int(11) NOT NULL,
`portName` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `ports`
--
INSERT INTO `ports` (`portID`, `portName`) VALUES
(1, 'Stokholma'),
(2, 'Helsinki'),
(3, 'Tallina'),
(4, 'Rīga');
-- --------------------------------------------------------
--
-- Table structure for table `routes`
--
CREATE TABLE `routes` (
`routeID` int(11) NOT NULL,
`routeStart` varchar(100) NOT NULL,
`routeEnd` varchar(100) NOT NULL,
`startTime` varchar(10) NOT NULL,
`endTime` varchar(10) NOT NULL,
`shipID` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `routes`
--
INSERT INTO `routes` (`routeID`, `routeStart`, `routeEnd`, `startTime`, `endTime`, `shipID`) VALUES
(1, 'Stokholma', 'Tallina', '1520672400', '1517563800', 2);
-- --------------------------------------------------------
--
-- Table structure for table `ships`
--
CREATE TABLE `ships` (
`shipID` int(11) NOT NULL,
`shipName` varchar(100) NOT NULL,
`shipDescr` longtext NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `ships`
--
INSERT INTO `ships` (`shipID`, `shipName`, `shipDescr`) VALUES
(1, 'Isabelle', 'Skaists kuģīts\''),
(2, 'Silja Europe', 'Vēl viens kuģīts\''),
(3, 'Romantika', 'Skaists kuģīts\'');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`userID` int(11) NOT NULL,
`name` text NOT NULL,
`surname` text NOT NULL,
`persCode` text NOT NULL,
`password` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`userID`, `name`, `surname`, `persCode`, `password`) VALUES
(1, 'Jānis', 'Liepiņš', '111111-11111', 'sha256:1000:3ZALsOlPhbHktQjpEFhKZSlY9bu1kEcn:SUwjk4lNYmvD5f3ROP1WANLa9Lu2T76P');
-- --------------------------------------------------------
--
-- Table structure for table `voyage`
--
CREATE TABLE `voyage` (
`voyageID` int(11) NOT NULL,
`shipID` int(11) NOT NULL,
`cabinID` int(11) NOT NULL,
`routeID` int(11) NOT NULL,
`passengerID` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `cabins`
--
ALTER TABLE `cabins`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `passengers`
--
ALTER TABLE `passengers`
ADD PRIMARY KEY (`passengerID`);
--
-- Indexes for table `ports`
--
ALTER TABLE `ports`
ADD PRIMARY KEY (`portID`);
--
-- Indexes for table `routes`
--
ALTER TABLE `routes`
ADD PRIMARY KEY (`routeID`);
--
-- Indexes for table `ships`
--
ALTER TABLE `ships`
ADD PRIMARY KEY (`shipID`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`userID`);
--
-- Indexes for table `voyage`
--
ALTER TABLE `voyage`
ADD PRIMARY KEY (`voyageID`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `cabins`
--
ALTER TABLE `cabins`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `passengers`
--
ALTER TABLE `passengers`
MODIFY `passengerID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `ports`
--
ALTER TABLE `ports`
MODIFY `portID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `routes`
--
ALTER TABLE `routes`
MODIFY `routeID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `ships`
--
ALTER TABLE `ships`
MODIFY `shipID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `userID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `voyage`
--
ALTER TABLE `voyage`
MODIFY `voyageID` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| 21.480315 | 121 | 0.628299 |
7d934476aeb43e1671ee385e19c0cb39c657c811 | 4,837 | dart | Dart | lib/src/date_checker_base.dart | CalvinGonsalves/date_checker | b7cc987b2c51cb376d69781ce1ba354dc9ef82e6 | [
"BSD-3-Clause"
] | null | null | null | lib/src/date_checker_base.dart | CalvinGonsalves/date_checker | b7cc987b2c51cb376d69781ce1ba354dc9ef82e6 | [
"BSD-3-Clause"
] | null | null | null | lib/src/date_checker_base.dart | CalvinGonsalves/date_checker | b7cc987b2c51cb376d69781ce1ba354dc9ef82e6 | [
"BSD-3-Clause"
] | null | null | null | ///Returns the first day of the week in which [date] is present. If [date] is
///not provided,
///the current day `DateTime.now()` is considered.
///
///```
///var moonLanding = DateTime.parse("1969-07-20 20:18:04Z");
///assert(weekStart(date: moonLanding) == DateTime(1969, 7, 14));
///assert(weekStart(date: moonLanding).weekday == DateTime.monday)
///
///```
///
///In accordance with ISO 8601 a week starts with Monday.
///By default the week will start with Monday unless [isMondayStartOfWeek] is
///set to false
///then week starts with Sunday.
///
///```
///assert(weekStart(date: moonLanding, isMondayStartOfWeek: false) ==
/// DateTime(1969, 7, 20),);
///assert(
/// weekStart(
/// date: moonLanding,
/// isMondayStartOfWeek: false,
/// ).weekday ==
/// DateTime.sunday,
/// );
///```
DateTime weekStart({DateTime? date, bool isMondayStartOfWeek = true}) {
date = date?.toLocal() ?? DateTime.now().toLocal();
var startOfWeek = DateTime(date.year, date.month, date.day);
var weekDay =
isMondayStartOfWeek ? startOfWeek.weekday : 1 + startOfWeek.weekday % 7;
startOfWeek = startOfWeek.subtract(
Duration(
days: weekDay - 1,
),
);
return startOfWeek;
}
///Returns the last day of the week in which [date] is present. If [date] is not
///provided,the current day `DateTime.now()` is considered.
///
///```
///var moonLanding = DateTime.parse("1969-07-20 20:18:04Z");
///assert(weekEnd(date: moonLanding) == DateTime(1969, 7, 20, 23, 59, 59, 999));
///assert(weekEnd(date: moonLanding).weekday == DateTime.sunday)
///```
///
///In accordance with ISO 8601 a week ends with Sunday.
///By default the week will end with Sunday unless [isMondayStartOfWeek] is set
///to false then week ends with Saturday.
///
///```
///assert(weekEnd(date: moonLanding, isMondayStartOfWeek: false) ==
/// DateTime(1969, 7, 26, 23, 59, 59, 999),);
///assert(weekEnd(date: moonLanding, isMondayStartOfWeek: false).weekday ==
/// DateTime.saturday,)
///```
///
DateTime weekEnd({DateTime? date, bool isMondayStartOfWeek = true}) {
date = date?.toLocal() ?? DateTime.now().toLocal();
var endOFWeek =
DateTime(date.year, date.month, date.day, 23, 59, 59, 999, 999);
var weekDay =
isMondayStartOfWeek ? endOFWeek.weekday : 1 + endOFWeek.weekday % 7;
endOFWeek = endOFWeek.add(
Duration(
days: 7 - weekDay,
),
);
return endOFWeek;
}
///Sets the start of the week to Sunday if set to true. This affects the result.
///of [isLastWeek] and [isThisWeek]
///
///By default Monday is the start of week.
set sundayAsStartOfWeek(bool sunday) =>
DateChecker._isMondayStartOfWeek = !sunday;
///Extension methods on DateTime
extension DateChecker on DateTime {
static bool _isMondayStartOfWeek = true;
///Returns true if [this] is current day
bool get isToday {
final date = toLocal();
final now = DateTime.now();
final diffDays = date.difference(now).inDays;
final isSameAsToday = (diffDays == 0 && date.day == now.day);
return isSameAsToday;
}
///Returns true if [this] is the next day
bool get isTomorrow {
final date = toLocal();
final now = DateTime.now();
return DateTime(now.year, now.month, now.day + 1) ==
(DateTime(date.year, date.month, date.day));
}
///Returns true if [this] is the previous day
bool get isYesterday {
final date = toLocal();
final now = DateTime.now();
return DateTime(now.year, now.month, now.day - 1) ==
(DateTime(date.year, date.month, date.day));
}
///Returns true if [this] is in last week
bool get isLastWeek {
final date = toLocal();
final weekStartDate = weekStart(
isMondayStartOfWeek: _isMondayStartOfWeek,
);
return (date.isAfter(
weekStartDate.subtract(const Duration(days: 7, microseconds: 1)),
) &&
date.isBefore(
weekStartDate,
));
}
///Returns true if [this] is in current week
bool get isThisWeek {
final date = toLocal();
final weekStartDate = weekStart(isMondayStartOfWeek: _isMondayStartOfWeek);
return ((date.isAtSameMomentAs(weekStartDate) ||
date.isAfter(weekStartDate)) &&
date.isBefore(weekEnd(isMondayStartOfWeek: _isMondayStartOfWeek)
.add(const Duration(microseconds: 1))));
}
///Returns true if [this] is in next week
bool get isNextWeek {
final date = toLocal();
final weekEndDate = weekEnd(isMondayStartOfWeek: _isMondayStartOfWeek);
return date.isAfter(weekEndDate) &&
date.isBefore(
weekEndDate.add(const Duration(days: 7, microseconds: 1)));
}
///Returs true if [this] is in current month of the current year
bool get isThisMonth =>
year == DateTime.now().year && month == DateTime.now().month;
}
| 30.23125 | 80 | 0.652264 |
a00e7a5700b4b6c515568aea5fbb738b80dd7d2b | 750 | swift | Swift | RWCoreDataViewer/RWCoreDataEntity.swift | richmondwatkins/RWCoreDataViewer | eb3f36abb0b19565ee0b23a40b4d5e9c72b02e7d | [
"MIT"
] | 15 | 2016-04-15T23:34:35.000Z | 2021-06-11T07:36:50.000Z | RWCoreDataViewer/RWCoreDataEntity.swift | richmondwatkins/RWCoreDataViewer | eb3f36abb0b19565ee0b23a40b4d5e9c72b02e7d | [
"MIT"
] | null | null | null | RWCoreDataViewer/RWCoreDataEntity.swift | richmondwatkins/RWCoreDataViewer | eb3f36abb0b19565ee0b23a40b4d5e9c72b02e7d | [
"MIT"
] | 2 | 2016-06-30T09:55:52.000Z | 2016-06-30T21:32:00.000Z | //
// AMACoreDataEntiry.swift
// AMAUtils
//
// Created by Watkins, Richmond on 4/13/16.
// Copyright © 2016 Asurion. All rights reserved.
//
import UIKit
import CoreData
class RWCoreDataEntity {
let entityName: String
let properties: [RWProperty]
let fetchResults: NSArray
init(entityName: String, properties: [String], moc: NSManagedObjectContext) {
self.entityName = entityName
self.properties = properties.map({ (propertyString) -> RWProperty in
return RWProperty(name: propertyString)
})
let fetchRequest: NSFetchRequest = NSFetchRequest<NSManagedObject>(entityName: entityName)
self.fetchResults = try! moc.fetch(fetchRequest) as NSArray
}
}
| 25.862069 | 98 | 0.674667 |
0c854c215d158012c99078b8d02a0bf8423f9708 | 20,048 | py | Python | bookworm/ocr/ocr_dialogs.py | xingkong0113/bookworm | 7214067f48e7a951198806a1f9170e3fd8fc0cce | [
"MIT"
] | 36 | 2020-11-15T03:21:39.000Z | 2022-03-05T01:11:26.000Z | bookworm/ocr/ocr_dialogs.py | xingkong0113/bookworm | 7214067f48e7a951198806a1f9170e3fd8fc0cce | [
"MIT"
] | 90 | 2020-10-06T14:46:07.000Z | 2022-03-31T03:03:34.000Z | bookworm/ocr/ocr_dialogs.py | xingkong0113/bookworm | 7214067f48e7a951198806a1f9170e3fd8fc0cce | [
"MIT"
] | 20 | 2020-09-30T17:40:44.000Z | 2022-03-17T19:59:53.000Z | # coding: utf-8
import wx
import wx.lib.sized_controls as sc
from dataclasses import dataclass
from functools import partial
from wx.adv import CommandLinkButton
from bookworm import app
from bookworm import config
from bookworm import typehints as t
from bookworm.i18n import LocaleInfo
from bookworm.concurrency import threaded_worker
from bookworm.gui.settings import SettingsPanel, ReconciliationStrategies
from bookworm.gui.components import (
make_sized_static_box,
SimpleDialog,
RobustProgressDialog,
SnakDialog,
AsyncSnakDialog,
ImmutableObjectListView,
ColumnDefn,
)
from bookworm.utils import restart_application
from bookworm.logger import logger
from bookworm.platform_services._win32 import tesseract_download
from bookworm.ocr_engines.tesseract_ocr_engine import TesseractOcrEngine
from bookworm.ocr_engines.image_processing_pipelines import (
ImageProcessingPipeline,
DebugProcessingPipeline,
DPIProcessingPipeline,
ThresholdProcessingPipeline,
BlurProcessingPipeline,
TwoInOneScanProcessingPipeline,
DeskewProcessingPipeline,
InvertColourProcessingPipeline,
ErosionProcessingPipeline,
DilationProcessingPipeline,
ConcatImagesProcessingPipeline,
SharpenColourProcessingPipeline,
)
log = logger.getChild(__name__)
@dataclass
class OcrOptions:
language: LocaleInfo
zoom_factor: float
_ipp_enabled: int
image_processing_pipelines: t.Tuple[ImageProcessingPipeline]
store_options: bool
class OcrPanel(SettingsPanel):
config_section = "ocr"
def addControls(self):
self._service = wx.GetApp().service_handler.get_service("ocr")
self._engines = self._service._available_ocr_engines
_engines_display = [_(e.display_name) for e in self._engines]
# Translators: the label of a group of controls in the reading page
generalOcrBox = self.make_static_box(_("OCR Options"))
self.ocrEngine = wx.RadioBox(
generalOcrBox,
-1,
# Translators: the title of a group of radio buttons in the OCR page
# in the application settings.
_("Default OCR Engine"),
majorDimension=1,
style=wx.RA_SPECIFY_COLS,
choices=_engines_display,
)
# Translators: the label of a group of controls in the OCR page
# of the settings related to Tesseract OCR engine
tessBox = self.make_static_box(_("Tesseract OCR Engine"))
if not tesseract_download.is_tesseract_available():
tessEngineDlBtn = CommandLinkButton(
tessBox,
-1,
_("Download Tesseract OCR Engine"),
_(
"Get a free, high-quality OCR engine that supports over 100 languages."
),
)
self.Bind(wx.EVT_BUTTON, self.onDownloadTesseractEngine, tessEngineDlBtn)
else:
tessLangDlBtn = CommandLinkButton(
tessBox,
-1,
_("Manage Tesseract OCR Languages"),
_("Add support for new languages, and /or remove installed languages."),
)
self.Bind(wx.EVT_BUTTON, self.onDownloadTesseractLanguages, tessLangDlBtn)
# Translators: the label of a group of controls in the reading page
# of the settings related to image enhancement
miscBox = self.make_static_box(_("Image processing"))
wx.CheckBox(
miscBox,
-1,
# Translators: the label of a checkbox
_("Enable default image enhancement filters"),
name="ocr.enhance_images",
)
def reconcile(self, strategy=ReconciliationStrategies.load):
if strategy is ReconciliationStrategies.load:
self.ocrEngine.SetSelection(
self._engines.index(self._service.get_first_available_ocr_engine())
)
elif strategy is ReconciliationStrategies.save:
selected_engine = self._engines[self.ocrEngine.GetSelection()]
if self.config["engine"] != selected_engine.name:
self.config["engine"] = selected_engine.name
self._service._init_ocr_engine()
super().reconcile(strategy=strategy)
if strategy is ReconciliationStrategies.save:
self._service._init_ocr_engine()
def onDownloadTesseractEngine(self, event):
AsyncSnakDialog(
task=tesseract_download.get_tesseract_download_info,
done_callback=self._on_tesseract_download_info,
message=_("Retrieving download info, please wait..."),
parent=self,
)
def onDownloadTesseractLanguages(self, event):
TesseractLanguageManager(
title=_("Manage Tesseract OCR Engine Languages"), parent=self
).ShowModal()
def _on_tesseract_download_info(self, future):
if (
info := tesseract_download.get_tesseract_download_info_from_future(
future, self
)
) is None:
return
dl_url = info.get_engine_download_url()
progress_dlg = RobustProgressDialog(
self,
# Translators: title of a progress dialog
_("Downloading Tesseract OCR Engine"),
# Translators: message of a progress dialog
_("Getting download information..."),
maxvalue=100,
can_abort=True,
)
threaded_worker.submit(
tesseract_download.download_tesseract_engine, dl_url, progress_dlg
).add_done_callback(partial(self._after_tesseract_install, progress_dlg))
def _after_tesseract_install(self, progress_dlg, future):
progress_dlg.Dismiss()
if future.result() is True:
wx.GetApp().mainFrame.notify_user(
_("Restart Required"),
_(
"Bookworm will now restart to complete the installation of the Tesseract OCR Engine."
),
)
wx.CallAfter(restart_application)
class OCROptionsDialog(SimpleDialog):
"""OCR options."""
def __init__(
self, *args, stored_options=None, languages=(), force_save=False, **kwargs
):
self.stored_options = stored_options
self.languages = languages
self.force_save = force_save
self._return_value = None
self.image_processing_pipelines = []
self.stored_ipp = (
()
if self.stored_options is None
else self.stored_options.image_processing_pipelines
)
super().__init__(*args, **kwargs)
def addControls(self, parent):
# Translators: the label of a combobox
label = wx.StaticText(parent, -1, _("Recognition Language:"))
self.langChoice = wx.Choice(
parent, -1, choices=[l.description for l in self.languages]
)
self.langChoice.SetSizerProps(expand=True)
wx.StaticText(parent, -1, _("Supplied Image resolution::"))
self.zoomFactorSlider = wx.Slider(parent, -1, minValue=0, maxValue=10)
# Translators: the label of a checkbox
self.should_enhance_images = wx.CheckBox(
parent, -1, _("Enable image enhancements")
)
ippPanel = sc.SizedPanel(parent)
# Translators: the label of a checkbox
imgProcBox = make_sized_static_box(
ippPanel, _("Available image pre-processing filters:")
)
for (ipp_cls, lbl, should_enable) in self.get_image_processing_pipelines_info():
chbx = wx.CheckBox(imgProcBox, -1, lbl)
if self.stored_options is not None:
chbx.SetValue(ipp_cls in self.stored_ipp)
else:
chbx.SetValue(should_enable)
self.image_processing_pipelines.append((chbx, ipp_cls))
wx.StaticLine(parent)
if not self.force_save:
self.storeOptionsCheckbox = wx.CheckBox(
parent,
-1,
# Translators: the label of a checkbox
_("&Save these options until I close the current book"),
)
self.Bind(wx.EVT_BUTTON, self.onOK, id=wx.ID_OK)
if self.stored_options is None:
self.langChoice.SetSelection(0)
self.zoomFactorSlider.SetValue(2)
self.should_enhance_images.SetValue(config.conf["ocr"]["enhance_images"])
else:
self.langChoice.SetSelection(
self.languages.index(self.stored_options.language)
)
self.zoomFactorSlider.SetValue(self.stored_options.zoom_factor)
self.should_enhance_images.SetValue(self.stored_options._ipp_enabled)
if not self.force_save:
self.storeOptionsCheckbox.SetValue(self.stored_options.store_options)
enable_or_disable_image_pipelines = lambda: ippPanel.Enable(
self.should_enhance_images.IsChecked()
)
self.Bind(
wx.EVT_CHECKBOX,
lambda e: enable_or_disable_image_pipelines(),
self.should_enhance_images,
)
enable_or_disable_image_pipelines()
def onOK(self, event):
if not self.should_enhance_images.IsChecked():
selected_image_pp = []
else:
selected_image_pp = [
ipp_cls
for c, ipp_cls in self.image_processing_pipelines
if c.IsChecked()
]
self._return_value = OcrOptions(
language=self.languages[self.langChoice.GetSelection()],
zoom_factor=self.zoomFactorSlider.GetValue() or 1,
_ipp_enabled=self.should_enhance_images.IsChecked(),
image_processing_pipelines=selected_image_pp,
store_options=self.force_save or self.storeOptionsCheckbox.IsChecked(),
)
self.Close()
def ShowModal(self):
super().ShowModal()
return self._return_value
def get_image_processing_pipelines_info(self):
ipp = [
(DPIProcessingPipeline, _("Increase image resolution"), True),
(ThresholdProcessingPipeline, _("Binarization"), True),
(
TwoInOneScanProcessingPipeline,
_("Split two-in-one scans to individual pages"),
False,
),
(ConcatImagesProcessingPipeline, _("Combine images"), False),
(BlurProcessingPipeline, _("Blurring"), False),
(DeskewProcessingPipeline, _("Deskewing"), False),
(ErosionProcessingPipeline, _("Erosion"), False),
(DilationProcessingPipeline, _("Dilation"), False),
(SharpenColourProcessingPipeline, _("Sharpen image"), False),
(InvertColourProcessingPipeline, _("Invert colors"), False),
]
if app.debug:
ipp.append((DebugProcessingPipeline, _("Debug"), False))
return ipp
class TesseractLanguageManager(SimpleDialog):
"""
A dialog to manage the languages for the managed
version of Tesseract OCR Engine on Windows.
"""
def __init__(self, *args, **kwargs):
self.online_languages = ()
super().__init__(*args, **kwargs)
self.SetSize((600, -1))
self.CenterOnScreen()
def addControls(self, parent):
# Translators: label of a list control containing bookmarks
wx.StaticText(parent, -1, _("Tesseract Languages"))
listPanel = sc.SizedPanel(parent)
listPanel.SetSizerType("horizontal")
listPanel.SetSizerProps(expand=True, align="center")
self.tesseractLanguageList = ImmutableObjectListView(
listPanel, wx.ID_ANY, style=wx.LC_REPORT | wx.SUNKEN_BORDER, size=(500, -1)
)
self.btnPanel = btnPanel = sc.SizedPanel(parent, -1)
btnPanel.SetSizerType("horizontal")
btnPanel.SetSizerProps(expand=True)
# Translators: text of a button to add a language to Tesseract OCR Engine (best quality model)
self.addBestButton = wx.Button(btnPanel, wx.ID_ANY, _("Download &Best Model"))
# Translators: text of a button to add a language to Tesseract OCR Engine (fastest model)
self.addFastButton = wx.Button(btnPanel, wx.ID_ANY, _("Download &Fast Model"))
# Translators: text of a button to remove a language from Tesseract OCR Engine
self.removeButton = wx.Button(btnPanel, wx.ID_REMOVE, _("&Remove"))
self.Bind(wx.EVT_BUTTON, self.onAdd, self.addFastButton)
self.Bind(wx.EVT_BUTTON, self.onAdd, self.addBestButton)
self.Bind(wx.EVT_BUTTON, self.onRemove, id=wx.ID_REMOVE)
self.Bind(
wx.EVT_LIST_ITEM_FOCUSED,
self.onListFocusChanged,
self.tesseractLanguageList,
)
AsyncSnakDialog(
task=tesseract_download.get_tesseract_download_info,
done_callback=self._on_tesseract_dl_info,
message=_("Getting download information, please wait..."),
parent=self,
)
def getButtons(self, parent):
btnsizer = wx.StdDialogButtonSizer()
# Translators: the label of a button to close a dialog
btnsizer.AddButton(wx.Button(self, wx.ID_CANCEL, _("&Close")))
btnsizer.Realize()
return btnsizer
def _on_tesseract_dl_info(self, future):
if (
info := tesseract_download.get_tesseract_download_info_from_future(
future, self
)
) is None:
return
self.online_languages = info.languages
self.populate_list()
def populate_list(self):
language_identifiers = set(
(True, lang.given_locale_name)
for lang in TesseractOcrEngine.get_recognition_languages()
)
_installed_langs = {lang[1].lower() for lang in language_identifiers}
language_identifiers.update(
(False, lang)
for lang in self.online_languages
if lang.lower() not in _installed_langs
)
languages = [
(
lang[0],
LocaleInfo.from_three_letter_code(lang[1]),
)
for lang in sorted(language_identifiers, key=lambda l: l, reverse=True)
]
column_defn = [
ColumnDefn(
# Translators: the title of a column in the Tesseract language list
_("Language"),
"left",
450,
lambda lang: lang[1].description,
),
ColumnDefn(
# Translators: the title of a column in the Tesseract language list
_("Installed"),
"center",
100,
lambda lang: _("Yes") if lang[0] else _("No"),
),
]
self.tesseractLanguageList.set_columns(column_defn)
self.tesseractLanguageList.set_objects(languages, focus_item=0)
# Maintain the state of the list
if not any(languages):
self.addBestButton.Enable(False)
self.addFastButton.Enable(False)
self.removeButton.Enable(False)
self.btnPanel.Enable(False)
def onAdd(self, event):
if (selected := self.tesseractLanguageList.get_selected()) is None:
return
lang = selected[1]
variant = "best" if event.GetEventObject() == self.addBestButton else "fast"
AsyncSnakDialog(
task=tesseract_download.get_tesseract_download_info,
done_callback=partial(
self._on_download_language, lang.given_locale_name, variant
),
message=_("Getting download information, please wait..."),
parent=self,
)
def onRemove(self, event):
if (selected := self.tesseractLanguageList.get_selected()) is None:
return
lang = selected[1]
msg = wx.MessageBox(
# Translators: content of a messagebox
_("Are you sure you want to remove language:\n{lang}?").format(
lang=lang.description
),
# Translators: title of a messagebox
_("Confirm"),
style=wx.YES_NO | wx.ICON_WARNING,
)
if msg == wx.NO:
return
try:
tesseract_download.get_language_path(lang.given_locale_name).unlink()
self.populate_list()
except:
log.exception(f"Could not remove language {lang}", exc_info=True)
def onListFocusChanged(self, event):
if (selected := self.tesseractLanguageList.get_selected()) is not None:
is_installed = selected[0]
self.addBestButton.Enable(not is_installed)
self.addFastButton.Enable(not is_installed)
self.removeButton.Enable(is_installed)
def _on_download_language(self, lang_name, variant, future):
if (
info := tesseract_download.get_tesseract_download_info_from_future(
future, self
)
) is None:
return
if lang_name not in info.languages:
log.debug(f"Could not find download info for language {lang_name}")
return
target_file = tesseract_download.get_language_path(lang_name)
if target_file.exists():
msg = wx.MessageBox(
# Translators: content of a messagebox
_(
"A version of the selected language model already exists.\n"
"Are you sure you want to replace it."
),
# Translators: title of a messagebox
_("Confirm"),
style=wx.YES_NO | wx.ICON_WARNING,
parent=self,
)
if msg == wx.NO:
return
try:
target_file.unlink(missing_ok=True)
except:
return
progress_dlg = RobustProgressDialog(
wx.GetApp().mainFrame,
# Translators: title of a progress dialog
_("Downloading Language"),
# Translators: content of a progress dialog
_("Getting download information..."),
maxvalue=100,
can_hide=True,
can_abort=True,
)
url = info.get_language_download_url(lang_name, variant=variant)
threaded_worker.submit(
tesseract_download.download_language, url, target_file, progress_dlg
).add_done_callback(
lambda future: wx.CallAfter(
self._after_download_language, progress_dlg, future
)
)
def _after_download_language(self, progress_dlg, future):
progress_dlg.Dismiss()
try:
if future.result():
wx.GetApp().mainFrame.notify_user(
# Translators: title of a messagebox
_("Language Added"),
_("The Language Model was downloaded successfully."),
parent=self,
)
self.populate_list()
except ConnectionError:
log.exception("Failed to download language data from {url}", exc_info=True)
wx.GetApp().mainFrame.notify_user(
# Translators: title of a messagebox
_("Connection Error"),
# Translators: content of a messagebox
_(
"Failed to download language data.\nPlease check your internet connection."
),
icon=wx.ICON_ERROR,
)
except:
log.exception("Failed to install language data from {url}", exc_info=True)
wx.GetApp().mainFrame.notify_user(
# Translators: title of a messagebox
_("Error"),
# Translators: content of a messagebox
_("Failed to install language data.\nPlease try again later."),
icon=wx.ICON_ERROR,
parent=self,
)
| 39.232877 | 105 | 0.610934 |
6cd28075b9f313e10b6e039f8dede9657eeba7a7 | 1,943 | go | Go | contrib/cmd/cli/param_parser.go | TsuyoshiUshio/azure-service-broker | 9b3b8900e08767e411efb49f9d5045bcb60fb9b5 | [
"MIT"
] | null | null | null | contrib/cmd/cli/param_parser.go | TsuyoshiUshio/azure-service-broker | 9b3b8900e08767e411efb49f9d5045bcb60fb9b5 | [
"MIT"
] | null | null | null | contrib/cmd/cli/param_parser.go | TsuyoshiUshio/azure-service-broker | 9b3b8900e08767e411efb49f9d5045bcb60fb9b5 | [
"MIT"
] | null | null | null | package main
import (
"fmt"
"strconv"
"strings"
"github.com/Azure/azure-service-broker/contrib/pkg/client"
"github.com/urfave/cli"
)
func parseParams(c *cli.Context) (map[string]interface{}, error) {
params := client.ProvisioningParameters{}
rawParamStrs := c.StringSlice(flagParameter)
for _, rawParamStr := range rawParamStrs {
key, val, err := parseParam(rawParamStr)
if err != nil {
return nil, err
}
params[key] = val
}
rawParamStrs = c.StringSlice(flagIntParameter)
for _, rawParamStr := range rawParamStrs {
key, valStr, err := parseParam(rawParamStr)
if err != nil {
return nil, err
}
val, err := strconv.Atoi(valStr)
if err != nil {
return nil, fmt.Errorf(
`error parsing int value from parameter string "%s"`,
rawParamStr,
)
}
params[key] = val
}
rawParamStrs = c.StringSlice(flagFloatParameter)
for _, rawParamStr := range rawParamStrs {
key, valStr, err := parseParam(rawParamStr)
if err != nil {
return nil, err
}
val, err := strconv.ParseFloat(valStr, 64)
if err != nil {
return nil, fmt.Errorf(
`error parsing float value from parameter string "%s"`,
rawParamStr,
)
}
params[key] = val
}
rawParamStrs = c.StringSlice(flagBoolParameter)
for _, rawParamStr := range rawParamStrs {
key, valStr, err := parseParam(rawParamStr)
if err != nil {
return nil, err
}
val, err := strconv.ParseBool(valStr)
if err != nil {
return nil, fmt.Errorf(
`error parsing bool value from parameter string "%s"`,
rawParamStr,
)
}
params[key] = val
}
return params, nil
}
func parseParam(rawParamStr string) (string, string, error) {
rawParamStr = strings.TrimSpace(rawParamStr)
tokens := strings.Split(rawParamStr, "=")
if len(tokens) != 2 {
return "", "", fmt.Errorf(
`parameter string "%s" is incorrectly formatted`,
rawParamStr,
)
}
return strings.TrimSpace(tokens[0]), strings.TrimSpace(tokens[1]), nil
}
| 23.987654 | 71 | 0.671642 |
b2b4b4908763c3a4a83c42ca39a61f42cc6d7104 | 800 | py | Python | galaxy_kickstart/binary_datatypes_to_be_added_in_galaxy.py | pajanne/galaxy-kickstart | a2e8a9d5f4e610f00548deab691d71290aa3a3b7 | [
"MIT"
] | 2 | 2016-08-04T19:16:17.000Z | 2016-08-04T19:45:58.000Z | galaxy_kickstart/binary_datatypes_to_be_added_in_galaxy.py | pajanne/galaxy-kickstart | a2e8a9d5f4e610f00548deab691d71290aa3a3b7 | [
"MIT"
] | null | null | null | galaxy_kickstart/binary_datatypes_to_be_added_in_galaxy.py | pajanne/galaxy-kickstart | a2e8a9d5f4e610f00548deab691d71290aa3a3b7 | [
"MIT"
] | null | null | null | class CompressedFastq( CompressedArchive ):
"""
Class describing an compressed fastq file
This class can be sublass'ed to implement archive filetypes that will not be unpacked by upload.py.
"""
file_ext = "fq.gz"
def set_peek( self, dataset, is_multi_byte=False ):
if not dataset.dataset.purged:
dataset.peek = "Compressed fastq file"
dataset.blurb = nice_size( dataset.get_size() )
else:
dataset.peek = 'file does not exist'
dataset.blurb = 'file purged from disk'
def display_peek( self, dataset ):
try:
return dataset.peek
except:
return "Compressed fastq file (%s)" % ( nice_size( dataset.get_size() ) )
Binary.register_unsniffable_binary_ext("fq.gz")
| 33.333333 | 107 | 0.62625 |
9ee5a752ffdf7bddf6387e4450aa7143011e44ff | 2,287 | rs | Rust | agent/resource-agent/examples/duplicator_resource_agent/main.rs | webern/bottlerocket-test-system | 6b523be719c79449784ae75b7bc18056d857aa89 | [
"Apache-2.0",
"MIT"
] | 10 | 2022-02-04T22:24:01.000Z | 2022-03-03T21:25:35.000Z | agent/resource-agent/examples/duplicator_resource_agent/main.rs | webern/bottlerocket-test-system | 6b523be719c79449784ae75b7bc18056d857aa89 | [
"Apache-2.0",
"MIT"
] | 78 | 2022-02-04T23:01:29.000Z | 2022-03-31T17:12:00.000Z | agent/resource-agent/examples/duplicator_resource_agent/main.rs | webern/bottlerocket-test-system | 6b523be719c79449784ae75b7bc18056d857aa89 | [
"Apache-2.0",
"MIT"
] | 1 | 2022-03-09T18:53:32.000Z | 2022-03-09T18:53:32.000Z | /*!
This program takes its input (the "spec") and writes it to its output (the "created resource"). The
purpose of this program is to test the resources that depend on other resources for their inputs,
and tests that depend on resources for their inputs.
!*/
mod provider;
use crate::provider::{DuplicationCreator, DuplicationDestroyer};
use env_logger::Builder;
use log::LevelFilter;
use resource_agent::clients::{DefaultAgentClient, DefaultInfoClient};
use resource_agent::error::AgentResult;
use resource_agent::{Agent, BootstrapData, Types};
use std::marker::PhantomData;
#[tokio::main]
async fn main() {
init_logger();
// This will get information that is provided to the container by the TestSys controller.
let data = match BootstrapData::from_env() {
Ok(ok) => ok,
Err(e) => {
eprintln!("Unable to get bootstrap data: {}", e);
std::process::exit(1);
}
};
// Pass the bootstrap data to a run function.
if let Err(e) = run(data).await {
eprintln!("{}", e);
std::process::exit(1);
};
}
async fn run(data: BootstrapData) -> AgentResult<()> {
// We specify all of our custom types with this PhantomData struct.
let types = Types {
info_client: PhantomData::<DefaultInfoClient>::default(),
agent_client: PhantomData::<DefaultAgentClient>::default(),
};
// We build the agent component and use it to either create or destroy resources.
let agent = Agent::new(types, data, DuplicationCreator {}, DuplicationDestroyer {}).await?;
agent.run().await
}
/// Extract the value of `RUST_LOG` if it exists, otherwise log this crate at
/// `DEFAULT_LEVEL_FILTER`.
fn init_logger() {
match std::env::var(env_logger::DEFAULT_FILTER_ENV).ok() {
Some(_) => {
// RUST_LOG exists; env_logger will use it.
Builder::from_default_env().init();
}
None => {
// RUST_LOG does not exist; use default log level for this crate only.
Builder::new()
.filter(Some(env!("CARGO_CRATE_NAME")), LevelFilter::Trace)
.filter(Some("resource_agent"), LevelFilter::Trace)
.filter(Some("model"), LevelFilter::Trace)
.init();
}
}
}
| 33.632353 | 99 | 0.637516 |
83d37363edb2fb1444fd153868f064f5f9c42a16 | 389 | go | Go | types/client/rio/v1beta1/zz_generated_tmpfs.go | innerpeacez/rio | 40b5101e464b8c8449cd47975ef1d820b5cc538c | [
"Apache-2.0"
] | null | null | null | types/client/rio/v1beta1/zz_generated_tmpfs.go | innerpeacez/rio | 40b5101e464b8c8449cd47975ef1d820b5cc538c | [
"Apache-2.0"
] | null | null | null | types/client/rio/v1beta1/zz_generated_tmpfs.go | innerpeacez/rio | 40b5101e464b8c8449cd47975ef1d820b5cc538c | [
"Apache-2.0"
] | null | null | null | package client
const (
TmpfsType = "tmpfs"
TmpfsFieldPath = "path"
TmpfsFieldReadOnly = "readOnly"
TmpfsFieldSizeBytes = "sizeBytes"
)
type Tmpfs struct {
Path string `json:"path,omitempty" yaml:"path,omitempty"`
ReadOnly bool `json:"readOnly,omitempty" yaml:"readOnly,omitempty"`
SizeBytes int64 `json:"sizeBytes,omitempty" yaml:"sizeBytes,omitempty"`
}
| 25.933333 | 73 | 0.706941 |
e4fff5c037a3c14e21d1056109ace2f5fcad5156 | 6,413 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1150.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1150.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1150.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 %r10
push %r11
push %r12
push %r14
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x581c, %rsi
nop
nop
nop
nop
add %r14, %r14
vmovups (%rsi), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $0, %xmm7, %r10
nop
nop
xor $54778, %rbx
lea addresses_normal_ht+0xad9c, %r10
nop
and %rsi, %rsi
vmovups (%r10), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $0, %xmm2, %rdx
nop
nop
lfence
lea addresses_D_ht+0x1309c, %r12
sub %rbx, %rbx
movb (%r12), %dl
and $303, %rbx
lea addresses_A_ht+0xd11c, %r10
nop
nop
nop
nop
and $21161, %r11
movb (%r10), %dl
nop
nop
nop
nop
add %r12, %r12
lea addresses_A_ht+0x1389c, %r12
sub $61351, %rsi
movb (%r12), %r10b
nop
nop
and %rbx, %rbx
lea addresses_WT_ht+0x989c, %rbx
nop
nop
nop
nop
add %r14, %r14
mov $0x6162636465666768, %rsi
movq %rsi, %xmm6
vmovups %ymm6, (%rbx)
nop
nop
nop
add $64625, %rbx
lea addresses_A_ht+0x89c, %rdx
xor $57790, %r14
movl $0x61626364, (%rdx)
xor $42054, %r11
lea addresses_A_ht+0xa69c, %rsi
lea addresses_WC_ht+0x15b9c, %rdi
nop
nop
nop
sub %r12, %r12
mov $3, %rcx
rep movsw
nop
nop
nop
nop
add %r11, %r11
lea addresses_A_ht+0x1569c, %rsi
lea addresses_D_ht+0x405c, %rdi
clflush (%rsi)
nop
nop
nop
nop
dec %r12
mov $74, %rcx
rep movsq
nop
xor $48528, %rbx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r14
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r14
push %r8
push %rax
push %rdi
// Store
lea addresses_WC+0x1c220, %rdi
nop
nop
nop
cmp $27861, %rax
mov $0x5152535455565758, %r11
movq %r11, (%rdi)
dec %r11
// Faulty Load
lea addresses_D+0xb09c, %r11
xor %rdi, %rdi
mov (%r11), %ax
lea oracles, %r11
and $0xff, %rax
shlq $12, %rax
mov (%r11,%rax,1), %rax
pop %rdi
pop %rax
pop %r8
pop %r14
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_WC', 'size': 8, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': True, 'congruent': 7, 'NT': False, 'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_D_ht', 'size': 1, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 9, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
| 39.343558 | 2,999 | 0.656011 |
2a4f91fb8934422b150b6af245ed654d5775118c | 8,185 | java | Java | core/src/main/java/org/jahia/modules/external/events/rest/SimpleValidationFeature.java | Jahia/external-provider | 3c4cc022394512ff50801746ec2a0b6d900c68fc | [
"Apache-2.0"
] | 3 | 2015-05-18T07:34:58.000Z | 2017-03-09T11:01:18.000Z | core/src/main/java/org/jahia/modules/external/events/rest/SimpleValidationFeature.java | Jahia/external-provider | 3c4cc022394512ff50801746ec2a0b6d900c68fc | [
"Apache-2.0"
] | 16 | 2016-09-01T12:02:54.000Z | 2021-09-10T07:05:34.000Z | core/src/main/java/org/jahia/modules/external/events/rest/SimpleValidationFeature.java | Jahia/external-provider | 3c4cc022394512ff50801746ec2a0b6d900c68fc | [
"Apache-2.0"
] | 10 | 2015-03-18T10:25:31.000Z | 2020-03-28T10:46:00.000Z | /*
* ==========================================================================================
* = JAHIA'S DUAL LICENSING - IMPORTANT INFORMATION =
* ==========================================================================================
*
* http://www.jahia.com
*
* Copyright (C) 2002-2020 Jahia Solutions Group SA. All rights reserved.
*
* THIS FILE IS AVAILABLE UNDER TWO DIFFERENT LICENSES:
* 1/GPL OR 2/JSEL
*
* 1/ GPL
* ==================================================================================
*
* IF YOU DECIDE TO CHOOSE THE GPL LICENSE, YOU MUST COMPLY WITH THE FOLLOWING TERMS:
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
* 2/ JSEL - Commercial and Supported Versions of the program
* ===================================================================================
*
* IF YOU DECIDE TO CHOOSE THE JSEL LICENSE, YOU MUST COMPLY WITH THE FOLLOWING TERMS:
*
* Alternatively, commercial and supported versions of the program - also known as
* Enterprise Distributions - must be used in accordance with the terms and conditions
* contained in a separate written agreement between you and Jahia Solutions Group SA.
*
* If you are unsure which license is appropriate for your use,
* please contact the sales department at sales@jahia.com.
*/
package org.jahia.modules.external.events.rest;
import org.glassfish.hk2.api.Factory;
import org.glassfish.hk2.api.PerLookup;
import org.glassfish.hk2.utilities.binding.AbstractBinder;
import org.glassfish.jersey.server.internal.inject.ConfiguredValidator;
import org.glassfish.jersey.server.model.Invocable;
import org.glassfish.jersey.server.model.Parameter;
import org.jahia.services.content.JCRSessionFactory;
import javax.inject.Singleton;
import javax.validation.*;
import javax.validation.executable.ExecutableValidator;
import javax.validation.metadata.BeanDescriptor;
import javax.ws.rs.core.Feature;
import javax.ws.rs.core.FeatureContext;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import java.lang.annotation.Annotation;
import java.util.HashSet;
import java.util.Set;
/**
* Simpler version of ValidationFeature
*/
public class SimpleValidationFeature implements Feature {
@Override
public boolean configure(final FeatureContext context) {
context.register(new AbstractBinder() {
@Override
protected void configure() {
bindFactory(ConfiguredValidatorFactory.class, Singleton.class).to(ConfiguredValidator.class).in(PerLookup.class);
}
});
context.register(ValidationExceptionMapper.class);
return true;
}
public static class ConfiguredValidatorFactory implements Factory<ConfiguredValidator> {
@Override
public ConfiguredValidator provide() {
return new ConfiguredValidatorImpl(JCRSessionFactory.getInstance().getValidatorFactoryBean().getValidator());
}
@Override
public void dispose(ConfiguredValidator configuredValidator) {
}
}
public static class ConfiguredValidatorImpl implements ConfiguredValidator {
private final Validator delegate;
public ConfiguredValidatorImpl(Validator delegate) {
this.delegate = delegate;
}
@Override
public <T> Set<ConstraintViolation<T>> validate(T object, Class<?>... groups) {
return delegate.validate(object, groups);
}
@Override
public <T> Set<ConstraintViolation<T>> validateProperty(T object, String propertyName, Class<?>... groups) {
return delegate.validateProperty(object, propertyName, groups);
}
@Override
public <T> Set<ConstraintViolation<T>> validateValue(Class<T> beanType, String propertyName, Object value, Class<?>... groups) {
return delegate.validateValue(beanType, propertyName, value, groups);
}
@Override
public BeanDescriptor getConstraintsForClass(Class<?> clazz) {
return delegate.getConstraintsForClass(clazz);
}
@Override
public <T> T unwrap(Class<T> type) {
return delegate.unwrap(type);
}
@Override
public ExecutableValidator forExecutables() {
return delegate.forExecutables();
}
@Override
public void validateResourceAndInputParams(Object resource, Invocable resourceMethod, Object[] args) throws ConstraintViolationException {
final Set<ConstraintViolation<Object>> constraintViolations = new HashSet<ConstraintViolation<Object>>();
final BeanDescriptor beanDescriptor = getConstraintsForClass(resource.getClass());
// Resource validation.
if (beanDescriptor.isBeanConstrained()) {
constraintViolations.addAll(validate(resource));
}
for (int i = 0; i < resourceMethod.getParameters().size(); i++) {
Parameter parameter = resourceMethod.getParameters().get(i);
for (Annotation annotation : parameter.getAnnotations()) {
if (Valid.class.isAssignableFrom(annotation.annotationType())) {
try {
if (args != null && args[i] != null) {
constraintViolations.addAll(validate(args[i]));
}
} catch (IndexOutOfBoundsException e){
// do nothing
}
break;
}
}
}
if (!constraintViolations.isEmpty()) {
throw new ConstraintViolationException(constraintViolations);
}
}
@Override
public void validateResult(Object resource, Invocable resourceMethod, Object result) throws ConstraintViolationException {
}
}
public static class ValidationExceptionMapper implements ExceptionMapper<ValidationException> {
@Override
public Response toResponse(ValidationException exception) {
if (exception instanceof ConstraintViolationException) {
ConstraintViolationException cve = (ConstraintViolationException)exception;
Response.ResponseBuilder response = Response.status(Response.Status.BAD_REQUEST);
response.type(MediaType.TEXT_PLAIN_TYPE);
StringBuilder builder = new StringBuilder();
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
builder.append(violation.getMessage());
builder.append(' ');
builder.append('(');
builder.append("path = " );
builder.append(violation.getPropertyPath());
builder.append(',');
builder.append(' ');
builder.append("invalidValue = ");
builder.append(violation.getInvalidValue());
builder.append(')');
builder.append('\n');
}
response.entity(builder.toString());
return response.build();
} else {
return Response.serverError().entity(exception.getMessage()).build();
}
}
}
} | 40.519802 | 146 | 0.604887 |
fbc693f0f2d8fbdefe0da40b9a23e7fce9d261ba | 267 | h | C | Source/NMundo.h | caiocampos/Descobrindo-Ogre | 28523e177af17cee0480df5fdecfbc8b23fdf6ac | [
"MIT"
] | 2 | 2019-10-30T12:21:28.000Z | 2019-10-30T12:27:54.000Z | Source/NMundo.h | cao-ancap/Descobrindo-Ogre | 28523e177af17cee0480df5fdecfbc8b23fdf6ac | [
"MIT"
] | null | null | null | Source/NMundo.h | cao-ancap/Descobrindo-Ogre | 28523e177af17cee0480df5fdecfbc8b23fdf6ac | [
"MIT"
] | null | null | null | #ifndef __NMundo_H__
# define __NMundo_H__
# include <Ogre.h>
namespace Mundo {
const String camera = "PlayerCam";
const String e_jogador = "PlayerEntity";
const String sn_jogador = "PlayerSuperNode";
const String n_jogador = "PlayerNode";
}
#endif
| 20.538462 | 46 | 0.715356 |
810b3b194b731e3da5727d4bbe8d15d7f95cf9d2 | 1,312 | go | Go | core/GetPointToPointDistance.go | bencalnan/geo-core | 86f97f4a3251a60d5d6e0397a5cdfe78142dd5f5 | [
"MIT"
] | 1 | 2019-09-06T13:38:27.000Z | 2019-09-06T13:38:27.000Z | core/GetPointToPointDistance.go | bencalnan/geo-fabric | 86f97f4a3251a60d5d6e0397a5cdfe78142dd5f5 | [
"MIT"
] | 10 | 2019-09-27T12:56:57.000Z | 2019-09-30T13:27:24.000Z | core/GetPointToPointDistance.go | bencalnan/geo-tools | 86f97f4a3251a60d5d6e0397a5cdfe78142dd5f5 | [
"MIT"
] | null | null | null | package core
import (
"math"
)
//PointToPointDistanceCosine Get distance (in meters) bewteen two Lat/Lons using cosine formula. Has some benefits over using Haversine formula.
//Input and Output in Radians
func PointToPointDistanceCosine(startPoint, endPoint Point) float64 {
var d = math.Acos(math.Sin(startPoint.Y)*math.Sin(endPoint.Y)+math.Cos(startPoint.Y)*math.Cos(endPoint.Y)*math.Cos(startPoint.X-endPoint.X)) * EarthRadius
return d
}
//PointToPointHaversine - Alternative method for getting distance (in meters) bewteen two Lat/Longs using cosine formula. Possibly slightly faster.
func PointToPointHaversine(start, end LatLng) float64 {
var startRadian = start.ConvertToRadian()
var endRadian = end.ConvertToRadian()
var difLat = endRadian.Lat - startRadian.Lat
var difLng = endRadian.Lng - startRadian.Lng
var a = math.Sin(difLat/2)*math.Sin(difLat/2) + math.Cos(startRadian.Lat)*math.Cos(endRadian.Lat)*math.Sin(difLng/2)*math.Sin(difLng/2)
var c = 2 * math.Atan2(math.Sqrt(a), math.Sqrt(1-a))
var d = EarthRadius * c
return d
}
//PointToPointCartesianDistance - Get distance betweeen two cartesian points
func PointToPointCartesianDistance(source, target Point) float64 {
distance := math.Sqrt(math.Pow((target.X-source.X), 2) + math.Pow((target.Y-source.Y), 2))
return distance
}
| 39.757576 | 155 | 0.765244 |
659b3a7d63f5d79ac6eb426e3b23cabae1493e0b | 1,566 | kt | Kotlin | githubuserfavoriteapps/src/main/java/com/ferdyhaspin/githubuserfavoriteapps/MainActivity.kt | ferdyhaspin/github-user | d129fbec737258e0582bb5abe01e54b54916fad0 | [
"Apache-2.0"
] | null | null | null | githubuserfavoriteapps/src/main/java/com/ferdyhaspin/githubuserfavoriteapps/MainActivity.kt | ferdyhaspin/github-user | d129fbec737258e0582bb5abe01e54b54916fad0 | [
"Apache-2.0"
] | null | null | null | githubuserfavoriteapps/src/main/java/com/ferdyhaspin/githubuserfavoriteapps/MainActivity.kt | ferdyhaspin/github-user | d129fbec737258e0582bb5abe01e54b54916fad0 | [
"Apache-2.0"
] | null | null | null | package com.ferdyhaspin.githubuserfavoriteapps
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
import com.google.android.material.snackbar.Snackbar
import com.xwray.groupie.GroupAdapter
import com.xwray.groupie.ViewHolder
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity() {
private lateinit var viewModel: MainViewModel
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
initViewModel()
observeViewModel()
}
override fun onResume() {
super.onResume()
viewModel.loadFavorite(this)
}
private fun initViewModel() {
viewModel = ViewModelProvider(this).get(MainViewModel::class.java)
}
private fun observeViewModel() {
viewModel.user.observe(this, Observer {
if (it.isEmpty())
Snackbar.make(rvUser, getString(R.string.empty_data), Snackbar.LENGTH_SHORT).show()
else
it.parseUser()
})
}
private fun List<User>.parseUser() {
val list = map {
UserItem(it)
}
val mAdapter = GroupAdapter<ViewHolder>().apply {
addAll(list)
}
rvUser.apply {
layoutManager = GridLayoutManager(this@MainActivity, 2)
adapter = mAdapter
}
}
}
| 28.472727 | 99 | 0.66986 |
e72e70f13bdfae2c111fd0ef184f95dd424498d0 | 104 | js | JavaScript | doc/html/search/pages_7.js | HITSZ-LeggedRobotics/rbdl | ac102e4b8eb44c62d0c122cf8835ea1c2c115fa0 | [
"Zlib"
] | 1 | 2019-12-23T02:34:50.000Z | 2019-12-23T02:34:50.000Z | doc/html/search/pages_7.js | HITSZ-LeggedRobotics/rbdl | ac102e4b8eb44c62d0c122cf8835ea1c2c115fa0 | [
"Zlib"
] | null | null | null | doc/html/search/pages_7.js | HITSZ-LeggedRobotics/rbdl | ac102e4b8eb44c62d0c122cf8835ea1c2c115fa0 | [
"Zlib"
] | 2 | 2019-10-14T02:09:51.000Z | 2022-02-22T03:53:06.000Z | var searchData=
[
['python_20api_20example',['Python API example',['../PythonExample.html',1,'']]]
];
| 20.8 | 82 | 0.663462 |
65411c7e37dbad40d3c7e12fad07bac5bfdb8e20 | 5,932 | kt | Kotlin | app/src/main/java/com/takusemba/cropme/internal/HorizontalAnimatorImpl.kt | EtsTest-AndroidApps/GameFace-Android | c4a80e6debca91ee73096783c264ce3ad78ee92a | [
"MIT"
] | 2 | 2021-09-06T22:30:45.000Z | 2021-10-02T01:35:26.000Z | app/src/main/java/com/takusemba/cropme/internal/HorizontalAnimatorImpl.kt | EtsTest-AndroidApps/GameFace-Android | c4a80e6debca91ee73096783c264ce3ad78ee92a | [
"MIT"
] | 7 | 2020-05-03T19:09:57.000Z | 2020-06-12T08:36:07.000Z | app/src/main/java/com/takusemba/cropme/internal/HorizontalAnimatorImpl.kt | EtsTest-AndroidApps/GameFace-Android | c4a80e6debca91ee73096783c264ce3ad78ee92a | [
"MIT"
] | 3 | 2020-11-28T22:32:51.000Z | 2022-02-11T01:15:09.000Z | /*
* Copyright (c) 2021 -Srihari Vishnu - All Rights Reserved
*
* 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.
*
*/
package com.takusemba.cropme.internal
import android.animation.ObjectAnimator
import android.graphics.Rect
import android.view.View
import android.view.View.TRANSLATION_X
import androidx.annotation.VisibleForTesting
import androidx.dynamicanimation.animation.DynamicAnimation
import androidx.dynamicanimation.animation.DynamicAnimation.OnAnimationUpdateListener
import androidx.dynamicanimation.animation.FlingAnimation
import androidx.dynamicanimation.animation.FloatPropertyCompat
import androidx.dynamicanimation.animation.SpringAnimation
import androidx.dynamicanimation.animation.SpringForce
import com.takusemba.cropme.internal.MoveAnimator.Companion.DAMPING_RATIO
import com.takusemba.cropme.internal.MoveAnimator.Companion.FRICTION
import com.takusemba.cropme.internal.MoveAnimator.Companion.STIFFNESS
/**
* HorizontalAnimatorImpl is responsible for animating [targetView] horizontally.
*/
internal class HorizontalAnimatorImpl @VisibleForTesting constructor(
private val targetView: View,
private val leftBound: Float,
private val rightBound: Float,
private val maxScale: Float,
private val spring: SpringAnimation,
private val fling: FlingAnimation,
private val animator: ObjectAnimator
) : MoveAnimator {
constructor(
targetView: View,
leftBound: Float,
rightBound: Float,
maxScale: Float
) : this(
targetView = targetView,
leftBound = leftBound,
rightBound = rightBound,
maxScale = maxScale,
spring = SpringAnimation(targetView, VERTICAL_PROPERTY).setSpring(SPRING_FORCE),
fling = FlingAnimation(targetView, DynamicAnimation.X).setFriction(FRICTION),
animator = ANIMATOR
)
private val updateListener = OnAnimationUpdateListener { _, _, velocity ->
val expectedRect = expectRect()
if (outOfBounds(expectedRect)) {
adjustToBounds(expectedRect, velocity)
}
}
init {
animator.target = targetView
}
override fun move(delta: Float) {
cancel()
animator.setFloatValues(targetView.translationX + delta)
animator.start()
}
override fun adjust() {
val expectedRect = expectRect()
if (outOfBounds(expectedRect)) {
adjustToBounds(expectedRect)
}
}
override fun fling(velocity: Float) {
cancel()
fling.addUpdateListener(updateListener)
fling.setStartVelocity(velocity).start()
}
private fun expectRect(): Rect {
val targetRect = Rect()
targetView.getHitRect(targetRect)
return when {
maxScale < targetView.scaleX -> {
val heightDiff = ((targetRect.height() - targetRect.height() * (maxScale / targetView.scaleY)) / 2).toInt()
val widthDiff = ((targetRect.width() - targetRect.width() * (maxScale / targetView.scaleY)) / 2).toInt()
Rect(
targetRect.left + widthDiff,
targetRect.top + heightDiff,
targetRect.right - widthDiff,
targetRect.bottom - heightDiff
)
}
targetView.scaleX < 1f -> {
val heightDiff = (targetView.height - targetRect.height()) / 2
val widthDiff = (targetView.width - targetRect.width()) / 2
Rect(
targetRect.left + widthDiff,
targetRect.top + heightDiff,
targetRect.right - widthDiff,
targetRect.bottom - heightDiff
)
}
else -> targetRect
}
}
private fun outOfBounds(rect: Rect): Boolean {
return leftBound < rect.left || rect.right < rightBound
}
private fun adjustToBounds(rect: Rect, velocity: Float = 0f) {
val scale = when {
maxScale < targetView.scaleX -> maxScale
targetView.scaleX < 1f -> 1f
else -> targetView.scaleX
}
val diff = (targetView.width * scale - targetView.width) / 2
if (leftBound < rect.left) {
cancel()
val finalPosition = leftBound + diff
spring.setStartVelocity(velocity).animateToFinalPosition(finalPosition)
} else if (rect.right < rightBound) {
cancel()
val finalPosition = rightBound - targetView.width.toFloat() - diff
spring.setStartVelocity(velocity).animateToFinalPosition(finalPosition)
}
}
private fun cancel() {
animator.cancel()
spring.cancel()
fling.cancel()
fling.removeUpdateListener(updateListener)
}
companion object {
private val ANIMATOR = ObjectAnimator().apply {
setProperty(TRANSLATION_X)
interpolator = null
duration = 0
}
private val VERTICAL_PROPERTY = object : FloatPropertyCompat<View>("X") {
override fun getValue(view: View): Float {
return view.x
}
override fun setValue(view: View, value: Float) {
view.x = value
}
}
private val SPRING_FORCE = SpringForce().setStiffness(STIFFNESS).setDampingRatio(DAMPING_RATIO)
}
}
| 34.091954 | 435 | 0.708361 |
1429ee00e16afb664585cd6565be534598b5f7b1 | 1,115 | css | CSS | assets/typography.css | caitwolf/interactive-md | c57ce59397c9f331795a42533637208e559bea40 | [
"MIT"
] | null | null | null | assets/typography.css | caitwolf/interactive-md | c57ce59397c9f331795a42533637208e559bea40 | [
"MIT"
] | 1 | 2021-08-23T20:44:22.000Z | 2021-08-23T20:44:22.000Z | assets/typography.css | caitwolf/interactive-md | c57ce59397c9f331795a42533637208e559bea40 | [
"MIT"
] | null | null | null | body {
font-family: sans-serif;
/* opacity: 0.87; */
/* background-color: #121212; */
background-color: #000000;
/* color: #F4F4F4; */
/* color: #dbdbdb; */
color: #c3c3c3;
font-weight: 100;
}
h1, h2 {
font-weight:500;
color: #B09ADB;
/* font-family: serif; */
}
h1 {
font-size:35px;
}
h2 {
font-size:25px;
}
h3 {
font-weight:500;
font-size:20px;
/* color: #D6AC11; */
color: #E2C458;
/* font-family: serif; */
}
h4, h5, h6 {
/* color: #D6AC11; */
color: #E2C458;
/* font-family: sans-serif; */
}
.float {
border-radius: 15px;
margin: 10px;
padding: 10px;
/* background-color: #1f1f1f; */
/* background-color: #2c2c2c; */
background-color: #121212;
vertical-align: 'center'
}
.eq {
font-family: serif;
}
.rc-slider-track {
background-color: #B09ADB;
}
.rc-slider-dot-active {
border-color: #B09ADB;
border: solid 2px #B09ADB;
}
.rc-slider-handle {
background-color: #B09ADB;
border-color: #B09ADB;
}
.rc.slider-handle:hover {
border-color: #B09ADB;
}
.rc.slider-handle-active:active {
border-color: #B09ADB;
}
| 15.067568 | 36 | 0.594619 |
a53af826ec40aea6265bdbadb4450615faeac0ae | 3,493 | asm | Assembly | lib/unpkb.asm | cppchriscpp/waddles-the-duck | 05127094ffea6dbb3bc822fb8c0be2a7800e5060 | [
"MIT"
] | null | null | null | lib/unpkb.asm | cppchriscpp/waddles-the-duck | 05127094ffea6dbb3bc822fb8c0be2a7800e5060 | [
"MIT"
] | null | null | null | lib/unpkb.asm | cppchriscpp/waddles-the-duck | 05127094ffea6dbb3bc822fb8c0be2a7800e5060 | [
"MIT"
] | null | null | null | ;
; unpkb.asm
; PackBits RLE unpacking
;
;
; Copyright 2000 Damian Yerrick
;
; 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.
;
;
; Set PKB_data to whatever data port you want PackBits to use.
; (Slightly more modification is necessary for memory-to-memory
; unpacking.)
;
PKB_data = $2007 ;NES PPU data register
;
; Set PKB_source to the address in direct page (i.e. zero page)
; where the pointer to packed data is stored.
;
PKB_source = tempAddr
PKB_len = tempa
;
; PKB_unpackblk
; Unpack PackBits() encoded data from memory at (PKB_source)
; to a character device such as the NES PPU data register.
;
; This entry point assumes a 16-bit length word in network
; byte order before the data.
PKB_unpackblk:
ldy #0
lda (PKB_source),y
inc PKB_source
bne @1
inc PKB_source+1
@1:
sta PKB_len+1
lda (PKB_source),y
inc PKB_source
bne @2
inc PKB_source+1
@2:
sta PKB_len
; This entry point assumes a 16-bit length word in host byte order
; at PKB_len.
PKB_unpack:
lda PKB_len
beq @3
inc PKB_len+1 ;trick to allow easier 16-bit decrement
@3:
ldy #0
PKB_loop:
lda (PKB_source),y
bmi PKB_run
;got a string
inc PKB_source
bne @4
inc PKB_source+1
@4:
tax
inx
txa
@5:
lda (PKB_source),y
inc PKB_source
bne @6
inc PKB_source+1
@6:
sta PKB_data
dec PKB_len
bne @7
dec PKB_len+1
beq PKB_rts
@7:
dex
bne @5
beq PKB_loop
PKB_run: ;got a run
inc PKB_source
bne @1
inc PKB_source+1
@1:
tax
dex
lda (PKB_source),y
inc PKB_source
bne @2
inc PKB_source+1
@2:
sta PKB_data
dec PKB_len
bne @3
dec PKB_len+1
beq PKB_rts
@3:
inx
bne @2
beq PKB_loop
PKB_rts:
rts
| 27.722222 | 71 | 0.554251 |
36c5f3e6617cb80418afb82da7b04878ac7ea719 | 58,053 | sql | SQL | SQL/Dump20171119.sql | jeansantos7/Proyecto_JLM | 61a3d480e330da0c009cc13a013ae40514373690 | [
"MIT"
] | null | null | null | SQL/Dump20171119.sql | jeansantos7/Proyecto_JLM | 61a3d480e330da0c009cc13a013ae40514373690 | [
"MIT"
] | null | null | null | SQL/Dump20171119.sql | jeansantos7/Proyecto_JLM | 61a3d480e330da0c009cc13a013ae40514373690 | [
"MIT"
] | null | null | null | CREATE DATABASE IF NOT EXISTS `bd_sae` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `bd_sae`;
-- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: bd_sae
-- ------------------------------------------------------
-- Server version 5.5.5-10.1.21-MariaDB
/*!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 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `asignacion`
--
DROP TABLE IF EXISTS `asignacion`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `asignacion` (
`id_Asignacion` int(11) NOT NULL AUTO_INCREMENT,
`id_docente_Asignacion` varchar(45) DEFAULT NULL,
`id_materias_Asignacion` varchar(45) DEFAULT NULL,
`id_curso_Asignacion` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id_Asignacion`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `asignacion`
--
LOCK TABLES `asignacion` WRITE;
/*!40000 ALTER TABLE `asignacion` DISABLE KEYS */;
/*!40000 ALTER TABLE `asignacion` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `clone_docente`
--
DROP TABLE IF EXISTS `clone_docente`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `clone_docente` (
`id_Docente` int(11) NOT NULL DEFAULT '0',
`cedula_Docente` int(10) DEFAULT NULL,
`ape_Docente` varchar(45) DEFAULT NULL,
`nom_Docente` varchar(45) DEFAULT NULL,
`telf_Docente` varchar(45) DEFAULT NULL,
`correo_Docente` varchar(45) DEFAULT NULL,
`direc_Docente` varchar(45) DEFAULT NULL,
`fech_nac_Docente` date DEFAULT NULL,
`user_Docente` varchar(45) DEFAULT NULL,
`pass_Docente` varchar(45) DEFAULT NULL,
`id_Asignacion` int(11) NOT NULL DEFAULT '0',
`id_docente_Asignacion` varchar(45) DEFAULT NULL,
`id_materias_Asignacion` varchar(45) DEFAULT NULL,
`id_curso_Asignacion` varchar(45) DEFAULT NULL,
`id_Materias` int(11) NOT NULL DEFAULT '0',
`nom_Materias` varchar(45) DEFAULT NULL,
`nom_corto_Materias` varchar(45) DEFAULT NULL,
`id_Cursos` int(11) NOT NULL DEFAULT '0',
`nom_Cursos` varchar(45) DEFAULT NULL,
`nivel_Cursos` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `clone_docente`
--
LOCK TABLES `clone_docente` WRITE;
/*!40000 ALTER TABLE `clone_docente` DISABLE KEYS */;
INSERT INTO `clone_docente` VALUES (1,1234,'Paz','Luis','09','legend@leg.com','av1','0000-00-00','ass','ass',1,'1234','1','1',1,'Historia','Historia',1,'Primero A','');
/*!40000 ALTER TABLE `clone_docente` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `clone_estudiantes`
--
DROP TABLE IF EXISTS `clone_estudiantes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `clone_estudiantes` (
`id_Estudiante` int(11) NOT NULL DEFAULT '0',
`matricula_Estudiante` varchar(45) DEFAULT NULL,
`fech_matricula_Estudiante` datetime DEFAULT NULL,
`cedula_Estudiante` int(10) DEFAULT NULL,
`ape_Estudiante` varchar(45) DEFAULT NULL,
`nom_Estudiante` varchar(45) DEFAULT NULL,
`fech_nac_Estudiante` varchar(45) DEFAULT NULL,
`dir_Estudiante` varchar(45) DEFAULT NULL,
`carnet_Estudiante` int(20) DEFAULT NULL,
`parentesco_Estudiante` varchar(45) DEFAULT NULL,
`pension_Estudiante` int(11) NOT NULL,
`user_Estudiante` varchar(45) DEFAULT NULL,
`pass_Estudiante` varchar(45) DEFAULT NULL,
`Representante_id_Representante` int(11) NOT NULL,
`Estado` varchar(45) DEFAULT '0',
`Estadonotas` varchar(45) DEFAULT '0',
`idMatricula` int(11) NOT NULL DEFAULT '0',
`cedula_estudiante_matricula` varchar(45) DEFAULT NULL,
`lectivo` varchar(45) DEFAULT NULL,
`id_curso` varchar(45) DEFAULT NULL,
`id_Cursos` int(11) NOT NULL DEFAULT '0',
`nom_Cursos` varchar(45) DEFAULT NULL,
`nivel_Cursos` varchar(30) NOT NULL,
`id_Materias` int(11) NOT NULL DEFAULT '0',
`nom_Materias` varchar(45) DEFAULT NULL,
`nom_corto_Materias` varchar(45) DEFAULT NULL,
`id_Docente` int(11) NOT NULL DEFAULT '0',
`cedula_Docente` int(10) DEFAULT NULL,
`ape_Docente` varchar(45) DEFAULT NULL,
`nom_Docente` varchar(45) DEFAULT NULL,
`telf_Docente` varchar(45) DEFAULT NULL,
`correo_Docente` varchar(45) DEFAULT NULL,
`direc_Docente` varchar(45) DEFAULT NULL,
`fech_nac_Docente` date DEFAULT NULL,
`user_Docente` varchar(45) DEFAULT NULL,
`pass_Docente` varchar(45) DEFAULT NULL,
`id` int(11) NOT NULL DEFAULT '0',
`quimestre_MateriasNotas` varchar(45) DEFAULT NULL,
`id_materia_MateriasNotas` varchar(45) DEFAULT NULL,
`id_curso_MateriasNotas` varchar(45) DEFAULT NULL,
`id_profesor_MateriasNotas` varchar(45) DEFAULT NULL,
`cedula_estudiantes_MateriasNotas` varchar(45) DEFAULT NULL,
`notaparcial1q1_MateriasNotas` varchar(45) DEFAULT NULL,
`notaparcial2q1_MateriasNotas` varchar(45) DEFAULT NULL,
`notaparcial3q1_MateriasNotas` varchar(45) DEFAULT NULL,
`porcentajeq1_MateriasNotas` varchar(45) DEFAULT NULL,
`nota_examenq1_MateriasNotas` varchar(45) DEFAULT NULL,
`nota_examen_porcentajeq1_MateriasNotas` varchar(45) DEFAULT NULL,
`promedioq1_MateriasNotas` varchar(45) DEFAULT NULL,
`notaparcial1q2_MateriasNotas` varchar(45) DEFAULT NULL,
`notaparcial2q2_MateriasNotas` varchar(45) DEFAULT NULL,
`notaparcial3q2_MateriasNotas` varchar(45) DEFAULT NULL,
`porcentajeq2_MateriasNotas` varchar(45) DEFAULT NULL,
`nota_examenq2_MateriasNotas` varchar(45) DEFAULT NULL,
`nota_examen_porcentajeq2_MateriasNotas` varchar(45) DEFAULT NULL,
`promedioq2_MateriasNotas` varchar(45) DEFAULT NULL,
`notarec_MateriasNotas` varchar(45) DEFAULT NULL,
`notareme_MateriasNotas` varchar(45) DEFAULT NULL,
`notaexa_MateriasNotas` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `clone_estudiantes`
--
LOCK TABLES `clone_estudiantes` WRITE;
/*!40000 ALTER TABLE `clone_estudiantes` DISABLE KEYS */;
INSERT INTO `clone_estudiantes` VALUES (5,'F3X8M6','2017-11-15 09:47:09',19172997,'Charde','Riley','2002-05-31 05:59:53','Apartado núm.: 332, 7778 Ornare ',NULL,'Sr.',100,'vestibulum.lorem@ridiculusmusDonec.com','BIO90TDA8AP',0,'1','0',1,'19172997','1','1',1,'Primero A','',1,'Historia','Historia',1,1234,'Paz','Luis','09','legend@leg.com','av1','0000-00-00','ass','ass',1,'1','1','1','1234','19172997','10','9','9','7.466666666666668','9','1.8','9.266666666666667','9','9','9','7.2','9','9','9',NULL,NULL,NULL);
/*!40000 ALTER TABLE `clone_estudiantes` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `clone_pensiones`
--
DROP TABLE IF EXISTS `clone_pensiones`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `clone_pensiones` (
`id_Estudiante` int(11) NOT NULL DEFAULT '0',
`matricula_Estudiante` varchar(45) DEFAULT NULL,
`fech_matricula_Estudiante` datetime DEFAULT NULL,
`cedula_Estudiante` int(10) DEFAULT NULL,
`ape_Estudiante` varchar(45) DEFAULT NULL,
`nom_Estudiante` varchar(45) DEFAULT NULL,
`fech_nac_Estudiante` varchar(45) DEFAULT NULL,
`dir_Estudiante` varchar(45) DEFAULT NULL,
`carnet_Estudiante` int(20) DEFAULT NULL,
`parentesco_Estudiante` varchar(45) DEFAULT NULL,
`pension_Estudiante` int(11) NOT NULL,
`user_Estudiante` varchar(45) DEFAULT NULL,
`pass_Estudiante` varchar(45) DEFAULT NULL,
`Representante_id_Representante` int(11) NOT NULL,
`Estado` varchar(45) DEFAULT '0',
`Estadonotas` varchar(45) DEFAULT '0',
`idPenciones` int(11) NOT NULL DEFAULT '0',
`id_estudiantes` varchar(45) DEFAULT NULL,
`valor_matricula` varchar(45) DEFAULT NULL,
`valor_pagado` varchar(45) DEFAULT NULL,
`mes_pagado` varchar(45) DEFAULT NULL,
`fecha` varchar(45) DEFAULT NULL,
`estado1` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `clone_pensiones`
--
LOCK TABLES `clone_pensiones` WRITE;
/*!40000 ALTER TABLE `clone_pensiones` DISABLE KEYS */;
INSERT INTO `clone_pensiones` VALUES (5,'F3X8M6','2017-11-15 09:47:09',19172997,'Charde','Riley','2002-05-31 05:59:53','Apartado núm.: 332, 7778 Ornare ',NULL,'Sr.',100,'vestibulum.lorem@ridiculusmusDonec.com','BIO90TDA8AP',0,'0','0',1,'19172997','100','100','0',NULL,NULL),(5,'F3X8M6','2017-11-15 09:47:09',19172997,'Charde','Riley','2002-05-31 05:59:53','Apartado núm.: 332, 7778 Ornare ',NULL,'Sr.',100,'vestibulum.lorem@ridiculusmusDonec.com','BIO90TDA8AP',0,'0','0',2,'19172997','100','100','1',NULL,NULL);
/*!40000 ALTER TABLE `clone_pensiones` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `clone_tutoria`
--
DROP TABLE IF EXISTS `clone_tutoria`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `clone_tutoria` (
`id_Docente` int(11) NOT NULL DEFAULT '0',
`cedula_Docente` int(10) DEFAULT NULL,
`ape_Docente` varchar(45) DEFAULT NULL,
`nom_Docente` varchar(45) DEFAULT NULL,
`telf_Docente` varchar(45) DEFAULT NULL,
`correo_Docente` varchar(45) DEFAULT NULL,
`direc_Docente` varchar(45) DEFAULT NULL,
`fech_nac_Docente` date DEFAULT NULL,
`user_Docente` varchar(45) DEFAULT NULL,
`pass_Docente` varchar(45) DEFAULT NULL,
`id_Cursos` int(11) NOT NULL DEFAULT '0',
`nom_Cursos` varchar(45) DEFAULT NULL,
`nivel_Cursos` varchar(30) NOT NULL,
`id` int(11) NOT NULL DEFAULT '0',
`id_curso_observacioncurso` varchar(45) DEFAULT NULL,
`cedula_profesor_observacioncurso` varchar(45) DEFAULT NULL,
`incidencia_observacioncurso` varchar(45) DEFAULT NULL,
`observ_observacioncurso` longtext,
`fecha_observacioncurso` datetime DEFAULT CURRENT_TIMESTAMP,
`id_curso_tutor` int(11) NOT NULL DEFAULT '0',
`cedula_Curso_Tutor` varchar(45) DEFAULT NULL,
`curso_Curso_Tutor` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `clone_tutoria`
--
LOCK TABLES `clone_tutoria` WRITE;
/*!40000 ALTER TABLE `clone_tutoria` DISABLE KEYS */;
INSERT INTO `clone_tutoria` VALUES (1,1234,'Paz','Luis','09','legend@leg.com','av1','0000-00-00','ass','ass',1,'Primero A','',1,'1','1234','FaltaInjustificada','ASASA NO VINOOOO','2017-11-19 11:10:45',1,'1234','1');
/*!40000 ALTER TABLE `clone_tutoria` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `curso_tutor`
--
DROP TABLE IF EXISTS `curso_tutor`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `curso_tutor` (
`id_curso_tutor` int(11) NOT NULL AUTO_INCREMENT,
`cedula_Curso_Tutor` varchar(45) DEFAULT NULL,
`curso_Curso_Tutor` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id_curso_tutor`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `curso_tutor`
--
LOCK TABLES `curso_tutor` WRITE;
/*!40000 ALTER TABLE `curso_tutor` DISABLE KEYS */;
/*!40000 ALTER TABLE `curso_tutor` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `cursos`
--
DROP TABLE IF EXISTS `cursos`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cursos` (
`id_Cursos` int(11) NOT NULL AUTO_INCREMENT,
`nom_Cursos` varchar(45) DEFAULT NULL,
`nivel_Cursos` varchar(30) NOT NULL,
PRIMARY KEY (`id_Cursos`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `cursos`
--
LOCK TABLES `cursos` WRITE;
/*!40000 ALTER TABLE `cursos` DISABLE KEYS */;
INSERT INTO `cursos` VALUES (1,'Primero A',''),(2,'Primero B',''),(3,'Primero C',''),(4,'Primero D',''),(5,'Segundo A',''),(6,'Segundo B',''),(7,'Segundo C',''),(8,'Segundo D',''),(9,'1ero',''),(10,'2do','B.G.U Ciencias');
/*!40000 ALTER TABLE `cursos` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `directivo`
--
DROP TABLE IF EXISTS `directivo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `directivo` (
`id_Directivo` int(11) NOT NULL AUTO_INCREMENT,
`cedula_Directivo` varchar(45) DEFAULT NULL,
`ape_Directivo` varchar(45) DEFAULT NULL,
`nom_Directivo` varchar(45) DEFAULT NULL,
`telf_Directivo` varchar(45) DEFAULT NULL,
`correo_Directivo` varchar(45) DEFAULT NULL,
`direc_Directivo` varchar(45) DEFAULT NULL,
`fech_nac_Directivo` varchar(45) DEFAULT NULL,
`user_Directivo` varchar(45) DEFAULT NULL,
`pass_Directivo` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id_Directivo`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `directivo`
--
LOCK TABLES `directivo` WRITE;
/*!40000 ALTER TABLE `directivo` DISABLE KEYS */;
INSERT INTO `directivo` VALUES (2,'0987654321673','sssssssssss','ssssssssssss','0999','sd@s.com','dddddd','2017-10-05','as','as'),(3,'123456765432','ASASASASAS','ASASASAS','ASASAS','ASASAS@c.c','ASASASAS','','SASASssss','ASASASAS');
/*!40000 ALTER TABLE `directivo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `docente`
--
DROP TABLE IF EXISTS `docente`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `docente` (
`id_Docente` int(11) NOT NULL AUTO_INCREMENT,
`cedula_Docente` int(10) DEFAULT NULL,
`ape_Docente` varchar(45) DEFAULT NULL,
`nom_Docente` varchar(45) DEFAULT NULL,
`telf_Docente` varchar(45) DEFAULT NULL,
`correo_Docente` varchar(45) DEFAULT NULL,
`direc_Docente` varchar(45) DEFAULT NULL,
`fech_nac_Docente` date DEFAULT NULL,
`user_Docente` varchar(45) DEFAULT NULL,
`pass_Docente` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id_Docente`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `docente`
--
LOCK TABLES `docente` WRITE;
/*!40000 ALTER TABLE `docente` DISABLE KEYS */;
INSERT INTO `docente` VALUES (1,1234,'Paz','Luis','09','legend@leg.com','av1','0000-00-00','ass','ass'),(2,21733479,'Reynolds, Keiko M.','Armand','076-940-1313','ligula.Aenean@vehicula.org','Apdo.:534-3421 Nec Avda.','1993-12-12','274915198','381506500'),(3,50177821,'Mcclure, Naida M.','Celeste','080-898-0913','erat.nonummy@nislelementum.co.uk','377-604 Tincidunt, Av.','1991-10-02','470194861','151420718'),(4,17460730,'Rollins, Nasim J.','Odysseus','028-180-2314','lobortis.risus.In@loremsit.org','433-5027 Turpis. Calle','1991-05-10','504610122','388869760'),(5,21004510,'Gillespie, Shellie U.','Ivana','098-276-0902','consequat.purus.Maecenas@nonleo.ca','301-6805 Dapibus Calle','1993-08-14','364063602','002301190'),(6,35445327,'Morin, Aladdin T.','Tana','063-444-1358','Quisque.ornare.tortor@elitpellentesque.org','Apdo.:685-6189 Magnis C/','1990-03-20','610000374','372205831'),(7,35778074,'Blackburn, Mary I.','Nero','067-204-8194','cursus@euelitNulla.org','Apdo.:997-2523 Etiam Avda.','1991-10-22','255827511','009957614'),(8,20149423,'Key, Yvonne I.','Regina','063-171-6894','Duis@dui.co.uk','Apartado núm.: 139, 3085 Orci Avenida','1994-04-24','360806319','338729965'),(9,16466071,'Ortiz, Mara B.','Brynne','011-644-9097','tristique@velit.co.uk','Apartado núm.: 787, 6956 Et, ','1990-11-14','549194249','852177963'),(10,32838665,'Chase, Palmer B.','Tad','071-081-2227','vel.turpis@etultrices.net','9133 Arcu ','1990-07-29','075432708','635346364'),(11,38904557,'Frye, Georgia T.','Murphy','059-450-6396','nulla.ante@ornare.com','Apartado núm.: 625, 8797 Lacus. Avda.','1994-04-12','244057691','494683691'),(12,43887296,'Irwin, Britanney N.','Christian','089-808-0373','in@cubiliaCurae.ca','7238 Semper Carretera','1991-03-02','449356112','738688787'),(13,14197764,'Bryant, Phoebe T.','Sage','010-336-0427','mi.felis.adipiscing@lectusasollicitudin.edu','Apdo.:107-2337 Neque C/','1993-12-12','752598904','693771677'),(14,46986424,'Francis, Ila N.','Patrick','083-946-8114','amet@at.org','104-8008 Eros Ctra.','1990-12-08','034490284','378958912'),(15,12314380,'Sharp, Wesley R.','Jared','028-544-9058','Donec@Aliquamnisl.ca','Apartado núm.: 935, 6293 Velit Avenida','1991-03-25','419192158','539023705'),(16,29016345,'Sosa, Astra N.','Warren','081-606-5309','euismod.mauris.eu@vulputatelacus.net','754-2675 Non, Carretera','1990-08-11','235941531','689065878'),(17,43815371,'Ramos, Harriet X.','Oren','062-569-9981','vitae.risus.Duis@enimEtiamgravida.net','4153 Augue C/','1992-08-09','328900576','606101392'),(18,19641384,'Savage, Rae U.','Miriam','050-214-7911','turpis@Fuscealiquam.org','8559 Orci C.','1993-11-27','064408883','431982602'),(19,48360294,'Savage, Ava Y.','Adena','090-317-5810','tellus.Nunc.lectus@felis.net','322-295 Vulputate Av.','1990-11-12','721996106','422770313'),(20,21116280,'Sharp, Tyrone D.','Hyatt','016-942-0742','diam@elitsedconsequat.ca','293-3845 Nec C.','1993-02-28','134873686','780212650'),(21,41194345,'Shelton, Melinda A.','Omar','078-930-0315','Nam@magnaPhasellus.org','3536 Nullam C.','1991-08-13','570729822','321298051');
/*!40000 ALTER TABLE `docente` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `estudiante`
--
DROP TABLE IF EXISTS `estudiante`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `estudiante` (
`id_Estudiante` int(11) NOT NULL AUTO_INCREMENT,
`matricula_Estudiante` varchar(45) DEFAULT NULL,
`fech_matricula_Estudiante` datetime DEFAULT NULL,
`cedula_Estudiante` int(10) DEFAULT NULL,
`ape_Estudiante` varchar(45) DEFAULT NULL,
`nom_Estudiante` varchar(45) DEFAULT NULL,
`fech_nac_Estudiante` varchar(45) DEFAULT NULL,
`dir_Estudiante` varchar(45) DEFAULT NULL,
`carnet_Estudiante` int(20) DEFAULT NULL,
`parentesco_Estudiante` varchar(45) DEFAULT NULL,
`pension_Estudiante` int(11) NOT NULL,
`user_Estudiante` varchar(45) DEFAULT NULL,
`pass_Estudiante` varchar(45) DEFAULT NULL,
`Representante_id_Representante` int(11) NOT NULL,
`Estado` varchar(45) DEFAULT '0',
`Estadonotas` varchar(45) DEFAULT '0',
PRIMARY KEY (`id_Estudiante`),
KEY `fk_Estudiante_Representante_idx` (`Representante_id_Representante`)
) ENGINE=InnoDB AUTO_INCREMENT=105 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `estudiante`
--
LOCK TABLES `estudiante` WRITE;
/*!40000 ALTER TABLE `estudiante` DISABLE KEYS */;
INSERT INTO `estudiante` VALUES (5,'F3X8M6','2017-11-15 09:47:09',19172997,'Charde','Riley','2002-05-31 05:59:53','Apartado núm.: 332, 7778 Ornare ',NULL,'Sr.',100,'vestibulum.lorem@ridiculusmusDonec.com','BIO90TDA8AP',0,'0','0'),(6,'W8X7F2','2017-10-03 08:04:52',40770483,'Yetta','Benton','2002-11-17 22:21:31','568-8740 Eu Carretera',NULL,'Dr.',100,'fermentum.vel.mauris@interdum.net','WAU74VEW4TF',0,'0','0'),(7,'L5I4D0','2016-12-07 12:06:27',24457663,'Ingrid','Jones','2004-06-04 10:42:04','447-9500 Eu Calle',NULL,'Sra.',100,'magna.et@nonummy.net','QIC45YWD3HE',0,'0','0'),(8,'M4Q6T9','2017-10-31 07:46:34',27800214,'Haviva','Welch','2004-09-15 15:50:26','Apdo.:834-8474 Elit Calle',NULL,'Srta.',100,'tellus.eu.augue@augueut.edu','MJV31STR6XY',0,'0','0'),(9,'Q3V4O3','2017-01-04 01:33:52',38978564,'Walker','Leon','2004-01-09 15:43:37','4701 Suspendisse C/',NULL,'',100,'natoque@consectetueradipiscing.ca','XAQ54IQH9QR',0,'0','0'),(10,'K5G9B1','2017-08-19 02:43:55',48430187,'Veda','Lowe','2001-09-11 10:10:23','1333 Id Carretera',NULL,'Sra.',100,'vitae@in.co.uk','NEO17CXY0YR',0,'0','0'),(11,'C6H4T5','2017-03-19 09:54:19',25829789,'Regina','Mccullough','2004-03-08 02:34:27','411-6101 Lacus. C/',NULL,'Sr.',100,'Sed.congue.elit@acorci.ca','AIY12QSF1HO',0,'0','0'),(12,'M7B7R1','2017-08-23 00:38:32',15742561,'Angelica','York','2002-05-16 12:49:20','918-5574 Malesuada Av.',NULL,'Sr.',100,'hendrerit.id.ante@acnullaIn.ca','QJX65BCJ5TS',0,'0','0'),(13,'W8V2A5','2017-05-16 15:37:40',41486812,'Karina','Johns','2000-05-07 21:04:53','Apdo.:375-1673 Elit, Avenida',NULL,'',100,'a.enim@molestie.co.uk','GZA39EVK6AY',0,'0','0'),(14,'G7E8K7','2017-07-01 08:39:18',21442768,'Garrett','Greer','2004-03-23 04:27:31','Apartado núm.: 666, 8644 Sit Avda.',NULL,'Sra.',100,'pellentesque@Curabiturvellectus.com','FUG73RZH2NJ',0,'0','0'),(15,'J7P7H5','2017-01-03 13:49:38',30379226,'Lael','Black','2003-06-22 02:56:48','5747 Suspendisse ',NULL,'Dr.',100,'imperdiet.nec@Donec.net','FDO93WYY7WC',0,'0','0'),(16,'U1Q6S5','2017-01-31 05:57:38',11282247,'Martin','Castro','2003-10-20 07:18:32','Apdo.:865-4257 Vulputate C.',NULL,'Srta.',100,'Quisque.ac.libero@Etiam.net','SYQ26RQF2KH',0,'0','0'),(17,'U9U7E0','2017-11-16 20:25:58',8229687,'Aquila','Drake','2000-11-04 22:35:50','8865 Et Ctra.',NULL,'',100,'ac.facilisis@Curabiturut.net','RUV73IOI4AR',0,'0','0'),(18,'I4V3A6','2017-09-23 15:52:16',5783821,'Ginger','Wolfe','2001-11-22 01:33:37','744-6131 Elit. C.',NULL,'Dr.',100,'Lorem.ipsum@Crasdictum.com','OKP00XOW3KY',0,'0','0'),(19,'T3Q2V6','2017-07-09 03:37:52',7596802,'William','Aguirre','2002-04-30 12:05:20','Apartado núm.: 123, 5877 In C/',NULL,'Dr.',100,'tellus@bibendumDonecfelis.edu','LBQ89LPV4FN',0,'0','0'),(20,'N6E1N4','2017-07-20 06:06:57',37287378,'Jasmine','Randolph','2003-06-07 08:16:36','6830 Luctus. ',NULL,'Sr.',100,'luctus.aliquet@faucibuslectusa.ca','VGX99WVT1QM',0,'0','0'),(21,'U9Y6P1','2017-04-17 16:47:40',39781466,'Moses','Pollard','2004-08-19 13:45:32','Apdo.:543-9876 Egestas. Avda.',NULL,'Sra.',100,'lorem.luctus@sociisnatoquepenatibus.net','LKA78RKD7HS',0,'0','0'),(22,'U9U5E6','2017-03-19 23:23:37',29740835,'Luke','Odonnell','2003-05-10 09:14:59','757-3379 Vitae, Ctra.',NULL,'',100,'facilisis.lorem@Proinegetodio.com','NHS83WHA1HA',0,'0','0'),(23,'V1H5Y2','2017-05-02 05:48:20',7917102,'Ivan','Hunt','2003-05-08 15:21:50','Apdo.:378-6219 Eu Ctra.',NULL,'Sr.',100,'id@sodalesnisi.edu','BMT52BXO8JW',0,'0','0'),(24,'U8K1Z0','2017-10-08 13:50:17',47111202,'Carly','Oconnor','2002-12-22 05:38:14','7810 Mattis Carretera',NULL,'Dr.',100,'elit.Curabitur@diam.org','EBN82TEH2OQ',0,'0','0'),(25,'B4R7V7','2017-06-24 00:30:28',19695162,'Deirdre','Nixon','2001-11-21 21:18:02','Apdo.:211-7325 Enim. Ctra.',NULL,'Sra.',100,'bibendum.fermentum.metus@Morbiquis.co.uk','AYJ72FRP5UB',0,'0','0'),(26,'E9L9D4','2017-05-18 04:31:51',27766414,'Sylvester','Collier','2002-07-30 04:19:48','4822 Turpis C.',NULL,'Srta.',100,'Integer@rutrum.org','TWM28BIB2WS',0,'0','0'),(27,'J5F4C1','2017-04-16 09:07:39',48985977,'Ria','Duke','2003-05-04 01:38:44','Apartado núm.: 967, 7741 Vulputate, C.',NULL,'Sra.',100,'eget@maurisrhoncusid.ca','RVH78GPQ6CU',0,'0','0'),(28,'A2K4P3','2017-01-04 12:54:57',47875959,'Judith','Finley','2004-07-23 10:17:59','Apdo.:930-7240 Dictum ',NULL,'Sr.',100,'ipsum@inhendreritconsectetuer.org','BTC21GWC6KO',0,'0','0'),(29,'P3S7R8','2017-07-31 11:00:51',13860412,'Ali','Farmer','2001-01-29 06:18:09','Apartado núm.: 711, 8847 Et, Avda.',NULL,'',100,'convallis@pede.com','TDS15PUS9MW',0,'0','0'),(30,'J1C2Y5','2017-09-14 00:38:44',46249006,'Paloma','Duffy','2003-10-19 05:34:04','6501 Ut, Avenida',NULL,'Sr.',100,'diam@nequeSedeget.co.uk','ZPP77AXD1VK',0,'0','0'),(31,'Z8Y5L4','2016-12-17 11:47:29',48967767,'Elliott','Bond','2003-10-19 06:59:12','488-5540 Placerat Avda.',NULL,'',100,'et@ultricesaauctor.ca','MHL65ZZA9WC',0,'0','0'),(32,'I2T5H5','2016-12-06 16:36:19',30474384,'Chaney','Sims','2004-03-08 10:08:09','Apartado núm.: 343, 7597 Morbi Carretera',NULL,'',100,'ut.sem@nequesed.ca','UIR47AIW4RK',0,'0','0'),(33,'U0L4H7','2017-09-13 17:43:46',42120388,'Linda','Silva','2003-03-26 02:10:37','Apartado núm.: 360, 7442 Pede, C.',NULL,'Dr.',100,'eget@Donectempor.edu','LYC45SZL7IC',0,'0','0'),(34,'U8K4L6','2017-08-15 10:13:44',18771049,'Hector','Moon','2001-11-10 20:52:44','4031 Suspendisse Ctra.',NULL,'Sr.',100,'cursus@auctorquistristique.co.uk','UWA12FHI2HQ',0,'0','0'),(35,'F5J2B9','2017-04-18 13:02:50',14124832,'Nehru','Shields','2003-09-10 21:10:34','563-8466 In Avenida',NULL,'',100,'parturient@egestas.org','WJA44EJF7QJ',0,'0','0'),(36,'H9W3Q2','2017-04-19 23:27:23',21725684,'Nehru','Silva','2002-09-29 09:58:43','624-9624 Semper Av.',NULL,'',100,'non.feugiat@Phasellusfermentum.org','PXB18GSE7GU',0,'0','0'),(37,'I6H7F2','2017-01-12 12:18:15',16697886,'Hamilton','Merrill','2002-05-01 12:57:16','703-1550 Pretium Calle',NULL,'Dr.',100,'tincidunt.pede@Suspendisse.com','IKP65NFC5RH',0,'0','0'),(38,'R2A9K1','2017-08-09 01:01:08',27945865,'Joel','Burris','2002-02-07 21:31:27','Apdo.:858-3608 Nibh. C.',NULL,'',100,'vulputate@laciniaatiaculis.ca','MGY69OGH7ZD',0,'0','0'),(39,'B0S7M9','2017-10-20 08:44:14',32861817,'Addison','Patrick','2003-09-21 03:35:05','6280 Leo ',NULL,'',100,'lobortis@rutrumFusce.edu','XMU59CTA9IP',0,'0','0'),(40,'N1H2U1','2017-04-24 18:41:11',33379449,'Hadley','Matthews','2005-01-28 23:45:19','985-3485 Amet Ctra.',NULL,'Sr.',100,'sit.amet@vestibulumloremsit.ca','YXO49KJP1NR',0,'0','0'),(41,'Z7L1U7','2017-09-25 10:06:41',33408764,'Liberty','Black','2003-02-04 11:15:41','3707 Nulla. Ctra.',NULL,'Dr.',100,'eget.varius@uterat.edu','ZRO39MBZ3RR',0,'0','0'),(42,'F2W2C5','2017-03-25 18:59:05',44952859,'Xander','Nieves','2002-09-14 17:08:54','Apdo.:678-212 Nunc C.',NULL,'',100,'Donec.consectetuer@mi.net','NUC20NJF0VU',0,'0','0'),(43,'V0K7V6','2017-05-10 11:29:25',26985730,'Camden','Rowe','2000-04-29 07:30:14','6700 Molestie Av.',NULL,'Sr.',100,'sapien@augueeu.com','SMN87YOX7ET',0,'0','0'),(44,'U6F4H4','2017-09-08 23:08:10',39560598,'Yoshi','Grimes','2004-12-01 11:06:06','Apdo.:197-2177 Natoque Carretera',NULL,'Sra.',100,'consectetuer.mauris@eliteratvitae.com','QLF89FKU0WI',0,'0','0'),(45,'K1L4J0','2017-01-09 12:21:36',32656243,'Harper','Greene','2000-01-10 02:33:14','423-4460 Mauris Carretera',NULL,'Dr.',100,'Nullam.suscipit.est@utipsumac.edu','BBB74FLH6UK',0,'0','0'),(46,'M6W6M6','2016-12-19 17:06:27',6047331,'Rafael','Fields','2001-04-01 23:13:51','Apartado núm.: 780, 5865 Tristique Av.',NULL,'Srta.',100,'Integer@penatibusetmagnis.org','MBD83EFX4CK',0,'0','0'),(47,'R5V8J2','2017-01-07 15:24:47',36032694,'Adrian','Perry','2002-10-01 01:09:01','4141 Magna C.',NULL,'Sra.',100,'velit.Cras@adlitora.com','AJX97QNE6EH',0,'0','0'),(48,'E9F9X2','2017-07-02 07:19:07',44802425,'Sybill','Newton','2001-06-26 22:57:49','4361 Libero. Carretera',NULL,'Sr.',100,'Nullam.vitae.diam@auctorullamcorpernisl.org','DMX84CAE3WG',0,'0','0'),(49,'H9A0L8','2017-03-26 21:20:41',15629327,'Keely','Ramos','2002-11-11 17:19:51','180-8312 Nisl. Ctra.',NULL,'Sra.',100,'aliquet@sagittisaugue.org','PKF03IUU5OZ',0,'0','0'),(50,'R7R8P2','2017-11-19 20:13:44',14897763,'Dalton','Mcfadden','2000-08-24 08:46:48','Apartado núm.: 138, 8465 Vitae Carretera',NULL,'Dr.',100,'ipsum.Donec.sollicitudin@vulputate.co.uk','WCK40CLT7NN',0,'0','0'),(51,'E9D5D4','2017-02-24 23:53:46',16026405,'Damian','Nixon','2004-06-28 03:54:11','Apdo.:539-5084 Lorem Avenida',NULL,'',100,'elementum.dui@vitaesodalesnisi.net','DMF27XDA9UF',0,'0','0'),(52,'N0D6Y7','2017-02-22 21:54:19',34323072,'Jared','Stuart','2002-11-30 00:36:21','876-2252 Felis. Avda.',NULL,'Srta.',96,'dapibus.id@semPellentesque.co.uk','ZZR32DXR0OL',0,'0','0'),(53,'I8K1P1','2017-10-09 06:17:13',7418427,'Owen','Colon','2003-06-30 01:15:20','759-8361 Eu ',NULL,'Srta.',91,'In@leoVivamus.ca','CVD93DIG9JT',0,'0','0'),(54,'N1K0K9','2017-06-28 13:52:48',26574602,'Baker','Nunez','2003-07-11 21:31:55','Apdo.:291-629 Nec ',NULL,'Srta.',94,'egestas@Fuscefeugiat.co.uk','GSU75AZO6VL',0,'0','0'),(55,'R0L9H2','2017-07-13 20:48:48',15749558,'Lawrence','Donovan','2002-12-31 16:22:56','388-5094 Dictum Calle',NULL,'Srta.',93,'sit@eutellus.ca','TTO86VIS8RU',0,'0','0'),(56,'D7U3C4','2017-05-03 05:19:11',41587843,'Desiree','Barnett','2000-01-21 04:59:05','8032 Sed, Calle',NULL,'Dr.',98,'non.lorem@congueelit.co.uk','OYO02HWF6XY',0,'0','0'),(57,'R8Q1H6','2017-01-23 21:36:49',46685602,'Leila','Lewis','2004-07-30 09:09:07','Apdo.:154-5777 Dui, Calle',NULL,'Sra.',94,'malesuada@sitamet.edu','RNY94IEF6AW',0,'0','0'),(58,'P0M7H5','2017-04-08 00:49:36',34324003,'Signe','Kirkland','2000-02-17 13:37:28','902-8577 Risus. Ctra.',NULL,'',91,'consequat.nec@pede.edu','ABN59HUG1UC',0,'0','0'),(59,'K6P9Y3','2016-12-07 07:48:40',10576840,'Neville','Mcdonald','2001-02-04 02:31:40','Apartado núm.: 705, 8971 Nibh Av.',NULL,'Srta.',99,'nunc.In.at@lectussit.net','EZL93ZPI9FV',0,'0','0'),(60,'F1T4X1','2017-03-25 14:39:15',5634111,'Graham','Meyers','2000-11-05 22:47:13','Apartado núm.: 980, 1833 Interdum C.',NULL,'Dr.',95,'egestas@elementum.net','RST96VAX6UE',0,'0','0'),(61,'P6O0C8','2017-05-27 09:32:04',46044622,'Sebastian','Stanley','2002-10-24 09:12:07','8090 Tincidunt Av.',NULL,'Srta.',100,'consequat.auctor.nunc@accumsan.net','FUK81QTO1FM',0,'0','0'),(62,'R9I4X4','2017-04-18 04:49:04',5532584,'Gannon','Barnett','2000-08-13 03:08:57','Apdo.:213-499 Sit Ctra.',NULL,'',97,'eu.arcu.Morbi@facilisis.co.uk','MYH54XAD0AJ',0,'0','0'),(63,'I5A8Q1','2017-04-18 22:57:42',37316621,'Uma','Mccall','2001-07-13 02:25:13','Apartado núm.: 244, 7080 Varius. Avenida',NULL,'Sra.',96,'lacus.Ut.nec@Maecenasmalesuada.ca','XAU87KTZ7CS',0,'0','0'),(64,'T1N6R7','2017-07-24 11:53:48',45402183,'Caleb','Walsh','2003-09-12 21:47:16','9526 Sapien. C/',NULL,'Sra.',98,'egestas.blandit@purus.com','FUH84VBK7EO',0,'0','0'),(65,'A2I8W0','2017-06-01 01:16:58',29259133,'Hillary','Carr','2000-10-19 01:33:21','Apartado núm.: 557, 6203 Bibendum Carretera',NULL,'Srta.',96,'sollicitudin.a.malesuada@eget.co.uk','AIH34WOU2PY',0,'0','0'),(66,'W0E2L2','2017-06-22 02:06:52',23673062,'Ferris','Jones','2001-04-28 16:59:03','Apartado núm.: 636, 6624 Ornare. Avda.',NULL,'Sra.',94,'erat.volutpat.Nulla@dolorelit.net','NRA35JHJ2NF',0,'0','0'),(67,'Q0M6S3','2017-02-27 19:10:18',21932224,'Autumn','Ryan','2004-05-23 08:12:26','295-3884 Vel Avda.',NULL,'Dr.',98,'mi.ac@sedhendrerit.org','PRN40XLH5RS',0,'0','0'),(68,'X9K4O2','2017-04-22 14:36:00',29503177,'Mia','Odonnell','2001-01-08 10:21:24','Apartado núm.: 923, 6424 Lorem, Avda.',NULL,'Srta.',91,'libero.Proin@purusin.edu','PNN15VSM2AY',0,'0','0'),(69,'E8X6W1','2017-09-28 12:22:16',47671477,'Mara','Reed','2001-05-15 12:26:44','790-4402 Orci Avenida',NULL,'Srta.',94,'ligula@nullaCraseu.edu','IZR31ZXK4WR',0,'0','0'),(70,'N3G7R9','2017-11-20 06:56:07',38403759,'Felix','Brady','2003-02-12 11:33:10','8924 Nisi. C.',NULL,'Sra.',97,'sit.amet.luctus@Maecenasmifelis.ca','LGW61XKN8EI',0,'0','0'),(71,'F1W3H4','2016-11-27 12:38:51',42066812,'Audrey','Lloyd','2004-03-14 08:26:04','5257 Et Avenida',NULL,'Sra.',92,'laoreet@lobortis.com','MKA74EEZ6MU',0,'0','0'),(72,'H5K5J7','2017-08-14 13:34:18',39135430,'Brooke','Wong','2004-10-08 11:11:20','Apartado núm.: 632, 3522 Feugiat ',NULL,'Srta.',91,'Cras.eu.tellus@natoquepenatibuset.ca','PTF52LRK1KW',0,'0','0'),(73,'A7T9A7','2016-12-16 14:02:36',38490158,'Heather','Riley','2001-02-11 18:11:12','Apdo.:883-3471 Etiam Avda.',NULL,'Sra.',96,'montes.nascetur.ridiculus@lacus.org','NKP29NJG8CD',0,'0','0'),(74,'A6G0Y8','2017-01-15 15:38:15',22458762,'Scott','Wagner','2002-12-24 18:57:43','9424 Tempor ',NULL,'Srta.',99,'tristique.pellentesque@Maurisvel.net','LEZ48PNH5CR',0,'0','0'),(75,'P4X9S2','2017-09-04 04:46:58',34250368,'Rafael','Knapp','2005-01-28 16:55:04','302-8716 Sem Av.',NULL,'Srta.',97,'eu.metus@egetipsum.org','TOV86GYO4GH',0,'0','0'),(76,'G5B1O0','2017-07-24 07:19:10',30437248,'Deacon','Reeves','2003-06-13 10:37:28','Apdo.:472-1710 Interdum C/',NULL,'',98,'Cras.dictum.ultricies@porttitorscelerisqueneq','IAO31HKF5SA',0,'0','0'),(77,'X0T5N6','2017-04-13 12:32:11',26697643,'Kelsie','Warner','2002-09-15 10:07:06','5213 Sed C/',NULL,'',91,'dui.Fusce@nec.co.uk','YZD07HOH0MO',0,'0','0'),(78,'T0H0V9','2017-02-20 12:12:38',16419947,'Caryn','Mccarthy','2004-07-20 21:12:57','Apartado núm.: 993, 3150 Et ',NULL,'Sr.',99,'Cum.sociis.natoque@Donecporttitor.edu','GKU69HQD0VR',0,'0','0'),(79,'T8D8O6','2017-09-18 21:10:48',26180169,'Constance','Joseph','2004-06-07 19:39:35','Apartado núm.: 189, 6742 Phasellus ',NULL,'Sra.',100,'est.congue@tellus.ca','ISU17DQB5OT',0,'0','0'),(80,'K0F1D7','2017-02-05 21:47:51',18340162,'Beck','Brock','2004-06-11 01:30:44','Apartado núm.: 238, 1896 Vel, Ctra.',NULL,'Sr.',91,'quam.a.felis@Integeraliquam.ca','HGV33UAD1UH',0,'0','0'),(81,'P2Z3W6','2016-12-18 05:38:32',16516795,'Elijah','Cash','2003-05-11 22:59:40','Apdo.:232-3713 Donec Av.',NULL,'Dr.',98,'aliquam.iaculis.lacus@Nunclectus.org','UYL07YTQ9QY',0,'0','0'),(82,'W2P7Y5','2017-03-19 17:40:01',13440880,'Cairo','Robinson','2001-04-05 19:23:24','Apartado núm.: 768, 1142 Ligula. C.',NULL,'Dr.',92,'in@Sedneque.net','DDK44NOJ9JU',0,'0','0'),(83,'V0B3W1','2017-02-20 12:43:19',36692365,'Hanae','Mooney','2004-10-14 22:31:42','Apartado núm.: 761, 1640 Feugiat Avenida',NULL,'Dr.',94,'dis.parturient@urnaVivamusmolestie.org','GED17YPT8PZ',0,'0','0'),(84,'I8U2O2','2017-07-11 10:18:18',40983534,'Jade','Finley','2003-02-26 19:43:11','Apartado núm.: 436, 5228 Viverra. C/',NULL,'',99,'porta.elit.a@euneque.org','QGM27VSG1WQ',0,'0','0'),(85,'N4X8B1','2017-05-12 10:26:49',31094413,'Vivian','Shepherd','2003-06-19 14:34:07','823-8193 Et ',NULL,'Sra.',99,'iaculis@eu.ca','KTD37UAU4HP',0,'0','0'),(86,'E0B4P1','2017-02-02 14:07:19',37298501,'Fredericka','Clemons','2004-09-04 07:44:07','Apartado núm.: 951, 8314 Sapien. Ctra.',NULL,'Dr.',97,'faucibus.id.libero@aliquetmagnaa.ca','GTN73ORU8EG',0,'0','0'),(87,'B9K7S2','2017-11-14 05:32:39',37329784,'Clayton','Hart','2001-05-29 09:14:05','8647 Morbi ',NULL,'Dr.',99,'a.enim.Suspendisse@sit.org','JNI89MLR6NF',0,'0','0'),(88,'H4J2S5','2017-08-09 00:39:59',6427765,'Kamal','Mullins','2000-01-09 09:52:24','2780 Libero C/',NULL,'',98,'Cras@litora.com','EUF66RSA1KM',0,'0','0'),(89,'T7F9R2','2017-07-14 02:03:55',28290099,'Pandora','Nelson','2002-02-23 09:35:42','Apartado núm.: 700, 406 Aenean Avenida',NULL,'Sr.',100,'tempor.diam@Phasellusin.com','ZPH71KZP0RO',0,'0','0'),(90,'I8F2A0','2017-10-02 16:26:31',49547905,'Dalton','Lindsey','2003-07-01 12:17:27','415-5981 Eu ',NULL,'Srta.',95,'cursus.et@arcu.edu','YPS38WBZ0HQ',0,'0','0'),(91,'W8K8E0','2017-10-29 01:22:31',29006247,'Aretha','Conway','2000-02-21 12:24:50','Apdo.:707-8398 Lacinia Avda.',NULL,'',92,'nec.tellus@odioapurus.org','JYN22ZVO7BM',0,'0','0'),(92,'L2P9M8','2017-05-30 11:36:29',11003159,'Dacey','Moran','2002-11-29 05:34:07','952-5067 Molestie Calle',NULL,'Sr.',93,'bibendum.ullamcorper.Duis@enimCurabiturmassa.','RHO05QRL2ML',0,'0','0'),(93,'C7Y5Y0','2017-09-28 13:24:50',21423144,'Ebony','Warner','2003-03-21 00:17:11','735-532 At, Carretera',NULL,'Srta.',98,'tempor@lacusQuisqueimperdiet.co.uk','WZW66OCF1PM',0,'0','0'),(94,'U9N2X8','2017-11-02 07:28:53',13097892,'Hanae','Webb','2001-05-09 01:26:11','Apdo.:300-393 Elit, C/',NULL,'Sra.',96,'diam.Duis.mi@necluctus.org','JVD87MCA9NR',0,'0','0'),(95,'G1U6J9','2016-12-10 19:36:13',41077107,'Camden','Abbott','2000-03-10 07:20:34','897-1173 Cras C/',NULL,'Srta.',96,'Morbi@ut.com','FQU49TDA4BT',0,'0','0'),(96,'F4H9R6','2017-07-10 01:48:47',32483143,'Brian','Santana','2001-02-02 10:39:28','Apdo.:553-1998 Facilisis Carretera',NULL,'Sr.',90,'convallis.convallis.dolor@atiaculis.edu','TYH82YEF7PY',0,'0','0'),(97,'P9D5D5','2017-08-23 06:03:33',8729131,'Daphne','Fowler','2004-01-11 17:44:56','Apdo.:553-4624 Posuere Avda.',NULL,'Sr.',94,'Cras.lorem@ametluctus.co.uk','PTT14ERJ9OT',0,'0','0'),(98,'E2P7R6','2017-08-10 20:55:06',28083360,'Nerea','Bridges','2004-07-03 03:17:36','Apartado núm.: 760, 9625 Ut C.',NULL,'Dr.',94,'semper.erat.in@Nuncquisarcu.com','KFO89MEG6IK',0,'0','0'),(99,'B5I4P3','2017-08-28 03:32:15',40123309,'Talon','Alexander','2002-02-27 06:56:39','Apdo.:284-1693 Arcu Carretera',NULL,'Sra.',91,'mi@ornare.co.uk','KJC42IFU1PH',0,'0','0'),(100,'E9F6M1','2017-10-18 11:51:07',35759016,'Nigel','Buck','2002-06-16 15:37:31','Apartado núm.: 800, 7919 Nec C.',NULL,'Sr.',99,'Cras.eget@euismodurna.org','GRQ98PII9UD',0,'0','0'),(101,'S2F8H1','2017-05-28 02:55:56',45341096,'Ebony','Montgomery','2003-06-11 20:01:18','9819 Pede. C.',NULL,'Dr.',90,'Donec.tincidunt.Donec@auctorMauris.co.uk','WNE08PGQ2NP',0,'0','0'),(102,'R0U3A1','2017-06-18 02:43:06',48761924,'Bree','Sosa','2005-01-25 14:34:40','Apdo.:146-6743 Diam. ',NULL,'',97,'dui.nec@turpis.ca','UVB24LSW8RW',0,'0','0'),(103,'P7W3P6','2017-08-04 18:45:03',45084699,'Julian','Little','2002-07-13 00:14:38','Apartado núm.: 996, 5795 Faucibus Ctra.',NULL,'Sra.',100,'metus.Aenean@urna.ca','FOS23BHO9ZD',0,'0','0'),(104,'I3S0U1','2017-08-14 18:24:46',36284901,'Jade','Sparks','2000-12-22 13:41:59','858-246 Augue Calle',NULL,'Sr.',99,'hendrerit.a.arcu@enimgravida.ca','AVZ43QPZ5GG',0,'0','0');
/*!40000 ALTER TABLE `estudiante` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `historial_pagos`
--
DROP TABLE IF EXISTS `historial_pagos`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `historial_pagos` (
`idhistorial_pagos` int(11) NOT NULL AUTO_INCREMENT,
`id_estudiante` varchar(45) DEFAULT NULL,
`id_mes` varchar(45) DEFAULT NULL,
`valor_del_pago` varchar(45) DEFAULT NULL,
`fecha` datetime DEFAULT NULL,
PRIMARY KEY (`idhistorial_pagos`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `historial_pagos`
--
LOCK TABLES `historial_pagos` WRITE;
/*!40000 ALTER TABLE `historial_pagos` DISABLE KEYS */;
INSERT INTO `historial_pagos` VALUES (1,'19172997','0','100','2017-11-19 01:34:30'),(2,'19172997','1','100','2017-11-19 01:34:42'),(3,'40770483','0','70','2017-11-19 01:35:05'),(4,'40770483','0','30','2017-11-19 01:35:11'),(5,'19172997','0','90','2017-11-19 11:00:03'),(6,'19172997','0','10','2017-11-19 11:00:09'),(7,'19172997','1','100','2017-11-19 11:00:15');
/*!40000 ALTER TABLE `historial_pagos` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `lectivo`
--
DROP TABLE IF EXISTS `lectivo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `lectivo` (
`idLectivo` int(11) NOT NULL AUTO_INCREMENT,
`descripcion` varchar(45) DEFAULT NULL,
PRIMARY KEY (`idLectivo`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `lectivo`
--
LOCK TABLES `lectivo` WRITE;
/*!40000 ALTER TABLE `lectivo` DISABLE KEYS */;
INSERT INTO `lectivo` VALUES (1,'2017-2018');
/*!40000 ALTER TABLE `lectivo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `materias`
--
DROP TABLE IF EXISTS `materias`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `materias` (
`id_Materias` int(11) NOT NULL AUTO_INCREMENT,
`nom_Materias` varchar(45) DEFAULT NULL,
`nom_corto_Materias` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id_Materias`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `materias`
--
LOCK TABLES `materias` WRITE;
/*!40000 ALTER TABLE `materias` DISABLE KEYS */;
INSERT INTO `materias` VALUES (1,'Historia','Historia'),(2,'Matematicas','Matematicas'),(3,'Español','Español'),(4,'Astronomía','Astronomía'),(5,'Quimica','Quimica'),(6,'Ed.Artistica','Ed.Artistica'),(7,'Fisica','Fisica'),(8,'Ingles ','Ingles '),(9,'Ed.Fisica','Ed.Fisica'),(10,'Ciencias Sociales','Ciencias Sociales'),(11,'Civica Y Etica','Civica Y Etica');
/*!40000 ALTER TABLE `materias` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `materiasnotas`
--
DROP TABLE IF EXISTS `materiasnotas`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `materiasnotas` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`quimestre_MateriasNotas` varchar(45) DEFAULT NULL,
`id_materia_MateriasNotas` varchar(45) DEFAULT NULL,
`id_curso_MateriasNotas` varchar(45) DEFAULT NULL,
`id_profesor_MateriasNotas` varchar(45) DEFAULT NULL,
`cedula_estudiantes_MateriasNotas` varchar(45) DEFAULT NULL,
`notaparcial1q1_MateriasNotas` varchar(45) DEFAULT NULL,
`notaparcial2q1_MateriasNotas` varchar(45) DEFAULT NULL,
`notaparcial3q1_MateriasNotas` varchar(45) DEFAULT NULL,
`porcentajeq1_MateriasNotas` varchar(45) DEFAULT NULL,
`nota_examenq1_MateriasNotas` varchar(45) DEFAULT NULL,
`nota_examen_porcentajeq1_MateriasNotas` varchar(45) DEFAULT NULL,
`promedioq1_MateriasNotas` varchar(45) DEFAULT NULL,
`notaparcial1q2_MateriasNotas` varchar(45) DEFAULT NULL,
`notaparcial2q2_MateriasNotas` varchar(45) DEFAULT NULL,
`notaparcial3q2_MateriasNotas` varchar(45) DEFAULT NULL,
`porcentajeq2_MateriasNotas` varchar(45) DEFAULT NULL,
`nota_examenq2_MateriasNotas` varchar(45) DEFAULT NULL,
`nota_examen_porcentajeq2_MateriasNotas` varchar(45) DEFAULT NULL,
`promedioq2_MateriasNotas` varchar(45) DEFAULT NULL,
`notarec_MateriasNotas` varchar(45) DEFAULT NULL,
`notareme_MateriasNotas` varchar(45) DEFAULT NULL,
`notaexa_MateriasNotas` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `materiasnotas`
--
LOCK TABLES `materiasnotas` WRITE;
/*!40000 ALTER TABLE `materiasnotas` DISABLE KEYS */;
/*!40000 ALTER TABLE `materiasnotas` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `matricula`
--
DROP TABLE IF EXISTS `matricula`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `matricula` (
`idMatricula` int(11) NOT NULL AUTO_INCREMENT,
`cedula_estudiante_matricula` varchar(45) DEFAULT NULL,
`lectivo` varchar(45) DEFAULT NULL,
`id_curso` varchar(45) DEFAULT NULL,
PRIMARY KEY (`idMatricula`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `matricula`
--
LOCK TABLES `matricula` WRITE;
/*!40000 ALTER TABLE `matricula` DISABLE KEYS */;
/*!40000 ALTER TABLE `matricula` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `observacion`
--
DROP TABLE IF EXISTS `observacion`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `observacion` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`cedula_estu_observacion` varchar(45) DEFAULT NULL,
`cedula_profe_observacion` varchar(45) DEFAULT NULL,
`descr_observacion` longtext,
`fecha` datetime DEFAULT CURRENT_TIMESTAMP,
`Incidencia_observacion` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `observacion`
--
LOCK TABLES `observacion` WRITE;
/*!40000 ALTER TABLE `observacion` DISABLE KEYS */;
INSERT INTO `observacion` VALUES (1,'19172997','1234','sdsddddddddddddddddd','2017-11-19 11:10:27','FaltaJustificada');
/*!40000 ALTER TABLE `observacion` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `observacioncurso`
--
DROP TABLE IF EXISTS `observacioncurso`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `observacioncurso` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_curso_observacioncurso` varchar(45) DEFAULT NULL,
`cedula_profesor_observacioncurso` varchar(45) DEFAULT NULL,
`incidencia_observacioncurso` varchar(45) DEFAULT NULL,
`observ_observacioncurso` longtext,
`fecha_observacioncurso` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `observacioncurso`
--
LOCK TABLES `observacioncurso` WRITE;
/*!40000 ALTER TABLE `observacioncurso` DISABLE KEYS */;
/*!40000 ALTER TABLE `observacioncurso` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `pensiones`
--
DROP TABLE IF EXISTS `pensiones`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pensiones` (
`idPenciones` int(11) NOT NULL AUTO_INCREMENT,
`id_estudiantes` varchar(45) DEFAULT NULL,
`valor_matricula` varchar(45) DEFAULT NULL,
`valor_pagado` varchar(45) DEFAULT NULL,
`mes_pagado` varchar(45) DEFAULT NULL,
`fecha` varchar(45) DEFAULT NULL,
`estado1` varchar(45) DEFAULT NULL,
PRIMARY KEY (`idPenciones`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `pensiones`
--
LOCK TABLES `pensiones` WRITE;
/*!40000 ALTER TABLE `pensiones` DISABLE KEYS */;
/*!40000 ALTER TABLE `pensiones` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `representante`
--
DROP TABLE IF EXISTS `representante`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `representante` (
`id_Representante` int(11) NOT NULL,
`cedula_Representante` varchar(45) DEFAULT NULL,
`ape_Representante` varchar(45) DEFAULT NULL,
`nom_Representante` varchar(45) DEFAULT NULL,
`telf_Representante` varchar(45) DEFAULT NULL,
`correo_Representante` varchar(45) DEFAULT NULL,
`dir_Representante` varchar(45) DEFAULT NULL,
`ocu_Representante` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id_Representante`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `representante`
--
LOCK TABLES `representante` WRITE;
/*!40000 ALTER TABLE `representante` DISABLE KEYS */;
/*!40000 ALTER TABLE `representante` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `secretaria`
--
DROP TABLE IF EXISTS `secretaria`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `secretaria` (
`id_Secretaria` int(11) NOT NULL AUTO_INCREMENT,
`cedula_Secretaria` int(10) DEFAULT NULL,
`ape_Secretaria` varchar(45) DEFAULT NULL,
`nom_Secretaria` varchar(45) DEFAULT NULL,
`telf_Secretaria` varchar(45) DEFAULT NULL,
`correo_Secretaria` varchar(45) DEFAULT NULL,
`direc_Secretaria` varchar(45) DEFAULT NULL,
`fech_nac_Secretaria` date DEFAULT NULL,
`user_Secretaria` varchar(45) DEFAULT NULL,
`pass_Secretaria` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id_Secretaria`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `secretaria`
--
LOCK TABLES `secretaria` WRITE;
/*!40000 ALTER TABLE `secretaria` DISABLE KEYS */;
/*!40000 ALTER TABLE `secretaria` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tabla_prueba`
--
DROP TABLE IF EXISTS `tabla_prueba`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tabla_prueba` (
`columna` varchar(3) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tabla_prueba`
--
LOCK TABLES `tabla_prueba` WRITE;
/*!40000 ALTER TABLE `tabla_prueba` DISABLE KEYS */;
INSERT INTO `tabla_prueba` VALUES ('a1'),('a2'),('a3'),('a4'),('a5'),('a6'),('a7'),('a8'),('a9'),('a10'),('a11'),('a12');
/*!40000 ALTER TABLE `tabla_prueba` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `usuario`
--
DROP TABLE IF EXISTS `usuario`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `usuario` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`cedula` varchar(45) DEFAULT NULL,
`usuario` varchar(45) DEFAULT NULL,
`Contra` varchar(45) DEFAULT NULL,
`tipo` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=160 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `usuario`
--
LOCK TABLES `usuario` WRITE;
/*!40000 ALTER TABLE `usuario` DISABLE KEYS */;
INSERT INTO `usuario` VALUES (1,'0','adonis','adonis','Secretario'),(2,'1','ass1','ass1','administracion'),(3,'2','qw','qw','Estudiante'),(9,'19172997','ESTU001','ESTU001','Estudiante'),(10,'987654321','ESTU002','ESTU002','Estudiante'),(11,'121212','ESTU003','ESTU003','Estudiante'),(12,'12225455','vestibulum.lorem@ridiculusmusDonec.com','BIO90TDA8AP','Estudiante'),(13,'40770483','fermentum.vel.mauris@interdum.net','WAU74VEW4TF','Estudiante'),(14,'24457663','magna.et@nonummy.net','QIC45YWD3HE','Estudiante'),(15,'27800214','tellus.eu.augue@augueut.edu','MJV31STR6XY','Estudiante'),(16,'38978564','natoque@consectetueradipiscing.ca','XAQ54IQH9QR','Estudiante'),(17,'48430187','vitae@in.co.uk','NEO17CXY0YR','Estudiante'),(18,'25829789','Sed.congue.elit@acorci.ca','AIY12QSF1HO','Estudiante'),(19,'15742561','hendrerit.id.ante@acnullaIn.ca','QJX65BCJ5TS','Estudiante'),(20,'41486812','a.enim@molestie.co.uk','GZA39EVK6AY','Estudiante'),(21,'21442768','pellentesque@Curabiturvellectus.com','FUG73RZH2NJ','Estudiante'),(22,'30379226','imperdiet.nec@Donec.net','FDO93WYY7WC','Estudiante'),(23,'11282247','Quisque.ac.libero@Etiam.net','SYQ26RQF2KH','Estudiante'),(24,'8229687','ac.facilisis@Curabiturut.net','RUV73IOI4AR','Estudiante'),(25,'5783821','Lorem.ipsum@Crasdictum.com','OKP00XOW3KY','Estudiante'),(26,'7596802','tellus@bibendumDonecfelis.edu','LBQ89LPV4FN','Estudiante'),(27,'37287378','luctus.aliquet@faucibuslectusa.ca','VGX99WVT1QM','Estudiante'),(28,'39781466','lorem.luctus@sociisnatoquepenatibus.net','LKA78RKD7HS','Estudiante'),(29,'29740835','facilisis.lorem@Proinegetodio.com','NHS83WHA1HA','Estudiante'),(30,'7917102','id@sodalesnisi.edu','BMT52BXO8JW','Estudiante'),(31,'47111202','elit.Curabitur@diam.org','EBN82TEH2OQ','Estudiante'),(32,'19695162','bibendum.fermentum.metus@Morbiquis.co.uk','AYJ72FRP5UB','Estudiante'),(33,'27766414','Integer@rutrum.org','TWM28BIB2WS','Estudiante'),(34,'48985977','eget@maurisrhoncusid.ca','RVH78GPQ6CU','Estudiante'),(35,'47875959','ipsum@inhendreritconsectetuer.org','BTC21GWC6KO','Estudiante'),(36,'13860412','convallis@pede.com','TDS15PUS9MW','Estudiante'),(37,'46249006','diam@nequeSedeget.co.uk','ZPP77AXD1VK','Estudiante'),(38,'48967767','et@ultricesaauctor.ca','MHL65ZZA9WC','Estudiante'),(39,'30474384','ut.sem@nequesed.ca','UIR47AIW4RK','Estudiante'),(40,'42120388','eget@Donectempor.edu','LYC45SZL7IC','Estudiante'),(41,'18771049','cursus@auctorquistristique.co.uk','UWA12FHI2HQ','Estudiante'),(42,'14124832','parturient@egestas.org','WJA44EJF7QJ','Estudiante'),(43,'21725684','non.feugiat@Phasellusfermentum.org','PXB18GSE7GU','Estudiante'),(44,'16697886','tincidunt.pede@Suspendisse.com','IKP65NFC5RH','Estudiante'),(45,'27945865','vulputate@laciniaatiaculis.ca','MGY69OGH7ZD','Estudiante'),(46,'32861817','lobortis@rutrumFusce.edu','XMU59CTA9IP','Estudiante'),(47,'33379449','sit.amet@vestibulumloremsit.ca','YXO49KJP1NR','Estudiante'),(48,'33408764','eget.varius@uterat.edu','ZRO39MBZ3RR','Estudiante'),(49,'44952859','Donec.consectetuer@mi.net','NUC20NJF0VU','Estudiante'),(50,'26985730','sapien@augueeu.com','SMN87YOX7ET','Estudiante'),(51,'39560598','consectetuer.mauris@eliteratvitae.com','QLF89FKU0WI','Estudiante'),(52,'32656243','Nullam.suscipit.est@utipsumac.edu','BBB74FLH6UK','Estudiante'),(53,'6047331','Integer@penatibusetmagnis.org','MBD83EFX4CK','Estudiante'),(54,'36032694','velit.Cras@adlitora.com','AJX97QNE6EH','Estudiante'),(55,'44802425','Nullam.vitae.diam@auctorullamcorpernisl.org','DMX84CAE3WG','Estudiante'),(56,'15629327','aliquet@sagittisaugue.org','PKF03IUU5OZ','Estudiante'),(57,'14897763','ipsum.Donec.sollicitudin@vulputate.co.uk','WCK40CLT7NN','Estudiante'),(58,'16026405','elementum.dui@vitaesodalesnisi.net','DMF27XDA9UF','Estudiante'),(59,'34323072','dapibus.id@semPellentesque.co.uk','ZZR32DXR0OL','Estudiante'),(60,'7418427','In@leoVivamus.ca','CVD93DIG9JT','Estudiante'),(61,'26574602','egestas@Fuscefeugiat.co.uk','GSU75AZO6VL','Estudiante'),(62,'15749558','sit@eutellus.ca','TTO86VIS8RU','Estudiante'),(63,'41587843','non.lorem@congueelit.co.uk','OYO02HWF6XY','Estudiante'),(64,'46685602','malesuada@sitamet.edu','RNY94IEF6AW','Estudiante'),(65,'34324003','consequat.nec@pede.edu','ABN59HUG1UC','Estudiante'),(66,'10576840','nunc.In.at@lectussit.net','EZL93ZPI9FV','Estudiante'),(67,'5634111','egestas@elementum.net','RST96VAX6UE','Estudiante'),(68,'46044622','consequat.auctor.nunc@accumsan.net','FUK81QTO1FM','Estudiante'),(69,'5532584','eu.arcu.Morbi@facilisis.co.uk','MYH54XAD0AJ','Estudiante'),(70,'37316621','lacus.Ut.nec@Maecenasmalesuada.ca','XAU87KTZ7CS','Estudiante'),(71,'45402183','egestas.blandit@purus.com','FUH84VBK7EO','Estudiante'),(72,'29259133','sollicitudin.a.malesuada@eget.co.uk','AIH34WOU2PY','Estudiante'),(73,'23673062','erat.volutpat.Nulla@dolorelit.net','NRA35JHJ2NF','Estudiante'),(74,'21932224','mi.ac@sedhendrerit.org','PRN40XLH5RS','Estudiante'),(75,'29503177','libero.Proin@purusin.edu','PNN15VSM2AY','Estudiante'),(76,'47671477','ligula@nullaCraseu.edu','IZR31ZXK4WR','Estudiante'),(77,'38403759','sit.amet.luctus@Maecenasmifelis.ca','LGW61XKN8EI','Estudiante'),(78,'42066812','laoreet@lobortis.com','MKA74EEZ6MU','Estudiante'),(79,'39135430','Cras.eu.tellus@natoquepenatibuset.ca','PTF52LRK1KW','Estudiante'),(80,'38490158','montes.nascetur.ridiculus@lacus.org','NKP29NJG8CD','Estudiante'),(81,'22458762','tristique.pellentesque@Maurisvel.net','LEZ48PNH5CR','Estudiante'),(82,'34250368','eu.metus@egetipsum.org','TOV86GYO4GH','Estudiante'),(83,'30437248','Cras.dictum.ultricies@porttitorscelerisqueneq','IAO31HKF5SA','Estudiante'),(84,'26697643','dui.Fusce@nec.co.uk','YZD07HOH0MO','Estudiante'),(85,'16419947','Cum.sociis.natoque@Donecporttitor.edu','GKU69HQD0VR','Estudiante'),(86,'26180169','est.congue@tellus.ca','ISU17DQB5OT','Estudiante'),(87,'18340162','quam.a.felis@Integeraliquam.ca','HGV33UAD1UH','Estudiante'),(88,'16516795','aliquam.iaculis.lacus@Nunclectus.org','UYL07YTQ9QY','Estudiante'),(89,'13440880','in@Sedneque.net','DDK44NOJ9JU','Estudiante'),(90,'36692365','dis.parturient@urnaVivamusmolestie.org','GED17YPT8PZ','Estudiante'),(91,'40983534','porta.elit.a@euneque.org','QGM27VSG1WQ','Estudiante'),(92,'31094413','iaculis@eu.ca','KTD37UAU4HP','Estudiante'),(93,'37298501','faucibus.id.libero@aliquetmagnaa.ca','GTN73ORU8EG','Estudiante'),(94,'37329784','a.enim.Suspendisse@sit.org','JNI89MLR6NF','Estudiante'),(95,'6427765','Cras@litora.com','EUF66RSA1KM','Estudiante'),(96,'28290099','tempor.diam@Phasellusin.com','ZPH71KZP0RO','Estudiante'),(97,'49547905','cursus.et@arcu.edu','YPS38WBZ0HQ','Estudiante'),(98,'29006247','nec.tellus@odioapurus.org','JYN22ZVO7BM','Estudiante'),(99,'11003159','bibendum.ullamcorper.Duis@enimCurabiturmassa.','RHO05QRL2ML','Estudiante'),(100,'21423144','tempor@lacusQuisqueimperdiet.co.uk','WZW66OCF1PM','Estudiante'),(101,'13097892','diam.Duis.mi@necluctus.org','JVD87MCA9NR','Estudiante'),(102,'41077107','Morbi@ut.com','FQU49TDA4BT','Estudiante'),(103,'32483143','convallis.convallis.dolor@atiaculis.edu','TYH82YEF7PY','Estudiante'),(104,'8729131','Cras.lorem@ametluctus.co.uk','PTT14ERJ9OT','Estudiante'),(105,'28083360','semper.erat.in@Nuncquisarcu.com','KFO89MEG6IK','Estudiante'),(106,'40123309','mi@ornare.co.uk','KJC42IFU1PH','Estudiante'),(107,'35759016','Cras.eget@euismodurna.org','GRQ98PII9UD','Estudiante'),(108,'45341096','Donec.tincidunt.Donec@auctorMauris.co.uk','WNE08PGQ2NP','Estudiante'),(109,'48761924','dui.nec@turpis.ca','UVB24LSW8RW','Estudiante'),(110,'45084699','metus.Aenean@urna.ca','FOS23BHO9ZD','Estudiante'),(111,'36284901','hendrerit.a.arcu@enimgravida.ca','AVZ43QPZ5GG','Estudiante'),(139,'1234','ass','ass','Profesor'),(140,'21733479','274915198','381506500','Profesor'),(141,'50177821','470194861','151420718','Profesor'),(142,'17460730','504610122','388869760','Profesor'),(143,'21004510','364063602','002301190','Profesor'),(144,'35445327','610000374','372205831','Profesor'),(145,'35778074','255827511','009957614','Profesor'),(146,'20149423','360806319','338729965','Profesor'),(147,'16466071','549194249','852177963','Profesor'),(148,'32838665','075432708','635346364','Profesor'),(149,'38904557','244057691','494683691','Profesor'),(150,'43887296','449356112','738688787','Profesor'),(151,'14197764','752598904','693771677','Profesor'),(152,'46986424','034490284','378958912','Profesor'),(153,'12314380','419192158','539023705','Profesor'),(154,'29016345','235941531','689065878','Profesor'),(155,'43815371','328900576','606101392','Profesor'),(156,'19641384','064408883','431982602','Profesor'),(157,'48360294','721996106','422770313','Profesor'),(158,'21116280','134873686','780212650','Profesor'),(159,'41194345','570729822','321298051','Profesor');
/*!40000 ALTER TABLE `usuario` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!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 */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2017-11-19 12:45:32
| 77.198138 | 18,066 | 0.711815 |
c45565fc2d7fe2ead9dbf646f4090e7bd3b8a2e2 | 4,474 | h | C | DIR819_v1.06/src/apps/tr064fe/data/standard/layer2bridgeparams.h | Sirherobrine23/Dir819gpl_code | 8af92d65416198755974e3247b7bbe7f1151d525 | [
"BSD-2-Clause"
] | 1 | 2022-03-19T06:38:01.000Z | 2022-03-19T06:38:01.000Z | DIR819_v1.06/src/apps/tr064fe/data/standard/layer2bridgeparams.h | Sirherobrine23/Dir819gpl_code | 8af92d65416198755974e3247b7bbe7f1151d525 | [
"BSD-2-Clause"
] | null | null | null | DIR819_v1.06/src/apps/tr064fe/data/standard/layer2bridgeparams.h | Sirherobrine23/Dir819gpl_code | 8af92d65416198755974e3247b7bbe7f1151d525 | [
"BSD-2-Clause"
] | 1 | 2022-03-19T06:38:03.000Z | 2022-03-19T06:38:03.000Z | /*****************************************************************************
//
// Copyright (c) 2005 Broadcom Corporation
// All Rights Reserved
// No portions of this material may be reproduced in any form without the
// written permission of:
// Broadcom Corporation
// 16215 Alton Parkway
// Irvine, California 92619
// All information contained in this document is Broadcom Corporation
// company private, proprietary, and trade secret.
//
******************************************************************************
//
// Filename: layer2bridgeparams.h
//
******************************************************************************/
#ifndef _LAYER2BRIDGEPARAMS_H
#define _LAYER2BRIDGEPARAMS_H
#define VAR_MaxBridgeEntries 0
#define VAR_MaxFilterEntries 1
#define VAR_MaxMarkingEntries 2
#define VAR_BridgeNumberOfEntries 3
#define VAR_BridgeKey 4
#define VAR_BridgeEnable 5
#define VAR_BridgeStatus 6
#define VAR_BridgeName 7
#define VAR_VLANID 8
#define VAR_FilterNumberOfEntries 9
#define VAR_FilterKey 10
#define VAR_FilterEnable 11
#define VAR_FilterStatus 12
#define VAR_FilterBridgeReference 13
#define VAR_ExclusivityOrder 14
#define VAR_FilterInterface 15
#define VAR_VLANIDFilter 16
#define VAR_AdmitOnlyVLANTagged 17
#define VAR_EthertypeFilterList 18
#define VAR_EthertypeFilterExclude 19
#define VAR_SourceMACAddressFilterList 20
#define VAR_SourceMACAddressFilterExclude 21
#define VAR_DestMACAddressFilterList 22
#define VAR_DestMACAddressFilterExclude 23
#define VAR_SourceMACFromVendorClassIDFilter 24
#define VAR_SourceMACFromVendorClassIDFilterExclude 25
#define VAR_DestMACFromVendorClassIDFilter 26
#define VAR_DestMACFromVendorClassIDFIlterExclude 27
#define VAR_SourceMACFromClientIDFilter 28
#define VAR_SourceMACFromClientIDFilterExclude 29
#define VAR_DestMACFromClientIDFilter 30
#define VAR_DestMACFromClientIDFilterExclude 31
#define VAR_SourceMACFromUserClassIDFilter 32
#define VAR_SourceMACFromUserClassIDFilterExclude 33
#define VAR_DestMACFromUserClassIDFilter 34
#define VAR_DestMACFromUserClassIDFilterExclude 35
#define VAR_MarkingNumberOfEntries 36
#define VAR_MarkingKey 37
#define VAR_MarkingEnable 38
#define VAR_MarkingStatus 39
#define VAR_MarkingBridgeReference 40
#define VAR_MarkingInterface 41
#define VAR_VLANIDUntag 42
#define VAR_VLANIDMark 43
#define VAR_EnternetPriorityMark 44
#define VAR_EthernetPriorityOverride 45
#define VAR_AvailableInterfaceNumberOfEntries 46
#define VAR_AvailableInterfaceKey 47
#define VAR_InterfaceType 48
#define VAR_InterfaceReference 49
int GetLayer2Bridge_Info(UFILE *uclient, PService psvc, PAction ac, pvar_entry_t args, int nargs);
int AddBridgeEntry( UFILE *uclient, PService psvc, PAction ac, pvar_entry_t args, int nargs);
int DeleteBridgeEntry( UFILE *uclient, PService psvc, PAction ac, pvar_entry_t args, int nargs);
int GetSpecificBridgeEntry(UFILE *uclient, PService psvc, PAction ac, pvar_entry_t args, int nargs);
int GetGenericBridgeEntry(UFILE *uclient, PService psvc, PAction ac, pvar_entry_t args, int nargs);
int SetBridgeEntryEnable(UFILE *uclient, PService psvc, PAction ac, pvar_entry_t args, int nargs);
int GetSpecificAvailableInterfaceEntry(UFILE *uclient, PService psvc, PAction ac, pvar_entry_t args, int nargs);
int GetGenericAvailableInterfaceEntry(UFILE *uclient, PService psvc, PAction ac, pvar_entry_t args, int nargs);
#endif /* LAYER2BRIDGEPARAMS_H */
| 54.560976 | 119 | 0.597452 |
1c5832bba1f7886d6ef59385bddcb6013fed49a7 | 6,942 | css | CSS | css/main.css | hojiakbar4211/Eduaction | 50eb384bbe88b3893cf6a6736a00fdb16c89941d | [
"CC-BY-4.0",
"MIT"
] | null | null | null | css/main.css | hojiakbar4211/Eduaction | 50eb384bbe88b3893cf6a6736a00fdb16c89941d | [
"CC-BY-4.0",
"MIT"
] | null | null | null | css/main.css | hojiakbar4211/Eduaction | 50eb384bbe88b3893cf6a6736a00fdb16c89941d | [
"CC-BY-4.0",
"MIT"
] | null | null | null |
/*hover*/
.hover:hover{
color: black!important;
}
.hovera:hover{
color: white!important;
}
.hoverbg:hover{
background-color: black!important;
}
.hoversv:hover{
background-color:#6a6a6a!important;
}
/*color-bcolor*/
.text-silver{
color: #6a6a6a;
}
.bg-blue{
background-color: #574bed;
}
.bg-violet{
background-color: #ab52ea;
}
.bg-orange{
background-color: #ff7953;
}
.bg-olov{
background-color: #FF896B;
}
.bg-pushti{
background-color: #FF819F;
}
.bg-salativiy{
background-color: #30ea87;
}
.bg-kumush{
background-color: #f9f9f9;
}
.bg-blue2{
background-color: #463BBD;
}
/*icons*/
.icon {
width: 24px;
height: 24px;
display: inline-block;
mask-position: center center;
mask-size: 100%;
mask-repeat: no-repeat;
-webkit-mask-position: center center;
-webkit-mask-size: 100%;
-webkit-mask-repeat: no-repeat;
background-color: #808080;
}
.icon-sm {
width: 16px;
height: 16px;
display: inline-block;
mask-position: center center;
mask-size: 100%;
mask-repeat: no-repeat;
-webkit-mask-position: center center;
-webkit-mask-size: 100%;
-webkit-mask-repeat: no-repeat;
background-color: #808080;
}
.iconcha {
width: 30px;
height: 30px;
display: inline-block;
mask-position: center center;
mask-size: 100%;
mask-repeat: no-repeat;
-webkit-mask-position: center center;
-webkit-mask-size: 100%;
-webkit-mask-repeat: no-repeat;
background-color: #808080;
}
.icon-md{
width: 48px;
height: 48px;
display: inline-block;
mask-position: center center;
mask-size: 100%;
mask-repeat: no-repeat;
-webkit-mask-position: center center;
-webkit-mask-size: 100%;
-webkit-mask-repeat: no-repeat;
background-color: #808080;
}
.icon-lg {
width: 65px;
height: 65px;
display: inline-block;
mask-position: center center;
mask-size: 100%;
mask-repeat: no-repeat;
-webkit-mask-position: center center;
-webkit-mask-size: 100%;
-webkit-mask-repeat: no-repeat;
background-color: transparent;
}
.icon-user {
mask-image: url("../icons/black-male-user-symbol.svg");
-webkit-mask-image: url("../icons/black-male-user-symbol.svg");
}
.icon-search {
mask-image: url("../svgs/solid/search.svg");
-webkit-mask-image: url("../svgs/solid/search.svg");
}
.icon-cart {
mask-image: url("../icons/shopping-basket.svg");
-webkit-mask-image: url("../icons/shopping-basket.svg");
}
.icon-book {
mask-image: url("../icons/book.svg");
-webkit-mask-image: url("../icons/book.svg");
}
.icon-calc {
mask-image: url("../icons/calculator.svg");
-webkit-mask-image: url("../icons/calculator.svg");
}
.icon-message {
mask-image: url("../icons/envelope.svg");
-webkit-mask-image: url("../icons/envelope.svg");
}
.icon-laptop {
mask-image: url("../icons/laptop.svg");
-webkit-mask-image: url("../icons/laptop.svg");
}
.icon-edit {
mask-image: url("../svgs/regular/edit.svg");
-webkit-mask-image: url("../svgs/regular/edit.svg");
}
.icon-star {
mask-image: url("../icons/star.svg");
-webkit-mask-image: url("../icons/star.svg");
}
.icon-twitter {
mask-image: url("../svgs/brands/twitter.svg");
-webkit-mask-image: url("../svgs/brands/twitter.svg");
}
.icon-max {
mask-image: url("../svgs/brands/maxcdn.svg");
-webkit-mask-image: url("../svgs/brands/maxcdn.svg");
}
.icon-clock {
mask-image: url("../svgs/regular/clock.svg");
-webkit-mask-image: url("../svgs/regular/clock.svg");
}
.icon-location {
mask-image: url("../icons/pin.svg");
-webkit-mask-image: url("../icons/pin.svg");
}
.icon-comment {
mask-image: url("../icons/comments.svg");
-webkit-mask-image: url("../icons/comments.svg");
}
.icon-calendar {
mask-image: url("../icons/calendar-with-spring-binder-and-date-blocks.svg");
-webkit-mask-image: url("../icons/calendar-with-spring-binder-and-date-blocks.svg");
}
.icon-phone {
mask-image: url("../icons/phone.png");
-webkit-mask-image: url("../icons/phone.png");
}
.icon-email {
mask-image: url("../icons/email.png");
-webkit-mask-image: url("../icons/email.png");
}
.icon-map-marked {
mask-image: url("../svgs/solid/map.svg");
-webkit-mask-image: url("../svgs/solid/map.svg");
}
/*col*/
.col-a {
-ms-flex: 0 0 6.333333%;
flex: 0 0 6.333333%;
max-width: 6.333333%;
}
/*circle*/
.aylana{
border-radius: 20px!important;
}
.doira{
border-radius: 10px!important;
}
/*abc*/
.abc{
padding-top: 1581px;
}
/*font family*/
body{
font-size: 115%;
}
@font-face {
font-family: "Barlow-BoldItalic";
src: url("../fonts/Barlow-BoldItalic.ttf") format("truetype");
}
@font-face {
font-family: "Barlow-ExtraBold";
src: url("../fonts/Barlow-ExtraBold.ttf") format("truetype");
}
@font-face {
font-family: "Barlow-ExtraBoldItalic";
src: url("../fonts/Barlow-ExtraBoldItalic.ttf") format("truetype");
}
@font-face {
font-family: "Barlow-ExtraLight";
src: url("../fonts/Barlow-ExtraLight.ttf") format("truetype");
}
@font-face {
font-family: "Barlow-ExtraLightItalic";
src: url("../fonts/Barlow-ExtraLightItalic.ttf") format("truetype");
}
@font-face {
font-family: "Barlow-Italic";
src: url("../fonts/Barlow-Italic.ttf") format("truetype");
}
@font-face {
font-family: "Barlow-LightItalic";
src: url("../fonts/Barlow-LightItalic.ttf") format("truetype");
}
@font-face {
font-family: "Barlow-Medium";
src: url("../fonts/Barlow-Medium.ttf") format("truetype");
}
@font-face {
font-family: "Barlow-MediumItalic";
src: url("../fonts/Barlow-MediumItalic.ttf") format("truetype");
}
@font-face {
font-family: "Barlow-Regular";
src: url("../fonts/Barlow-Regular.ttf") format("truetype");
}
@font-face {
font-family: "Barlow-SemiBold";
src: url("../fonts/Barlow-SemiBold.ttf") format("truetype");
}
@font-face {
font-family: "Barlow-SemiBoldItalic";
src: url("../fonts/Barlow-SemiBoldItalic.ttf") format("truetype");
}
@font-face {
font-family: "Barlow-Thin";
src: url("../fonts/Barlow-Thin.ttf") format("truetype");
}
@font-face {
font-family: "Barlow-ThinItalic";
src: url("../fonts/Barlow-ThinItalic.ttf") format("truetype");
}
.active{
color: #5548e0!important;
}
li{
font-family: Barlow-SemiBold;
}
.carousel-indicators li {
width: 12px;
height: 12px;
opacity: 1;
border-radius: 50%;
background: transparent;
display: block;
border: 2px solid white; }
.carousel-indicators li.active {
border: 2px solid white;
background-color: white; } | 24.443662 | 89 | 0.606165 |
3bd48d701213e8150a5e221863233c8330649357 | 450 | h | C | AYRuntime/Classes/AYDeallocNotifier.h | alan-yeh/AYRuntime | 06c5a0a7eaddc9f3331ef7162fdc3de1988067f4 | [
"MIT"
] | 1 | 2016-10-19T07:04:50.000Z | 2016-10-19T07:04:50.000Z | AYRuntime/Classes/AYDeallocNotifier.h | alan-yeh/AYRuntime | 06c5a0a7eaddc9f3331ef7162fdc3de1988067f4 | [
"MIT"
] | null | null | null | AYRuntime/Classes/AYDeallocNotifier.h | alan-yeh/AYRuntime | 06c5a0a7eaddc9f3331ef7162fdc3de1988067f4 | [
"MIT"
] | null | null | null | //
// AYDeallocNotifier.h
// AYRuntime
//
// Created by Alan Yeh on 16/8/3.
//
//
#import <Foundation/Foundation.h>
@interface AYDeallocNotifier : NSObject
@property (nonatomic, strong) NSMutableArray *callbacks;
+ (void)notifyWhenInstanceDelloc:(id)anInstance withCallback:(void (^)(void))callback;
@end
@interface NSObject (AYDeallocNotifier)
- (void)ay_notifyWhenDealloc:(void (^)(void))notification;/**< 当dealloc时,执行${notification}. */
@end | 25 | 94 | 0.735556 |
f919bbc7de7b31266e963d11bc719ab8258bf76c | 283 | sql | SQL | packages/api/prisma/migrations/20220219064214_/migration.sql | ProjectHyde/snaily-cadv4 | 3a68a4ae0907d077ca4abee6c59dc0081a5ba2e4 | [
"MIT"
] | 28 | 2021-10-06T18:11:15.000Z | 2022-03-22T11:57:26.000Z | packages/api/prisma/migrations/20220219064214_/migration.sql | ProjectHyde/snaily-cadv4 | 3a68a4ae0907d077ca4abee6c59dc0081a5ba2e4 | [
"MIT"
] | 380 | 2021-10-05T05:19:12.000Z | 2022-03-31T17:09:45.000Z | packages/api/prisma/migrations/20220219064214_/migration.sql | ProjectHyde/snaily-cadv4 | 3a68a4ae0907d077ca4abee6c59dc0081a5ba2e4 | [
"MIT"
] | 23 | 2021-10-06T18:11:17.000Z | 2022-03-18T17:28:20.000Z | -- AlterTable
ALTER TABLE "DiscordRoles" ADD COLUMN "whitelistedRoleId" TEXT;
-- AddForeignKey
ALTER TABLE "DiscordRoles" ADD CONSTRAINT "DiscordRoles_whitelistedRoleId_fkey" FOREIGN KEY ("whitelistedRoleId") REFERENCES "DiscordRole"("id") ON DELETE SET NULL ON UPDATE CASCADE;
| 47.166667 | 182 | 0.795053 |
79bbf36b52724dce69927d90857110a0d2dd415f | 294 | swift | Swift | it/versions/structures/codable/swift/Foo/V4.swift | nezdolik/reproto | 2d69d8efca518a6ea23a4182b29872fcc62a1a71 | [
"Apache-2.0",
"MIT"
] | 108 | 2017-07-19T02:07:52.000Z | 2022-02-27T04:46:43.000Z | it/versions/structures/codable/swift/Foo/V4.swift | nezdolik/reproto | 2d69d8efca518a6ea23a4182b29872fcc62a1a71 | [
"Apache-2.0",
"MIT"
] | 42 | 2017-11-21T14:21:40.000Z | 2022-02-26T02:40:38.000Z | it/versions/structures/codable/swift/Foo/V4.swift | nezdolik/reproto | 2d69d8efca518a6ea23a4182b29872fcc62a1a71 | [
"Apache-2.0",
"MIT"
] | 9 | 2017-05-26T00:36:23.000Z | 2020-07-26T10:58:20.000Z | public struct Foo_V4_Thing: Codable {
let name: String?
let other: Bar_V1_Other?
let other2: Bar_V20_Other?
let other21: Bar_V21_Other?
enum CodingKeys: String, CodingKey {
case name = "name"
case other = "other"
case other2 = "other2"
case other21 = "other21"
}
}
| 21 | 38 | 0.673469 |
2401cd89e09ad50957cdd406f180b4edb45fbb6d | 370 | asm | Assembly | programs/oeis/183/A183865.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/183/A183865.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/183/A183865.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A183865: n-1+ceiling(3(n+2)/5); complement of A183864.
; 1,4,8,13,19,27,36,46,57,69,83,98,114,131,149,169,190,212,235,259,285,312,340,369,399,431,464,498,533,569,607,646,686,727,769,813,858,904,951,999,1049,1100,1152,1205,1259,1315,1372,1430,1489,1549,1611,1674,1738,1803,1869,1937,2006,2076,2147,2219
mov $1,$0
add $1,1
pow $1,2
mul $1,3
add $1,4
div $1,5
add $1,$0
| 33.636364 | 246 | 0.7 |
e9dfa0bda9f2017ad7c49ad9599587ad3718d305 | 530 | go | Go | orders_test.go | leonelquinteros/woocommerce | 1361d9cd613d1da67bf3f9171d64e9c480bbbb5f | [
"MIT"
] | null | null | null | orders_test.go | leonelquinteros/woocommerce | 1361d9cd613d1da67bf3f9171d64e9c480bbbb5f | [
"MIT"
] | null | null | null | orders_test.go | leonelquinteros/woocommerce | 1361d9cd613d1da67bf3f9171d64e9c480bbbb5f | [
"MIT"
] | 1 | 2021-07-12T14:44:55.000Z | 2021-07-12T14:44:55.000Z | package woocommerce
import (
"net/url"
"testing"
)
func TestGetOrders(t *testing.T) {
c := getTestClient()
params := url.Values{}
params.Set("orderby", "id")
params.Set("order", "desc")
r, err := c.Orders().List(params)
if err != nil {
t.Fatal(err)
}
if len(r) > 0 {
_, err = c.Orders().Get(r[0].ID)
if err != nil {
t.Error(err)
}
ons, err := c.Orders().ListOrderNotes(r[0].ID)
if err != nil {
t.Error(err)
}
if len(ons) > 0 {
_, err = c.Orders().GetOrderNote(r[0].ID, ons[0].ID)
}
}
}
| 15.142857 | 55 | 0.562264 |
1826f14cc59b5ed5062ae56f8a97ed5a2dbbf53c | 40 | lua | Lua | rust/tests/thing.lua | dpp/mu | 12100fa926a620e085b11fd772d518de2de34656 | [
"MIT"
] | 1 | 2021-01-17T17:03:03.000Z | 2021-01-17T17:03:03.000Z | rust/tests/thing.lua | dpp/mu | 12100fa926a620e085b11fd772d518de2de34656 | [
"MIT"
] | 6 | 2021-01-17T17:51:18.000Z | 2021-02-14T21:58:59.000Z | rust/tests/thing.lua | dpp/mutt | 12100fa926a620e085b11fd772d518de2de34656 | [
"MIT"
] | null | null | null | function thing(a)
return a + 42
end
| 10 | 17 | 0.65 |
3946761558bdec9a603f29eb37f81a8a665d9c29 | 957 | html | HTML | manuscript/page-300/body.html | marvindanig/peter-pan | 3ff00116ccaae88990fd4cfb7793aabaef757bd1 | [
"CECILL-B"
] | null | null | null | manuscript/page-300/body.html | marvindanig/peter-pan | 3ff00116ccaae88990fd4cfb7793aabaef757bd1 | [
"CECILL-B"
] | null | null | null | manuscript/page-300/body.html | marvindanig/peter-pan | 3ff00116ccaae88990fd4cfb7793aabaef757bd1 | [
"CECILL-B"
] | null | null | null | <div class="leaf flex"><div class="inner justify"><p>“You will remember about changing your flannels, Peter?” she said, lingering over him. She was always so particular about their flannels.</p><p>“Yes.”</p><p>“And you will take your medicine?”</p><p>“Yes.”</p><p>That seemed to be everything, and an awkward pause followed. Peter, however, was not the kind that breaks down before other people. “Are you ready, Tinker Bell?” he called out.</p><p>“Ay, ay.”</p><p>“Then lead the way.”</p><p>Tink darted up the nearest tree; but no one followed her, for it was at this moment that the pirates made their dreadful attack upon the redskins. Above, where all had been so still, the air was rent with shrieks and the clash of steel. Below, there was dead silence. Mouths opened and remained open. Wendy fell on her knees, but her arms were extended toward Peter.</p></div> </div> | 957 | 957 | 0.746082 |
01e147a20983b5e5e767663206d1ca22e454a5bd | 924 | rs | Rust | src/models/transactions/routing_v1.rs | ci-work/helium-api-rs | dc0393692b02ab5d013ead45aa4e1fdd5ccbe5be | [
"Apache-2.0"
] | 13 | 2020-03-23T01:43:04.000Z | 2022-03-26T23:32:12.000Z | src/models/transactions/routing_v1.rs | ci-work/helium-api-rs | dc0393692b02ab5d013ead45aa4e1fdd5ccbe5be | [
"Apache-2.0"
] | 20 | 2020-09-15T19:13:19.000Z | 2022-02-26T12:53:16.000Z | src/models/transactions/routing_v1.rs | ci-work/helium-api-rs | dc0393692b02ab5d013ead45aa4e1fdd5ccbe5be | [
"Apache-2.0"
] | 18 | 2020-03-23T01:44:06.000Z | 2022-03-23T23:15:07.000Z | use serde::{Deserialize, Serialize};
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct RoutingV1 {
pub fee: u64,
pub oui: u64,
pub hash: String,
pub nonce: u64,
pub owner: String,
pub action: RoutingAction,
}
#[derive(Clone, Serialize, Deserialize, Debug)]
#[serde(tag = "action", rename_all = "snake_case")]
pub enum RoutingAction {
NewXor(NewXor),
UpdateXor(UpdateXor),
UpdateRouters(UpdateRouters),
RequestSubnet(RequestSubnet),
}
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct NewXor {
pub filter: String,
}
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct UpdateXor {
pub filter: String,
pub index: usize,
}
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct UpdateRouters {
pub addresses: Vec<String>,
}
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct RequestSubnet {
pub requested_subnet_size: u64,
}
| 22 | 51 | 0.69697 |
d05d8f04afe57861db35ff9161bc2c84886c93d9 | 1,512 | css | CSS | third_party/jquery/chat/style.css | jeremyosborne/javascript | ca19ab036f76fc35018a4dfc9ac23157c7cc17ab | [
"MIT"
] | null | null | null | third_party/jquery/chat/style.css | jeremyosborne/javascript | ca19ab036f76fc35018a4dfc9ac23157c7cc17ab | [
"MIT"
] | null | null | null | third_party/jquery/chat/style.css | jeremyosborne/javascript | ca19ab036f76fc35018a4dfc9ac23157c7cc17ab | [
"MIT"
] | null | null | null | /* Assumes top of page. */
#page-header h1 {
margin: 0;
text-align: center;
padding: 1em;
font-family: Helvetica, Verdana, Arial, sans-serif;
font-size: 4em;
letter-spacing: 0.1em;
text-align: right;
}
/* Assume the content body of the page. */
#page-body {
width: 70%;
max-width: 768px;
margin: 2em auto;
}
/* Assume bottom of page. */
#page-footer {
padding: 1em;
font-size: 0.8em;
color: #aaa;
text-align: center;
}
.message-history {
padding: 0;
margin: 0;
list-style: none;
}
.message-history .message-container {
padding: 0.3em;
border: 1px solid black;
}
.message-history .message-container:nth-child(even) {
background-color: #ccc;
}
.message-history .message-container .date {
font-size: 80%;
padding: 0.3em;
color: #aaa;
}
.message-history .message-container .user {
padding: 0.3em;
}
.message-history .message-container .user:before {
content: "(";
}
.message-history .message-container .user:after {
content: ")";
}
.message-history .message-container:hover {
text-shadow: 0px 0px 2px #aaa;
box-shadow: inset 0px 0px 1em rgba(150, 150, 180, 0.9);
}
/* Tablet(ish) view. */
@media only screen and (max-width: 960px) {
#page-header h1 {
padding: 0.7em;
}
#page-body {
width: 85%;
}
}
/* Mobile(ish) view. */
@media only screen and (max-width: 500px) {
#page-header h1 {
padding: 0.4em;
}
#page-body {
width: 98%;
}
}
| 18.666667 | 59 | 0.599868 |
9a98da27d7ec69997e729c26fec3c34c1eeb989b | 2,122 | lua | Lua | src/AdiBags_ByExpansion_Shadowlands/dungeons/plaguefall.lua | Geurtje/Adibags_ByExpansion | 561dcec43db5978229329633c3330409b9470128 | [
"Unlicense"
] | null | null | null | src/AdiBags_ByExpansion_Shadowlands/dungeons/plaguefall.lua | Geurtje/Adibags_ByExpansion | 561dcec43db5978229329633c3330409b9470128 | [
"Unlicense"
] | null | null | null | src/AdiBags_ByExpansion_Shadowlands/dungeons/plaguefall.lua | Geurtje/Adibags_ByExpansion | 561dcec43db5978229329633c3330409b9470128 | [
"Unlicense"
] | null | null | null | local AddonName, AddonTable = ...
-- Plaguefall
AddonTable.plaguefall = {
-- Globgrog
181786, -- Eternal Hunger [Potency Conduit]
183506, -- Lethal Poisons [Potency Conduit]
182465, -- Truth's Wake [Potency Conduit]
183486, -- Well-Honed Instincts [Endurance Conduit]
178753, -- Surgical Pustule Extractor
178760, -- Disgested Interrogator's Gaze
178773, -- Plague Handler's Greathelm
178762, -- Blightborne Chain Legguards
178756, -- Stradama's Misplaced Slippers
178770, -- Slimy Consumptive Organ
-- Doctor Ickus
180933, -- Ashen Juggernaut [Potency Conduit]
182140, -- Dissonant Echoes [Potency Conduit]
182752, -- Fel Commando [Potency Conduit]
181455, -- Icy Propulsion [Potency Conduit]
181495, -- Jade Bond [Potency Conduit]
182187, -- Meat Shield [Endurance Conduit]
178752, -- Sophisticated Bonecracker
178759, -- Depraved Physician's Mask
178763, -- Malodorous Gristle-Sown Spaulders
178767, -- Tortured Assistant's Bindings
178775, -- Fleshfused Crushers
178771, -- Phial of Putrefaction
-- Domina Venomblade
182368, -- Demon's Touch [Potency Conduit]
182208, -- Lingering Plague [Potency Conduit]
183167, -- Strength of the Pack [Potency Conduit]
178929, -- Halberd of the Aranakk
178928, -- Domina's Oozing Shiv
178934, -- Fastened Venombarb Binds
178930, -- Mitts of Flawless Duplication
178932, -- Belt of Wretched Manipulations
178931, -- Scarred Bloodbound Girdle
178933, -- Arachnid Cipher Ring
-- Margrave Stradama
182747, -- Cold Embrace [Potency Conduit]
181943, -- Eradicating Blow [Potency Conduit]
183478, -- Fury of the Skies [Potency Conduit]
181504, -- Infernal Cascade [Potency Conduit]
182139, -- Rapid Shadows [Potency Conduit]
178754, -- Poxstorm, Longsword of Pestilence
178764, -- Plagueborne Shoulderguards
178755, -- Blighted Margrave's Cloak
178757, -- Gloves of Obscure Rituals
178761, -- Leggings of the Erudite Scholar
178774, -- Muckwallow Stompers
178769, -- Infinitely Divisible Ooze
}
| 39.296296 | 55 | 0.689444 |
460e89e4b10092165ab4498477bbb3cbbce04e10 | 146 | swift | Swift | Octomate Prototype/Data/Model/Login.swift | comprimasantosa/ios-swift-octomateprototype | 2dec1de080a438344196ae2ba362c31e606c3543 | [
"MIT"
] | null | null | null | Octomate Prototype/Data/Model/Login.swift | comprimasantosa/ios-swift-octomateprototype | 2dec1de080a438344196ae2ba362c31e606c3543 | [
"MIT"
] | null | null | null | Octomate Prototype/Data/Model/Login.swift | comprimasantosa/ios-swift-octomateprototype | 2dec1de080a438344196ae2ba362c31e606c3543 | [
"MIT"
] | null | null | null | //
// Login.swift
// Octomate Prototype
//
// Created by Prima Santosa on 21/05/21.
//
import Foundation
struct Login {
let name: String
}
| 11.230769 | 41 | 0.657534 |
0a1041da43842181a16b1df3f23d3be433eb500e | 15,883 | c | C | lib/linux-5.18-rc3-smdk/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c | OpenMPDK/SMDK | 8f19d32d999731242cb1ab116a4cb445d9993b15 | [
"BSD-3-Clause"
] | 44 | 2022-03-16T08:32:31.000Z | 2022-03-31T16:02:35.000Z | releases/hanggai/src/linux-5.18/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c | marmolak/gray486linux | 6403fc9d12cf6e8c6f42213ae287bc1e19b83e60 | [
"BSD-2-Clause"
] | 1 | 2022-03-29T02:30:28.000Z | 2022-03-30T03:40:46.000Z | releases/hanggai/src/linux-5.18/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c | marmolak/gray486linux | 6403fc9d12cf6e8c6f42213ae287bc1e19b83e60 | [
"BSD-2-Clause"
] | 18 | 2022-03-19T04:41:04.000Z | 2022-03-31T03:32:12.000Z | // SPDX-License-Identifier: GPL-2.0+
#include <linux/ptp_classify.h>
#include "lan966x_main.h"
#define LAN966X_MAX_PTP_ID 512
/* Represents 1ppm adjustment in 2^59 format with 6.037735849ns as reference
* The value is calculated as following: (1/1000000)/((2^-59)/6.037735849)
*/
#define LAN966X_1PPM_FORMAT 3480517749723LL
/* Represents 1ppb adjustment in 2^29 format with 6.037735849ns as reference
* The value is calculated as following: (1/1000000000)/((2^59)/6.037735849)
*/
#define LAN966X_1PPB_FORMAT 3480517749LL
#define TOD_ACC_PIN 0x5
enum {
PTP_PIN_ACTION_IDLE = 0,
PTP_PIN_ACTION_LOAD,
PTP_PIN_ACTION_SAVE,
PTP_PIN_ACTION_CLOCK,
PTP_PIN_ACTION_DELTA,
PTP_PIN_ACTION_TOD
};
static u64 lan966x_ptp_get_nominal_value(void)
{
/* This is the default value that for each system clock, the time of day
* is increased. It has the format 5.59 nanosecond.
*/
return 0x304d4873ecade305;
}
int lan966x_ptp_hwtstamp_set(struct lan966x_port *port, struct ifreq *ifr)
{
struct lan966x *lan966x = port->lan966x;
struct hwtstamp_config cfg;
struct lan966x_phc *phc;
/* For now don't allow to run ptp on ports that are part of a bridge,
* because in case of transparent clock the HW will still forward the
* frames, so there would be duplicate frames
*/
if (lan966x->bridge_mask & BIT(port->chip_port))
return -EINVAL;
if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg)))
return -EFAULT;
switch (cfg.tx_type) {
case HWTSTAMP_TX_ON:
port->ptp_cmd = IFH_REW_OP_TWO_STEP_PTP;
break;
case HWTSTAMP_TX_ONESTEP_SYNC:
port->ptp_cmd = IFH_REW_OP_ONE_STEP_PTP;
break;
case HWTSTAMP_TX_OFF:
port->ptp_cmd = IFH_REW_OP_NOOP;
break;
default:
return -ERANGE;
}
switch (cfg.rx_filter) {
case HWTSTAMP_FILTER_NONE:
break;
case HWTSTAMP_FILTER_ALL:
case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
case HWTSTAMP_FILTER_PTP_V2_EVENT:
case HWTSTAMP_FILTER_PTP_V2_SYNC:
case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
case HWTSTAMP_FILTER_NTP_ALL:
cfg.rx_filter = HWTSTAMP_FILTER_ALL;
break;
default:
return -ERANGE;
}
/* Commit back the result & save it */
mutex_lock(&lan966x->ptp_lock);
phc = &lan966x->phc[LAN966X_PHC_PORT];
memcpy(&phc->hwtstamp_config, &cfg, sizeof(cfg));
mutex_unlock(&lan966x->ptp_lock);
return copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg)) ? -EFAULT : 0;
}
int lan966x_ptp_hwtstamp_get(struct lan966x_port *port, struct ifreq *ifr)
{
struct lan966x *lan966x = port->lan966x;
struct lan966x_phc *phc;
phc = &lan966x->phc[LAN966X_PHC_PORT];
return copy_to_user(ifr->ifr_data, &phc->hwtstamp_config,
sizeof(phc->hwtstamp_config)) ? -EFAULT : 0;
}
static int lan966x_ptp_classify(struct lan966x_port *port, struct sk_buff *skb)
{
struct ptp_header *header;
u8 msgtype;
int type;
if (port->ptp_cmd == IFH_REW_OP_NOOP)
return IFH_REW_OP_NOOP;
type = ptp_classify_raw(skb);
if (type == PTP_CLASS_NONE)
return IFH_REW_OP_NOOP;
header = ptp_parse_header(skb, type);
if (!header)
return IFH_REW_OP_NOOP;
if (port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP)
return IFH_REW_OP_TWO_STEP_PTP;
/* If it is sync and run 1 step then set the correct operation,
* otherwise run as 2 step
*/
msgtype = ptp_get_msgtype(header, type);
if ((msgtype & 0xf) == 0)
return IFH_REW_OP_ONE_STEP_PTP;
return IFH_REW_OP_TWO_STEP_PTP;
}
static void lan966x_ptp_txtstamp_old_release(struct lan966x_port *port)
{
struct sk_buff *skb, *skb_tmp;
unsigned long flags;
spin_lock_irqsave(&port->tx_skbs.lock, flags);
skb_queue_walk_safe(&port->tx_skbs, skb, skb_tmp) {
if time_after(LAN966X_SKB_CB(skb)->jiffies + LAN966X_PTP_TIMEOUT,
jiffies)
break;
__skb_unlink(skb, &port->tx_skbs);
dev_kfree_skb_any(skb);
}
spin_unlock_irqrestore(&port->tx_skbs.lock, flags);
}
int lan966x_ptp_txtstamp_request(struct lan966x_port *port,
struct sk_buff *skb)
{
struct lan966x *lan966x = port->lan966x;
unsigned long flags;
u8 rew_op;
rew_op = lan966x_ptp_classify(port, skb);
LAN966X_SKB_CB(skb)->rew_op = rew_op;
if (rew_op != IFH_REW_OP_TWO_STEP_PTP)
return 0;
lan966x_ptp_txtstamp_old_release(port);
spin_lock_irqsave(&lan966x->ptp_ts_id_lock, flags);
if (lan966x->ptp_skbs == LAN966X_MAX_PTP_ID) {
spin_unlock_irqrestore(&lan966x->ptp_ts_id_lock, flags);
return -EBUSY;
}
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
skb_queue_tail(&port->tx_skbs, skb);
LAN966X_SKB_CB(skb)->ts_id = port->ts_id;
LAN966X_SKB_CB(skb)->jiffies = jiffies;
lan966x->ptp_skbs++;
port->ts_id++;
if (port->ts_id == LAN966X_MAX_PTP_ID)
port->ts_id = 0;
spin_unlock_irqrestore(&lan966x->ptp_ts_id_lock, flags);
return 0;
}
void lan966x_ptp_txtstamp_release(struct lan966x_port *port,
struct sk_buff *skb)
{
struct lan966x *lan966x = port->lan966x;
unsigned long flags;
spin_lock_irqsave(&lan966x->ptp_ts_id_lock, flags);
port->ts_id--;
lan966x->ptp_skbs--;
skb_unlink(skb, &port->tx_skbs);
spin_unlock_irqrestore(&lan966x->ptp_ts_id_lock, flags);
}
static void lan966x_get_hwtimestamp(struct lan966x *lan966x,
struct timespec64 *ts,
u32 nsec)
{
/* Read current PTP time to get seconds */
unsigned long flags;
u32 curr_nsec;
spin_lock_irqsave(&lan966x->ptp_clock_lock, flags);
lan_rmw(PTP_PIN_CFG_PIN_ACTION_SET(PTP_PIN_ACTION_SAVE) |
PTP_PIN_CFG_PIN_DOM_SET(LAN966X_PHC_PORT) |
PTP_PIN_CFG_PIN_SYNC_SET(0),
PTP_PIN_CFG_PIN_ACTION |
PTP_PIN_CFG_PIN_DOM |
PTP_PIN_CFG_PIN_SYNC,
lan966x, PTP_PIN_CFG(TOD_ACC_PIN));
ts->tv_sec = lan_rd(lan966x, PTP_TOD_SEC_LSB(TOD_ACC_PIN));
curr_nsec = lan_rd(lan966x, PTP_TOD_NSEC(TOD_ACC_PIN));
ts->tv_nsec = nsec;
/* Sec has incremented since the ts was registered */
if (curr_nsec < nsec)
ts->tv_sec--;
spin_unlock_irqrestore(&lan966x->ptp_clock_lock, flags);
}
irqreturn_t lan966x_ptp_irq_handler(int irq, void *args)
{
int budget = LAN966X_MAX_PTP_ID;
struct lan966x *lan966x = args;
while (budget--) {
struct sk_buff *skb, *skb_tmp, *skb_match = NULL;
struct skb_shared_hwtstamps shhwtstamps;
struct lan966x_port *port;
struct timespec64 ts;
unsigned long flags;
u32 val, id, txport;
u32 delay;
val = lan_rd(lan966x, PTP_TWOSTEP_CTRL);
/* Check if a timestamp can be retrieved */
if (!(val & PTP_TWOSTEP_CTRL_VLD))
break;
WARN_ON(val & PTP_TWOSTEP_CTRL_OVFL);
if (!(val & PTP_TWOSTEP_CTRL_STAMP_TX))
continue;
/* Retrieve the ts Tx port */
txport = PTP_TWOSTEP_CTRL_STAMP_PORT_GET(val);
/* Retrieve its associated skb */
port = lan966x->ports[txport];
/* Retrieve the delay */
delay = lan_rd(lan966x, PTP_TWOSTEP_STAMP);
delay = PTP_TWOSTEP_STAMP_STAMP_NSEC_GET(delay);
/* Get next timestamp from fifo, which needs to be the
* rx timestamp which represents the id of the frame
*/
lan_rmw(PTP_TWOSTEP_CTRL_NXT_SET(1),
PTP_TWOSTEP_CTRL_NXT,
lan966x, PTP_TWOSTEP_CTRL);
val = lan_rd(lan966x, PTP_TWOSTEP_CTRL);
/* Check if a timestamp can be retried */
if (!(val & PTP_TWOSTEP_CTRL_VLD))
break;
/* Read RX timestamping to get the ID */
id = lan_rd(lan966x, PTP_TWOSTEP_STAMP);
spin_lock_irqsave(&port->tx_skbs.lock, flags);
skb_queue_walk_safe(&port->tx_skbs, skb, skb_tmp) {
if (LAN966X_SKB_CB(skb)->ts_id != id)
continue;
__skb_unlink(skb, &port->tx_skbs);
skb_match = skb;
break;
}
spin_unlock_irqrestore(&port->tx_skbs.lock, flags);
/* Next ts */
lan_rmw(PTP_TWOSTEP_CTRL_NXT_SET(1),
PTP_TWOSTEP_CTRL_NXT,
lan966x, PTP_TWOSTEP_CTRL);
if (WARN_ON(!skb_match))
continue;
spin_lock(&lan966x->ptp_ts_id_lock);
lan966x->ptp_skbs--;
spin_unlock(&lan966x->ptp_ts_id_lock);
/* Get the h/w timestamp */
lan966x_get_hwtimestamp(lan966x, &ts, delay);
/* Set the timestamp into the skb */
shhwtstamps.hwtstamp = ktime_set(ts.tv_sec, ts.tv_nsec);
skb_tstamp_tx(skb_match, &shhwtstamps);
dev_kfree_skb_any(skb_match);
}
return IRQ_HANDLED;
}
static int lan966x_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
{
struct lan966x_phc *phc = container_of(ptp, struct lan966x_phc, info);
struct lan966x *lan966x = phc->lan966x;
unsigned long flags;
bool neg_adj = 0;
u64 tod_inc;
u64 ref;
if (!scaled_ppm)
return 0;
if (scaled_ppm < 0) {
neg_adj = 1;
scaled_ppm = -scaled_ppm;
}
tod_inc = lan966x_ptp_get_nominal_value();
/* The multiplication is split in 2 separate additions because of
* overflow issues. If scaled_ppm with 16bit fractional part was bigger
* than 20ppm then we got overflow.
*/
ref = LAN966X_1PPM_FORMAT * (scaled_ppm >> 16);
ref += (LAN966X_1PPM_FORMAT * (0xffff & scaled_ppm)) >> 16;
tod_inc = neg_adj ? tod_inc - ref : tod_inc + ref;
spin_lock_irqsave(&lan966x->ptp_clock_lock, flags);
lan_rmw(PTP_DOM_CFG_CLKCFG_DIS_SET(1 << BIT(phc->index)),
PTP_DOM_CFG_CLKCFG_DIS,
lan966x, PTP_DOM_CFG);
lan_wr((u32)tod_inc & 0xFFFFFFFF, lan966x,
PTP_CLK_PER_CFG(phc->index, 0));
lan_wr((u32)(tod_inc >> 32), lan966x,
PTP_CLK_PER_CFG(phc->index, 1));
lan_rmw(PTP_DOM_CFG_CLKCFG_DIS_SET(0),
PTP_DOM_CFG_CLKCFG_DIS,
lan966x, PTP_DOM_CFG);
spin_unlock_irqrestore(&lan966x->ptp_clock_lock, flags);
return 0;
}
static int lan966x_ptp_settime64(struct ptp_clock_info *ptp,
const struct timespec64 *ts)
{
struct lan966x_phc *phc = container_of(ptp, struct lan966x_phc, info);
struct lan966x *lan966x = phc->lan966x;
unsigned long flags;
spin_lock_irqsave(&lan966x->ptp_clock_lock, flags);
/* Must be in IDLE mode before the time can be loaded */
lan_rmw(PTP_PIN_CFG_PIN_ACTION_SET(PTP_PIN_ACTION_IDLE) |
PTP_PIN_CFG_PIN_DOM_SET(phc->index) |
PTP_PIN_CFG_PIN_SYNC_SET(0),
PTP_PIN_CFG_PIN_ACTION |
PTP_PIN_CFG_PIN_DOM |
PTP_PIN_CFG_PIN_SYNC,
lan966x, PTP_PIN_CFG(TOD_ACC_PIN));
/* Set new value */
lan_wr(PTP_TOD_SEC_MSB_TOD_SEC_MSB_SET(upper_32_bits(ts->tv_sec)),
lan966x, PTP_TOD_SEC_MSB(TOD_ACC_PIN));
lan_wr(lower_32_bits(ts->tv_sec),
lan966x, PTP_TOD_SEC_LSB(TOD_ACC_PIN));
lan_wr(ts->tv_nsec, lan966x, PTP_TOD_NSEC(TOD_ACC_PIN));
/* Apply new values */
lan_rmw(PTP_PIN_CFG_PIN_ACTION_SET(PTP_PIN_ACTION_LOAD) |
PTP_PIN_CFG_PIN_DOM_SET(phc->index) |
PTP_PIN_CFG_PIN_SYNC_SET(0),
PTP_PIN_CFG_PIN_ACTION |
PTP_PIN_CFG_PIN_DOM |
PTP_PIN_CFG_PIN_SYNC,
lan966x, PTP_PIN_CFG(TOD_ACC_PIN));
spin_unlock_irqrestore(&lan966x->ptp_clock_lock, flags);
return 0;
}
static int lan966x_ptp_gettime64(struct ptp_clock_info *ptp,
struct timespec64 *ts)
{
struct lan966x_phc *phc = container_of(ptp, struct lan966x_phc, info);
struct lan966x *lan966x = phc->lan966x;
unsigned long flags;
time64_t s;
s64 ns;
spin_lock_irqsave(&lan966x->ptp_clock_lock, flags);
lan_rmw(PTP_PIN_CFG_PIN_ACTION_SET(PTP_PIN_ACTION_SAVE) |
PTP_PIN_CFG_PIN_DOM_SET(phc->index) |
PTP_PIN_CFG_PIN_SYNC_SET(0),
PTP_PIN_CFG_PIN_ACTION |
PTP_PIN_CFG_PIN_DOM |
PTP_PIN_CFG_PIN_SYNC,
lan966x, PTP_PIN_CFG(TOD_ACC_PIN));
s = lan_rd(lan966x, PTP_TOD_SEC_MSB(TOD_ACC_PIN));
s <<= 32;
s |= lan_rd(lan966x, PTP_TOD_SEC_LSB(TOD_ACC_PIN));
ns = lan_rd(lan966x, PTP_TOD_NSEC(TOD_ACC_PIN));
ns &= PTP_TOD_NSEC_TOD_NSEC;
spin_unlock_irqrestore(&lan966x->ptp_clock_lock, flags);
/* Deal with negative values */
if ((ns & 0xFFFFFFF0) == 0x3FFFFFF0) {
s--;
ns &= 0xf;
ns += 999999984;
}
set_normalized_timespec64(ts, s, ns);
return 0;
}
static int lan966x_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
{
struct lan966x_phc *phc = container_of(ptp, struct lan966x_phc, info);
struct lan966x *lan966x = phc->lan966x;
if (delta > -(NSEC_PER_SEC / 2) && delta < (NSEC_PER_SEC / 2)) {
unsigned long flags;
spin_lock_irqsave(&lan966x->ptp_clock_lock, flags);
/* Must be in IDLE mode before the time can be loaded */
lan_rmw(PTP_PIN_CFG_PIN_ACTION_SET(PTP_PIN_ACTION_IDLE) |
PTP_PIN_CFG_PIN_DOM_SET(phc->index) |
PTP_PIN_CFG_PIN_SYNC_SET(0),
PTP_PIN_CFG_PIN_ACTION |
PTP_PIN_CFG_PIN_DOM |
PTP_PIN_CFG_PIN_SYNC,
lan966x, PTP_PIN_CFG(TOD_ACC_PIN));
lan_wr(PTP_TOD_NSEC_TOD_NSEC_SET(delta),
lan966x, PTP_TOD_NSEC(TOD_ACC_PIN));
/* Adjust time with the value of PTP_TOD_NSEC */
lan_rmw(PTP_PIN_CFG_PIN_ACTION_SET(PTP_PIN_ACTION_DELTA) |
PTP_PIN_CFG_PIN_DOM_SET(phc->index) |
PTP_PIN_CFG_PIN_SYNC_SET(0),
PTP_PIN_CFG_PIN_ACTION |
PTP_PIN_CFG_PIN_DOM |
PTP_PIN_CFG_PIN_SYNC,
lan966x, PTP_PIN_CFG(TOD_ACC_PIN));
spin_unlock_irqrestore(&lan966x->ptp_clock_lock, flags);
} else {
/* Fall back using lan966x_ptp_settime64 which is not exact */
struct timespec64 ts;
u64 now;
lan966x_ptp_gettime64(ptp, &ts);
now = ktime_to_ns(timespec64_to_ktime(ts));
ts = ns_to_timespec64(now + delta);
lan966x_ptp_settime64(ptp, &ts);
}
return 0;
}
static struct ptp_clock_info lan966x_ptp_clock_info = {
.owner = THIS_MODULE,
.name = "lan966x ptp",
.max_adj = 200000,
.gettime64 = lan966x_ptp_gettime64,
.settime64 = lan966x_ptp_settime64,
.adjtime = lan966x_ptp_adjtime,
.adjfine = lan966x_ptp_adjfine,
};
static int lan966x_ptp_phc_init(struct lan966x *lan966x,
int index,
struct ptp_clock_info *clock_info)
{
struct lan966x_phc *phc = &lan966x->phc[index];
phc->info = *clock_info;
phc->clock = ptp_clock_register(&phc->info, lan966x->dev);
if (IS_ERR(phc->clock))
return PTR_ERR(phc->clock);
phc->index = index;
phc->lan966x = lan966x;
/* PTP Rx stamping is always enabled. */
phc->hwtstamp_config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
return 0;
}
int lan966x_ptp_init(struct lan966x *lan966x)
{
u64 tod_adj = lan966x_ptp_get_nominal_value();
struct lan966x_port *port;
int err, i;
if (!lan966x->ptp)
return 0;
for (i = 0; i < LAN966X_PHC_COUNT; ++i) {
err = lan966x_ptp_phc_init(lan966x, i, &lan966x_ptp_clock_info);
if (err)
return err;
}
spin_lock_init(&lan966x->ptp_clock_lock);
spin_lock_init(&lan966x->ptp_ts_id_lock);
mutex_init(&lan966x->ptp_lock);
/* Disable master counters */
lan_wr(PTP_DOM_CFG_ENA_SET(0), lan966x, PTP_DOM_CFG);
/* Configure the nominal TOD increment per clock cycle */
lan_rmw(PTP_DOM_CFG_CLKCFG_DIS_SET(0x7),
PTP_DOM_CFG_CLKCFG_DIS,
lan966x, PTP_DOM_CFG);
for (i = 0; i < LAN966X_PHC_COUNT; ++i) {
lan_wr((u32)tod_adj & 0xFFFFFFFF, lan966x,
PTP_CLK_PER_CFG(i, 0));
lan_wr((u32)(tod_adj >> 32), lan966x,
PTP_CLK_PER_CFG(i, 1));
}
lan_rmw(PTP_DOM_CFG_CLKCFG_DIS_SET(0),
PTP_DOM_CFG_CLKCFG_DIS,
lan966x, PTP_DOM_CFG);
/* Enable master counters */
lan_wr(PTP_DOM_CFG_ENA_SET(0x7), lan966x, PTP_DOM_CFG);
for (i = 0; i < lan966x->num_phys_ports; i++) {
port = lan966x->ports[i];
if (!port)
continue;
skb_queue_head_init(&port->tx_skbs);
}
return 0;
}
void lan966x_ptp_deinit(struct lan966x *lan966x)
{
struct lan966x_port *port;
int i;
for (i = 0; i < lan966x->num_phys_ports; i++) {
port = lan966x->ports[i];
if (!port)
continue;
skb_queue_purge(&port->tx_skbs);
}
for (i = 0; i < LAN966X_PHC_COUNT; ++i)
ptp_clock_unregister(lan966x->phc[i].clock);
}
void lan966x_ptp_rxtstamp(struct lan966x *lan966x, struct sk_buff *skb,
u64 timestamp)
{
struct skb_shared_hwtstamps *shhwtstamps;
struct lan966x_phc *phc;
struct timespec64 ts;
u64 full_ts_in_ns;
if (!lan966x->ptp)
return;
phc = &lan966x->phc[LAN966X_PHC_PORT];
lan966x_ptp_gettime64(&phc->info, &ts);
/* Drop the sub-ns precision */
timestamp = timestamp >> 2;
if (ts.tv_nsec < timestamp)
ts.tv_sec--;
ts.tv_nsec = timestamp;
full_ts_in_ns = ktime_set(ts.tv_sec, ts.tv_nsec);
shhwtstamps = skb_hwtstamps(skb);
shhwtstamps->hwtstamp = full_ts_in_ns;
}
| 25.659128 | 79 | 0.739533 |
fb69779b88dfaca4ff3ebbd111c837a682480ad2 | 834 | h | C | Src/global.h | pbuteau/jtag-boundary-scan | f7f5f4d17e4bad36b838a141b9199cb7245a0e8b | [
"MIT"
] | null | null | null | Src/global.h | pbuteau/jtag-boundary-scan | f7f5f4d17e4bad36b838a141b9199cb7245a0e8b | [
"MIT"
] | null | null | null | Src/global.h | pbuteau/jtag-boundary-scan | f7f5f4d17e4bad36b838a141b9199cb7245a0e8b | [
"MIT"
] | null | null | null | #ifndef _GLOBAL_H
#define _GLOBAL_H
#include "TAP.h"
extern JtagState jtagState;
typedef enum{
BYPASS,
IDCODE,
SAMPLE_PRELOAD,
EXTEST,
DONT_CARE,
}JTAGInstruction;
// Instruction MACROs
#define CORTEX_M3_JTAG_INSTRUCTION_LENGTH 9
#define BYPASS_BOTH_TAP 0b111111111
#define READ_BOTH_IDCODE 0b000011110
#define READ_BSC_IDCODE_BYPASS_M3_TAP 0b000011111
#define BYPASS_BSC_TAP_READ_M3_IDCODE 0b111111110
#define SAMPLE_PRELOAD_BSC_TAP_BYPASS_M3_TAP 0b000101111
#define EXTEST_BSC_TAP_BYPASS_M3_TAP 0b000001111
// Miscellaneous MACROs
#define DUMMY_DATA 0x1234abcd
#define CORTEX_M3_BOUNDARY_SCAN_CELL_LENGTH 232
#define DISVAL 1
#define NUMBER_OF_TAPS 2
#define BUFFER_SIZE 1024
#define BSCELL_STR_LENGTH 16
void jtagSetIr(JTAGInstruction instruction);
void jtagDelay(uint32_t cycles);
#endif // _GLOBAL_H
| 19.395349 | 56 | 0.830935 |
2a3eb9e20e700e5a4caa9e5aa5f34d23b82b5a06 | 2,715 | java | Java | cloudgraph-rdb/src/main/java/org/cloudgraph/rdb/connect/JNDIDataSourceProvider.java | cloudgraph/cloudgraph | d81d0192c354c7ea755363b8ce8b9605e924792f | [
"ECL-2.0",
"Apache-2.0"
] | 14 | 2017-07-21T03:01:10.000Z | 2022-01-16T20:40:02.000Z | cloudgraph-rdb/src/main/java/org/cloudgraph/rdb/connect/JNDIDataSourceProvider.java | cloudgraph/cloudgraph | d81d0192c354c7ea755363b8ce8b9605e924792f | [
"ECL-2.0",
"Apache-2.0"
] | 46 | 2017-07-31T02:16:22.000Z | 2022-03-13T19:05:13.000Z | cloudgraph-rdb/src/main/java/org/cloudgraph/rdb/connect/JNDIDataSourceProvider.java | cloudgraph/cloudgraph | d81d0192c354c7ea755363b8ce8b9605e924792f | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | /**
* Copyright 2017 TerraMeta Software, 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.
*/
package org.cloudgraph.rdb.connect;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.plasma.runtime.ConfigurationConstants;
import org.plasma.runtime.DataAccessProviderName;
import org.plasma.runtime.PlasmaRuntime;
import org.plasma.runtime.Property;
import org.plasma.sdo.access.DataAccessException;
/**
* Supplies connections using a JNDI registered datasource.
*/
public class JNDIDataSourceProvider implements DataSourceProvder {
private static final Log log = LogFactory.getLog(JNDIDataSourceProvider.class);
protected DataSource datasource;
public JNDIDataSourceProvider() {
Properties props = new Properties();
for (Property property : PlasmaRuntime.getInstance()
.getDataAccessProvider(DataAccessProviderName.JDBC).getProperties()) {
props.put(property.getName(), property.getValue());
}
String datasourceName = props.getProperty(ConfigurationConstants.JDBC_DATASOURCE_NAME);
if (datasourceName == null)
throw new DataAccessException("cannot lookup datasource - datasource name property '"
+ ConfigurationConstants.JDBC_DATASOURCE_NAME + "' not found in configuration for "
+ "data access provider '" + DataAccessProviderName.JDBC.name()
+ "' - a fully qualified JNDI name is required");
try {
Context initialContext = new InitialContext();
this.datasource = (DataSource) initialContext.lookup(datasourceName);
if (this.datasource == null) {
throw new DataAccessException("cannot lookup datasource '" + datasourceName + "'");
}
} catch (NamingException ex) {
log.error("cannot lookup datasource '" + datasourceName + "'", ex);
throw new DataAccessException(ex);
}
}
@Override
public Connection getConnection() throws SQLException {
return this.datasource.getConnection();
}
}
| 37.191781 | 93 | 0.74291 |
32feb3b5e9696ba351c7164c11428d5acc59366d | 2,657 | kt | Kotlin | rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/ISymbolTable.kt | benetti-smeup/jariko | c11a45fa2b540df092abf94b0ab1014ca1ef3410 | [
"Apache-2.0"
] | 40 | 2019-11-26T16:35:55.000Z | 2022-02-15T08:35:20.000Z | rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/ISymbolTable.kt | benetti-smeup/jariko | c11a45fa2b540df092abf94b0ab1014ca1ef3410 | [
"Apache-2.0"
] | 28 | 2019-12-02T13:32:20.000Z | 2021-12-17T09:34:56.000Z | rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/ISymbolTable.kt | benetti-smeup/jariko | c11a45fa2b540df092abf94b0ab1014ca1ef3410 | [
"Apache-2.0"
] | 9 | 2019-12-10T06:40:59.000Z | 2021-10-18T08:55:29.000Z | /*
* Copyright 2019 Sme.UP S.p.A.
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.smeup.rpgparser.interpreter
interface ISymbolTable {
var parentSymbolTable: ISymbolTable?
/**
* Get the program symbol table, which is the one without parentSymbolTable
* */
val programSymbolTable: ISymbolTable
get() {
return if (parentSymbolTable == null) {
this
} else {
var currentParent = parentSymbolTable
var rootSymbolTable = this
while (currentParent != null) {
rootSymbolTable = currentParent
currentParent = currentParent.parentSymbolTable
}
rootSymbolTable
}
}
/**
* @return true if SymbolTable contains a variable named dataName
* */
operator fun contains(dataName: String): Boolean
/**
* @return true if SymbolTable contains the datadefinition
* */
operator fun contains(data: AbstractDataDefinition): Boolean
/**
* @return value associated to data
* */
operator fun get(data: AbstractDataDefinition): Value
/**
* @return value associated to variable named dataName
* */
operator fun get(dataName: String): Value
/**
* @return if exists a datadefinition by variable name
* */
fun dataDefinitionByName(dataName: String): AbstractDataDefinition?
/**
* Set a value for data.
* @return old value if presents
* */
operator fun set(data: AbstractDataDefinition, value: Value): Value?
/**
* @return All symbol table values
* */
fun getValues(): Map<AbstractDataDefinition, Value>
/**
* Clear symbol table.
* */
fun clear()
/**
* @return if is empty
* */
fun isEmpty(): Boolean
}
fun Value.forType(type: Type): Value {
if (type is StringType && this is StringValue) {
if (type.varying) {
// this.trimEnd()
} else {
if (this.value.length < type.length) this.pad(type.length)
}
}
return this
} | 27.391753 | 79 | 0.61385 |
6209caefebf7e4ba3144c0eb43f321e08d6f5453 | 264 | swift | Swift | NimbleMedium/Sources/Domain/Parameters/CreateArticleParameters.swift | nimblehq/nimble-medium-ios | d0014f8fd9641ac919122c8b747b55dd0b0f6998 | [
"MIT"
] | 1 | 2022-03-09T04:36:41.000Z | 2022-03-09T04:36:41.000Z | NimbleMedium/Sources/Domain/Parameters/CreateArticleParameters.swift | nimblehq/nimble-medium-ios | d0014f8fd9641ac919122c8b747b55dd0b0f6998 | [
"MIT"
] | 221 | 2021-08-05T09:07:20.000Z | 2021-12-03T04:48:28.000Z | NimbleMedium/Sources/Domain/Parameters/CreateArticleParameters.swift | nimblehq/nimble-medium-ios | d0014f8fd9641ac919122c8b747b55dd0b0f6998 | [
"MIT"
] | null | null | null | //
// CreateArticleParameters.swift
// NimbleMedium
//
// Created by Minh Pham on 18/10/2021.
//
import Foundation
struct CreateArticleParameters: Encodable {
let title: String
let description: String
let body: String
let tagList: [String]
}
| 15.529412 | 43 | 0.69697 |
1f9137841192347e5ab7a640c86ddb351db5de06 | 2,136 | htm | HTML | Help/Source/documentationview.htm | sajithanangolath/pyscripter | 00a9ba8a1c8357df6e055dd79fa8065702f3b211 | [
"MIT"
] | 769 | 2015-08-26T03:24:37.000Z | 2022-03-31T15:58:00.000Z | Help/Source/documentationview.htm | sajithanangolath/pyscripter | 00a9ba8a1c8357df6e055dd79fa8065702f3b211 | [
"MIT"
] | 392 | 2015-08-31T05:36:28.000Z | 2022-03-24T10:05:21.000Z | Help/Source/documentationview.htm | sajithanangolath/pyscripter | 00a9ba8a1c8357df6e055dd79fa8065702f3b211 | [
"MIT"
] | 311 | 2015-08-26T17:42:06.000Z | 2022-03-22T16:32:17.000Z | <html><head>
<title>Documentation View</title>
<meta name="generator" content="HelpMaker.net">
<meta name="keywords" content="Source Code Views,Documentation View,pydocProgrammer Utilities"></head>
<body bgcolor="#FFFCEA">
<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#C0C0C0">
<tr>
<td align="left">
<div align="left"><font face="Arial" color="#010101" size="4"><span style=" font-size:14pt; font-family:Arial; color:#010101">Documentation View</span></font></div>
</td>
<td align="right">
<font face="Arial" size="2">
<a href="findreferences.htm">Previous</a> <a href="pyscripter.htm">Top</a> <a href="disassemblyview.htm">Next</a>
</font>
</td>
</tr></table>
<hr><div align="left"><font face="Arial" color="#010101" size="2"><span style=" font-size:10pt; font-family:Arial; color:#010101">PyScripter can use the standard Python module pydoc to generate HTML documentation for
Python Modules. This feature is available from the "Source Code Views" submenu of the </span></font><a href="toolsmenu.htm"><font face="Arial" color="#0000ff" size="2"><span style=" font-size:10pt; font-family:Arial; color:#0000ff"><u>Tools menu</u></span></font></a><font face="Arial" color="#010101" size="2"><span style=" font-size:10pt; font-family:Arial; color:#010101">. The HTML documentation is displayed using
an internal browser. You can use
the toolbar buttons to print preview, print or save the HTML file. To close the documentation
view, right-click on the "Doc" tab and select "Close".</span></font></div><div align="left"><font face="Arial" color="#010101" size="2"><span style=" font-size:10pt; font-family:Arial; color:#010101"><br></span></font></div><div align="left"><font face="Arial" color="#010101" size="2"><span style=" font-size:10pt; font-family:Arial; color:#010101"><br></span></font></div><div align="center"><img src="documentationview1.JPG" style="width:36.88em; height:22.69em" border="0" alt="graphic"></div>
</body></html>
| 85.44 | 525 | 0.677903 |
8f011ae0b46690c5475b6b8364778fcc14197550 | 1,137 | java | Java | bkc-model/src/main/java/cn/bitflash/entity/UserComplaintBean.java | mrchen210282/springcloud | b882d2b1938cacc2bc56b8602e40c2ea2b3c62e4 | [
"Apache-2.0"
] | null | null | null | bkc-model/src/main/java/cn/bitflash/entity/UserComplaintBean.java | mrchen210282/springcloud | b882d2b1938cacc2bc56b8602e40c2ea2b3c62e4 | [
"Apache-2.0"
] | null | null | null | bkc-model/src/main/java/cn/bitflash/entity/UserComplaintBean.java | mrchen210282/springcloud | b882d2b1938cacc2bc56b8602e40c2ea2b3c62e4 | [
"Apache-2.0"
] | 1 | 2020-12-29T08:42:17.000Z | 2020-12-29T08:42:17.000Z | package cn.bitflash.entity;
import cn.bitflash.entities.UserComplaintEntity;
import java.io.Serializable;
/**
* 申诉
*
* @author gaoyuguo
*/
public class UserComplaintBean extends UserComplaintEntity implements Serializable {
private String contactsUname;
private String contactsMobile;
private String complaintUname;
private String complaintMobile;
public String getContactsUname() {
return contactsUname;
}
public void setContactsUname(String contactsUname) {
this.contactsUname = contactsUname;
}
public String getContactsMobile() {
return contactsMobile;
}
public void setContactsMobile(String contactsMobile) {
this.contactsMobile = contactsMobile;
}
public String getComplaintUname() {
return complaintUname;
}
public void setComplaintUname(String complaintUname) {
this.complaintUname = complaintUname;
}
public String getComplaintMobile() {
return complaintMobile;
}
public void setComplaintMobile(String complaintMobile) {
this.complaintMobile = complaintMobile;
}
}
| 21.055556 | 84 | 0.705365 |
78b973ffa17fe0bf5b22bac7a7d06c7c4517f629 | 124 | sql | SQL | src/3_3.sql | ytyaru/Sqlite3.Syntax.Check.Constraint.20190831114817 | 0c74707dfe7658ec7f34d0b12802c835e19dfafb | [
"CC0-1.0"
] | null | null | null | src/3_3.sql | ytyaru/Sqlite3.Syntax.Check.Constraint.20190831114817 | 0c74707dfe7658ec7f34d0b12802c835e19dfafb | [
"CC0-1.0"
] | null | null | null | src/3_3.sql | ytyaru/Sqlite3.Syntax.Check.Constraint.20190831114817 | 0c74707dfe7658ec7f34d0b12802c835e19dfafb | [
"CC0-1.0"
] | null | null | null | create table T(A integer check(A not between 0 and 3));
insert into T values(4);
insert into T values(3);
select * from T;
| 20.666667 | 55 | 0.709677 |
992b7a6d694cde00a5bca27d0fcbefedcc5c5a1c | 17,341 | c | C | Verse/v_connection.c | valiet/quel_solaar | 70dc81fc77858c2b96a2a9ceb7d1672e52758977 | [
"BSD-3-Clause"
] | 2 | 2022-01-20T16:24:55.000Z | 2022-01-29T04:11:47.000Z | Verse/v_connection.c | valiet/quel_solaar | 70dc81fc77858c2b96a2a9ceb7d1672e52758977 | [
"BSD-3-Clause"
] | null | null | null | Verse/v_connection.c | valiet/quel_solaar | 70dc81fc77858c2b96a2a9ceb7d1672e52758977 | [
"BSD-3-Clause"
] | null | null | null | /*
**
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "v_cmd_buf.h"
#include "v_network_in_que.h"
#include "v_network_out_que.h"
#include "v_cmd_gen.h"
#include "v_connection.h"
#include "v_encryption.h"
#include "v_util.h"
#if !defined(V_GENERATE_FUNC_MODE)
#include "verse.h"
#define CONNECTION_CHUNK_SIZE 16
#define V_MAX_CONNECT_PACKET_SIZE 1500
#define V_CON_MAX_MICROSECOND_BETWEEN_SENDS 100
#define V_RE_CONNECTON_TIME_OUT 4
#define V_CONNECTON_TIME_OUT 30
typedef struct {
VNetOutQueue *out_queue;
VNetInQueue in_queue;
VNetworkAddress network_address;
boolean connected;
unsigned int avatar;
/* unsigned int packet_id;*/
int32 timedelta_s;
uint32 timedelta_f;
boolean destroy_flag;
void *ordered_storage;
char name[V_ENCRYPTION_LOGIN_KEY_SIZE / 2];
char pass[V_ENCRYPTION_LOGIN_KEY_SIZE / 2];
VConnectStage connect_stage;
unsigned int stage_atempts;
uint8 key_my[V_ENCRYPTION_LOGIN_KEY_FULL_SIZE];
uint8 key_other[V_ENCRYPTION_LOGIN_KEY_FULL_SIZE];
uint8 key_data[V_ENCRYPTION_DATA_KEY_SIZE];
uint8 *expected_key;
} VConnection;
static struct {
VConnection *con;
unsigned int con_count;
unsigned int current_connection;
VNetworkAddress *connect_address;
void *unified_func_storage;
uint16 connect_port;
unsigned int pending_packets;
uint8 host_id[V_ENCRYPTION_LOGIN_KEY_FULL_SIZE];
} VConData;
extern void cmd_buf_init(void);
void v_con_init(void) /* since verse doesnt have an init function this function is runned over an ove ard starts whit a check it it has run before */
{
static boolean v_con_initialized = FALSE;
if(v_con_initialized)
return;
cmd_buf_init();
v_con_initialized = TRUE;
VConData.con = malloc(CONNECTION_CHUNK_SIZE * sizeof *VConData.con);
memset(VConData.con, 0, CONNECTION_CHUNK_SIZE * sizeof *VConData.con); /* Clear the memory. */
VConData.con_count = 0;
VConData.pending_packets = 0;
/* v_e_connect_create_key(&VConData.host_id[V_ENCRYPTION_LOGIN_PRIVATE_START],
&VConData.host_id[V_ENCRYPTION_LOGIN_PUBLIC_START],
&VConData.host_id[V_ENCRYPTION_LOGIN_N_START]);*/ /* default host id if none is set by user */
}
void verse_set_port(uint16 port)
{
v_n_set_port(port);
}
void verse_host_id_create(uint8 *id)
{
v_e_connect_create_key(&id[V_ENCRYPTION_LOGIN_PRIVATE_START],
&id[V_ENCRYPTION_LOGIN_PUBLIC_START], &id[V_ENCRYPTION_LOGIN_N_START]);
}
void verse_host_id_set(uint8 *id)
{
memcpy(VConData.host_id, id, V_ENCRYPTION_LOGIN_KEY_FULL_SIZE);
}
extern void *v_fs_create_func_storage(void);
extern void *v_create_ordered_storage(void);
extern void v_destroy_ordered_storage(void *data);
void *v_con_connect(uint32 ip, uint16 port, VConnectStage stage) /* creates a new connection slot */
{
v_con_init(); /* init connections, if not done yet */
if((VConData.con_count - 1) % CONNECTION_CHUNK_SIZE == 0) /* do we need more slots for connections, then reallocate more space */
VConData.con = realloc(VConData.con, (sizeof *VConData.con) * (VConData.con_count + CONNECTION_CHUNK_SIZE));
VConData.con[VConData.con_count].out_queue = v_noq_create_network_queue(); /* create a out queue fo all out going commands */
v_niq_clear(&VConData.con[VConData.con_count].in_queue); /* clear and init the que of incomming packets.*/
VConData.con[VConData.con_count].connected = FALSE; /* not yet propperly connected and should not accept commands yet */
VConData.con[VConData.con_count].network_address.ip = ip; /* ip address of other side */
VConData.con[VConData.con_count].network_address.port = port; /* port used by other side */
VConData.con[VConData.con_count].avatar = 0; /* no avatar set yet*/
/* VConData.con[VConData.con_count].packet_id = 2;*/
VConData.con[VConData.con_count].destroy_flag = FALSE; /* this is a flag that is set once the connection is about to be destroyed.*/
VConData.con[VConData.con_count].ordered_storage = v_create_ordered_storage();
VConData.con[VConData.con_count].name[0] = 0; /* nouser name set yet */
VConData.con[VConData.con_count].pass[0] = 0; /* no password set yet */
VConData.con[VConData.con_count].connect_stage = stage; /* this is the stage of the connection, it show if the connection is ready, the init state depends if this is a client or host */
VConData.con[VConData.con_count].stage_atempts = 0; /* each stage in the connection prosess is atempted multiple times to avoid failiure if packets get lost*/
VConData.con[VConData.con_count].timedelta_s = 0; /* number of seconds since last incomming packet to the connection*/
VConData.con[VConData.con_count].timedelta_f = 0; /* number of fractions of a second since last incomming packet to the connection*/
VConData.con[VConData.con_count].expected_key = NULL; /* expected hist id if this is a client */
VConData.current_connection = VConData.con_count; /* set the new connection to the current*/
++VConData.con_count; /* add one to the number of connections*/
return VConData.con[VConData.current_connection].out_queue;
}
void verse_session_destroy(VSession session) /* a session can not be destroyed right away, because this function might be called inside a call back from the session it tryes tpo destroy, therfor it only markes it*/
{
unsigned int i;
for(i = 0; i < VConData.con_count && VConData.con[i].out_queue != session; i++);
if(i < VConData.con_count)
{
VConData.con[i].destroy_flag = TRUE;
}
}
void verse_session_set(VSession session) /* find a session and make it the current*/
{
unsigned int i;
for(i = 0; i < VConData.con_count && session != VConData.con[i].out_queue; i++);
if(i < VConData.con_count)
VConData.current_connection = i;
}
VSession verse_session_get(void)
{
if(VConData.current_connection < VConData.con_count)
return VConData.con[VConData.current_connection].out_queue;
return NULL;
}
uint32 v_co_find_connection(uint32 ip, uint16 port) /* if a packet comes form a ip address what connection does it belong to? */
{
unsigned int i;
for(i = 0; i < VConData.con_count; i++)
{
if(ip == VConData.con[i].network_address.ip &&
port == VConData.con[i].network_address.port &&
VConData.con[i].destroy_flag == 0)
{
return i;
}
}
return -1;
}
boolean v_co_switch_connection(uint32 ip, uint16 port) /* switches to the current connection to one ip address if it exists */
{
unsigned int i;
for(i = 0; i < VConData.con_count; i++)
{
if(ip == VConData.con[i].network_address.ip && port == VConData.con[i].network_address.port)
{
VConData.current_connection = i;
return TRUE;
}
}
return FALSE;
}
void v_con_inqueue_timer_update(void)
{
if(VConData.current_connection < VConData.con_count)
{
v_niq_timer_update(&VConData.con[VConData.current_connection].in_queue);
}
}
/*
extern void v_fs_buf_unpack(const uint8 *data, unsigned int length);
extern void v_fs_buf_store_pack(uint8 *data, unsigned int length);
extern boolean v_fs_buf_unpack_stored(void);
*/
extern void v_unpack_connection(const char *buf, unsigned int buffer_length);
extern void verse_send_packet_nak(uint32 packet_id);
extern void v_callback_connect_terminate(const char *bye);
extern boolean v_connect_unpack_ping(const char *buf, size_t buffer_length, uint32 ip, uint16 port);
extern void v_ping_update(void);
void v_fs_unpack_beginning(uint8 *data, unsigned int length);
/* Main function that receives and distributes all incoming packets. */
boolean v_con_network_listen(void)
{
VNetworkAddress address;
uint8 buf[V_MAX_CONNECT_PACKET_SIZE], *store;
int size = 0;
unsigned int connection;
uint32 packet_id;
boolean ret = FALSE;
v_con_init(); /* Init if needed. */
connection = VConData.current_connection; /* Store current connection in a local variable so that we can restore it later. */
size = v_n_receive_data(&address, buf, sizeof buf); /* Ask for incoming data from the network. */
while(size != -1 && size != 0) /* Did we get any data? */
{
VConData.current_connection = v_co_find_connection(address.ip, address.port); /* Is there a connection matching the IP and port? */
vnp_raw_unpack_uint32(buf, &packet_id); /* Unpack the ID of the packet. */
/* printf("got packet ID %u, %d bytes, connection %u\n", packet_id, size, VConData.current_connection);*/
if(VConData.current_connection < VConData.con_count &&
!(VConData.con[VConData.current_connection].connect_stage == V_CS_CONNECTED && packet_id == 0)) /* If this isn't a packet from an existing connection, disregard it. */
{
if(VConData.con[VConData.current_connection].connect_stage == V_CS_CONNECTED) /* Is this connection initialized? */
{
store = v_niq_store(&VConData.con[VConData.current_connection].in_queue, size, packet_id); /* Store the packet. */
if(store != NULL)
{
VConData.pending_packets++; /* We now have one more packet pending unpack. */
v_e_data_decrypt_packet(store, buf, size, VConData.con[VConData.current_connection].key_data); /* Decrypt the packet. */
v_fs_unpack_beginning(store, size);
}
}
else
{
v_unpack_connection(buf, size); /* This is an ongoing connecton-attempt. */
v_niq_timer_update(&VConData.con[VConData.current_connection].in_queue);
}
}
else if(v_connect_unpack_ping(buf, size, address.ip, address.port)) /* Ping handled. */
;
else if(v_fs_func_accept_connections()) /* Do we accept connection-attempts? */
{
if(VConData.current_connection >= VConData.con_count ||
V_RE_CONNECTON_TIME_OUT < v_niq_time_out(&VConData.con[VConData.current_connection].in_queue)) /* Is it a new client, or an old client that we haven't heard form in some time? */
{
if(VConData.current_connection < VConData.con_count)
{
VConData.con[VConData.current_connection].network_address.ip = 0;
VConData.con[VConData.current_connection].destroy_flag = TRUE; /* Destroy old connection if there is one. */
}
v_con_connect(address.ip, address.port, V_CS_IDLE); /* Create a new connection. */
v_unpack_connection(buf, size); /* Unpack the connection-attempt. */
}
}
else
{
fprintf(stderr, __FILE__ ": Unhandled packet--dropping\n");
if(VConData.con_count > 0)
{
fprintf(stderr, __FILE__ ": State: current=%u count=%u stage=%d id=%u\n",
VConData.current_connection,
VConData.con_count,
VConData.con[VConData.current_connection].connect_stage,
packet_id);
}
}
size = v_n_receive_data(&address, buf, sizeof buf); /* See if there are more incoming packets. */
ret = TRUE;
}
VConData.current_connection = connection; /* Reset the current connection. */
return ret;
}
extern void v_update_connection_pending(boolean resend);
boolean v_con_callback_update(void)
{
static unsigned int seconds;
boolean output = FALSE;
size_t size;
unsigned int connection, s;
VNetInPacked *p;
v_n_get_current_time(&s, NULL);
connection = VConData.current_connection;
for(VConData.current_connection = 0; VConData.current_connection < VConData.con_count; VConData.current_connection++)
if(VConData.con[VConData.current_connection].connect_stage != V_CS_CONNECTED)
v_update_connection_pending(s != seconds);
seconds = s;
VConData.current_connection = connection;
if(VConData.pending_packets == 0)
return FALSE;
if(VConData.con[VConData.current_connection].connect_stage == V_CS_CONNECTED)
{
while((p = v_niq_get(&VConData.con[VConData.current_connection].in_queue, &size)) != NULL)
{
VConData.pending_packets--;
v_fs_unpack(p->data, size);
v_niq_release(&VConData.con[VConData.current_connection].in_queue, p);
output = TRUE;
}
v_con_network_listen();
}
return output;
}
void verse_callback_update(unsigned int microseconds)
{
unsigned int connection, passed;
v_ping_update(); /* Deliver any pending pings. */
connection = VConData.current_connection;
for(VConData.current_connection = 0; VConData.current_connection < VConData.con_count; VConData.current_connection++)
{
if(VConData.con[VConData.current_connection].connect_stage == V_CS_CONNECTED)
v_noq_send_queue(VConData.con[VConData.current_connection].out_queue, &VConData.con[VConData.current_connection].network_address);
if(VConData.con[VConData.current_connection].destroy_flag == TRUE)
{
v_noq_destroy_network_queue(VConData.con[VConData.current_connection].out_queue);
VConData.pending_packets -= v_niq_free(&VConData.con[VConData.current_connection].in_queue);
v_destroy_ordered_storage(VConData.con[VConData.current_connection].ordered_storage);
if(VConData.con[VConData.current_connection].expected_key != NULL)
free(VConData.con[VConData.current_connection].expected_key);
if(VConData.con_count - 1 != VConData.current_connection)
VConData.con[VConData.current_connection] = VConData.con[VConData.con_count - 1];
VConData.con_count--;
if(connection >= VConData.con_count)
VConData.current_connection = 0;
return;
}
}
VConData.current_connection = connection;
if(VConData.con_count > 0)
{
/* printf("checking timeout of stage %d connection %u\n",
VConData.con[VConData.current_connection].connect_stage, VConData.current_connection);
*/ if(V_CONNECTON_TIME_OUT < v_niq_time_out(&VConData.con[VConData.current_connection].in_queue))
{
if(VConData.con[VConData.current_connection].connect_stage != V_CS_CONNECTED)
{
VConData.con[VConData.current_connection].destroy_flag = TRUE;
}
else
v_callback_connect_terminate("connection timed out");
}
}
v_con_network_listen();
if(VConData.con_count > 0)
if(v_con_callback_update())
return;
for(passed = 0; passed < microseconds && VConData.pending_packets == 0;)
{
boolean update;
if(microseconds - passed > V_CON_MAX_MICROSECOND_BETWEEN_SENDS) /* Still a long way to go? */
passed += v_n_wait_for_incoming(V_CON_MAX_MICROSECOND_BETWEEN_SENDS);
else
passed += v_n_wait_for_incoming(microseconds - passed);
do
{
update = v_con_network_listen();
connection = VConData.current_connection;
for(VConData.current_connection = 0; VConData.current_connection < VConData.con_count; VConData.current_connection++)
{
if(VConData.con[VConData.current_connection].connect_stage == V_CS_CONNECTED)
{
if(v_noq_send_queue(VConData.con[VConData.current_connection].out_queue, &VConData.con[VConData.current_connection].network_address))
update = TRUE;
}
}
VConData.current_connection = connection;
} while(update);
}
if(VConData.con_count > 0)
v_con_callback_update();
}
void v_con_set_name_pass(const char *name, const char *pass)
{
v_strlcpy(VConData.con[VConData.current_connection].name, name, sizeof VConData.con[VConData.current_connection].name);
v_strlcpy(VConData.con[VConData.current_connection].pass, pass, sizeof VConData.con[VConData.current_connection].pass);
}
const char * v_con_get_name(void)
{
return VConData.con[VConData.current_connection].name;
}
const char * v_con_get_pass(void)
{
return VConData.con[VConData.current_connection].pass;
}
void v_con_set_connect_stage(VConnectStage stage)
{
VConData.con[VConData.current_connection].connect_stage = stage;
VConData.con[VConData.current_connection].stage_atempts = 0;
}
VConnectStage v_con_get_connect_stage(void)
{
return VConData.con[VConData.current_connection].connect_stage;
}
uint8 *v_con_get_my_key(void)
{
return VConData.con[VConData.current_connection].key_my;
}
uint8 *v_con_get_other_key(void)
{
return VConData.con[VConData.current_connection].key_other;
}
uint8 **v_con_get_expected_key(void)
{
return &VConData.con[VConData.current_connection].expected_key;
}
uint8 * v_con_get_host_id(void)
{
return VConData.host_id;
}
void v_con_set_data_key(const uint8 *key)
{
memcpy(VConData.con[VConData.current_connection].key_data, key, V_ENCRYPTION_DATA_KEY_SIZE);
}
const uint8 * v_con_get_data_key(void)
{
return VConData.con[VConData.current_connection].key_data;
}
void * v_con_get_network_queue(void)
{
return VConData.con[VConData.current_connection].out_queue;
}
VNetworkAddress * v_con_get_network_address(void)
{
return &VConData.con[VConData.current_connection].network_address;
}
void * v_con_get_ordered_storage(void)
{
return VConData.con[VConData.current_connection].ordered_storage;
}
void v_con_set_avatar(uint32 avatar)
{
VConData.con[VConData.current_connection].avatar = avatar;
}
uint32 verse_session_get_avatar(void)
{
return VConData.con[VConData.current_connection].avatar;
}
void verse_session_get_time(uint32 *seconds, uint32 *fractions)
{
uint32 s, f;
v_n_get_current_time(&s, &f);
if((uint32)~0 - f < VConData.con[VConData.current_connection].timedelta_f)
s++;
if(seconds != NULL)
{
if(VConData.con[VConData.current_connection].timedelta_s < 0)
*seconds = s - (uint32)(-VConData.con[VConData.current_connection].timedelta_s);
else
*seconds = s + VConData.con[VConData.current_connection].timedelta_s;
}
if(fractions != NULL)
*fractions = f + VConData.con[VConData.current_connection].timedelta_f;
}
void v_con_set_time(uint32 seconds, uint32 fractions)
{
uint32 s, f;
v_n_get_current_time(&s, &f);
if(f < fractions)
s--;
if (s < seconds)
VConData.con[VConData.current_connection].timedelta_s = -(int)(seconds - s);
else
VConData.con[VConData.current_connection].timedelta_s = (int)(s - seconds);
VConData.con[VConData.current_connection].timedelta_f = f - fractions;
}
#endif
| 35.317719 | 214 | 0.756358 |
f9fe34ea3c2bd55f45bc7dbf6947694c2257ebc2 | 3,123 | go | Go | src/wal/global_state.go | peekeri/influxdb | c7c79bc441720d91117aae4766131a437be92ad3 | [
"MIT"
] | null | null | null | src/wal/global_state.go | peekeri/influxdb | c7c79bc441720d91117aae4766131a437be92ad3 | [
"MIT"
] | null | null | null | src/wal/global_state.go | peekeri/influxdb | c7c79bc441720d91117aae4766131a437be92ad3 | [
"MIT"
] | 2 | 2016-10-18T02:35:38.000Z | 2019-06-13T18:22:25.000Z | package wal
import (
"bufio"
"encoding/gob"
"fmt"
"io"
"math"
"os"
)
type GlobalState struct {
// used for creating index entries
CurrentFileSuffix int
CurrentFileOffset int64
// keep track of the next request number
LargestRequestNumber uint32
// used for rollover
FirstSuffix int
// last seq number used
ShardLastSequenceNumber map[uint32]uint64
// committed request number per server
ServerLastRequestNumber map[uint32]uint32
// path to the state file
path string
}
func newGlobalState(path string) (*GlobalState, error) {
f, err := os.Open(path)
state := &GlobalState{
ServerLastRequestNumber: map[uint32]uint32{},
ShardLastSequenceNumber: map[uint32]uint64{},
path: path,
}
if os.IsNotExist(err) {
return state, nil
}
if err != nil {
return nil, err
}
if err := state.read(f); err != nil {
return nil, err
}
state.path = path
return state, nil
}
func (self *GlobalState) writeToFile() error {
newFile, err := os.OpenFile(self.path+".new", os.O_CREATE|os.O_RDWR, 0644)
if err != nil {
return err
}
if _, err := newFile.Seek(0, os.SEEK_SET); err != nil {
return err
}
if err := self.write(newFile); err != nil {
return err
}
if err := newFile.Sync(); err != nil {
return err
}
if err := newFile.Close(); err != nil {
return err
}
os.Remove(self.path)
return os.Rename(self.path+".new", self.path)
}
func (self *GlobalState) write(w io.Writer) error {
fmt.Fprintf(w, "%d\n", 1) // write the version
return gob.NewEncoder(w).Encode(self)
}
func (self *GlobalState) read(r io.Reader) error {
// skip the version
reader := bufio.NewReader(r)
// read the version line
_, err := reader.ReadString('\n')
if err != nil {
return err
}
return gob.NewDecoder(reader).Decode(self)
}
func (self *GlobalState) recover(shardId uint32, sequenceNumber uint64) {
lastSequenceNumber := self.ShardLastSequenceNumber[shardId]
if sequenceNumber > lastSequenceNumber {
self.ShardLastSequenceNumber[shardId] = sequenceNumber
}
}
func (self *GlobalState) getNextRequestNumber() uint32 {
self.LargestRequestNumber++
return self.LargestRequestNumber
}
func (self *GlobalState) getCurrentSequenceNumber(shardId uint32) uint64 {
return self.ShardLastSequenceNumber[shardId]
}
func (self *GlobalState) setCurrentSequenceNumber(shardId uint32, sequenceNumber uint64) {
self.ShardLastSequenceNumber[shardId] = sequenceNumber
}
func (self *GlobalState) commitRequestNumber(serverId, requestNumber uint32) {
// TODO: we need a way to verify the request numbers, the following
// won't work though when the request numbers roll over
// if currentRequestNumber := self.ServerLastRequestNumber[serverId]; requestNumber < currentRequestNumber {
// panic(fmt.Errorf("Expected rn %d to be >= %d", requestNumber, currentRequestNumber))
// }
self.ServerLastRequestNumber[serverId] = requestNumber
}
func (self *GlobalState) LowestCommitedRequestNumber() uint32 {
requestNumber := uint32(math.MaxUint32)
for _, number := range self.ServerLastRequestNumber {
if number < requestNumber {
requestNumber = number
}
}
return requestNumber
}
| 23.133333 | 109 | 0.723343 |
baf570db876867e50f000576bdb0259f9f1f3c18 | 691 | sql | SQL | init.sql | POABOB/Dcard-intern-project | 5a717cdf30568ed1450281590f804f6f2d274fb4 | [
"ISC"
] | 5 | 2022-03-23T12:03:16.000Z | 2022-03-24T13:25:02.000Z | init.sql | POABOB/Dcard-intern-project | 5a717cdf30568ed1450281590f804f6f2d274fb4 | [
"ISC"
] | null | null | null | init.sql | POABOB/Dcard-intern-project | 5a717cdf30568ed1450281590f804f6f2d274fb4 | [
"ISC"
] | null | null | null | CREATE DATABASE IF NOT EXISTS shortURL;
USE shortURL;
CREATE TABLE IF NOT EXISTS `shortURL`.`url` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT , `url` TEXT NOT NULL , `expireAt` INT NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB;
-- CREATE TABLE `shortURL`.`url_random` (`id` int(11) NOT NULL AUTO_INCREMENT,`url` text NOT NULL DEFAULT '0', `expireAt` int(11) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `url` (`url`(1024))) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- CREATE TABLE `shortURL`.`url_random_nums` (`id` int(11) NOT NULL AUTO_INCREMENT,`urlNums` int(11) UNSIGNED NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- INSERT INTO `url_random_nums`(urlNums) VALUES (0); | 98.714286 | 230 | 0.722142 |
141d7267becb7e2d41e3f869adf6262b8df8c2c3 | 241 | css | CSS | _/chapter-4/nuxt-universal/transition/page-transition-property/global-default/assets/css/transitions.css | paullewallencom/nuxt-978-1-7899-5269-8 | 860331d92f9ca72af4f958428d9b74ac8af693cd | [
"Apache-2.0"
] | 30 | 2020-07-06T18:46:09.000Z | 2022-03-13T10:33:13.000Z | _/chapter-4/nuxt-universal/transition/page-transition-property/global-default/assets/css/transitions.css | paullewallencom/nuxt-978-1-7899-5269-8 | 860331d92f9ca72af4f958428d9b74ac8af693cd | [
"Apache-2.0"
] | 24 | 2020-06-23T13:59:30.000Z | 2022-03-08T23:26:34.000Z | _/chapter-4/nuxt-universal/transition/page-transition-property/global-default/assets/css/transitions.css | paullewallencom/nuxt-978-1-7899-5269-8 | 860331d92f9ca72af4f958428d9b74ac8af693cd | [
"Apache-2.0"
] | 26 | 2020-07-04T06:20:09.000Z | 2022-03-22T10:26:54.000Z | /**
* Global Settings
* https://nuxtjs.org/guide/routing#transitions
*/
.page-enter,
.page-leave-to {
opacity: 0;
}
.page-leave,
.page-enter-to {
opacity: 1;
}
.page-enter-active,
.page-leave-active {
transition: opacity 300ms;
}
| 12.684211 | 47 | 0.659751 |
963ef6d1be9930e859b2314d81543fd3e1be3e5a | 953 | php | PHP | app/Http/Middleware/Tenant/Tenant.php | kingRayhan/laravel-multitenancy-boilerplate | f899cb82bcf78de18f28345581b0434b74671230 | [
"MIT"
] | null | null | null | app/Http/Middleware/Tenant/Tenant.php | kingRayhan/laravel-multitenancy-boilerplate | f899cb82bcf78de18f28345581b0434b74671230 | [
"MIT"
] | null | null | null | app/Http/Middleware/Tenant/Tenant.php | kingRayhan/laravel-multitenancy-boilerplate | f899cb82bcf78de18f28345581b0434b74671230 | [
"MIT"
] | null | null | null | <?php
namespace App\Http\Middleware\Tenant;
use App\Models\Store;
use App\Tenant\TenantManager;
use Closure;
use Illuminate\Http\Request;
class Tenant
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
$tenant = $this->resolveTenant($request->store ?: session()->get('tenant'));
if (!auth()->user()->stores->contains('id', $tenant->id)) {
return redirect()->route('dashboard');
}
$this->registerTenant($tenant);
return $next($request);
}
public function registerTenant($tenant)
{
app(TenantManager::class)->setTenant($tenant);
session()->put('tenant', $tenant->slug);
}
public function resolveTenant($tenantSlug)
{
return Store::where('slug', $tenantSlug)->first();
}
}
| 23.243902 | 84 | 0.60021 |
04d9915521016f105e7f2d2a6dd6c537e0843118 | 1,030 | kt | Kotlin | backend/common-web/src/main/kotlin/io/featurehub/jersey/OffsetDateTimeQueryProvider.kt | nashjain/featurehub | d0dd173a814bf1184a7aa671f49b669701e91314 | [
"Apache-2.0"
] | 142 | 2020-07-22T09:46:20.000Z | 2022-03-31T13:28:06.000Z | backend/common-web/src/main/kotlin/io/featurehub/jersey/OffsetDateTimeQueryProvider.kt | featurehub-io/featurehub | 0ab7892a5c0ec9d63d4cf1c954156e5fc4543dee | [
"Apache-2.0"
] | 290 | 2020-07-22T01:18:22.000Z | 2022-03-24T06:44:46.000Z | backend/common-web/src/main/kotlin/io/featurehub/jersey/OffsetDateTimeQueryProvider.kt | nashjain/featurehub | d0dd173a814bf1184a7aa671f49b669701e91314 | [
"Apache-2.0"
] | 19 | 2020-08-27T17:02:31.000Z | 2022-03-18T15:29:23.000Z | package io.featurehub.jersey
import jakarta.ws.rs.ext.ParamConverter
import jakarta.ws.rs.ext.ParamConverterProvider
import jakarta.ws.rs.ext.Provider
import java.lang.reflect.Type
import java.time.OffsetDateTime
import java.time.format.DateTimeFormatter
@Provider
class OffsetDateTimeQueryProvider : ParamConverterProvider {
override fun <T : Any?> getConverter(
rawType: Class<T>,
genericType: Type,
annotations: Array<out Annotation>?
): ParamConverter<T?>? {
if (rawType.name.equals(OffsetDateTime::class.java.name)) {
return object: ParamConverter<T?> {
override fun toString(value: T?): String? {
if (value == null) {
return null
}
return (value as OffsetDateTime).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)
}
override fun fromString(value: String?): T? {
if (value == null) {
return null;
}
return OffsetDateTime.parse(value) as T
}
}
}
return null;
}
}
| 25.121951 | 89 | 0.652427 |
862ce6e3598f14f79f920fda0de55fe887fd949c | 28,695 | rs | Rust | glutin/src/api/glx/mod.rs | inferrna/glutin | fef5c513f46e3bd1e8e63615b31d0638d9d5b0fa | [
"Apache-2.0"
] | 2 | 2020-11-06T19:07:37.000Z | 2021-04-01T04:18:04.000Z | glutin/src/api/glx/mod.rs | inferrna/glutin | fef5c513f46e3bd1e8e63615b31d0638d9d5b0fa | [
"Apache-2.0"
] | null | null | null | glutin/src/api/glx/mod.rs | inferrna/glutin | fef5c513f46e3bd1e8e63615b31d0638d9d5b0fa | [
"Apache-2.0"
] | 1 | 2021-04-01T04:18:06.000Z | 2021-04-01T04:18:06.000Z | #![cfg(any(
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
))]
#![cfg(feature = "x11")]
mod make_current_guard;
mod glx {
use crate::api::dlloader::{SymTrait, SymWrapper};
use glutin_glx_sys as ffi;
use std::ops::{Deref, DerefMut};
#[derive(Clone)]
pub struct Glx(SymWrapper<ffi::glx::Glx>);
/// Because `*const raw::c_void` doesn't implement `Sync`.
unsafe impl Sync for Glx {}
impl SymTrait for ffi::glx::Glx {
fn load_with(lib: &libloading::Library) -> Self {
Self::load_with(|sym| unsafe {
lib.get(
std::ffi::CString::new(sym.as_bytes())
.unwrap()
.as_bytes_with_nul(),
)
.map(|sym| *sym)
.unwrap_or(std::ptr::null_mut())
})
}
}
impl Glx {
pub fn new() -> Result<Self, ()> {
let paths = vec!["libGL.so.1", "libGL.so"];
SymWrapper::new(paths).map(|i| Glx(i))
}
}
impl Deref for Glx {
type Target = ffi::glx::Glx;
fn deref(&self) -> &ffi::glx::Glx {
&self.0
}
}
impl DerefMut for Glx {
fn deref_mut(&mut self) -> &mut ffi::glx::Glx {
&mut self.0
}
}
}
pub use self::glx::Glx;
use self::make_current_guard::MakeCurrentGuard;
use crate::{
Api, ContextError, CreationError, GlAttributes, GlProfile, GlRequest,
PixelFormat, PixelFormatRequirements, ReleaseBehavior, Robustness,
};
use crate::platform::unix::x11::XConnection;
use crate::platform_impl::x11_utils::SurfaceType;
use glutin_glx_sys as ffi;
use winit::dpi;
use std::ffi::{CStr, CString};
use std::os::raw;
use std::sync::Arc;
lazy_static! {
pub static ref GLX: Option<Glx> = Glx::new().ok();
}
#[derive(Debug)]
pub struct Context {
xconn: Arc<XConnection>,
drawable: ffi::Window,
context: ffi::GLXContext,
pixel_format: PixelFormat,
}
impl Context {
// transparent is `None` if window is raw.
pub fn new<'a>(
xconn: Arc<XConnection>,
pf_reqs: &PixelFormatRequirements,
opengl: &'a GlAttributes<&'a Context>,
screen_id: raw::c_int,
surface_type: SurfaceType,
transparent: Option<bool>,
) -> Result<ContextPrototype<'a>, CreationError> {
let glx = GLX.as_ref().unwrap();
// This is completely ridiculous, but VirtualBox's OpenGL driver needs
// some call handled by *it* (i.e. not Mesa) to occur before
// anything else can happen. That is because VirtualBox's OpenGL
// driver is going to apply binary patches to Mesa in the DLL
// constructor and until it's loaded it won't have a chance to do that.
//
// The easiest way to do this is to just call `glXQueryVersion()` before
// doing anything else. See: https://www.virtualbox.org/ticket/8293
let (mut major, mut minor) = (0, 0);
unsafe {
glx.QueryVersion(xconn.display as *mut _, &mut major, &mut minor);
}
// loading the list of extensions
let extensions = load_extensions(&xconn, screen_id)?;
// finding the pixel format we want
let (fb_config, pixel_format, visual_infos) = unsafe {
choose_fbconfig(
&extensions,
&xconn,
screen_id,
pf_reqs,
surface_type,
transparent,
)?
};
Ok(ContextPrototype {
extensions,
xconn,
opengl,
fb_config,
visual_infos: unsafe { std::mem::transmute(visual_infos) },
pixel_format,
})
}
unsafe fn check_make_current(
&self,
ret: Option<i32>,
) -> Result<(), ContextError> {
if ret == Some(0) {
let err = self.xconn.check_errors();
Err(ContextError::OsError(format!(
"`glXMakeCurrent` failed: {:?}",
err
)))
} else {
Ok(())
}
}
#[inline]
pub unsafe fn make_current(&self) -> Result<(), ContextError> {
let glx = GLX.as_ref().unwrap();
let res = glx.MakeCurrent(
self.xconn.display as *mut _,
self.drawable,
self.context,
);
self.check_make_current(Some(res))
}
#[inline]
pub unsafe fn make_not_current(&self) -> Result<(), ContextError> {
let glx = GLX.as_ref().unwrap();
if self.drawable == glx.GetCurrentDrawable()
|| self.context == glx.GetCurrentContext()
{
let res = glx.MakeCurrent(
self.xconn.display as *mut _,
0,
std::ptr::null(),
);
self.check_make_current(Some(res))
} else {
self.check_make_current(None)
}
}
#[inline]
pub fn is_current(&self) -> bool {
let glx = GLX.as_ref().unwrap();
unsafe { glx.GetCurrentContext() == self.context }
}
#[inline]
pub fn get_api(&self) -> crate::Api {
crate::Api::OpenGl
}
#[inline]
pub unsafe fn raw_handle(&self) -> ffi::GLXContext {
self.context
}
#[inline]
pub fn get_proc_address(&self, addr: &str) -> *const core::ffi::c_void {
let glx = GLX.as_ref().unwrap();
let addr = CString::new(addr.as_bytes()).unwrap();
let addr = addr.as_ptr();
unsafe { glx.GetProcAddress(addr as *const _) as *const _ }
}
#[inline]
pub fn swap_buffers(&self) -> Result<(), ContextError> {
let glx = GLX.as_ref().unwrap();
unsafe {
glx.SwapBuffers(self.xconn.display as *mut _, self.drawable);
}
if let Err(err) = self.xconn.check_errors() {
Err(ContextError::OsError(format!(
"`glXSwapBuffers` failed: {:?}",
err
)))
} else {
Ok(())
}
}
#[inline]
pub fn get_pixel_format(&self) -> PixelFormat {
self.pixel_format.clone()
}
}
unsafe impl Send for Context {}
unsafe impl Sync for Context {}
impl Drop for Context {
fn drop(&mut self) {
let glx = GLX.as_ref().unwrap();
unsafe {
// See `drop` for `crate::api::egl::Context` for rationale.
let mut guard =
MakeCurrentGuard::new(&self.xconn, self.drawable, self.context)
.map_err(|err| ContextError::OsError(err))
.unwrap();
let gl_finish_fn = self.get_proc_address("glFinish");
assert!(gl_finish_fn != std::ptr::null());
let gl_finish_fn =
std::mem::transmute::<_, extern "system" fn()>(gl_finish_fn);
gl_finish_fn();
if guard.old_context() == Some(self.context) {
guard.invalidate()
}
std::mem::drop(guard);
glx.DestroyContext(self.xconn.display as *mut _, self.context);
}
}
}
#[derive(Debug)]
pub struct ContextPrototype<'a> {
extensions: String,
xconn: Arc<XConnection>,
opengl: &'a GlAttributes<&'a Context>,
fb_config: ffi::glx::types::GLXFBConfig,
visual_infos: ffi::XVisualInfo,
pixel_format: PixelFormat,
}
impl<'a> ContextPrototype<'a> {
#[inline]
pub fn get_visual_infos(&self) -> &ffi::XVisualInfo {
&self.visual_infos
}
// creating GL context
fn create_context(
&self,
) -> Result<(ffi::glx_extra::Glx, ffi::GLXContext), CreationError> {
let glx = GLX.as_ref().unwrap();
let share = match self.opengl.sharing {
Some(ctx) => ctx.context,
None => std::ptr::null(),
};
// loading the extra GLX functions
let extra_functions = ffi::glx_extra::Glx::load_with(|proc_name| {
let c_str = CString::new(proc_name).unwrap();
unsafe {
glx.GetProcAddress(c_str.as_ptr() as *const u8) as *const _
}
});
let context = match self.opengl.version {
GlRequest::Latest => {
let opengl_versions = [
(4, 6),
(4, 5),
(4, 4),
(4, 3),
(4, 2),
(4, 1),
(4, 0),
(3, 3),
(3, 2),
(3, 1),
];
let ctx;
'outer: loop {
// Try all OpenGL versions in descending order because some
// non-compliant drivers don't return
// the latest supported version but the one requested
for opengl_version in opengl_versions.iter() {
match create_context(
&extra_functions,
&self.extensions,
&self.xconn.xlib,
*opengl_version,
self.opengl.profile,
self.opengl.debug,
self.opengl.robustness,
share,
self.xconn.display,
self.fb_config,
&self.visual_infos,
) {
Ok(x) => {
ctx = x;
break 'outer;
}
Err(_) => continue,
}
}
ctx = create_context(
&extra_functions,
&self.extensions,
&self.xconn.xlib,
(1, 0),
self.opengl.profile,
self.opengl.debug,
self.opengl.robustness,
share,
self.xconn.display,
self.fb_config,
&self.visual_infos,
)?;
break;
}
ctx
}
GlRequest::Specific(Api::OpenGl, (major, minor)) => create_context(
&extra_functions,
&self.extensions,
&self.xconn.xlib,
(major, minor),
self.opengl.profile,
self.opengl.debug,
self.opengl.robustness,
share,
self.xconn.display,
self.fb_config,
&self.visual_infos,
)?,
GlRequest::Specific(_, _) => panic!("Only OpenGL is supported"),
GlRequest::GlThenGles {
opengl_version: (major, minor),
..
} => create_context(
&extra_functions,
&self.extensions,
&self.xconn.xlib,
(major, minor),
self.opengl.profile,
self.opengl.debug,
self.opengl.robustness,
share,
self.xconn.display,
self.fb_config,
&self.visual_infos,
)?,
};
Ok((extra_functions, context))
}
pub fn finish_pbuffer(
self,
size: dpi::PhysicalSize<u32>,
) -> Result<Context, CreationError> {
let glx = GLX.as_ref().unwrap();
let size: (u32, u32) = size.into();
let (_extra_functions, context) = self.create_context()?;
let attributes: Vec<raw::c_int> = vec![
ffi::glx::PBUFFER_WIDTH as raw::c_int,
size.0 as raw::c_int,
ffi::glx::PBUFFER_HEIGHT as raw::c_int,
size.1 as raw::c_int,
0,
];
let pbuffer = unsafe {
glx.CreatePbuffer(
self.xconn.display as *mut _,
self.fb_config,
attributes.as_ptr(),
)
};
Ok(Context {
xconn: self.xconn,
drawable: pbuffer,
context,
pixel_format: self.pixel_format,
})
}
pub fn finish(self, window: ffi::Window) -> Result<Context, CreationError> {
let glx = GLX.as_ref().unwrap();
let (extra_functions, context) = self.create_context()?;
// vsync
let swap_mode = if self.opengl.vsync { 1 } else { 0 };
let _guard = MakeCurrentGuard::new(&self.xconn, window, context)
.map_err(|err| CreationError::OsError(err))?;
if check_ext(&self.extensions, "GLX_EXT_swap_control")
&& extra_functions.SwapIntervalEXT.is_loaded()
{
// this should be the most common extension
unsafe {
extra_functions.SwapIntervalEXT(
self.xconn.display as *mut _,
window,
swap_mode,
);
}
let mut swap = unsafe { std::mem::zeroed() };
unsafe {
glx.QueryDrawable(
self.xconn.display as *mut _,
window,
ffi::glx_extra::SWAP_INTERVAL_EXT as i32,
&mut swap,
);
}
if swap != swap_mode as u32 {
return Err(CreationError::OsError(format!(
"Couldn't setup vsync: expected interval `{}` but got `{}`",
swap_mode, swap
)));
}
} else if check_ext(&self.extensions, "GLX_MESA_swap_control")
&& extra_functions.SwapIntervalMESA.is_loaded()
{
unsafe {
extra_functions.SwapIntervalMESA(swap_mode as u32);
}
} else if check_ext(&self.extensions, "GLX_SGI_swap_control")
&& extra_functions.SwapIntervalSGI.is_loaded()
{
unsafe {
extra_functions.SwapIntervalSGI(swap_mode);
}
} else {
return Err(CreationError::OsError(
"Couldn't find any available vsync extension".to_string(),
));
}
Ok(Context {
xconn: self.xconn,
drawable: window,
context,
pixel_format: self.pixel_format,
})
}
}
extern "C" fn x_error_callback(
_dpy: *mut ffi::Display,
_err: *mut ffi::XErrorEvent,
) -> i32 {
0
}
fn create_context(
extra_functions: &ffi::glx_extra::Glx,
extensions: &str,
xlib: &ffi::Xlib,
version: (u8, u8),
profile: Option<GlProfile>,
debug: bool,
robustness: Robustness,
share: ffi::GLXContext,
display: *mut ffi::Display,
fb_config: ffi::glx::types::GLXFBConfig,
visual_infos: &ffi::XVisualInfo,
) -> Result<ffi::GLXContext, CreationError> {
let glx = GLX.as_ref().unwrap();
unsafe {
let old_callback = (xlib.XSetErrorHandler)(Some(x_error_callback));
let context = if check_ext(extensions, "GLX_ARB_create_context") {
let mut attributes = Vec::with_capacity(9);
attributes
.push(ffi::glx_extra::CONTEXT_MAJOR_VERSION_ARB as raw::c_int);
attributes.push(version.0 as raw::c_int);
attributes
.push(ffi::glx_extra::CONTEXT_MINOR_VERSION_ARB as raw::c_int);
attributes.push(version.1 as raw::c_int);
if let Some(profile) = profile {
let flag = match profile {
GlProfile::Compatibility => {
ffi::glx_extra::CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB
}
GlProfile::Core => {
ffi::glx_extra::CONTEXT_CORE_PROFILE_BIT_ARB
}
};
attributes.push(
ffi::glx_extra::CONTEXT_PROFILE_MASK_ARB as raw::c_int,
);
attributes.push(flag as raw::c_int);
}
let flags = {
let mut flags = 0;
// robustness
if check_ext(extensions, "GLX_ARB_create_context_robustness") {
match robustness {
Robustness::RobustNoResetNotification
| Robustness::TryRobustNoResetNotification => {
attributes.push(
ffi::glx_extra::CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB as raw::c_int,
);
attributes.push(
ffi::glx_extra::NO_RESET_NOTIFICATION_ARB
as raw::c_int,
);
flags = flags
| ffi::glx_extra::CONTEXT_ROBUST_ACCESS_BIT_ARB
as raw::c_int;
}
Robustness::RobustLoseContextOnReset
| Robustness::TryRobustLoseContextOnReset => {
attributes.push(
ffi::glx_extra::CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB as raw::c_int,
);
attributes.push(
ffi::glx_extra::LOSE_CONTEXT_ON_RESET_ARB
as raw::c_int,
);
flags = flags
| ffi::glx_extra::CONTEXT_ROBUST_ACCESS_BIT_ARB
as raw::c_int;
}
Robustness::NotRobust => (),
Robustness::NoError => (),
}
} else {
match robustness {
Robustness::RobustNoResetNotification
| Robustness::RobustLoseContextOnReset => {
return Err(CreationError::RobustnessNotSupported);
}
_ => (),
}
}
if debug {
flags = flags
| ffi::glx_extra::CONTEXT_DEBUG_BIT_ARB as raw::c_int;
}
flags
};
attributes.push(ffi::glx_extra::CONTEXT_FLAGS_ARB as raw::c_int);
attributes.push(flags);
attributes.push(0);
extra_functions.CreateContextAttribsARB(
display as *mut _,
fb_config,
share,
1,
attributes.as_ptr(),
)
} else {
let visual_infos: *const ffi::XVisualInfo = visual_infos;
glx.CreateContext(
display as *mut _,
visual_infos as *mut _,
share,
1,
)
};
(xlib.XSetErrorHandler)(old_callback);
if context.is_null() {
// TODO: check for errors and return `OpenGlVersionNotSupported`
return Err(CreationError::OsError(
"GL context creation failed".to_string(),
));
}
Ok(context)
}
}
/// Enumerates all available FBConfigs
unsafe fn choose_fbconfig(
extensions: &str,
xconn: &Arc<XConnection>,
screen_id: raw::c_int,
pf_reqs: &PixelFormatRequirements,
surface_type: SurfaceType,
transparent: Option<bool>,
) -> Result<
(ffi::glx::types::GLXFBConfig, PixelFormat, ffi::XVisualInfo),
CreationError,
> {
let glx = GLX.as_ref().unwrap();
let descriptor = {
let mut out: Vec<raw::c_int> = Vec::with_capacity(37);
out.push(ffi::glx::X_RENDERABLE as raw::c_int);
out.push(1);
if let Some(xid) = pf_reqs.x11_visual_xid {
// getting the visual infos
let fvi = crate::platform_impl::x11_utils::get_visual_info_from_xid(
&xconn, xid,
);
out.push(ffi::glx::X_VISUAL_TYPE as raw::c_int);
out.push(fvi.class as raw::c_int);
out.push(ffi::glx::VISUAL_ID as raw::c_int);
out.push(xid as raw::c_int);
} else {
out.push(ffi::glx::X_VISUAL_TYPE as raw::c_int);
out.push(ffi::glx::TRUE_COLOR as raw::c_int);
}
out.push(ffi::glx::DRAWABLE_TYPE as raw::c_int);
let surface_type = match surface_type {
SurfaceType::Window => ffi::glx::WINDOW_BIT,
SurfaceType::PBuffer => ffi::glx::PBUFFER_BIT,
SurfaceType::Surfaceless => ffi::glx::DONT_CARE, /* TODO: Properly support */
};
out.push(surface_type as raw::c_int);
// TODO: Use RGB/RGB_FLOAT_BIT_ARB if they don't want alpha bits,
// fallback to it if they don't care
out.push(ffi::glx::RENDER_TYPE as raw::c_int);
if pf_reqs.float_color_buffer {
if check_ext(extensions, "GLX_ARB_fbconfig_float") {
out.push(ffi::glx_extra::RGBA_FLOAT_BIT_ARB as raw::c_int);
} else {
return Err(CreationError::NoAvailablePixelFormat);
}
} else {
out.push(ffi::glx::RGBA_BIT as raw::c_int);
}
if let Some(color) = pf_reqs.color_bits {
out.push(ffi::glx::RED_SIZE as raw::c_int);
out.push((color / 3) as raw::c_int);
out.push(ffi::glx::GREEN_SIZE as raw::c_int);
out.push(
(color / 3 + if color % 3 != 0 { 1 } else { 0 }) as raw::c_int,
);
out.push(ffi::glx::BLUE_SIZE as raw::c_int);
out.push(
(color / 3 + if color % 3 == 2 { 1 } else { 0 }) as raw::c_int,
);
}
if let Some(alpha) = pf_reqs.alpha_bits {
out.push(ffi::glx::ALPHA_SIZE as raw::c_int);
out.push(alpha as raw::c_int);
}
if let Some(depth) = pf_reqs.depth_bits {
out.push(ffi::glx::DEPTH_SIZE as raw::c_int);
out.push(depth as raw::c_int);
}
if let Some(stencil) = pf_reqs.stencil_bits {
out.push(ffi::glx::STENCIL_SIZE as raw::c_int);
out.push(stencil as raw::c_int);
}
let double_buffer = pf_reqs.double_buffer.unwrap_or(true);
out.push(ffi::glx::DOUBLEBUFFER as raw::c_int);
out.push(if double_buffer { 1 } else { 0 });
if let Some(multisampling) = pf_reqs.multisampling {
if check_ext(extensions, "GLX_ARB_multisample") {
out.push(ffi::glx_extra::SAMPLE_BUFFERS_ARB as raw::c_int);
out.push(if multisampling == 0 { 0 } else { 1 });
out.push(ffi::glx_extra::SAMPLES_ARB as raw::c_int);
out.push(multisampling as raw::c_int);
} else {
return Err(CreationError::NoAvailablePixelFormat);
}
}
out.push(ffi::glx::STEREO as raw::c_int);
out.push(if pf_reqs.stereoscopy { 1 } else { 0 });
if pf_reqs.srgb {
if check_ext(extensions, "GLX_ARB_framebuffer_sRGB") {
out.push(
ffi::glx_extra::FRAMEBUFFER_SRGB_CAPABLE_ARB as raw::c_int,
);
out.push(1);
} else if check_ext(extensions, "GLX_EXT_framebuffer_sRGB") {
out.push(
ffi::glx_extra::FRAMEBUFFER_SRGB_CAPABLE_EXT as raw::c_int,
);
out.push(1);
} else {
return Err(CreationError::NoAvailablePixelFormat);
}
}
match pf_reqs.release_behavior {
ReleaseBehavior::Flush => (),
ReleaseBehavior::None => {
if check_ext(extensions, "GLX_ARB_context_flush_control") {
out.push(
ffi::glx_extra::CONTEXT_RELEASE_BEHAVIOR_ARB
as raw::c_int,
);
out.push(
ffi::glx_extra::CONTEXT_RELEASE_BEHAVIOR_NONE_ARB
as raw::c_int,
);
}
}
}
out.push(ffi::glx::CONFIG_CAVEAT as raw::c_int);
out.push(ffi::glx::DONT_CARE as raw::c_int);
out.push(0);
out
};
// calling glXChooseFBConfig
let (fb_config, visual_infos): (
ffi::glx::types::GLXFBConfig,
ffi::XVisualInfo,
) = {
let mut num_configs = 0;
let configs = glx.ChooseFBConfig(
xconn.display as *mut _,
screen_id,
descriptor.as_ptr(),
&mut num_configs,
);
if configs.is_null() {
return Err(CreationError::NoAvailablePixelFormat);
}
if num_configs == 0 {
return Err(CreationError::NoAvailablePixelFormat);
}
match crate::platform_impl::x11_utils::select_config(
xconn,
transparent,
pf_reqs,
(0..num_configs).collect(),
|config_id| {
let visual_infos_raw = glx.GetVisualFromFBConfig(
xconn.display as *mut _,
*configs.offset(*config_id as isize),
);
if visual_infos_raw.is_null() {
return None;
}
let visual_infos: ffi::XVisualInfo =
std::ptr::read(visual_infos_raw as *const _);
(xconn.xlib.XFree)(visual_infos_raw as *mut _);
Some(visual_infos)
},
) {
Ok((config_id, visual_infos)) => {
let config = *configs.offset(config_id as isize);
let config = config.clone();
(xconn.xlib.XFree)(configs as *mut _);
(config, visual_infos)
}
Err(()) => {
(xconn.xlib.XFree)(configs as *mut _);
return Err(CreationError::NoAvailablePixelFormat);
}
}
};
let get_attrib = |attrib: raw::c_int| -> i32 {
let mut value = 0;
glx.GetFBConfigAttrib(
xconn.display as *mut _,
fb_config,
attrib,
&mut value,
);
// TODO: check return value
value
};
let pf_desc = PixelFormat {
hardware_accelerated: get_attrib(ffi::glx::CONFIG_CAVEAT as raw::c_int)
!= ffi::glx::SLOW_CONFIG as raw::c_int,
color_bits: get_attrib(ffi::glx::RED_SIZE as raw::c_int) as u8
+ get_attrib(ffi::glx::GREEN_SIZE as raw::c_int) as u8
+ get_attrib(ffi::glx::BLUE_SIZE as raw::c_int) as u8,
alpha_bits: get_attrib(ffi::glx::ALPHA_SIZE as raw::c_int) as u8,
depth_bits: get_attrib(ffi::glx::DEPTH_SIZE as raw::c_int) as u8,
stencil_bits: get_attrib(ffi::glx::STENCIL_SIZE as raw::c_int) as u8,
stereoscopy: get_attrib(ffi::glx::STEREO as raw::c_int) != 0,
double_buffer: get_attrib(ffi::glx::DOUBLEBUFFER as raw::c_int) != 0,
multisampling: if get_attrib(ffi::glx::SAMPLE_BUFFERS as raw::c_int)
!= 0
{
Some(get_attrib(ffi::glx::SAMPLES as raw::c_int) as u16)
} else {
None
},
srgb: get_attrib(
ffi::glx_extra::FRAMEBUFFER_SRGB_CAPABLE_ARB as raw::c_int,
) != 0
|| get_attrib(
ffi::glx_extra::FRAMEBUFFER_SRGB_CAPABLE_EXT as raw::c_int,
) != 0,
};
Ok((fb_config, pf_desc, visual_infos))
}
/// Checks if `ext` is available.
fn check_ext(extensions: &str, ext: &str) -> bool {
extensions.split(' ').find(|&s| s == ext).is_some()
}
fn load_extensions(
xconn: &Arc<XConnection>,
screen_id: raw::c_int,
) -> Result<String, CreationError> {
unsafe {
let glx = GLX.as_ref().unwrap();
let extensions =
glx.QueryExtensionsString(xconn.display as *mut _, screen_id);
if extensions.is_null() {
return Err(CreationError::OsError(
"`glXQueryExtensionsString` found no glX extensions"
.to_string(),
));
}
let extensions = CStr::from_ptr(extensions).to_bytes().to_vec();
Ok(String::from_utf8(extensions).unwrap())
}
}
| 32.831808 | 102 | 0.49486 |
0c38d770a63892f8c75052704b88789860766dce | 1,209 | sql | SQL | database/archive/create_panel.sql | G-Simeone/Learning_Accident_Occurence_on_Dutch_Highways | 1f3992a529fed70fd488811d68128a1e255fac5f | [
"MIT"
] | 4 | 2018-11-09T16:18:28.000Z | 2019-04-09T11:19:23.000Z | database/archive/create_panel.sql | G-Simeone/Learning_Accident_Occurence_on_Dutch_Highways | 1f3992a529fed70fd488811d68128a1e255fac5f | [
"MIT"
] | null | null | null | database/archive/create_panel.sql | G-Simeone/Learning_Accident_Occurence_on_Dutch_Highways | 1f3992a529fed70fd488811d68128a1e255fac5f | [
"MIT"
] | 1 | 2020-05-28T18:48:17.000Z | 2020-05-28T18:48:17.000Z | -- this joins ongeval to hectopunten through the ongeval_hectopunten link
with panel_staging_0 as (
select o.datetime,date_trunc('hour', o.datetime) as datetime_rounded,h.weather_station,
o.ongekey, h.hectoyearkey, 1 as acccident, h.num_lanes_max
from rws_clean.ongevallen as o
left join rws_clean.ong_hect_link as l
on o.ongekey = l.ongekey
left join rws_clean.hectopunten as h
on l.hectoyearkey = h.hectoyearkey),
-- panel_staging_1 connects panel with knmi_features based on weather station
-- and rounded time
panel_staging_1 as (
select panel_staging_0.*,
kf.avg_wind_speed_hr
-- add features from knmi_features here.
from panel_staging_0 left join rws_clean.knmi_features as kf
on panel_staging_0.datetime_rounded = kf.datetime and panel_staging_0.weather_station = kf.weather_station
),
-- panel_staging_2 is for extracting temporal features.
panel_staging_2 as (
select *,
extract(hour from panel_staging_1.datetime)::int as hour,
extract(month from panel_staging_1.datetime)::int as month,
extract(isodow from panel_staging_1.datetime)::int as day_of_week --monday is 1
from panel_staging_1
)
-- If we wanted flow we would need panel_staging_3 so on and so forth.
select * from panel_staging_2
;
| 37.78125 | 106 | 0.811414 |
e94570f0d181c3d80c6672f8b8ad6db231ece558 | 2,956 | go | Go | utils/astarte_interfaces.go | bettio/astartectl | feb0880e0b53bf8bba59320aba9e66ff253a156f | [
"Apache-2.0"
] | null | null | null | utils/astarte_interfaces.go | bettio/astartectl | feb0880e0b53bf8bba59320aba9e66ff253a156f | [
"Apache-2.0"
] | null | null | null | utils/astarte_interfaces.go | bettio/astartectl | feb0880e0b53bf8bba59320aba9e66ff253a156f | [
"Apache-2.0"
] | null | null | null | package utils
import (
"fmt"
"strings"
"github.com/astarte-platform/astartectl/common"
)
// ValidateInterfacePath validates path against the structure of astarteInterface, and returns a meaningful error
// the path cannot be resolved.
func ValidateInterfacePath(astarteInterface common.AstarteInterface, interfacePath string) error {
isAggregate := astarteInterface.Aggregation == common.ObjectAggregation
// Ensure the path resolves the parameter
interfacePathTokens := strings.Split(interfacePath, "/")
if isAggregate {
// Any mapping is fine here, so just take the first
validationEndpointTokens := strings.Split(astarteInterface.Mappings[0].Endpoint, "/")
if len(interfacePathTokens) > len(validationEndpointTokens) {
return fmt.Errorf("Path %s does not exist on Interface %s", interfacePath, astarteInterface.Name)
}
if astarteInterface.IsParametric() {
for index, token := range validationEndpointTokens {
if len(interfacePathTokens) < index {
return fmt.Errorf("%s is not a valid path for retrieving samples on Interface %s", interfacePath, astarteInterface.Name)
}
if strings.HasPrefix(token, "%{") {
if len(interfacePathTokens) == index+1 {
// The user requested the parametric endpoint of an aggregate, go for it.
return nil
}
} else if token != interfacePathTokens[index] {
// It could be the last one - in that case, it's ok.
if len(validationEndpointTokens) != index+1 {
return fmt.Errorf("Cannot resolve path %s on Interface %s", interfacePath, astarteInterface.Name)
}
}
// This token is valid.
}
} else {
// Just verify in which range we're moving
if len(interfacePathTokens) == len(validationEndpointTokens) && interfacePath != "/" {
// Is the path valid?
return simpleMappingValidation(astarteInterface, interfacePath)
}
}
} else {
// Ensure we're matching exactly one of the mappings.
if !astarteInterface.IsParametric() {
return simpleMappingValidation(astarteInterface, interfacePath)
}
for _, mapping := range astarteInterface.Mappings {
mappingTokens := strings.Split(mapping.Endpoint, "/")
if len(mappingTokens) != len(interfacePathTokens) {
continue
}
// Iterate
matchFound := true
for index, token := range mappingTokens {
if interfacePathTokens[index] != token && !strings.HasPrefix(token, "%{") {
matchFound = false
break
}
}
if matchFound {
return nil
}
}
return fmt.Errorf("Path %s does not exist on Interface %s", interfacePath, astarteInterface.Name)
}
// The path is valid
return nil
}
func simpleMappingValidation(astarteInterface common.AstarteInterface, interfacePath string) error {
// Is the path valid?
for _, mapping := range astarteInterface.Mappings {
if mapping.Endpoint == interfacePath {
return nil
}
}
return fmt.Errorf("Path %s does not exist on Interface %s", interfacePath, astarteInterface.Name)
}
| 34.372093 | 125 | 0.714479 |
c185abcf79635fa418817f770c5276a05152a61d | 8,606 | dart | Dart | APP(Android)/lib/components/customized_bar_chart.dart | jonginj0130/SW21_OSAM_HACKATHON_FINAL | da803bf76c02a727e3600b9a3bc784cf6719d5d1 | [
"MIT"
] | null | null | null | APP(Android)/lib/components/customized_bar_chart.dart | jonginj0130/SW21_OSAM_HACKATHON_FINAL | da803bf76c02a727e3600b9a3bc784cf6719d5d1 | [
"MIT"
] | null | null | null | APP(Android)/lib/components/customized_bar_chart.dart | jonginj0130/SW21_OSAM_HACKATHON_FINAL | da803bf76c02a727e3600b9a3bc784cf6719d5d1 | [
"MIT"
] | 2 | 2021-12-17T14:52:07.000Z | 2022-03-24T10:07:13.000Z | import 'dart:async';
import 'dart:math';
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:mypt/theme.dart';
import 'package:mypt/models/workout_result.dart';
class CustomizedBarChart extends StatefulWidget {
CustomizedBarChart({Key? key, required this.workoutResult}) : super(key: key);
WorkoutResult workoutResult;
@override
State<StatefulWidget> createState() => CustomizedBarChartState();
}
class CustomizedBarChartState extends State<CustomizedBarChart> {
final Color barBackgroundColor = const Color(0xff72d8bf);
final Duration animDuration = const Duration(milliseconds: 250);
late List<String> feedbackNames;
int touchedIndex = -1;
bool isPlaying = false;
late int maxFeedback;
@override
initState() {
super.initState();
if(widget.workoutResult.workoutName == 'push_up'){
feedbackNames = pushUpFeedbackNames;
} else if(widget.workoutResult.workoutName == 'pull_up'){
feedbackNames = pullUpFeedbackNames;
} else { // squat
feedbackNames = squatFeedbackNames;
}
}
@override
Widget build(BuildContext context) {
return AspectRatio(
aspectRatio: 1,
child: Card(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(18)),
color: const Color(0xff81e5cd),
child: Stack(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
const Text(
'운동 분석 결과',
style: TextStyle(
color: Color(0xff0f4a3c),
fontSize: 18,
fontWeight: FontWeight.bold),
),
const SizedBox(
height: 4,
),
Text(
'${widget.workoutResult.workoutName}', // 서버에서 운동 종목 받아야 함
style: const TextStyle(
color: Color(0xff379982),
fontSize: 14,
fontWeight: FontWeight.bold),
),
const SizedBox(
height: 38,
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: BarChart(
mainBarData(),
swapAnimationDuration: animDuration,
),
),
),
const SizedBox(
height: 12,
),
],
),
),
],
),
),
);
}
BarChartGroupData makeGroupData(
int x,
double y, {
bool isTouched = false,
Color barColor = Colors.white,
double width = 22,
List<int> showTooltips = const [],
}) {
return BarChartGroupData(
x: x,
barRods: [
BarChartRodData(
y: isTouched ? y + 1 : y,
colors: isTouched ? [Colors.yellow] : [barColor],
width: width,
borderSide: isTouched
? BorderSide(color: Colors.yellow, width: 1)
: const BorderSide(color: Colors.white, width: 0),
backDrawRodData: BackgroundBarChartRodData(
show: true,
y: widget.workoutResult.count!.toDouble(),
colors: [barBackgroundColor],
),
),
],
showingTooltipIndicators: showTooltips,
);
}
// 서버에서 값 받아오기
List<BarChartGroupData> showingGroups() => List.generate(widget.workoutResult.feedbackCounts!.length, (i) {
switch (i) {
case 0:
return makeGroupData(0, widget.workoutResult.feedbackCounts![i].toDouble(), isTouched: i == touchedIndex);
case 1:
return makeGroupData(1, widget.workoutResult.feedbackCounts![i].toDouble(), isTouched: i == touchedIndex);
case 2:
return makeGroupData(2, widget.workoutResult.feedbackCounts![i].toDouble(), isTouched: i == touchedIndex);
case 3:
return makeGroupData(3, widget.workoutResult.feedbackCounts![i].toDouble(), isTouched: i == touchedIndex);
case 4:
return makeGroupData(4, widget.workoutResult.feedbackCounts![i].toDouble(), isTouched: i == touchedIndex);
case 5:
return makeGroupData(5, widget.workoutResult.feedbackCounts![i].toDouble(), isTouched: i == touchedIndex);
default:
return throw Error();
}
});
BarChartData mainBarData() {
return BarChartData(
maxY: widget.workoutResult.count!.toDouble(),
barTouchData: BarTouchData(
touchTooltipData: BarTouchTooltipData(
tooltipBgColor: Colors.blueGrey,
getTooltipItem: (group, groupIndex, rod, rodIndex) {
String weekDay;
switch (group.x.toInt()) {
case 0:
weekDay = feedbackNames[0];
break;
case 1:
weekDay = feedbackNames[1];
break;
case 2:
weekDay = feedbackNames[2];
break;
case 3:
weekDay = feedbackNames[3];
break;
case 4:
weekDay = feedbackNames[4];
break;
case 5:
weekDay = feedbackNames[5];
break;
default:
throw Error();
}
return BarTooltipItem(
weekDay + '\n',
const TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 14,
),
children: <TextSpan>[
TextSpan(
text: (rod.y - 1).toString(),
style: const TextStyle(
color: Colors.yellow,
fontSize: 12,
fontWeight: FontWeight.w500,
),
),
],
);
}),
touchCallback: (FlTouchEvent event, barTouchResponse) {
setState(() {
if (!event.isInterestedForInteractions ||
barTouchResponse == null ||
barTouchResponse.spot == null) {
touchedIndex = -1;
return;
}
touchedIndex = barTouchResponse.spot!.touchedBarGroupIndex;
});
},
),
titlesData: FlTitlesData(
show: true,
rightTitles: SideTitles(showTitles: false),
topTitles: SideTitles(showTitles: false),
bottomTitles: SideTitles(
showTitles: true,
getTextStyles: (context, value) => const TextStyle(
color: Colors.black54, fontWeight: FontWeight.bold, fontSize: 12),
margin: 16,
getTitles: (double value) {
switch (value.toInt()) {
case 0:
return feedbackNames[0];
case 1:
return feedbackNames[1];
case 2:
return feedbackNames[2];
case 3:
return feedbackNames[3];
case 4:
return feedbackNames[4];
case 5:
return feedbackNames[5];
default:
return feedbackNames[0];
}
},
),
leftTitles: SideTitles(
showTitles: false,
),
),
borderData: FlBorderData(
show: false,
),
barGroups: showingGroups(),
gridData: FlGridData(show: false),
);
}
Future<dynamic> refreshState() async {
setState(() {});
await Future<dynamic>.delayed(
animDuration + const Duration(milliseconds: 50));
if (isPlaying) {
await refreshState();
}
}
}
List<String> pushUpFeedbackNames = [
'이완X',
'수축X',
'골반이\n올라감',
'골반이\n내려감',
'무릎이\n내려감',
'운동속도\n빠름',
];
List<String> pullUpFeedbackNames = [
'이완X',
'수축X',
'팔이\n흔들림',
'반동을\n사용함',
'운동속도가\n빠름',
];
List<String> squatFeedbackNames = [
'이완X',
'수축X',
'엉덩이가\n먼저 수축',
'무릎이\n먼저 수축',
'무릎이\n앞으로 나옴',
'운동속도가\n빠름',
]; | 30.956835 | 118 | 0.50918 |
65db0946ed7d1d63cef22a76a60479a3b5c7c527 | 3,825 | rs | Rust | portfolio/src/cli.rs | rcjmurillo/crypto-portfolio | 3032bb100159875b5730da440b008d1e46df7539 | [
"MIT"
] | null | null | null | portfolio/src/cli.rs | rcjmurillo/crypto-portfolio | 3032bb100159875b5730da440b008d1e46df7539 | [
"MIT"
] | null | null | null | portfolio/src/cli.rs | rcjmurillo/crypto-portfolio | 3032bb100159875b5730da440b008d1e46df7539 | [
"MIT"
] | null | null | null | use std::{
ffi::{OsStr, OsString},
fs::{read_to_string, File},
path::PathBuf,
};
use anyhow::{anyhow, Context, Error as AnyhowError, Result};
use chrono::NaiveDate;
use serde::Deserialize;
use structopt::{self, StructOpt};
use toml;
use crate::errors::Error;
use binance::Config as BinanceConfig;
use coinbase::Config as CoinbaseConfig;
use exchange::{Asset, AssetPair};
fn read_config_file(path: &OsStr) -> std::result::Result<Config, OsString> {
match Config::from_file_path(path.into()) {
Ok(config) => Ok(config),
Err(err) => Err(err.to_string().into()),
}
}
fn read_file(path: &OsStr) -> std::result::Result<File, OsString> {
match File::open(path) {
Ok(file) => Ok(file),
Err(err) => Err(err.to_string().into()),
}
}
#[derive(Debug, Clone, Deserialize)]
pub struct ExchangeConfig {
// all the asset pairs to work with, only asset pairs included here will
// appear in the report.
pub symbols: Option<Vec<String>>,
pub assets: Option<Vec<Asset>>,
// How far back to look for transactions
start_date: toml::Value,
}
impl ExchangeConfig {
pub fn start_date(&self) -> Result<NaiveDate> {
if let Some(start_date) = self.start_date.as_datetime() {
Ok(start_date.to_string().parse::<NaiveDate>().unwrap())
} else {
return Err(anyhow!("could not parse date from config").context(Error::Cli));
}
}
}
#[derive(Deserialize)]
pub struct Config {
// allow to specify a configuration per exchange
pub binance: Option<ExchangeConfig>,
pub binance_us: Option<ExchangeConfig>,
pub coinbase: Option<ExchangeConfig>,
pub coinbase_pro: Option<ExchangeConfig>,
}
impl Config {
pub fn from_file_path(file_path: PathBuf) -> Result<Self> {
let contents = read_to_string(file_path.clone()).map_err(|e| {
anyhow!(Error::Cli).context(format!(
"couldn't read config file: {:?} error: {}",
file_path, e
))
})?;
toml::from_str(contents.as_str()).map_err(|e| {
anyhow!(Error::Cli).context(format!(
"couldn't parse config file: {:?} error: {}",
file_path, e
))
})
}
}
impl TryFrom<ExchangeConfig> for BinanceConfig {
type Error = AnyhowError;
fn try_from(c: ExchangeConfig) -> Result<Self> {
Ok(Self {
start_date: c.start_date()?,
symbols: c
.symbols
.ok_or_else(|| anyhow!("missing symbols in binance config"))?
.iter()
.map(|s| AssetPair::try_from_str(&s))
.collect::<Result<Vec<AssetPair>>>()?,
})
}
}
impl TryFrom<ExchangeConfig> for CoinbaseConfig {
type Error = AnyhowError;
fn try_from(c: ExchangeConfig) -> Result<Self> {
Ok(Self {
start_date: c.start_date()?,
// fixme: decide which one to use by check if c.symbols or c.assets is present
symbols: c
.assets
.ok_or_else(|| anyhow!("missing assets in binance config"))?
.clone(),
})
}
}
#[derive(StructOpt)]
pub enum PortfolioAction {
Balances,
Sync,
RevenueReport {
#[structopt(long)]
asset: Option<String>,
},
}
#[derive(StructOpt)]
#[structopt(rename_all = "kebab-case")]
pub enum Args {
Portfolio {
/// Action to run
#[structopt(subcommand)]
action: PortfolioAction,
/// Configuration file
#[structopt(short, long, parse(try_from_os_str = read_config_file))]
config: Config,
/// Operations file in JSON format
#[structopt(long = "custom-ops", parse(try_from_os_str = read_file))]
ops_file: Option<File>,
},
}
| 28.977273 | 90 | 0.590065 |
5f0615625cfffdcdaf36cb042af0ba8e40d2bd7d | 1,586 | ts | TypeScript | src/templates/universal/changelog.template.ts | raymonschouwenaar/cgx | d2e86ff8626d57b744e326e0271076548d935334 | [
"MIT"
] | null | null | null | src/templates/universal/changelog.template.ts | raymonschouwenaar/cgx | d2e86ff8626d57b744e326e0271076548d935334 | [
"MIT"
] | null | null | null | src/templates/universal/changelog.template.ts | raymonschouwenaar/cgx | d2e86ff8626d57b744e326e0271076548d935334 | [
"MIT"
] | 1 | 2019-08-13T05:26:59.000Z | 2019-08-13T05:26:59.000Z | import { injectable, inject } from 'inversify';
import { DefaultTemplate } from '../default/default.template';
import { FileName } from '../../models/file';
import { CommitData } from '../../models/commit-data';
import * as childProcess from 'child_process';
@injectable()
export class Changelog {
private fileName = FileName.CHANGELOG;
constructor(@inject('DefaultTemplate') private defaultTemplate: DefaultTemplate) {}
public generateFile(): void {
this.defaultTemplate.generateFile(this.fileName, this.generateFileContent());
}
private generateFileContent(): string {
const gitLogCommand: string = 'git log --pretty=format:"%h%n%d%n%an%n%s%n%ai%n%b%ae%n%n" --no-merges -z';
const gitLog: string = childProcess.execSync(gitLogCommand).toString().trim();
return this.JSONToMarkdown(gitLog).replace(/,/g, '');
};
private JSONToMarkdown(gitLog: string): string {
const newLine: string = '\n';
const json = this.gitLogToJSON(gitLog);
return `# Changelog
` + json.map((commit: CommitData) => {
return `__Commit:__ [${commit.hash}](${commit.hash}):
__Message:__ ${commit.message}
__Author:__ ${commit.author} on ${commit.date} ${newLine} ${newLine}`;
})
};
private gitLogToJSON(gitLog: string): CommitData[] {
return gitLog.split('\0').map((commit: any) => {
const commitParts = commit.split('\n');
const [hash, , author, message, date, mail] = commitParts;
return {hash, author, message, date, mail};
});
};
}
| 36.045455 | 113 | 0.635561 |
22959193a56feebf28ac73c48bad3269b5813562 | 5,533 | asm | Assembly | research/02/TestControl.asm | NNNIC/psgg-nasm-sample | dfe5454f73ae3b9d86756548f5dffbedc1a03808 | [
"MIT"
] | null | null | null | research/02/TestControl.asm | NNNIC/psgg-nasm-sample | dfe5454f73ae3b9d86756548f5dffbedc1a03808 | [
"MIT"
] | null | null | null | research/02/TestControl.asm | NNNIC/psgg-nasm-sample | dfe5454f73ae3b9d86756548f5dffbedc1a03808 | [
"MIT"
] | null | null | null | global _main
extern _GetStdHandle@4
extern _WriteFile@20
extern _ExitProcess@4
section .text
_main:
; DWORD bytes;
; <- prepare local variable
mov ebp, esp
sub esp, 4
; hStdOut = GetStdHandle(STD_OUTPUT_HANDLE)
; (STD_OUTPUT_HANDLE = -11)
push -11
call _GetStdHandle@4
mov ebx, eax
; WriteFile( hStdOut, msg, length(msg), &size, 0)
push 0
lea eax, [ebp - 4]
push eax
push (message_end - message)
push message
push ebx
call _WriteFile@20
; ExitProcess(0)
push 0
call _ExitProcess@4
; never here
hlt
message:
db 'Hello, World', 10
message_end:
//== Declear States ==
// [STATEGO OUTPUT START] $/^S_/->#static$
// psggConverterLib.dll converted from psgg-file:TestControl.psgg
static void S_0001(bool bFirst);
static void S_0002(bool bFirst);
static void S_0003(bool bFirst);
static void S_END(bool bFirst);
static void S_GOSUB1(bool bFirst);
static void S_LOOP1(bool bFirst);
static void S_LOOP1_LoopCheckAndGosub____(bool bFirst);
static void S_LOOP1_LoopCheckAndGosub____(bool bFirst);
static void S_LOOP1_LoopNext____(bool bFirst);
static void S_RETURN1(bool bFirst);
static void S_RETURN2(bool bFirst);
static void S_START(bool bFirst);
static void S_SUBSTART1(bool bFirst);
static void S_SUBSTART2(bool bFirst);
// [STATEGO OUTPUT END]
// == manager ==
static void *m_curfunc = NULL;
static void *m_nextfunc= NULL;
static bool m_bNoWait = false;
const int MAX_CALL_STACK = 10;
static void *m_callstack[10];
static int m_callstack_level = 0;
static void update() {
while(true) {
bool bFirst = false;
if (m_nextfunc!=NULL) {
m_curfunc = m_nextfunc;
m_nextfunc = NULL;
bFirst = true;
}
m_bNoWait = false;
if (m_curfunc!=NULL) {
void (*func)(bool);
func = m_curfunc;
(*func)(bFirst);
}
if (m_bNoWait == false) break;
}
}
static void Goto(void *st) {
m_nextfunc = st;
}
static bool CheckState(void *st) {
return m_curfunc == st;
}
static bool HasNextState() {
return m_nextfunc != NULL;
}
static void NoWait()
{
m_bNoWait = true;
}
static void GoSubState(void *sub, void *next)
{
if (m_callstack_level >= MAX_CALL_STACK-1)
{
printf("CALL STACK OVER FLOW\n");
exit(1);
}
m_callstack[m_callstack_level++] = next;
Goto(sub);
}
static void ReturnState()
{
void *st = NULL;
if (m_callstack_level <= 0)
{
printf("CALL STACK UNDER FLOW\n");
exit(1);
}
m_callstack_level--;
st = m_callstack[m_callstack_level];
Goto(st);
}
// [STATEGO OUTPUT START] $/^E_/$
// psggConverterLib.dll converted from psgg-file:TestControl.psgg
/*
E_0001
new embed code
*/
static int m_I;
// [STATEGO OUTPUT END]
// [STATEGO OUTPUT START] $/^S_/$
// psggConverterLib.dll converted from psgg-file:TestControl.psgg
/*
S_0001
*/
void S_0001(bool bFirst)
{
if (bFirst)
{
printf("StateGo is running\n");
}
if (!HasNextState())
{
Goto(S_GOSUB1);
}
}
/*
S_0002
*/
void S_0002(bool bFirst)
{
if (bFirst)
{
printf("A Subroutine is running\n");
}
if (!HasNextState())
{
Goto(S_RETURN1);
}
}
/*
S_0003
*/
void S_0003(bool bFirst)
{
if (bFirst)
{
printf("Loop Cointer : %d\n", m_I );
}
if (!HasNextState())
{
Goto(S_RETURN2);
}
}
/*
S_END
*/
void S_END(bool bFirst)
{
}
/*
S_GOSUB1
*/
void S_GOSUB1(bool bFirst)
{
GoSubState(S_SUBSTART1,S_LOOP1);
NoWait();
}
/*
S_LOOP1
Loop 0 to 9
*/
void S_LOOP1(bool bFirst)
{
m_I = 0;
Goto(S_LOOP1_LoopCheckAndGosub____);
NoWait();
}
void S_LOOP1_LoopCheckAndGosub____(bool bFirst)
{
if (m_I < 10) GoSubState(S_SUBSTART2,S_LOOP1_LoopNext____);
else Goto(S_END);
NoWait();
}
void S_LOOP1_LoopNext____(bool bFirst)
{
m_I ++;
Goto(S_LOOP1_LoopCheckAndGosub____);
NoWait();
}
/*
S_RETURN1
*/
void S_RETURN1(bool bFirst)
{
ReturnState();
NoWait();
}
/*
S_RETURN2
*/
void S_RETURN2(bool bFirst)
{
ReturnState();
NoWait();
}
/*
S_START
*/
void S_START(bool bFirst)
{
Goto(S_0001);
NoWait();
}
/*
S_SUBSTART1
*/
void S_SUBSTART1(bool bFirst)
{
if (!HasNextState())
{
Goto(S_0002);
}
}
/*
S_SUBSTART2
*/
void S_SUBSTART2(bool bFirst)
{
if (!HasNextState())
{
Goto(S_0003);
}
}
// [STATEGO OUTPUT END]
// externs
extern void TestControl_start()
{
Goto(S_START);
}
extern void TestControl_update()
{
update();
}
extern bool TestControl_is_end()
{
return CheckState(S_END);
}
| 19.07931 | 81 | 0.528104 |
80432a57c66eba31902429b7eff7c0c483b8c94a | 69 | sql | SQL | Instructor-Resources/Session 1/Demos/2_ModifyService_Objective.sql | pdmih/AzureSQLDatawarehouse | 6deb28ae3eb08319f382939583c585cc2ab6550d | [
"MIT"
] | null | null | null | Instructor-Resources/Session 1/Demos/2_ModifyService_Objective.sql | pdmih/AzureSQLDatawarehouse | 6deb28ae3eb08319f382939583c585cc2ab6550d | [
"MIT"
] | null | null | null | Instructor-Resources/Session 1/Demos/2_ModifyService_Objective.sql | pdmih/AzureSQLDatawarehouse | 6deb28ae3eb08319f382939583c585cc2ab6550d | [
"MIT"
] | null | null | null | ALTER DATABASE AdventureWorksDW
MODIFY(service_objective = 'DW100')
; | 23 | 35 | 0.826087 |
928cfe1c9d347afed637b2cdd9c901391168619b | 966 | h | C | include/il2cpp/Dpr/Battle/Logic/Net/Client/SendToClientReq.h | martmists-gh/BDSP | d6326c5d3ad9697ea65269ed47aa0b63abac2a0a | [
"MIT"
] | 1 | 2022-01-15T20:20:27.000Z | 2022-01-15T20:20:27.000Z | include/il2cpp/Dpr/Battle/Logic/Net/Client/SendToClientReq.h | martmists-gh/BDSP | d6326c5d3ad9697ea65269ed47aa0b63abac2a0a | [
"MIT"
] | null | null | null | include/il2cpp/Dpr/Battle/Logic/Net/Client/SendToClientReq.h | martmists-gh/BDSP | d6326c5d3ad9697ea65269ed47aa0b63abac2a0a | [
"MIT"
] | null | null | null | #pragma once
#include "il2cpp.h"
int32_t Dpr_Battle_Logic_Net_Client_SendToClientReq__GetDivNum (Dpr_Battle_Logic_Net_Client_SendToClientReq_o __this, const MethodInfo* method_info);
bool Dpr_Battle_Logic_Net_Client_SendToClientReq__GetOfs (Dpr_Battle_Logic_Net_Client_SendToClientReq_o __this, int32_t* outOfs, int32_t* outBytes, int32_t index, const MethodInfo* method_info);
int32_t Dpr_Battle_Logic_Net_Client_SendToClientReq__GetDivNum (int32_t size, const MethodInfo* method_info);
bool Dpr_Battle_Logic_Net_Client_SendToClientReq__GetOfs (int32_t* outOfs, int32_t* outBytes, int32_t size, int32_t index, const MethodInfo* method_info);
void Dpr_Battle_Logic_Net_Client_SendToClientReq__Set (Dpr_Battle_Logic_Net_Client_SendToClientReq_o __this, uint64_t pSendBuf, int32_t sendSize, const MethodInfo* method_info);
void Dpr_Battle_Logic_Net_Client_SendToClientReq__Clear (Dpr_Battle_Logic_Net_Client_SendToClientReq_o __this, const MethodInfo* method_info);
| 87.818182 | 194 | 0.885093 |
afaa62f59b6b4f934debb817b0c13d1b0a4e4f61 | 466 | rb | Ruby | lib/yomou/commands/clean/novel.rb | kenhys/yomou | fcd5796397a622349560bb16e019304146fe448c | [
"MIT"
] | null | null | null | lib/yomou/commands/clean/novel.rb | kenhys/yomou | fcd5796397a622349560bb16e019304146fe448c | [
"MIT"
] | null | null | null | lib/yomou/commands/clean/novel.rb | kenhys/yomou | fcd5796397a622349560bb16e019304146fe448c | [
"MIT"
] | null | null | null | # frozen_string_literal: true
require_relative '../../command'
require_relative '../../cleaner'
module Yomou
module Commands
class Clean
class Novel < Yomou::Command
def initialize(type_or_path, options)
@type = type_or_path
@options = options
end
def execute(input: $stdin, output: $stdout)
cleaner = Yomou::NovelCleaner.new
cleaner.clean(@type)
end
end
end
end
end
| 20.26087 | 51 | 0.607296 |
6d8aaf64a441c441aed5d27d20e0b24f6ded0abf | 1,099 | kt | Kotlin | buildSrc/src/main/kotlin/karakum/popper/Enums.kt | JervNorsk/types-kotlin | ea7261ca0fac6ef75a3d5139e4765a286e638a4e | [
"Apache-2.0"
] | 9 | 2021-08-16T07:42:18.000Z | 2021-09-24T08:04:03.000Z | buildSrc/src/main/kotlin/karakum/popper/Enums.kt | karakum-team/react-types-kotlin | 940a93bb5b3093184916c9c39fbd530eb444be15 | [
"Apache-2.0"
] | null | null | null | buildSrc/src/main/kotlin/karakum/popper/Enums.kt | karakum-team/react-types-kotlin | 940a93bb5b3093184916c9c39fbd530eb444be15 | [
"Apache-2.0"
] | 2 | 2022-01-25T23:46:40.000Z | 2022-03-25T09:11:51.000Z | package karakum.popper
import karakum.common.unionBody
internal fun enums(): Sequence<ConversionResult> =
sequenceOf(
enum(
"ModifierPhases",
"beforeRead",
"read",
"afterRead",
"beforeMain",
"main",
"afterMain",
"beforeWrite",
"write",
"afterWrite",
),
enum(
"Placement",
"auto",
"auto-start",
"auto-end",
"top",
"top-start",
"top-end",
"bottom",
"bottom-start",
"bottom-end",
"right",
"right-start",
"right-end",
"left",
"left-start",
"left-end",
),
enum(
"PositioningStrategy",
"absolute",
"fixed",
),
)
private fun enum(
name: String,
vararg values: String,
): ConversionResult =
ConversionResult(
name = name,
body = unionBody(name, values.toList()),
)
| 19.981818 | 50 | 0.413103 |
477e3be42744785a88345cf3a857cb4724c19b4f | 940 | html | HTML | src/app/admin-pages/public-users/view-user-info/view-user-info.component.html | CruSea/karokore_mkc_frontend | c73777d2efc6f3598eb69fd63f20fd842952f05f | [
"MIT"
] | null | null | null | src/app/admin-pages/public-users/view-user-info/view-user-info.component.html | CruSea/karokore_mkc_frontend | c73777d2efc6f3598eb69fd63f20fd842952f05f | [
"MIT"
] | 14 | 2020-05-06T19:49:08.000Z | 2022-02-26T22:59:05.000Z | src/app/admin-pages/public-users/view-user-info/view-user-info.component.html | CruSea/weletemwc_frontend | b1ea7c33f2bad73ca909afc5ee631412ffcc8d20 | [
"MIT"
] | null | null | null | <form>
<div class="modal-body">
<h5 class="text-center">Detail</h5>
<div class="form-label-group">
<mat-form-field class="example-full-width">
<input matInput [readonly]="!editable" placeholder="Full Name" [(ngModel)]="selected_user_data.full_name" name="full_name">
</mat-form-field>
</div>
<div class="form-label-group">
<mat-form-field class="example-full-width">
<input matInput [readonly]="!editable" placeholder="Email" [(ngModel)]="selected_user_data.email" name="email" >
</mat-form-field>
<mat-form-field class="example-full-width">
<input matInput [readonly]="!editable" placeholder="Phone" [(ngModel)]="selected_user_data.phone" name="phone">
</mat-form-field>
</div>
<div class="form-label-group">
<button mat-raised-button type="button" (click)="cancel()" class="btn btn-danger pull-right">Cancel</button>
</div>
</div>
</form> | 42.727273 | 132 | 0.644681 |
2f7ce4cc937b18b1e9826385334081362a87a655 | 512 | sql | SQL | dist/circ/checkouts-and-renewals-in-date-range.sql | cityplymlibrary/koha-reports | dcadb25f3619f647affd0999e7b5a43af813d79e | [
"Apache-2.0"
] | null | null | null | dist/circ/checkouts-and-renewals-in-date-range.sql | cityplymlibrary/koha-reports | dcadb25f3619f647affd0999e7b5a43af813d79e | [
"Apache-2.0"
] | null | null | null | dist/circ/checkouts-and-renewals-in-date-range.sql | cityplymlibrary/koha-reports | dcadb25f3619f647affd0999e7b5a43af813d79e | [
"Apache-2.0"
] | null | null | null | SELECT borrowers.cardnumber,borrowers.surname,borrowers.firstname,statistics.datetime,statistics.type,items.barcode,items.itype
FROM borrowers
LEFT JOIN statistics on (statistics.borrowernumber=borrowers.borrowernumber)
LEFT JOIN items on (items.itemnumber = statistics.itemnumber)
LEFT JOIN biblioitems on (biblioitems.biblioitemnumber = items.biblioitemnumber)
WHERE statistics.datetime BETWEEN <<Checked out BETWEEN (yyyy-mm-dd)|date>>
AND <<and (yyyy-mm-dd)|date>> AND statistics.type IN ('issue','renew')
| 64 | 128 | 0.816406 |
4a36b76a687d042ff0c78759b9ab61082a6d3355 | 761 | swift | Swift | ios/Tests/StringExtensionTests.swift | vsilux/CBCore | 616cc7df0746bef53d212a6cfbaef87806cf4dcc | [
"Apache-2.0"
] | 33 | 2019-10-21T23:44:41.000Z | 2022-03-17T07:44:59.000Z | ios/Tests/StringExtensionTests.swift | ZachT1711/CBCore | 34b9b51a41d2a442bf86c330720e817fa9e90cc1 | [
"Apache-2.0"
] | 4 | 2020-07-27T17:06:49.000Z | 2021-09-16T22:23:52.000Z | ios/Tests/StringExtensionTests.swift | ZachT1711/CBCore | 34b9b51a41d2a442bf86c330720e817fa9e90cc1 | [
"Apache-2.0"
] | 22 | 2019-10-28T10:06:59.000Z | 2022-02-25T17:51:10.000Z | // Copyright (c) 2017-2019 Coinbase Inc. See LICENSE
import XCTest
class StringExtensionTests: XCTestCase {
func testMatches() {
let string = "this is a string"
var matches = string.matches(regex: "(\\w)+")
XCTAssertEqual(matches.count, 4)
matches = string.matches(regex: "(is)+")
XCTAssertEqual(matches.count, 2)
matches = string.matches(regex: "(string)+")
XCTAssertEqual(matches.count, 1)
matches = string.matches(regex: "(thisi)+")
XCTAssertTrue(matches.isEmpty)
matches = string.matches(regex: "(rthis)+")
XCTAssertTrue(matches.isEmpty)
matches = string.matches(regex: "(this is a string and more)+")
XCTAssertTrue(matches.isEmpty)
}
}
| 27.178571 | 71 | 0.626807 |
0a2a1594bab472b12f515e80f05469f13c97dde6 | 159 | lua | Lua | sorce/shmat/shtar_macro.lua | montoyamoraga/shbobo | 3469747603dfead376111f38b455af1250365848 | [
"MIT"
] | 16 | 2020-12-21T04:52:20.000Z | 2022-02-28T10:15:34.000Z | sorce/shmat/shtar_macro.lua | montoyamoraga/shbobo | 3469747603dfead376111f38b455af1250365848 | [
"MIT"
] | 8 | 2021-01-02T01:01:26.000Z | 2021-12-19T01:40:34.000Z | sorce/shmat/shtar_macro.lua | montoyamoraga/shbobo | 3469747603dfead376111f38b455af1250365848 | [
"MIT"
] | 4 | 2021-01-01T15:27:43.000Z | 2021-08-10T21:14:29.000Z |
for i=-32,-1 do
print (".hword",math.floor(math.pow(2,i/17)*256*64))
end
print("\n")
for i=0,31 do
print (".hword",math.floor(math.pow(2,i/17)*256*64))
end
| 17.666667 | 53 | 0.628931 |
340ab015c30c5c7447fca44ac9bdba60d436bf81 | 19,457 | rs | Rust | src/design/implementation/composer/parser.rs | matthijsr/tydi | 9bc4ae74d5a1f70cde6d52807c010ee7396ca465 | [
"Apache-2.0"
] | null | null | null | src/design/implementation/composer/parser.rs | matthijsr/tydi | 9bc4ae74d5a1f70cde6d52807c010ee7396ca465 | [
"Apache-2.0"
] | 26 | 2021-09-06T04:29:55.000Z | 2022-02-16T04:23:42.000Z | src/design/implementation/composer/parser.rs | matthijsr/tydi | 9bc4ae74d5a1f70cde6d52807c010ee7396ca465 | [
"Apache-2.0"
] | 1 | 2021-09-21T14:26:19.000Z | 2021-09-21T14:26:19.000Z | use std::collections::HashMap;
use std::convert::{TryFrom, TryInto};
use std::ops::Deref;
use std::rc::Rc;
use pest::{Parser, RuleType};
use pest::iterators::Pair;
use crate::{Error, Name, Result, Reversed, UniqueKeyBuilder};
use crate::design::{
GEN_LIB, IFKey, LibKey, Library, Mode, NodeIFHandle, NodeKey, Project, Streamlet,
StreamletHandle, StreamletKey,
};
use crate::design::implementation::composer::impl_graph::{Edge, ImplementationGraph, Node};
use crate::design::implementation::composer::GenericComponent;
use crate::design::implementation::composer::patterns::{FilterStream, MapStream, ReduceStream};
use crate::design::implementation::Implementation;
use crate::design::implementation::Implementation::Structural;
use crate::error::LineErr;
#[derive(Parser)]
#[grammar = "design/implementation/composer/impl.pest"]
pub struct ImplDef;
pub trait LineNum {
fn line_num(&self) -> usize;
}
impl<'i, R: RuleType> LineNum for Pair<'i, R> {
fn line_num(&self) -> usize {
self.as_span().start_pos().line_col().0
}
}
fn match_rule<T>(
pair: Pair<Rule>,
rule: Rule,
mut f: impl FnMut(Pair<Rule>) -> Result<T>,
) -> Result<T> {
if pair.as_rule() == rule {
f(pair)
} else {
Err(Error::ImplParsingError(LineErr::new(
pair.line_num(),
format!("Expected: \"{:?}\", Actual: \"{:?}\"", rule, pair),
)))
}
}
pub struct ImplParser<'i> {
project: &'i mut Project,
body: Pair<'i, Rule>,
imp: Implementation,
}
impl<'i> ImplParser<'i> {
pub fn try_new(project: &'i mut Project, input: &'i str) -> Result<Self> {
let pair = ImplDef::parse(Rule::implementation, input)
.map_err(|e| {
Error::ImplParsingError(LineErr::new(
0,
format!("Implementation parsing error: {}", e),
))
})?
.next()
.unwrap();
let mut pairs = pair.into_inner();
let streamlet_handle: StreamletHandle = pairs.next().unwrap().try_into()?;
//let pair = pairs.next().unwrap();
let s = project
.get_lib(streamlet_handle.lib())?
.get_streamlet(streamlet_handle.streamlet())?
.clone();
let gen_lib = Library::new(LibKey::try_new(GEN_LIB).unwrap());
project.add_lib(gen_lib)?;
//Create a streamlet with reversed interfaces
let this_streamlet = Streamlet::from_builder(
StreamletKey::try_from(s.key()).unwrap(),
UniqueKeyBuilder::new().with_items(s.interfaces().map(|i| i.deref().reversed())),
None,
)?;
Ok(ImplParser {
project,
//Safe to unwrap, Pest guarantees that there's an implementation body.
body: pairs.next().unwrap(),
imp: Implementation::Structural(ImplementationGraph {
streamlet: streamlet_handle,
edges: vec![],
nodes: vec![(
NodeKey::this(),
Node {
key: NodeKey::this(),
item: Rc::new(this_streamlet.clone()),
},
)]
.into_iter()
.collect::<HashMap<NodeKey, Node>>(),
}),
})
}
pub fn transform_body(&mut self) -> Result<()> {
match &mut self.body.as_rule() {
Rule::structural => self.transform_structural(),
_ => unimplemented!(),
}
}
pub fn transform_structural(&mut self) -> Result<()> {
//Step to structural_body
let pair = self.body.clone().into_inner().next().unwrap();
//structural_body inner
//let pair = pair.into_inner().next().unwrap();
for pair in pair.into_inner() {
match &pair.as_rule() {
Rule::node => {
let node_tuple = self.transform_node(pair)?;
let node = node_tuple.1;
self.insert_node(node)?;
for edges in node_tuple.3 {
self.connect(edges)?;
}
}
Rule::connection => {
let edge = Edge::try_from(pair)?;
self.connect(edge)?
}
Rule::chain_connection => {
self.transform_chain_connection(pair)?;
}
_ => unimplemented!(),
}
}
Ok(())
}
pub fn transform_node(
&mut self,
pair: Pair<Rule>,
) -> Result<(Name, Node, StreamletHandle, Vec<Edge>)> {
//{ ident ~ ":" ~ (pattern | streamlet_inst) }
let mut pairs = pair.into_inner();
//ident
let name_pair = pairs.next().unwrap();
let key = Name::try_from(name_pair).unwrap();
//(pattern | streamlet_inst)
let pair = pairs.next().unwrap();
match pair.as_rule() {
Rule::streamlet_inst => {
let node_tuple = self.transform_streamlet_inst(pair, key.clone())?;
let node = Node {
key: key.clone(),
item: node_tuple.0,
};
Ok((key.clone(), node, node_tuple.1, Vec::new()))
}
Rule::pattern => {
let node_tuple = self.transform_pattern(pair, key.clone())?;
let node = Node {
key: key.clone(),
item: node_tuple.0,
};
Ok((key.clone(), node, node_tuple.1, node_tuple.2))
}
_ => unreachable!(),
}
}
pub fn transform_streamlet_inst(
&mut self,
pair: Pair<Rule>,
_key: Name,
) -> Result<(Rc<dyn GenericComponent>, StreamletHandle, Vec<Edge>)> {
//{ streamlet_handle ~ ("[" ~ (parameter_assign)+ ~ "]")? }
let mut pairs = pair.into_inner();
//streamlet_handle
let streamlet_handle_pair = pairs.next().unwrap();
let streamlet_handle = StreamletHandle::try_from(streamlet_handle_pair)?;
let streamlet = self
.project
.get_lib(streamlet_handle.lib())?
.get_streamlet(streamlet_handle.streamlet())?
.clone();
Ok((Rc::new(streamlet.clone()), streamlet_handle, Vec::new()))
}
pub fn transform_pattern(
&mut self,
pair: Pair<Rule>,
key: Name,
) -> Result<(Rc<dyn GenericComponent>, StreamletHandle, Vec<Edge>)> {
//{ map_stream | filter_stream | reduce_stream }
let pair = pair.into_inner().next().unwrap();
match pair.as_rule() {
Rule::map_stream => self.transform_map_stream(pair, key),
Rule::reduce_stream => self.transform_reduce_stream(pair, key),
Rule::filter_stream => self.transform_filter_stream(pair, key),
_ => unreachable!(),
}
}
pub fn transform_map_stream(
&mut self,
pair: Pair<Rule>,
key: Name,
) -> Result<(Rc<dyn GenericComponent>, StreamletHandle, Vec<Edge>)> {
let op = self.transform_node(pair.into_inner().next().unwrap())?;
let name = Name::try_from(format!("{}_gen", key.to_string()))?;
let mut component = MapStream::try_new(self.project, name.clone(), op.2)?;
component.with_backend(
name.clone(),
StreamletHandle {
lib: Name::try_new(GEN_LIB)?,
streamlet: name.clone(),
},
)?;
let object = component.finish();
let handle = self
.project
.get_lib_mut(Name::try_from(GEN_LIB).unwrap())?
.add_streamlet(object.streamlet().clone())?;
Ok((Rc::new(object), handle, Vec::new()))
}
pub fn transform_reduce_stream(
&mut self,
pair: Pair<Rule>,
key: Name,
) -> Result<(Rc<dyn GenericComponent>, StreamletHandle, Vec<Edge>)> {
let op = self.transform_node(pair.into_inner().next().unwrap())?;
let name = Name::try_from(format!("{}_gen", key.to_string()))?;
let mut component = ReduceStream::try_new(self.project, name.clone(), op.2)?;
component.with_backend(
name.clone(),
StreamletHandle {
lib: Name::try_new(GEN_LIB)?,
streamlet: name.clone(),
},
)?;
let object = component.finish();
let handle = self
.project
.get_lib_mut(Name::try_from(GEN_LIB).unwrap())?
.add_streamlet(object.streamlet().clone())?;
Ok((Rc::new(object), handle, Vec::new()))
}
pub fn transform_filter_stream(
&mut self,
pair: Pair<Rule>,
key: Name,
) -> Result<(Rc<dyn GenericComponent>, StreamletHandle, Vec<Edge>)> {
let predicate = NodeIFHandle::try_from(pair.into_inner().next().unwrap())?;
let name = Name::try_from(format!("{}_gen", key.to_string()))?;
let mut component = FilterStream::try_new(self.project, name.clone())?;
component.with_backend(
name.clone(),
StreamletHandle {
lib: Name::try_new(GEN_LIB)?,
streamlet: name.clone(),
},
)?;
let object = component.finish();
let handle = self
.project
.get_lib_mut(Name::try_from(GEN_LIB).unwrap())?
.add_streamlet(object.streamlet().clone())?;
let edges = vec![Edge {
source: predicate.clone(),
sink: NodeIFHandle {
node: key.clone(),
iface: IFKey::try_new("pred")?,
},
}];
Ok((Rc::new(object), handle, edges))
}
pub fn transform_chain_connection(&mut self, pair: Pair<Rule>) -> Result<()> {
//{ (ident | node_if_handle_list) ~ "<=>" ~ (ident | node_if_handle_list) }
let mut pairs = pair.into_inner();
//(ident | node_if_handle_list)
let pair = pairs.next().unwrap();
let mut src = match pair.as_rule() {
Rule::ident => Name::try_from(pair.clone()),
_ => unimplemented!(),
}?;
for pair in pairs {
let dst = match pair.as_rule() {
Rule::ident => Name::try_from(pair),
_ => unimplemented!(),
}?;
let src_i = match &mut self.imp {
Structural(ref mut s) => {
match s
.get_node(src.clone())?
.component()
.outputs()
.find(|i| i.key().to_string() == "out".to_string())
{
Some(i) => Ok(i.clone()),
None => Err(Error::ComposerError(format!(
"Chain connection left side doesn't have an output interface: {:?}",
src
))),
}
}
_ => unreachable!(),
}?;
let dst_i = match &mut self.imp {
Structural(ref mut s) => {
match s.get_node(dst.clone())?.component().inputs().find(|i| i.key().to_string() == "in".to_string()) {
Some(i) => Ok(i.clone()),
None => Err(Error::ComposerError(format!(
"Chain connection right side doesn't have a matching input interface: {:?}",
dst
))),
}
}
_ => unreachable!(),
}?;
let edge = Edge {
source: NodeIFHandle {
node: src.clone(),
iface: src_i.key().clone(),
},
sink: NodeIFHandle {
node: dst.clone(),
iface: dst_i.key().clone(),
},
};
self.connect(edge)?;
src = dst;
}
Ok(())
}
pub fn connect(&mut self, edge: Edge) -> Result<()> {
match &mut self.imp {
Structural(ref mut s) => {
//Deal with type inferences
let src_if = s
.get_node(edge.clone().source().node)?
.iface(edge.clone().source().iface)?
.deref()
.clone();
let dst_if = s
.get_node(edge.clone().sink().node)?
.iface(edge.clone().sink().iface)?
.deref()
.clone();
let src_type = src_if.typ().clone();
let dst_type = dst_if.typ().clone();
s.get_node(edge.clone().source().node)?
.iface_mut(edge.clone().source().iface)?
.infer_type(dst_type.clone())?;
s.get_node(edge.clone().sink().node)?
.iface_mut(edge.clone().sink().iface)?
.infer_type(src_type.clone())?;
//Run action handlers for connection
s.get_node(edge.clone().source().node)?
.component()
.connect_action()?;
s.get_node(edge.clone().sink().node)?
.component()
.connect_action()?;
//Refresh the data types afgter propagation for checks
let src_if = s
.get_node(edge.clone().source().node)?
.iface(edge.clone().source().iface)?
.deref()
.clone();
let dst_if = s
.get_node(edge.clone().sink().node)?
.iface(edge.clone().sink().iface)?
.deref()
.clone();
if src_if.mode() != Mode::Out {
Err(Error::ComposerError(format!(
"Interface {:?} is not an output.",
edge.clone().source()
)))
} else if dst_if.mode() != Mode::In {
Err(Error::ComposerError(format!(
"Interface {:?} is not an input.",
edge.clone().source()
)))
} else if s.get_edge(edge.clone().source()).is_ok() {
Err(Error::ComposerError(format!(
"Cannot connect {:?} to {:?}, source is already connected.",
edge.clone().sink(),
edge.clone().source()
)))
} else if s.get_edge(edge.clone().sink()).is_ok() {
Err(Error::ComposerError(format!(
"Cannot connect {:?} to {:?}, sink is already connected.",
edge.clone().sink(),
edge.clone().source()
)))
} else if src_if.typ() != dst_if.typ() {
Err(Error::ComposerError(format!(
"Type incompatibility between sink {:?} : {:?}, and source {:?} : {:?}.",
edge.clone().sink(),
dst_type,
edge.clone().source(),
src_type
)))
} else {
s.edges.push(edge);
Ok(())
}?;
}
_ => unreachable!(),
}
Ok(())
}
pub fn insert_node(&mut self, node: Node) -> Result<()> {
match &mut self.imp {
Structural(ref mut s) => match s.nodes.insert(node.clone().key(), node.clone()) {
None => Ok(()),
Some(_lib) => Err(Error::ComposerError(format!(
"Instance {} already exists.",
node.key()
))),
},
_ => unreachable!(),
}
}
pub fn this(&self) -> Node {
match &self.imp {
Structural(s) => {
// We can unwrap safely here because the "this" node should always exist.
s.nodes.get(&NodeKey::this()).unwrap().clone()
}
_ => unreachable!(),
}
}
pub fn finish(self) -> Implementation {
self.imp
}
}
impl<'i> TryFrom<Pair<'i, Rule>> for StreamletHandle {
type Error = Error;
fn try_from(pair: Pair<Rule>) -> Result<Self> {
match_rule(pair, Rule::streamlet_handle, |pair| {
let mut pairs = pair.into_inner();
let lib = pairs.next().unwrap().as_str();
let streamlet = pairs.next().unwrap().as_str();
let lib_key = LibKey::try_from(lib)?;
let streamlet_key = StreamletKey::try_from(streamlet)?;
Ok(StreamletHandle {
lib: lib_key,
streamlet: streamlet_key,
})
})
}
}
impl<'i> TryFrom<Pair<'i, Rule>> for Name {
type Error = Error;
fn try_from(pair: Pair<Rule>) -> Result<Self> {
match_rule(pair.clone(), Rule::ident, |pair| {
Name::try_from(pair.clone().as_str())
})
}
}
impl<'i> TryFrom<Pair<'i, Rule>> for NodeIFHandle {
type Error = Error;
fn try_from(pair: Pair<Rule>) -> Result<Self> {
match_rule(pair, Rule::node_if_handle, |pair| {
let mut pairs = pair.into_inner();
let node = pairs.next().unwrap().as_str();
let node = Name::try_from(node)?;
let iface = pairs.next().unwrap().as_str();
let iface = Name::try_from(iface)?;
Ok(NodeIFHandle { node, iface })
})
}
}
impl<'i> TryFrom<Pair<'i, Rule>> for Edge {
type Error = Error;
fn try_from(pair: Pair<Rule>) -> Result<Self> {
match_rule(pair, Rule::connection, |pair| {
let mut pairs = pair.into_inner();
let sink = NodeIFHandle::try_from(pairs.next().unwrap())?;
let source = NodeIFHandle::try_from(pairs.next().unwrap())?;
Ok(Edge { source, sink })
})
}
}
#[cfg(test)]
pub mod tests {
use std::convert::TryFrom;
use crate::{Name, Result};
use crate::design::implementation::composer::tests::composition_test_proj;
use crate::design::StreamletHandle;
use super::*;
pub fn impl_parser_test() -> Result<Project> {
let mut prj = composition_test_proj()?;
let top_impl = include_str!("../../../../tests/implementations/composition_example.impl");
let mut builder = ImplParser::try_new(&mut prj, &top_impl)?;
builder.transform_body().unwrap();
let imp = builder.finish();
prj.add_streamlet_impl(
StreamletHandle {
lib: Name::try_from("compositions")?,
streamlet: Name::try_from("Top_level")?,
},
imp,
)?;
Ok(prj)
}
#[test]
fn parser() -> Result<()> {
let mut prj = composition_test_proj()?;
let top_impl = include_str!("../../../../tests/implementations/composition_example.impl");
let mut builder = ImplParser::try_new(&mut prj, &top_impl).unwrap();
builder.transform_body().unwrap();
let _imp = builder.finish();
Ok(())
}
}
| 34.806798 | 123 | 0.484967 |
96a3716100cb4fe1cdced01155f2ace8cb661d4b | 2,244 | html | HTML | src/app/navbar/navbar.component.html | yuriimartynenko/angular-todo-employees | 1cb703e75e0d355f06824e6e277c36eb28a42a83 | [
"MIT"
] | null | null | null | src/app/navbar/navbar.component.html | yuriimartynenko/angular-todo-employees | 1cb703e75e0d355f06824e6e277c36eb28a42a83 | [
"MIT"
] | 5 | 2021-05-11T02:17:31.000Z | 2022-03-02T07:14:09.000Z | src/app/navbar/navbar.component.html | yuriimartynenko/angular-todo-employees | 1cb703e75e0d355f06824e6e277c36eb28a42a83 | [
"MIT"
] | null | null | null | <nav class="navbar navbar-dark bg-dark">
<div class="container">
<a class="navbar-brand" href="#">{{active ? $ctrl.titleEmployee : $ctrl.title}}</a>
<form ng-class="{'d-none': active, 'form inline': !active}">
<button type="button" class="btn btn-danger cursor-default" ng-click="$ctrl.employeesService.deleteSelectedEmployees()" ng-disabled="!$ctrl.employeesService.selectCount">
<i class="fas fa-trash-alt"></i>
Delete
<span class="badge badge-pill badge-light text-danger">{{$ctrl.employeesService.selectCount}}</span>
</button>
<button type="button" class="btn btn-success ml-2" ng-click="active = !active">
<i class="fas fa-plus-circle"></i>
Add New Employee
</button>
</form>
<div ng-class="{'collapse show': active, 'collapse': !active}" id="collapseExample">
<form class="form-inline" name="myForm">
<div class="form-row">
<input type="text" class="form-control mr-sm-2 mb-2 mb-lg-0" ng-model="$ctrl.employeeName" placeholder="Name" required>
<input type="number" class="form-control mr-sm-2 mb-2 mb-lg-0" ng-model="$ctrl.employeeSalary" placeholder="Salary (USD)" required>
<input type="number" class="form-control mr-sm-2 mb-2 mb-lg-0" ng-model="$ctrl.employeeAge" placeholder="Age" required>
<div class="col-auto">
<button type="submit" class="btn btn-success"
ng-click="$ctrl.add()"
ng-disabled="myForm.$invalid"
>
<i class="fas fa-check-circle"></i>
Add
</button>
</div>
<div class="col-auto">
<button type="submit" class="btn btn-danger" ng-click="active = !active">
<i class="fas fa-times-circle"></i>
Cancel
</button>
</div>
</div>
</form>
</div>
</div>
</nav> | 56.1 | 182 | 0.49287 |